const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-3wm3rc-X.js","assets/sha3--8JbGYfk.js","assets/utils-CqP-FaiV.js","assets/clsx.m-DHulAg21.js","assets/index-DX3HZbqT.js","assets/events-DQ172AOg.js","assets/index-B8lqC164.js","assets/index-Bgc9HhbY.js","assets/index-fU4ef4IJ.js","assets/index.es-Cxpu7xZ1.js"])))=>i.map(i=>d[i]);
var nQe=Object.defineProperty;var Jfe=t=>{throw TypeError(t)};var rQe=(t,e,n)=>e in t?nQe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gn=(t,e,n)=>rQe(t,typeof e!="symbol"?e+"":e,n),mH=(t,e,n)=>e.has(t)||Jfe("Cannot "+n);var Xe=(t,e,n)=>(mH(t,e,"read from private field"),n?n.call(t):e.get(t)),Un=(t,e,n)=>e.has(t)?Jfe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Xt=(t,e,n,r)=>(mH(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Cr=(t,e,n)=>(mH(t,e,"access private method"),n);var gb=(t,e,n,r)=>({set _(s){Xt(t,e,s,n)},get _(){return Xe(t,e,r)}});function CAe(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Ru=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function sQe(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 xH={exports:{}},$A={},gH={exports:{}},Vi={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ehe;function iQe(){if(ehe)return Vi;ehe=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function x(oe){return oe===null||typeof oe!="object"?null:(oe=f&&oe[f]||oe["@@iterator"],typeof oe=="function"?oe:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,v={};function C(oe,he,_e){this.props=oe,this.context=he,this.refs=v,this.updater=_e||g}C.prototype.isReactComponent={},C.prototype.setState=function(oe,he){if(typeof oe!="object"&&typeof oe!="function"&&oe!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,oe,he,"setState")},C.prototype.forceUpdate=function(oe){this.updater.enqueueForceUpdate(this,oe,"forceUpdate")};function N(){}N.prototype=C.prototype;function I(oe,he,_e){this.props=oe,this.context=he,this.refs=v,this.updater=_e||g}var P=I.prototype=new N;P.constructor=I,y(P,C.prototype),P.isPureReactComponent=!0;var M=Array.isArray,F=Object.prototype.hasOwnProperty,$={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function z(oe,he,_e){var xe,Se={},ge=null,Ce=null;if(he!=null)for(xe in he.ref!==void 0&&(Ce=he.ref),he.key!==void 0&&(ge=""+he.key),he)F.call(he,xe)&&!L.hasOwnProperty(xe)&&(Se[xe]=he[xe]);var je=arguments.length-2;if(je===1)Se.children=_e;else if(1<je){for(var Oe=Array(je),$e=0;$e<je;$e++)Oe[$e]=arguments[$e+2];Se.children=Oe}if(oe&&oe.defaultProps)for(xe in je=oe.defaultProps,je)Se[xe]===void 0&&(Se[xe]=je[xe]);return{$$typeof:t,type:oe,key:ge,ref:Ce,props:Se,_owner:$.current}}function Q(oe,he){return{$$typeof:t,type:oe.type,key:he,ref:oe.ref,props:oe.props,_owner:oe._owner}}function se(oe){return typeof oe=="object"&&oe!==null&&oe.$$typeof===t}function ee(oe){var he={"=":"=0",":":"=2"};return"$"+oe.replace(/[=:]/g,function(_e){return he[_e]})}var K=/\/+/g;function re(oe,he){return typeof oe=="object"&&oe!==null&&oe.key!=null?ee(""+oe.key):he.toString(36)}function de(oe,he,_e,xe,Se){var ge=typeof oe;(ge==="undefined"||ge==="boolean")&&(oe=null);var Ce=!1;if(oe===null)Ce=!0;else switch(ge){case"string":case"number":Ce=!0;break;case"object":switch(oe.$$typeof){case t:case e:Ce=!0}}if(Ce)return Ce=oe,Se=Se(Ce),oe=xe===""?"."+re(Ce,0):xe,M(Se)?(_e="",oe!=null&&(_e=oe.replace(K,"$&/")+"/"),de(Se,he,_e,"",function($e){return $e})):Se!=null&&(se(Se)&&(Se=Q(Se,_e+(!Se.key||Ce&&Ce.key===Se.key?"":(""+Se.key).replace(K,"$&/")+"/")+oe)),he.push(Se)),1;if(Ce=0,xe=xe===""?".":xe+":",M(oe))for(var je=0;je<oe.length;je++){ge=oe[je];var Oe=xe+re(ge,je);Ce+=de(ge,he,_e,Oe,Se)}else if(Oe=x(oe),typeof Oe=="function")for(oe=Oe.call(oe),je=0;!(ge=oe.next()).done;)ge=ge.value,Oe=xe+re(ge,je++),Ce+=de(ge,he,_e,Oe,Se);else if(ge==="object")throw he=String(oe),Error("Objects are not valid as a React child (found: "+(he==="[object Object]"?"object with keys {"+Object.keys(oe).join(", ")+"}":he)+"). If you meant to render a collection of children, use an array instead.");return Ce}function G(oe,he,_e){if(oe==null)return oe;var xe=[],Se=0;return de(oe,xe,"","",function(ge){return he.call(_e,ge,Se++)}),xe}function ie(oe){if(oe._status===-1){var he=oe._result;he=he(),he.then(function(_e){(oe._status===0||oe._status===-1)&&(oe._status=1,oe._result=_e)},function(_e){(oe._status===0||oe._status===-1)&&(oe._status=2,oe._result=_e)}),oe._status===-1&&(oe._status=0,oe._result=he)}if(oe._status===1)return oe._result.default;throw oe._result}var ae={current:null},q={transition:null},W={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:q,ReactCurrentOwner:$};function ne(){throw Error("act(...) is not supported in production builds of React.")}return Vi.Children={map:G,forEach:function(oe,he,_e){G(oe,function(){he.apply(this,arguments)},_e)},count:function(oe){var he=0;return G(oe,function(){he++}),he},toArray:function(oe){return G(oe,function(he){return he})||[]},only:function(oe){if(!se(oe))throw Error("React.Children.only expected to receive a single React element child.");return oe}},Vi.Component=C,Vi.Fragment=n,Vi.Profiler=s,Vi.PureComponent=I,Vi.StrictMode=r,Vi.Suspense=c,Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Vi.act=ne,Vi.cloneElement=function(oe,he,_e){if(oe==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+oe+".");var xe=y({},oe.props),Se=oe.key,ge=oe.ref,Ce=oe._owner;if(he!=null){if(he.ref!==void 0&&(ge=he.ref,Ce=$.current),he.key!==void 0&&(Se=""+he.key),oe.type&&oe.type.defaultProps)var je=oe.type.defaultProps;for(Oe in he)F.call(he,Oe)&&!L.hasOwnProperty(Oe)&&(xe[Oe]=he[Oe]===void 0&&je!==void 0?je[Oe]:he[Oe])}var Oe=arguments.length-2;if(Oe===1)xe.children=_e;else if(1<Oe){je=Array(Oe);for(var $e=0;$e<Oe;$e++)je[$e]=arguments[$e+2];xe.children=je}return{$$typeof:t,type:oe.type,key:Se,ref:ge,props:xe,_owner:Ce}},Vi.createContext=function(oe){return oe={$$typeof:o,_currentValue:oe,_currentValue2:oe,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},oe.Provider={$$typeof:a,_context:oe},oe.Consumer=oe},Vi.createElement=z,Vi.createFactory=function(oe){var he=z.bind(null,oe);return he.type=oe,he},Vi.createRef=function(){return{current:null}},Vi.forwardRef=function(oe){return{$$typeof:l,render:oe}},Vi.isValidElement=se,Vi.lazy=function(oe){return{$$typeof:d,_payload:{_status:-1,_result:oe},_init:ie}},Vi.memo=function(oe,he){return{$$typeof:u,type:oe,compare:he===void 0?null:he}},Vi.startTransition=function(oe){var he=q.transition;q.transition={};try{oe()}finally{q.transition=he}},Vi.unstable_act=ne,Vi.useCallback=function(oe,he){return ae.current.useCallback(oe,he)},Vi.useContext=function(oe){return ae.current.useContext(oe)},Vi.useDebugValue=function(){},Vi.useDeferredValue=function(oe){return ae.current.useDeferredValue(oe)},Vi.useEffect=function(oe,he){return ae.current.useEffect(oe,he)},Vi.useId=function(){return ae.current.useId()},Vi.useImperativeHandle=function(oe,he,_e){return ae.current.useImperativeHandle(oe,he,_e)},Vi.useInsertionEffect=function(oe,he){return ae.current.useInsertionEffect(oe,he)},Vi.useLayoutEffect=function(oe,he){return ae.current.useLayoutEffect(oe,he)},Vi.useMemo=function(oe,he){return ae.current.useMemo(oe,he)},Vi.useReducer=function(oe,he,_e){return ae.current.useReducer(oe,he,_e)},Vi.useRef=function(oe){return ae.current.useRef(oe)},Vi.useState=function(oe){return ae.current.useState(oe)},Vi.useSyncExternalStore=function(oe,he,_e){return ae.current.useSyncExternalStore(oe,he,_e)},Vi.useTransition=function(){return ae.current.useTransition()},Vi.version="18.3.1",Vi}var the;function xx(){return the||(the=1,gH.exports=iQe()),gH.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 nhe;function aQe(){if(nhe)return $A;nhe=1;var t=xx(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,u){var d,f={},x=null,g=null;u!==void 0&&(x=""+u),c.key!==void 0&&(x=""+c.key),c.ref!==void 0&&(g=c.ref);for(d in c)r.call(c,d)&&!a.hasOwnProperty(d)&&(f[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)f[d]===void 0&&(f[d]=c[d]);return{$$typeof:e,type:l,key:x,ref:g,props:f,_owner:s.current}}return $A.Fragment=n,$A.jsx=o,$A.jsxs=o,$A}var rhe;function oQe(){return rhe||(rhe=1,xH.exports=aQe()),xH.exports}var i=oQe(),uP={},bH={exports:{}},Hd={},yH={exports:{}},vH={};/**
* @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 she;function lQe(){return she||(she=1,function(t){function e(q,W){var ne=q.length;q.push(W);e:for(;0<ne;){var oe=ne-1>>>1,he=q[oe];if(0<s(he,W))q[oe]=W,q[ne]=he,ne=oe;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var W=q[0],ne=q.pop();if(ne!==W){q[0]=ne;e:for(var oe=0,he=q.length,_e=he>>>1;oe<_e;){var xe=2*(oe+1)-1,Se=q[xe],ge=xe+1,Ce=q[ge];if(0>s(Se,ne))ge<he&&0>s(Ce,Se)?(q[oe]=Ce,q[ge]=ne,oe=ge):(q[oe]=Se,q[xe]=ne,oe=xe);else if(ge<he&&0>s(Ce,ne))q[oe]=Ce,q[ge]=ne,oe=ge;else break e}}return W}function s(q,W){var ne=q.sortIndex-W.sortIndex;return ne!==0?ne:q.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,x=3,g=!1,y=!1,v=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(q){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=q)r(u),W.sortIndex=W.expirationTime,e(c,W);else break;W=n(u)}}function M(q){if(v=!1,P(q),!y)if(n(c)!==null)y=!0,ie(F);else{var W=n(u);W!==null&&ae(M,W.startTime-q)}}function F(q,W){y=!1,v&&(v=!1,N(z),z=-1),g=!0;var ne=x;try{for(P(W),f=n(c);f!==null&&(!(f.expirationTime>W)||q&&!ee());){var oe=f.callback;if(typeof oe=="function"){f.callback=null,x=f.priorityLevel;var he=oe(f.expirationTime<=W);W=t.unstable_now(),typeof he=="function"?f.callback=he:f===n(c)&&r(c),P(W)}else r(c);f=n(c)}if(f!==null)var _e=!0;else{var xe=n(u);xe!==null&&ae(M,xe.startTime-W),_e=!1}return _e}finally{f=null,x=ne,g=!1}}var $=!1,L=null,z=-1,Q=5,se=-1;function ee(){return!(t.unstable_now()-se<Q)}function K(){if(L!==null){var q=t.unstable_now();se=q;var W=!0;try{W=L(!0,q)}finally{W?re():($=!1,L=null)}}else $=!1}var re;if(typeof I=="function")re=function(){I(K)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,G=de.port2;de.port1.onmessage=K,re=function(){G.postMessage(null)}}else re=function(){C(K,0)};function ie(q){L=q,$||($=!0,re())}function ae(q,W){z=C(function(){q(t.unstable_now())},W)}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(q){q.callback=null},t.unstable_continueExecution=function(){y||g||(y=!0,ie(F))},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(q){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var ne=x;x=W;try{return q()}finally{x=ne}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,W){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ne=x;x=q;try{return W()}finally{x=ne}},t.unstable_scheduleCallback=function(q,W,ne){var oe=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?oe+ne:oe):ne=oe,q){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=ne+he,q={id:d++,callback:W,priorityLevel:q,startTime:ne,expirationTime:he,sortIndex:-1},ne>oe?(q.sortIndex=ne,e(u,q),n(c)===null&&q===n(u)&&(v?(N(z),z=-1):v=!0,ae(M,ne-oe))):(q.sortIndex=he,e(c,q),y||g||(y=!0,ie(F))),q},t.unstable_shouldYield=ee,t.unstable_wrapCallback=function(q){var W=x;return function(){var ne=x;x=W;try{return q.apply(this,arguments)}finally{x=ne}}}}(vH)),vH}var ihe;function cQe(){return ihe||(ihe=1,yH.exports=lQe()),yH.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 ahe;function uQe(){if(ahe)return Hd;ahe=1;var t=xx(),e=cQe();function n(_){for(var R="https://reactjs.org/docs/error-decoder.html?invariant="+_,J=1;J<arguments.length;J++)R+="&args[]="+encodeURIComponent(arguments[J]);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,J,be){if(J!==null&&J.type===0)return!1;switch(typeof R){case"function":case"symbol":return!0;case"boolean":return be?!1:J!==null?!J.acceptsBooleans:(_=_.toLowerCase().slice(0,5),_!=="data-"&&_!=="aria-");default:return!1}}function y(_,R,J,be){if(R===null||typeof R>"u"||g(_,R,J,be))return!0;if(be)return!1;if(J!==null)switch(J.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,J,be,Le,Qe,Ft){this.acceptsBooleans=R===2||R===3||R===4,this.attributeName=be,this.attributeNamespace=Le,this.mustUseProperty=J,this.propertyName=_,this.type=R,this.sanitizeURL=Qe,this.removeEmptyString=Ft}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 N=/[\-:]([a-z])/g;function I(_){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(N,I);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(N,I);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(N,I);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 P(_,R,J,be){var Le=C.hasOwnProperty(R)?C[R]:null;(Le!==null?Le.type!==0:be||!(2<R.length)||R[0]!=="o"&&R[0]!=="O"||R[1]!=="n"&&R[1]!=="N")&&(y(R,J,Le,be)&&(J=null),be||Le===null?x(R)&&(J===null?_.removeAttribute(R):_.setAttribute(R,""+J)):Le.mustUseProperty?_[Le.propertyName]=J===null?Le.type===3?!1:"":J:(R=Le.attributeName,be=Le.attributeNamespace,J===null?_.removeAttribute(R):(Le=Le.type,J=Le===3||Le===4&&J===!0?"":""+J,be?_.setAttributeNS(be,R,J):_.setAttribute(R,J))))}var M=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,F=Symbol.for("react.element"),$=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),se=Symbol.for("react.provider"),ee=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),de=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),ae=Symbol.for("react.offscreen"),q=Symbol.iterator;function W(_){return _===null||typeof _!="object"?null:(_=q&&_[q]||_["@@iterator"],typeof _=="function"?_:null)}var ne=Object.assign,oe;function he(_){if(oe===void 0)try{throw Error()}catch(J){var R=J.stack.trim().match(/\n( *(at )?)/);oe=R&&R[1]||""}return`
`+oe+_}var _e=!1;function xe(_,R){if(!_||_e)return"";_e=!0;var J=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(ur){var be=ur}Reflect.construct(_,[],R)}else{try{R.call()}catch(ur){be=ur}_.call(R.prototype)}else{try{throw Error()}catch(ur){be=ur}_()}}catch(ur){if(ur&&be&&typeof ur.stack=="string"){for(var Le=ur.stack.split(`
`),Qe=be.stack.split(`
`),Ft=Le.length-1,bn=Qe.length-1;1<=Ft&&0<=bn&&Le[Ft]!==Qe[bn];)bn--;for(;1<=Ft&&0<=bn;Ft--,bn--)if(Le[Ft]!==Qe[bn]){if(Ft!==1||bn!==1)do if(Ft--,bn--,0>bn||Le[Ft]!==Qe[bn]){var Mn=`
`+Le[Ft].replace(" at new "," at ");return _.displayName&&Mn.includes("<anonymous>")&&(Mn=Mn.replace("<anonymous>",_.displayName)),Mn}while(1<=Ft&&0<=bn);break}}}finally{_e=!1,Error.prepareStackTrace=J}return(_=_?_.displayName||_.name:"")?he(_):""}function Se(_){switch(_.tag){case 5:return he(_.type);case 16:return he("Lazy");case 13:return he("Suspense");case 19:return he("SuspenseList");case 0:case 2:case 15:return _=xe(_.type,!1),_;case 11:return _=xe(_.type.render,!1),_;case 1:return _=xe(_.type,!0),_;default:return""}}function ge(_){if(_==null)return null;if(typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case L:return"Fragment";case $:return"Portal";case Q:return"Profiler";case z:return"StrictMode";case re:return"Suspense";case de:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case ee:return(_.displayName||"Context")+".Consumer";case se:return(_._context.displayName||"Context")+".Provider";case K:var R=_.render;return _=_.displayName,_||(_=R.displayName||R.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case G:return R=_.displayName||null,R!==null?R:ge(_.type)||"Memo";case ie:R=_._payload,_=_._init;try{return ge(_(R))}catch{}}return null}function Ce(_){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 ge(R);case 8:return R===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R}return null}function je(_){switch(typeof _){case"boolean":case"number":case"string":case"undefined":return _;case"object":return _;default:return""}}function Oe(_){var R=_.type;return(_=_.nodeName)&&_.toLowerCase()==="input"&&(R==="checkbox"||R==="radio")}function $e(_){var R=Oe(_)?"checked":"value",J=Object.getOwnPropertyDescriptor(_.constructor.prototype,R),be=""+_[R];if(!_.hasOwnProperty(R)&&typeof J<"u"&&typeof J.get=="function"&&typeof J.set=="function"){var Le=J.get,Qe=J.set;return Object.defineProperty(_,R,{configurable:!0,get:function(){return Le.call(this)},set:function(Ft){be=""+Ft,Qe.call(this,Ft)}}),Object.defineProperty(_,R,{enumerable:J.enumerable}),{getValue:function(){return be},setValue:function(Ft){be=""+Ft},stopTracking:function(){_._valueTracker=null,delete _[R]}}}}function Ye(_){_._valueTracker||(_._valueTracker=$e(_))}function Je(_){if(!_)return!1;var R=_._valueTracker;if(!R)return!0;var J=R.getValue(),be="";return _&&(be=Oe(_)?_.checked?"true":"false":_.value),_=be,_!==J?(R.setValue(_),!0):!1}function ht(_){if(_=_||(typeof document<"u"?document:void 0),typeof _>"u")return null;try{return _.activeElement||_.body}catch{return _.body}}function rt(_,R){var J=R.checked;return ne({},R,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:J??_._wrapperState.initialChecked})}function st(_,R){var J=R.defaultValue==null?"":R.defaultValue,be=R.checked!=null?R.checked:R.defaultChecked;J=je(R.value!=null?R.value:J),_._wrapperState={initialChecked:be,initialValue:J,controlled:R.type==="checkbox"||R.type==="radio"?R.checked!=null:R.value!=null}}function He(_,R){R=R.checked,R!=null&&P(_,"checked",R,!1)}function Ve(_,R){He(_,R);var J=je(R.value),be=R.type;if(J!=null)be==="number"?(J===0&&_.value===""||_.value!=J)&&(_.value=""+J):_.value!==""+J&&(_.value=""+J);else if(be==="submit"||be==="reset"){_.removeAttribute("value");return}R.hasOwnProperty("value")?xt(_,R.type,J):R.hasOwnProperty("defaultValue")&&xt(_,R.type,je(R.defaultValue)),R.checked==null&&R.defaultChecked!=null&&(_.defaultChecked=!!R.defaultChecked)}function bt(_,R,J){if(R.hasOwnProperty("value")||R.hasOwnProperty("defaultValue")){var be=R.type;if(!(be!=="submit"&&be!=="reset"||R.value!==void 0&&R.value!==null))return;R=""+_._wrapperState.initialValue,J||R===_.value||(_.value=R),_.defaultValue=R}J=_.name,J!==""&&(_.name=""),_.defaultChecked=!!_._wrapperState.initialChecked,J!==""&&(_.name=J)}function xt(_,R,J){(R!=="number"||ht(_.ownerDocument)!==_)&&(J==null?_.defaultValue=""+_._wrapperState.initialValue:_.defaultValue!==""+J&&(_.defaultValue=""+J))}var Qt=Array.isArray;function St(_,R,J,be){if(_=_.options,R){R={};for(var Le=0;Le<J.length;Le++)R["$"+J[Le]]=!0;for(J=0;J<_.length;J++)Le=R.hasOwnProperty("$"+_[J].value),_[J].selected!==Le&&(_[J].selected=Le),Le&&be&&(_[J].defaultSelected=!0)}else{for(J=""+je(J),R=null,Le=0;Le<_.length;Le++){if(_[Le].value===J){_[Le].selected=!0,be&&(_[Le].defaultSelected=!0);return}R!==null||_[Le].disabled||(R=_[Le])}R!==null&&(R.selected=!0)}}function on(_,R){if(R.dangerouslySetInnerHTML!=null)throw Error(n(91));return ne({},R,{value:void 0,defaultValue:void 0,children:""+_._wrapperState.initialValue})}function cn(_,R){var J=R.value;if(J==null){if(J=R.children,R=R.defaultValue,J!=null){if(R!=null)throw Error(n(92));if(Qt(J)){if(1<J.length)throw Error(n(93));J=J[0]}R=J}R==null&&(R=""),J=R}_._wrapperState={initialValue:je(J)}}function Vn(_,R){var J=je(R.value),be=je(R.defaultValue);J!=null&&(J=""+J,J!==_.value&&(_.value=J),R.defaultValue==null&&_.defaultValue!==J&&(_.defaultValue=J)),be!=null&&(_.defaultValue=""+be)}function tn(_){var R=_.textContent;R===_._wrapperState.initialValue&&R!==""&&R!==null&&(_.value=R)}function fn(_){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 rn(_,R){return _==null||_==="http://www.w3.org/1999/xhtml"?fn(R):_==="http://www.w3.org/2000/svg"&&R==="foreignObject"?"http://www.w3.org/1999/xhtml":_}var nt,it=function(_){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(R,J,be,Le){MSApp.execUnsafeLocalFunction(function(){return _(R,J,be,Le)})}:_}(function(_,R){if(_.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in _)_.innerHTML=R;else{for(nt=nt||document.createElement("div"),nt.innerHTML="<svg>"+R.valueOf().toString()+"</svg>",R=nt.firstChild;_.firstChild;)_.removeChild(_.firstChild);for(;R.firstChild;)_.appendChild(R.firstChild)}});function Ut(_,R){if(R){var J=_.firstChild;if(J&&J===_.lastChild&&J.nodeType===3){J.nodeValue=R;return}}_.textContent=R}var hn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},nn=["Webkit","ms","Moz","O"];Object.keys(hn).forEach(function(_){nn.forEach(function(R){R=R+_.charAt(0).toUpperCase()+_.substring(1),hn[R]=hn[_]})});function Vt(_,R,J){return R==null||typeof R=="boolean"||R===""?"":J||typeof R!="number"||R===0||hn.hasOwnProperty(_)&&hn[_]?(""+R).trim():R+"px"}function pt(_,R){_=_.style;for(var J in R)if(R.hasOwnProperty(J)){var be=J.indexOf("--")===0,Le=Vt(J,R[J],be);J==="float"&&(J="cssFloat"),be?_.setProperty(J,Le):_[J]=Le}}var We=ne({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 It(_,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 Ge(_,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 vt(_){return _=_.target||_.srcElement||window,_.correspondingUseElement&&(_=_.correspondingUseElement),_.nodeType===3?_.parentNode:_}var Ht=null,Rt=null,mn=null;function un(_){if(_=gc(_)){if(typeof Ht!="function")throw Error(n(280));var R=_.stateNode;R&&(R=a6(R),Ht(_.stateNode,_.type,R))}}function yn(_){Rt?mn?mn.push(_):mn=[_]:Rt=_}function _n(){if(Rt){var _=Rt,R=mn;if(mn=Rt=null,un(_),R)for(_=0;_<R.length;_++)un(R[_])}}function In(_,R){return _(R)}function Sn(){}var Yn=!1;function Xn(_,R,J){if(Yn)return _(R,J);Yn=!0;try{return In(_,R,J)}finally{Yn=!1,(Rt!==null||mn!==null)&&(Sn(),_n())}}function zn(_,R){var J=_.stateNode;if(J===null)return null;var be=a6(J);if(be===null)return null;J=be[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":(be=!be.disabled)||(_=_.type,be=!(_==="button"||_==="input"||_==="select"||_==="textarea")),_=!be;break e;default:_=!1}if(_)return null;if(J&&typeof J!="function")throw Error(n(231,R,typeof J));return J}var Kn=!1;if(l)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){Kn=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{Kn=!1}function De(_,R,J,be,Le,Qe,Ft,bn,Mn){var ur=Array.prototype.slice.call(arguments,3);try{R.apply(J,ur)}catch(zr){this.onError(zr)}}var pe=!1,qe=null,Ae=!1,ze=null,zt={onError:function(_){pe=!0,qe=_}};function kt(_,R,J,be,Le,Qe,Ft,bn,Mn){pe=!1,qe=null,De.apply(zt,arguments)}function gt(_,R,J,be,Le,Qe,Ft,bn,Mn){if(kt.apply(this,arguments),pe){if(pe){var ur=qe;pe=!1,qe=null}else throw Error(n(198));Ae||(Ae=!0,ze=ur)}}function Mt(_){var R=_,J=_;if(_.alternate)for(;R.return;)R=R.return;else{_=R;do R=_,R.flags&4098&&(J=R.return),_=R.return;while(_)}return R.tag===3?J:null}function ln(_){if(_.tag===13){var R=_.memoizedState;if(R===null&&(_=_.alternate,_!==null&&(R=_.memoizedState)),R!==null)return R.dehydrated}return null}function vn(_){if(Mt(_)!==_)throw Error(n(188))}function Wn(_){var R=_.alternate;if(!R){if(R=Mt(_),R===null)throw Error(n(188));return R!==_?null:_}for(var J=_,be=R;;){var Le=J.return;if(Le===null)break;var Qe=Le.alternate;if(Qe===null){if(be=Le.return,be!==null){J=be;continue}break}if(Le.child===Qe.child){for(Qe=Le.child;Qe;){if(Qe===J)return vn(Le),_;if(Qe===be)return vn(Le),R;Qe=Qe.sibling}throw Error(n(188))}if(J.return!==be.return)J=Le,be=Qe;else{for(var Ft=!1,bn=Le.child;bn;){if(bn===J){Ft=!0,J=Le,be=Qe;break}if(bn===be){Ft=!0,be=Le,J=Qe;break}bn=bn.sibling}if(!Ft){for(bn=Qe.child;bn;){if(bn===J){Ft=!0,J=Qe,be=Le;break}if(bn===be){Ft=!0,be=Qe,J=Le;break}bn=bn.sibling}if(!Ft)throw Error(n(189))}}if(J.alternate!==be)throw Error(n(190))}if(J.tag!==3)throw Error(n(188));return J.stateNode.current===J?_:R}function On(_){return _=Wn(_),_!==null?$t(_):null}function $t(_){if(_.tag===5||_.tag===6)return _;for(_=_.child;_!==null;){var R=$t(_);if(R!==null)return R;_=_.sibling}return null}var Nn=e.unstable_scheduleCallback,Fn=e.unstable_cancelCallback,Tt=e.unstable_shouldYield,pn=e.unstable_requestPaint,ke=e.unstable_now,m=e.unstable_getCurrentPriorityLevel,p=e.unstable_ImmediatePriority,S=e.unstable_UserBlockingPriority,A=e.unstable_NormalPriority,k=e.unstable_LowPriority,T=e.unstable_IdlePriority,D=null,V=null;function X(_){if(V&&typeof V.onCommitFiberRoot=="function")try{V.onCommitFiberRoot(D,_,void 0,(_.current.flags&128)===128)}catch{}}var le=Math.clz32?Math.clz32:ye,ce=Math.log,fe=Math.LN2;function ye(_){return _>>>=0,_===0?32:31-(ce(_)/fe|0)|0}var Pe=64,Me=4194304;function Ke(_){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 we(_,R){var J=_.pendingLanes;if(J===0)return 0;var be=0,Le=_.suspendedLanes,Qe=_.pingedLanes,Ft=J&268435455;if(Ft!==0){var bn=Ft&~Le;bn!==0?be=Ke(bn):(Qe&=Ft,Qe!==0&&(be=Ke(Qe)))}else Ft=J&~Le,Ft!==0?be=Ke(Ft):Qe!==0&&(be=Ke(Qe));if(be===0)return 0;if(R!==0&&R!==be&&!(R&Le)&&(Le=be&-be,Qe=R&-R,Le>=Qe||Le===16&&(Qe&4194240)!==0))return R;if(be&4&&(be|=J&16),R=_.entangledLanes,R!==0)for(_=_.entanglements,R&=be;0<R;)J=31-le(R),Le=1<<J,be|=_[J],R&=~Le;return be}function Te(_,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 te(_,R){for(var J=_.suspendedLanes,be=_.pingedLanes,Le=_.expirationTimes,Qe=_.pendingLanes;0<Qe;){var Ft=31-le(Qe),bn=1<<Ft,Mn=Le[Ft];Mn===-1?(!(bn&J)||bn&be)&&(Le[Ft]=Te(bn,R)):Mn<=R&&(_.expiredLanes|=bn),Qe&=~bn}}function ve(_){return _=_.pendingLanes&-1073741825,_!==0?_:_&1073741824?1073741824:0}function Be(){var _=Pe;return Pe<<=1,!(Pe&4194240)&&(Pe=64),_}function Ue(_){for(var R=[],J=0;31>J;J++)R.push(_);return R}function Fe(_,R,J){_.pendingLanes|=R,R!==536870912&&(_.suspendedLanes=0,_.pingedLanes=0),_=_.eventTimes,R=31-le(R),_[R]=J}function at(_,R){var J=_.pendingLanes&~R;_.pendingLanes=R,_.suspendedLanes=0,_.pingedLanes=0,_.expiredLanes&=R,_.mutableReadLanes&=R,_.entangledLanes&=R,R=_.entanglements;var be=_.eventTimes;for(_=_.expirationTimes;0<J;){var Le=31-le(J),Qe=1<<Le;R[Le]=0,be[Le]=-1,_[Le]=-1,J&=~Qe}}function ut(_,R){var J=_.entangledLanes|=R;for(_=_.entanglements;J;){var be=31-le(J),Le=1<<be;Le&R|_[be]&R&&(_[be]|=R),J&=~Le}}var yt=0;function Lt(_){return _&=-_,1<_?4<_?_&268435455?16:536870912:4:1}var Gt,an,et,Pt,qt,ft=!1,tt=[],Bt=null,gn=null,tr=null,Dn=new Map,er=new Map,Sr=[],dr="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function kr(_,R){switch(_){case"focusin":case"focusout":Bt=null;break;case"dragenter":case"dragleave":gn=null;break;case"mouseover":case"mouseout":tr=null;break;case"pointerover":case"pointerout":Dn.delete(R.pointerId);break;case"gotpointercapture":case"lostpointercapture":er.delete(R.pointerId)}}function qn(_,R,J,be,Le,Qe){return _===null||_.nativeEvent!==Qe?(_={blockedOn:R,domEventName:J,eventSystemFlags:be,nativeEvent:Qe,targetContainers:[Le]},R!==null&&(R=gc(R),R!==null&&an(R)),_):(_.eventSystemFlags|=be,R=_.targetContainers,Le!==null&&R.indexOf(Le)===-1&&R.push(Le),_)}function Tn(_,R,J,be,Le){switch(R){case"focusin":return Bt=qn(Bt,_,R,J,be,Le),!0;case"dragenter":return gn=qn(gn,_,R,J,be,Le),!0;case"mouseover":return tr=qn(tr,_,R,J,be,Le),!0;case"pointerover":var Qe=Le.pointerId;return Dn.set(Qe,qn(Dn.get(Qe)||null,_,R,J,be,Le)),!0;case"gotpointercapture":return Qe=Le.pointerId,er.set(Qe,qn(er.get(Qe)||null,_,R,J,be,Le)),!0}return!1}function $n(_){var R=dh(_.target);if(R!==null){var J=Mt(R);if(J!==null){if(R=J.tag,R===13){if(R=ln(J),R!==null){_.blockedOn=R,qt(_.priority,function(){et(J)});return}}else if(R===3&&J.stateNode.current.memoizedState.isDehydrated){_.blockedOn=J.tag===3?J.stateNode.containerInfo:null;return}}}_.blockedOn=null}function ir(_){if(_.blockedOn!==null)return!1;for(var R=_.targetContainers;0<R.length;){var J=wr(_.domEventName,_.eventSystemFlags,R[0],_.nativeEvent);if(J===null){J=_.nativeEvent;var be=new J.constructor(J.type,J);ct=be,J.target.dispatchEvent(be),ct=null}else return R=gc(J),R!==null&&an(R),_.blockedOn=J,!1;R.shift()}return!0}function ls(_,R,J){ir(_)&&J.delete(R)}function cs(){ft=!1,Bt!==null&&ir(Bt)&&(Bt=null),gn!==null&&ir(gn)&&(gn=null),tr!==null&&ir(tr)&&(tr=null),Dn.forEach(ls),er.forEach(ls)}function lt(_,R){_.blockedOn===R&&(_.blockedOn=null,ft||(ft=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cs)))}function Nt(_){function R(Le){return lt(Le,_)}if(0<tt.length){lt(tt[0],_);for(var J=1;J<tt.length;J++){var be=tt[J];be.blockedOn===_&&(be.blockedOn=null)}}for(Bt!==null&<(Bt,_),gn!==null&<(gn,_),tr!==null&<(tr,_),Dn.forEach(R),er.forEach(R),J=0;J<Sr.length;J++)be=Sr[J],be.blockedOn===_&&(be.blockedOn=null);for(;0<Sr.length&&(J=Sr[0],J.blockedOn===null);)$n(J),J.blockedOn===null&&Sr.shift()}var Rn=M.ReactCurrentBatchConfig,ar=!0;function Tr(_,R,J,be){var Le=yt,Qe=Rn.transition;Rn.transition=null;try{yt=1,$r(_,R,J,be)}finally{yt=Le,Rn.transition=Qe}}function Lr(_,R,J,be){var Le=yt,Qe=Rn.transition;Rn.transition=null;try{yt=4,$r(_,R,J,be)}finally{yt=Le,Rn.transition=Qe}}function $r(_,R,J,be){if(ar){var Le=wr(_,R,J,be);if(Le===null)H8(_,R,be,cr,J),kr(_,be);else if(Tn(Le,_,R,J,be))be.stopPropagation();else if(kr(_,be),R&4&&-1<dr.indexOf(_)){for(;Le!==null;){var Qe=gc(Le);if(Qe!==null&&Gt(Qe),Qe=wr(_,R,J,be),Qe===null&&H8(_,R,be,cr,J),Qe===Le)break;Le=Qe}Le!==null&&be.stopPropagation()}else H8(_,R,be,null,J)}}var cr=null;function wr(_,R,J,be){if(cr=null,_=vt(be),_=dh(_),_!==null)if(R=Mt(_),R===null)_=null;else if(J=R.tag,J===13){if(_=ln(R),_!==null)return _;_=null}else if(J===3){if(R.stateNode.current.memoizedState.isDehydrated)return R.tag===3?R.stateNode.containerInfo:null;_=null}else R!==_&&(_=null);return cr=_,null}function ss(_){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 S:return 4;case A:case k:return 16;case T:return 536870912;default:return 16}default:return 16}}var mr=null,ts=null,Qs=null;function Es(){if(Qs)return Qs;var _,R=ts,J=R.length,be,Le="value"in mr?mr.value:mr.textContent,Qe=Le.length;for(_=0;_<J&&R[_]===Le[_];_++);var Ft=J-_;for(be=1;be<=Ft&&R[J-be]===Le[Qe-be];be++);return Qs=Le.slice(_,1<be?1-be:void 0)}function br(_){var R=_.keyCode;return"charCode"in _?(_=_.charCode,_===0&&R===13&&(_=13)):_=R,_===10&&(_=13),32<=_||_===13?_:0}function Zt(){return!0}function me(){return!1}function dt(_){function R(J,be,Le,Qe,Ft){this._reactName=J,this._targetInst=Le,this.type=be,this.nativeEvent=Qe,this.target=Ft,this.currentTarget=null;for(var bn in _)_.hasOwnProperty(bn)&&(J=_[bn],this[bn]=J?J(Qe):Qe[bn]);return this.isDefaultPrevented=(Qe.defaultPrevented!=null?Qe.defaultPrevented:Qe.returnValue===!1)?Zt:me,this.isPropagationStopped=me,this}return ne(R.prototype,{preventDefault:function(){this.defaultPrevented=!0;var J=this.nativeEvent;J&&(J.preventDefault?J.preventDefault():typeof J.returnValue!="unknown"&&(J.returnValue=!1),this.isDefaultPrevented=Zt)},stopPropagation:function(){var J=this.nativeEvent;J&&(J.stopPropagation?J.stopPropagation():typeof J.cancelBubble!="unknown"&&(J.cancelBubble=!0),this.isPropagationStopped=Zt)},persist:function(){},isPersistent:Zt}),R}var _t={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(_){return _.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},At=dt(_t),xn=ne({},_t,{view:0,detail:0}),Cn=dt(xn),fr,_r,pr,hr=ne({},xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Or,button:0,buttons:0,relatedTarget:function(_){return _.relatedTarget===void 0?_.fromElement===_.srcElement?_.toElement:_.fromElement:_.relatedTarget},movementX:function(_){return"movementX"in _?_.movementX:(_!==pr&&(pr&&_.type==="mousemove"?(fr=_.screenX-pr.screenX,_r=_.screenY-pr.screenY):_r=fr=0,pr=_),fr)},movementY:function(_){return"movementY"in _?_.movementY:_r}}),Xr=dt(hr),is=ne({},hr,{dataTransfer:0}),Pr=dt(is),yr=ne({},xn,{relatedTarget:0}),nr=dt(yr),gs=ne({},_t,{animationName:0,elapsedTime:0,pseudoElement:0}),ei=dt(gs),ci=ne({},_t,{clipboardData:function(_){return"clipboardData"in _?_.clipboardData:window.clipboardData}}),Fr=dt(ci),En=ne({},_t,{data:0}),Bn=dt(En),mt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kt={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"},sr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Zn(_){var R=this.nativeEvent;return R.getModifierState?R.getModifierState(_):(_=sr[_])?!!R[_]:!1}function Or(){return Zn}var Ir=ne({},xn,{key:function(_){if(_.key){var R=mt[_.key]||_.key;if(R!=="Unidentified")return R}return _.type==="keypress"?(_=br(_),_===13?"Enter":String.fromCharCode(_)):_.type==="keydown"||_.type==="keyup"?Kt[_.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Or,charCode:function(_){return _.type==="keypress"?br(_):0},keyCode:function(_){return _.type==="keydown"||_.type==="keyup"?_.keyCode:0},which:function(_){return _.type==="keypress"?br(_):_.type==="keydown"||_.type==="keyup"?_.keyCode:0}}),ns=dt(Ir),Ls=ne({},hr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ot=dt(Ls),lr=ne({},xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Or}),Qn=dt(lr),Vr=ne({},_t,{propertyName:0,elapsedTime:0,pseudoElement:0}),us=dt(Vr),as=ne({},hr,{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}),xs=dt(as),bs=[9,13,27,32],zi=l&&"CompositionEvent"in window,zs=null;l&&"documentMode"in document&&(zs=document.documentMode);var ys=l&&"TextEvent"in window&&!zs,Ss=l&&(!zi||zs&&8<zs&&11>=zs),pc=" ",ks=!1;function ka(_,R){switch(_){case"keyup":return bs.indexOf(R.keyCode)!==-1;case"keydown":return R.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wu(_){return _=_.detail,typeof _=="object"&&"data"in _?_.data:null}var Sa=!1;function Yo(_,R){switch(_){case"compositionend":return Wu(R);case"keypress":return R.which!==32?null:(ks=!0,pc);case"textInput":return _=R.data,_===pc&&ks?null:_;default:return null}}function qu(_,R){if(Sa)return _==="compositionend"||!zi&&ka(_,R)?(_=Es(),Qs=ts=mr=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 Ss&&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 wi(_){var R=_&&_.nodeName&&_.nodeName.toLowerCase();return R==="input"?!!Ql[_.type]:R==="textarea"}function Ed(_,R,J,be){yn(be),R=n6(R,"onChange"),0<R.length&&(J=new At("onChange","change",null,J,be),_.push({event:J,listeners:R}))}var wt=null,w=null;function E(_){gI(_,0)}function O(_){var R=Ai(_);if(Je(R))return _}function U(_,R){if(_==="change")return R}var H=!1;if(l){var Z;if(l){var ue="oninput"in document;if(!ue){var Ee=document.createElement("div");Ee.setAttribute("oninput","return;"),ue=typeof Ee.oninput=="function"}Z=ue}else Z=!1;H=Z&&(!document.documentMode||9<document.documentMode)}function Re(){wt&&(wt.detachEvent("onpropertychange",ot),w=wt=null)}function ot(_){if(_.propertyName==="value"&&O(w)){var R=[];Ed(R,w,_,vt(_)),Xn(E,R)}}function Ct(_,R,J){_==="focusin"?(Re(),wt=R,w=J,wt.attachEvent("onpropertychange",ot)):_==="focusout"&&Re()}function Dt(_){if(_==="selectionchange"||_==="keyup"||_==="keydown")return O(w)}function sn(_,R){if(_==="click")return O(R)}function Et(_,R){if(_==="input"||_==="change")return O(R)}function Yt(_,R){return _===R&&(_!==0||1/_===1/R)||_!==_&&R!==R}var Jt=typeof Object.is=="function"?Object.is:Yt;function Pn(_,R){if(Jt(_,R))return!0;if(typeof _!="object"||_===null||typeof R!="object"||R===null)return!1;var J=Object.keys(_),be=Object.keys(R);if(J.length!==be.length)return!1;for(be=0;be<J.length;be++){var Le=J[be];if(!c.call(R,Le)||!Jt(_[Le],R[Le]))return!1}return!0}function xr(_){for(;_&&_.firstChild;)_=_.firstChild;return _}function Nr(_,R){var J=xr(_);_=0;for(var be;J;){if(J.nodeType===3){if(be=_+J.textContent.length,_<=R&&be>=R)return{node:J,offset:R-_};_=be}e:{for(;J;){if(J.nextSibling){J=J.nextSibling;break e}J=J.parentNode}J=void 0}J=xr(J)}}function Ar(_,R){return _&&R?_===R?!0:_&&_.nodeType===3?!1:R&&R.nodeType===3?Ar(_,R.parentNode):"contains"in _?_.contains(R):_.compareDocumentPosition?!!(_.compareDocumentPosition(R)&16):!1:!1}function Ns(){for(var _=window,R=ht();R instanceof _.HTMLIFrameElement;){try{var J=typeof R.contentWindow.location.href=="string"}catch{J=!1}if(J)_=R.contentWindow;else break;R=ht(_.document)}return R}function ti(_){var R=_&&_.nodeName&&_.nodeName.toLowerCase();return R&&(R==="input"&&(_.type==="text"||_.type==="search"||_.type==="tel"||_.type==="url"||_.type==="password")||R==="textarea"||_.contentEditable==="true")}function mc(_){var R=Ns(),J=_.focusedElem,be=_.selectionRange;if(R!==J&&J&&J.ownerDocument&&Ar(J.ownerDocument.documentElement,J)){if(be!==null&&ti(J)){if(R=be.start,_=be.end,_===void 0&&(_=R),"selectionStart"in J)J.selectionStart=R,J.selectionEnd=Math.min(_,J.value.length);else if(_=(R=J.ownerDocument||document)&&R.defaultView||window,_.getSelection){_=_.getSelection();var Le=J.textContent.length,Qe=Math.min(be.start,Le);be=be.end===void 0?Qe:Math.min(be.end,Le),!_.extend&&Qe>be&&(Le=be,be=Qe,Qe=Le),Le=Nr(J,Qe);var Ft=Nr(J,be);Le&&Ft&&(_.rangeCount!==1||_.anchorNode!==Le.node||_.anchorOffset!==Le.offset||_.focusNode!==Ft.node||_.focusOffset!==Ft.offset)&&(R=R.createRange(),R.setStart(Le.node,Le.offset),_.removeAllRanges(),Qe>be?(_.addRange(R),_.extend(Ft.node,Ft.offset)):(R.setEnd(Ft.node,Ft.offset),_.addRange(R)))}}for(R=[],_=J;_=_.parentNode;)_.nodeType===1&&R.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;J<R.length;J++)_=R[J],_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}var ro=l&&"documentMode"in document&&11>=document.documentMode,so=null,pa=null,Ta=null,Xo=!1;function kd(_,R,J){var be=J.window===J?J.document:J.nodeType===9?J:J.ownerDocument;Xo||so==null||so!==ht(be)||(be=so,"selectionStart"in be&&ti(be)?be={start:be.selectionStart,end:be.selectionEnd}:(be=(be.ownerDocument&&be.ownerDocument.defaultView||window).getSelection(),be={anchorNode:be.anchorNode,anchorOffset:be.anchorOffset,focusNode:be.focusNode,focusOffset:be.focusOffset}),Ta&&Pn(Ta,be)||(Ta=be,be=n6(pa,"onSelect"),0<be.length&&(R=new At("onSelect","select",null,R,J),_.push({event:R,listeners:be}),R.target=so)))}function Oi(_,R){var J={};return J[_.toLowerCase()]=R.toLowerCase(),J["Webkit"+_]="webkit"+R,J["Moz"+_]="moz"+R,J}var Lm={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionend:Oi("Transition","TransitionEnd")},W1={},z2={};l&&(z2=document.createElement("div").style,"AnimationEvent"in window||(delete Lm.animationend.animation,delete Lm.animationiteration.animation,delete Lm.animationstart.animation),"TransitionEvent"in window||delete Lm.transitionend.transition);function Q5(_){if(W1[_])return W1[_];if(!Lm[_])return _;var R=Lm[_],J;for(J in R)if(R.hasOwnProperty(J)&&J in z2)return W1[_]=R[J];return _}var pI=Q5("animationend"),mI=Q5("animationiteration"),H2=Q5("animationstart"),Np=Q5("transitionend"),V2=new Map,U8="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 Nf(_,R){V2.set(_,R),a(R,[_])}for(var Z5=0;Z5<U8.length;Z5++){var J5=U8[Z5],e6=J5.toLowerCase(),xI=J5[0].toUpperCase()+J5.slice(1);Nf(e6,"on"+xI)}Nf(pI,"onAnimationEnd"),Nf(mI,"onAnimationIteration"),Nf(H2,"onAnimationStart"),Nf("dblclick","onDoubleClick"),Nf("focusin","onFocus"),Nf("focusout","onBlur"),Nf(Np,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var 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(" "),Sx=new Set("cancel close invalid load scroll toggle".split(" ").concat(jp));function W2(_,R,J){var be=_.type||"unknown-event";_.currentTarget=J,gt(be,R,void 0,_),_.currentTarget=null}function gI(_,R){R=(R&4)!==0;for(var J=0;J<_.length;J++){var be=_[J],Le=be.event;be=be.listeners;e:{var Qe=void 0;if(R)for(var Ft=be.length-1;0<=Ft;Ft--){var bn=be[Ft],Mn=bn.instance,ur=bn.currentTarget;if(bn=bn.listener,Mn!==Qe&&Le.isPropagationStopped())break e;W2(Le,bn,ur),Qe=Mn}else for(Ft=0;Ft<be.length;Ft++){if(bn=be[Ft],Mn=bn.instance,ur=bn.currentTarget,bn=bn.listener,Mn!==Qe&&Le.isPropagationStopped())break e;W2(Le,bn,ur),Qe=Mn}}}if(Ae)throw _=ze,Ae=!1,ze=null,_}function Ka(_,R){var J=R[i6];J===void 0&&(J=R[i6]=new Set);var be=_+"__bubble";J.has(be)||(t6(R,_,2,!1),J.add(be))}function z8(_,R,J){var be=0;R&&(be|=4),t6(J,_,be,R)}var Nx="_reactListening"+Math.random().toString(36).slice(2);function Dm(_){if(!_[Nx]){_[Nx]=!0,r.forEach(function(J){J!=="selectionchange"&&(Sx.has(J)||z8(J,!1,_),z8(J,!0,_))});var R=_.nodeType===9?_:_.ownerDocument;R===null||R[Nx]||(R[Nx]=!0,z8("selectionchange",!1,R))}}function t6(_,R,J,be){switch(ss(R)){case 1:var Le=Tr;break;case 4:Le=Lr;break;default:Le=$r}J=Le.bind(null,R,J,_),Le=void 0,!Kn||R!=="touchstart"&&R!=="touchmove"&&R!=="wheel"||(Le=!0),be?Le!==void 0?_.addEventListener(R,J,{capture:!0,passive:Le}):_.addEventListener(R,J,!0):Le!==void 0?_.addEventListener(R,J,{passive:Le}):_.addEventListener(R,J,!1)}function H8(_,R,J,be,Le){var Qe=be;if(!(R&1)&&!(R&2)&&be!==null)e:for(;;){if(be===null)return;var Ft=be.tag;if(Ft===3||Ft===4){var bn=be.stateNode.containerInfo;if(bn===Le||bn.nodeType===8&&bn.parentNode===Le)break;if(Ft===4)for(Ft=be.return;Ft!==null;){var Mn=Ft.tag;if((Mn===3||Mn===4)&&(Mn=Ft.stateNode.containerInfo,Mn===Le||Mn.nodeType===8&&Mn.parentNode===Le))return;Ft=Ft.return}for(;bn!==null;){if(Ft=dh(bn),Ft===null)return;if(Mn=Ft.tag,Mn===5||Mn===6){be=Qe=Ft;continue e}bn=bn.parentNode}}be=be.return}Xn(function(){var ur=Qe,zr=vt(J),Wr=[];e:{var Ur=V2.get(_);if(Ur!==void 0){var hs=At,js=_;switch(_){case"keypress":if(br(J)===0)break e;case"keydown":case"keyup":hs=ns;break;case"focusin":js="focus",hs=nr;break;case"focusout":js="blur",hs=nr;break;case"beforeblur":case"afterblur":hs=nr;break;case"click":if(J.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":hs=Xr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":hs=Pr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":hs=Qn;break;case pI:case mI:case H2:hs=ei;break;case Np:hs=us;break;case"scroll":hs=Cn;break;case"wheel":hs=xs;break;case"copy":case"cut":case"paste":hs=Fr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":hs=Ot}var Ps=(R&4)!==0,To=!Ps&&_==="scroll",rr=Ps?Ur!==null?Ur+"Capture":null:Ur;Ps=[];for(var Hn=ur,or;Hn!==null;){or=Hn;var Qr=or.stateNode;if(or.tag===5&&Qr!==null&&(or=Qr,rr!==null&&(Qr=zn(Hn,rr),Qr!=null&&Ps.push(q1(Hn,Qr,or)))),To)break;Hn=Hn.return}0<Ps.length&&(Ur=new hs(Ur,js,null,J,zr),Wr.push({event:Ur,listeners:Ps}))}}if(!(R&7)){e:{if(Ur=_==="mouseover"||_==="pointerover",hs=_==="mouseout"||_==="pointerout",Ur&&J!==ct&&(js=J.relatedTarget||J.fromElement)&&(dh(js)||js[Gu]))break e;if((hs||Ur)&&(Ur=zr.window===zr?zr:(Ur=zr.ownerDocument)?Ur.defaultView||Ur.parentWindow:window,hs?(js=J.relatedTarget||J.toElement,hs=ur,js=js?dh(js):null,js!==null&&(To=Mt(js),js!==To||js.tag!==5&&js.tag!==6)&&(js=null)):(hs=null,js=ur),hs!==js)){if(Ps=Xr,Qr="onMouseLeave",rr="onMouseEnter",Hn="mouse",(_==="pointerout"||_==="pointerover")&&(Ps=Ot,Qr="onPointerLeave",rr="onPointerEnter",Hn="pointer"),To=hs==null?Ur:Ai(hs),or=js==null?Ur:Ai(js),Ur=new Ps(Qr,Hn+"leave",hs,J,zr),Ur.target=To,Ur.relatedTarget=or,Qr=null,dh(zr)===ur&&(Ps=new Ps(rr,Hn+"enter",js,J,zr),Ps.target=or,Ps.relatedTarget=To,Qr=Ps),To=Qr,hs&&js)t:{for(Ps=hs,rr=js,Hn=0,or=Ps;or;or=G1(or))Hn++;for(or=0,Qr=rr;Qr;Qr=G1(Qr))or++;for(;0<Hn-or;)Ps=G1(Ps),Hn--;for(;0<or-Hn;)rr=G1(rr),or--;for(;Hn--;){if(Ps===rr||rr!==null&&Ps===rr.alternate)break t;Ps=G1(Ps),rr=G1(rr)}Ps=null}else Ps=null;hs!==null&&Qo(Wr,Ur,hs,Ps,!1),js!==null&&To!==null&&Qo(Wr,To,js,Ps,!0)}}e:{if(Ur=ur?Ai(ur):window,hs=Ur.nodeName&&Ur.nodeName.toLowerCase(),hs==="select"||hs==="input"&&Ur.type==="file")var Fs=U;else if(wi(Ur))if(H)Fs=Et;else{Fs=Dt;var qs=Ct}else(hs=Ur.nodeName)&&hs.toLowerCase()==="input"&&(Ur.type==="checkbox"||Ur.type==="radio")&&(Fs=sn);if(Fs&&(Fs=Fs(_,ur))){Ed(Wr,Fs,J,zr);break e}qs&&qs(_,Ur,ur),_==="focusout"&&(qs=Ur._wrapperState)&&qs.controlled&&Ur.type==="number"&&xt(Ur,"number",Ur.value)}switch(qs=ur?Ai(ur):window,_){case"focusin":(wi(qs)||qs.contentEditable==="true")&&(so=qs,pa=ur,Ta=null);break;case"focusout":Ta=pa=so=null;break;case"mousedown":Xo=!0;break;case"contextmenu":case"mouseup":case"dragend":Xo=!1,kd(Wr,J,zr);break;case"selectionchange":if(ro)break;case"keydown":case"keyup":kd(Wr,J,zr)}var Gs;if(zi)e:{switch(_){case"compositionstart":var Js="onCompositionStart";break e;case"compositionend":Js="onCompositionEnd";break e;case"compositionupdate":Js="onCompositionUpdate";break e}Js=void 0}else Sa?ka(_,J)&&(Js="onCompositionEnd"):_==="keydown"&&J.keyCode===229&&(Js="onCompositionStart");Js&&(Ss&&J.locale!=="ko"&&(Sa||Js!=="onCompositionStart"?Js==="onCompositionEnd"&&Sa&&(Gs=Es()):(mr=zr,ts="value"in mr?mr.value:mr.textContent,Sa=!0)),qs=n6(ur,Js),0<qs.length&&(Js=new Bn(Js,_,null,J,zr),Wr.push({event:Js,listeners:qs}),Gs?Js.data=Gs:(Gs=Wu(J),Gs!==null&&(Js.data=Gs)))),(Gs=ys?Yo(_,J):qu(_,J))&&(ur=n6(ur,"onBeforeInput"),0<ur.length&&(zr=new Bn("onBeforeInput","beforeinput",null,J,zr),Wr.push({event:zr,listeners:ur}),zr.data=Gs))}gI(Wr,R)})}function q1(_,R,J){return{instance:_,listener:R,currentTarget:J}}function n6(_,R){for(var J=R+"Capture",be=[];_!==null;){var Le=_,Qe=Le.stateNode;Le.tag===5&&Qe!==null&&(Le=Qe,Qe=zn(_,J),Qe!=null&&be.unshift(q1(_,Qe,Le)),Qe=zn(_,R),Qe!=null&&be.push(q1(_,Qe,Le))),_=_.return}return be}function G1(_){if(_===null)return null;do _=_.return;while(_&&_.tag!==5);return _||null}function Qo(_,R,J,be,Le){for(var Qe=R._reactName,Ft=[];J!==null&&J!==be;){var bn=J,Mn=bn.alternate,ur=bn.stateNode;if(Mn!==null&&Mn===be)break;bn.tag===5&&ur!==null&&(bn=ur,Le?(Mn=zn(J,Qe),Mn!=null&&Ft.unshift(q1(J,Mn,bn))):Le||(Mn=zn(J,Qe),Mn!=null&&Ft.push(q1(J,Mn,bn)))),J=J.return}Ft.length!==0&&_.push({event:R,listeners:Ft})}var xc=/\r\n?/g,Dz=/\u0000|\uFFFD/g;function bI(_){return(typeof _=="string"?_:""+_).replace(xc,`
`).replace(Dz,"")}function q2(_,R,J){if(R=bI(R),bI(_)!==R&&J)throw Error(n(425))}function r6(){}var G2=null,jx=null;function K2(_,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,Y2=typeof clearTimeout=="function"?clearTimeout:void 0,K1=typeof Promise=="function"?Promise:void 0,s6=typeof queueMicrotask=="function"?queueMicrotask:typeof K1<"u"?function(_){return K1.resolve(null).then(_).catch(Y1)}:Bm;function Y1(_){setTimeout(function(){throw _})}function V8(_,R){var J=R,be=0;do{var Le=J.nextSibling;if(_.removeChild(J),Le&&Le.nodeType===8)if(J=Le.data,J==="/$"){if(be===0){_.removeChild(Le),Nt(R);return}be--}else J!=="$"&&J!=="$?"&&J!=="$!"||be++;J=Le}while(J);Nt(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 yI(_){_=_.previousSibling;for(var R=0;_;){if(_.nodeType===8){var J=_.data;if(J==="$"||J==="$!"||J==="$?"){if(R===0)return _;R--}else J==="/$"&&R++}_=_.previousSibling}return null}var X1=Math.random().toString(36).slice(2),uh="__reactFiber$"+X1,Um="__reactProps$"+X1,Gu="__reactContainer$"+X1,i6="__reactEvents$"+X1,Wt="__reactListeners$"+X1,Q1="__reactHandles$"+X1;function dh(_){var R=_[uh];if(R)return R;for(var J=_.parentNode;J;){if(R=J[Gu]||J[uh]){if(J=R.alternate,R.child!==null||J!==null&&J.child!==null)for(_=yI(_);_!==null;){if(J=_[uh])return J;_=yI(_)}return R}_=J,J=_.parentNode}return null}function gc(_){return _=_[uh]||_[Gu],!_||_.tag!==5&&_.tag!==6&&_.tag!==13&&_.tag!==3?null:_}function Ai(_){if(_.tag===5||_.tag===6)return _.stateNode;throw Error(n(33))}function a6(_){return _[Um]||null}var W8=[],Z1=-1;function hu(_){return{current:_}}function Ya(_){0>Z1||(_.current=W8[Z1],W8[Z1]=null,Z1--)}function Ha(_,R){Z1++,W8[Z1]=_.current,_.current=R}var zm={},bc=hu(zm),pu=hu(!1),Vc=zm;function J1(_,R){var J=_.type.contextTypes;if(!J)return zm;var be=_.stateNode;if(be&&be.__reactInternalMemoizedUnmaskedChildContext===R)return be.__reactInternalMemoizedMaskedChildContext;var Le={},Qe;for(Qe in J)Le[Qe]=R[Qe];return be&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=R,_.__reactInternalMemoizedMaskedChildContext=Le),Le}function mu(_){return _=_.childContextTypes,_!=null}function o6(){Ya(pu),Ya(bc)}function vI(_,R,J){if(bc.current!==zm)throw Error(n(168));Ha(bc,R),Ha(pu,J)}function wI(_,R,J){var be=_.stateNode;if(R=R.childContextTypes,typeof be.getChildContext!="function")return J;be=be.getChildContext();for(var Le in be)if(!(Le in R))throw Error(n(108,Ce(_)||"Unknown",Le));return ne({},J,be)}function Td(_){return _=(_=_.stateNode)&&_.__reactInternalMemoizedMergedChildContext||zm,Vc=bc.current,Ha(bc,_),Ha(pu,pu.current),!0}function CI(_,R,J){var be=_.stateNode;if(!be)throw Error(n(169));J?(_=wI(_,R,Vc),be.__reactInternalMemoizedMergedChildContext=_,Ya(pu),Ya(bc),Ha(bc,_)):Ya(pu),Ha(pu,J)}var Ap=null,l6=!1,q8=!1;function SI(_){Ap===null?Ap=[_]:Ap.push(_)}function Ax(_){l6=!0,SI(_)}function Hm(){if(!q8&&Ap!==null){q8=!0;var _=0,R=yt;try{var J=Ap;for(yt=1;_<J.length;_++){var be=J[_];do be=be(!0);while(be!==null)}Ap=null,l6=!1}catch(Le){throw Ap!==null&&(Ap=Ap.slice(_+1)),Nn(p,Hm),Le}finally{yt=R,q8=!1}}return null}var eb=[],yc=0,c6=null,u6=0,Id=[],Pd=0,_x=null,fh=1,hh="";function Ex(_,R){eb[yc++]=u6,eb[yc++]=c6,c6=_,u6=R}function NI(_,R,J){Id[Pd++]=fh,Id[Pd++]=hh,Id[Pd++]=_x,_x=_;var be=fh;_=hh;var Le=32-le(be)-1;be&=~(1<<Le),J+=1;var Qe=32-le(R)+Le;if(30<Qe){var Ft=Le-Le%5;Qe=(be&(1<<Ft)-1).toString(32),be>>=Ft,Le-=Ft,fh=1<<32-le(R)+Le|J<<Le|be,hh=Qe+_}else fh=1<<Qe|J<<Le|be,hh=_}function X2(_){_.return!==null&&(Ex(_,1),NI(_,1,0))}function kx(_){for(;_===c6;)c6=eb[--yc],eb[yc]=null,u6=eb[--yc],eb[yc]=null;for(;_===_x;)_x=Id[--Pd],Id[Pd]=null,hh=Id[--Pd],Id[Pd]=null,fh=Id[--Pd],Id[Pd]=null}var vc=null,Ku=null,Xa=!1,jf=null;function ph(_,R){var J=Bd(5,null,null,0);J.elementType="DELETED",J.stateNode=R,J.return=_,R=_.deletions,R===null?(_.deletions=[J],_.flags|=16):R.push(J)}function d6(_,R){switch(_.tag){case 5:var J=_.type;return R=R.nodeType!==1||J.toLowerCase()!==R.nodeName.toLowerCase()?null:R,R!==null?(_.stateNode=R,vc=_,Ku=$m(R.firstChild),!0):!1;case 6:return R=_.pendingProps===""||R.nodeType!==3?null:R,R!==null?(_.stateNode=R,vc=_,Ku=null,!0):!1;case 13:return R=R.nodeType!==8?null:R,R!==null?(J=_x!==null?{id:fh,overflow:hh}:null,_.memoizedState={dehydrated:R,treeContext:J,retryLane:1073741824},J=Bd(18,null,null,0),J.stateNode=R,J.return=_,_.child=J,vc=_,Ku=null,!0):!1;default:return!1}}function _p(_){return(_.mode&1)!==0&&(_.flags&128)===0}function xu(_){if(Xa){var R=Ku;if(R){var J=R;if(!d6(_,R)){if(_p(_))throw Error(n(418));R=$m(J.nextSibling);var be=vc;R&&d6(_,R)?ph(be,J):(_.flags=_.flags&-4097|2,Xa=!1,vc=_)}}else{if(_p(_))throw Error(n(418));_.flags=_.flags&-4097|2,Xa=!1,vc=_}}}function jI(_){for(_=_.return;_!==null&&_.tag!==5&&_.tag!==3&&_.tag!==13;)_=_.return;vc=_}function Q2(_){if(_!==vc)return!1;if(!Xa)return jI(_),Xa=!0,!1;var R;if((R=_.tag!==3)&&!(R=_.tag!==5)&&(R=_.type,R=R!=="head"&&R!=="body"&&!K2(_.type,_.memoizedProps)),R&&(R=Ku)){if(_p(_))throw G8(),Error(n(418));for(;R;)ph(_,R),R=$m(R.nextSibling)}if(jI(_),_.tag===13){if(_=_.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));e:{for(_=_.nextSibling,R=0;_;){if(_.nodeType===8){var J=_.data;if(J==="/$"){if(R===0){Ku=$m(_.nextSibling);break e}R--}else J!=="$"&&J!=="$!"&&J!=="$?"||R++}_=_.nextSibling}Ku=null}}else Ku=vc?$m(_.stateNode.nextSibling):null;return!0}function G8(){for(var _=Ku;_;)_=$m(_.nextSibling)}function mh(){Ku=vc=null,Xa=!1}function xh(_){jf===null?jf=[_]:jf.push(_)}var AI=M.ReactCurrentBatchConfig;function Z2(_,R,J){if(_=J.ref,_!==null&&typeof _!="function"&&typeof _!="object"){if(J._owner){if(J=J._owner,J){if(J.tag!==1)throw Error(n(309));var be=J.stateNode}if(!be)throw Error(n(147,_));var Le=be,Qe=""+_;return R!==null&&R.ref!==null&&typeof R.ref=="function"&&R.ref._stringRef===Qe?R.ref:(R=function(Ft){var bn=Le.refs;Ft===null?delete bn[Qe]:bn[Qe]=Ft},R._stringRef=Qe,R)}if(typeof _!="string")throw Error(n(284));if(!J._owner)throw Error(n(290,_))}return _}function Tx(_,R){throw _=Object.prototype.toString.call(R),Error(n(31,_==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":_))}function _I(_){var R=_._init;return R(_._payload)}function K8(_){function R(rr,Hn){if(_){var or=rr.deletions;or===null?(rr.deletions=[Hn],rr.flags|=16):or.push(Hn)}}function J(rr,Hn){if(!_)return null;for(;Hn!==null;)R(rr,Hn),Hn=Hn.sibling;return null}function be(rr,Hn){for(rr=new Map;Hn!==null;)Hn.key!==null?rr.set(Hn.key,Hn):rr.set(Hn.index,Hn),Hn=Hn.sibling;return rr}function Le(rr,Hn){return rr=Pf(rr,Hn),rr.index=0,rr.sibling=null,rr}function Qe(rr,Hn,or){return rr.index=or,_?(or=rr.alternate,or!==null?(or=or.index,or<Hn?(rr.flags|=2,Hn):or):(rr.flags|=2,Hn)):(rr.flags|=1048576,Hn)}function Ft(rr){return _&&rr.alternate===null&&(rr.flags|=2),rr}function bn(rr,Hn,or,Qr){return Hn===null||Hn.tag!==6?(Hn=OA(or,rr.mode,Qr),Hn.return=rr,Hn):(Hn=Le(Hn,or),Hn.return=rr,Hn)}function Mn(rr,Hn,or,Qr){var Fs=or.type;return Fs===L?zr(rr,Hn,or.props.children,Qr,or.key):Hn!==null&&(Hn.elementType===Fs||typeof Fs=="object"&&Fs!==null&&Fs.$$typeof===ie&&_I(Fs)===Hn.type)?(Qr=Le(Hn,or.props),Qr.ref=Z2(rr,Hn,or),Qr.return=rr,Qr):(Qr=q6(or.type,or.key,or.props,null,rr.mode,Qr),Qr.ref=Z2(rr,Hn,or),Qr.return=rr,Qr)}function ur(rr,Hn,or,Qr){return Hn===null||Hn.tag!==4||Hn.stateNode.containerInfo!==or.containerInfo||Hn.stateNode.implementation!==or.implementation?(Hn=MA(or,rr.mode,Qr),Hn.return=rr,Hn):(Hn=Le(Hn,or.children||[]),Hn.return=rr,Hn)}function zr(rr,Hn,or,Qr,Fs){return Hn===null||Hn.tag!==7?(Hn=Ux(or,rr.mode,Qr,Fs),Hn.return=rr,Hn):(Hn=Le(Hn,or),Hn.return=rr,Hn)}function Wr(rr,Hn,or){if(typeof Hn=="string"&&Hn!==""||typeof Hn=="number")return Hn=OA(""+Hn,rr.mode,or),Hn.return=rr,Hn;if(typeof Hn=="object"&&Hn!==null){switch(Hn.$$typeof){case F:return or=q6(Hn.type,Hn.key,Hn.props,null,rr.mode,or),or.ref=Z2(rr,null,Hn),or.return=rr,or;case $:return Hn=MA(Hn,rr.mode,or),Hn.return=rr,Hn;case ie:var Qr=Hn._init;return Wr(rr,Qr(Hn._payload),or)}if(Qt(Hn)||W(Hn))return Hn=Ux(Hn,rr.mode,or,null),Hn.return=rr,Hn;Tx(rr,Hn)}return null}function Ur(rr,Hn,or,Qr){var Fs=Hn!==null?Hn.key:null;if(typeof or=="string"&&or!==""||typeof or=="number")return Fs!==null?null:bn(rr,Hn,""+or,Qr);if(typeof or=="object"&&or!==null){switch(or.$$typeof){case F:return or.key===Fs?Mn(rr,Hn,or,Qr):null;case $:return or.key===Fs?ur(rr,Hn,or,Qr):null;case ie:return Fs=or._init,Ur(rr,Hn,Fs(or._payload),Qr)}if(Qt(or)||W(or))return Fs!==null?null:zr(rr,Hn,or,Qr,null);Tx(rr,or)}return null}function hs(rr,Hn,or,Qr,Fs){if(typeof Qr=="string"&&Qr!==""||typeof Qr=="number")return rr=rr.get(or)||null,bn(Hn,rr,""+Qr,Fs);if(typeof Qr=="object"&&Qr!==null){switch(Qr.$$typeof){case F:return rr=rr.get(Qr.key===null?or:Qr.key)||null,Mn(Hn,rr,Qr,Fs);case $:return rr=rr.get(Qr.key===null?or:Qr.key)||null,ur(Hn,rr,Qr,Fs);case ie:var qs=Qr._init;return hs(rr,Hn,or,qs(Qr._payload),Fs)}if(Qt(Qr)||W(Qr))return rr=rr.get(or)||null,zr(Hn,rr,Qr,Fs,null);Tx(Hn,Qr)}return null}function js(rr,Hn,or,Qr){for(var Fs=null,qs=null,Gs=Hn,Js=Hn=0,xl=null;Gs!==null&&Js<or.length;Js++){Gs.index>Js?(xl=Gs,Gs=null):xl=Gs.sibling;var ua=Ur(rr,Gs,or[Js],Qr);if(ua===null){Gs===null&&(Gs=xl);break}_&&Gs&&ua.alternate===null&&R(rr,Gs),Hn=Qe(ua,Hn,Js),qs===null?Fs=ua:qs.sibling=ua,qs=ua,Gs=xl}if(Js===or.length)return J(rr,Gs),Xa&&Ex(rr,Js),Fs;if(Gs===null){for(;Js<or.length;Js++)Gs=Wr(rr,or[Js],Qr),Gs!==null&&(Hn=Qe(Gs,Hn,Js),qs===null?Fs=Gs:qs.sibling=Gs,qs=Gs);return Xa&&Ex(rr,Js),Fs}for(Gs=be(rr,Gs);Js<or.length;Js++)xl=hs(Gs,rr,Js,or[Js],Qr),xl!==null&&(_&&xl.alternate!==null&&Gs.delete(xl.key===null?Js:xl.key),Hn=Qe(xl,Hn,Js),qs===null?Fs=xl:qs.sibling=xl,qs=xl);return _&&Gs.forEach(function(t0){return R(rr,t0)}),Xa&&Ex(rr,Js),Fs}function Ps(rr,Hn,or,Qr){var Fs=W(or);if(typeof Fs!="function")throw Error(n(150));if(or=Fs.call(or),or==null)throw Error(n(151));for(var qs=Fs=null,Gs=Hn,Js=Hn=0,xl=null,ua=or.next();Gs!==null&&!ua.done;Js++,ua=or.next()){Gs.index>Js?(xl=Gs,Gs=null):xl=Gs.sibling;var t0=Ur(rr,Gs,ua.value,Qr);if(t0===null){Gs===null&&(Gs=xl);break}_&&Gs&&t0.alternate===null&&R(rr,Gs),Hn=Qe(t0,Hn,Js),qs===null?Fs=t0:qs.sibling=t0,qs=t0,Gs=xl}if(ua.done)return J(rr,Gs),Xa&&Ex(rr,Js),Fs;if(Gs===null){for(;!ua.done;Js++,ua=or.next())ua=Wr(rr,ua.value,Qr),ua!==null&&(Hn=Qe(ua,Hn,Js),qs===null?Fs=ua:qs.sibling=ua,qs=ua);return Xa&&Ex(rr,Js),Fs}for(Gs=be(rr,Gs);!ua.done;Js++,ua=or.next())ua=hs(Gs,rr,Js,ua.value,Qr),ua!==null&&(_&&ua.alternate!==null&&Gs.delete(ua.key===null?Js:ua.key),Hn=Qe(ua,Hn,Js),qs===null?Fs=ua:qs.sibling=ua,qs=ua);return _&&Gs.forEach(function(rH){return R(rr,rH)}),Xa&&Ex(rr,Js),Fs}function To(rr,Hn,or,Qr){if(typeof or=="object"&&or!==null&&or.type===L&&or.key===null&&(or=or.props.children),typeof or=="object"&&or!==null){switch(or.$$typeof){case F:e:{for(var Fs=or.key,qs=Hn;qs!==null;){if(qs.key===Fs){if(Fs=or.type,Fs===L){if(qs.tag===7){J(rr,qs.sibling),Hn=Le(qs,or.props.children),Hn.return=rr,rr=Hn;break e}}else if(qs.elementType===Fs||typeof Fs=="object"&&Fs!==null&&Fs.$$typeof===ie&&_I(Fs)===qs.type){J(rr,qs.sibling),Hn=Le(qs,or.props),Hn.ref=Z2(rr,qs,or),Hn.return=rr,rr=Hn;break e}J(rr,qs);break}else R(rr,qs);qs=qs.sibling}or.type===L?(Hn=Ux(or.props.children,rr.mode,Qr,or.key),Hn.return=rr,rr=Hn):(Qr=q6(or.type,or.key,or.props,null,rr.mode,Qr),Qr.ref=Z2(rr,Hn,or),Qr.return=rr,rr=Qr)}return Ft(rr);case $:e:{for(qs=or.key;Hn!==null;){if(Hn.key===qs)if(Hn.tag===4&&Hn.stateNode.containerInfo===or.containerInfo&&Hn.stateNode.implementation===or.implementation){J(rr,Hn.sibling),Hn=Le(Hn,or.children||[]),Hn.return=rr,rr=Hn;break e}else{J(rr,Hn);break}else R(rr,Hn);Hn=Hn.sibling}Hn=MA(or,rr.mode,Qr),Hn.return=rr,rr=Hn}return Ft(rr);case ie:return qs=or._init,To(rr,Hn,qs(or._payload),Qr)}if(Qt(or))return js(rr,Hn,or,Qr);if(W(or))return Ps(rr,Hn,or,Qr);Tx(rr,or)}return typeof or=="string"&&or!==""||typeof or=="number"?(or=""+or,Hn!==null&&Hn.tag===6?(J(rr,Hn.sibling),Hn=Le(Hn,or),Hn.return=rr,rr=Hn):(J(rr,Hn),Hn=OA(or,rr.mode,Qr),Hn.return=rr,rr=Hn),Ft(rr)):J(rr,Hn)}return To}var ko=K8(!0),f6=K8(!1),J2=hu(null),Yu=null,Vm=null,tb=null;function Ep(){tb=Vm=Yu=null}function h6(_){var R=J2.current;Ya(J2),_._currentValue=R}function Zl(_,R,J){for(;_!==null;){var be=_.alternate;if((_.childLanes&R)!==R?(_.childLanes|=R,be!==null&&(be.childLanes|=R)):be!==null&&(be.childLanes&R)!==R&&(be.childLanes|=R),_===J)break;_=_.return}}function Wm(_,R){Yu=_,tb=Vm=null,_=_.dependencies,_!==null&&_.firstContext!==null&&(_.lanes&R&&(qc=!0),_.firstContext=null)}function Fd(_){var R=_._currentValue;if(tb!==_)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 Ix=null;function Y8(_){Ix===null?Ix=[_]:Ix.push(_)}function p6(_,R,J,be){var Le=R.interleaved;return Le===null?(J.next=J,Y8(R)):(J.next=Le.next,Le.next=J),R.interleaved=J,kp(_,be)}function kp(_,R){_.lanes|=R;var J=_.alternate;for(J!==null&&(J.lanes|=R),J=_,_=_.return;_!==null;)_.childLanes|=R,J=_.alternate,J!==null&&(J.childLanes|=R),J=_,_=_.return;return J.tag===3?J.stateNode:null}var Od=!1;function m6(_){_.updateQueue={baseState:_.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function EI(_,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,J){var be=_.updateQueue;if(be===null)return null;if(be=be.shared,Zi&2){var Le=be.pending;return Le===null?R.next=R:(R.next=Le.next,Le.next=R),be.pending=R,kp(_,J)}return Le=be.interleaved,Le===null?(R.next=R,Y8(be)):(R.next=Le.next,Le.next=R),be.interleaved=R,kp(_,J)}function x6(_,R,J){if(R=R.updateQueue,R!==null&&(R=R.shared,(J&4194240)!==0)){var be=R.lanes;be&=_.pendingLanes,J|=be,R.lanes=J,ut(_,J)}}function kI(_,R){var J=_.updateQueue,be=_.alternate;if(be!==null&&(be=be.updateQueue,J===be)){var Le=null,Qe=null;if(J=J.firstBaseUpdate,J!==null){do{var Ft={eventTime:J.eventTime,lane:J.lane,tag:J.tag,payload:J.payload,callback:J.callback,next:null};Qe===null?Le=Qe=Ft:Qe=Qe.next=Ft,J=J.next}while(J!==null);Qe===null?Le=Qe=R:Qe=Qe.next=R}else Le=Qe=R;J={baseState:be.baseState,firstBaseUpdate:Le,lastBaseUpdate:Qe,shared:be.shared,effects:be.effects},_.updateQueue=J;return}_=J.lastBaseUpdate,_===null?J.firstBaseUpdate=R:_.next=R,J.lastBaseUpdate=R}function nb(_,R,J,be){var Le=_.updateQueue;Od=!1;var Qe=Le.firstBaseUpdate,Ft=Le.lastBaseUpdate,bn=Le.shared.pending;if(bn!==null){Le.shared.pending=null;var Mn=bn,ur=Mn.next;Mn.next=null,Ft===null?Qe=ur:Ft.next=ur,Ft=Mn;var zr=_.alternate;zr!==null&&(zr=zr.updateQueue,bn=zr.lastBaseUpdate,bn!==Ft&&(bn===null?zr.firstBaseUpdate=ur:bn.next=ur,zr.lastBaseUpdate=Mn))}if(Qe!==null){var Wr=Le.baseState;Ft=0,zr=ur=Mn=null,bn=Qe;do{var Ur=bn.lane,hs=bn.eventTime;if((be&Ur)===Ur){zr!==null&&(zr=zr.next={eventTime:hs,lane:0,tag:bn.tag,payload:bn.payload,callback:bn.callback,next:null});e:{var js=_,Ps=bn;switch(Ur=R,hs=J,Ps.tag){case 1:if(js=Ps.payload,typeof js=="function"){Wr=js.call(hs,Wr,Ur);break e}Wr=js;break e;case 3:js.flags=js.flags&-65537|128;case 0:if(js=Ps.payload,Ur=typeof js=="function"?js.call(hs,Wr,Ur):js,Ur==null)break e;Wr=ne({},Wr,Ur);break e;case 2:Od=!0}}bn.callback!==null&&bn.lane!==0&&(_.flags|=64,Ur=Le.effects,Ur===null?Le.effects=[bn]:Ur.push(bn))}else hs={eventTime:hs,lane:Ur,tag:bn.tag,payload:bn.payload,callback:bn.callback,next:null},zr===null?(ur=zr=hs,Mn=Wr):zr=zr.next=hs,Ft|=Ur;if(bn=bn.next,bn===null){if(bn=Le.shared.pending,bn===null)break;Ur=bn,bn=Ur.next,Ur.next=null,Le.lastBaseUpdate=Ur,Le.shared.pending=null}}while(!0);if(zr===null&&(Mn=Wr),Le.baseState=Mn,Le.firstBaseUpdate=ur,Le.lastBaseUpdate=zr,R=Le.shared.interleaved,R!==null){Le=R;do Ft|=Le.lane,Le=Le.next;while(Le!==R)}else Qe===null&&(Le.shared.lanes=0);Xm|=Ft,_.lanes=Ft,_.memoizedState=Wr}}function X8(_,R,J){if(_=R.effects,R.effects=null,_!==null)for(R=0;R<_.length;R++){var be=_[R],Le=be.callback;if(Le!==null){if(be.callback=null,be=J,typeof Le!="function")throw Error(n(191,Le));Le.call(be)}}}var ev={},gh=hu(ev),tv=hu(ev),rb=hu(ev);function Ip(_){if(_===ev)throw Error(n(174));return _}function Q8(_,R){switch(Ha(rb,R),Ha(tv,_),Ha(gh,ev),_=R.nodeType,_){case 9:case 11:R=(R=R.documentElement)?R.namespaceURI:rn(null,"");break;default:_=_===8?R.parentNode:R,R=_.namespaceURI||null,_=_.tagName,R=rn(R,_)}Ya(gh),Ha(gh,R)}function qm(){Ya(gh),Ya(tv),Ya(rb)}function Z8(_){Ip(rb.current);var R=Ip(gh.current),J=rn(R,_.type);R!==J&&(Ha(tv,_),Ha(gh,J))}function g6(_){tv.current===_&&(Ya(gh),Ya(tv))}var io=hu(0);function Px(_){for(var R=_;R!==null;){if(R.tag===13){var J=R.memoizedState;if(J!==null&&(J=J.dehydrated,J===null||J.data==="$?"||J.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 J8=[];function b6(){for(var _=0;_<J8.length;_++)J8[_]._workInProgressVersionPrimary=null;J8.length=0}var nv=M.ReactCurrentDispatcher,eA=M.ReactCurrentBatchConfig,Gm=0,bo=null,zo=null,pl=null,sb=!1,rv=!1,Fx=0,Mi=0;function wc(){throw Error(n(321))}function tA(_,R){if(R===null)return!1;for(var J=0;J<R.length&&J<_.length;J++)if(!Jt(_[J],R[J]))return!1;return!0}function Ox(_,R,J,be,Le,Qe){if(Gm=Qe,bo=R,R.memoizedState=null,R.updateQueue=null,R.lanes=0,nv.current=_===null||_.memoizedState===null?$z:j6,_=J(be,Le),rv){Qe=0;do{if(rv=!1,Fx=0,25<=Qe)throw Error(n(301));Qe+=1,pl=zo=null,R.updateQueue=null,nv.current=lb,_=J(be,Le)}while(rv)}if(nv.current=N6,R=zo!==null&&zo.next!==null,Gm=0,pl=zo=bo=null,sb=!1,R)throw Error(n(300));return _}function y6(){var _=Fx!==0;return Fx=0,_}function bh(){var _={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pl===null?bo.memoizedState=pl=_:pl=pl.next=_,pl}function Rd(){if(zo===null){var _=bo.alternate;_=_!==null?_.memoizedState:null}else _=zo.next;var R=pl===null?bo.memoizedState:pl.next;if(R!==null)pl=R,zo=_;else{if(_===null)throw Error(n(310));zo=_,_={memoizedState:zo.memoizedState,baseState:zo.baseState,baseQueue:zo.baseQueue,queue:zo.queue,next:null},pl===null?bo.memoizedState=pl=_:pl=pl.next=_}return pl}function Cc(_,R){return typeof R=="function"?R(_):R}function nA(_){var R=Rd(),J=R.queue;if(J===null)throw Error(n(311));J.lastRenderedReducer=_;var be=zo,Le=be.baseQueue,Qe=J.pending;if(Qe!==null){if(Le!==null){var Ft=Le.next;Le.next=Qe.next,Qe.next=Ft}be.baseQueue=Le=Qe,J.pending=null}if(Le!==null){Qe=Le.next,be=be.baseState;var bn=Ft=null,Mn=null,ur=Qe;do{var zr=ur.lane;if((Gm&zr)===zr)Mn!==null&&(Mn=Mn.next={lane:0,action:ur.action,hasEagerState:ur.hasEagerState,eagerState:ur.eagerState,next:null}),be=ur.hasEagerState?ur.eagerState:_(be,ur.action);else{var Wr={lane:zr,action:ur.action,hasEagerState:ur.hasEagerState,eagerState:ur.eagerState,next:null};Mn===null?(bn=Mn=Wr,Ft=be):Mn=Mn.next=Wr,bo.lanes|=zr,Xm|=zr}ur=ur.next}while(ur!==null&&ur!==Qe);Mn===null?Ft=be:Mn.next=bn,Jt(be,R.memoizedState)||(qc=!0),R.memoizedState=be,R.baseState=Ft,R.baseQueue=Mn,J.lastRenderedState=be}if(_=J.interleaved,_!==null){Le=_;do Qe=Le.lane,bo.lanes|=Qe,Xm|=Qe,Le=Le.next;while(Le!==_)}else Le===null&&(J.lanes=0);return[R.memoizedState,J.dispatch]}function ib(_){var R=Rd(),J=R.queue;if(J===null)throw Error(n(311));J.lastRenderedReducer=_;var be=J.dispatch,Le=J.pending,Qe=R.memoizedState;if(Le!==null){J.pending=null;var Ft=Le=Le.next;do Qe=_(Qe,Ft.action),Ft=Ft.next;while(Ft!==Le);Jt(Qe,R.memoizedState)||(qc=!0),R.memoizedState=Qe,R.baseQueue===null&&(R.baseState=Qe),J.lastRenderedState=Qe}return[Qe,be]}function v6(){}function rA(_,R){var J=bo,be=Rd(),Le=R(),Qe=!Jt(be.memoizedState,Le);if(Qe&&(be.memoizedState=Le,qc=!0),be=be.queue,yh(Pp.bind(null,J,be,_),[_]),be.getSnapshot!==R||Qe||pl!==null&&pl.memoizedState.tag&1){if(J.flags|=2048,ab(9,gu.bind(null,J,be,Le,R),void 0,null),Ol===null)throw Error(n(349));Gm&30||sA(J,R,Le)}return Le}function sA(_,R,J){_.flags|=16384,_={getSnapshot:R,value:J},R=bo.updateQueue,R===null?(R={lastEffect:null,stores:null},bo.updateQueue=R,R.stores=[_]):(J=R.stores,J===null?R.stores=[_]:J.push(_))}function gu(_,R,J,be){R.value=J,R.getSnapshot=be,w6(R)&&iA(_)}function Pp(_,R,J){return J(function(){w6(R)&&iA(_)})}function w6(_){var R=_.getSnapshot;_=_.value;try{var J=R();return!Jt(_,J)}catch{return!0}}function iA(_){var R=kp(_,1);R!==null&&If(R,_,1,-1)}function sv(_){var R=bh();return typeof _=="function"&&(_=_()),R.memoizedState=R.baseState=_,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cc,lastRenderedState:_},R.queue=_,_=_.dispatch=MI.bind(null,bo,_),[R.memoizedState,_]}function ab(_,R,J,be){return _={tag:_,create:R,destroy:J,deps:be,next:null},R=bo.updateQueue,R===null?(R={lastEffect:null,stores:null},bo.updateQueue=R,R.lastEffect=_.next=_):(J=R.lastEffect,J===null?R.lastEffect=_.next=_:(be=J.next,J.next=_,_.next=be,R.lastEffect=_)),_}function C6(){return Rd().memoizedState}function iv(_,R,J,be){var Le=bh();bo.flags|=_,Le.memoizedState=ab(1|R,J,void 0,be===void 0?null:be)}function ob(_,R,J,be){var Le=Rd();be=be===void 0?null:be;var Qe=void 0;if(zo!==null){var Ft=zo.memoizedState;if(Qe=Ft.destroy,be!==null&&tA(be,Ft.deps)){Le.memoizedState=ab(R,J,Qe,be);return}}bo.flags|=_,Le.memoizedState=ab(1|R,J,Qe,be)}function S6(_,R){return iv(8390656,8,_,R)}function yh(_,R){return ob(2048,8,_,R)}function TI(_,R){return ob(4,2,_,R)}function Fp(_,R){return ob(4,4,_,R)}function aA(_,R){if(typeof R=="function")return _=_(),R(_),function(){R(null)};if(R!=null)return _=_(),R.current=_,function(){R.current=null}}function oA(_,R,J){return J=J!=null?J.concat([_]):null,ob(4,4,aA.bind(null,R,_),J)}function av(){}function II(_,R){var J=Rd();R=R===void 0?null:R;var be=J.memoizedState;return be!==null&&R!==null&&tA(R,be[1])?be[0]:(J.memoizedState=[_,R],_)}function PI(_,R){var J=Rd();R=R===void 0?null:R;var be=J.memoizedState;return be!==null&&R!==null&&tA(R,be[1])?be[0]:(_=_(),J.memoizedState=[_,R],_)}function FI(_,R,J){return Gm&21?(Jt(J,R)||(J=Be(),bo.lanes|=J,Xm|=J,_.baseState=!0),R):(_.baseState&&(_.baseState=!1,qc=!0),_.memoizedState=J)}function OI(_,R){var J=yt;yt=J!==0&&4>J?J:4,_(!0);var be=eA.transition;eA.transition={};try{_(!1),R()}finally{yt=J,eA.transition=be}}function lA(){return Rd().memoizedState}function Bz(_,R,J){var be=Jm(_);if(J={lane:be,action:J,hasEagerState:!1,eagerState:null,next:null},cA(_))Wc(R,J);else if(J=p6(_,R,J,be),J!==null){var Le=Yc();If(J,_,be,Le),Af(J,R,be)}}function MI(_,R,J){var be=Jm(_),Le={lane:be,action:J,hasEagerState:!1,eagerState:null,next:null};if(cA(_))Wc(R,Le);else{var Qe=_.alternate;if(_.lanes===0&&(Qe===null||Qe.lanes===0)&&(Qe=R.lastRenderedReducer,Qe!==null))try{var Ft=R.lastRenderedState,bn=Qe(Ft,J);if(Le.hasEagerState=!0,Le.eagerState=bn,Jt(bn,Ft)){var Mn=R.interleaved;Mn===null?(Le.next=Le,Y8(R)):(Le.next=Mn.next,Mn.next=Le),R.interleaved=Le;return}}catch{}finally{}J=p6(_,R,Le,be),J!==null&&(Le=Yc(),If(J,_,be,Le),Af(J,R,be))}}function cA(_){var R=_.alternate;return _===bo||R!==null&&R===bo}function Wc(_,R){rv=sb=!0;var J=_.pending;J===null?R.next=R:(R.next=J.next,J.next=R),_.pending=R}function Af(_,R,J){if(J&4194240){var be=R.lanes;be&=_.pendingLanes,J|=be,R.lanes=J,ut(_,J)}}var N6={readContext:Fd,useCallback:wc,useContext:wc,useEffect:wc,useImperativeHandle:wc,useInsertionEffect:wc,useLayoutEffect:wc,useMemo:wc,useReducer:wc,useRef:wc,useState:wc,useDebugValue:wc,useDeferredValue:wc,useTransition:wc,useMutableSource:wc,useSyncExternalStore:wc,useId:wc,unstable_isNewReconciler:!1},$z={readContext:Fd,useCallback:function(_,R){return bh().memoizedState=[_,R===void 0?null:R],_},useContext:Fd,useEffect:S6,useImperativeHandle:function(_,R,J){return J=J!=null?J.concat([_]):null,iv(4194308,4,aA.bind(null,R,_),J)},useLayoutEffect:function(_,R){return iv(4194308,4,_,R)},useInsertionEffect:function(_,R){return iv(4,2,_,R)},useMemo:function(_,R){var J=bh();return R=R===void 0?null:R,_=_(),J.memoizedState=[_,R],_},useReducer:function(_,R,J){var be=bh();return R=J!==void 0?J(R):R,be.memoizedState=be.baseState=R,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_,lastRenderedState:R},be.queue=_,_=_.dispatch=Bz.bind(null,bo,_),[be.memoizedState,_]},useRef:function(_){var R=bh();return _={current:_},R.memoizedState=_},useState:sv,useDebugValue:av,useDeferredValue:function(_){return bh().memoizedState=_},useTransition:function(){var _=sv(!1),R=_[0];return _=OI.bind(null,_[1]),bh().memoizedState=_,[R,_]},useMutableSource:function(){},useSyncExternalStore:function(_,R,J){var be=bo,Le=bh();if(Xa){if(J===void 0)throw Error(n(407));J=J()}else{if(J=R(),Ol===null)throw Error(n(349));Gm&30||sA(be,R,J)}Le.memoizedState=J;var Qe={value:J,getSnapshot:R};return Le.queue=Qe,S6(Pp.bind(null,be,Qe,_),[_]),be.flags|=2048,ab(9,gu.bind(null,be,Qe,J,R),void 0,null),J},useId:function(){var _=bh(),R=Ol.identifierPrefix;if(Xa){var J=hh,be=fh;J=(be&~(1<<32-le(be)-1)).toString(32)+J,R=":"+R+"R"+J,J=Fx++,0<J&&(R+="H"+J.toString(32)),R+=":"}else J=Mi++,R=":"+R+"r"+J.toString(32)+":";return _.memoizedState=R},unstable_isNewReconciler:!1},j6={readContext:Fd,useCallback:II,useContext:Fd,useEffect:yh,useImperativeHandle:oA,useInsertionEffect:TI,useLayoutEffect:Fp,useMemo:PI,useReducer:nA,useRef:C6,useState:function(){return nA(Cc)},useDebugValue:av,useDeferredValue:function(_){var R=Rd();return FI(R,zo.memoizedState,_)},useTransition:function(){var _=nA(Cc)[0],R=Rd().memoizedState;return[_,R]},useMutableSource:v6,useSyncExternalStore:rA,useId:lA,unstable_isNewReconciler:!1},lb={readContext:Fd,useCallback:II,useContext:Fd,useEffect:yh,useImperativeHandle:oA,useInsertionEffect:TI,useLayoutEffect:Fp,useMemo:PI,useReducer:ib,useRef:C6,useState:function(){return ib(Cc)},useDebugValue:av,useDeferredValue:function(_){var R=Rd();return zo===null?R.memoizedState=_:FI(R,zo.memoizedState,_)},useTransition:function(){var _=ib(Cc)[0],R=Rd().memoizedState;return[_,R]},useMutableSource:v6,useSyncExternalStore:rA,useId:lA,unstable_isNewReconciler:!1};function Ld(_,R){if(_&&_.defaultProps){R=ne({},R),_=_.defaultProps;for(var J in _)R[J]===void 0&&(R[J]=_[J]);return R}return R}function A6(_,R,J,be){R=_.memoizedState,J=J(be,R),J=J==null?R:ne({},R,J),_.memoizedState=J,_.lanes===0&&(_.updateQueue.baseState=J)}var _6={isMounted:function(_){return(_=_._reactInternals)?Mt(_)===_:!1},enqueueSetState:function(_,R,J){_=_._reactInternals;var be=Yc(),Le=Jm(_),Qe=Tp(be,Le);Qe.payload=R,J!=null&&(Qe.callback=J),R=Md(_,Qe,Le),R!==null&&(If(R,_,Le,be),x6(R,_,Le))},enqueueReplaceState:function(_,R,J){_=_._reactInternals;var be=Yc(),Le=Jm(_),Qe=Tp(be,Le);Qe.tag=1,Qe.payload=R,J!=null&&(Qe.callback=J),R=Md(_,Qe,Le),R!==null&&(If(R,_,Le,be),x6(R,_,Le))},enqueueForceUpdate:function(_,R){_=_._reactInternals;var J=Yc(),be=Jm(_),Le=Tp(J,be);Le.tag=2,R!=null&&(Le.callback=R),R=Md(_,Le,be),R!==null&&(If(R,_,be,J),x6(R,_,be))}};function uA(_,R,J,be,Le,Qe,Ft){return _=_.stateNode,typeof _.shouldComponentUpdate=="function"?_.shouldComponentUpdate(be,Qe,Ft):R.prototype&&R.prototype.isPureReactComponent?!Pn(J,be)||!Pn(Le,Qe):!0}function Mx(_,R,J){var be=!1,Le=zm,Qe=R.contextType;return typeof Qe=="object"&&Qe!==null?Qe=Fd(Qe):(Le=mu(R)?Vc:bc.current,be=R.contextTypes,Qe=(be=be!=null)?J1(_,Le):zm),R=new R(J,Qe),_.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,R.updater=_6,_.stateNode=R,R._reactInternals=_,be&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=Le,_.__reactInternalMemoizedMaskedChildContext=Qe),R}function cb(_,R,J,be){_=R.state,typeof R.componentWillReceiveProps=="function"&&R.componentWillReceiveProps(J,be),typeof R.UNSAFE_componentWillReceiveProps=="function"&&R.UNSAFE_componentWillReceiveProps(J,be),R.state!==_&&_6.enqueueReplaceState(R,R.state,null)}function dA(_,R,J,be){var Le=_.stateNode;Le.props=J,Le.state=_.memoizedState,Le.refs={},m6(_);var Qe=R.contextType;typeof Qe=="object"&&Qe!==null?Le.context=Fd(Qe):(Qe=mu(R)?Vc:bc.current,Le.context=J1(_,Qe)),Le.state=_.memoizedState,Qe=R.getDerivedStateFromProps,typeof Qe=="function"&&(A6(_,R,Qe,J),Le.state=_.memoizedState),typeof R.getDerivedStateFromProps=="function"||typeof Le.getSnapshotBeforeUpdate=="function"||typeof Le.UNSAFE_componentWillMount!="function"&&typeof Le.componentWillMount!="function"||(R=Le.state,typeof Le.componentWillMount=="function"&&Le.componentWillMount(),typeof Le.UNSAFE_componentWillMount=="function"&&Le.UNSAFE_componentWillMount(),R!==Le.state&&_6.enqueueReplaceState(Le,Le.state,null),nb(_,J,Le,be),Le.state=_.memoizedState),typeof Le.componentDidMount=="function"&&(_.flags|=4194308)}function Rx(_,R){try{var J="",be=R;do J+=Se(be),be=be.return;while(be);var Le=J}catch(Qe){Le=`
Error generating stack: `+Qe.message+`
`+Qe.stack}return{value:_,source:R,stack:Le,digest:null}}function E6(_,R,J){return{value:_,source:null,stack:J??null,digest:R??null}}function ub(_,R){try{console.error(R.value)}catch(J){setTimeout(function(){throw J})}}var RI=typeof WeakMap=="function"?WeakMap:Map;function ov(_,R,J){J=Tp(-1,J),J.tag=3,J.payload={element:null};var be=R.value;return J.callback=function(){B6||(B6=!0,_A=be),ub(_,R)},J}function k6(_,R,J){J=Tp(-1,J),J.tag=3;var be=_.type.getDerivedStateFromError;if(typeof be=="function"){var Le=R.value;J.payload=function(){return be(Le)},J.callback=function(){ub(_,R)}}var Qe=_.stateNode;return Qe!==null&&typeof Qe.componentDidCatch=="function"&&(J.callback=function(){ub(_,R),typeof be!="function"&&(Qm===null?Qm=new Set([this]):Qm.add(this));var Ft=R.stack;this.componentDidCatch(R.value,{componentStack:Ft!==null?Ft:""})}),J}function lv(_,R,J){var be=_.pingCache;if(be===null){be=_.pingCache=new RI;var Le=new Set;be.set(R,Le)}else Le=be.get(R),Le===void 0&&(Le=new Set,be.set(R,Le));Le.has(J)||(Le.add(J),_=Kz.bind(null,_,R,J),R.then(_,_))}function LI(_){do{var R;if((R=_.tag===13)&&(R=_.memoizedState,R=R!==null?R.dehydrated!==null:!0),R)return _;_=_.return}while(_!==null);return null}function fA(_,R,J,be,Le){return _.mode&1?(_.flags|=65536,_.lanes=Le,_):(_===R?_.flags|=65536:(_.flags|=128,J.flags|=131072,J.flags&=-52805,J.tag===1&&(J.alternate===null?J.tag=17:(R=Tp(-1,1),R.tag=2,Md(J,R,1))),J.lanes|=1),_)}var T6=M.ReactCurrentOwner,qc=!1;function Jl(_,R,J,be){R.child=_===null?f6(R,null,J,be):ko(R,_.child,J,be)}function DI(_,R,J,be,Le){J=J.render;var Qe=R.ref;return Wm(R,Le),be=Ox(_,R,J,be,Qe,Le),J=y6(),_!==null&&!qc?(R.updateQueue=_.updateQueue,R.flags&=-2053,_.lanes&=~Le,_f(_,R,Le)):(Xa&&J&&X2(R),R.flags|=1,Jl(_,R,be,Le),R.child)}function hA(_,R,J,be,Le){if(_===null){var Qe=J.type;return typeof Qe=="function"&&!W6(Qe)&&Qe.defaultProps===void 0&&J.compare===null&&J.defaultProps===void 0?(R.tag=15,R.type=Qe,vh(_,R,Qe,be,Le)):(_=q6(J.type,null,be,R,R.mode,Le),_.ref=R.ref,_.return=R,R.child=_)}if(Qe=_.child,!(_.lanes&Le)){var Ft=Qe.memoizedProps;if(J=J.compare,J=J!==null?J:Pn,J(Ft,be)&&_.ref===R.ref)return _f(_,R,Le)}return R.flags|=1,_=Pf(Qe,be),_.ref=R.ref,_.return=R,R.child=_}function vh(_,R,J,be,Le){if(_!==null){var Qe=_.memoizedProps;if(Pn(Qe,be)&&_.ref===R.ref)if(qc=!1,R.pendingProps=be=Qe,(_.lanes&Le)!==0)_.flags&131072&&(qc=!0);else return R.lanes=_.lanes,_f(_,R,Le)}return xA(_,R,J,be,Le)}function pA(_,R,J){var be=R.pendingProps,Le=be.children,Qe=_!==null?_.memoizedState:null;if(be.mode==="hidden")if(!(R.mode&1))R.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ha(pb,Qu),Qu|=J;else{if(!(J&1073741824))return _=Qe!==null?Qe.baseLanes|J:J,R.lanes=R.childLanes=1073741824,R.memoizedState={baseLanes:_,cachePool:null,transitions:null},R.updateQueue=null,Ha(pb,Qu),Qu|=_,null;R.memoizedState={baseLanes:0,cachePool:null,transitions:null},be=Qe!==null?Qe.baseLanes:J,Ha(pb,Qu),Qu|=be}else Qe!==null?(be=Qe.baseLanes|J,R.memoizedState=null):be=J,Ha(pb,Qu),Qu|=be;return Jl(_,R,Le,J),R.child}function mA(_,R){var J=R.ref;(_===null&&J!==null||_!==null&&_.ref!==J)&&(R.flags|=512,R.flags|=2097152)}function xA(_,R,J,be,Le){var Qe=mu(J)?Vc:bc.current;return Qe=J1(R,Qe),Wm(R,Le),J=Ox(_,R,J,be,Qe,Le),be=y6(),_!==null&&!qc?(R.updateQueue=_.updateQueue,R.flags&=-2053,_.lanes&=~Le,_f(_,R,Le)):(Xa&&be&&X2(R),R.flags|=1,Jl(_,R,J,Le),R.child)}function gA(_,R,J,be,Le){if(mu(J)){var Qe=!0;Td(R)}else Qe=!1;if(Wm(R,Le),R.stateNode===null)P6(_,R),Mx(R,J,be),dA(R,J,be,Le),be=!0;else if(_===null){var Ft=R.stateNode,bn=R.memoizedProps;Ft.props=bn;var Mn=Ft.context,ur=J.contextType;typeof ur=="object"&&ur!==null?ur=Fd(ur):(ur=mu(J)?Vc:bc.current,ur=J1(R,ur));var zr=J.getDerivedStateFromProps,Wr=typeof zr=="function"||typeof Ft.getSnapshotBeforeUpdate=="function";Wr||typeof Ft.UNSAFE_componentWillReceiveProps!="function"&&typeof Ft.componentWillReceiveProps!="function"||(bn!==be||Mn!==ur)&&cb(R,Ft,be,ur),Od=!1;var Ur=R.memoizedState;Ft.state=Ur,nb(R,be,Ft,Le),Mn=R.memoizedState,bn!==be||Ur!==Mn||pu.current||Od?(typeof zr=="function"&&(A6(R,J,zr,be),Mn=R.memoizedState),(bn=Od||uA(R,J,bn,be,Ur,Mn,ur))?(Wr||typeof Ft.UNSAFE_componentWillMount!="function"&&typeof Ft.componentWillMount!="function"||(typeof Ft.componentWillMount=="function"&&Ft.componentWillMount(),typeof Ft.UNSAFE_componentWillMount=="function"&&Ft.UNSAFE_componentWillMount()),typeof Ft.componentDidMount=="function"&&(R.flags|=4194308)):(typeof Ft.componentDidMount=="function"&&(R.flags|=4194308),R.memoizedProps=be,R.memoizedState=Mn),Ft.props=be,Ft.state=Mn,Ft.context=ur,be=bn):(typeof Ft.componentDidMount=="function"&&(R.flags|=4194308),be=!1)}else{Ft=R.stateNode,EI(_,R),bn=R.memoizedProps,ur=R.type===R.elementType?bn:Ld(R.type,bn),Ft.props=ur,Wr=R.pendingProps,Ur=Ft.context,Mn=J.contextType,typeof Mn=="object"&&Mn!==null?Mn=Fd(Mn):(Mn=mu(J)?Vc:bc.current,Mn=J1(R,Mn));var hs=J.getDerivedStateFromProps;(zr=typeof hs=="function"||typeof Ft.getSnapshotBeforeUpdate=="function")||typeof Ft.UNSAFE_componentWillReceiveProps!="function"&&typeof Ft.componentWillReceiveProps!="function"||(bn!==Wr||Ur!==Mn)&&cb(R,Ft,be,Mn),Od=!1,Ur=R.memoizedState,Ft.state=Ur,nb(R,be,Ft,Le);var js=R.memoizedState;bn!==Wr||Ur!==js||pu.current||Od?(typeof hs=="function"&&(A6(R,J,hs,be),js=R.memoizedState),(ur=Od||uA(R,J,ur,be,Ur,js,Mn)||!1)?(zr||typeof Ft.UNSAFE_componentWillUpdate!="function"&&typeof Ft.componentWillUpdate!="function"||(typeof Ft.componentWillUpdate=="function"&&Ft.componentWillUpdate(be,js,Mn),typeof Ft.UNSAFE_componentWillUpdate=="function"&&Ft.UNSAFE_componentWillUpdate(be,js,Mn)),typeof Ft.componentDidUpdate=="function"&&(R.flags|=4),typeof Ft.getSnapshotBeforeUpdate=="function"&&(R.flags|=1024)):(typeof Ft.componentDidUpdate!="function"||bn===_.memoizedProps&&Ur===_.memoizedState||(R.flags|=4),typeof Ft.getSnapshotBeforeUpdate!="function"||bn===_.memoizedProps&&Ur===_.memoizedState||(R.flags|=1024),R.memoizedProps=be,R.memoizedState=js),Ft.props=be,Ft.state=js,Ft.context=Mn,be=ur):(typeof Ft.componentDidUpdate!="function"||bn===_.memoizedProps&&Ur===_.memoizedState||(R.flags|=4),typeof Ft.getSnapshotBeforeUpdate!="function"||bn===_.memoizedProps&&Ur===_.memoizedState||(R.flags|=1024),be=!1)}return bA(_,R,J,be,Qe,Le)}function bA(_,R,J,be,Le,Qe){mA(_,R);var Ft=(R.flags&128)!==0;if(!be&&!Ft)return Le&&CI(R,J,!1),_f(_,R,Qe);be=R.stateNode,T6.current=R;var bn=Ft&&typeof J.getDerivedStateFromError!="function"?null:be.render();return R.flags|=1,_!==null&&Ft?(R.child=ko(R,_.child,null,Qe),R.child=ko(R,null,bn,Qe)):Jl(_,R,bn,Qe),R.memoizedState=be.state,Le&&CI(R,J,!0),R.child}function BI(_){var R=_.stateNode;R.pendingContext?vI(_,R.pendingContext,R.pendingContext!==R.context):R.context&&vI(_,R.context,!1),Q8(_,R.containerInfo)}function wh(_,R,J,be,Le){return mh(),xh(Le),R.flags|=256,Jl(_,R,J,be),R.child}var cv={dehydrated:null,treeContext:null,retryLane:0};function uv(_){return{baseLanes:_,cachePool:null,transitions:null}}function I6(_,R,J){var be=R.pendingProps,Le=io.current,Qe=!1,Ft=(R.flags&128)!==0,bn;if((bn=Ft)||(bn=_!==null&&_.memoizedState===null?!1:(Le&2)!==0),bn?(Qe=!0,R.flags&=-129):(_===null||_.memoizedState!==null)&&(Le|=1),Ha(io,Le&1),_===null)return xu(R),_=R.memoizedState,_!==null&&(_=_.dehydrated,_!==null)?(R.mode&1?_.data==="$!"?R.lanes=8:R.lanes=1073741824:R.lanes=1,null):(Ft=be.children,_=be.fallback,Qe?(be=R.mode,Qe=R.child,Ft={mode:"hidden",children:Ft},!(be&1)&&Qe!==null?(Qe.childLanes=0,Qe.pendingProps=Ft):Qe=G6(Ft,be,0,null),_=Ux(_,be,J,null),Qe.return=R,_.return=R,Qe.sibling=_,R.child=Qe,R.child.memoizedState=uv(J),R.memoizedState=cv,_):db(R,Ft));if(Le=_.memoizedState,Le!==null&&(bn=Le.dehydrated,bn!==null))return Ys(_,R,Ft,be,bn,Le,J);if(Qe){Qe=be.fallback,Ft=R.mode,Le=_.child,bn=Le.sibling;var Mn={mode:"hidden",children:be.children};return!(Ft&1)&&R.child!==Le?(be=R.child,be.childLanes=0,be.pendingProps=Mn,R.deletions=null):(be=Pf(Le,Mn),be.subtreeFlags=Le.subtreeFlags&14680064),bn!==null?Qe=Pf(bn,Qe):(Qe=Ux(Qe,Ft,J,null),Qe.flags|=2),Qe.return=R,be.return=R,be.sibling=Qe,R.child=be,be=Qe,Qe=R.child,Ft=_.child.memoizedState,Ft=Ft===null?uv(J):{baseLanes:Ft.baseLanes|J,cachePool:null,transitions:Ft.transitions},Qe.memoizedState=Ft,Qe.childLanes=_.childLanes&~J,R.memoizedState=cv,be}return Qe=_.child,_=Qe.sibling,be=Pf(Qe,{mode:"visible",children:be.children}),!(R.mode&1)&&(be.lanes=J),be.return=R,be.sibling=null,_!==null&&(J=R.deletions,J===null?(R.deletions=[_],R.flags|=16):J.push(_)),R.child=be,R.memoizedState=null,be}function db(_,R){return R=G6({mode:"visible",children:R},_.mode,0,null),R.return=_,_.child=R}function Op(_,R,J,be){return be!==null&&xh(be),ko(R,_.child,null,J),_=db(R,R.pendingProps.children),_.flags|=2,R.memoizedState=null,_}function Ys(_,R,J,be,Le,Qe,Ft){if(J)return R.flags&256?(R.flags&=-257,be=E6(Error(n(422))),Op(_,R,Ft,be)):R.memoizedState!==null?(R.child=_.child,R.flags|=128,null):(Qe=be.fallback,Le=R.mode,be=G6({mode:"visible",children:be.children},Le,0,null),Qe=Ux(Qe,Le,Ft,null),Qe.flags|=2,be.return=R,Qe.return=R,be.sibling=Qe,R.child=be,R.mode&1&&ko(R,_.child,null,Ft),R.child.memoizedState=uv(Ft),R.memoizedState=cv,Qe);if(!(R.mode&1))return Op(_,R,Ft,null);if(Le.data==="$!"){if(be=Le.nextSibling&&Le.nextSibling.dataset,be)var bn=be.dgst;return be=bn,Qe=Error(n(419)),be=E6(Qe,be,void 0),Op(_,R,Ft,be)}if(bn=(Ft&_.childLanes)!==0,qc||bn){if(be=Ol,be!==null){switch(Ft&-Ft){case 4:Le=2;break;case 16:Le=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:Le=32;break;case 536870912:Le=268435456;break;default:Le=0}Le=Le&(be.suspendedLanes|Ft)?0:Le,Le!==0&&Le!==Qe.retryLane&&(Qe.retryLane=Le,kp(_,Le),If(be,_,Le,-1))}return FA(),be=E6(Error(n(421))),Op(_,R,Ft,be)}return Le.data==="$?"?(R.flags|=128,R.child=_.child,R=Yz.bind(null,_),Le._reactRetry=R,null):(_=Qe.treeContext,Ku=$m(Le.nextSibling),vc=R,Xa=!0,jf=null,_!==null&&(Id[Pd++]=fh,Id[Pd++]=hh,Id[Pd++]=_x,fh=_.id,hh=_.overflow,_x=R),R=db(R,be.children),R.flags|=4096,R)}function dv(_,R,J){_.lanes|=R;var be=_.alternate;be!==null&&(be.lanes|=R),Zl(_.return,R,J)}function fv(_,R,J,be,Le){var Qe=_.memoizedState;Qe===null?_.memoizedState={isBackwards:R,rendering:null,renderingStartTime:0,last:be,tail:J,tailMode:Le}:(Qe.isBackwards=R,Qe.rendering=null,Qe.renderingStartTime=0,Qe.last=be,Qe.tail=J,Qe.tailMode=Le)}function Km(_,R,J){var be=R.pendingProps,Le=be.revealOrder,Qe=be.tail;if(Jl(_,R,be.children,J),be=io.current,be&2)be=be&1|2,R.flags|=128;else{if(_!==null&&_.flags&128)e:for(_=R.child;_!==null;){if(_.tag===13)_.memoizedState!==null&&dv(_,J,R);else if(_.tag===19)dv(_,J,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}be&=1}if(Ha(io,be),!(R.mode&1))R.memoizedState=null;else switch(Le){case"forwards":for(J=R.child,Le=null;J!==null;)_=J.alternate,_!==null&&Px(_)===null&&(Le=J),J=J.sibling;J=Le,J===null?(Le=R.child,R.child=null):(Le=J.sibling,J.sibling=null),fv(R,!1,Le,J,Qe);break;case"backwards":for(J=null,Le=R.child,R.child=null;Le!==null;){if(_=Le.alternate,_!==null&&Px(_)===null){R.child=Le;break}_=Le.sibling,Le.sibling=J,J=Le,Le=_}fv(R,!0,J,null,Qe);break;case"together":fv(R,!1,null,null,void 0);break;default:R.memoizedState=null}return R.child}function P6(_,R){!(R.mode&1)&&_!==null&&(_.alternate=null,R.alternate=null,R.flags|=2)}function _f(_,R,J){if(_!==null&&(R.dependencies=_.dependencies),Xm|=R.lanes,!(J&R.childLanes))return null;if(_!==null&&R.child!==_.child)throw Error(n(153));if(R.child!==null){for(_=R.child,J=Pf(_,_.pendingProps),R.child=J,J.return=R;_.sibling!==null;)_=_.sibling,J=J.sibling=Pf(_,_.pendingProps),J.return=R;J.sibling=null}return R.child}function $I(_,R,J){switch(R.tag){case 3:BI(R),mh();break;case 5:Z8(R);break;case 1:mu(R.type)&&Td(R);break;case 4:Q8(R,R.stateNode.containerInfo);break;case 10:var be=R.type._context,Le=R.memoizedProps.value;Ha(J2,be._currentValue),be._currentValue=Le;break;case 13:if(be=R.memoizedState,be!==null)return be.dehydrated!==null?(Ha(io,io.current&1),R.flags|=128,null):J&R.child.childLanes?I6(_,R,J):(Ha(io,io.current&1),_=_f(_,R,J),_!==null?_.sibling:null);Ha(io,io.current&1);break;case 19:if(be=(J&R.childLanes)!==0,_.flags&128){if(be)return Km(_,R,J);R.flags|=128}if(Le=R.memoizedState,Le!==null&&(Le.rendering=null,Le.tail=null,Le.lastEffect=null),Ha(io,io.current),be)break;return null;case 22:case 23:return R.lanes=0,pA(_,R,J)}return _f(_,R,J)}var ec,yA,UI,vA;ec=function(_,R){for(var J=R.child;J!==null;){if(J.tag===5||J.tag===6)_.appendChild(J.stateNode);else if(J.tag!==4&&J.child!==null){J.child.return=J,J=J.child;continue}if(J===R)break;for(;J.sibling===null;){if(J.return===null||J.return===R)return;J=J.return}J.sibling.return=J.return,J=J.sibling}},yA=function(){},UI=function(_,R,J,be){var Le=_.memoizedProps;if(Le!==be){_=R.stateNode,Ip(gh.current);var Qe=null;switch(J){case"input":Le=rt(_,Le),be=rt(_,be),Qe=[];break;case"select":Le=ne({},Le,{value:void 0}),be=ne({},be,{value:void 0}),Qe=[];break;case"textarea":Le=on(_,Le),be=on(_,be),Qe=[];break;default:typeof Le.onClick!="function"&&typeof be.onClick=="function"&&(_.onclick=r6)}It(J,be);var Ft;J=null;for(ur in Le)if(!be.hasOwnProperty(ur)&&Le.hasOwnProperty(ur)&&Le[ur]!=null)if(ur==="style"){var bn=Le[ur];for(Ft in bn)bn.hasOwnProperty(Ft)&&(J||(J={}),J[Ft]="")}else ur!=="dangerouslySetInnerHTML"&&ur!=="children"&&ur!=="suppressContentEditableWarning"&&ur!=="suppressHydrationWarning"&&ur!=="autoFocus"&&(s.hasOwnProperty(ur)?Qe||(Qe=[]):(Qe=Qe||[]).push(ur,null));for(ur in be){var Mn=be[ur];if(bn=Le!=null?Le[ur]:void 0,be.hasOwnProperty(ur)&&Mn!==bn&&(Mn!=null||bn!=null))if(ur==="style")if(bn){for(Ft in bn)!bn.hasOwnProperty(Ft)||Mn&&Mn.hasOwnProperty(Ft)||(J||(J={}),J[Ft]="");for(Ft in Mn)Mn.hasOwnProperty(Ft)&&bn[Ft]!==Mn[Ft]&&(J||(J={}),J[Ft]=Mn[Ft])}else J||(Qe||(Qe=[]),Qe.push(ur,J)),J=Mn;else ur==="dangerouslySetInnerHTML"?(Mn=Mn?Mn.__html:void 0,bn=bn?bn.__html:void 0,Mn!=null&&bn!==Mn&&(Qe=Qe||[]).push(ur,Mn)):ur==="children"?typeof Mn!="string"&&typeof Mn!="number"||(Qe=Qe||[]).push(ur,""+Mn):ur!=="suppressContentEditableWarning"&&ur!=="suppressHydrationWarning"&&(s.hasOwnProperty(ur)?(Mn!=null&&ur==="onScroll"&&Ka("scroll",_),Qe||bn===Mn||(Qe=[])):(Qe=Qe||[]).push(ur,Mn))}J&&(Qe=Qe||[]).push("style",J);var ur=Qe;(R.updateQueue=ur)&&(R.flags|=4)}},vA=function(_,R,J,be){J!==be&&(R.flags|=4)};function hv(_,R){if(!Xa)switch(_.tailMode){case"hidden":R=_.tail;for(var J=null;R!==null;)R.alternate!==null&&(J=R),R=R.sibling;J===null?_.tail=null:J.sibling=null;break;case"collapsed":J=_.tail;for(var be=null;J!==null;)J.alternate!==null&&(be=J),J=J.sibling;be===null?R||_.tail===null?_.tail=null:_.tail.sibling=null:be.sibling=null}}function tc(_){var R=_.alternate!==null&&_.alternate.child===_.child,J=0,be=0;if(R)for(var Le=_.child;Le!==null;)J|=Le.lanes|Le.childLanes,be|=Le.subtreeFlags&14680064,be|=Le.flags&14680064,Le.return=_,Le=Le.sibling;else for(Le=_.child;Le!==null;)J|=Le.lanes|Le.childLanes,be|=Le.subtreeFlags,be|=Le.flags,Le.return=_,Le=Le.sibling;return _.subtreeFlags|=be,_.childLanes=J,R}function Uz(_,R,J){var be=R.pendingProps;switch(kx(R),R.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tc(R),null;case 1:return mu(R.type)&&o6(),tc(R),null;case 3:return be=R.stateNode,qm(),Ya(pu),Ya(bc),b6(),be.pendingContext&&(be.context=be.pendingContext,be.pendingContext=null),(_===null||_.child===null)&&(Q2(R)?R.flags|=4:_===null||_.memoizedState.isDehydrated&&!(R.flags&256)||(R.flags|=1024,jf!==null&&(TA(jf),jf=null))),yA(_,R),tc(R),null;case 5:g6(R);var Le=Ip(rb.current);if(J=R.type,_!==null&&R.stateNode!=null)UI(_,R,J,be,Le),_.ref!==R.ref&&(R.flags|=512,R.flags|=2097152);else{if(!be){if(R.stateNode===null)throw Error(n(166));return tc(R),null}if(_=Ip(gh.current),Q2(R)){be=R.stateNode,J=R.type;var Qe=R.memoizedProps;switch(be[uh]=R,be[Um]=Qe,_=(R.mode&1)!==0,J){case"dialog":Ka("cancel",be),Ka("close",be);break;case"iframe":case"object":case"embed":Ka("load",be);break;case"video":case"audio":for(Le=0;Le<jp.length;Le++)Ka(jp[Le],be);break;case"source":Ka("error",be);break;case"img":case"image":case"link":Ka("error",be),Ka("load",be);break;case"details":Ka("toggle",be);break;case"input":st(be,Qe),Ka("invalid",be);break;case"select":be._wrapperState={wasMultiple:!!Qe.multiple},Ka("invalid",be);break;case"textarea":cn(be,Qe),Ka("invalid",be)}It(J,Qe),Le=null;for(var Ft in Qe)if(Qe.hasOwnProperty(Ft)){var bn=Qe[Ft];Ft==="children"?typeof bn=="string"?be.textContent!==bn&&(Qe.suppressHydrationWarning!==!0&&q2(be.textContent,bn,_),Le=["children",bn]):typeof bn=="number"&&be.textContent!==""+bn&&(Qe.suppressHydrationWarning!==!0&&q2(be.textContent,bn,_),Le=["children",""+bn]):s.hasOwnProperty(Ft)&&bn!=null&&Ft==="onScroll"&&Ka("scroll",be)}switch(J){case"input":Ye(be),bt(be,Qe,!0);break;case"textarea":Ye(be),tn(be);break;case"select":case"option":break;default:typeof Qe.onClick=="function"&&(be.onclick=r6)}be=Le,R.updateQueue=be,be!==null&&(R.flags|=4)}else{Ft=Le.nodeType===9?Le:Le.ownerDocument,_==="http://www.w3.org/1999/xhtml"&&(_=fn(J)),_==="http://www.w3.org/1999/xhtml"?J==="script"?(_=Ft.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild)):typeof be.is=="string"?_=Ft.createElement(J,{is:be.is}):(_=Ft.createElement(J),J==="select"&&(Ft=_,be.multiple?Ft.multiple=!0:be.size&&(Ft.size=be.size))):_=Ft.createElementNS(_,J),_[uh]=R,_[Um]=be,ec(_,R,!1,!1),R.stateNode=_;e:{switch(Ft=Ge(J,be),J){case"dialog":Ka("cancel",_),Ka("close",_),Le=be;break;case"iframe":case"object":case"embed":Ka("load",_),Le=be;break;case"video":case"audio":for(Le=0;Le<jp.length;Le++)Ka(jp[Le],_);Le=be;break;case"source":Ka("error",_),Le=be;break;case"img":case"image":case"link":Ka("error",_),Ka("load",_),Le=be;break;case"details":Ka("toggle",_),Le=be;break;case"input":st(_,be),Le=rt(_,be),Ka("invalid",_);break;case"option":Le=be;break;case"select":_._wrapperState={wasMultiple:!!be.multiple},Le=ne({},be,{value:void 0}),Ka("invalid",_);break;case"textarea":cn(_,be),Le=on(_,be),Ka("invalid",_);break;default:Le=be}It(J,Le),bn=Le;for(Qe in bn)if(bn.hasOwnProperty(Qe)){var Mn=bn[Qe];Qe==="style"?pt(_,Mn):Qe==="dangerouslySetInnerHTML"?(Mn=Mn?Mn.__html:void 0,Mn!=null&&it(_,Mn)):Qe==="children"?typeof Mn=="string"?(J!=="textarea"||Mn!=="")&&Ut(_,Mn):typeof Mn=="number"&&Ut(_,""+Mn):Qe!=="suppressContentEditableWarning"&&Qe!=="suppressHydrationWarning"&&Qe!=="autoFocus"&&(s.hasOwnProperty(Qe)?Mn!=null&&Qe==="onScroll"&&Ka("scroll",_):Mn!=null&&P(_,Qe,Mn,Ft))}switch(J){case"input":Ye(_),bt(_,be,!1);break;case"textarea":Ye(_),tn(_);break;case"option":be.value!=null&&_.setAttribute("value",""+je(be.value));break;case"select":_.multiple=!!be.multiple,Qe=be.value,Qe!=null?St(_,!!be.multiple,Qe,!1):be.defaultValue!=null&&St(_,!!be.multiple,be.defaultValue,!0);break;default:typeof Le.onClick=="function"&&(_.onclick=r6)}switch(J){case"button":case"input":case"select":case"textarea":be=!!be.autoFocus;break e;case"img":be=!0;break e;default:be=!1}}be&&(R.flags|=4)}R.ref!==null&&(R.flags|=512,R.flags|=2097152)}return tc(R),null;case 6:if(_&&R.stateNode!=null)vA(_,R,_.memoizedProps,be);else{if(typeof be!="string"&&R.stateNode===null)throw Error(n(166));if(J=Ip(rb.current),Ip(gh.current),Q2(R)){if(be=R.stateNode,J=R.memoizedProps,be[uh]=R,(Qe=be.nodeValue!==J)&&(_=vc,_!==null))switch(_.tag){case 3:q2(be.nodeValue,J,(_.mode&1)!==0);break;case 5:_.memoizedProps.suppressHydrationWarning!==!0&&q2(be.nodeValue,J,(_.mode&1)!==0)}Qe&&(R.flags|=4)}else be=(J.nodeType===9?J:J.ownerDocument).createTextNode(be),be[uh]=R,R.stateNode=be}return tc(R),null;case 13:if(Ya(io),be=R.memoizedState,_===null||_.memoizedState!==null&&_.memoizedState.dehydrated!==null){if(Xa&&Ku!==null&&R.mode&1&&!(R.flags&128))G8(),mh(),R.flags|=98560,Qe=!1;else if(Qe=Q2(R),be!==null&&be.dehydrated!==null){if(_===null){if(!Qe)throw Error(n(318));if(Qe=R.memoizedState,Qe=Qe!==null?Qe.dehydrated:null,!Qe)throw Error(n(317));Qe[uh]=R}else mh(),!(R.flags&128)&&(R.memoizedState=null),R.flags|=4;tc(R),Qe=!1}else jf!==null&&(TA(jf),jf=null),Qe=!0;if(!Qe)return R.flags&65536?R:null}return R.flags&128?(R.lanes=J,R):(be=be!==null,be!==(_!==null&&_.memoizedState!==null)&&be&&(R.child.flags|=8192,R.mode&1&&(_===null||io.current&1?ml===0&&(ml=3):FA())),R.updateQueue!==null&&(R.flags|=4),tc(R),null);case 4:return qm(),yA(_,R),_===null&&Dm(R.stateNode.containerInfo),tc(R),null;case 10:return h6(R.type._context),tc(R),null;case 17:return mu(R.type)&&o6(),tc(R),null;case 19:if(Ya(io),Qe=R.memoizedState,Qe===null)return tc(R),null;if(be=(R.flags&128)!==0,Ft=Qe.rendering,Ft===null)if(be)hv(Qe,!1);else{if(ml!==0||_!==null&&_.flags&128)for(_=R.child;_!==null;){if(Ft=Px(_),Ft!==null){for(R.flags|=128,hv(Qe,!1),be=Ft.updateQueue,be!==null&&(R.updateQueue=be,R.flags|=4),R.subtreeFlags=0,be=J,J=R.child;J!==null;)Qe=J,_=be,Qe.flags&=14680066,Ft=Qe.alternate,Ft===null?(Qe.childLanes=0,Qe.lanes=_,Qe.child=null,Qe.subtreeFlags=0,Qe.memoizedProps=null,Qe.memoizedState=null,Qe.updateQueue=null,Qe.dependencies=null,Qe.stateNode=null):(Qe.childLanes=Ft.childLanes,Qe.lanes=Ft.lanes,Qe.child=Ft.child,Qe.subtreeFlags=0,Qe.deletions=null,Qe.memoizedProps=Ft.memoizedProps,Qe.memoizedState=Ft.memoizedState,Qe.updateQueue=Ft.updateQueue,Qe.type=Ft.type,_=Ft.dependencies,Qe.dependencies=_===null?null:{lanes:_.lanes,firstContext:_.firstContext}),J=J.sibling;return Ha(io,io.current&1|2),R.child}_=_.sibling}Qe.tail!==null&&ke()>Lx&&(R.flags|=128,be=!0,hv(Qe,!1),R.lanes=4194304)}else{if(!be)if(_=Px(Ft),_!==null){if(R.flags|=128,be=!0,J=_.updateQueue,J!==null&&(R.updateQueue=J,R.flags|=4),hv(Qe,!0),Qe.tail===null&&Qe.tailMode==="hidden"&&!Ft.alternate&&!Xa)return tc(R),null}else 2*ke()-Qe.renderingStartTime>Lx&&J!==1073741824&&(R.flags|=128,be=!0,hv(Qe,!1),R.lanes=4194304);Qe.isBackwards?(Ft.sibling=R.child,R.child=Ft):(J=Qe.last,J!==null?J.sibling=Ft:R.child=Ft,Qe.last=Ft)}return Qe.tail!==null?(R=Qe.tail,Qe.rendering=R,Qe.tail=R.sibling,Qe.renderingStartTime=ke(),R.sibling=null,J=io.current,Ha(io,be?J&1|2:J&1),R):(tc(R),null);case 22:case 23:return PA(),be=R.memoizedState!==null,_!==null&&_.memoizedState!==null!==be&&(R.flags|=8192),be&&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 zz(_,R){switch(kx(R),R.tag){case 1:return mu(R.type)&&o6(),_=R.flags,_&65536?(R.flags=_&-65537|128,R):null;case 3:return qm(),Ya(pu),Ya(bc),b6(),_=R.flags,_&65536&&!(_&128)?(R.flags=_&-65537|128,R):null;case 5:return g6(R),null;case 13:if(Ya(io),_=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 Ya(io),null;case 4:return qm(),null;case 10:return h6(R.type._context),null;case 22:case 23:return PA(),null;case 24:return null;default:return null}}var F6=!1,ao=!1,Gc=typeof WeakSet=="function"?WeakSet:Set,vs=null;function fb(_,R){var J=_.ref;if(J!==null)if(typeof J=="function")try{J(null)}catch(be){yo(_,R,be)}else J.current=null}function pv(_,R,J){try{J()}catch(be){yo(_,R,be)}}var zI=!1;function Hz(_,R){if(G2=ar,_=Ns(),ti(_)){if("selectionStart"in _)var J={start:_.selectionStart,end:_.selectionEnd};else e:{J=(J=_.ownerDocument)&&J.defaultView||window;var be=J.getSelection&&J.getSelection();if(be&&be.rangeCount!==0){J=be.anchorNode;var Le=be.anchorOffset,Qe=be.focusNode;be=be.focusOffset;try{J.nodeType,Qe.nodeType}catch{J=null;break e}var Ft=0,bn=-1,Mn=-1,ur=0,zr=0,Wr=_,Ur=null;t:for(;;){for(var hs;Wr!==J||Le!==0&&Wr.nodeType!==3||(bn=Ft+Le),Wr!==Qe||be!==0&&Wr.nodeType!==3||(Mn=Ft+be),Wr.nodeType===3&&(Ft+=Wr.nodeValue.length),(hs=Wr.firstChild)!==null;)Ur=Wr,Wr=hs;for(;;){if(Wr===_)break t;if(Ur===J&&++ur===Le&&(bn=Ft),Ur===Qe&&++zr===be&&(Mn=Ft),(hs=Wr.nextSibling)!==null)break;Wr=Ur,Ur=Wr.parentNode}Wr=hs}J=bn===-1||Mn===-1?null:{start:bn,end:Mn}}else J=null}J=J||{start:0,end:0}}else J=null;for(jx={focusedElem:_,selectionRange:J},ar=!1,vs=R;vs!==null;)if(R=vs,_=R.child,(R.subtreeFlags&1028)!==0&&_!==null)_.return=R,vs=_;else for(;vs!==null;){R=vs;try{var js=R.alternate;if(R.flags&1024)switch(R.tag){case 0:case 11:case 15:break;case 1:if(js!==null){var Ps=js.memoizedProps,To=js.memoizedState,rr=R.stateNode,Hn=rr.getSnapshotBeforeUpdate(R.elementType===R.type?Ps:Ld(R.type,Ps),To);rr.__reactInternalSnapshotBeforeUpdate=Hn}break;case 3:var or=R.stateNode.containerInfo;or.nodeType===1?or.textContent="":or.nodeType===9&&or.documentElement&&or.removeChild(or.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Qr){yo(R,R.return,Qr)}if(_=R.sibling,_!==null){_.return=R.return,vs=_;break}vs=R.return}return js=zI,zI=!1,js}function Mp(_,R,J){var be=R.updateQueue;if(be=be!==null?be.lastEffect:null,be!==null){var Le=be=be.next;do{if((Le.tag&_)===_){var Qe=Le.destroy;Le.destroy=void 0,Qe!==void 0&&pv(R,J,Qe)}Le=Le.next}while(Le!==be)}}function mv(_,R){if(R=R.updateQueue,R=R!==null?R.lastEffect:null,R!==null){var J=R=R.next;do{if((J.tag&_)===_){var be=J.create;J.destroy=be()}J=J.next}while(J!==R)}}function O6(_){var R=_.ref;if(R!==null){var J=_.stateNode;switch(_.tag){case 5:_=J;break;default:_=J}typeof R=="function"?R(_):R.current=_}}function HI(_){var R=_.alternate;R!==null&&(_.alternate=null,HI(R)),_.child=null,_.deletions=null,_.sibling=null,_.tag===5&&(R=_.stateNode,R!==null&&(delete R[uh],delete R[Um],delete R[i6],delete R[Wt],delete R[Q1])),_.stateNode=null,_.return=null,_.dependencies=null,_.memoizedProps=null,_.memoizedState=null,_.pendingProps=null,_.stateNode=null,_.updateQueue=null}function VI(_){return _.tag===5||_.tag===3||_.tag===4}function WI(_){e:for(;;){for(;_.sibling===null;){if(_.return===null||VI(_.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 wA(_,R,J){var be=_.tag;if(be===5||be===6)_=_.stateNode,R?J.nodeType===8?J.parentNode.insertBefore(_,R):J.insertBefore(_,R):(J.nodeType===8?(R=J.parentNode,R.insertBefore(_,J)):(R=J,R.appendChild(_)),J=J._reactRootContainer,J!=null||R.onclick!==null||(R.onclick=r6));else if(be!==4&&(_=_.child,_!==null))for(wA(_,R,J),_=_.sibling;_!==null;)wA(_,R,J),_=_.sibling}function M6(_,R,J){var be=_.tag;if(be===5||be===6)_=_.stateNode,R?J.insertBefore(_,R):J.appendChild(_);else if(be!==4&&(_=_.child,_!==null))for(M6(_,R,J),_=_.sibling;_!==null;)M6(_,R,J),_=_.sibling}var Fl=null,Ef=!1;function Ch(_,R,J){for(J=J.child;J!==null;)CA(_,R,J),J=J.sibling}function CA(_,R,J){if(V&&typeof V.onCommitFiberUnmount=="function")try{V.onCommitFiberUnmount(D,J)}catch{}switch(J.tag){case 5:ao||fb(J,R);case 6:var be=Fl,Le=Ef;Fl=null,Ch(_,R,J),Fl=be,Ef=Le,Fl!==null&&(Ef?(_=Fl,J=J.stateNode,_.nodeType===8?_.parentNode.removeChild(J):_.removeChild(J)):Fl.removeChild(J.stateNode));break;case 18:Fl!==null&&(Ef?(_=Fl,J=J.stateNode,_.nodeType===8?V8(_.parentNode,J):_.nodeType===1&&V8(_,J),Nt(_)):V8(Fl,J.stateNode));break;case 4:be=Fl,Le=Ef,Fl=J.stateNode.containerInfo,Ef=!0,Ch(_,R,J),Fl=be,Ef=Le;break;case 0:case 11:case 14:case 15:if(!ao&&(be=J.updateQueue,be!==null&&(be=be.lastEffect,be!==null))){Le=be=be.next;do{var Qe=Le,Ft=Qe.destroy;Qe=Qe.tag,Ft!==void 0&&(Qe&2||Qe&4)&&pv(J,R,Ft),Le=Le.next}while(Le!==be)}Ch(_,R,J);break;case 1:if(!ao&&(fb(J,R),be=J.stateNode,typeof be.componentWillUnmount=="function"))try{be.props=J.memoizedProps,be.state=J.memoizedState,be.componentWillUnmount()}catch(bn){yo(J,R,bn)}Ch(_,R,J);break;case 21:Ch(_,R,J);break;case 22:J.mode&1?(ao=(be=ao)||J.memoizedState!==null,Ch(_,R,J),ao=be):Ch(_,R,J);break;default:Ch(_,R,J)}}function hb(_){var R=_.updateQueue;if(R!==null){_.updateQueue=null;var J=_.stateNode;J===null&&(J=_.stateNode=new Gc),R.forEach(function(be){var Le=Xz.bind(null,_,be);J.has(be)||(J.add(be),be.then(Le,Le))})}}function Xu(_,R){var J=R.deletions;if(J!==null)for(var be=0;be<J.length;be++){var Le=J[be];try{var Qe=_,Ft=R,bn=Ft;e:for(;bn!==null;){switch(bn.tag){case 5:Fl=bn.stateNode,Ef=!1;break e;case 3:Fl=bn.stateNode.containerInfo,Ef=!0;break e;case 4:Fl=bn.stateNode.containerInfo,Ef=!0;break e}bn=bn.return}if(Fl===null)throw Error(n(160));CA(Qe,Ft,Le),Fl=null,Ef=!1;var Mn=Le.alternate;Mn!==null&&(Mn.return=null),Le.return=null}catch(ur){yo(Le,R,ur)}}if(R.subtreeFlags&12854)for(R=R.child;R!==null;)SA(R,_),R=R.sibling}function SA(_,R){var J=_.alternate,be=_.flags;switch(_.tag){case 0:case 11:case 14:case 15:if(Xu(R,_),kf(_),be&4){try{Mp(3,_,_.return),mv(3,_)}catch(Ps){yo(_,_.return,Ps)}try{Mp(5,_,_.return)}catch(Ps){yo(_,_.return,Ps)}}break;case 1:Xu(R,_),kf(_),be&512&&J!==null&&fb(J,J.return);break;case 5:if(Xu(R,_),kf(_),be&512&&J!==null&&fb(J,J.return),_.flags&32){var Le=_.stateNode;try{Ut(Le,"")}catch(Ps){yo(_,_.return,Ps)}}if(be&4&&(Le=_.stateNode,Le!=null)){var Qe=_.memoizedProps,Ft=J!==null?J.memoizedProps:Qe,bn=_.type,Mn=_.updateQueue;if(_.updateQueue=null,Mn!==null)try{bn==="input"&&Qe.type==="radio"&&Qe.name!=null&&He(Le,Qe),Ge(bn,Ft);var ur=Ge(bn,Qe);for(Ft=0;Ft<Mn.length;Ft+=2){var zr=Mn[Ft],Wr=Mn[Ft+1];zr==="style"?pt(Le,Wr):zr==="dangerouslySetInnerHTML"?it(Le,Wr):zr==="children"?Ut(Le,Wr):P(Le,zr,Wr,ur)}switch(bn){case"input":Ve(Le,Qe);break;case"textarea":Vn(Le,Qe);break;case"select":var Ur=Le._wrapperState.wasMultiple;Le._wrapperState.wasMultiple=!!Qe.multiple;var hs=Qe.value;hs!=null?St(Le,!!Qe.multiple,hs,!1):Ur!==!!Qe.multiple&&(Qe.defaultValue!=null?St(Le,!!Qe.multiple,Qe.defaultValue,!0):St(Le,!!Qe.multiple,Qe.multiple?[]:"",!1))}Le[Um]=Qe}catch(Ps){yo(_,_.return,Ps)}}break;case 6:if(Xu(R,_),kf(_),be&4){if(_.stateNode===null)throw Error(n(162));Le=_.stateNode,Qe=_.memoizedProps;try{Le.nodeValue=Qe}catch(Ps){yo(_,_.return,Ps)}}break;case 3:if(Xu(R,_),kf(_),be&4&&J!==null&&J.memoizedState.isDehydrated)try{Nt(R.containerInfo)}catch(Ps){yo(_,_.return,Ps)}break;case 4:Xu(R,_),kf(_);break;case 13:Xu(R,_),kf(_),Le=_.child,Le.flags&8192&&(Qe=Le.memoizedState!==null,Le.stateNode.isHidden=Qe,!Qe||Le.alternate!==null&&Le.alternate.memoizedState!==null||(AA=ke())),be&4&&hb(_);break;case 22:if(zr=J!==null&&J.memoizedState!==null,_.mode&1?(ao=(ur=ao)||zr,Xu(R,_),ao=ur):Xu(R,_),kf(_),be&8192){if(ur=_.memoizedState!==null,(_.stateNode.isHidden=ur)&&!zr&&_.mode&1)for(vs=_,zr=_.child;zr!==null;){for(Wr=vs=zr;vs!==null;){switch(Ur=vs,hs=Ur.child,Ur.tag){case 0:case 11:case 14:case 15:Mp(4,Ur,Ur.return);break;case 1:fb(Ur,Ur.return);var js=Ur.stateNode;if(typeof js.componentWillUnmount=="function"){be=Ur,J=Ur.return;try{R=be,js.props=R.memoizedProps,js.state=R.memoizedState,js.componentWillUnmount()}catch(Ps){yo(be,J,Ps)}}break;case 5:fb(Ur,Ur.return);break;case 22:if(Ur.memoizedState!==null){Ym(Wr);continue}}hs!==null?(hs.return=Ur,vs=hs):Ym(Wr)}zr=zr.sibling}e:for(zr=null,Wr=_;;){if(Wr.tag===5){if(zr===null){zr=Wr;try{Le=Wr.stateNode,ur?(Qe=Le.style,typeof Qe.setProperty=="function"?Qe.setProperty("display","none","important"):Qe.display="none"):(bn=Wr.stateNode,Mn=Wr.memoizedProps.style,Ft=Mn!=null&&Mn.hasOwnProperty("display")?Mn.display:null,bn.style.display=Vt("display",Ft))}catch(Ps){yo(_,_.return,Ps)}}}else if(Wr.tag===6){if(zr===null)try{Wr.stateNode.nodeValue=ur?"":Wr.memoizedProps}catch(Ps){yo(_,_.return,Ps)}}else if((Wr.tag!==22&&Wr.tag!==23||Wr.memoizedState===null||Wr===_)&&Wr.child!==null){Wr.child.return=Wr,Wr=Wr.child;continue}if(Wr===_)break e;for(;Wr.sibling===null;){if(Wr.return===null||Wr.return===_)break e;zr===Wr&&(zr=null),Wr=Wr.return}zr===Wr&&(zr=null),Wr.sibling.return=Wr.return,Wr=Wr.sibling}}break;case 19:Xu(R,_),kf(_),be&4&&hb(_);break;case 21:break;default:Xu(R,_),kf(_)}}function kf(_){var R=_.flags;if(R&2){try{e:{for(var J=_.return;J!==null;){if(VI(J)){var be=J;break e}J=J.return}throw Error(n(160))}switch(be.tag){case 5:var Le=be.stateNode;be.flags&32&&(Ut(Le,""),be.flags&=-33);var Qe=WI(_);M6(_,Qe,Le);break;case 3:case 4:var Ft=be.stateNode.containerInfo,bn=WI(_);wA(_,bn,Ft);break;default:throw Error(n(161))}}catch(Mn){yo(_,_.return,Mn)}_.flags&=-3}R&4096&&(_.flags&=-4097)}function R6(_,R,J){vs=_,NA(_)}function NA(_,R,J){for(var be=(_.mode&1)!==0;vs!==null;){var Le=vs,Qe=Le.child;if(Le.tag===22&&be){var Ft=Le.memoizedState!==null||F6;if(!Ft){var bn=Le.alternate,Mn=bn!==null&&bn.memoizedState!==null||ao;bn=F6;var ur=ao;if(F6=Ft,(ao=Mn)&&!ur)for(vs=Le;vs!==null;)Ft=vs,Mn=Ft.child,Ft.tag===22&&Ft.memoizedState!==null?qI(Le):Mn!==null?(Mn.return=Ft,vs=Mn):qI(Le);for(;Qe!==null;)vs=Qe,NA(Qe),Qe=Qe.sibling;vs=Le,F6=bn,ao=ur}Tf(_)}else Le.subtreeFlags&8772&&Qe!==null?(Qe.return=Le,vs=Qe):Tf(_)}}function Tf(_){for(;vs!==null;){var R=vs;if(R.flags&8772){var J=R.alternate;try{if(R.flags&8772)switch(R.tag){case 0:case 11:case 15:ao||mv(5,R);break;case 1:var be=R.stateNode;if(R.flags&4&&!ao)if(J===null)be.componentDidMount();else{var Le=R.elementType===R.type?J.memoizedProps:Ld(R.type,J.memoizedProps);be.componentDidUpdate(Le,J.memoizedState,be.__reactInternalSnapshotBeforeUpdate)}var Qe=R.updateQueue;Qe!==null&&X8(R,Qe,be);break;case 3:var Ft=R.updateQueue;if(Ft!==null){if(J=null,R.child!==null)switch(R.child.tag){case 5:J=R.child.stateNode;break;case 1:J=R.child.stateNode}X8(R,Ft,J)}break;case 5:var bn=R.stateNode;if(J===null&&R.flags&4){J=bn;var Mn=R.memoizedProps;switch(R.type){case"button":case"input":case"select":case"textarea":Mn.autoFocus&&J.focus();break;case"img":Mn.src&&(J.src=Mn.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(R.memoizedState===null){var ur=R.alternate;if(ur!==null){var zr=ur.memoizedState;if(zr!==null){var Wr=zr.dehydrated;Wr!==null&&Nt(Wr)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}ao||R.flags&512&&O6(R)}catch(Ur){yo(R,R.return,Ur)}}if(R===_){vs=null;break}if(J=R.sibling,J!==null){J.return=R.return,vs=J;break}vs=R.return}}function Ym(_){for(;vs!==null;){var R=vs;if(R===_){vs=null;break}var J=R.sibling;if(J!==null){J.return=R.return,vs=J;break}vs=R.return}}function qI(_){for(;vs!==null;){var R=vs;try{switch(R.tag){case 0:case 11:case 15:var J=R.return;try{mv(4,R)}catch(Mn){yo(R,J,Mn)}break;case 1:var be=R.stateNode;if(typeof be.componentDidMount=="function"){var Le=R.return;try{be.componentDidMount()}catch(Mn){yo(R,Le,Mn)}}var Qe=R.return;try{O6(R)}catch(Mn){yo(R,Qe,Mn)}break;case 5:var Ft=R.return;try{O6(R)}catch(Mn){yo(R,Ft,Mn)}}}catch(Mn){yo(R,R.return,Mn)}if(R===_){vs=null;break}var bn=R.sibling;if(bn!==null){bn.return=R.return,vs=bn;break}vs=R.return}}var GI=Math.ceil,L6=M.ReactCurrentDispatcher,jA=M.ReactCurrentOwner,Dd=M.ReactCurrentBatchConfig,Zi=0,Ol=null,Zo=null,nc=0,Qu=0,pb=hu(0),ml=0,xv=null,Xm=0,gv=0,D6=0,bv=null,bu=null,AA=0,Lx=1/0,Rp=null,B6=!1,_A=null,Qm=null,$6=!1,Zm=null,Kc=0,yv=0,EA=null,U6=-1,vv=0;function Yc(){return Zi&6?ke():U6!==-1?U6:U6=ke()}function Jm(_){return _.mode&1?Zi&2&&nc!==0?nc&-nc:AI.transition!==null?(vv===0&&(vv=Be()),vv):(_=yt,_!==0||(_=window.event,_=_===void 0?16:ss(_.type)),_):1}function If(_,R,J,be){if(50<yv)throw yv=0,EA=null,Error(n(185));Fe(_,J,be),(!(Zi&2)||_!==Ol)&&(_===Ol&&(!(Zi&2)&&(gv|=J),ml===4&&e0(_,nc)),yu(_,be),J===1&&Zi===0&&!(R.mode&1)&&(Lx=ke()+500,l6&&Hm()))}function yu(_,R){var J=_.callbackNode;te(_,R);var be=we(_,_===Ol?nc:0);if(be===0)J!==null&&Fn(J),_.callbackNode=null,_.callbackPriority=0;else if(R=be&-be,_.callbackPriority!==R){if(J!=null&&Fn(J),R===1)_.tag===0?Ax(KI.bind(null,_)):SI(KI.bind(null,_)),s6(function(){!(Zi&6)&&Hm()}),J=null;else{switch(Lt(be)){case 1:J=p;break;case 4:J=S;break;case 16:J=A;break;case 536870912:J=T;break;default:J=A}J=tP(J,z6.bind(null,_))}_.callbackPriority=R,_.callbackNode=J}}function z6(_,R){if(U6=-1,vv=0,Zi&6)throw Error(n(327));var J=_.callbackNode;if(mb()&&_.callbackNode!==J)return null;var be=we(_,_===Ol?nc:0);if(be===0)return null;if(be&30||be&_.expiredLanes||R)R=H6(_,be);else{R=be;var Le=Zi;Zi|=2;var Qe=XI();(Ol!==_||nc!==R)&&(Rp=null,Lx=ke()+500,Bx(_,R));do try{qz();break}catch(bn){YI(_,bn)}while(!0);Ep(),L6.current=Qe,Zi=Le,Zo!==null?R=0:(Ol=null,nc=0,R=ml)}if(R!==0){if(R===2&&(Le=ve(_),Le!==0&&(be=Le,R=kA(_,Le))),R===1)throw J=xv,Bx(_,0),e0(_,be),yu(_,ke()),J;if(R===6)e0(_,be);else{if(Le=_.current.alternate,!(be&30)&&!Vz(Le)&&(R=H6(_,be),R===2&&(Qe=ve(_),Qe!==0&&(be=Qe,R=kA(_,Qe))),R===1))throw J=xv,Bx(_,0),e0(_,be),yu(_,ke()),J;switch(_.finishedWork=Le,_.finishedLanes=be,R){case 0:case 1:throw Error(n(345));case 2:$x(_,bu,Rp);break;case 3:if(e0(_,be),(be&130023424)===be&&(R=AA+500-ke(),10<R)){if(we(_,0)!==0)break;if(Le=_.suspendedLanes,(Le&be)!==be){Yc(),_.pingedLanes|=_.suspendedLanes&Le;break}_.timeoutHandle=Bm($x.bind(null,_,bu,Rp),R);break}$x(_,bu,Rp);break;case 4:if(e0(_,be),(be&4194240)===be)break;for(R=_.eventTimes,Le=-1;0<be;){var Ft=31-le(be);Qe=1<<Ft,Ft=R[Ft],Ft>Le&&(Le=Ft),be&=~Qe}if(be=Le,be=ke()-be,be=(120>be?120:480>be?480:1080>be?1080:1920>be?1920:3e3>be?3e3:4320>be?4320:1960*GI(be/1960))-be,10<be){_.timeoutHandle=Bm($x.bind(null,_,bu,Rp),be);break}$x(_,bu,Rp);break;case 5:$x(_,bu,Rp);break;default:throw Error(n(329))}}}return yu(_,ke()),_.callbackNode===J?z6.bind(null,_):null}function kA(_,R){var J=bv;return _.current.memoizedState.isDehydrated&&(Bx(_,R).flags|=256),_=H6(_,R),_!==2&&(R=bu,bu=J,R!==null&&TA(R)),_}function TA(_){bu===null?bu=_:bu.push.apply(bu,_)}function Vz(_){for(var R=_;;){if(R.flags&16384){var J=R.updateQueue;if(J!==null&&(J=J.stores,J!==null))for(var be=0;be<J.length;be++){var Le=J[be],Qe=Le.getSnapshot;Le=Le.value;try{if(!Jt(Qe(),Le))return!1}catch{return!1}}}if(J=R.child,R.subtreeFlags&16384&&J!==null)J.return=R,R=J;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&=~D6,R&=~gv,_.suspendedLanes|=R,_.pingedLanes&=~R,_=_.expirationTimes;0<R;){var J=31-le(R),be=1<<J;_[J]=-1,R&=~be}}function KI(_){if(Zi&6)throw Error(n(327));mb();var R=we(_,0);if(!(R&1))return yu(_,ke()),null;var J=H6(_,R);if(_.tag!==0&&J===2){var be=ve(_);be!==0&&(R=be,J=kA(_,be))}if(J===1)throw J=xv,Bx(_,0),e0(_,R),yu(_,ke()),J;if(J===6)throw Error(n(345));return _.finishedWork=_.current.alternate,_.finishedLanes=R,$x(_,bu,Rp),yu(_,ke()),null}function IA(_,R){var J=Zi;Zi|=1;try{return _(R)}finally{Zi=J,Zi===0&&(Lx=ke()+500,l6&&Hm())}}function Dx(_){Zm!==null&&Zm.tag===0&&!(Zi&6)&&mb();var R=Zi;Zi|=1;var J=Dd.transition,be=yt;try{if(Dd.transition=null,yt=1,_)return _()}finally{yt=be,Dd.transition=J,Zi=R,!(Zi&6)&&Hm()}}function PA(){Qu=pb.current,Ya(pb)}function Bx(_,R){_.finishedWork=null,_.finishedLanes=0;var J=_.timeoutHandle;if(J!==-1&&(_.timeoutHandle=-1,Y2(J)),Zo!==null)for(J=Zo.return;J!==null;){var be=J;switch(kx(be),be.tag){case 1:be=be.type.childContextTypes,be!=null&&o6();break;case 3:qm(),Ya(pu),Ya(bc),b6();break;case 5:g6(be);break;case 4:qm();break;case 13:Ya(io);break;case 19:Ya(io);break;case 10:h6(be.type._context);break;case 22:case 23:PA()}J=J.return}if(Ol=_,Zo=_=Pf(_.current,null),nc=Qu=R,ml=0,xv=null,D6=gv=Xm=0,bu=bv=null,Ix!==null){for(R=0;R<Ix.length;R++)if(J=Ix[R],be=J.interleaved,be!==null){J.interleaved=null;var Le=be.next,Qe=J.pending;if(Qe!==null){var Ft=Qe.next;Qe.next=Le,be.next=Ft}J.pending=be}Ix=null}return _}function YI(_,R){do{var J=Zo;try{if(Ep(),nv.current=N6,sb){for(var be=bo.memoizedState;be!==null;){var Le=be.queue;Le!==null&&(Le.pending=null),be=be.next}sb=!1}if(Gm=0,pl=zo=bo=null,rv=!1,Fx=0,jA.current=null,J===null||J.return===null){ml=1,xv=R,Zo=null;break}e:{var Qe=_,Ft=J.return,bn=J,Mn=R;if(R=nc,bn.flags|=32768,Mn!==null&&typeof Mn=="object"&&typeof Mn.then=="function"){var ur=Mn,zr=bn,Wr=zr.tag;if(!(zr.mode&1)&&(Wr===0||Wr===11||Wr===15)){var Ur=zr.alternate;Ur?(zr.updateQueue=Ur.updateQueue,zr.memoizedState=Ur.memoizedState,zr.lanes=Ur.lanes):(zr.updateQueue=null,zr.memoizedState=null)}var hs=LI(Ft);if(hs!==null){hs.flags&=-257,fA(hs,Ft,bn,Qe,R),hs.mode&1&&lv(Qe,ur,R),R=hs,Mn=ur;var js=R.updateQueue;if(js===null){var Ps=new Set;Ps.add(Mn),R.updateQueue=Ps}else js.add(Mn);break e}else{if(!(R&1)){lv(Qe,ur,R),FA();break e}Mn=Error(n(426))}}else if(Xa&&bn.mode&1){var To=LI(Ft);if(To!==null){!(To.flags&65536)&&(To.flags|=256),fA(To,Ft,bn,Qe,R),xh(Rx(Mn,bn));break e}}Qe=Mn=Rx(Mn,bn),ml!==4&&(ml=2),bv===null?bv=[Qe]:bv.push(Qe),Qe=Ft;do{switch(Qe.tag){case 3:Qe.flags|=65536,R&=-R,Qe.lanes|=R;var rr=ov(Qe,Mn,R);kI(Qe,rr);break e;case 1:bn=Mn;var Hn=Qe.type,or=Qe.stateNode;if(!(Qe.flags&128)&&(typeof Hn.getDerivedStateFromError=="function"||or!==null&&typeof or.componentDidCatch=="function"&&(Qm===null||!Qm.has(or)))){Qe.flags|=65536,R&=-R,Qe.lanes|=R;var Qr=k6(Qe,bn,R);kI(Qe,Qr);break e}}Qe=Qe.return}while(Qe!==null)}ZI(J)}catch(Fs){R=Fs,Zo===J&&J!==null&&(Zo=J=J.return);continue}break}while(!0)}function XI(){var _=L6.current;return L6.current=N6,_===null?N6:_}function FA(){(ml===0||ml===3||ml===2)&&(ml=4),Ol===null||!(Xm&268435455)&&!(gv&268435455)||e0(Ol,nc)}function H6(_,R){var J=Zi;Zi|=2;var be=XI();(Ol!==_||nc!==R)&&(Rp=null,Bx(_,R));do try{Wz();break}catch(Le){YI(_,Le)}while(!0);if(Ep(),Zi=J,L6.current=be,Zo!==null)throw Error(n(261));return Ol=null,nc=0,ml}function Wz(){for(;Zo!==null;)QI(Zo)}function qz(){for(;Zo!==null&&!Tt();)QI(Zo)}function QI(_){var R=eP(_.alternate,_,Qu);_.memoizedProps=_.pendingProps,R===null?ZI(_):Zo=R,jA.current=null}function ZI(_){var R=_;do{var J=R.alternate;if(_=R.return,R.flags&32768){if(J=zz(J,R),J!==null){J.flags&=32767,Zo=J;return}if(_!==null)_.flags|=32768,_.subtreeFlags=0,_.deletions=null;else{ml=6,Zo=null;return}}else if(J=Uz(J,R,Qu),J!==null){Zo=J;return}if(R=R.sibling,R!==null){Zo=R;return}Zo=R=_}while(R!==null);ml===0&&(ml=5)}function $x(_,R,J){var be=yt,Le=Dd.transition;try{Dd.transition=null,yt=1,Gz(_,R,J,be)}finally{Dd.transition=Le,yt=be}return null}function Gz(_,R,J,be){do mb();while(Zm!==null);if(Zi&6)throw Error(n(327));J=_.finishedWork;var Le=_.finishedLanes;if(J===null)return null;if(_.finishedWork=null,_.finishedLanes=0,J===_.current)throw Error(n(177));_.callbackNode=null,_.callbackPriority=0;var Qe=J.lanes|J.childLanes;if(at(_,Qe),_===Ol&&(Zo=Ol=null,nc=0),!(J.subtreeFlags&2064)&&!(J.flags&2064)||$6||($6=!0,tP(A,function(){return mb(),null})),Qe=(J.flags&15990)!==0,J.subtreeFlags&15990||Qe){Qe=Dd.transition,Dd.transition=null;var Ft=yt;yt=1;var bn=Zi;Zi|=4,jA.current=null,Hz(_,J),SA(J,_),mc(jx),ar=!!G2,jx=G2=null,_.current=J,R6(J),pn(),Zi=bn,yt=Ft,Dd.transition=Qe}else _.current=J;if($6&&($6=!1,Zm=_,Kc=Le),Qe=_.pendingLanes,Qe===0&&(Qm=null),X(J.stateNode),yu(_,ke()),R!==null)for(be=_.onRecoverableError,J=0;J<R.length;J++)Le=R[J],be(Le.value,{componentStack:Le.stack,digest:Le.digest});if(B6)throw B6=!1,_=_A,_A=null,_;return Kc&1&&_.tag!==0&&mb(),Qe=_.pendingLanes,Qe&1?_===EA?yv++:(yv=0,EA=_):yv=0,Hm(),null}function mb(){if(Zm!==null){var _=Lt(Kc),R=Dd.transition,J=yt;try{if(Dd.transition=null,yt=16>_?16:_,Zm===null)var be=!1;else{if(_=Zm,Zm=null,Kc=0,Zi&6)throw Error(n(331));var Le=Zi;for(Zi|=4,vs=_.current;vs!==null;){var Qe=vs,Ft=Qe.child;if(vs.flags&16){var bn=Qe.deletions;if(bn!==null){for(var Mn=0;Mn<bn.length;Mn++){var ur=bn[Mn];for(vs=ur;vs!==null;){var zr=vs;switch(zr.tag){case 0:case 11:case 15:Mp(8,zr,Qe)}var Wr=zr.child;if(Wr!==null)Wr.return=zr,vs=Wr;else for(;vs!==null;){zr=vs;var Ur=zr.sibling,hs=zr.return;if(HI(zr),zr===ur){vs=null;break}if(Ur!==null){Ur.return=hs,vs=Ur;break}vs=hs}}}var js=Qe.alternate;if(js!==null){var Ps=js.child;if(Ps!==null){js.child=null;do{var To=Ps.sibling;Ps.sibling=null,Ps=To}while(Ps!==null)}}vs=Qe}}if(Qe.subtreeFlags&2064&&Ft!==null)Ft.return=Qe,vs=Ft;else e:for(;vs!==null;){if(Qe=vs,Qe.flags&2048)switch(Qe.tag){case 0:case 11:case 15:Mp(9,Qe,Qe.return)}var rr=Qe.sibling;if(rr!==null){rr.return=Qe.return,vs=rr;break e}vs=Qe.return}}var Hn=_.current;for(vs=Hn;vs!==null;){Ft=vs;var or=Ft.child;if(Ft.subtreeFlags&2064&&or!==null)or.return=Ft,vs=or;else e:for(Ft=Hn;vs!==null;){if(bn=vs,bn.flags&2048)try{switch(bn.tag){case 0:case 11:case 15:mv(9,bn)}}catch(Fs){yo(bn,bn.return,Fs)}if(bn===Ft){vs=null;break e}var Qr=bn.sibling;if(Qr!==null){Qr.return=bn.return,vs=Qr;break e}vs=bn.return}}if(Zi=Le,Hm(),V&&typeof V.onPostCommitFiberRoot=="function")try{V.onPostCommitFiberRoot(D,_)}catch{}be=!0}return be}finally{yt=J,Dd.transition=R}}return!1}function V6(_,R,J){R=Rx(J,R),R=ov(_,R,1),_=Md(_,R,1),R=Yc(),_!==null&&(Fe(_,1,R),yu(_,R))}function yo(_,R,J){if(_.tag===3)V6(_,_,J);else for(;R!==null;){if(R.tag===3){V6(R,_,J);break}else if(R.tag===1){var be=R.stateNode;if(typeof R.type.getDerivedStateFromError=="function"||typeof be.componentDidCatch=="function"&&(Qm===null||!Qm.has(be))){_=Rx(J,_),_=k6(R,_,1),R=Md(R,_,1),_=Yc(),R!==null&&(Fe(R,1,_),yu(R,_));break}}R=R.return}}function Kz(_,R,J){var be=_.pingCache;be!==null&&be.delete(R),R=Yc(),_.pingedLanes|=_.suspendedLanes&J,Ol===_&&(nc&J)===J&&(ml===4||ml===3&&(nc&130023424)===nc&&500>ke()-AA?Bx(_,0):D6|=J),yu(_,R)}function JI(_,R){R===0&&(_.mode&1?(R=Me,Me<<=1,!(Me&130023424)&&(Me=4194304)):R=1);var J=Yc();_=kp(_,R),_!==null&&(Fe(_,R,J),yu(_,J))}function Yz(_){var R=_.memoizedState,J=0;R!==null&&(J=R.retryLane),JI(_,J)}function Xz(_,R){var J=0;switch(_.tag){case 13:var be=_.stateNode,Le=_.memoizedState;Le!==null&&(J=Le.retryLane);break;case 19:be=_.stateNode;break;default:throw Error(n(314))}be!==null&&be.delete(R),JI(_,J)}var eP;eP=function(_,R,J){if(_!==null)if(_.memoizedProps!==R.pendingProps||pu.current)qc=!0;else{if(!(_.lanes&J)&&!(R.flags&128))return qc=!1,$I(_,R,J);qc=!!(_.flags&131072)}else qc=!1,Xa&&R.flags&1048576&&NI(R,u6,R.index);switch(R.lanes=0,R.tag){case 2:var be=R.type;P6(_,R),_=R.pendingProps;var Le=J1(R,bc.current);Wm(R,J),Le=Ox(null,R,be,_,Le,J);var Qe=y6();return R.flags|=1,typeof Le=="object"&&Le!==null&&typeof Le.render=="function"&&Le.$$typeof===void 0?(R.tag=1,R.memoizedState=null,R.updateQueue=null,mu(be)?(Qe=!0,Td(R)):Qe=!1,R.memoizedState=Le.state!==null&&Le.state!==void 0?Le.state:null,m6(R),Le.updater=_6,R.stateNode=Le,Le._reactInternals=R,dA(R,be,_,J),R=bA(null,R,be,!0,Qe,J)):(R.tag=0,Xa&&Qe&&X2(R),Jl(null,R,Le,J),R=R.child),R;case 16:be=R.elementType;e:{switch(P6(_,R),_=R.pendingProps,Le=be._init,be=Le(be._payload),R.type=be,Le=R.tag=Zz(be),_=Ld(be,_),Le){case 0:R=xA(null,R,be,_,J);break e;case 1:R=gA(null,R,be,_,J);break e;case 11:R=DI(null,R,be,_,J);break e;case 14:R=hA(null,R,be,Ld(be.type,_),J);break e}throw Error(n(306,be,""))}return R;case 0:return be=R.type,Le=R.pendingProps,Le=R.elementType===be?Le:Ld(be,Le),xA(_,R,be,Le,J);case 1:return be=R.type,Le=R.pendingProps,Le=R.elementType===be?Le:Ld(be,Le),gA(_,R,be,Le,J);case 3:e:{if(BI(R),_===null)throw Error(n(387));be=R.pendingProps,Qe=R.memoizedState,Le=Qe.element,EI(_,R),nb(R,be,null,J);var Ft=R.memoizedState;if(be=Ft.element,Qe.isDehydrated)if(Qe={element:be,isDehydrated:!1,cache:Ft.cache,pendingSuspenseBoundaries:Ft.pendingSuspenseBoundaries,transitions:Ft.transitions},R.updateQueue.baseState=Qe,R.memoizedState=Qe,R.flags&256){Le=Rx(Error(n(423)),R),R=wh(_,R,be,J,Le);break e}else if(be!==Le){Le=Rx(Error(n(424)),R),R=wh(_,R,be,J,Le);break e}else for(Ku=$m(R.stateNode.containerInfo.firstChild),vc=R,Xa=!0,jf=null,J=f6(R,null,be,J),R.child=J;J;)J.flags=J.flags&-3|4096,J=J.sibling;else{if(mh(),be===Le){R=_f(_,R,J);break e}Jl(_,R,be,J)}R=R.child}return R;case 5:return Z8(R),_===null&&xu(R),be=R.type,Le=R.pendingProps,Qe=_!==null?_.memoizedProps:null,Ft=Le.children,K2(be,Le)?Ft=null:Qe!==null&&K2(be,Qe)&&(R.flags|=32),mA(_,R),Jl(_,R,Ft,J),R.child;case 6:return _===null&&xu(R),null;case 13:return I6(_,R,J);case 4:return Q8(R,R.stateNode.containerInfo),be=R.pendingProps,_===null?R.child=ko(R,null,be,J):Jl(_,R,be,J),R.child;case 11:return be=R.type,Le=R.pendingProps,Le=R.elementType===be?Le:Ld(be,Le),DI(_,R,be,Le,J);case 7:return Jl(_,R,R.pendingProps,J),R.child;case 8:return Jl(_,R,R.pendingProps.children,J),R.child;case 12:return Jl(_,R,R.pendingProps.children,J),R.child;case 10:e:{if(be=R.type._context,Le=R.pendingProps,Qe=R.memoizedProps,Ft=Le.value,Ha(J2,be._currentValue),be._currentValue=Ft,Qe!==null)if(Jt(Qe.value,Ft)){if(Qe.children===Le.children&&!pu.current){R=_f(_,R,J);break e}}else for(Qe=R.child,Qe!==null&&(Qe.return=R);Qe!==null;){var bn=Qe.dependencies;if(bn!==null){Ft=Qe.child;for(var Mn=bn.firstContext;Mn!==null;){if(Mn.context===be){if(Qe.tag===1){Mn=Tp(-1,J&-J),Mn.tag=2;var ur=Qe.updateQueue;if(ur!==null){ur=ur.shared;var zr=ur.pending;zr===null?Mn.next=Mn:(Mn.next=zr.next,zr.next=Mn),ur.pending=Mn}}Qe.lanes|=J,Mn=Qe.alternate,Mn!==null&&(Mn.lanes|=J),Zl(Qe.return,J,R),bn.lanes|=J;break}Mn=Mn.next}}else if(Qe.tag===10)Ft=Qe.type===R.type?null:Qe.child;else if(Qe.tag===18){if(Ft=Qe.return,Ft===null)throw Error(n(341));Ft.lanes|=J,bn=Ft.alternate,bn!==null&&(bn.lanes|=J),Zl(Ft,J,R),Ft=Qe.sibling}else Ft=Qe.child;if(Ft!==null)Ft.return=Qe;else for(Ft=Qe;Ft!==null;){if(Ft===R){Ft=null;break}if(Qe=Ft.sibling,Qe!==null){Qe.return=Ft.return,Ft=Qe;break}Ft=Ft.return}Qe=Ft}Jl(_,R,Le.children,J),R=R.child}return R;case 9:return Le=R.type,be=R.pendingProps.children,Wm(R,J),Le=Fd(Le),be=be(Le),R.flags|=1,Jl(_,R,be,J),R.child;case 14:return be=R.type,Le=Ld(be,R.pendingProps),Le=Ld(be.type,Le),hA(_,R,be,Le,J);case 15:return vh(_,R,R.type,R.pendingProps,J);case 17:return be=R.type,Le=R.pendingProps,Le=R.elementType===be?Le:Ld(be,Le),P6(_,R),R.tag=1,mu(be)?(_=!0,Td(R)):_=!1,Wm(R,J),Mx(R,be,Le),dA(R,be,Le,J),bA(null,R,be,!0,_,J);case 19:return Km(_,R,J);case 22:return pA(_,R,J)}throw Error(n(156,R.tag))};function tP(_,R){return Nn(_,R)}function Qz(_,R,J,be){this.tag=_,this.key=J,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=be,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bd(_,R,J,be){return new Qz(_,R,J,be)}function W6(_){return _=_.prototype,!(!_||!_.isReactComponent)}function Zz(_){if(typeof _=="function")return W6(_)?1:0;if(_!=null){if(_=_.$$typeof,_===K)return 11;if(_===G)return 14}return 2}function Pf(_,R){var J=_.alternate;return J===null?(J=Bd(_.tag,R,_.key,_.mode),J.elementType=_.elementType,J.type=_.type,J.stateNode=_.stateNode,J.alternate=_,_.alternate=J):(J.pendingProps=R,J.type=_.type,J.flags=0,J.subtreeFlags=0,J.deletions=null),J.flags=_.flags&14680064,J.childLanes=_.childLanes,J.lanes=_.lanes,J.child=_.child,J.memoizedProps=_.memoizedProps,J.memoizedState=_.memoizedState,J.updateQueue=_.updateQueue,R=_.dependencies,J.dependencies=R===null?null:{lanes:R.lanes,firstContext:R.firstContext},J.sibling=_.sibling,J.index=_.index,J.ref=_.ref,J}function q6(_,R,J,be,Le,Qe){var Ft=2;if(be=_,typeof _=="function")W6(_)&&(Ft=1);else if(typeof _=="string")Ft=5;else e:switch(_){case L:return Ux(J.children,Le,Qe,R);case z:Ft=8,Le|=8;break;case Q:return _=Bd(12,J,R,Le|2),_.elementType=Q,_.lanes=Qe,_;case re:return _=Bd(13,J,R,Le),_.elementType=re,_.lanes=Qe,_;case de:return _=Bd(19,J,R,Le),_.elementType=de,_.lanes=Qe,_;case ae:return G6(J,Le,Qe,R);default:if(typeof _=="object"&&_!==null)switch(_.$$typeof){case se:Ft=10;break e;case ee:Ft=9;break e;case K:Ft=11;break e;case G:Ft=14;break e;case ie:Ft=16,be=null;break e}throw Error(n(130,_==null?_:typeof _,""))}return R=Bd(Ft,J,R,Le),R.elementType=_,R.type=be,R.lanes=Qe,R}function Ux(_,R,J,be){return _=Bd(7,_,be,R),_.lanes=J,_}function G6(_,R,J,be){return _=Bd(22,_,be,R),_.elementType=ae,_.lanes=J,_.stateNode={isHidden:!1},_}function OA(_,R,J){return _=Bd(6,_,null,R),_.lanes=J,_}function MA(_,R,J){return R=Bd(4,_.children!==null?_.children:[],_.key,R),R.lanes=J,R.stateNode={containerInfo:_.containerInfo,pendingChildren:null,implementation:_.implementation},R}function Jz(_,R,J,be,Le){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=Ue(0),this.expirationTimes=Ue(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.identifierPrefix=be,this.onRecoverableError=Le,this.mutableSourceEagerHydrationData=null}function RA(_,R,J,be,Le,Qe,Ft,bn,Mn){return _=new Jz(_,R,J,bn,Mn),R===1?(R=1,Qe===!0&&(R|=8)):R=0,Qe=Bd(3,null,null,R),_.current=Qe,Qe.stateNode=_,Qe.memoizedState={element:be,isDehydrated:J,cache:null,transitions:null,pendingSuspenseBoundaries:null},m6(Qe),_}function eH(_,R,J){var be=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:be==null?null:""+be,children:_,containerInfo:R,implementation:J}}function nP(_){if(!_)return zm;_=_._reactInternals;e:{if(Mt(_)!==_||_.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 J=_.type;if(mu(J))return wI(_,J,R)}return R}function rP(_,R,J,be,Le,Qe,Ft,bn,Mn){return _=RA(J,be,!0,_,Le,Qe,Ft,bn,Mn),_.context=nP(null),J=_.current,be=Yc(),Le=Jm(J),Qe=Tp(be,Le),Qe.callback=R??null,Md(J,Qe,Le),_.current.lanes=Le,Fe(_,Le,be),yu(_,be),_}function K6(_,R,J,be){var Le=R.current,Qe=Yc(),Ft=Jm(Le);return J=nP(J),R.context===null?R.context=J:R.pendingContext=J,R=Tp(Qe,Ft),R.payload={element:_},be=be===void 0?null:be,be!==null&&(R.callback=be),_=Md(Le,R,Ft),_!==null&&(If(_,Le,Ft,Qe),x6(_,Le,Ft)),Ft}function Y6(_){if(_=_.current,!_.child)return null;switch(_.child.tag){case 5:return _.child.stateNode;default:return _.child.stateNode}}function sP(_,R){if(_=_.memoizedState,_!==null&&_.dehydrated!==null){var J=_.retryLane;_.retryLane=J!==0&&J<R?J:R}}function LA(_,R){sP(_,R),(_=_.alternate)&&sP(_,R)}var iP=typeof reportError=="function"?reportError:function(_){console.error(_)};function DA(_){this._internalRoot=_}wv.prototype.render=DA.prototype.render=function(_){var R=this._internalRoot;if(R===null)throw Error(n(409));K6(_,R,null,null)},wv.prototype.unmount=DA.prototype.unmount=function(){var _=this._internalRoot;if(_!==null){this._internalRoot=null;var R=_.containerInfo;Dx(function(){K6(null,_,null,null)}),R[Gu]=null}};function wv(_){this._internalRoot=_}wv.prototype.unstable_scheduleHydration=function(_){if(_){var R=Pt();_={blockedOn:null,target:_,priority:R};for(var J=0;J<Sr.length&&R!==0&&R<Sr[J].priority;J++);Sr.splice(J,0,_),J===0&&$n(_)}};function X6(_){return!(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)}function Q6(_){return!(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11&&(_.nodeType!==8||_.nodeValue!==" react-mount-point-unstable "))}function aP(){}function tH(_,R,J,be,Le){if(Le){if(typeof be=="function"){var Qe=be;be=function(){var ur=Y6(Ft);Qe.call(ur)}}var Ft=rP(R,be,_,0,null,!1,!1,"",aP);return _._reactRootContainer=Ft,_[Gu]=Ft.current,Dm(_.nodeType===8?_.parentNode:_),Dx(),Ft}for(;Le=_.lastChild;)_.removeChild(Le);if(typeof be=="function"){var bn=be;be=function(){var ur=Y6(Mn);bn.call(ur)}}var Mn=RA(_,0,!1,null,null,!1,!1,"",aP);return _._reactRootContainer=Mn,_[Gu]=Mn.current,Dm(_.nodeType===8?_.parentNode:_),Dx(function(){K6(R,Mn,J,be)}),Mn}function Z6(_,R,J,be,Le){var Qe=J._reactRootContainer;if(Qe){var Ft=Qe;if(typeof Le=="function"){var bn=Le;Le=function(){var Mn=Y6(Ft);bn.call(Mn)}}K6(R,Ft,_,Le)}else Ft=tH(J,R,_,Le,be);return Y6(Ft)}Gt=function(_){switch(_.tag){case 3:var R=_.stateNode;if(R.current.memoizedState.isDehydrated){var J=Ke(R.pendingLanes);J!==0&&(ut(R,J|1),yu(R,ke()),!(Zi&6)&&(Lx=ke()+500,Hm()))}break;case 13:Dx(function(){var be=kp(_,1);if(be!==null){var Le=Yc();If(be,_,1,Le)}}),LA(_,1)}},an=function(_){if(_.tag===13){var R=kp(_,134217728);if(R!==null){var J=Yc();If(R,_,134217728,J)}LA(_,134217728)}},et=function(_){if(_.tag===13){var R=Jm(_),J=kp(_,R);if(J!==null){var be=Yc();If(J,_,R,be)}LA(_,R)}},Pt=function(){return yt},qt=function(_,R){var J=yt;try{return yt=_,R()}finally{yt=J}},Ht=function(_,R,J){switch(R){case"input":if(Ve(_,J),R=J.name,J.type==="radio"&&R!=null){for(J=_;J.parentNode;)J=J.parentNode;for(J=J.querySelectorAll("input[name="+JSON.stringify(""+R)+'][type="radio"]'),R=0;R<J.length;R++){var be=J[R];if(be!==_&&be.form===_.form){var Le=a6(be);if(!Le)throw Error(n(90));Je(be),Ve(be,Le)}}}break;case"textarea":Vn(_,J);break;case"select":R=J.value,R!=null&&St(_,!!J.multiple,R,!1)}},In=IA,Sn=Dx;var J6={usingClientEntryPoint:!1,Events:[gc,Ai,a6,yn,_n,IA]},Cv={findFiberByHostInstance:dh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nH={bundleType:Cv.bundleType,version:Cv.version,rendererPackageName:Cv.rendererPackageName,rendererConfig:Cv.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(_){return _=On(_),_===null?null:_.stateNode},findFiberByHostInstance:Cv.findFiberByHostInstance,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var eC=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eC.isDisabled&&eC.supportsFiber)try{D=eC.inject(nH),V=eC}catch{}}return Hd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J6,Hd.createPortal=function(_,R){var J=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!X6(R))throw Error(n(200));return eH(_,R,null,J)},Hd.createRoot=function(_,R){if(!X6(_))throw Error(n(299));var J=!1,be="",Le=iP;return R!=null&&(R.unstable_strictMode===!0&&(J=!0),R.identifierPrefix!==void 0&&(be=R.identifierPrefix),R.onRecoverableError!==void 0&&(Le=R.onRecoverableError)),R=RA(_,1,!1,null,null,J,!1,be,Le),_[Gu]=R.current,Dm(_.nodeType===8?_.parentNode:_),new DA(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 _=On(R),_=_===null?null:_.stateNode,_},Hd.flushSync=function(_){return Dx(_)},Hd.hydrate=function(_,R,J){if(!Q6(R))throw Error(n(200));return Z6(null,_,R,!0,J)},Hd.hydrateRoot=function(_,R,J){if(!X6(_))throw Error(n(405));var be=J!=null&&J.hydratedSources||null,Le=!1,Qe="",Ft=iP;if(J!=null&&(J.unstable_strictMode===!0&&(Le=!0),J.identifierPrefix!==void 0&&(Qe=J.identifierPrefix),J.onRecoverableError!==void 0&&(Ft=J.onRecoverableError)),R=rP(R,null,_,1,J??null,Le,!1,Qe,Ft),_[Gu]=R.current,Dm(_),be)for(_=0;_<be.length;_++)J=be[_],Le=J._getVersion,Le=Le(J._source),R.mutableSourceEagerHydrationData==null?R.mutableSourceEagerHydrationData=[J,Le]:R.mutableSourceEagerHydrationData.push(J,Le);return new wv(R)},Hd.render=function(_,R,J){if(!Q6(R))throw Error(n(200));return Z6(null,_,R,!1,J)},Hd.unmountComponentAtNode=function(_){if(!Q6(_))throw Error(n(40));return _._reactRootContainer?(Dx(function(){Z6(null,null,_,!1,function(){_._reactRootContainer=null,_[Gu]=null})}),!0):!1},Hd.unstable_batchedUpdates=IA,Hd.unstable_renderSubtreeIntoContainer=function(_,R,J,be){if(!Q6(J))throw Error(n(200));if(_==null||_._reactInternals===void 0)throw Error(n(38));return Z6(_,R,J,!1,be)},Hd.version="18.3.1-next-f1338f8080-20240426",Hd}var ohe;function SAe(){if(ohe)return bH.exports;ohe=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(),bH.exports=uQe(),bH.exports}var lhe;function dQe(){if(lhe)return uP;lhe=1;var t=SAe();return uP.createRoot=t.createRoot,uP.hydrateRoot=t.hydrateRoot,uP}var NAe=dQe(),h=xx();const Ie=Ti(h),Wy=CAe({__proto__:null,default:Ie},[h]);var _a=SAe();const Qse=Ti(_a);/**
* @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 r_(){return r_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},r_.apply(this,arguments)}var Sy;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Sy||(Sy={}));const che="popstate";function fQe(t){t===void 0&&(t={});function e(r,s){let{pathname:a,search:o,hash:l}=r.location;return PZ("",{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:FM(s)}return pQe(e,n,null,t)}function Ko(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function jAe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function hQe(){return Math.random().toString(36).substr(2,8)}function uhe(t,e){return{usr:t.state,key:t.key,idx:e}}function PZ(t,e,n,r){return n===void 0&&(n=null),r_({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ej(e):e,{state:n,key:e&&e.key||r||hQe()})}function FM(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 Ej(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 pQe(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,l=Sy.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(r_({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Sy.Pop;let C=d(),N=C==null?null:C-u;u=C,c&&c({action:l,location:v.location,delta:N})}function x(C,N){l=Sy.Push;let I=PZ(v.location,C,N);u=d()+1;let P=uhe(I,u),M=v.createHref(I);try{o.pushState(P,"",M)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;s.location.assign(M)}a&&c&&c({action:l,location:v.location,delta:1})}function g(C,N){l=Sy.Replace;let I=PZ(v.location,C,N);u=d();let P=uhe(I,u),M=v.createHref(I);o.replaceState(P,"",M),a&&c&&c({action:l,location:v.location,delta:0})}function y(C){let N=s.location.origin!=="null"?s.location.origin:s.location.href,I=typeof C=="string"?C:FM(C);return I=I.replace(/ $/,"%20"),Ko(N,"No window.location.(origin|href) available to create URL for href: "+I),new URL(I,N)}let v={get action(){return l},get location(){return t(s,o)},listen(C){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(che,f),c=C,()=>{s.removeEventListener(che,f),c=null}},createHref(C){return e(s,C)},createURL:y,encodeLocation(C){let N=y(C);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:x,replace:g,go(C){return o.go(C)}};return v}var dhe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(dhe||(dhe={}));function mQe(t,e,n){return n===void 0&&(n="/"),xQe(t,e,n)}function xQe(t,e,n,r){let s=typeof e=="string"?Ej(e):e,a=GS(s.pathname||"/",n);if(a==null)return null;let o=AAe(t);gQe(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=EQe(a);l=AQe(o[c],u)}return l}function AAe(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Ko(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Oy([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(Ko(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),AAe(a.children,e,d,u)),!(a.path==null&&!a.index)&&e.push({path:u,score:NQe(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 _Ae(a.path))s(a,o,c)}),e}function _Ae(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=_Ae(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 gQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:jQe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const bQe=/^:[\w-]+$/,yQe=3,vQe=2,wQe=1,CQe=10,SQe=-2,fhe=t=>t==="*";function NQe(t,e){let n=t.split("/"),r=n.length;return n.some(fhe)&&(r+=SQe),e&&(r+=vQe),n.filter(s=>!fhe(s)).reduce((s,a)=>s+(bQe.test(a)?yQe:a===""?wQe:CQe),r)}function jQe(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 AQe(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=FZ({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),x=c.route;if(!f)return null;Object.assign(s,f.params),o.push({params:s,pathname:Oy([a,f.pathname]),pathnameBase:PQe(Oy([a,f.pathnameBase])),route:x}),f.pathnameBase!=="/"&&(a=Oy([a,f.pathnameBase]))}return o}function FZ(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=_Qe(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 _Qe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),jAe(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 EQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return jAe(!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 GS(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 kQe(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?Ej(t):t;return{pathname:n?n.startsWith("/")?n:TQe(n,e):e,search:FQe(r),hash:OQe(s)}}function TQe(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 wH(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 IQe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Zse(t,e){let n=IQe(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Jse(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=Ej(t):(s=r_({},t),Ko(!s.pathname||!s.pathname.includes("?"),wH("?","pathname","search",s)),Ko(!s.pathname||!s.pathname.includes("#"),wH("#","pathname","hash",s)),Ko(!s.search||!s.search.includes("#"),wH("#","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=kQe(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Oy=t=>t.join("/").replace(/\/\/+/g,"/"),PQe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),FQe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,OQe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function MQe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const EAe=["post","put","patch","delete"];new Set(EAe);const RQe=["get",...EAe];new Set(RQe);/**
* 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 s_(){return s_=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},s_.apply(this,arguments)}const yB=h.createContext(null),kAe=h.createContext(null),I1=h.createContext(null),vB=h.createContext(null),gx=h.createContext({outlet:null,matches:[],isDataRoute:!1}),TAe=h.createContext(null);function LQe(t,e){let{relative:n}=e===void 0?{}:e;kj()||Ko(!1);let{basename:r,navigator:s}=h.useContext(I1),{hash:a,pathname:o,search:l}=wB(t,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:Oy([r,o])),s.createHref({pathname:c,search:l,hash:a})}function kj(){return h.useContext(vB)!=null}function Xl(){return kj()||Ko(!1),h.useContext(vB).location}function IAe(t){h.useContext(I1).static||h.useLayoutEffect(t)}function Ao(){let{isDataRoute:t}=h.useContext(gx);return t?ZQe():DQe()}function DQe(){kj()||Ko(!1);let t=h.useContext(yB),{basename:e,future:n,navigator:r}=h.useContext(I1),{matches:s}=h.useContext(gx),{pathname:a}=Xl(),o=JSON.stringify(Zse(s,n.v7_relativeSplatPath)),l=h.useRef(!1);return IAe(()=>{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=Jse(u,JSON.parse(o),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Oy([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,o,a,t])}const BQe=h.createContext(null);function $Qe(t){let e=h.useContext(gx).outlet;return e&&h.createElement(BQe.Provider,{value:t},e)}function g2(){let{matches:t}=h.useContext(gx),e=t[t.length-1];return e?e.params:{}}function wB(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=h.useContext(I1),{matches:s}=h.useContext(gx),{pathname:a}=Xl(),o=JSON.stringify(Zse(s,r.v7_relativeSplatPath));return h.useMemo(()=>Jse(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function UQe(t,e){return zQe(t,e)}function zQe(t,e,n,r){kj()||Ko(!1);let{navigator:s}=h.useContext(I1),{matches:a}=h.useContext(gx),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Xl(),d;if(e){var f;let C=typeof e=="string"?Ej(e):e;c==="/"||(f=C.pathname)!=null&&f.startsWith(c)||Ko(!1),d=C}else d=u;let x=d.pathname||"/",g=x;if(c!=="/"){let C=c.replace(/^\//,"").split("/");g="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let y=mQe(t,{pathname:g}),v=GQe(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:Oy([c,s.encodeLocation?s.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:Oy([c,s.encodeLocation?s.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),a,n,r);return e&&v?h.createElement(vB.Provider,{value:{location:s_({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Sy.Pop}},v):v}function HQe(){let t=QQe(),e=MQe(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 VQe=h.createElement(HQe,null);class WQe 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(gx.Provider,{value:this.props.routeContext},h.createElement(TAe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function qQe(t){let{routeContext:e,match:n,children:r}=t,s=h.useContext(yB);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(gx.Provider,{value:e},r)}function GQe(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Ko(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:x,errors:g}=n,y=f.route.loader&&x[f.route.id]===void 0&&(!g||g[f.route.id]===void 0);if(f.route.lazy||y){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,x)=>{let g,y=!1,v=null,C=null;n&&(g=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||VQe,c&&(u<0&&x===0?(y=!0,C=null):u===x&&(y=!0,C=f.route.hydrateFallbackElement||null)));let N=e.concat(o.slice(0,x+1)),I=()=>{let P;return g?P=v:y?P=C:f.route.Component?P=h.createElement(f.route.Component,null):f.route.element?P=f.route.element:P=d,h.createElement(qQe,{match:f,routeContext:{outlet:d,matches:N,isDataRoute:n!=null},children:P})};return n&&(f.route.ErrorBoundary||f.route.errorElement||x===0)?h.createElement(WQe,{location:n.location,revalidation:n.revalidation,component:v,error:g,children:I(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):I()},null)}var PAe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(PAe||{}),OM=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}(OM||{});function KQe(t){let e=h.useContext(yB);return e||Ko(!1),e}function YQe(t){let e=h.useContext(kAe);return e||Ko(!1),e}function XQe(t){let e=h.useContext(gx);return e||Ko(!1),e}function FAe(t){let e=XQe(),n=e.matches[e.matches.length-1];return n.route.id||Ko(!1),n.route.id}function QQe(){var t;let e=h.useContext(TAe),n=YQe(OM.UseRouteError),r=FAe(OM.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function ZQe(){let{router:t}=KQe(PAe.UseNavigateStable),e=FAe(OM.UseNavigateStable),n=h.useRef(!1);return IAe(()=>{n.current=!0}),h.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,s_({fromRouteId:e},a)))},[t,e])}function hhe(t){let{to:e,replace:n,state:r,relative:s}=t;kj()||Ko(!1);let{future:a,static:o}=h.useContext(I1),{matches:l}=h.useContext(gx),{pathname:c}=Xl(),u=Ao(),d=Jse(e,Zse(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 JQe(t){return $Qe(t.context)}function da(t){Ko(!1)}function eZe(t){let{basename:e="/",children:n=null,location:r,navigationType:s=Sy.Pop,navigator:a,static:o=!1,future:l}=t;kj()&&Ko(!1);let c=e.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:c,navigator:a,static:o,future:s_({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=Ej(r));let{pathname:d="/",search:f="",hash:x="",state:g=null,key:y="default"}=r,v=h.useMemo(()=>{let C=GS(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(I1.Provider,{value:u},h.createElement(vB.Provider,{children:n,value:v}))}function tZe(t){let{children:e,location:n}=t;return UQe(OZ(e),n)}new Promise(()=>{});function OZ(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,OZ(r.props.children,a));return}r.type!==da&&Ko(!1),!r.props.index||!r.props.children||Ko(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=OZ(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 MM(){return MM=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},MM.apply(this,arguments)}function OAe(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 nZe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function rZe(t,e){return t.button===0&&(!e||e==="_self")&&!nZe(t)}function MZ(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 sZe(t,e){let n=MZ(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const iZe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],aZe=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],oZe="6";try{window.__reactRouterVersion=oZe}catch{}const lZe=h.createContext({isTransitioning:!1}),cZe="startTransition",phe=Wy[cZe];function uZe(t){let{basename:e,children:n,future:r,window:s}=t,a=h.useRef();a.current==null&&(a.current=fQe({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&&phe?phe(()=>c(f)):c(f)},[c,u]);return h.useLayoutEffect(()=>o.listen(d),[o,d]),h.createElement(eZe,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const dZe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fZe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Po=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=OAe(e,iZe),{basename:g}=h.useContext(I1),y,v=!1;if(typeof u=="string"&&fZe.test(u)&&(y=u,dZe))try{let P=new URL(window.location.href),M=u.startsWith("//")?new URL(P.protocol+u):new URL(u),F=GS(M.pathname,g);M.origin===P.origin&&F!=null?u=F+M.search+M.hash:v=!0}catch{}let C=LQe(u,{relative:s}),N=pZe(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,unstable_viewTransition:f});function I(P){r&&r(P),P.defaultPrevented||N(P)}return h.createElement("a",MM({},x,{href:y||C,onClick:v||a?r:I,ref:n,target:c}))}),mhe=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=OAe(e,aZe),x=wB(c,{relative:f.relative}),g=Xl(),y=h.useContext(kAe),{navigator:v,basename:C}=h.useContext(I1),N=y!=null&&mZe(x)&&u===!0,I=v.encodeLocation?v.encodeLocation(x).pathname:x.pathname,P=g.pathname,M=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;s||(P=P.toLowerCase(),M=M?M.toLowerCase():null,I=I.toLowerCase()),M&&C&&(M=GS(M,C)||M);const F=I!=="/"&&I.endsWith("/")?I.length-1:I.length;let $=P===I||!o&&P.startsWith(I)&&P.charAt(F)==="/",L=M!=null&&(M===I||!o&&M.startsWith(I)&&M.charAt(I.length)==="/"),z={isActive:$,isPending:L,isTransitioning:N},Q=$?r:void 0,se;typeof a=="function"?se=a(z):se=[a,$?"active":null,L?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let ee=typeof l=="function"?l(z):l;return h.createElement(Po,MM({},f,{"aria-current":Q,className:se,ref:n,style:ee,to:c,unstable_viewTransition:u}),typeof d=="function"?d(z):d)});var RZ;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(RZ||(RZ={}));var xhe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(xhe||(xhe={}));function hZe(t){let e=h.useContext(yB);return e||Ko(!1),e}function pZe(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,unstable_viewTransition:l}=e===void 0?{}:e,c=Ao(),u=Xl(),d=wB(t,{relative:o});return h.useCallback(f=>{if(rZe(f,n)){f.preventDefault();let x=r!==void 0?r:FM(u)===FM(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 MAe(t){let e=h.useRef(MZ(t)),n=h.useRef(!1),r=Xl(),s=h.useMemo(()=>sZe(r.search,n.current?null:e.current),[r.search]),a=Ao(),o=h.useCallback((l,c)=>{const u=MZ(typeof l=="function"?l(s):l);n.current=!0,a("?"+u,c)},[a,s]);return[s,o]}function mZe(t,e){e===void 0&&(e={});let n=h.useContext(lZe);n==null&&Ko(!1);let{basename:r}=hZe(RZ.useViewTransitionState),s=wB(t,{relative:e.relative});if(!n.isTransitioning)return!1;let a=GS(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=GS(n.nextLocation.pathname,r)||n.nextLocation.pathname;return FZ(s.pathname,o)!=null||FZ(s.pathname,a)!=null}let xZe={data:""},gZe=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||xZe,bZe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,yZe=/\/\*[^]*?\*\/| +/g,ghe=/\n+/g,Wb=(t,e)=>{let n="",r="",s="";for(let a in t){let o=t[a];a[0]=="@"?a[1]=="i"?n=a+" "+o+";":r+=a[1]=="f"?Wb(o,a):a+"{"+Wb(o,a[1]=="k"?"":e)+"}":typeof o=="object"?r+=Wb(o,e?e.replace(/([^,])+/g,l=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,l):l?l+" "+c:c)):a):o!=null&&(a=/^--/.test(a)?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Wb.p?Wb.p(a,o):a+":"+o+";")}return n+(e&&s?e+"{"+s+"}":s)+r},Wx={},RAe=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+RAe(t[n]);return e}return t},vZe=(t,e,n,r,s)=>{let a=RAe(t),o=Wx[a]||(Wx[a]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Wx[o]){let c=a!==t?t:(u=>{let d,f,x=[{}];for(;d=bZe.exec(u.replace(yZe,""));)d[4]?x.shift():d[3]?(f=d[3].replace(ghe," ").trim(),x.unshift(x[0][f]=x[0][f]||{})):x[0][d[1]]=d[2].replace(ghe," ").trim();return x[0]})(t);Wx[o]=Wb(s?{["@keyframes "+o]:c}:c,n?"":"."+o)}let l=n&&Wx.g?Wx.g:null;return n&&(Wx.g=Wx[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(Wx[o],e,r,l),o},wZe=(t,e,n)=>t.reduce((r,s,a)=>{let o=e[a];if(o&&o.call){let l=o(n),c=l&&l.props&&l.props.className||/^go/.test(l)&&l;o=c?"."+c:l&&typeof l=="object"?l.props?"":Wb(l,""):l===!1?"":l}return r+s+(o??"")},"");function CB(t){let e=this||{},n=t.call?t(e.p):t;return vZe(n.unshift?n.raw?wZe(n,[].slice.call(arguments,1),e.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(e.p):s),{}):n,gZe(e.target),e.g,e.o,e.k)}let LAe,LZ,DZ;CB.bind({g:1});let f1=CB.bind({k:1});function CZe(t,e,n,r){Wb.p=e,LAe=t,LZ=n,DZ=r}function b2(t,e){let n=this||{};return function(){let r=arguments;function s(a,o){let l=Object.assign({},a),c=l.className||s.className;n.p=Object.assign({theme:LZ&&LZ()},l),n.o=/ *go\d+/.test(c),l.className=CB.apply(n,r)+(c?" "+c:"");let u=t;return t[0]&&(u=l.as||t,delete l.as),DZ&&u[0]&&DZ(l),LAe(u,l)}return s}}var SZe=t=>typeof t=="function",RM=(t,e)=>SZe(t)?t(e):t,NZe=(()=>{let t=0;return()=>(++t).toString()})(),DAe=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),jZe=20,CO=new Map,AZe=1e3,bhe=t=>{if(CO.has(t))return;let e=setTimeout(()=>{CO.delete(t),C5({type:4,toastId:t})},AZe);CO.set(t,e)},_Ze=t=>{let e=CO.get(t);e&&clearTimeout(e)},BZ=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,jZe)};case 1:return e.toast.id&&_Ze(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)?BZ(t,{type:1,toast:n}):BZ(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?bhe(r):t.toasts.forEach(a=>{bhe(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}))}}},SO=[],NO={toasts:[],pausedAt:void 0},C5=t=>{NO=BZ(NO,t),SO.forEach(e=>{e(NO)})},EZe={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},kZe=(t={})=>{let[e,n]=h.useState(NO);h.useEffect(()=>(SO.push(n),()=>{let s=SO.indexOf(n);s>-1&&SO.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)||EZe[s.type],style:{...t.style,...(o=t[s.type])==null?void 0:o.style,...s.style}}});return{...e,toasts:r}},TZe=(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)||NZe()}),eT=t=>(e,n)=>{let r=TZe(e,t,n);return C5({type:2,toast:r}),r.id},Xf=(t,e)=>eT("blank")(t,e);Xf.error=eT("error");Xf.success=eT("success");Xf.loading=eT("loading");Xf.custom=eT("custom");Xf.dismiss=t=>{C5({type:3,toastId:t})};Xf.remove=t=>C5({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(RM(e.success,s),{id:r,...n,...n==null?void 0:n.success}),s)).catch(s=>{Xf.error(RM(e.error,s),{id:r,...n,...n==null?void 0:n.error})}),t};var IZe=(t,e)=>{C5({type:1,toast:{id:t,height:e}})},PZe=()=>{C5({type:5,time:Date.now()})},FZe=t=>{let{toasts:e,pausedAt:n}=kZe(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&&C5({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:IZe,startPause:PZe,endPause:r,calculateOffset:s}}},OZe=f1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,MZe=f1`
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}`,RZe=f1`
from {
transform: scale(0) rotate(90deg);
opacity: 0;
}
to {
transform: scale(1) rotate(90deg);
opacity: 1;
}`,LZe=b2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#ff4b4b"};
position: relative;
transform: rotate(45deg);
animation: ${OZe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after,
&:before {
content: '';
animation: ${MZe} 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: ${RZe} 0.15s ease-out forwards;
animation-delay: 180ms;
transform: rotate(90deg);
}
`,DZe=f1`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`,BAe=b2("div")`
width: 12px;
height: 12px;
box-sizing: border-box;
border: 2px solid;
border-radius: 100%;
border-color: ${t=>t.secondary||"#e0e0e0"};
border-right-color: ${t=>t.primary||"#616161"};
animation: ${DZe} 1s linear infinite;
`,BZe=f1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,$Ze=f1`
0% {
height: 0;
width: 0;
opacity: 0;
}
40% {
height: 0;
width: 6px;
opacity: 1;
}
100% {
opacity: 1;
height: 10px;
}`,UZe=b2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#61d345"};
position: relative;
transform: rotate(45deg);
animation: ${BZe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after {
content: '';
box-sizing: border-box;
animation: ${$Ze} 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;
}
`,zZe=b2("div")`
position: absolute;
`,HZe=b2("div")`
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-width: 20px;
min-height: 20px;
`,VZe=f1`
from {
transform: scale(0.6);
opacity: 0.4;
}
to {
transform: scale(1);
opacity: 1;
}`,WZe=b2("div")`
position: relative;
transform: scale(0.6);
opacity: 0.4;
min-width: 20px;
animation: ${VZe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
`,qZe=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?h.createElement(WZe,null,e):e:n==="blank"?null:h.createElement(HZe,null,h.createElement(BAe,{...r}),n!=="loading"&&h.createElement(zZe,null,n==="error"?h.createElement(LZe,{...r}):h.createElement(UZe,{...r})))},GZe=t=>`
0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`,KZe=t=>`
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;}
`,YZe="0%{opacity:0;} 100%{opacity:1;}",XZe="0%{opacity:1;} 100%{opacity:0;}",QZe=b2("div")`
display: flex;
align-items: center;
background: #fff;
color: #363636;
line-height: 1.3;
will-change: transform;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
max-width: 350px;
pointer-events: auto;
padding: 8px 10px;
border-radius: 8px;
`,ZZe=b2("div")`
display: flex;
justify-content: center;
margin: 4px 10px;
color: inherit;
flex: 1 1 auto;
white-space: pre-line;
`,JZe=(t,e)=>{let n=t.includes("top")?1:-1,[r,s]=DAe()?[YZe,XZe]:[GZe(n),KZe(n)];return{animation:e?`${f1(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${f1(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},eJe=h.memo(({toast:t,position:e,style:n,children:r})=>{let s=t.height?JZe(t.position||e||"top-center",t.visible):{opacity:0},a=h.createElement(qZe,{toast:t}),o=h.createElement(ZZe,{...t.ariaProps},RM(t.message,t));return h.createElement(QZe,{className:t.className,style:{...s,...n,...t.style}},typeof r=="function"?r({icon:a,message:o}):h.createElement(h.Fragment,null,a,o))});CZe(h.createElement);var tJe=({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)},nJe=(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:DAe()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...s}},rJe=CB`
z-index: 9999;
> * {
pointer-events: auto;
}
`,dP=16,sJe=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:s,containerStyle:a,containerClassName:o})=>{let{toasts:l,handlers:c}=FZe(n);return h.createElement("div",{style:{position:"fixed",zIndex:9999,top:dP,left:dP,right:dP,bottom:dP,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=nJe(d,f);return h.createElement(tJe,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?rJe:"",style:x},u.type==="custom"?RM(u.message,u):s?s(u):h.createElement(eJe,{toast:u,position:d}))}))},dn=Xf;const $Ae=typeof document<"u"?Ie.useLayoutEffect:()=>{};function iJe(t){const e=h.useRef(null);return $Ae(()=>{e.current=t},[t]),h.useCallback((...n)=>{const r=e.current;return r==null?void 0:r(...n)},[])}const tT=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},aw=t=>t&&"window"in t&&t.window===t?t:tT(t).defaultView||window;function aJe(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 oJe(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 UAe(t){let e=null;return()=>(e==null&&(e=t()),e)}const lJe=UAe(function(){return oJe(/^Mac/i)}),cJe=UAe(function(){return aJe(/Android/i)});function uJe(t){return t.mozInputSource===0&&t.isTrusted?!0:cJe()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}class dJe{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 zAe(t){let e=h.useRef({isFocused:!1,observer:null});$Ae(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=iJe(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 dJe("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 fJe(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=zAe(a),l=h.useCallback(c=>{const u=tT(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 nT=null,$Z=new Set,x9=new Map,P3=!1,UZ=!1;const hJe={Tab:!0,Escape:!0};function eie(t,e){for(let n of $Z)n(t,e)}function pJe(t){return!(t.metaKey||!lJe()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function LM(t){P3=!0,pJe(t)&&(nT="keyboard",eie("keyboard",t))}function ep(t){nT="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(P3=!0,eie("pointer",t))}function HAe(t){uJe(t)&&(P3=!0,nT="virtual")}function VAe(t){t.target===window||t.target===document||(!P3&&!UZ&&(nT="virtual",eie("virtual",t)),P3=!1,UZ=!1)}function WAe(){P3=!1,UZ=!0}function zZ(t){if(typeof window>"u"||x9.get(aw(t)))return;const e=aw(t),n=tT(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){P3=!0,r.apply(this,arguments)},n.addEventListener("keydown",LM,!0),n.addEventListener("keyup",LM,!0),n.addEventListener("click",HAe,!0),e.addEventListener("focus",VAe,!0),e.addEventListener("blur",WAe,!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",()=>{qAe(t)},{once:!0}),x9.set(e,{focus:r})}const qAe=(t,e)=>{const n=aw(t),r=tT(t);e&&r.removeEventListener("DOMContentLoaded",e),x9.has(n)&&(n.HTMLElement.prototype.focus=x9.get(n).focus,r.removeEventListener("keydown",LM,!0),r.removeEventListener("keyup",LM,!0),r.removeEventListener("click",HAe,!0),n.removeEventListener("focus",VAe,!0),n.removeEventListener("blur",WAe,!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)),x9.delete(n))};function mJe(t){const e=tT(t);let n;return e.readyState!=="loading"?zZ(t):(n=()=>{zZ(t)},e.addEventListener("DOMContentLoaded",n)),()=>qAe(t,n)}typeof document<"u"&&mJe();function GAe(){return nT!=="pointer"}const xJe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function gJe(t,e,n){var r;const s=typeof window<"u"?aw(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?aw(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?aw(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?aw(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return t=t||(n==null?void 0:n.target)instanceof s&&!xJe.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&&!hJe[n.key])}function bJe(t,e,n){zZ(),h.useEffect(()=>{let r=(s,a)=>{gJe(!!(n!=null&&n.isTextInput),s,a)&&t(GAe())};return $Z.add(r),()=>{$Z.delete(r)}},e)}function yJe(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=zAe(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 DM=!1,CH=0;function HZ(){DM=!0,setTimeout(()=>{DM=!1},50)}function yhe(t){t.pointerType==="touch"&&HZ()}function vJe(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",yhe):document.addEventListener("touchend",HZ),CH++,()=>{CH--,!(CH>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",yhe):document.removeEventListener("touchend",HZ))}}function tie(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(vJe,[]);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=>{DM&&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&&!DM&&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 nie(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,s=h.useRef({isFocused:!1,isFocusVisible:e||GAe()}),[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]);bJe(g=>{s.current.isFocusVisible=g,u()},[],{isTextInput:n});let{focusProps:f}=fJe({isDisabled:r,onFocusChange:d}),{focusWithinProps:x}=yJe({isDisabled:!r,onFocusWithinChange:d});return{isFocused:a,isFocusVisible:l,focusProps:r?x:f}}var wJe=Object.defineProperty,CJe=(t,e,n)=>e in t?wJe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,SH=(t,e,n)=>(CJe(t,typeof e!="symbol"?e+"":e,n),n);let SJe=class{constructor(){SH(this,"current",this.detect()),SH(this,"handoffState","pending"),SH(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},o3=new SJe;function y2(t){return o3.isServer?null:t instanceof Node?t.ownerDocument:t!=null&&t.hasOwnProperty("current")&&t.current instanceof Node?t.current.ownerDocument:document}function SB(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function bx(){let t=[],e={addEventListener(n,r,s,a){return n.addEventListener(r,s,a),e.add(()=>n.removeEventListener(r,s,a))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return SB(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,s){let a=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:s}),this.add(()=>{Object.assign(n.style,{[r]:a})})},group(n){let r=bx();return n(r),this.add(()=>r.dispose())},add(n){return t.includes(n)||t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let s of t.splice(r,1))s()}},dispose(){for(let n of t.splice(0))n()}};return e}function v2(){let[t]=h.useState(bx);return h.useEffect(()=>()=>t.dispose(),[t]),t}let to=(t,e)=>{o3.isServer?h.useEffect(t,e):h.useLayoutEffect(t,e)};function S5(t){let e=h.useRef(t);return to(()=>{e.current=t},[t]),e}let Ws=function(t){let e=S5(t);return Ie.useCallback((...n)=>e.current(...n),[e])};function NJe(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 jJe(t,e){return!(!t||!e||t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom)}function rie({disabled:t=!1}={}){let e=h.useRef(null),[n,r]=h.useState(!1),s=v2(),a=Ws(()=>{e.current=null,r(!1),s.dispose()}),o=Ws(l=>{if(s.dispose(),e.current===null){e.current=l.currentTarget,r(!0);{let c=y2(l.currentTarget);s.addEventListener(c,"pointerup",a,!1),s.addEventListener(c,"pointermove",u=>{if(e.current){let d=NJe(u);r(jJe(d,e.current.getBoundingClientRect()))}},!1),s.addEventListener(c,"pointercancel",a,!1)}}});return{pressed:n,pressProps:t?{}:{onPointerDown:o,onPointerUp:a,onClick:a}}}let AJe=h.createContext(void 0);function sie(){return h.useContext(AJe)}function VZ(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function rh(t,e,...n){if(t in e){let s=e[t];return typeof s=="function"?s(...n):s}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(s=>`"${s}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,rh),r}var qy=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(qy||{}),Ny=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(Ny||{});function Eo(){let t=EJe();return h.useCallback(e=>_Je({mergeRefs:t,...e}),[t])}function _Je({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:s,visible:a=!0,name:o,mergeRefs:l}){l=l??kJe;let c=KAe(e,t);if(a)return fP(c,n,r,o,l);let u=s??0;if(u&2){let{static:d=!1,...f}=c;if(d)return fP(f,n,r,o,l)}if(u&1){let{unmount:d=!0,...f}=c;return rh(d?0:1,{0(){return null},1(){return fP({...f,hidden:!0,style:{display:"none"}},n,r,o,l)}})}return fP(c,n,r,o,l)}function fP(t,e={},n,r,s){let{as:a=n,children:o,refName:l="ref",...c}=NH(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(Hb(c)).length>0||Object.keys(Hb(f)).length>0))if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(Hb(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Hb(c)).concat(Object.keys(Hb(f))).map(x=>` - ${x}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(x=>` - ${x}`).join(`
`)].join(`
`))}else{let x=d.props,g=x==null?void 0:x.className,y=typeof g=="function"?(...N)=>VZ(g(...N),c.className):VZ(g,c.className),v=y?{className:y}:{},C=KAe(d.props,Hb(NH(c,["ref"])));for(let N in f)N in C&&delete f[N];return h.cloneElement(d,Object.assign({},C,f,u,{ref:s(TJe(d),u.ref)},v))}return h.createElement(a,Object.assign({},NH(c,["ref"]),a!==h.Fragment&&u,a!==h.Fragment&&f),d)}function EJe(){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 kJe(...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 KAe(...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 i_(...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 go(t){var e;return Object.assign(h.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Hb(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function NH(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}function TJe(t){return Ie.version.split(".")[0]>="19"?t.props.ref:t.ref}function IJe(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,Ws(u=>(a||s(u),e==null?void 0:e(u)))]}function PJe(t){let[e]=h.useState(t);return e}function YAe(t={},e=null,n=[]){for(let[r,s]of Object.entries(t))QAe(n,XAe(e,r),s);return n}function XAe(t,e){return t?t+"["+e+"]":e}function QAe(t,e,n){if(Array.isArray(n))for(let[r,s]of n.entries())QAe(t,XAe(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,""]):YAe(n,e,t)}function FJe(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 OJe="span";var KS=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(KS||{});function MJe(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 Eo()({ourProps:a,theirProps:s,slot:{},defaultTag:OJe,name:"Hidden"})}let a_=go(MJe),RJe=h.createContext(null);function LJe({children:t}){let e=h.useContext(RJe);if(!e)return Ie.createElement(Ie.Fragment,null,t);let{target:n}=e;return n?_a.createPortal(Ie.createElement(Ie.Fragment,null,t),n):null}function DJe({data:t,form:e,disabled:n,onReset:r,overrides:s}){let[a,o]=h.useState(null),l=v2();return h.useEffect(()=>{if(r&&a)return l.addEventListener(a,"reset",r)},[a,e,r]),Ie.createElement(LJe,null,Ie.createElement(BJe,{setForm:o,formId:e}),YAe(t).map(([c,u])=>Ie.createElement(a_,{features:KS.Hidden,...Hb({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:e,disabled:n,name:c,value:u,...s})})))}function BJe({setForm:t,formId:e}){return h.useEffect(()=>{if(e){let n=document.getElementById(e);n&&t(n)}},[t,e]),e?null:Ie.createElement(a_,{features:KS.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&t(r)}})}let $Je=h.createContext(void 0);function ZAe(){return h.useContext($Je)}function iie(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&&UJe(n)?!1:r}function UJe(t){if(!t)return!1;let e=t.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}let JAe=Symbol();function e7e(t,e=!0){return Object.assign(t,{[JAe]:e})}function dc(...t){let e=h.useRef(t);h.useEffect(()=>{e.current=t},[t]);let n=Ws(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[JAe]))?void 0:n}let NB=h.createContext(null);NB.displayName="DescriptionContext";function t7e(){let t=h.useContext(NB);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,t7e),e}return t}function zJe(){var t,e;return(e=(t=h.useContext(NB))==null?void 0:t.value)!=null?e:void 0}function aie(){let[t,e]=h.useState([]);return[t.length>0?t.join(" "):void 0,h.useMemo(()=>function(n){let r=Ws(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 Ie.createElement(NB.Provider,{value:s},n.children)},[e])]}let HJe="p";function VJe(t,e){let n=h.useId(),r=sie(),{id:s=`headlessui-description-${n}`,...a}=t,o=t7e(),l=dc(e);to(()=>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 Eo()({ourProps:d,theirProps:a,slot:u,defaultTag:HJe,name:o.name||"Description"})}let WJe=go(VJe),n7e=Object.assign(WJe,{});var Co=(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))(Co||{});let jB=h.createContext(null);jB.displayName="LabelContext";function oie(){let t=h.useContext(jB);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,oie),e}return t}function r7e(t){var e,n,r;let s=(n=(e=h.useContext(jB))==null?void 0:e.value)!=null?n:void 0;return((r=void 0)!=null?r:0)>0?[s,...t].filter(Boolean).join(" "):s}function lie({inherit:t=!1}={}){let e=r7e(),[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=Ws(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 Ie.createElement(jB.Provider,{value:l},a.children)},[r])]}let qJe="label";function GJe(t,e){var n;let r=h.useId(),s=oie(),a=ZAe(),o=sie(),{id:l=`headlessui-label-${r}`,htmlFor:c=a??((n=s.props)==null?void 0:n.htmlFor),passive:u=!1,...d}=t,f=dc(e);to(()=>s.register(l),[l,s.register]);let x=Ws(C=>{let N=C.currentTarget;if(N instanceof HTMLLabelElement&&C.preventDefault(),s.props&&"onClick"in s.props&&typeof s.props.onClick=="function"&&s.props.onClick(C),N instanceof HTMLLabelElement){let I=document.getElementById(N.htmlFor);if(I){let P=I.getAttribute("disabled");if(P==="true"||P==="")return;let M=I.getAttribute("aria-disabled");if(M==="true"||M==="")return;(I instanceof HTMLInputElement&&(I.type==="radio"||I.type==="checkbox")||I.role==="radio"||I.role==="checkbox"||I.role==="switch")&&I.click(),I.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),Eo()({ourProps:v,theirProps:d,slot:y,defaultTag:c?qJe:"div",name:s.name||"Label"})}let KJe=go(GJe),YJe=Object.assign(KJe,{}),XJe=h.createContext(()=>{});function s7e({value:t,children:e}){return Ie.createElement(XJe.Provider,{value:t},e)}function QJe(t){if(t===null)return{width:0,height:0};let{width:e,height:n}=t.getBoundingClientRect();return{width:e,height:n}}function ZJe(t,e=!1){let[n,r]=h.useReducer(()=>({}),{}),s=h.useMemo(()=>QJe(t),[t,n]);return to(()=>{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 JJe=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 i7e(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 a7e(t){return h.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}let eet=new JJe(()=>i7e(()=>[],{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 Tj(t,e){let n=eet.get(e),r=h.useId(),s=a7e(n);if(to(()=>{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 WZ=new Map,g9=new Map;function vhe(t){var e;let n=(e=g9.get(t))!=null?e:0;return g9.set(t,n+1),n!==0?()=>whe(t):(WZ.set(t,{"aria-hidden":t.getAttribute("aria-hidden"),inert:t.inert}),t.setAttribute("aria-hidden","true"),t.inert=!0,()=>whe(t))}function whe(t){var e;let n=(e=g9.get(t))!=null?e:1;if(n===1?g9.delete(t):g9.set(t,n-1),n!==1)return;let r=WZ.get(t);r&&(r["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r["aria-hidden"]),t.inert=r.inert,WZ.delete(t))}function o7e(t,{allowed:e,disallowed:n}={}){let r=Tj(t,"inert-others");to(()=>{var s,a;if(!r)return;let o=bx();for(let c of(s=n==null?void 0:n())!=null?s:[])c&&o.add(vhe(c));let l=(a=e==null?void 0:e())!=null?a:[];for(let c of l){if(!c)continue;let u=y2(c);if(!u)continue;let d=c.parentElement;for(;d&&d!==u.body;){for(let f of d.children)l.some(x=>f.contains(x))||o.add(vhe(f));d=d.parentElement}}return o.dispose},[r,e,n])}function l7e(t,e,n){let r=S5(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=bx();if(typeof ResizeObserver<"u"){let o=new ResizeObserver(()=>r.current(s));o.observe(s),a.add(()=>o.disconnect())}if(typeof IntersectionObserver<"u"){let o=new IntersectionObserver(()=>r.current(s));o.observe(s),a.add(()=>o.disconnect())}return()=>a.dispose()},[e,r,t])}let BM=["[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(","),tet=["[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||{}),qZ=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(qZ||{}),net=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(net||{});function c7e(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(BM)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function ret(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(tet)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var cie=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(cie||{});function uie(t,e=0){var n;return t===((n=y2(t))==null?void 0:n.body)?!1:rh(e,{0(){return t.matches(BM)},1(){let r=t;for(;r!==null;){if(r.matches(BM))return!0;r=r.parentElement}return!1}})}function u7e(t){let e=y2(t);bx().nextFrame(()=>{e&&!uie(e.activeElement,0)&&V0(t)})}var set=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(set||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",t=>{t.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:t.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function V0(t){t==null||t.focus({preventScroll:!0})}let iet=["textarea","input"].join(",");function aet(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,iet))!=null?n:!1}function d7e(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 oet(t,e){return b4(c7e(),e,{relativeTo:t})}function b4(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?d7e(t):t:e&64?ret(t):c7e(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 f7e(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function cet(){return/Android/gi.test(window.navigator.userAgent)}function uet(){return f7e()||cet()}function UA(t,e,n,r){let s=S5(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 h7e(t,e,n,r){let s=S5(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 Che=30;function p7e(t,e,n){let r=Tj(t,"outside-click"),s=S5(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!uie(d,cie.Loose)&&d.tabIndex!==-1&&c.preventDefault(),s.current(c,d)},[s,e]),o=h.useRef(null);UA(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),UA(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),UA(r,"click",c=>{uet()||o.current&&(a(c,()=>o.current),o.current=null)},!0);let l=h.useRef({x:0,y:0});UA(r,"touchstart",c=>{l.current.x=c.touches[0].clientX,l.current.y=c.touches[0].clientY},!0),UA(r,"touchend",c=>{let u={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(u.x-l.current.x)>=Che||Math.abs(u.y-l.current.y)>=Che))return a(c,()=>c.target instanceof HTMLElement?c.target:null)},!0),h7e(r,"blur",c=>a(c,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Ij(...t){return h.useMemo(()=>y2(...t),[...t])}function m7e(t,e,n,r){let s=S5(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 die(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 det(){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 fet(){return f7e()?{before({doc:t,d:e,meta:n}){function r(s){return n.containers.flatMap(a=>a()).some(a=>a.contains(s))}e.microTask(()=>{var s;if(window.getComputedStyle(t.documentElement).scrollBehavior!=="auto"){let l=bx();l.style(t.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>l.dispose()))}let a=(s=window.scrollY)!=null?s:window.pageYOffset,o=null;e.addEventListener(t,"click",l=>{if(l.target instanceof HTMLElement)try{let c=l.target.closest("a");if(!c)return;let{hash:u}=new URL(c.href),d=t.querySelector(u);d&&!r(d)&&(o=d)}catch{}},!0),e.addEventListener(t,"touchstart",l=>{if(l.target instanceof HTMLElement)if(r(l.target)){let c=l.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;e.style(c,"overscrollBehavior","contain")}else e.style(l.target,"touchAction","none")}),e.addEventListener(t,"touchmove",l=>{if(l.target instanceof HTMLElement){if(l.target.tagName==="INPUT")return;if(r(l.target)){let c=l.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),e.add(()=>{var l;let c=(l=window.scrollY)!=null?l:window.pageYOffset;a!==c&&window.scrollTo(0,a),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function het(){return{before({doc:t,d:e}){e.style(t.documentElement,"overflow","hidden")}}}function pet(t){let e={};for(let n of t)Object.assign(e,n(e));return e}let ow=i7e(()=>new Map,{PUSH(t,e){var n;let r=(n=this.get(t))!=null?n:{doc:t,count:0,d:bx(),meta:new Set};return r.count++,r.meta.add(e),this.set(t,r),this},POP(t,e){let n=this.get(t);return n&&(n.count--,n.meta.delete(e)),this},SCROLL_PREVENT({doc:t,d:e,meta:n}){let r={doc:t,d:e,meta:pet(n)},s=[fet(),det(),het()];s.forEach(({before:a})=>a==null?void 0:a(r)),s.forEach(({after:a})=>a==null?void 0:a(r))},SCROLL_ALLOW({d:t}){t.dispose()},TEARDOWN({doc:t}){this.delete(t)}});ow.subscribe(()=>{let t=ow.getSnapshot(),e=new Map;for(let[n]of t)e.set(n,n.documentElement.style.overflow);for(let n of t.values()){let r=e.get(n.doc)==="hidden",s=n.count!==0;(s&&!r||!s&&r)&&ow.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ow.dispatch("TEARDOWN",n)}});function met(t,e,n=()=>({containers:[]})){let r=a7e(ow),s=e?r.get(e):void 0,a=s?s.count>0:!1;return to(()=>{if(!(!e||!t))return ow.dispatch("PUSH",e,n),()=>ow.dispatch("POP",e,n)},[t,e]),a}function x7e(t,e,n=()=>[document.body]){let r=Tj(t,"scroll-lock");met(r,e,s=>{var a;return{containers:[...(a=s.containers)!=null?a:[],n]}})}function She(t){return[t.screenX,t.screenY]}function xet(){let t=h.useRef([-1,-1]);return{wasMoved(e){let n=She(e);return t.current[0]===n[0]&&t.current[1]===n[1]?!1:(t.current=n,!0)},update(e){t.current=She(e)}}}function get(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 bet={},Nhe,jhe;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Nhe=process==null?void 0:bet)==null?void 0:Nhe.NODE_ENV)==="test"&&typeof((jhe=Element==null?void 0:Element.prototype)==null?void 0:jhe.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 yet=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(yet||{});function fie(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function hie(t,e,n,r){let[s,a]=h.useState(n),{hasFlag:o,addFlag:l,removeFlag:c}=get(t&&s?3:0),u=h.useRef(!1),d=h.useRef(!1),f=v2();return to(()=>{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),vet(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 vet(t,{prepare:e,run:n,done:r,inFlight:s}){let a=bx();return Cet(t,{prepare:e,inFlight:s}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(wet(t,r))})}),a.dispose}function wet(t,e){var n,r;let s=bx();if(!t)return s.dispose;let a=!1;s.add(()=>{a=!0});let o=(r=(n=t.getAnimations)==null?void 0:n.call(t).filter(l=>l instanceof CSSTransition))!=null?r:[];return o.length===0?(e(),s.dispose):(Promise.allSettled(o.map(l=>l.finished)).then(()=>{a||e()}),s.dispose)}function Cet(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 Net(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]),to(()=>{if(!e||!t)return;let o=y2(e);if(!o)return;let l=s.current,c=a.current,u=Object.assign(f=>l(f),{acceptNode:l}),d=o.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)c(d.currentNode)},[e,t,s,a])}function pie(t,e){let n=h.useRef([]),r=Ws(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 AB(){return typeof window<"u"}function Pj(t){return g7e(t)?(t.nodeName||"").toLowerCase():"#document"}function Qf(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function yx(t){var e;return(e=(g7e(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function g7e(t){return AB()?t instanceof Node||t instanceof Qf(t).Node:!1}function ud(t){return AB()?t instanceof Element||t instanceof Qf(t).Element:!1}function nx(t){return AB()?t instanceof HTMLElement||t instanceof Qf(t).HTMLElement:!1}function Ahe(t){return!AB()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qf(t).ShadowRoot}function rT(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Nm(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function jet(t){return["table","td","th"].includes(Pj(t))}function _B(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function mie(t){const e=xie(),n=ud(t)?Nm(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Aet(t){let e=Gy(t);for(;nx(e)&&!YS(e);){if(mie(e))return e;if(_B(e))return null;e=Gy(e)}return null}function xie(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function YS(t){return["html","body","#document"].includes(Pj(t))}function Nm(t){return Qf(t).getComputedStyle(t)}function EB(t){return ud(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Gy(t){if(Pj(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ahe(t)&&t.host||yx(t);return Ahe(e)?e.host:e}function b7e(t){const e=Gy(t);return YS(e)?t.ownerDocument?t.ownerDocument.body:t.body:nx(e)&&rT(e)?e:b7e(e)}function o_(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=b7e(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Qf(s);if(a){const l=GZ(o);return e.concat(o,o.visualViewport||[],rT(s)?s:[],l&&n?o_(l):[])}return e.concat(s,o_(s,[],n))}function GZ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function _et(){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 Eet=["top","right","bottom","left"],Ky=Math.min,Tu=Math.max,l_=Math.round,hP=Math.floor,Yy=t=>({x:t,y:t}),ket={left:"right",right:"left",bottom:"top",top:"bottom"},Tet={start:"end",end:"start"};function KZ(t,e,n){return Tu(t,Ky(e,n))}function rx(t,e){return typeof t=="function"?t(e):t}function h1(t){return t.split("-")[0]}function Fj(t){return t.split("-")[1]}function gie(t){return t==="x"?"y":"x"}function bie(t){return t==="y"?"height":"width"}function Xy(t){return["top","bottom"].includes(h1(t))?"y":"x"}function yie(t){return gie(Xy(t))}function Iet(t,e,n){n===void 0&&(n=!1);const r=Fj(t),s=yie(t),a=bie(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=$M(o)),[o,$M(o)]}function Pet(t){const e=$M(t);return[YZ(t),e,YZ(e)]}function YZ(t){return t.replace(/start|end/g,e=>Tet[e])}function Fet(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 Oet(t,e,n,r){const s=Fj(t);let a=Fet(h1(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(YZ)))),a}function $M(t){return t.replace(/left|right|bottom|top/g,e=>ket[e])}function Met(t){return{top:0,right:0,bottom:0,left:0,...t}}function y7e(t){return typeof t!="number"?Met(t):{top:t,right:t,bottom:t,left:t}}function c_(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 _he(t,e,n){let{reference:r,floating:s}=t;const a=Xy(e),o=yie(e),l=bie(o),c=h1(e),u=a==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,x=r[l]/2-s[l]/2;let g;switch(c){case"top":g={x:d,y:r.y-s.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-s.width,y:f};break;default:g={x:r.x,y:r.y}}switch(Fj(e)){case"start":g[o]-=x*(n&&u?-1:1);break;case"end":g[o]+=x*(n&&u?-1:1);break}return g}const Ret=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}=_he(u,r,c),x=r,g={},y=0;for(let v=0;v<l.length;v++){const{name:C,fn:N}=l[v],{x:I,y:P,data:M,reset:F}=await N({x:d,y:f,initialPlacement:r,placement:x,strategy:s,middlewareData:g,rects:u,platform:o,elements:{reference:t,floating:e}});d=I??d,f=P??f,g={...g,[C]:{...g[C],...M}},F&&y<=50&&(y++,typeof F=="object"&&(F.placement&&(x=F.placement),F.rects&&(u=F.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):F.rects),{x:d,y:f}=_he(u,x,c)),v=-1)}return{x:d,y:f,placement:x,strategy:s,middlewareData:g}};async function XS(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:x=!1,padding:g=0}=rx(e,t),y=y7e(g),C=l[x?f==="floating"?"reference":"floating":f],N=c_(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})),I=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),M=await(a.isElement==null?void 0:a.isElement(P))?await(a.getScale==null?void 0:a.getScale(P))||{x:1,y:1}:{x:1,y:1},F=c_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:I,offsetParent:P,strategy:c}):I);return{top:(N.top-F.top+y.top)/M.y,bottom:(F.bottom-N.bottom+y.bottom)/M.y,left:(N.left-F.left+y.left)/M.x,right:(F.right-N.right+y.right)/M.x}}const Let=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=rx(t,e)||{};if(u==null)return{};const f=y7e(d),x={x:n,y:r},g=yie(s),y=bie(g),v=await o.getDimensions(u),C=g==="y",N=C?"top":"left",I=C?"bottom":"right",P=C?"clientHeight":"clientWidth",M=a.reference[y]+a.reference[g]-x[g]-a.floating[y],F=x[g]-a.reference[g],$=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let L=$?$[P]:0;(!L||!await(o.isElement==null?void 0:o.isElement($)))&&(L=l.floating[P]||a.floating[y]);const z=M/2-F/2,Q=L/2-v[y]/2-1,se=Ky(f[N],Q),ee=Ky(f[I],Q),K=se,re=L-v[y]-ee,de=L/2-v[y]/2+z,G=KZ(K,de,re),ie=!c.arrow&&Fj(s)!=null&&de!==G&&a.reference[y]/2-(de<K?se:ee)-v[y]/2<0,ae=ie?de<K?de-K:de-re:0;return{[g]:x[g]+ae,data:{[g]:G,centerOffset:de-G-ae,...ie&&{alignmentOffset:ae}},reset:ie}}}),Det=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:x,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...C}=rx(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const N=h1(s),I=Xy(l),P=h1(l)===l,M=await(c.isRTL==null?void 0:c.isRTL(u.floating)),F=x||(P||!v?[$M(l)]:Pet(l)),$=y!=="none";!x&&$&&F.push(...Oet(l,v,y,M));const L=[l,...F],z=await XS(e,C),Q=[];let se=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&Q.push(z[N]),f){const de=Iet(s,o,M);Q.push(z[de[0]],z[de[1]])}if(se=[...se,{placement:s,overflows:Q}],!Q.every(de=>de<=0)){var ee,K;const de=(((ee=a.flip)==null?void 0:ee.index)||0)+1,G=L[de];if(G)return{data:{index:de,overflows:se},reset:{placement:G}};let ie=(K=se.filter(ae=>ae.overflows[0]<=0).sort((ae,q)=>ae.overflows[1]-q.overflows[1])[0])==null?void 0:K.placement;if(!ie)switch(g){case"bestFit":{var re;const ae=(re=se.filter(q=>{if($){const W=Xy(q.placement);return W===I||W==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(W=>W>0).reduce((W,ne)=>W+ne,0)]).sort((q,W)=>q[1]-W[1])[0])==null?void 0:re[0];ae&&(ie=ae);break}case"initialPlacement":ie=l;break}if(s!==ie)return{reset:{placement:ie}}}return{}}}};function Ehe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function khe(t){return Eet.some(e=>t[e]>=0)}const Bet=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=rx(t,e);switch(r){case"referenceHidden":{const a=await XS(e,{...s,elementContext:"reference"}),o=Ehe(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:khe(o)}}}case"escaped":{const a=await XS(e,{...s,altBoundary:!0}),o=Ehe(a,n.floating);return{data:{escapedOffsets:o,escaped:khe(o)}}}default:return{}}}}};async function $et(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=h1(n),l=Fj(n),c=Xy(n)==="y",u=["left","top"].includes(o)?-1:1,d=a&&c?-1:1,f=rx(e,t);let{mainAxis:x,crossAxis:g,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(g=l==="end"?y*-1:y),c?{x:g*d,y:x*u}:{x:x*u,y:g*d}}const Uet=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 $et(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}}}}},zet=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:C=>{let{x:N,y:I}=C;return{x:N,y:I}}},...c}=rx(t,e),u={x:n,y:r},d=await XS(e,c),f=Xy(h1(s)),x=gie(f);let g=u[x],y=u[f];if(a){const C=x==="y"?"top":"left",N=x==="y"?"bottom":"right",I=g+d[C],P=g-d[N];g=KZ(I,g,P)}if(o){const C=f==="y"?"top":"left",N=f==="y"?"bottom":"right",I=y+d[C],P=y-d[N];y=KZ(I,y,P)}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}}}}}},Het=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=rx(t,e),d={x:n,y:r},f=Xy(s),x=gie(f);let g=d[x],y=d[f];const v=rx(l,e),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const P=x==="y"?"height":"width",M=a.reference[x]-a.floating[P]+C.mainAxis,F=a.reference[x]+a.reference[P]-C.mainAxis;g<M?g=M:g>F&&(g=F)}if(u){var N,I;const P=x==="y"?"width":"height",M=["top","left"].includes(h1(s)),F=a.reference[f]-a.floating[P]+(M&&((N=o.offset)==null?void 0:N[f])||0)+(M?0:C.crossAxis),$=a.reference[f]+a.reference[P]+(M?0:((I=o.offset)==null?void 0:I[f])||0)-(M?C.crossAxis:0);y<F?y=F:y>$&&(y=$)}return{[x]:g,[f]:y}}}},Vet=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:l}=e,{apply:c=()=>{},...u}=rx(t,e),d=await XS(e,u),f=h1(s),x=Fj(s),g=Xy(s)==="y",{width:y,height:v}=a.floating;let C,N;f==="top"||f==="bottom"?(C=f,N=x===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(N=f,C=x==="end"?"top":"bottom");const I=v-d.top-d.bottom,P=y-d.left-d.right,M=Ky(v-d[C],I),F=Ky(y-d[N],P),$=!e.middlewareData.shift;let L=M,z=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=P),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=I),$&&!x){const se=Tu(d.left,0),ee=Tu(d.right,0),K=Tu(d.top,0),re=Tu(d.bottom,0);g?z=y-2*(se!==0||ee!==0?se+ee:Tu(d.left,d.right)):L=v-2*(K!==0||re!==0?K+re:Tu(d.top,d.bottom))}await c({...e,availableWidth:z,availableHeight:L});const Q=await o.getDimensions(l.floating);return y!==Q.width||v!==Q.height?{reset:{rects:!0}}:{}}}};function v7e(t){const e=Nm(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=nx(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=l_(n)!==a||l_(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function vie(t){return ud(t)?t:t.contextElement}function y4(t){const e=vie(t);if(!nx(e))return Yy(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=v7e(e);let o=(a?l_(n.width):n.width)/r,l=(a?l_(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Wet=Yy(0);function w7e(t){const e=Qf(t);return!xie()||!e.visualViewport?Wet:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function qet(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Qf(t)?!1:e}function F3(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=vie(t);let o=Yy(1);e&&(r?ud(r)&&(o=y4(r)):o=y4(t));const l=qet(a,n,r)?w7e(a):Yy(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(a){const x=Qf(a),g=r&&ud(r)?Qf(r):r;let y=x,v=GZ(y);for(;v&&r&&g!==y;){const C=y4(v),N=v.getBoundingClientRect(),I=Nm(v),P=N.left+(v.clientLeft+parseFloat(I.paddingLeft))*C.x,M=N.top+(v.clientTop+parseFloat(I.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=P,u+=M,y=Qf(v),v=GZ(y)}}return c_({width:d,height:f,x:c,y:u})}function Get(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=yx(r),l=e?_B(e.floating):!1;if(r===o||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Yy(1);const d=Yy(0),f=nx(r);if((f||!f&&!a)&&((Pj(r)!=="body"||rT(o))&&(c=EB(r)),nx(r))){const x=F3(r);u=y4(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 Ket(t){return Array.from(t.getClientRects())}function XZ(t,e){const n=EB(t).scrollLeft;return e?e.left+n:F3(yx(t)).left+n}function Yet(t){const e=yx(t),n=EB(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+XZ(t);const l=-n.scrollTop;return Nm(r).direction==="rtl"&&(o+=Tu(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:l}}function Xet(t,e){const n=Qf(t),r=yx(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;const u=xie();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}function Qet(t,e){const n=F3(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=nx(t)?y4(t):Yy(1),o=t.clientWidth*a.x,l=t.clientHeight*a.y,c=s*a.x,u=r*a.y;return{width:o,height:l,x:c,y:u}}function The(t,e,n){let r;if(e==="viewport")r=Xet(t,n);else if(e==="document")r=Yet(yx(t));else if(ud(e))r=Qet(e,n);else{const s=w7e(t);r={...e,x:e.x-s.x,y:e.y-s.y}}return c_(r)}function C7e(t,e){const n=Gy(t);return n===e||!ud(n)||YS(n)?!1:Nm(n).position==="fixed"||C7e(n,e)}function Zet(t,e){const n=e.get(t);if(n)return n;let r=o_(t,[],!1).filter(l=>ud(l)&&Pj(l)!=="body"),s=null;const a=Nm(t).position==="fixed";let o=a?Gy(t):t;for(;ud(o)&&!YS(o);){const l=Nm(o),c=mie(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||rT(o)&&!c&&C7e(t,o))?r=r.filter(d=>d!==o):s=l,o=Gy(o)}return e.set(t,r),r}function Jet(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?_B(e)?[]:Zet(e,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=The(e,d,s);return u.top=Tu(f.top,u.top),u.right=Ky(f.right,u.right),u.bottom=Ky(f.bottom,u.bottom),u.left=Tu(f.left,u.left),u},The(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ett(t){const{width:e,height:n}=v7e(t);return{width:e,height:n}}function ttt(t,e,n){const r=nx(e),s=yx(e),a=n==="fixed",o=F3(t,!0,a,e);let l={scrollLeft:0,scrollTop:0};const c=Yy(0);if(r||!r&&!a)if((Pj(e)!=="body"||rT(s))&&(l=EB(e)),r){const g=F3(e,!0,a,e);c.x=g.x+e.clientLeft,c.y=g.y+e.clientTop}else s&&(c.x=XZ(s));let u=0,d=0;if(s&&!r&&!a){const g=s.getBoundingClientRect();d=g.top+l.scrollTop,u=g.left+l.scrollLeft-XZ(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 jH(t){return Nm(t).position==="static"}function Ihe(t,e){if(!nx(t)||Nm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return yx(t)===n&&(n=n.ownerDocument.body),n}function S7e(t,e){const n=Qf(t);if(_B(t))return n;if(!nx(t)){let s=Gy(t);for(;s&&!YS(s);){if(ud(s)&&!jH(s))return s;s=Gy(s)}return n}let r=Ihe(t,e);for(;r&&jet(r)&&jH(r);)r=Ihe(r,e);return r&&YS(r)&&jH(r)&&!mie(r)?n:r||Aet(t)||n}const ntt=async function(t){const e=this.getOffsetParent||S7e,n=this.getDimensions,r=await n(t.floating);return{reference:ttt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rtt(t){return Nm(t).direction==="rtl"}const stt={convertOffsetParentRelativeRectToViewportRelativeRect:Get,getDocumentElement:yx,getClippingRect:Jet,getOffsetParent:S7e,getElementRects:ntt,getClientRects:Ket,getDimensions:ett,getScale:y4,isElement:ud,isRTL:rtt};function itt(t,e){let n=null,r;const s=yx(t);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const{left:u,top:d,width:f,height:x}=t.getBoundingClientRect();if(l||e(),!f||!x)return;const g=hP(d),y=hP(s.clientWidth-(u+f)),v=hP(s.clientHeight-(d+x)),C=hP(u),I={rootMargin:-g+"px "+-y+"px "+-v+"px "+-C+"px",threshold:Tu(0,Ky(1,c))||1};let P=!0;function M(F){const $=F[0].intersectionRatio;if($!==c){if(!P)return o();$?o(!1,$):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{n=new IntersectionObserver(M,{...I,root:s.ownerDocument})}catch{n=new IntersectionObserver(M,I)}n.observe(t)}return o(!0),a}function N7e(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=vie(t),d=s||a?[...u?o_(u):[],...o_(e)]:[];d.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),a&&N.addEventListener("resize",n)});const f=u&&l?itt(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(N=>{let[I]=N;I&&I.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?F3(t):null;c&&C();function C(){const N=F3(t);v&&(N.x!==v.x||N.y!==v.y||N.width!==v.width||N.height!==v.height)&&n(),v=N,y=requestAnimationFrame(C)}return n(),()=>{var N;d.forEach(I=>{s&&I.removeEventListener("scroll",n),a&&I.removeEventListener("resize",n)}),f==null||f(),(N=g)==null||N.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const AH=XS,j7e=Uet,A7e=zet,_7e=Det,E7e=Vet,att=Bet,Phe=Let,ott=Het,k7e=(t,e,n)=>{const r=new Map,s={platform:stt,...n},a={...s.platform,_c:r};return Ret(t,e,{...s,platform:a})};var jO=typeof document<"u"?h.useLayoutEffect:h.useEffect;function UM(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(!UM(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)&&!UM(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function T7e(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Fhe(t,e){const n=T7e(t);return Math.round(e*n)/n}function _H(t){const e=h.useRef(t);return jO(()=>{e.current=t}),e}function ltt(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);UM(x,r)||g(r);const[y,v]=h.useState(null),[C,N]=h.useState(null),I=h.useCallback(q=>{q!==$.current&&($.current=q,v(q))},[]),P=h.useCallback(q=>{q!==L.current&&(L.current=q,N(q))},[]),M=a||y,F=o||C,$=h.useRef(null),L=h.useRef(null),z=h.useRef(d),Q=c!=null,se=_H(c),ee=_H(s),K=_H(u),re=h.useCallback(()=>{if(!$.current||!L.current)return;const q={placement:e,strategy:n,middleware:x};ee.current&&(q.platform=ee.current),k7e($.current,L.current,q).then(W=>{const ne={...W,isPositioned:K.current!==!1};de.current&&!UM(z.current,ne)&&(z.current=ne,_a.flushSync(()=>{f(ne)}))})},[x,e,n,ee,K]);jO(()=>{u===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[u]);const de=h.useRef(!1);jO(()=>(de.current=!0,()=>{de.current=!1}),[]),jO(()=>{if(M&&($.current=M),F&&(L.current=F),M&&F){if(se.current)return se.current(M,F,re);re()}},[M,F,re,se,Q]);const G=h.useMemo(()=>({reference:$,floating:L,setReference:I,setFloating:P}),[I,P]),ie=h.useMemo(()=>({reference:M,floating:F}),[M,F]),ae=h.useMemo(()=>{const q={position:n,left:0,top:0};if(!ie.floating)return q;const W=Fhe(ie.floating,d.x),ne=Fhe(ie.floating,d.y);return l?{...q,transform:"translate("+W+"px, "+ne+"px)",...T7e(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:ne}},[n,l,ie.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:re,refs:G,elements:ie,floatingStyles:ae}),[d,re,G,ie,ae])}const I7e=(t,e)=>({...j7e(t),options:[t,e]}),ctt=(t,e)=>({...A7e(t),options:[t,e]}),utt=(t,e)=>({..._7e(t),options:[t,e]}),dtt=(t,e)=>({...E7e(t),options:[t,e]}),P7e={...Wy},ftt=P7e.useInsertionEffect,htt=ftt||(t=>t());function F7e(t){const e=h.useRef(()=>{});return htt(()=>{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 QZ=typeof document<"u"?h.useLayoutEffect:h.useEffect;let Ohe=!1,ptt=0;const Mhe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ptt++;function mtt(){const[t,e]=h.useState(()=>Ohe?Mhe():void 0);return QZ(()=>{t==null&&e(Mhe())},[]),h.useEffect(()=>{Ohe=!0},[]),t}const xtt=P7e.useId,gtt=xtt||mtt;function btt(){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 ytt=h.createContext(null),vtt=h.createContext(null),wtt=()=>{var t;return((t=h.useContext(ytt))==null?void 0:t.id)||null},Ctt=()=>h.useContext(vtt),Stt="data-floating-ui-focusable";function Ntt(t){const{open:e=!1,onOpenChange:n,elements:r}=t,s=gtt(),a=h.useRef({}),[o]=h.useState(()=>btt()),l=wtt()!=null,[c,u]=h.useState(r.reference),d=F7e((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 jtt(t){t===void 0&&(t={});const{nodeId:e}=t,n=Ntt({...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=Ctt();QZ(()=>{d&&(f.current=d)},[d]);const g=ltt({...t,elements:{...s,...l&&{reference:l}}}),y=h.useCallback(P=>{const M=ud(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;c(M),g.refs.setReference(M)},[g.refs]),v=h.useCallback(P=>{(ud(P)||P===null)&&(f.current=P,o(P)),(ud(g.refs.reference.current)||g.refs.reference.current===null||P!==null&&!ud(P))&&g.refs.setReference(P)},[g.refs]),C=h.useMemo(()=>({...g.refs,setReference:v,setPositionReference:y,domReference:f}),[g.refs,v,y]),N=h.useMemo(()=>({...g.elements,domReference:d}),[g.elements,d]),I=h.useMemo(()=>({...g,...r,refs:C,elements:N,nodeId:e}),[g,C,N,e,r]);return QZ(()=>{r.dataRef.current.floatingContext=I;const P=x==null?void 0:x.nodesRef.current.find(M=>M.id===e);P&&(P.context=I)}),h.useMemo(()=>({...g,context:I,refs:C,elements:N}),[g,C,N,I])}const Rhe="active",Lhe="selected";function EH(t,e,n){const r=new Map,s=n==="item";let a=t;if(s&&t){const{[Rhe]:o,[Lhe]:l,...c}=t;a=c}return{...n==="floating"&&{tabIndex:-1,[Stt]:""},...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&&[Rhe,Lhe].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 Att(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=>EH(l,t,"reference"),e),a=h.useCallback(l=>EH(l,t,"floating"),n),o=h.useCallback(l=>EH(l,t,"item"),r);return h.useMemo(()=>({getReferenceProps:s,getFloatingProps:a,getItemProps:o}),[s,a,o])}function Dhe(t,e){return{...t,rects:{...t.rects,floating:{...t.rects.floating,height:e}}}}const _tt=t=>({name:"inner",options:t,async fn(e){const{listRef:n,overflowRef:r,onFallbackChange:s,offset:a=0,index:o=0,minItemsVisible:l=4,referenceOverflowThreshold:c=0,scrollRef:u,...d}=rx(t,e),{rects:f,elements:{floating:x}}=e,g=n.current[o],y=(u==null?void 0:u.current)||x,v=x.clientTop||y.clientTop,C=x.clientTop!==0,N=y.clientTop!==0,I=x===y;if(!g)return{};const P={...e,...await I7e(-g.offsetTop-x.clientTop-f.reference.height/2-g.offsetHeight/2-a).fn(e)},M=await AH(Dhe(P,y.scrollHeight+v+x.clientTop),d),F=await AH(P,{...d,elementContext:"reference"}),$=Tu(0,M.top),L=P.y+$,z=y.scrollHeight>y.clientHeight,se=(z?ee=>ee:l_)(Tu(0,y.scrollHeight+(C&&I||N?v*2:0)-$-Tu(0,M.bottom)));if(y.style.maxHeight=se+"px",y.scrollTop=$,s){const ee=z&&y.offsetHeight<g.offsetHeight*l-1||F.top>=-c||F.bottom>=-c;_a.flushSync(()=>s(ee))}return r&&(r.current=await AH(Dhe({...P,y:L},y.offsetHeight+v+x.clientTop),d)),{y:L}}});function Ett(t,e){const{open:n,elements:r}=t,{enabled:s=!0,overflowRef:a,scrollRef:o,onChange:l}=e,c=F7e(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,N=a.current.top>=-.5,I=a.current.bottom>=-.5,P=y.scrollHeight-y.clientHeight,M=C<0?-1:1,F=C<0?"max":"min";y.scrollHeight<=y.clientHeight||(!N&&C>0||!I&&C<0?(v.preventDefault(),_a.flushSync(()=>{c($=>$+Math[F](C,P*M))})):/firefox/i.test(_et())&&(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)&&_a.flushSync(()=>c(v=>v+y))}requestAnimationFrame(()=>{d.current=g.scrollTop})}}}),[r.floating,c,a,o]);return h.useMemo(()=>s?{floating:x}:{},[s,x])}let Oj=h.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Oj.displayName="FloatingContext";let wie=h.createContext(null);wie.displayName="PlacementContext";function ktt(t){return h.useMemo(()=>t?typeof t=="string"?{to:t}:t:null,[t])}function Ttt(){return h.useContext(Oj).setReference}function Itt(){return h.useContext(Oj).getReferenceProps}function Ptt(){let{getFloatingProps:t,slot:e}=h.useContext(Oj);return h.useCallback((...n)=>Object.assign({},t(...n),{"data-anchor":e.anchor}),[t,e])}function Ftt(t=null){t===!1&&(t=null),typeof t=="string"&&(t={to:t});let e=h.useContext(wie),n=h.useMemo(()=>t,[JSON.stringify(t,(s,a)=>{var o;return(o=a==null?void 0:a.outerHTML)!=null?o:a})]);to(()=>{e==null||e(n??null)},[e,n]);let r=h.useContext(Oj);return h.useMemo(()=>[r.setFloating,t?r.styles:{}],[r.setFloating,t,r.styles])}let Bhe=4;function Ott({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);Mtt(l);let u=e&&n!==null&&l!==null,{to:d="bottom",gap:f=0,offset:x=0,padding:g=0,inner:y}=Rtt(n,l),[v,C="center"]=d.split(" ");to(()=>{u&&a(0)},[u]);let{refs:N,floatingStyles:I,context:P}=jtt({open:u,placement:v==="selection"?C==="center"?"bottom":`bottom-${C}`:C==="center"?`${v}`:`${v}-${C}`,strategy:"absolute",transform:!1,middleware:[I7e({mainAxis:v==="selection"?0:f,crossAxis:x}),ctt({padding:g}),v!=="selection"&&utt({padding:g}),v==="selection"&&y?_tt({...y,padding:g,overflowRef:o,offset:s,minItemsVisible:Bhe,referenceOverflowThreshold:g,onFallbackChange(ee){var K,re;if(!ee)return;let de=P.elements.floating;if(!de)return;let G=parseFloat(getComputedStyle(de).scrollPaddingBottom)||0,ie=Math.min(Bhe,de.childElementCount),ae=0,q=0;for(let W of(re=(K=P.elements.floating)==null?void 0:K.childNodes)!=null?re:[])if(W instanceof HTMLElement){let ne=W.offsetTop,oe=ne+W.clientHeight+G,he=de.scrollTop,_e=he+de.clientHeight;if(ne>=he&&oe<=_e)ie--;else{q=Math.max(0,Math.min(oe,_e)-Math.max(ne,he)),ae=W.clientHeight;break}}ie>=1&&a(W=>{let ne=ae*ie-q+G;return W>=ne?W:ne})}}):null,dtt({padding:g,apply({availableWidth:ee,availableHeight:K,elements:re}){Object.assign(re.floating.style,{overflow:"auto",maxWidth:`${ee}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${K}px)`})}})].filter(Boolean),whileElementsMounted:N7e}),[M=v,F=C]=P.placement.split("-");v==="selection"&&(M="selection");let $=h.useMemo(()=>({anchor:[M,F].filter(Boolean).join(" ")}),[M,F]),L=Ett(P,{overflowRef:o,onChange:a}),{getReferenceProps:z,getFloatingProps:Q}=Att([L]),se=Ws(ee=>{c(ee),N.setFloating(ee)});return h.createElement(wie.Provider,{value:r},h.createElement(Oj.Provider,{value:{setFloating:se,setReference:N.setReference,styles:I,getReferenceProps:z,getFloatingProps:Q,slot:$}},t))}function Mtt(t){to(()=>{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 Rtt(t,e){var n,r,s;let a=kH((n=t==null?void 0:t.gap)!=null?n:"var(--anchor-gap, 0)",e),o=kH((r=t==null?void 0:t.offset)!=null?r:"var(--anchor-offset, 0)",e),l=kH((s=t==null?void 0:t.padding)!=null?s:"var(--anchor-padding, 0)",e);return{...t,gap:a,offset:o,padding:l}}function kH(t,e,n=void 0){let r=v2(),s=Ws((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=$he(c,u);return[d,f=>{let x=O7e(c);{let g=x.map(y=>window.getComputedStyle(u).getPropertyValue(y));r.requestAnimationFrame(function y(){r.nextFrame(y);let v=!1;for(let[N,I]of x.entries()){let P=window.getComputedStyle(u).getPropertyValue(I);if(g[N]!==P){g[N]=P,v=!0;break}}if(!v)return;let C=$he(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 to(()=>{let[c,u]=s(t,e);if(l(c),!!u)return u(l)},[t,e]),o}function O7e(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,...O7e(s)]:[r]}return[]}function $he(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 kB=h.createContext(null);kB.displayName="OpenClosedContext";var ac=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(ac||{});function Mj(){return h.useContext(kB)}function Cie({value:t,children:e}){return Ie.createElement(kB.Provider,{value:t},e)}function M7e({children:t}){return Ie.createElement(kB.Provider,{value:null},t)}function Ltt(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let qb=[];Ltt(()=>{function t(e){if(!(e.target instanceof HTMLElement)||e.target===document.body||qb[0]===e.target)return;let n=e.target;n=n.closest(BM),qb.unshift(n??e.target),qb=qb.filter(r=>r!=null&&r.isConnected),qb.splice(10)}window.addEventListener("click",t,{capture:!0}),window.addEventListener("mousedown",t,{capture:!0}),window.addEventListener("focus",t,{capture:!0}),document.body.addEventListener("click",t,{capture:!0}),document.body.addEventListener("mousedown",t,{capture:!0}),document.body.addEventListener("focus",t,{capture:!0})});function Dtt(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 TH(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:Dtt(t)}}function R7e(t){let e=Ws(t),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,SB(()=>{n.current&&e()})}),[e])}function Btt(){let t=typeof document>"u";return"useSyncExternalStore"in Wy?(e=>e.useSyncExternalStore)(Wy)(()=>()=>{},()=>!1,()=>!t):!1}function sT(){let t=Btt(),[e,n]=h.useState(o3.isHandoffComplete);return e&&o3.isHandoffComplete===!1&&n(!1),h.useEffect(()=>{e!==!0&&n(!0)},[e]),h.useEffect(()=>o3.handoff(),[]),t?!1:e}let L7e=h.createContext(!1);function $tt(){return h.useContext(L7e)}function Uhe(t){return Ie.createElement(L7e.Provider,{value:t.force},t.children)}function Utt(t){let e=$tt(),n=h.useContext(B7e),r=Ij(t),[s,a]=h.useState(()=>{var o;if(!e&&n!==null)return(o=n.current)!=null?o:null;if(o3.isServer)return null;let l=r==null?void 0:r.getElementById("headlessui-portal-root");if(l)return l;if(r===null)return null;let c=r.createElement("div");return c.setAttribute("id","headlessui-portal-root"),r.body.appendChild(c)});return 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 D7e=h.Fragment,ztt=go(function(t,e){let n=t,r=h.useRef(null),s=dc(e7e(f=>{r.current=f}),e),a=Ij(r),o=Utt(r),[l]=h.useState(()=>{var f;return o3.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),c=h.useContext(ZZ),u=sT();to(()=>{!o||!l||o.contains(l)||(l.setAttribute("data-headlessui-portal",""),o.appendChild(l))},[o,l]),to(()=>{if(l&&c)return c.register(l)},[c,l]),R7e(()=>{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=Eo();return u?!o||!l?null:_a.createPortal(d({ourProps:{ref:s},theirProps:n,slot:{},defaultTag:D7e,name:"Portal"}),l):null});function Htt(t,e){let n=dc(e),{enabled:r=!0,...s}=t,a=Eo();return r?Ie.createElement(ztt,{...s,ref:n}):a({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:D7e,name:"Portal"})}let Vtt=h.Fragment,B7e=h.createContext(null);function Wtt(t,e){let{target:n,...r}=t,s={ref:dc(e)},a=Eo();return Ie.createElement(B7e.Provider,{value:n},a({ourProps:s,theirProps:r,defaultTag:Vtt,name:"Popover.Group"}))}let ZZ=h.createContext(null);function qtt(){let t=h.useContext(ZZ),e=h.useRef([]),n=Ws(a=>(e.current.push(a),t&&t.register(a),()=>r(a))),r=Ws(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 Ie.createElement(ZZ.Provider,{value:s},a)},[s])]}let Gtt=go(Htt),$7e=go(Wtt),U7e=Object.assign(Gtt,{Group:$7e});function Ktt(t,e=typeof document<"u"?document.defaultView:null,n){let r=Tj(t,"escape");m7e(e,"keydown",s=>{r&&(s.defaultPrevented||s.key===Co.Escape&&n(s))})}function Ytt(){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 to(()=>{if(!e)return;function s(a){r(a.matches)}return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[e]),n}function Xtt({defaultContainers:t=[],portals:e,mainTreeNode:n}={}){let r=Ij(n),s=Ws(()=>{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:Ws(a=>s().some(o=>o.contains(a)))}}let z7e=h.createContext(null);function zhe({children:t,node:e}){let[n,r]=h.useState(null),s=H7e(e??n);return Ie.createElement(z7e.Provider,{value:s},t,s===null&&Ie.createElement(a_,{features:KS.Hidden,ref:a=>{var o,l;if(a){for(let c of(l=(o=y2(a))==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&c instanceof HTMLElement&&c!=null&&c.contains(a)){r(c);break}}}}))}function H7e(t=null){var e;return(e=h.useContext(z7e))!=null?e:t}function Sie(){let t=h.useRef(!1);return to(()=>(t.current=!0,()=>{t.current=!1}),[]),t}var B7=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(B7||{});function Qtt(){let t=h.useRef(0);return h7e(!0,"keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}function V7e(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 Ztt="div";var Zv=(t=>(t[t.None=0]="None",t[t.InitialFocus=1]="InitialFocus",t[t.TabLock=2]="TabLock",t[t.FocusLock=4]="FocusLock",t[t.RestoreFocus=8]="RestoreFocus",t[t.AutoFocus=16]="AutoFocus",t))(Zv||{});function Jtt(t,e){let n=h.useRef(null),r=dc(n,e),{initialFocus:s,initialFocusFallback:a,containers:o,features:l=15,...c}=t;sT()||(l=0);let u=Ij(n);rnt(l,{ownerDocument:u});let d=snt(l,{ownerDocument:u,container:n,initialFocus:s,initialFocusFallback:a});int(l,{ownerDocument:u,container:n,containers:o,previousActiveElement:d});let f=Qtt(),x=Ws(I=>{let P=n.current;P&&(M=>M())(()=>{rh(f.current,{[B7.Forwards]:()=>{b4(P,um.First,{skipElements:[I.relatedTarget,a]})},[B7.Backwards]:()=>{b4(P,um.Last,{skipElements:[I.relatedTarget,a]})}})})}),g=Tj(!!(l&2),"focus-trap#tab-lock"),y=v2(),v=h.useRef(!1),C={ref:r,onKeyDown(I){I.key=="Tab"&&(v.current=!0,y.requestAnimationFrame(()=>{v.current=!1}))},onBlur(I){if(!(l&4))return;let P=V7e(o);n.current instanceof HTMLElement&&P.add(n.current);let M=I.relatedTarget;M instanceof HTMLElement&&M.dataset.headlessuiFocusGuard!=="true"&&(W7e(P,M)||(v.current?b4(n.current,rh(f.current,{[B7.Forwards]:()=>um.Next,[B7.Backwards]:()=>um.Previous})|um.WrapAround,{relativeTo:I.target}):I.target instanceof HTMLElement&&V0(I.target)))}},N=Eo();return Ie.createElement(Ie.Fragment,null,g&&Ie.createElement(a_,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:KS.Focusable}),N({ourProps:C,theirProps:c,defaultTag:Ztt,name:"FocusTrap"}),g&&Ie.createElement(a_,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:KS.Focusable}))}let ent=go(Jtt),tnt=Object.assign(ent,{features:Zv});function nnt(t=!0){let e=h.useRef(qb.slice());return pie(([n],[r])=>{r===!0&&n===!1&&SB(()=>{e.current.splice(0)}),r===!1&&n===!0&&(e.current=qb.slice())},[t,qb,e]),Ws(()=>{var n;return(n=e.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function rnt(t,{ownerDocument:e}){let n=!!(t&8),r=nnt(n);pie(()=>{n||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&V0(r())},[n]),R7e(()=>{n&&V0(r())})}function snt(t,{ownerDocument:e,container:n,initialFocus:r,initialFocusFallback:s}){let a=h.useRef(null),o=Tj(!!(t&1),"focus-trap#initial-focus"),l=Sie();return pie(()=>{if(t===0)return;if(!o){s!=null&&s.current&&V0(s.current);return}let c=n.current;c&&SB(()=>{if(!l.current)return;let u=e==null?void 0:e.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===u){a.current=u;return}}else if(c.contains(u)){a.current=u;return}if(r!=null&&r.current)V0(r.current);else{if(t&16){if(b4(c,um.First|um.AutoFocus)!==qZ.Error)return}else if(b4(c,um.First)!==qZ.Error)return;if(s!=null&&s.current&&(V0(s.current),(e==null?void 0:e.activeElement)===s.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=e==null?void 0:e.activeElement})},[s,o,t]),a}function int(t,{ownerDocument:e,container:n,containers:r,previousActiveElement:s}){let a=Sie(),o=!!(t&4);m7e(e==null?void 0:e.defaultView,"focus",l=>{if(!o||!a.current)return;let c=V7e(r);n.current instanceof HTMLElement&&c.add(n.current);let u=s.current;if(!u)return;let d=l.target;d&&d instanceof HTMLElement?W7e(c,d)?(s.current=d,V0(d)):(l.preventDefault(),l.stopPropagation(),V0(u)):V0(s.current)},!0)}function W7e(t,e){for(let n of t)if(n.contains(e))return!0;return!1}function q7e(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:K7e)!==h.Fragment||Ie.Children.count(t.children)===1}let TB=h.createContext(null);TB.displayName="TransitionContext";var ant=(t=>(t.Visible="visible",t.Hidden="hidden",t))(ant||{});function ont(){let t=h.useContext(TB);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function lnt(){let t=h.useContext(IB);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let IB=h.createContext(null);IB.displayName="NestingContext";function PB(t){return"children"in t?PB(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function G7e(t,e){let n=S5(t),r=h.useRef([]),s=Sie(),a=v2(),o=Ws((g,y=Ny.Hidden)=>{let v=r.current.findIndex(({el:C})=>C===g);v!==-1&&(rh(y,{[Ny.Unmount](){r.current.splice(v,1)},[Ny.Hidden](){r.current[v].state="hidden"}}),a.microTask(()=>{var C;!PB(r)&&s.current&&((C=n.current)==null||C.call(n))}))}),l=Ws(g=>{let y=r.current.find(({el:v})=>v===g);return y?y.state!=="visible"&&(y.state="visible"):r.current.push({el:g,state:"visible"}),()=>o(g,Ny.Unmount)}),c=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[]}),f=Ws((g,y,v)=>{c.current.splice(0),e&&(e.chains.current[y]=e.chains.current[y].filter(([C])=>C!==g)),e==null||e.chains.current[y].push([g,new Promise(C=>{c.current.push(C)})]),e==null||e.chains.current[y].push([g,new Promise(C=>{Promise.all(d.current[y].map(([N,I])=>I)).then(()=>C())})]),y==="enter"?u.current=u.current.then(()=>e==null?void 0:e.wait.current).then(()=>v(y)):v(y)}),x=Ws((g,y,v)=>{Promise.all(d.current[y].splice(0).map(([C,N])=>N)).then(()=>{var C;(C=c.current.shift())==null||C()}).then(()=>v(y))});return h.useMemo(()=>({children:r,register:l,unregister:o,onStart:f,onStop:x,wait:u,chains:d}),[l,o,r,f,x,d,u])}let K7e=h.Fragment,Y7e=qy.RenderStrategy;function cnt(t,e){var n,r;let{transition:s=!0,beforeEnter:a,afterEnter:o,beforeLeave:l,afterLeave:c,enter:u,enterFrom:d,enterTo:f,entered:x,leave:g,leaveFrom:y,leaveTo:v,...C}=t,[N,I]=h.useState(null),P=h.useRef(null),M=q7e(t),F=dc(...M?[P,e,I]:e===null?[]:[e]),$=(n=C.unmount)==null||n?Ny.Unmount:Ny.Hidden,{show:L,appear:z,initial:Q}=ont(),[se,ee]=h.useState(L?"visible":"hidden"),K=lnt(),{register:re,unregister:de}=K;to(()=>re(P),[re,P]),to(()=>{if($===Ny.Hidden&&P.current){if(L&&se!=="visible"){ee("visible");return}return rh(se,{hidden:()=>de(P),visible:()=>re(P)})}},[se,P,re,de,L,$]);let G=sT();to(()=>{if(M&&G&&se==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,se,G,M]);let ie=Q&&!z,ae=z&&L&&Q,q=h.useRef(!1),W=G7e(()=>{q.current||(ee("hidden"),de(P))},K),ne=Ws(Ce=>{q.current=!0;let je=Ce?"enter":"leave";W.onStart(P,je,Oe=>{Oe==="enter"?a==null||a():Oe==="leave"&&(l==null||l())})}),oe=Ws(Ce=>{let je=Ce?"enter":"leave";q.current=!1,W.onStop(P,je,Oe=>{Oe==="enter"?o==null||o():Oe==="leave"&&(c==null||c())}),je==="leave"&&!PB(W)&&(ee("hidden"),de(P))});h.useEffect(()=>{M&&s||(ne(L),oe(L))},[L,M,s]);let he=!(!s||!M||!G||ie),[,_e]=hie(he,N,L,{start:ne,end:oe}),xe=Hb({ref:F,className:((r=VZ(C.className,ae&&u,ae&&d,_e.enter&&u,_e.enter&&_e.closed&&d,_e.enter&&!_e.closed&&f,_e.leave&&g,_e.leave&&!_e.closed&&y,_e.leave&&_e.closed&&v,!_e.transition&&L&&x))==null?void 0:r.trim())||void 0,...fie(_e)}),Se=0;se==="visible"&&(Se|=ac.Open),se==="hidden"&&(Se|=ac.Closed),_e.enter&&(Se|=ac.Opening),_e.leave&&(Se|=ac.Closing);let ge=Eo();return Ie.createElement(IB.Provider,{value:W},Ie.createElement(Cie,{value:Se},ge({ourProps:xe,theirProps:C,defaultTag:K7e,features:Y7e,visible:se==="visible",name:"Transition.Child"})))}function unt(t,e){let{show:n,appear:r=!1,unmount:s=!0,...a}=t,o=h.useRef(null),l=q7e(t),c=dc(...l?[o,e]:e===null?[]:[e]);sT();let u=Mj();if(n===void 0&&u!==null&&(n=(u&ac.Open)===ac.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=G7e(()=>{n||f("hidden")}),[g,y]=h.useState(!0),v=h.useRef([n]);to(()=>{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]);to(()=>{n?f("visible"):!PB(x)&&o.current!==null&&f("hidden")},[n,x]);let N={unmount:s},I=Ws(()=>{var F;g&&y(!1),(F=t.beforeEnter)==null||F.call(t)}),P=Ws(()=>{var F;g&&y(!1),(F=t.beforeLeave)==null||F.call(t)}),M=Eo();return Ie.createElement(IB.Provider,{value:x},Ie.createElement(TB.Provider,{value:C},M({ourProps:{...N,as:h.Fragment,children:Ie.createElement(X7e,{ref:c,...N,...a,beforeEnter:I,beforeLeave:P})},theirProps:{},defaultTag:h.Fragment,features:Y7e,visible:d==="visible",name:"Transition"})))}function dnt(t,e){let n=h.useContext(TB)!==null,r=Mj()!==null;return Ie.createElement(Ie.Fragment,null,!n&&r?Ie.createElement(JZ,{ref:e,...t}):Ie.createElement(X7e,{ref:e,...t}))}let JZ=go(unt),X7e=go(cnt),Nie=go(dnt),Q7e=Object.assign(JZ,{Child:Nie,Root:JZ});var fnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(fnt||{}),hnt=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(hnt||{});let pnt={0(t,e){return t.titleId===e.id?t:{...t,titleId:e.id}}},jie=h.createContext(null);jie.displayName="DialogContext";function FB(t){let e=h.useContext(jie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,FB),n}return e}function mnt(t,e){return rh(e.type,pnt,t,e)}let Hhe=go(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=Mj();s===void 0&&g!==null&&(s=(g&ac.Open)===ac.Open);let y=h.useRef(null),v=dc(y,e),C=Ij(y),N=s?0:1,[I,P]=h.useReducer(mnt,{titleId:null,descriptionId:null,panelRef:h.createRef()}),M=Ws(()=>a(!1)),F=Ws(oe=>P({type:0,id:oe})),$=sT()?N===0:!1,[L,z]=qtt(),Q={get current(){var oe;return(oe=I.panelRef.current)!=null?oe:y.current}},se=H7e(),{resolveContainers:ee}=Xtt({mainTreeNode:se,portals:L,defaultContainers:[Q]}),K=g!==null?(g&ac.Closing)===ac.Closing:!1;o7e(u||K?!1:$,{allowed:Ws(()=>{var oe,he;return[(he=(oe=y.current)==null?void 0:oe.closest("[data-headlessui-portal]"))!=null?he:null]}),disallowed:Ws(()=>{var oe;return[(oe=se==null?void 0:se.closest("body > *:not(#headlessui-portal-root)"))!=null?oe:null]})}),p7e($,ee,oe=>{oe.preventDefault(),M()}),Ktt($,C==null?void 0:C.defaultView,oe=>{oe.preventDefault(),oe.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),M()}),x7e(u||K?!1:$,C,ee),l7e($,y,M);let[re,de]=aie(),G=h.useMemo(()=>[{dialogState:N,close:M,setTitleId:F,unmount:d},I],[N,I,M,F,d]),ie=h.useMemo(()=>({open:N===0}),[N]),ae={ref:v,id:r,role:l,tabIndex:-1,"aria-modal":u?void 0:N===0?!0:void 0,"aria-labelledby":I.titleId,"aria-describedby":re,unmount:d},q=!Ytt(),W=Zv.None;$&&!u&&(W|=Zv.RestoreFocus,W|=Zv.TabLock,c&&(W|=Zv.AutoFocus),q&&(W|=Zv.InitialFocus));let ne=Eo();return Ie.createElement(M7e,null,Ie.createElement(Uhe,{force:!0},Ie.createElement(U7e,null,Ie.createElement(jie.Provider,{value:G},Ie.createElement($7e,{target:y},Ie.createElement(Uhe,{force:!1},Ie.createElement(de,{slot:ie},Ie.createElement(z,null,Ie.createElement(tnt,{initialFocus:o,initialFocusFallback:y,containers:ee,features:W},Ie.createElement(s7e,{value:M},ne({ourProps:ae,theirProps:f,slot:ie,defaultTag:xnt,features:gnt,visible:N===0,name:"Dialog"})))))))))))}),xnt="div",gnt=qy.RenderStrategy|qy.Static;function bnt(t,e){let{transition:n=!1,open:r,...s}=t,a=Mj(),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?Ie.createElement(zhe,null,Ie.createElement(Q7e,{show:r,transition:n,unmount:s.unmount},Ie.createElement(Hhe,{ref:e,...s}))):Ie.createElement(zhe,null,Ie.createElement(Hhe,{ref:e,open:r,...s}))}let ynt="div";function vnt(t,e){let n=h.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:s=!1,...a}=t,[{dialogState:o,unmount:l},c]=FB("Dialog.Panel"),u=dc(e,c.panelRef),d=h.useMemo(()=>({open:o===0}),[o]),f=Ws(C=>{C.stopPropagation()}),x={ref:u,id:r,onClick:f},g=s?Nie:h.Fragment,y=s?{unmount:l}:{},v=Eo();return Ie.createElement(g,{...y},v({ourProps:x,theirProps:a,slot:d,defaultTag:ynt,name:"Dialog.Panel"}))}let wnt="div";function Cnt(t,e){let{transition:n=!1,...r}=t,[{dialogState:s,unmount:a}]=FB("Dialog.Backdrop"),o=h.useMemo(()=>({open:s===0}),[s]),l={ref:e,"aria-hidden":!0},c=n?Nie:h.Fragment,u=n?{unmount:a}:{},d=Eo();return Ie.createElement(c,{...u},d({ourProps:l,theirProps:r,slot:o,defaultTag:wnt,name:"Dialog.Backdrop"}))}let Snt="h2";function Nnt(t,e){let n=h.useId(),{id:r=`headlessui-dialog-title-${n}`,...s}=t,[{dialogState:a,setTitleId:o}]=FB("Dialog.Title"),l=dc(e);h.useEffect(()=>(o(r),()=>o(null)),[r,o]);let c=h.useMemo(()=>({open:a===0}),[a]),u={ref:l,id:r};return Eo()({ourProps:u,theirProps:s,slot:c,defaultTag:Snt,name:"Dialog.Title"})}let jnt=go(bnt),xa=go(vnt),wa=go(Cnt),Ant=go(Nnt),Ca=Object.assign(jnt,{Panel:xa,Title:Ant,Description:n7e});var Vhe;let _nt=(Vhe=Ie.startTransition)!=null?Vhe:function(t){t()};var Ent=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Ent||{}),knt=(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))(knt||{});let Tnt={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}}},Aie=h.createContext(null);Aie.displayName="DisclosureContext";function _ie(t){let e=h.useContext(Aie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_ie),n}return e}let Eie=h.createContext(null);Eie.displayName="DisclosureAPIContext";function Z7e(t){let e=h.useContext(Eie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Z7e),n}return e}let kie=h.createContext(null);kie.displayName="DisclosurePanelContext";function Int(){return h.useContext(kie)}function Pnt(t,e){return rh(e.type,Tnt,t,e)}let Fnt=h.Fragment;function Ont(t,e){let{defaultOpen:n=!1,...r}=t,s=h.useRef(null),a=dc(e,e7e(v=>{s.current=v},t.as===void 0||t.as===h.Fragment)),o=h.useReducer(Pnt,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=o,d=Ws(v=>{u({type:1});let C=y2(s);if(!C||!c)return;let N=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:C.getElementById(c):C.getElementById(c);N==null||N.focus()}),f=h.useMemo(()=>({close:d}),[d]),x=h.useMemo(()=>({open:l===0,close:d}),[l,d]),g={ref:a},y=Eo();return Ie.createElement(Aie.Provider,{value:o},Ie.createElement(Eie.Provider,{value:f},Ie.createElement(s7e,{value:d},Ie.createElement(Cie,{value:rh(l,{0:ac.Open,1:ac.Closed})},y({ourProps:g,theirProps:r,slot:x,defaultTag:Fnt,name:"Disclosure"})))))}let Mnt="button";function Rnt(t,e){let n=h.useId(),{id:r=`headlessui-disclosure-button-${n}`,disabled:s=!1,autoFocus:a=!1,...o}=t,[l,c]=_ie("Disclosure.Button"),u=Int(),d=u===null?!1:u===l.panelId,f=h.useRef(null),x=dc(f,e,Ws(Q=>{if(!d)return c({type:4,element:Q})}));h.useEffect(()=>{if(!d)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,d]);let g=Ws(Q=>{var se;if(d){if(l.disclosureState===1)return;switch(Q.key){case Co.Space:case Co.Enter:Q.preventDefault(),Q.stopPropagation(),c({type:0}),(se=l.buttonElement)==null||se.focus();break}}else switch(Q.key){case Co.Space:case Co.Enter:Q.preventDefault(),Q.stopPropagation(),c({type:0});break}}),y=Ws(Q=>{switch(Q.key){case Co.Space:Q.preventDefault();break}}),v=Ws(Q=>{var se;iie(Q.currentTarget)||s||(d?(c({type:0}),(se=l.buttonElement)==null||se.focus()):c({type:0}))}),{isFocusVisible:C,focusProps:N}=nie({autoFocus:a}),{isHovered:I,hoverProps:P}=tie({isDisabled:s}),{pressed:M,pressProps:F}=rie({disabled:s}),$=h.useMemo(()=>({open:l.disclosureState===0,hover:I,active:M,disabled:s,focus:C,autofocus:a}),[l,I,M,C,s,a]),L=die(t,l.buttonElement),z=i_(d?{ref:x,type:L,disabled:s||void 0,autoFocus:a,onKeyDown:g,onClick:v}:{ref:x,id:r,type:L,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:s||void 0,autoFocus:a,onKeyDown:g,onKeyUp:y,onClick:v},N,P,F);return Eo()({ourProps:z,theirProps:o,slot:$,defaultTag:Mnt,name:"Disclosure.Button"})}let Lnt="div",Dnt=qy.RenderStrategy|qy.Static;function Bnt(t,e){let n=h.useId(),{id:r=`headlessui-disclosure-panel-${n}`,transition:s=!1,...a}=t,[o,l]=_ie("Disclosure.Panel"),{close:c}=Z7e("Disclosure.Panel"),[u,d]=h.useState(null),f=dc(e,Ws(I=>{_nt(()=>l({type:5,element:I}))}),d);h.useEffect(()=>(l({type:3,panelId:r}),()=>{l({type:3,panelId:null})}),[r,l]);let x=Mj(),[g,y]=hie(s,u,x!==null?(x&ac.Open)===ac.Open:o.disclosureState===0),v=h.useMemo(()=>({open:o.disclosureState===0,close:c}),[o.disclosureState,c]),C={ref:f,id:r,...fie(y)},N=Eo();return Ie.createElement(M7e,null,Ie.createElement(kie.Provider,{value:o.panelId},N({ourProps:C,theirProps:a,slot:v,defaultTag:Lnt,features:Dnt,visible:g,name:"Disclosure.Panel"})))}let $nt=go(Ont),Tie=go(Rnt),Iie=go(Bnt),J7e=Object.assign($nt,{Button:Tie,Panel:Iie});function Unt(t,e){let n=h.useRef({left:0,top:0});if(to(()=>{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 Whe=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function qhe(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 Whe.test(o)&&(o=o.replace(Whe,"")),o}function znt(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():qhe(a).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return qhe(t).trim()}function Hnt(t){let e=h.useRef(""),n=h.useRef("");return Ws(()=>{let r=t.current;if(!r)return"";let s=r.innerText;if(e.current===s)return n.current;let a=znt(r).trim().toLowerCase();return e.current=s,n.current=a,a})}var Vnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Vnt||{}),Wnt=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(Wnt||{}),qnt=(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))(qnt||{});function IH(t,e=n=>n){let n=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=d7e(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 Gnt={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=TH(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=TH(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=IH(t),u=TH(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=IH(t,r=>[...r,{id:e.id,dataRef:e.dataRef}]);return{...t,...n}},6:(t,e)=>{let n=IH(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}},Pie=h.createContext(null);Pie.displayName="MenuContext";function OB(t){let e=h.useContext(Pie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,OB),n}return e}function Knt(t,e){return rh(e.type,Gnt,t,e)}let Ynt=h.Fragment;function Xnt(t,e){let{__demoMode:n=!1,...r}=t,s=h.useReducer(Knt,{__demoMode:n,menuState:n?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:a,itemsElement:o,buttonElement:l},c]=s,u=dc(e);p7e(a===0,[l,o],(y,v)=>{c({type:1}),uie(v,cie.Loose)||(y.preventDefault(),l==null||l.focus())});let d=Ws(()=>{c({type:1})}),f=h.useMemo(()=>({open:a===0,close:d}),[a,d]),x={ref:u},g=Eo();return Ie.createElement(Ott,null,Ie.createElement(Pie.Provider,{value:s},Ie.createElement(Cie,{value:rh(a,{0:ac.Open,1:ac.Closed})},g({ourProps:x,theirProps:r,slot:f,defaultTag:Ynt,name:"Menu"}))))}let Qnt="button";function Znt(t,e){var n;let r=h.useId(),{id:s=`headlessui-menu-button-${r}`,disabled:a=!1,autoFocus:o=!1,...l}=t,[c,u]=OB("Menu.Button"),d=Itt(),f=dc(e,Ttt(),Ws(L=>u({type:7,element:L}))),x=Ws(L=>{switch(L.key){case Co.Space:case Co.Enter:case Co.ArrowDown:L.preventDefault(),L.stopPropagation(),_a.flushSync(()=>u({type:0})),u({type:2,focus:Ou.First});break;case Co.ArrowUp:L.preventDefault(),L.stopPropagation(),_a.flushSync(()=>u({type:0})),u({type:2,focus:Ou.Last});break}}),g=Ws(L=>{switch(L.key){case Co.Space:L.preventDefault();break}}),y=Ws(L=>{var z;if(iie(L.currentTarget))return L.preventDefault();a||(c.menuState===0?(_a.flushSync(()=>u({type:1})),(z=c.buttonElement)==null||z.focus({preventScroll:!0})):(L.preventDefault(),u({type:0})))}),{isFocusVisible:v,focusProps:C}=nie({autoFocus:o}),{isHovered:N,hoverProps:I}=tie({isDisabled:a}),{pressed:P,pressProps:M}=rie({disabled:a}),F=h.useMemo(()=>({open:c.menuState===0,active:P||c.menuState===0,disabled:a,hover:N,focus:v,autofocus:o}),[c,N,v,P,a,o]),$=i_(d(),{ref:f,id:s,type:die(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,I,M);return Eo()({ourProps:$,theirProps:l,slot:F,defaultTag:Qnt,name:"Menu.Button"})}let Jnt="div",ert=qy.RenderStrategy|qy.Static;function trt(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=ktt(o),[x,g]=OB("Menu.Items"),[y,v]=Ftt(f),C=Ptt(),[N,I]=h.useState(null),P=dc(e,f?y:null,Ws(q=>g({type:8,element:q})),I),M=Ij(x.itemsElement);f&&(l=!0);let F=Mj(),[$,L]=hie(u,N,F!==null?(F&ac.Open)===ac.Open:x.menuState===0);l7e($,x.buttonElement,()=>{g({type:1})});let z=x.__demoMode?!1:c&&x.menuState===0;x7e(z,M);let Q=x.__demoMode?!1:c&&x.menuState===0;o7e(Q,{allowed:h.useCallback(()=>[x.buttonElement,x.itemsElement],[x.buttonElement,x.itemsElement])});let se=x.menuState!==0,ee=Unt(se,x.buttonElement)?!1:$;h.useEffect(()=>{let q=x.itemsElement;q&&x.menuState===0&&q!==(M==null?void 0:M.activeElement)&&q.focus({preventScroll:!0})},[x.menuState,x.itemsElement,M]),Net(x.menuState===0,{container:x.itemsElement,accept(q){return q.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:q.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(q){q.setAttribute("role","none")}});let K=v2(),re=Ws(q=>{var W,ne,oe;switch(K.dispose(),q.key){case Co.Space:if(x.searchQuery!=="")return q.preventDefault(),q.stopPropagation(),g({type:3,value:q.key});case Co.Enter:if(q.preventDefault(),q.stopPropagation(),g({type:1}),x.activeItemIndex!==null){let{dataRef:he}=x.items[x.activeItemIndex];(ne=(W=he.current)==null?void 0:W.domRef.current)==null||ne.click()}u7e(x.buttonElement);break;case Co.ArrowDown:return q.preventDefault(),q.stopPropagation(),g({type:2,focus:Ou.Next});case Co.ArrowUp:return q.preventDefault(),q.stopPropagation(),g({type:2,focus:Ou.Previous});case Co.Home:case Co.PageUp:return q.preventDefault(),q.stopPropagation(),g({type:2,focus:Ou.First});case Co.End:case Co.PageDown:return q.preventDefault(),q.stopPropagation(),g({type:2,focus:Ou.Last});case Co.Escape:q.preventDefault(),q.stopPropagation(),_a.flushSync(()=>g({type:1})),(oe=x.buttonElement)==null||oe.focus({preventScroll:!0});break;case Co.Tab:q.preventDefault(),q.stopPropagation(),_a.flushSync(()=>g({type:1})),oet(x.buttonElement,q.shiftKey?um.Previous:um.Next);break;default:q.key.length===1&&(g({type:3,value:q.key}),K.setTimeout(()=>g({type:4}),350));break}}),de=Ws(q=>{switch(q.key){case Co.Space:q.preventDefault();break}}),G=h.useMemo(()=>({open:x.menuState===0}),[x.menuState]),ie=i_(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:re,onKeyUp:de,role:"menu",tabIndex:x.menuState===0?0:void 0,ref:P,style:{...d.style,...v,"--button-width":ZJe(x.buttonElement,!0).width},...fie(L)}),ae=Eo();return Ie.createElement(U7e,{enabled:l?t.static||$:!1},ae({ourProps:ie,theirProps:d,slot:G,defaultTag:Jnt,features:ert,visible:ee,name:"Menu.Items"}))}let nrt=h.Fragment;function rrt(t,e){let n=h.useId(),{id:r=`headlessui-menu-item-${n}`,disabled:s=!1,...a}=t,[o,l]=OB("Menu.Item"),c=o.activeItemIndex!==null?o.items[o.activeItemIndex].id===r:!1,u=h.useRef(null),d=dc(e,u);to(()=>{if(!o.__demoMode&&o.menuState===0&&c&&o.activationTrigger!==0)return bx().requestAnimationFrame(()=>{var ee,K;(K=(ee=u.current)==null?void 0:ee.scrollIntoView)==null||K.call(ee,{block:"nearest"})})},[o.__demoMode,u,c,o.menuState,o.activationTrigger,o.activeItemIndex]);let f=Hnt(u),x=h.useRef({disabled:s,domRef:u,get textValue(){return f()}});to(()=>{x.current.disabled=s},[x,s]),to(()=>(l({type:5,id:r,dataRef:x}),()=>l({type:6,id:r})),[x,r]);let g=Ws(()=>{l({type:1})}),y=Ws(ee=>{if(s)return ee.preventDefault();l({type:1}),u7e(o.buttonElement)}),v=Ws(()=>{if(s)return l({type:2,focus:Ou.Nothing});l({type:2,focus:Ou.Specific,id:r})}),C=xet(),N=Ws(ee=>{C.update(ee),!s&&(c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),I=Ws(ee=>{C.wasMoved(ee)&&(s||c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),P=Ws(ee=>{C.wasMoved(ee)&&(s||c&&l({type:2,focus:Ou.Nothing}))}),[M,F]=lie(),[$,L]=aie(),z=h.useMemo(()=>({active:c,focus:c,disabled:s,close:g}),[c,s,g]),Q={id:r,ref:d,role:"menuitem",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-labelledby":M,"aria-describedby":$,disabled:void 0,onClick:y,onFocus:v,onPointerEnter:N,onMouseEnter:N,onPointerMove:I,onMouseMove:I,onPointerLeave:P,onMouseLeave:P},se=Eo();return Ie.createElement(F,null,Ie.createElement(L,null,se({ourProps:Q,theirProps:a,slot:z,defaultTag:nrt,name:"Menu.Item"})))}let srt="div";function irt(t,e){let[n,r]=lie(),s=t,a={ref:e,"aria-labelledby":n,role:"group"},o=Eo();return Ie.createElement(r,null,o({ourProps:a,theirProps:s,slot:{},defaultTag:srt,name:"Menu.Section"}))}let art="header";function ort(t,e){let n=h.useId(),{id:r=`headlessui-menu-heading-${n}`,...s}=t,a=oie();to(()=>a.register(r),[r,a.register]);let o={id:r,ref:e,role:"presentation",...a.props};return Eo()({ourProps:o,theirProps:s,slot:{},defaultTag:art,name:"Menu.Heading"})}let lrt="div";function crt(t,e){let n=t,r={ref:e,role:"separator"};return Eo()({ourProps:r,theirProps:n,slot:{},defaultTag:lrt,name:"Menu.Separator"})}let urt=go(Xnt),MB=go(Znt),RB=go(trt),XC=go(rrt),drt=go(irt),frt=go(ort),hrt=go(crt),LB=Object.assign(urt,{Button:MB,Items:RB,Item:XC,Section:drt,Heading:frt,Separator:hrt}),Fie=h.createContext(null);Fie.displayName="GroupContext";let prt=h.Fragment;function mrt(t){var e;let[n,r]=h.useState(null),[s,a]=lie(),[o,l]=aie(),c=h.useMemo(()=>({switch:n,setSwitch:r}),[n,r]),u={},d=t,f=Eo();return Ie.createElement(l,{name:"Switch.Description",value:o},Ie.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}))}}},Ie.createElement(Fie.Provider,{value:c},f({ourProps:u,theirProps:d,slot:{},defaultTag:prt,name:"Switch.Group"}))))}let xrt="button";function grt(t,e){var n;let r=h.useId(),s=ZAe(),a=sie(),{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(Fie),[N,I]=h.useState(null),P=h.useRef(null),M=dc(P,e,C===null?null:C.setSwitch,I),F=PJe(u),[$,L]=IJe(c,d,F??!1),z=v2(),[Q,se]=h.useState(!1),ee=Ws(()=>{se(!0),L==null||L(!$),z.nextFrame(()=>{se(!1)})}),K=Ws(Ce=>{if(iie(Ce.currentTarget))return Ce.preventDefault();Ce.preventDefault(),ee()}),re=Ws(Ce=>{Ce.key===Co.Space?(Ce.preventDefault(),ee()):Ce.key===Co.Enter&&FJe(Ce.currentTarget)}),de=Ws(Ce=>Ce.preventDefault()),G=r7e(),ie=zJe(),{isFocusVisible:ae,focusProps:q}=nie({autoFocus:y}),{isHovered:W,hoverProps:ne}=tie({isDisabled:l}),{pressed:oe,pressProps:he}=rie({disabled:l}),_e=h.useMemo(()=>({checked:$,disabled:l,hover:W,focus:ae,active:oe,autofocus:y,changing:Q}),[$,W,ae,oe,l,Q,y]),xe=i_({id:o,ref:M,role:"switch",type:die(t,N),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:K,onKeyUp:re,onKeyPress:de},q,ne,he),Se=h.useCallback(()=>{if(F!==void 0)return L==null?void 0:L(F)},[L,F]),ge=Eo();return Ie.createElement(Ie.Fragment,null,f!=null&&Ie.createElement(DJe,{disabled:l,data:{[f]:x||"on"},overrides:{type:"checkbox",checked:$},form:g,onReset:Se}),ge({ourProps:xe,theirProps:v,slot:_e,defaultTag:xrt,name:"Switch"}))}let brt=go(grt),yrt=mrt,vrt=YJe,wrt=n7e,Fo=Object.assign(brt,{Group:yrt,Label:vrt,Description:wrt});function Crt({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 zl=h.forwardRef(Crt);function Srt({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 Jg=h.forwardRef(Srt);function Nrt({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 jrt=h.forwardRef(Nrt);function Art({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 Oie=h.forwardRef(Art);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 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 Ert=h.forwardRef(_rt);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:"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 e9e=h.forwardRef(krt);function Trt({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 u_=h.forwardRef(Trt);function Irt({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 Mie=h.forwardRef(Irt);function Prt({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 N5=h.forwardRef(Prt);function Frt({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 Ort=h.forwardRef(Frt);function Mrt({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 Rrt=h.forwardRef(Mrt);function Lrt({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 t9e=h.forwardRef(Lrt);function Drt({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 Brt=h.forwardRef(Drt);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",{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 n9e=h.forwardRef($rt),r9e=h.createContext({});function Urt(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const Rie=typeof window<"u",zrt=Rie?h.useLayoutEffect:h.useEffect,Lie=h.createContext(null);function iT(t,e){t.indexOf(e)===-1&&t.push(e)}function aT(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 QS=()=>{};const Bc={},DB=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function BB(t){return typeof t=="object"&&t!==null}const $B=t=>/^0[^.\s]+$/u.test(t);function Rj(t){let e;return()=>(e===void 0&&(e=t()),e)}const dl=t=>t,Hrt=(t,e)=>n=>e(t(n)),vx=(...t)=>t.reduce(Hrt),sx=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Lj{constructor(){this.subscriptions=[]}add(e){return iT(this.subscriptions,e),()=>aT(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 ql=t=>t*1e3,ll=t=>t/1e3;function UB(t,e){return e?t*(1e3/e):0}const s9e=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Vrt=1e-7,Wrt=12;function qrt(t,e,n,r,s){let a,o,l=0;do o=e+(n-e)/2,a=s9e(o,r,s)-t,a>0?n=o:e=o;while(Math.abs(a)>Vrt&&++l<Wrt);return o}function oT(t,e,n,r){if(t===e&&n===r)return dl;const s=a=>qrt(a,0,1,t,n);return a=>a===0||a===1?a:s9e(s(a),e,r)}const i9e=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,a9e=t=>e=>1-t(1-e),o9e=oT(.33,1.53,.69,.99),Die=a9e(o9e),Bie=i9e(Die),$ie=t=>(t*=2)<1?.5*Die(t):.5*(2-Math.pow(2,-10*(t-1))),Uie=t=>1-Math.sin(Math.acos(t)),zie=a9e(Uie),Hie=i9e(Uie),Grt=oT(.42,0,1,1),Krt=oT(0,0,.58,1),Vie=oT(.42,0,.58,1),l9e=t=>Array.isArray(t)&&typeof t[0]!="number",Wie=t=>Array.isArray(t)&&typeof t[0]=="number",Ghe={linear:dl,easeIn:Grt,easeInOut:Vie,easeOut:Krt,circIn:Uie,circInOut:Hie,circOut:zie,backIn:Die,backInOut:Bie,backOut:o9e,anticipate:$ie},Yrt=t=>typeof t=="string",zM=t=>{if(Wie(t)){QS(t.length===4);const[e,n,r,s]=t;return oT(e,n,r,s)}else if(Yrt(t))return QS(Ghe[t]!==void 0),Ghe[t];return t},pP=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Xrt(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 Qrt=40;function c9e(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=pP.reduce((P,M)=>(P[M]=Xrt(a),P),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const P=Bc.useManualTiming?s.timestamp:performance.now();n=!1,Bc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(P-s.timestamp,Qrt),1)),s.timestamp=P,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:pP.reduce((P,M)=>{const F=o[M];return P[M]=($,L=!1,z=!1)=>(n||C(),F.schedule($,L,z)),P},{}),cancel:P=>{for(let M=0;M<pP.length;M++)o[pP[M]].cancel(P)},state:s,steps:o}}const{schedule:Do,cancel:Qy,state:eu,steps:PH}=c9e(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0);let AO;function Zrt(){AO=void 0}const sf={now:()=>(AO===void 0&&sf.set(eu.isProcessing||Bc.useManualTiming?eu.timestamp:performance.now()),AO),set:t=>{AO=t,queueMicrotask(Zrt)}},u9e=t=>e=>typeof e=="string"&&e.startsWith(t),qie=u9e("--"),Jrt=u9e("var(--"),Gie=t=>Jrt(t)?est.test(t.split("/*")[0].trim()):!1,est=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Dj={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},d_={...Dj,transform:t=>Dc(0,1,t)},mP={...Dj,default:1},b9=t=>Math.round(t*1e5)/1e5,Kie=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tst(t){return t==null}const nst=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Yie=(t,e)=>n=>!!(typeof n=="string"&&nst.test(n)&&n.startsWith(t)||e&&!tst(n)&&Object.prototype.hasOwnProperty.call(n,e)),d9e=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(Kie);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},rst=t=>Dc(0,255,t),FH={...Dj,transform:t=>Math.round(rst(t))},lw={test:Yie("rgb","red"),parse:d9e("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+FH.transform(t)+", "+FH.transform(e)+", "+FH.transform(n)+", "+b9(d_.transform(r))+")"};function sst(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 eJ={test:Yie("#"),parse:sst,transform:lw.transform},lT=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Rb=lT("deg"),W0=lT("%"),di=lT("px"),ist=lT("vh"),ast=lT("vw"),Khe={...W0,parse:t=>W0.parse(t)/100,transform:t=>W0.transform(t*100)},QC={test:Yie("hsl","hue"),parse:d9e("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+W0.transform(b9(e))+", "+W0.transform(b9(n))+", "+b9(d_.transform(r))+")"},$l={test:t=>lw.test(t)||eJ.test(t)||QC.test(t),parse:t=>lw.test(t)?lw.parse(t):QC.test(t)?QC.parse(t):eJ.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?lw.transform(t):QC.transform(t),getAnimatableNone:t=>{const e=$l.parse(t);return e.alpha=0,$l.transform(e)}},ost=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function lst(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Kie))==null?void 0:e.length)||0)+(((n=t.match(ost))==null?void 0:n.length)||0)>0}const f9e="number",h9e="color",cst="var",ust="var(",Yhe="${}",dst=/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 f_(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(dst,c=>($l.test(c)?(r.color.push(a),s.push(h9e),n.push($l.parse(c))):c.startsWith(ust)?(r.var.push(a),s.push(cst),n.push(c)):(r.number.push(a),s.push(f9e),n.push(parseFloat(c))),++a,Yhe)).split(Yhe);return{values:n,split:l,indexes:r,types:s}}function p9e(t){return f_(t).values}function m9e(t){const{split:e,types:n}=f_(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===f9e?a+=b9(s[o]):l===h9e?a+=$l.transform(s[o]):a+=s[o]}return a}}const fst=t=>typeof t=="number"?0:$l.test(t)?$l.getAnimatableNone(t):t;function hst(t){const e=p9e(t);return m9e(t)(e.map(fst))}const Zy={test:lst,parse:p9e,createTransformer:m9e,getAnimatableNone:hst};function OH(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 pst({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=OH(c,l,t+1/3),a=OH(c,l,t),o=OH(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function HM(t,e){return n=>n>0?e:t}const qo=(t,e,n)=>t+(e-t)*n,MH=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},mst=[eJ,lw,QC],xst=t=>mst.find(e=>e.test(t));function Xhe(t){const e=xst(t);if(!e)return!1;let n=e.parse(t);return e===QC&&(n=pst(n)),n}const Qhe=(t,e)=>{const n=Xhe(t),r=Xhe(e);if(!n||!r)return HM(t,e);const s={...n};return a=>(s.red=MH(n.red,r.red,a),s.green=MH(n.green,r.green,a),s.blue=MH(n.blue,r.blue,a),s.alpha=qo(n.alpha,r.alpha,a),lw.transform(s))},tJ=new Set(["none","hidden"]);function gst(t,e){return tJ.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function bst(t,e){return n=>qo(t,e,n)}function Xie(t){return typeof t=="number"?bst:typeof t=="string"?Gie(t)?HM:$l.test(t)?Qhe:wst:Array.isArray(t)?x9e:typeof t=="object"?$l.test(t)?Qhe:yst:HM}function x9e(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>Xie(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function yst(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=Xie(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function vst(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 wst=(t,e)=>{const n=Zy.createTransformer(e),r=f_(t),s=f_(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?tJ.has(t)&&!s.values.length||tJ.has(e)&&!r.values.length?gst(t,e):vx(x9e(vst(r,s),s.values),n):HM(t,e)};function g9e(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?qo(t,e,n):Xie(t)(t,e)}const Cst=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Do.update(e,n),stop:()=>Qy(e),now:()=>eu.isProcessing?eu.timestamp:sf.now()}},b9e=(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)})`},VM=2e4;function Qie(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<VM;)e+=n,r=t.next(e);return e>=VM?1/0:e}function Sst(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Qie(r),VM);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:ll(s)}}const Nst=5;function y9e(t,e,n){const r=Math.max(e-Nst,0);return UB(n-t(r),e-r)}const sl={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Zhe=.001;function jst({duration:t=sl.duration,bounce:e=sl.bounce,velocity:n=sl.velocity,mass:r=sl.mass}){let s,a,o=1-e;o=Dc(sl.minDamping,sl.maxDamping,o),t=Dc(sl.minDuration,sl.maxDuration,ll(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=nJ(u,o),y=Math.exp(-f);return Zhe-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=nJ(Math.pow(u,2),o);return(-s(u)+Zhe>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=_st(s,a,l);if(t=ql(t),isNaN(c))return{stiffness:sl.stiffness,damping:sl.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const Ast=12;function _st(t,e,n){let r=n;for(let s=1;s<Ast;s++)r=r-t(r)/e(r);return r}function nJ(t,e){return t*Math.sqrt(1-e*e)}const Est=["duration","bounce"],kst=["stiffness","damping","mass"];function Jhe(t,e){return e.some(n=>t[n]!==void 0)}function Tst(t){let e={velocity:sl.velocity,stiffness:sl.stiffness,damping:sl.damping,mass:sl.mass,isResolvedFromDuration:!1,...t};if(!Jhe(t,kst)&&Jhe(t,Est))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:sl.mass,stiffness:s,damping:a}}else{const n=jst(t);e={...e,...n,mass:sl.mass},e.isResolvedFromDuration=!0}return e}function WM(t=sl.visualDuration,e=sl.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:f,velocity:x,isResolvedFromDuration:g}=Tst({...n,velocity:-ll(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,N=ll(Math.sqrt(c/d)),I=Math.abs(C)<5;r||(r=I?sl.restSpeed.granular:sl.restSpeed.default),s||(s=I?sl.restDelta.granular:sl.restDelta.default);let P;if(v<1){const F=nJ(N,v);P=$=>{const L=Math.exp(-v*N*$);return o-L*((y+v*N*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)P=F=>o-Math.exp(-N*F)*(C+(y+N*C)*F);else{const F=N*Math.sqrt(v*v-1);P=$=>{const L=Math.exp(-v*N*$),z=Math.min(F*$,300);return o-L*((y+v*N*C)*Math.sinh(z)+F*C*Math.cosh(z))/F}}const M={calculatedDuration:g&&f||null,next:F=>{const $=P(F);if(g)l.done=F>=f;else{let L=F===0?y:0;v<1&&(L=F===0?ql(y):y9e(P,F,$));const z=Math.abs(L)<=r,Q=Math.abs(o-$)<=s;l.done=z&&Q}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(Qie(M),VM),$=b9e(L=>M.next(F*L).value,F,30);return F+"ms "+$},toTransition:()=>{}};return M}WM.applyToOptions=t=>{const e=Sst(t,100,WM);return t.ease=e.ease,t.duration=ql(e.duration),t.type="keyframes",t};function rJ({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=t[0],x={done:!1,value:f},g=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let v=n*e;const C=f+v,N=o===void 0?C:o(C);N!==C&&(v=N-f);const I=z=>-v*Math.exp(-z/r),P=z=>N+I(z),M=z=>{const Q=I(z),se=P(z);x.done=Math.abs(Q)<=u,x.value=x.done?N:se};let F,$;const L=z=>{g(x.value)&&(F=z,$=WM({keyframes:[x.value,y(x.value)],velocity:y9e(P,z,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return L(0),{calculatedDuration:null,next:z=>{let Q=!1;return!$&&F===void 0&&(Q=!0,M(z),L(z)),F!==void 0&&z>=F?$.next(z-F):(!Q&&M(z),x)}}}function Ist(t,e,n){const r=[],s=n||Bc.mix||g9e,a=t.length-1;for(let o=0;o<a;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||dl:e;l=vx(c,l)}r.push(l)}return r}function Pst(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(QS(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=Ist(e,r,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let f=0;if(c>1)for(;f<t.length-2&&!(d<t[f+1]);f++);const x=sx(t[f],t[f+1],d);return l[f](x)};return n?d=>u(Dc(t[0],t[a-1],d)):u}function Fst(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=sx(0,e,r);t.push(qo(n,1,s))}}function Ost(t){const e=[0];return Fst(e,t.length-1),e}function Mst(t,e){return t.map(n=>n*e)}function Rst(t,e){return t.map(()=>e||Vie).splice(0,t.length-1)}function y9({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=l9e(r)?r.map(zM):zM(r),a={done:!1,value:e[0]},o=Mst(n&&n.length===e.length?n:Ost(e),t),l=Pst(o,e,{ease:Array.isArray(s)?s:Rst(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const Lst=t=>t!==null;function Zie(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(Lst),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const Dst={decay:rJ,inertia:rJ,tween:y9,keyframes:y9,spring:WM};function v9e(t){typeof t.type=="string"&&(t.type=Dst[t.type])}let Jie=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 Bst=t=>t/100;let eae=class extends Jie{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;v9e(e);const{type:n=y9,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||y9;c!==y9&&typeof l[0]!="number"&&(this.mixKeyframes=vx(Bst,g9e(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=Qie(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:x,repeatDelay:g,type:y,onUpdate:v,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const N=this.currentTime-u*(this.playbackSpeed>=0?1:-1),I=this.playbackSpeed>=0?N<0:N>s;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let P=this.currentTime,M=r;if(f){const z=Math.min(this.currentTime,s)/l;let Q=Math.floor(z),se=z%1;!se&&z>=1&&(se=1),se===1&&Q--,Q=Math.min(Q,f+1),!!(Q%2)&&(x==="reverse"?(se=1-se,g&&(se-=g/l)):x==="mirror"&&(M=o)),P=Dc(0,1,se)*l}const F=I?{done:!1,value:d[0]}:M.next(P);a&&(F.value=a(F.value));let{done:$}=F;!I&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return L&&y!==rJ&&(F.value=Zie(d,this.options,C,this.speed)),v&&v(F.value),L&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return ll(this.calculatedDuration)}get time(){return ll(this.currentTime)}set time(e){var n;e=ql(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=ll(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=Cst,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 $st(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const cw=t=>t*180/Math.PI,sJ=t=>{const e=cw(Math.atan2(t[1],t[0]));return iJ(e)},Ust={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:sJ,rotateZ:sJ,skewX:t=>cw(Math.atan(t[1])),skewY:t=>cw(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},iJ=t=>(t=t%360,t<0&&(t+=360),t),epe=sJ,tpe=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),npe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),zst={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tpe,scaleY:npe,scale:t=>(tpe(t)+npe(t))/2,rotateX:t=>iJ(cw(Math.atan2(t[6],t[5]))),rotateY:t=>iJ(cw(Math.atan2(-t[2],t[0]))),rotateZ:epe,rotate:epe,skewX:t=>cw(Math.atan(t[4])),skewY:t=>cw(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function aJ(t){return t.includes("scale")?1:0}function oJ(t,e){if(!t||t==="none")return aJ(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=zst,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Ust,s=l}if(!s)return aJ(e);const a=r[e],o=s[1].split(",").map(Vst);return typeof a=="function"?a(o):o[a]}const Hst=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return oJ(n,e)};function Vst(t){return parseFloat(t.trim())}const Bj=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],$j=new Set(Bj),rpe=t=>t===Dj||t===di,Wst=new Set(["x","y","z"]),qst=Bj.filter(t=>!Wst.has(t));function Gst(t){const e=[];return qst.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const l3={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>oJ(e,"x"),y:(t,{transform:e})=>oJ(e,"y")};l3.translateX=l3.x;l3.translateY=l3.y;const c3=new Set;let lJ=!1,cJ=!1,uJ=!1;function w9e(){if(cJ){const t=Array.from(c3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=Gst(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,lJ=!1,c3.forEach(t=>t.complete(uJ)),c3.clear()}function C9e(){c3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(cJ=!0)})}function Kst(){uJ=!0,C9e(),w9e(),uJ=!1}let tae=class{constructor(e,n,r,s,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(c3.add(this),lJ||(lJ=!0,Do.read(C9e),Do.resolveKeyframes(w9e))):(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])}$st(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),c3.delete(this)}cancel(){this.state==="scheduled"&&(c3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}};const Yst=t=>t.startsWith("--");function Xst(t,e,n){Yst(e)?t.style.setProperty(e,n):t.style[e]=n}const Qst=Rj(()=>window.ScrollTimeline!==void 0),Zst={};function Jst(t,e){const n=Rj(t);return()=>Zst[e]??n()}const S9e=Jst(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),$7=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,spe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$7([0,.65,.55,1]),circOut:$7([.55,0,1,.45]),backIn:$7([.31,.01,.66,-.59]),backOut:$7([.33,1.53,.69,.99])};function N9e(t,e){if(t)return typeof t=="function"?S9e()?b9e(t,e):"ease-out":Wie(t)?$7(t):Array.isArray(t)?t.map(n=>N9e(n,e)||spe.easeOut):spe[t]}function eit(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=N9e(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 j9e(t){return typeof t=="function"&&"applyToOptions"in t}function tit({type:t,...e}){return j9e(t)&&S9e()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}let nit=class extends Jie{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,QS(typeof e.type!="string");const u=tit(e);this.animation=eit(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=Zie(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):Xst(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return ll(Number(e))}get time(){return ll(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=ql(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&&Qst()?(this.animation.timeline=e,dl):n(this)}};const A9e={anticipate:$ie,backInOut:Bie,circInOut:Hie};function rit(t){return t in A9e}function sit(t){typeof t.ease=="string"&&rit(t.ease)&&(t.ease=A9e[t.ease])}const ipe=10;let iit=class extends nit{constructor(e){sit(e),v9e(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 eae({...o,autoplay:!1}),c=ql(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-ipe).value,l.sample(c).value,ipe),l.stop()}};const ape=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Zy.test(t)||t==="0")&&!t.startsWith("url("));function ait(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 oit(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=ape(s,e),l=ape(a,e);return!o||!l?!1:ait(t)||(n==="spring"||j9e(n))&&r}function dJ(t){t.duration=0,t.type}const lit=new Set(["opacity","clipPath","filter","transform"]),cit=Rj(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uit(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 cit()&&n&&lit.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const dit=40;let fit=class extends Jie{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)||tae;this.keyframeResolver=new g(l,(v,C,N)=>this.onKeyframesResolved(v,C,x,!N),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=sf.now(),oit(e,a,o,l)||((Bc.instantAnimations||!c)&&(d==null||d(Zie(e,r,n))),e[0]=e[e.length-1],dJ(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>dit?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&uit(x)?new iit({...x,element:x.motionValue.owner.current}):new eae(x);g.finished.then(()=>this.notifyFinished()).catch(dl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Kst()),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 hit=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pit(t){const e=hit.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function _9e(t,e,n=1){const[r,s]=pit(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return DB(o)?parseFloat(o):o}return Gie(s)?_9e(s,e,n+1):s}function nae(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const E9e=new Set(["width","height","top","left","right","bottom",...Bj]),mit={test:t=>t==="auto",parse:t=>t},k9e=t=>e=>e.test(t),T9e=[Dj,di,W0,Rb,ast,ist,mit],ope=t=>T9e.find(k9e(t));function xit(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$B(t):!0}const git=new Set(["brightness","contrast","saturate","opacity"]);function bit(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Kie)||[];if(!r)return t;const s=n.replace(r,"");let a=git.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const yit=/\b([a-z-]*)\(.*?\)/gu,fJ={...Zy,getAnimatableNone:t=>{const e=t.match(yit);return e?e.map(bit).join(" "):t}},lpe={...Dj,transform:Math.round},vit={rotate:Rb,rotateX:Rb,rotateY:Rb,rotateZ:Rb,scale:mP,scaleX:mP,scaleY:mP,scaleZ:mP,skew:Rb,skewX:Rb,skewY:Rb,distance:di,translateX:di,translateY:di,translateZ:di,x:di,y:di,z:di,perspective:di,transformPerspective:di,opacity:d_,originX:Khe,originY:Khe,originZ:di},rae={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,...vit,zIndex:lpe,fillOpacity:d_,strokeOpacity:d_,numOctaves:lpe},wit={...rae,color:$l,backgroundColor:$l,outlineColor:$l,fill:$l,stroke:$l,borderColor:$l,borderTopColor:$l,borderRightColor:$l,borderBottomColor:$l,borderLeftColor:$l,filter:fJ,WebkitFilter:fJ},I9e=t=>wit[t];function P9e(t,e){let n=I9e(t);return n!==fJ&&(n=Zy),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Cit=new Set(["auto","none","0"]);function Sit(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!Cit.has(a)&&f_(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=P9e(n,s)}let Nit=class extends tae{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(),Gie(u))){const d=_9e(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!E9e.has(r)||e.length!==2)return;const[s,a]=e,o=ope(s),l=ope(a);if(o!==l)if(rpe(o)&&rpe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else l3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||xit(e[s]))&&r.push(s);r.length&&Sit(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l3[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=l3[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}};function jit(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 F9e=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Ait(t){return BB(t)&&"offsetHeight"in t}const cpe=30,_it=t=>!isNaN(parseFloat(t));let Eit=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=_it(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 Lj);const r=this.events[e].add(n);return e==="change"?()=>{r(),Do.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>cpe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,cpe);return UB(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ZS(t,e){return new Eit(t,e)}const{schedule:sae,cancel:hCn}=c9e(queueMicrotask,!1),Hp={x:!1,y:!1};function O9e(){return Hp.x||Hp.y}function kit(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 M9e(t,e){const n=jit(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function upe(t){return!(t.pointerType==="touch"||O9e())}function Tit(t,e,n={}){const[r,s,a]=M9e(t,n),o=l=>{if(!upe(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{upe(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const R9e=(t,e)=>e?t===e?!0:R9e(t,e.parentElement):!1,iae=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Iit=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Pit(t){return Iit.has(t.tagName)||t.tabIndex!==-1}const _O=new WeakSet;function dpe(t){return e=>{e.key==="Enter"&&t(e)}}function RH(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Fit=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=dpe(()=>{if(_O.has(n))return;RH(n,"down");const s=dpe(()=>{RH(n,"up")}),a=()=>RH(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 fpe(t){return iae(t)&&!O9e()}function Oit(t,e,n={}){const[r,s,a]=M9e(t,n),o=l=>{const c=l.currentTarget;if(!fpe(l))return;_O.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),_O.has(c)&&_O.delete(c),fpe(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||R9e(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),Ait(l)&&(l.addEventListener("focus",u=>Fit(u,s)),!Pit(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function L9e(t){return BB(t)&&"ownerSVGElement"in t}function Mit(t){return L9e(t)&&t.tagName==="svg"}const Lu=t=>!!(t&&t.getVelocity),Rit=[...T9e,$l,Zy],Lit=t=>Rit.find(k9e(t)),D9e=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Dit(t=!0){const e=h.useContext(Lie);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 B9e=h.createContext({strict:!1}),hpe={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},JS={};for(const t in hpe)JS[t]={isEnabled:e=>hpe[t].some(n=>!!e[n])};function Bit(t){for(const e in t)JS[e]={...JS[e],...t[e]}}const $it=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 qM(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||$it.has(t)}let $9e=t=>!qM(t);function Uit(t){typeof t=="function"&&($9e=e=>e.startsWith("on")?!qM(e):t(e))}try{Uit(require("@emotion/is-prop-valid").default)}catch{}function zit(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||($9e(s)||n===!0&&qM(s)||!e&&!qM(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const zB=h.createContext({});function HB(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function h_(t){return typeof t=="string"||Array.isArray(t)}const aae=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],oae=["initial",...aae];function VB(t){return HB(t.animate)||oae.some(e=>h_(t[e]))}function U9e(t){return!!(VB(t)||t.variants)}function Hit(t,e){if(VB(t)){const{initial:n,animate:r}=t;return{initial:n===!1||h_(n)?n:void 0,animate:h_(r)?r:void 0}}return t.inherit!==!1?e:{}}function Vit(t){const{initial:e,animate:n}=Hit(t,h.useContext(zB));return h.useMemo(()=>({initial:e,animate:n}),[ppe(e),ppe(n)])}function ppe(t){return Array.isArray(t)?t.join(" "):t}const p_={};function Wit(t){for(const e in t)p_[e]=t[e],qie(e)&&(p_[e].isCSSVariable=!0)}function z9e(t,{layout:e,layoutId:n}){return $j.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!p_[t]||t==="opacity")}const qit={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Git=Bj.length;function Kit(t,e,n){let r="",s=!0;for(let a=0;a<Git;a++){const o=Bj[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=F9e(l,rae[o]);if(!c){s=!1;const d=qit[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function lae(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($j.has(c)){o=!0;continue}else if(qie(c)){s[c]=u;continue}else{const d=F9e(u,rae[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=Kit(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 cae=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function H9e(t,e,n){for(const r in e)!Lu(e[r])&&!z9e(r,n)&&(t[r]=e[r])}function Yit({transformTemplate:t},e){return h.useMemo(()=>{const n=cae();return lae(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Xit(t,e){const n=t.style||{},r={};return H9e(r,n,t),Object.assign(r,Yit(t,e)),r}function Qit(t,e){const n={},r=Xit(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 Zit={offset:"stroke-dashoffset",array:"stroke-dasharray"},Jit={offset:"strokeDashoffset",array:"strokeDasharray"};function eat(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?Zit:Jit;t[a.offset]=di.transform(-r);const o=di.transform(e),l=di.transform(n);t[a.array]=`${o} ${l}`}function V9e(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(lae(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&&eat(f,s,a,o,!1)}const W9e=()=>({...cae(),attrs:{}}),q9e=t=>typeof t=="string"&&t.toLowerCase()==="svg";function tat(t,e,n,r){const s=h.useMemo(()=>{const a=W9e();return V9e(a,e,q9e(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};H9e(a,t.style,t),s.style={...a,...s.style}}return s}const nat=["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 uae(t){return typeof t!="string"||t.includes("-")?!1:!!(nat.indexOf(t)>-1||/[A-Z]/u.test(t))}function rat(t,e,n,{latestValues:r},s,a=!1){const l=(uae(t)?tat:Qit)(e,r,s,t),c=zit(e,typeof t=="string",a),u=t!==h.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=h.useMemo(()=>Lu(d)?d.get():d,[d]);return h.createElement(t,{...u,children:f})}function mpe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function dae(t,e,n,r){if(typeof e=="function"){const[s,a]=mpe(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]=mpe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function EO(t){return Lu(t)?t.get():t}function sat({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:iat(n,r,s,t),renderState:e()}}function iat(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=EO(a[x]);let{initial:o,animate:l}=t;const c=VB(t),u=U9e(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"&&!HB(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=dae(t,x[g]);if(y){const{transitionEnd:v,transition:C,...N}=y;for(const I in N){let P=N[I];if(Array.isArray(P)){const M=d?P.length-1:0;P=P[M]}P!==null&&(s[I]=P)}for(const I in v)s[I]=v[I]}}}return s}const G9e=t=>(e,n)=>{const r=h.useContext(zB),s=h.useContext(Lie),a=()=>sat(t,e,r,s);return n?a():Urt(a)};function fae(t,e,n){var a;const{style:r}=t,s={};for(const o in r)(Lu(r[o])||e.style&&Lu(e.style[o])||z9e(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const aat=G9e({scrapeMotionValuesFromProps:fae,createRenderState:cae});function K9e(t,e,n){const r=fae(t,e,n);for(const s in t)if(Lu(t[s])||Lu(e[s])){const a=Bj.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const oat=G9e({scrapeMotionValuesFromProps:K9e,createRenderState:W9e}),lat=Symbol.for("motionComponentSymbol");function ZC(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function cat(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):ZC(n)&&(n.current=r))},[e])}const hae=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),uat="framerAppearId",Y9e="data-"+hae(uat),X9e=h.createContext({});function dat(t,e,n,r,s){var v,C;const{visualElement:a}=h.useContext(zB),o=h.useContext(B9e),l=h.useContext(Lie),c=h.useContext(D9e).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(X9e);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&fat(u.current,n,s,f);const x=h.useRef(!1);h.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[Y9e],y=h.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return zrt(()=>{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 N;(N=window.MotionHandoffMarkAsComplete)==null||N.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function fat(t,e,n,r){const{layoutId:s,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Q9e(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&ZC(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function Q9e(t){if(t)return t.options.allowProjection!==!1?t.projection:Q9e(t.parent)}function LH(t,{forwardMotionProps:e=!1}={},n,r){n&&Bit(n);const s=uae(t)?oat:aat;function a(l,c){let u;const d={...h.useContext(D9e),...l,layoutId:hat(l)},{isStatic:f}=d,x=Vit(l),g=s(l,f);if(!f&&Rie){pat();const y=mat(d);u=y.MeasureLayout,x.visualElement=dat(t,g,d,r,y.ProjectionNode)}return i.jsxs(zB.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,rat(t,l,cat(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[lat]=t,o}function hat({layoutId:t}){const e=h.useContext(r9e).id;return e&&t!==void 0?e+"-"+t:t}function pat(t,e){h.useContext(B9e).strict}function mat(t){const{drag:e,layout:n}=JS;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function xat(t,e){if(typeof Proxy>"u")return LH;const n=new Map,r=(a,o)=>LH(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,LH(o,void 0,t,e)),n.get(o))})}function Z9e({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function gat({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function bat(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 DH(t){return t===void 0||t===1}function hJ({scale:t,scaleX:e,scaleY:n}){return!DH(t)||!DH(e)||!DH(n)}function Uv(t){return hJ(t)||J9e(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function J9e(t){return xpe(t.x)||xpe(t.y)}function xpe(t){return t&&t!=="0%"}function GM(t,e,n){const r=t-n,s=e*r;return n+s}function gpe(t,e,n,r,s){return s!==void 0&&(t=GM(t,s,r)),GM(t,n,r)+e}function pJ(t,e=0,n=1,r,s){t.min=gpe(t.min,e,n,r,s),t.max=gpe(t.max,e,n,r,s)}function e_e(t,{x:e,y:n}){pJ(t.x,e.translate,e.scale,e.originPoint),pJ(t.y,n.translate,n.scale,n.originPoint)}const bpe=.999999999999,ype=1.0000000000001;function yat(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&&e4(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,e_e(t,o)),r&&Uv(a.latestValues)&&e4(t,a.latestValues))}e.x<ype&&e.x>bpe&&(e.x=1),e.y<ype&&e.y>bpe&&(e.y=1)}function JC(t,e){t.min=t.min+e,t.max=t.max+e}function vpe(t,e,n,r,s=.5){const a=qo(t.min,t.max,s);pJ(t,e,n,a,r)}function e4(t,e){vpe(t.x,e.x,e.scaleX,e.scale,e.originX),vpe(t.y,e.y,e.scaleY,e.scale,e.originY)}function t_e(t,e){return Z9e(bat(t.getBoundingClientRect(),e))}function vat(t,e,n){const r=t_e(t,n),{scroll:s}=e;return s&&(JC(r.x,s.offset.x),JC(r.y,s.offset.y)),r}const wpe=()=>({translate:0,scale:1,origin:0,originPoint:0}),t4=()=>({x:wpe(),y:wpe()}),Cpe=()=>({min:0,max:0}),yl=()=>({x:Cpe(),y:Cpe()}),mJ={current:null},n_e={current:!1};function wat(){if(n_e.current=!0,!!Rie)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>mJ.current=t.matches;t.addEventListener("change",e),e()}else mJ.current=!1}const Cat=new WeakMap;function Sat(t,e,n){for(const r in e){const s=e[r],a=n[r];if(Lu(s))t.addValue(r,s);else if(Lu(a))t.addValue(r,ZS(s,{owner:t}));else if(a!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,ZS(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Spe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Nat=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=tae,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,Do.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=VB(n),this.isVariantNode=U9e(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const x in f){const g=f[x];c[x]!==void 0&&Lu(g)&&g.set(c[x])}}mount(e){var n;this.current=e,Cat.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)),n_e.current||wat(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:mJ.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),Qy(this.notifyUpdate),Qy(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=$j.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Do.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in JS){const n=JS[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):yl()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Spe.length;r++){const s=Spe[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=Sat(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=ZS(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(DB(r)||$B(r))?r=parseFloat(r):!Lit(r)&&Zy.test(n)&&(r=P9e(e,n)),this.setBaseTarget(e,Lu(r)?r.get():r)),Lu(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var a;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=dae(this.props,n,(a=this.presenceContext)==null?void 0:a.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Lu(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Lj),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){sae.render(this.render)}},r_e=class extends Nat{constructor(){super(...arguments),this.KeyframeResolver=Nit}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Lu(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}};function s_e(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 jat(t){return window.getComputedStyle(t)}let Aat=class extends r_e{constructor(){super(...arguments),this.type="html",this.renderInstance=s_e}readValueFromInstance(e,n){var r;if($j.has(n))return(r=this.projection)!=null&&r.isProjecting?aJ(n):Hst(e,n);{const s=jat(e),a=(qie(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return t_e(e,n)}build(e,n,r){lae(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return fae(e,n,r)}};const i_e=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 _at(t,e,n,r){s_e(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(i_e.has(s)?s:hae(s),e.attrs[s])}let Eat=class extends r_e{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if($j.has(n)){const r=I9e(n);return r&&r.default||0}return n=i_e.has(n)?n:hae(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return K9e(e,n,r)}build(e,n,r){V9e(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){_at(e,n,r,s)}mount(e){this.isSVGTag=q9e(e.tagName),super.mount(e)}};const kat=(t,e)=>uae(t)?new Eat(e):new Aat(e,{allowProjection:t!==h.Fragment});function v4(t,e,n){const r=t.getProps();return dae(r,e,n!==void 0?n:r.custom,t)}const xJ=t=>Array.isArray(t);function Tat(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ZS(n))}function Iat(t){return xJ(t)?t[t.length-1]||0:t}function Pat(t,e){const n=v4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=Iat(a[o]);Tat(t,o,l)}}function Fat(t){return!!(Lu(t)&&t.add)}function gJ(t,e){const n=t.getValue("willChange");if(Fat(n))return n.add(e);if(!n&&Bc.WillChange){const r=new Bc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function a_e(t){return t.props[Y9e]}const Oat=t=>t!==null;function Mat(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Oat),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const Rat={type:"spring",stiffness:500,damping:25,restSpeed:10},Lat=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Dat={type:"keyframes",duration:.8},Bat={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$at=(t,{keyframes:e})=>e.length>2?Dat:$j.has(t)?t.startsWith("scale")?Lat(e[1]):Rat:Bat;function Uat({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 pae=(t,e,n,r={},s,a)=>o=>{const l=nae(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ql(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};Uat(l)||Object.assign(d,$at(t,d)),d.duration&&(d.duration=ql(d.duration)),d.repeatDelay&&(d.repeatDelay=ql(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(dJ(d),d.delay===0&&(f=!0)),(Bc.instantAnimations||Bc.skipAnimations)&&(f=!0,dJ(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=Mat(d.keyframes,l);if(x!==void 0){Do.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new eae(d):new fit(d)};function zat({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function o_e(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&&zat(u,d))continue;const g={delay:n,...nae(a||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(x)&&x===y&&!g.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const N=a_e(t);if(N){const I=window.MotionHandoffAnimation(N,d,Do);I!==null&&(g.startTime=I,v=!0)}}gJ(t,d),f.start(pae(d,f,x,t.shouldReduceMotion&&E9e.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{Do.update(()=>{o&&Pat(t,o)})}),c}function l_e(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 bJ(t,e,n={}){var c;const r=v4(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(o_e(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return Hat(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 Hat(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(bJ(c,e,{...o,delay:n+(typeof r=="function"?0:r)+l_e(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function Vat(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>bJ(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=bJ(t,e,n);else{const s=typeof e=="function"?v4(t,e,n.custom):e;r=Promise.all(o_e(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function c_e(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 Wat=oae.length;function u_e(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?u_e(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Wat;n++){const r=oae[n],s=t.props[r];(h_(s)||s===!1)&&(e[r]=s)}return e}const qat=[...aae].reverse(),Gat=aae.length;function Kat(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Vat(t,n,r)))}function Yat(t){let e=Kat(t),n=Npe(),r=!0;const s=c=>(u,d)=>{var x;const f=v4(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=u_e(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<Gat;C++){const N=qat[C],I=n[N],P=u[N]!==void 0?u[N]:d[N],M=h_(P),F=N===c?I.isActive:null;F===!1&&(y=C);let $=P===d[N]&&P!==u[N]&&M;if($&&r&&t.manuallyAnimateOnMount&&($=!1),I.protectedKeys={...g},!I.isActive&&F===null||!P&&!I.prevProp||HB(P)||typeof P=="boolean")continue;const L=Xat(I.prevProp,P);let z=L||N===c&&I.isActive&&!$&&M||C>y&&M,Q=!1;const se=Array.isArray(P)?P:[P];let ee=se.reduce(s(N),{});F===!1&&(ee={});const{prevResolvedValues:K={}}=I,re={...K,...ee},de=ae=>{z=!0,x.has(ae)&&(Q=!0,x.delete(ae)),I.needsAnimating[ae]=!0;const q=t.getValue(ae);q&&(q.liveStyle=!1)};for(const ae in re){const q=ee[ae],W=K[ae];if(g.hasOwnProperty(ae))continue;let ne=!1;xJ(q)&&xJ(W)?ne=!c_e(q,W):ne=q!==W,ne?q!=null?de(ae):x.add(ae):q!==void 0&&x.has(ae)?de(ae):I.protectedKeys[ae]=!0}I.prevProp=P,I.prevResolvedValues=ee,I.isActive&&(g={...g,...ee}),r&&t.blockInitialAnimation&&(z=!1);const G=$&&L;z&&(!G||Q)&&f.push(...se.map(ae=>{const q={type:N};if(typeof ae=="string"&&r&&!G&&t.manuallyAnimateOnMount&&t.parent){const{parent:W}=t,ne=v4(W,ae);if(W.enteringChildren&&ne){const{delayChildren:oe}=ne.transition||{};q.delay=l_e(W.enteringChildren,t,oe)}}return{animation:ae,options:q}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const N=v4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);N&&N.transition&&(C.transition=N.transition)}x.forEach(N=>{const I=t.getBaseTarget(N),P=t.getValue(N);P&&(P.liveStyle=!0),C[N]=I??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=Npe(),r=!0}}}function Xat(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!c_e(e,t):!1}function Nv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Npe(){return{animate:Nv(!0),whileInView:Nv(),whileHover:Nv(),whileTap:Nv(),whileDrag:Nv(),whileFocus:Nv(),exit:Nv()}}let w2=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},Qat=class extends w2{constructor(e){super(e),e.animationState||(e.animationState=Yat(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();HB(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)}},Zat=0,Jat=class extends w2{constructor(){super(...arguments),this.id=Zat++}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 eot={animation:{Feature:Qat},exit:{Feature:Jat}};function m_(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function cT(t){return{point:{x:t.pageX,y:t.pageY}}}const tot=t=>e=>iae(e)&&t(e,cT(e));function v9(t,e,n,r){return m_(t,e,tot(n),r)}const d_e=1e-4,not=1-d_e,rot=1+d_e,f_e=.01,sot=0-f_e,iot=0+f_e;function dd(t){return t.max-t.min}function aot(t,e,n){return Math.abs(t-e)<=n}function jpe(t,e,n,r=.5){t.origin=r,t.originPoint=qo(e.min,e.max,t.origin),t.scale=dd(n)/dd(e),t.translate=qo(n.min,n.max,t.origin)-t.originPoint,(t.scale>=not&&t.scale<=rot||isNaN(t.scale))&&(t.scale=1),(t.translate>=sot&&t.translate<=iot||isNaN(t.translate))&&(t.translate=0)}function w9(t,e,n,r){jpe(t.x,e.x,n.x,r?r.originX:void 0),jpe(t.y,e.y,n.y,r?r.originY:void 0)}function Ape(t,e,n){t.min=n.min+e.min,t.max=t.min+dd(e)}function oot(t,e,n){Ape(t.x,e.x,n.x),Ape(t.y,e.y,n.y)}function _pe(t,e,n){t.min=e.min-n.min,t.max=t.min+dd(e)}function C9(t,e,n){_pe(t.x,e.x,n.x),_pe(t.y,e.y,n.y)}function Bh(t){return[t("x"),t("y")]}const h_e=({current:t})=>t?t.ownerDocument.defaultView:null,Epe=(t,e)=>Math.abs(t-e);function lot(t,e){const n=Epe(t.x,e.x),r=Epe(t.y,e.y);return Math.sqrt(n**2+r**2)}let p_e=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=$H(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=lot(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:N,onMove:I}=this.handlers;g||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),I&&I(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=BH(g,this.transformPagePoint),Do.update(this.updatePoint,!0)},this.handlePointerUp=(x,g)=>{this.end();const{onEnd:y,onSessionEnd:v,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=$H(x.type==="pointercancel"?this.lastMoveEventInfo:BH(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,N),v&&v(x,N)},!iae(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=cT(e),c=BH(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=eu;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,$H(c,this.history)),this.removeListeners=vx(v9(this.contextWindow,"pointermove",this.handlePointerMove),v9(this.contextWindow,"pointerup",this.handlePointerUp),v9(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Qy(this.updatePoint)}};function BH(t,e){return e?{point:e(t.point)}:t}function kpe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function $H({point:t},e){return{point:t,delta:kpe(t,m_e(e)),offset:kpe(t,cot(e)),velocity:uot(e,.1)}}function cot(t){return t[0]}function m_e(t){return t[t.length-1]}function uot(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=m_e(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>ql(e)));)n--;if(!r)return{x:0,y:0};const a=ll(s.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(s.x-r.x)/a,y:(s.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function dot(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?qo(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?qo(n,t,r.max):Math.min(t,n)),t}function Tpe(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 fot(t,{top:e,left:n,bottom:r,right:s}){return{x:Tpe(t.x,n,s),y:Tpe(t.y,e,r)}}function Ipe(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 hot(t,e){return{x:Ipe(t.x,e.x),y:Ipe(t.y,e.y)}}function pot(t,e){let n=.5;const r=dd(t),s=dd(e);return s>r?n=sx(e.min,e.max-r,t.min):r>s&&(n=sx(t.min,t.max-s,e.min)),Dc(0,1,n)}function mot(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 yJ=.35;function xot(t=yJ){return t===!1?t=0:t===!0&&(t=yJ),{x:Ppe(t,"left","right"),y:Ppe(t,"top","bottom")}}function Ppe(t,e,n){return{min:Fpe(t,e),max:Fpe(t,n)}}function Fpe(t,e){return typeof t=="number"?t:t[e]||0}const got=new WeakMap;let bot=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=yl(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=f=>{const{dragSnapToOrigin:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(cT(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=kit(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bh(N=>{let I=this.getAxisMotionValue(N).get()||0;if(W0.test(I)){const{projection:P}=this.visualElement;if(P&&P.layout){const M=P.layout.layoutBox[N];M&&(I=dd(M)*(parseFloat(I)/100))}}this.originPoint[N]=I}),v&&Do.postRender(()=>v(f,x)),gJ(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},l=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x;const{dragPropagation:g,dragDirectionLock:y,onDirectionLock:v,onDrag:C}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:N}=x;if(y&&this.currentDirection===null){this.currentDirection=yot(N),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),C&&C(f,x)},c=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x,this.stop(f,x),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>Bh(f=>{var x;return this.getAnimationState(f)==="paused"&&((x=this.getAxisMotionValue(f).animation)==null?void 0:x.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new p_e(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:h_e(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&&Do.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||!xP(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=dot(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&&ZC(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=fot(r.layoutBox,e):this.constraints=!1,this.elastic=xot(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bh(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=mot(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ZC(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=vat(r,s.root,this.visualElement.getTransformPagePoint());let o=hot(s.layout.layoutBox,a);if(n){const l=n(gat(o));this.hasMutatedConstraints=!!l,l&&(o=Z9e(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(!xP(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 gJ(this.visualElement,e),r.start(pae(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(!xP(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];a.set(e[n]-qo(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ZC(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]=pot({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(!xP(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(qo(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;got.set(this.visualElement,this);const e=this.visualElement.current,n=v9(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();ZC(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()),Do.read(r);const o=m_(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=yJ,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}};function xP(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function yot(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}let vot=class extends w2{constructor(e){super(e),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new bot(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}unmount(){this.removeGroupControls(),this.removeListeners()}};const Ope=t=>(e,n)=>{t&&Do.postRender(()=>t(e,n))};let wot=class extends w2{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(e){this.session=new p_e(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:h_e(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Ope(e),onStart:Ope(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&Do.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=v9(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 kO={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Mpe(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const zA={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(di.test(t))t=parseFloat(t);else return t;const n=Mpe(t,e.target.x),r=Mpe(t,e.target.y);return`${n}% ${r}%`}},Cot={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Zy.parse(t);if(s.length>5)return r;const a=Zy.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=qo(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),a(s)}};let UH=!1,Sot=class extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;Wit(Not),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),UH&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),kO.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,UH=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||Do.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),sae.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;UH=!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 x_e(t){const[e,n]=Dit(),r=h.useContext(r9e);return i.jsx(Sot,{...t,layoutGroup:r,switchLayoutGroup:h.useContext(X9e),isPresent:e,safeToRemove:n})}const Not={borderRadius:{...zA,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zA,borderTopRightRadius:zA,borderBottomLeftRadius:zA,borderBottomRightRadius:zA,boxShadow:Cot};function jot(t,e,n){const r=Lu(t)?t:ZS(t);return r.start(pae("",r,e,n)),r.animation}const Aot=(t,e)=>t.depth-e.depth;let _ot=class{constructor(){this.children=[],this.isDirty=!1}add(e){iT(this.children,e),this.isDirty=!0}remove(e){aT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Aot),this.isDirty=!1,this.children.forEach(e)}};function Eot(t,e){const n=sf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(Qy(r),t(a-e))};return Do.setup(r,!0),()=>Qy(r)}const g_e=["TopLeft","TopRight","BottomLeft","BottomRight"],kot=g_e.length,Rpe=t=>typeof t=="string"?parseFloat(t):t,Lpe=t=>typeof t=="number"||di.test(t);function Tot(t,e,n,r,s,a){s?(t.opacity=qo(0,n.opacity??1,Iot(r)),t.opacityExit=qo(e.opacity??1,0,Pot(r))):a&&(t.opacity=qo(e.opacity??1,n.opacity??1,r));for(let o=0;o<kot;o++){const l=`border${g_e[o]}Radius`;let c=Dpe(e,l),u=Dpe(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Lpe(c)===Lpe(u)?(t[l]=Math.max(qo(Rpe(c),Rpe(u),r),0),(W0.test(u)||W0.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=qo(e.rotate||0,n.rotate||0,r))}function Dpe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Iot=b_e(0,.5,zie),Pot=b_e(.5,.95,dl);function b_e(t,e,n){return r=>r<t?0:r>e?1:n(sx(t,e,r))}function Bpe(t,e){t.min=e.min,t.max=e.max}function Nh(t,e){Bpe(t.x,e.x),Bpe(t.y,e.y)}function $pe(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Upe(t,e,n,r,s){return t-=e,t=GM(t,1/n,r),s!==void 0&&(t=GM(t,1/s,r)),t}function Fot(t,e=0,n=1,r=.5,s,a=t,o=t){if(W0.test(e)&&(e=parseFloat(e),e=qo(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=qo(a.min,a.max,r);t===a&&(l-=e),t.min=Upe(t.min,e,n,l,s),t.max=Upe(t.max,e,n,l,s)}function zpe(t,e,[n,r,s],a,o){Fot(t,e[n],e[r],e[s],e.scale,a,o)}const Oot=["x","scaleX","originX"],Mot=["y","scaleY","originY"];function Hpe(t,e,n,r){zpe(t.x,e,Oot,n?n.x:void 0,r?r.x:void 0),zpe(t.y,e,Mot,n?n.y:void 0,r?r.y:void 0)}function Vpe(t){return t.translate===0&&t.scale===1}function y_e(t){return Vpe(t.x)&&Vpe(t.y)}function Wpe(t,e){return t.min===e.min&&t.max===e.max}function Rot(t,e){return Wpe(t.x,e.x)&&Wpe(t.y,e.y)}function qpe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function v_e(t,e){return qpe(t.x,e.x)&&qpe(t.y,e.y)}function Gpe(t){return dd(t.x)/dd(t.y)}function Kpe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}let Lot=class{constructor(){this.members=[]}add(e){iT(this.members,e),e.scheduleRender()}remove(e){if(aT(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 Dot(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 zH=["","X","Y","Z"],Bot=1e3;let $ot=0;function HH(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function w_e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=a_e(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Do,!(s||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&w_e(r)}function C_e({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=$ot++,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(Hot),this.nodes.forEach(Got),this.nodes.forEach(Kot),this.nodes.forEach(Vot)},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 _ot)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Lj),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=L9e(o)&&!Mit(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;Do.read(()=>{f=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,d&&d(),d=Eot(x,250),kO.hasAnimatedSinceResize&&(kO.hasAnimatedSinceResize=!1,this.nodes.forEach(Qpe)))})}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()||Jot,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),N=!this.targetLayout||!v_e(this.targetLayout,g),I=!f&&x;if(this.options.layoutRoot||this.resumeFrom||I||f&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const P={...nae(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P),this.setAnimationOrigin(d,I)}else f||Qpe(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Qy(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Yot),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&&w_e(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(Ype);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Xpe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(qot),this.nodes.forEach(Uot),this.nodes.forEach(zot)):this.nodes.forEach(Xpe),this.clearAllSnapshots();const l=sf.now();eu.delta=Dc(0,1e3/60,l-eu.timestamp),eu.timestamp=l,eu.isProcessing=!0,PH.update.process(eu),PH.preRender.process(eu),PH.render.process(eu),eu.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,sae.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Wot),this.sharedNodes.forEach(Xot)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Do.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Do.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=yl(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!y_e(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Uv(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),elt(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return yl();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(tlt))){const{scroll:d}=this.root;d&&(JC(l.x,d.offset.x),JC(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=yl();if(Nh(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:x}=d;d!==this.root&&f&&x.layoutScroll&&(f.wasRoot&&Nh(l,o),JC(l.x,f.offset.x),JC(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=yl();Nh(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&e4(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Uv(d.latestValues)&&e4(c,d.latestValues)}return Uv(this.latestValues)&&e4(c,this.latestValues),c}removeTransform(o){const l=yl();Nh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Uv(u.latestValues))continue;hJ(u.latestValues)&&u.updateSnapshot();const d=yl(),f=u.measurePageBox();Nh(d,f),Hpe(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Uv(this.latestValues)&&Hpe(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=yl(),this.relativeTargetOrigin=yl(),C9(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Nh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=yl(),this.targetWithTransforms=yl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),oot(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Nh(this.target,this.layout.layoutBox),e_e(this.target,this.targetDelta)):Nh(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=yl(),this.relativeTargetOrigin=yl(),C9(this.relativeTargetOrigin,this.target,g.target),Nh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||hJ(this.parent.latestValues)||J9e(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;Nh(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,x=this.treeScale.y;yat(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=yl());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():($pe(this.prevProjectionDelta.x,this.projectionDelta.x),$pe(this.prevProjectionDelta.y,this.projectionDelta.y)),w9(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!Kpe(this.projectionDelta.x,this.prevProjectionDelta.x)||!Kpe(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=t4(),this.projectionDelta=t4(),this.projectionDeltaWithTransform=t4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=t4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const x=yl(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,v=g!==y,C=this.getStack(),N=!C||C.members.length<=1,I=!!(v&&!N&&this.options.crossfade===!0&&!this.path.some(Zot));this.animationProgress=0;let P;this.mixTargetDelta=M=>{const F=M/1e3;Zpe(f.x,o.x,F),Zpe(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(C9(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Qot(this.relativeTarget,this.relativeTargetOrigin,x,F),P&&Rot(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=yl()),Nh(P,this.relativeTarget)),v&&(this.animationValues=d,Tot(d,u,this.latestValues,F,I,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Qy(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Do.update(()=>{kO.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ZS(0)),this.currentAnimation=jot(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(Bot),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&&S_e(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||yl();const f=dd(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const x=dd(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+x}Nh(l,c),e4(l,d),w9(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Lot),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&&HH("z",o,u,this.animationValues);for(let d=0;d<zH.length;d++)HH(`rotate${zH[d]}`,o,u,this.animationValues),HH(`skew${zH[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=EO(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=EO(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Uv(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=Dot(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 p_){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:N}=p_[y],I=f==="none"?d[y]:v(d[y],u);if(C){const P=C.length;for(let M=0;M<P;M++)o[C[M]]=I}else N?this.options.visualElement.renderState.vars[y]=I:o[y]=I}this.options.layoutId&&(o.pointerEvents=u===this?EO(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(Ype),this.root.sharedNodes.clear()}}}function Uot(t){t.updateLayout()}function zot(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}):S_e(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=t4();w9(l,r,e.layoutBox);const c=t4();o?w9(c,t.applyTransform(s,!0),e.measuredBox):w9(c,r,e.layoutBox);const u=!y_e(l);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:x,layout:g}=f;if(x&&g){const y=yl();C9(y,e.layoutBox,x.layoutBox);const v=yl();C9(v,r,g.layoutBox),v_e(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 Hot(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 Vot(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Wot(t){t.clearSnapshot()}function Ype(t){t.clearMeasurements()}function Xpe(t){t.isLayoutDirty=!1}function qot(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Qpe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Got(t){t.resolveTargetDelta()}function Kot(t){t.calcProjection()}function Yot(t){t.resetSkewAndRotation()}function Xot(t){t.removeLeadSnapshot()}function Zpe(t,e,n){t.translate=qo(e.translate,0,n),t.scale=qo(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Jpe(t,e,n,r){t.min=qo(e.min,n.min,r),t.max=qo(e.max,n.max,r)}function Qot(t,e,n,r){Jpe(t.x,e.x,n.x,r),Jpe(t.y,e.y,n.y,r)}function Zot(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Jot={duration:.45,ease:[.4,0,.1,1]},eme=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tme=eme("applewebkit/")&&!eme("chrome/")?Math.round:dl;function nme(t){t.min=tme(t.min),t.max=tme(t.max)}function elt(t){nme(t.x),nme(t.y)}function S_e(t,e,n){return t==="position"||t==="preserve-aspect"&&!aot(Gpe(e),Gpe(n),.2)}function tlt(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const nlt=C_e({attachResizeListener:(t,e)=>m_(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),VH={current:void 0},N_e=C_e({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!VH.current){const t=new nlt({});t.mount(window),t.setOptions({layoutScroll:!0}),VH.current=t}return VH.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rlt={pan:{Feature:wot},drag:{Feature:vot,ProjectionNode:N_e,MeasureLayout:x_e}};function rme(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&&Do.postRender(()=>a(e,cT(e)))}let slt=class extends w2{mount(){const{current:e}=this.node;e&&(this.unmount=Tit(e,(n,r)=>(rme(this.node,r,"Start"),s=>rme(this.node,s,"End"))))}unmount(){}},ilt=class extends w2{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vx(m_(this.node.current,"focus",()=>this.onFocus()),m_(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function sme(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&&Do.postRender(()=>a(e,cT(e)))}let alt=class extends w2{mount(){const{current:e}=this.node;e&&(this.unmount=Oit(e,(n,r)=>(sme(this.node,r,"Start"),(s,{success:a})=>sme(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}};const vJ=new WeakMap,WH=new WeakMap,olt=t=>{const e=vJ.get(t.target);e&&e(t)},llt=t=>{t.forEach(olt)};function clt({root:t,...e}){const n=t||document;WH.has(n)||WH.set(n,{});const r=WH.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(llt,{root:t,...e})),r[s]}function ult(t,e,n){const r=clt(e);return vJ.set(t,n),r.observe(t),()=>{vJ.delete(t),r.unobserve(t)}}const dlt={some:0,all:1};let flt=class extends w2{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:a}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:dlt[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 ult(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(hlt(e,n))&&this.startObserver()}unmount(){}};function hlt({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const plt={inView:{Feature:flt},tap:{Feature:alt},focus:{Feature:ilt},hover:{Feature:slt}},mlt={layout:{ProjectionNode:N_e,MeasureLayout:x_e}},xlt={...eot,...plt,...rlt,...mlt},pm=xat(xlt,kat),ime={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 u3({label:t="NEW",tone:e="yellow"}){const n=ime[e]??ime.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 glt({label:t,items:e=[],activePaths:n=[],badgeLabel:r,badgeTone:s="yellow",align:a="left",border_color:o=""}){var f,x;const{pathname:l}=Xl(),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(Ie.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(LB,{as:"div",className:"relative hidden sm:inline-block text-left",children:[i.jsxs(MB,{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(u3,{label:r,tone:s}):null,i.jsx(u_,{"aria-hidden":"true",className:"-mr-1 size-5 text-gray-400"})]}),i.jsx(RB,{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(XC,{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(u_,{className:"size-4 -rotate-90 text-gray-400"})]}),i.jsx("div",{className:"absolute top-0 left-full hidden group-hover:block z-50 px-2",children:i.jsx("div",{className:"min-w-[220px] bg-[#1A1A1A] rounded-2xl shadow border border-[#242424] p-1.5",children:g.submenu.map((C,N)=>C.to?i.jsx(mhe,{to:C.to,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl flex justify-between items-center",children:i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:C.label})},`sub-to-${N}`):i.jsxs("button",{onClick:C.onClick,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl flex justify-start items-center",children:[i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:C.label}),C.badge&&i.jsx(u3,{tone:"emerald",label:C.badge})]},`sub-btn-${N}`))})})]},`flyout-${y}`);const v=()=>i.jsx("div",{className:"flex justify-between items-center gap-6 w-full",children:i.jsxs("div",{className:"text-white text-[13px] font-semibold font-manrope flex items-center gap-2",children:[d(g.icon),i.jsxs("span",{className:"flex items-center gap-2",children:[g.label,g.description?i.jsxs("span",{className:"text-[10.5px] text-[#ffffff] font-semibold",children:["(",g.description,")"]}):null]}),g.badge&&i.jsx(u3,{tone:"emerald",label:g.badge})]})});return g.to?i.jsx(XC,{children:i.jsx(mhe,{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(XC,{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(XC,{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 Uj=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"121",height:"32",viewBox:"0 0 32 32",fill:"none",className:t,children:[i.jsx("path",{d:"M9.13309 30.4398L9.88315 26.9871C10.7197 23.1362 7.77521 19.4988 3.82118 19.4988H0.385363C1.4689 24.3374 4.75127 28.3496 9.13309 30.4398Z",fill:"currentColor"}),i.jsx("path",{d:"M10.64 31.0663C12.3326 31.6707 14.1567 32 16.0579 32C23.7199 32 30.1285 26.6527 31.7305 19.4988H21.249C16.5244 19.4988 12.4396 22.7824 11.44 27.3838L10.64 31.0663Z",fill:"currentColor"}),i.jsx("path",{d:"M32.0038 17.8987C32.0778 17.2756 32.1159 16.6415 32.1159 15.9985C32.1159 7.60402 25.629 0.719287 17.3779 0.0503251L15.1273 10.4105C14.2907 14.2614 17.2352 17.8987 21.1892 17.8987H32.0038Z",fill:"currentColor"}),i.jsx("path",{d:"M15.7459 0C7.02134 0.165717 0 7.26504 0 15.9985C0 16.6415 0.0380539 17.2756 0.112041 17.8987H3.76146C8.48603 17.8987 12.5709 14.6151 13.5705 10.0137L15.7459 0Z",fill:"currentColor"}),i.jsxs("defs",{children:[i.jsxs("linearGradient",{id:"paint0_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint1_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint2_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint3_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]})]})]}),M0=({className:t})=>i.jsxs("svg",{viewBox:"0 0 53 96",fill:"currentColor",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:`size-full ${t}`,children:[i.jsx("path",{d:"M23 76.3751L0 96V20.687L23 0V76.3751Z"}),i.jsx("path",{d:"M53 76.4219L30 96V66.6279L53 46V76.4219Z"})]}),blt="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",Ki="/assets/dextrabotIcon-B5aLRkPC.png",ylt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%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",vlt="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",za="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0.5'%20y='0.5'%20width='39'%20height='39'%20rx='19.5'%20fill='%23232323'/%3e%3crect%20x='0.5'%20y='0.5'%20width='39'%20height='39'%20rx='19.5'%20stroke='%23ACACAC'%20style='mix-blend-mode:color-dodge'/%3e%3cpath%20d='M21.1515%2013.9091C21.1515%2012.3024%2022.454%2011%2024.0606%2011C25.6673%2011%2026.9697%2012.3024%2026.9697%2013.9091C26.9697%2015.5157%2025.6673%2016.8182%2024.0606%2016.8182C22.454%2016.8182%2021.1515%2015.5157%2021.1515%2013.9091Z'%20fill='%236C6C6C'/%3e%3cpath%20d='M17.5365%2017.017C17.2707%2016.5917%2016.8045%2016.3333%2016.303%2016.3333C15.8015%2016.3333%2015.3354%2016.5917%2015.0696%2017.017L10.2211%2024.7745C9.94085%2025.2229%209.92601%2025.7881%2010.1823%2026.2506C10.4387%2026.7131%2010.9258%2027%2011.4545%2027H26.9697C27.5206%2027%2028.0243%2026.6887%2028.2707%2026.1959C28.5171%2025.7032%2028.4639%2025.1135%2028.1333%2024.6727L25.2243%2020.7939C24.9496%2020.4277%2024.5184%2020.2121%2024.0606%2020.2121C23.6028%2020.2121%2023.1717%2020.4277%2022.897%2020.7939L21.2607%2022.9757L17.5365%2017.017Z'%20fill='%236C6C6C'/%3e%3c/svg%3e",Ua="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.6568%2017.6568L6.34314%206.34314'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20/%3e%3cpath%20d='M17.6569%206.34314L6.34315%2017.6568'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20/%3e%3c/svg%3e",_o="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",wlt="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",P1="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",j_e="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",Clt="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",Slt="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",Kl="/assets/noDataNewIcon-D33nv6-9.svg",zj="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",j5="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",Nlt="/assets/referralBgIcon-C-Csekzm.svg",A5="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1635_11489)'%3e%3cpath%20d='M7.58763%209.47632C8.45415%209.97644%208.8874%2010.2265%209.36324%2010.2269C9.83905%2010.2273%2010.2727%209.97802%2011.1401%209.47942L16.6693%206.30109C16.9189%206.15761%2017.0728%205.89166%2017.0728%205.60374C17.0728%205.31582%2016.9189%205.04987%2016.6693%204.90639L11.1381%201.7269C10.2717%201.22883%209.83844%200.979795%209.3631%200.979981C8.88773%200.980166%208.45471%201.22954%207.58863%201.72828L2.83367%204.4665C2.79841%204.4868%202.7808%204.49696%202.76438%204.50657C1.14012%205.45741%200.136601%207.19333%200.123183%209.07539C0.123047%209.09441%200.123047%209.11474%200.123047%209.15542C0.123047%209.19601%200.123047%209.21634%200.123182%209.23534C0.136571%2011.1153%201.13785%2012.8496%202.75921%2013.8012C2.7756%2013.8108%202.79321%2013.8209%202.82838%2013.8413L5.80688%2015.561C7.54244%2016.563%208.41021%2017.064%209.36318%2017.0644C10.3161%2017.0647%2011.1843%2016.5642%2012.9205%2015.5633L16.0647%2013.7508C16.9341%2013.2496%2017.3688%2012.9991%2017.6074%2012.5859C17.8461%2012.1728%2017.8461%2011.6711%2017.8461%2010.6676V8.72907C17.8461%208.4507%2017.6954%208.19416%2017.4521%208.05869C17.2168%207.92762%2016.9299%207.92956%2016.6964%208.06381L10.2491%2011.7699C9.81659%2012.0185%209.60028%2012.1429%209.36296%2012.1429C9.12561%2012.143%208.90925%2012.0188%208.47653%2011.7704L4.11289%209.2656C3.89431%209.14013%203.78501%209.07738%203.69722%209.06605C3.49709%209.04022%203.30466%209.15234%203.22842%209.33918C3.195%209.42113%203.19566%209.54715%203.19702%209.79918C3.19802%209.98472%203.19851%2010.0775%203.21585%2010.1628C3.2547%2010.3539%203.35522%2010.527%203.50202%2010.6553C3.56757%2010.7127%203.6479%2010.7591%203.80863%2010.8518L8.47406%2013.5445C8.90792%2013.7949%209.12483%2013.9201%209.36302%2013.9202C9.60122%2013.9202%209.81822%2013.7952%2010.2522%2013.545L15.9706%2010.2487C16.1189%2010.1632%2016.193%2010.1205%2016.2486%2010.1526C16.3041%2010.1847%2016.3041%2010.2703%2016.3041%2010.4414V11.3206C16.3041%2011.5715%2016.3041%2011.6969%2016.2445%2011.8002C16.1848%2011.9035%2016.0761%2011.9661%2015.8588%2012.0914L11.1422%2014.8103C10.2738%2015.3108%209.83968%2015.5611%209.36313%2015.5608C8.88654%2015.5606%208.4526%2015.31%207.58475%2014.8086L3.17196%2012.2596C3.15794%2012.2514%203.15094%2012.2474%203.1444%2012.2436C2.21916%2011.7029%201.64824%2010.7138%201.64288%209.64217C1.64285%209.63461%201.64285%209.62652%201.64285%209.61032V8.8032C1.64285%208.21161%201.95792%207.6648%202.46974%207.36813C2.92201%207.10599%203.47987%207.10547%203.93261%207.36677L7.58763%209.47632Z'%20fill='%23F2F7F7'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_1635_11489'%3e%3crect%20width='18'%20height='18'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",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",KM="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",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%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",Alt="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",_lt="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",Elt="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",YM="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",XM="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",Hj="/assets/sharePnlGreenIcon-CwGFUwvO.svg",Vj="/assets/sharePnlRedIcon-NsgQBTQF.svg",Wj="/assets/dextrabotShareIcon-DbUzC8hq.png",klt="/assets/buttonHyperrIcon-BEIlirim.png",ame="/assets/mushroomRed-DlifwotO.svg",ome="/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",Tlt="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",Ilt="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",Hl="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",mae="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",Plt="/assets/copyTradeBanner-Bzh6f0rX.svg",Flt="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",lme="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",xae="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",Olt="/assets/introductionModalIcon-C3qCLVbZ.svg",Mlt="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",Rlt="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",Llt="/assets/dextrabot-copy-trade-hyperliquid-BgdeQSj5.png",Dlt="/assets/dextrabot-position-copy-Ph5ntD17.png",Blt="/assets/dextrabot-referral-rewards-CvRzGBKC.png",$lt="/assets/hyperliquid-discover-wallets-CgeXGTl5.svg",Ult="/assets/dextrabot-telegram-alerts-CJHcZn29.png",zlt="/assets/hyperliquid-wallet-analysis-DwEnicpm.png",Hlt="/assets/dextrabot-discover-wallets-filters-BSnYa19g.svg",Vlt="/assets/hyperliquid-trading-metrics-Cwsy4rqz.svg",Wlt="/assets/dextrabot-risk-parameters-DzTb7mB0.svg",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%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",qH="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",Glt="/assets/dextrabotNewLogoIcon-V6eDxoac.png",gae="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",Klt="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",Ylt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='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",Xlt="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",Qlt="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",A_e="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",Zlt="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",__e="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",Jlt="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",ect="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",tct="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",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='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",E_e="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=",rct="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",sct="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",ict="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",cme="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",wJ="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",CJ="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",act="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",oct="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",qj="/assets/dextrabotIcon64x64-CGBWeHNW.png",lct="/assets/telegramfilterIcon-D3R-nSo1.svg",cct="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",x_="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",g_="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",uct="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",bae="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",dct="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",fct="/assets/telegramModalIcon-CwWiyADO.png",k_e="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",T_e="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",ume="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",I_e="/assets/basedLogoSvgIcon-C71QETXb.png",uT="/assets/variationalIcon-VFI-7A--.png",yae="/assets/apexIcon-pUC7_jPm.png",dT="/assets/paradexIcon-gNYlng5D.jpg",hct="/assets/basedAppIcon-xn9d9rQz.jpg",pct="/assets/pacificaErrorImage-BKGQKjSV.jpeg",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",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{label:"Lighter Grid Bot",to:"/terminal/lighter/BTC#gridbot",icon:M0},{label:"HL Grid Bot",to:"/terminal/hyperliquid/BTC#gridbot",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg"},{label:"HL Market Maker Bot",to:"/market-maker",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg"},{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:uT},{label:"Paradex",action:"openParadex",description:"",icon:dT},{label:"Lighter",action:"openLighter",description:"Delta Neutral vs Variational",icon:M0},{label:"Pacifica",action:"openPacifica",description:"",icon:"https://app.pacifica.fi/imgs/icon.svg"},{label:"Apex",action:"openApex",description:"",icon:yae},{label:"Aster",action:"openAster",description:"",icon:Uj}]}];function O3(t){"@babel/helpers - typeof";return O3=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},O3(t)}function xct(t,e){if(O3(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(O3(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function P_e(t){var e=xct(t,"string");return O3(e)=="symbol"?e:e+""}function U7(t,e,n){return(e=P_e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dme(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 Zs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dme(Object(n),!0).forEach(function(r){U7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dme(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gct(t){if(Array.isArray(t))return t}function bct(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 SJ(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 F_e(t,e){if(t){if(typeof t=="string")return SJ(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)?SJ(t,e):void 0}}function yct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e1(t,e){return gct(t)||bct(t,e)||F_e(t,e)||yct()}function vct(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.includes(r))continue;n[r]=t[r]}return n}function F1(t,e){if(t==null)return{};var n,r,s=vct(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 wct=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Cct(t){var e=t.defaultInputValue,n=e===void 0?"":e,r=t.defaultMenuIsOpen,s=r===void 0?!1:r,a=t.defaultValue,o=a===void 0?null:a,l=t.inputValue,c=t.menuIsOpen,u=t.onChange,d=t.onInputChange,f=t.onMenuClose,x=t.onMenuOpen,g=t.value,y=F1(t,wct),v=h.useState(l!==void 0?l:n),C=e1(v,2),N=C[0],I=C[1],P=h.useState(c!==void 0?c:s),M=e1(P,2),F=M[0],$=M[1],L=h.useState(g!==void 0?g:o),z=e1(L,2),Q=z[0],se=z[1],ee=h.useCallback(function(q,W){typeof u=="function"&&u(q,W),se(q)},[u]),K=h.useCallback(function(q,W){var ne;typeof d=="function"&&(ne=d(q,W)),I(ne!==void 0?ne:q)},[d]),re=h.useCallback(function(){typeof x=="function"&&x(),$(!0)},[x]),de=h.useCallback(function(){typeof f=="function"&&f(),$(!1)},[f]),G=l!==void 0?l:N,ie=c!==void 0?c:F,ae=g!==void 0?g:Q;return Zs(Zs({},y),{},{inputValue:G,menuIsOpen:ie,onChange:ee,onInputChange:K,onMenuClose:de,onMenuOpen:re,value:ae})}function ii(){return ii=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},ii.apply(null,arguments)}function Sct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fme(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,P_e(r.key),r)}}function Nct(t,e,n){return fme(t.prototype,e),fme(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function NJ(t,e){return NJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},NJ(t,e)}function jct(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&&NJ(t,e)}function QM(t){return QM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},QM(t)}function O_e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O_e=function(){return!!t})()}function Act(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _ct(t,e){if(e&&(O3(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Act(t)}function Ect(t){var e=O_e();return function(){var n,r=QM(t);if(e){var s=QM(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return _ct(this,n)}}function kct(t){if(Array.isArray(t))return SJ(t)}function Tct(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ict(){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 vae(t){return kct(t)||Tct(t)||F_e(t)||Ict()}function Pct(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 Fct(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 Oct=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(Fct(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Pct(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-",ZM="-moz-",Na="-webkit-",M_e="comm",wae="rule",Cae="decl",Mct="@import",R_e="@keyframes",Rct="@layer",Lct=Math.abs,WB=String.fromCharCode,Dct=Object.assign;function Bct(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 L_e(t){return t.trim()}function $ct(t,e){return(t=e.exec(t))?t[0]:t}function ja(t,e,n){return t.replace(e,n)}function jJ(t,e){return t.indexOf(e)}function nu(t,e){return t.charCodeAt(e)|0}function b_(t,e,n){return t.slice(e,n)}function A0(t){return t.length}function Sae(t){return t.length}function gP(t,e){return e.push(t),t}function Uct(t,e){return t.map(e).join("")}var qB=1,eN=1,D_e=0,xf=0,Vl=0,Gj="";function GB(t,e,n,r,s,a,o){return{value:t,root:e,parent:n,type:r,props:s,children:a,line:qB,column:eN,length:o,return:""}}function HA(t,e){return Dct(GB("",null,null,"",null,null,0),t,{length:-t.length},e)}function zct(){return Vl}function Hct(){return Vl=xf>0?nu(Gj,--xf):0,eN--,Vl===10&&(eN=1,qB--),Vl}function Zf(){return Vl=xf<D_e?nu(Gj,xf++):0,eN++,Vl===10&&(eN=1,qB++),Vl}function q0(){return nu(Gj,xf)}function TO(){return xf}function fT(t,e){return b_(Gj,t,e)}function y_(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 B_e(t){return qB=eN=1,D_e=A0(Gj=t),xf=0,[]}function $_e(t){return Gj="",t}function IO(t){return L_e(fT(xf-1,AJ(t===91?t+2:t===40?t+1:t)))}function Vct(t){for(;(Vl=q0())&&Vl<33;)Zf();return y_(t)>2||y_(Vl)>3?"":" "}function Wct(t,e){for(;--e&&Zf()&&!(Vl<48||Vl>102||Vl>57&&Vl<65||Vl>70&&Vl<97););return fT(t,TO()+(e<6&&q0()==32&&Zf()==32))}function AJ(t){for(;Zf();)switch(Vl){case t:return xf;case 34:case 39:t!==34&&t!==39&&AJ(Vl);break;case 40:t===41&&AJ(t);break;case 92:Zf();break}return xf}function qct(t,e){for(;Zf()&&t+Vl!==57;)if(t+Vl===84&&q0()===47)break;return"/*"+fT(e,xf-1)+"*"+WB(t===47?t:Zf())}function Gct(t){for(;!y_(q0());)Zf();return fT(t,xf)}function Kct(t){return $_e(PO("",null,null,null,[""],t=B_e(t),0,[0],t))}function PO(t,e,n,r,s,a,o,l,c){for(var u=0,d=0,f=o,x=0,g=0,y=0,v=1,C=1,N=1,I=0,P="",M=s,F=a,$=r,L=P;C;)switch(y=I,I=Zf()){case 40:if(y!=108&&nu(L,f-1)==58){jJ(L+=ja(IO(I),"&","&\f"),"&\f")!=-1&&(N=-1);break}case 34:case 39:case 91:L+=IO(I);break;case 9:case 10:case 13:case 32:L+=Vct(y);break;case 92:L+=Wct(TO()-1,7);continue;case 47:switch(q0()){case 42:case 47:gP(Yct(qct(Zf(),TO()),e,n),c);break;default:L+="/"}break;case 123*v:l[u++]=A0(L)*N;case 125*v:case 59:case 0:switch(I){case 0:case 125:C=0;case 59+d:N==-1&&(L=ja(L,/\f/g,"")),g>0&&A0(L)-f&&gP(g>32?pme(L+";",r,n,f-1):pme(ja(L," ","")+";",r,n,f-2),c);break;case 59:L+=";";default:if(gP($=hme(L,e,n,u,d,s,l,P,M=[],F=[],f),a),I===123)if(d===0)PO(L,e,$,$,M,a,f,l,F);else switch(x===99&&nu(L,3)===110?100:x){case 100:case 108:case 109:case 115:PO(t,$,$,r&&gP(hme(t,$,$,0,0,s,l,P,s,M=[],f),F),s,F,f,l,r?M:F);break;default:PO(L,$,$,$,[""],F,0,l,F)}}u=d=g=0,v=N=1,P=L="",f=o;break;case 58:f=1+A0(L),g=y;default:if(v<1){if(I==123)--v;else if(I==125&&v++==0&&Hct()==125)continue}switch(L+=WB(I),I*v){case 38:N=d>0?1:(L+="\f",-1);break;case 44:l[u++]=(A0(L)-1)*N,N=1;break;case 64:q0()===45&&(L+=IO(Zf())),x=q0(),d=f=A0(P=L+=Gct(TO())),I++;break;case 45:y===45&&A0(L)==2&&(v=0)}}return a}function hme(t,e,n,r,s,a,o,l,c,u,d){for(var f=s-1,x=s===0?a:[""],g=Sae(x),y=0,v=0,C=0;y<r;++y)for(var N=0,I=b_(t,f+1,f=Lct(v=o[y])),P=t;N<g;++N)(P=L_e(v>0?x[N]+" "+I:ja(I,/&\f/g,x[N])))&&(c[C++]=P);return GB(t,e,n,s===0?wae:l,c,u,d)}function Yct(t,e,n){return GB(t,e,n,M_e,WB(zct()),b_(t,2,-2),0)}function pme(t,e,n,r){return GB(t,e,n,Cae,b_(t,0,r),b_(t,r+1,-1),r)}function w4(t,e){for(var n="",r=Sae(t),s=0;s<r;s++)n+=e(t[s],s,t,e)||"";return n}function Xct(t,e,n,r){switch(t.type){case Rct:if(t.children.length)break;case Mct:case Cae:return t.return=t.return||t.value;case M_e:return"";case R_e:return t.return=t.value+"{"+w4(t.children,r)+"}";case wae:t.value=t.props.join(",")}return A0(n=w4(t.children,r))?t.return=t.value+"{"+n+"}":""}function Qct(t){var e=Sae(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 Zct(t){return function(e){e.root||(e=e.return)&&t(e)}}function Jct(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var eut=function(e,n,r){for(var s=0,a=0;s=a,a=q0(),s===38&&a===12&&(n[r]=1),!y_(a);)Zf();return fT(e,xf)},tut=function(e,n){var r=-1,s=44;do switch(y_(s)){case 0:s===38&&q0()===12&&(n[r]=1),e[r]+=eut(xf-1,n,r);break;case 2:e[r]+=IO(s);break;case 4:if(s===44){e[++r]=q0()===58?"&\f":"",n[r]=e[r].length;break}default:e[r]+=WB(s)}while(s=Zf());return e},nut=function(e,n){return $_e(tut(B_e(e),n))},mme=new WeakMap,rut=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&&!mme.get(r))&&!s){mme.set(e,!0);for(var a=[],o=nut(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 U_e(t,e){switch(Bct(t,e)){case 5103:return Na+"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 Na+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Na+t+ZM+t+vu+t+t;case 6828:case 4268:return Na+t+vu+t+t;case 6165:return Na+t+vu+"flex-"+t+t;case 5187:return Na+t+ja(t,/(\w+).+(:[^]+)/,Na+"box-$1$2"+vu+"flex-$1$2")+t;case 5443:return Na+t+vu+"flex-item-"+ja(t,/flex-|-self/,"")+t;case 4675:return Na+t+vu+"flex-line-pack"+ja(t,/align-content|flex-|-self/,"")+t;case 5548:return Na+t+vu+ja(t,"shrink","negative")+t;case 5292:return Na+t+vu+ja(t,"basis","preferred-size")+t;case 6060:return Na+"box-"+ja(t,"-grow","")+Na+t+vu+ja(t,"grow","positive")+t;case 4554:return Na+ja(t,/([^-])(transform)/g,"$1"+Na+"$2")+t;case 6187:return ja(ja(ja(t,/(zoom-|grab)/,Na+"$1"),/(image-set)/,Na+"$1"),t,"")+t;case 5495:case 3959:return ja(t,/(image-set\([^]*)/,Na+"$1$`$1");case 4968:return ja(ja(t,/(.+:)(flex-)?(.*)/,Na+"box-pack:$3"+vu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Na+t+t;case 4095:case 3583:case 4068:case 2532:return ja(t,/(.+)-inline(.+)/,Na+"$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 ja(t,/(.+:)(.+)-([^]+)/,"$1"+Na+"$2-$3$1"+ZM+(nu(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~jJ(t,"stretch")?U_e(ja(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-(~jJ(t,"!important")&&10))){case 107:return ja(t,":",":"+Na)+t;case 101:return ja(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Na+(nu(t,14)===45?"inline-":"")+"box$3$1"+Na+"$2$3$1"+vu+"$2box$3")+t}break;case 5936:switch(nu(t,e+11)){case 114:return Na+t+vu+ja(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Na+t+vu+ja(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Na+t+vu+ja(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Na+t+vu+t+t}return t}var iut=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case Cae:e.return=U_e(e.value,e.length);break;case R_e:return w4([HA(e,{value:ja(e.value,"@","@"+Na)})],s);case wae:if(e.length)return Uct(e.props,function(a){switch($ct(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return w4([HA(e,{props:[ja(a,/:(read-\w+)/,":"+ZM+"$1")]})],s);case"::placeholder":return w4([HA(e,{props:[ja(a,/:(plac\w+)/,":"+Na+"input-$1")]}),HA(e,{props:[ja(a,/:(plac\w+)/,":"+ZM+"$1")]}),HA(e,{props:[ja(a,/:(plac\w+)/,vu+"input-$1")]})],s)}return""})}},aut=[iut],out=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(" "),N=1;N<C.length;N++)a[C[N]]=!0;l.push(v)});var c,u=[rut,sut];{var d,f=[Xct,Zct(function(v){d.insert(v)})],x=Qct(u.concat(s,f)),g=function(C){return w4(Kct(C),x)};c=function(C,N,I,P){d=I,g(C?C+"{"+N.styles+"}":N.styles),P&&(y.inserted[N.name]=!0)}}var y={key:n,sheet:new Oct({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},GH={exports:{}},Pa={};/** @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 xme;function lut(){if(xme)return Pa;xme=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,f=t?Symbol.for("react.suspense"):60113,x=t?Symbol.for("react.suspense_list"):60120,g=t?Symbol.for("react.memo"):60115,y=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,C=t?Symbol.for("react.fundamental"):60117,N=t?Symbol.for("react.responder"):60118,I=t?Symbol.for("react.scope"):60119;function P(F){if(typeof F=="object"&&F!==null){var $=F.$$typeof;switch($){case e:switch(F=F.type,F){case c:case u:case r:case a:case s:case f:return F;default:switch(F=F&&F.$$typeof,F){case l:case d:case y:case g:case o:return F;default:return $}}case n:return $}}}function M(F){return P(F)===u}return Pa.AsyncMode=c,Pa.ConcurrentMode=u,Pa.ContextConsumer=l,Pa.ContextProvider=o,Pa.Element=e,Pa.ForwardRef=d,Pa.Fragment=r,Pa.Lazy=y,Pa.Memo=g,Pa.Portal=n,Pa.Profiler=a,Pa.StrictMode=s,Pa.Suspense=f,Pa.isAsyncMode=function(F){return M(F)||P(F)===c},Pa.isConcurrentMode=M,Pa.isContextConsumer=function(F){return P(F)===l},Pa.isContextProvider=function(F){return P(F)===o},Pa.isElement=function(F){return typeof F=="object"&&F!==null&&F.$$typeof===e},Pa.isForwardRef=function(F){return P(F)===d},Pa.isFragment=function(F){return P(F)===r},Pa.isLazy=function(F){return P(F)===y},Pa.isMemo=function(F){return P(F)===g},Pa.isPortal=function(F){return P(F)===n},Pa.isProfiler=function(F){return P(F)===a},Pa.isStrictMode=function(F){return P(F)===s},Pa.isSuspense=function(F){return P(F)===f},Pa.isValidElementType=function(F){return typeof F=="string"||typeof F=="function"||F===r||F===u||F===a||F===s||F===f||F===x||typeof F=="object"&&F!==null&&(F.$$typeof===y||F.$$typeof===g||F.$$typeof===o||F.$$typeof===l||F.$$typeof===d||F.$$typeof===C||F.$$typeof===N||F.$$typeof===I||F.$$typeof===v)},Pa.typeOf=P,Pa}var gme;function cut(){return gme||(gme=1,GH.exports=lut()),GH.exports}var KH,bme;function uut(){if(bme)return KH;bme=1;var t=cut(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};a[t.ForwardRef]=r,a[t.Memo]=s;function o(y){return t.isMemo(y)?s:a[y.$$typeof]||e}var l=Object.defineProperty,c=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,x=Object.prototype;function g(y,v,C){if(typeof v!="string"){if(x){var N=f(v);N&&N!==x&&g(y,N,C)}var I=c(v);u&&(I=I.concat(u(v)));for(var P=o(y),M=o(v),F=0;F<I.length;++F){var $=I[F];if(!n[$]&&!(C&&C[$])&&!(M&&M[$])&&!(P&&P[$])){var L=d(v,$);try{l(y,$,L)}catch{}}}}return y}return KH=g,KH}uut();var dut=!0;function fut(t,e,n){var r="";return n.split(" ").forEach(function(s){t[s]!==void 0?e.push(t[s]+";"):s&&(r+=s+" ")}),r}var z_e=function(e,n,r){var s=e.key+"-"+n.name;(r===!1||dut===!1)&&e.registered[s]===void 0&&(e.registered[s]=n.styles)},hut=function(e,n,r){z_e(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 put(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},xut=/[A-Z]|^ms/g,gut=/_EMO_([^_]+?)_([^]*?)_EMO_/g,H_e=function(e){return e.charCodeAt(1)===45},yme=function(e){return e!=null&&typeof e!="boolean"},YH=Jct(function(t){return H_e(t)?t:t.replace(xut,"-$&").toLowerCase()}),vme=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(gut,function(r,s,a){return _0={name:s,styles:a,next:_0},s})}return mut[e]!==1&&!H_e(e)&&typeof n=="number"&&n!==0?n+"px":n};function v_(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 but(t,e,n)}case"function":{if(t!==void 0){var c=_0,u=n(t);return _0=c,v_(t,e,u)}break}}var d=n;return d}function but(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=v_(t,e,n[s])+";";else for(var a in n){var o=n[a];if(typeof o!="object"){var l=o;yme(l)&&(r+=YH(a)+":"+vme(a,l)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&e==null)for(var c=0;c<o.length;c++)yme(o[c])&&(r+=YH(a)+":"+vme(a,o[c])+";");else{var u=v_(t,e,o);switch(a){case"animation":case"animationName":{r+=YH(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}return r}var wme=/label:\s*([^\s;{]+)\s*(;|$)/g,_0;function V_e(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+=v_(n,e,a);else{var o=a;s+=o[0]}for(var l=1;l<t.length;l++)if(s+=v_(n,e,t[l]),r){var c=a;s+=c[l]}wme.lastIndex=0;for(var u="",d;(d=wme.exec(s))!==null;)u+="-"+d[1];var f=put(s)+u;return{name:f,styles:s,next:_0}}var yut=function(e){return e()},vut=Wy.useInsertionEffect?Wy.useInsertionEffect:!1,wut=vut||yut,W_e=h.createContext(typeof HTMLElement<"u"?out({key:"css"}):null);W_e.Provider;var Cut=function(e){return h.forwardRef(function(n,r){var s=h.useContext(W_e);return e(n,s,r)})},Sut=h.createContext({}),Nae={}.hasOwnProperty,_J="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Nut=function(e,n){var r={};for(var s in n)Nae.call(n,s)&&(r[s]=n[s]);return r[_J]=e,r},jut=function(e){var n=e.cache,r=e.serialized,s=e.isStringTag;return z_e(n,r,s),wut(function(){return hut(n,r,s)}),null},Aut=Cut(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=fut(e.registered,a,t.className):t.className!=null&&(o=t.className+" ");var l=V_e(a,void 0,h.useContext(Sut));o+=e.key+"-"+l.name;var c={};for(var u in t)Nae.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(jut,{cache:e,serialized:l,isStringTag:typeof s=="string"}),h.createElement(s,c))}),_ut=Aut,Ks=function(e,n){var r=arguments;if(n==null||!Nae.call(n,"css"))return h.createElement.apply(void 0,r);var s=r.length,a=new Array(s);a[0]=_ut,a[1]=Nut(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={}))})(Ks);function jae(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return V_e(e)}function Eut(){var t=jae.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 kut(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}const Tut=Math.min,Iut=Math.max,JM=Math.round,bP=Math.floor,eR=t=>({x:t,y:t});function KB(){return typeof window<"u"}function q_e(t){return K_e(t)?(t.nodeName||"").toLowerCase():"#document"}function p1(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function G_e(t){var e;return(e=(K_e(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function K_e(t){return KB()?t instanceof Node||t instanceof p1(t).Node:!1}function Put(t){return KB()?t instanceof Element||t instanceof p1(t).Element:!1}function Aae(t){return KB()?t instanceof HTMLElement||t instanceof p1(t).HTMLElement:!1}function Cme(t){return!KB()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof p1(t).ShadowRoot}function Y_e(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=_ae(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function Fut(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Out(t){return["html","body","#document"].includes(q_e(t))}function _ae(t){return p1(t).getComputedStyle(t)}function Mut(t){if(q_e(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Cme(t)&&t.host||G_e(t);return Cme(e)?e.host:e}function X_e(t){const e=Mut(t);return Out(e)?t.ownerDocument?t.ownerDocument.body:t.body:Aae(e)&&Y_e(e)?e:X_e(e)}function tR(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=X_e(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=p1(s);if(a){const l=EJ(o);return e.concat(o,o.visualViewport||[],Y_e(s)?s:[],l&&n?tR(l):[])}return e.concat(s,tR(s,[],n))}function EJ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Rut(t){const e=_ae(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Aae(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=JM(n)!==a||JM(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function Eae(t){return Put(t)?t:t.contextElement}function Sme(t){const e=Eae(t);if(!Aae(e))return eR(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=Rut(e);let o=(a?JM(n.width):n.width)/r,l=(a?JM(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Lut=eR(0);function Dut(t){const e=p1(t);return!Fut()||!e.visualViewport?Lut:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function But(t,e,n){return!1}function Nme(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),a=Eae(t);let o=eR(1);e&&(o=Sme(t));const l=But()?Dut(a):eR(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(a){const x=p1(a),g=r;let y=x,v=EJ(y);for(;v&&r&&g!==y;){const C=Sme(v),N=v.getBoundingClientRect(),I=_ae(v),P=N.left+(v.clientLeft+parseFloat(I.paddingLeft))*C.x,M=N.top+(v.clientTop+parseFloat(I.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=P,u+=M,y=p1(v),v=EJ(y)}}return c_({width:d,height:f,x:c,y:u})}function Q_e(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $ut(t,e){let n=null,r;const s=G_e(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=bP(f),v=bP(s.clientWidth-(d+x)),C=bP(s.clientHeight-(f+g)),N=bP(d),P={rootMargin:-y+"px "+-v+"px "+-C+"px "+-N+"px",threshold:Iut(0,Tut(1,c))||1};let M=!0;function F($){const L=$[0].intersectionRatio;if(L!==c){if(!M)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!Q_e(u,t.getBoundingClientRect())&&o(),M=!1}try{n=new IntersectionObserver(F,{...P,root:s.ownerDocument})}catch{n=new IntersectionObserver(F,P)}n.observe(t)}return o(!0),a}function Uut(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=Eae(t),d=s||a?[...u?tR(u):[],...tR(e)]:[];d.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),a&&N.addEventListener("resize",n)});const f=u&&l?$ut(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(N=>{let[I]=N;I&&I.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?Nme(t):null;c&&C();function C(){const N=Nme(t);v&&!Q_e(v,N)&&n(),v=N,y=requestAnimationFrame(C)}return n(),()=>{var N;d.forEach(I=>{s&&I.removeEventListener("scroll",n),a&&I.removeEventListener("resize",n)}),f==null||f(),(N=g)==null||N.disconnect(),g=null,c&&cancelAnimationFrame(y)}}var kJ=h.useLayoutEffect,zut=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],nR=function(){};function Hut(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function Vut(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(Hut(t,o)));return a.filter(function(l){return l}).map(function(l){return String(l).trim()}).join(" ")}var jme=function(e){return Jut(e)?e.filter(Boolean):O3(e)==="object"&&e!==null?[e]:[]},Z_e=function(e){e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme;var n=F1(e,zut);return Zs({},n)},fl=function(e,n,r){var s=e.cx,a=e.getStyles,o=e.getClassNames,l=e.className;return{css:a(n,e),className:s(r??{},o(n,e),l)}};function YB(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function Wut(t){return YB(t)?window.innerHeight:t.clientHeight}function J_e(t){return YB(t)?window.pageYOffset:t.scrollTop}function rR(t,e){if(YB(t)){window.scrollTo(0,e);return}t.scrollTop=e}function qut(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 Gut(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function yP(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:nR,s=J_e(t),a=e-s,o=10,l=0;function c(){l+=o;var u=Gut(l,s,a,n);rR(t,u),l<n?window.requestAnimationFrame(c):r(t)}c()}function Ame(t,e){var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=e.offsetHeight/3;r.bottom+s>n.bottom?rR(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s<n.top&&rR(t,Math.max(e.offsetTop-s,0))}function Kut(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 _me(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function Yut(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var eEe=!1,Xut={get passive(){return eEe=!0}},vP=typeof window<"u"?window:{};vP.addEventListener&&vP.removeEventListener&&(vP.addEventListener("p",nR,Xut),vP.removeEventListener("p",nR,!1));var Qut=eEe;function Zut(t){return t!=null}function Jut(t){return Array.isArray(t)}function wP(t,e,n){return t?e:n}var edt=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var a=Object.entries(e).filter(function(o){var l=e1(o,1),c=l[0];return!r.includes(c)});return a.reduce(function(o,l){var c=e1(l,2),u=c[0],d=c[1];return o[u]=d,o},{})},tdt=["children","innerProps"],ndt=["children","innerProps"];function rdt(t){var e=t.maxHeight,n=t.menuEl,r=t.minHeight,s=t.placement,a=t.shouldScroll,o=t.isFixedPosition,l=t.controlHeight,c=qut(n),u={placement:"bottom",maxHeight:e};if(!n||!n.offsetParent)return u;var d=c.getBoundingClientRect(),f=d.height,x=n.getBoundingClientRect(),g=x.bottom,y=x.height,v=x.top,C=n.offsetParent.getBoundingClientRect(),N=C.top,I=o?window.innerHeight:Wut(c),P=J_e(c),M=parseInt(getComputedStyle(n).marginBottom,10),F=parseInt(getComputedStyle(n).marginTop,10),$=N-F,L=I-v,z=$+P,Q=f-P-v,se=g-I+P+M,ee=P+v-F,K=160;switch(s){case"auto":case"bottom":if(L>=y)return{placement:"bottom",maxHeight:e};if(Q>=y&&!o)return a&&yP(c,se,K),{placement:"bottom",maxHeight:e};if(!o&&Q>=r||o&&L>=r){a&&yP(c,se,K);var re=o?L-M:Q-M;return{placement:"bottom",maxHeight:re}}if(s==="auto"||o){var de=e,G=o?$:z;return G>=r&&(de=Math.min(G-M-l,e)),{placement:"top",maxHeight:de}}if(s==="bottom")return a&&rR(c,se),{placement:"bottom",maxHeight:e};break;case"top":if($>=y)return{placement:"top",maxHeight:e};if(z>=y&&!o)return a&&yP(c,ee,K),{placement:"top",maxHeight:e};if(!o&&z>=r||o&&$>=r){var ie=e;return(!o&&z>=r||o&&$>=r)&&(ie=o?$-F:z-F),a&&yP(c,ee,K),{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 tEe=function(e){return e==="auto"?"bottom":e},idt=function(e,n){var r,s=e.placement,a=e.theme,o=a.borderRadius,l=a.spacing,c=a.colors;return Zs((r={label:"menu"},U7(r,sdt(s),"100%"),U7(r,"position","absolute"),U7(r,"width","100%"),U7(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})},nEe=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(nEe)||{},d=u.setPortalPlacement,f=h.useRef(null),x=h.useState(s),g=e1(x,2),y=g[0],v=g[1],C=h.useState(null),N=e1(C,2),I=N[0],P=N[1],M=c.spacing.controlHeight;return kJ(function(){var F=f.current;if(F){var $=o==="fixed",L=l&&!$,z=rdt({maxHeight:s,menuEl:F,minHeight:r,placement:a,shouldScroll:L,isFixedPosition:$,controlHeight:M});v(z.maxHeight),P(z.placement),d==null||d(z.placement)}},[s,a,o,l,r,d,M]),n({ref:f,placerProps:Zs(Zs({},e),{},{placement:I||tEe(a),maxHeight:y})})},odt=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return Ks("div",ii({},fl(e,"menu",{menu:!0}),{ref:r},s),n)},ldt=odt,cdt=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return Zs({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},udt=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,a=e.isMulti;return Ks("div",ii({},fl(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:s},r),n)},rEe=function(e,n){var r=e.theme,s=r.spacing.baseUnit,a=r.colors;return Zs({textAlign:"center"},n?{}:{color:a.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},ddt=rEe,fdt=rEe,hdt=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,a=F1(e,tdt);return Ks("div",ii({},fl(Zs(Zs({},a),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},pdt=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,a=F1(e,ndt);return Ks("div",ii({},fl(Zs(Zs({},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}},xdt=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(tEe(o)),f=e1(d,2),x=f[0],g=f[1],y=h.useMemo(function(){return{setPortalPlacement:g}},[]),v=h.useState(null),C=e1(v,2),N=C[0],I=C[1],P=h.useCallback(function(){if(s){var L=Kut(s),z=l==="fixed"?0:window.pageYOffset,Q=L[x]+z;(Q!==(N==null?void 0:N.offset)||L.left!==(N==null?void 0:N.rect.left)||L.width!==(N==null?void 0:N.rect.width))&&I({offset:Q,rect:L})}},[s,l,x,N==null?void 0:N.offset,N==null?void 0:N.rect.left,N==null?void 0:N.rect.width]);kJ(function(){P()},[P]);var M=h.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),s&&c.current&&(u.current=Uut(s,c.current,P,{elementResize:"ResizeObserver"in window}))},[s,P]);kJ(function(){M()},[M]);var F=h.useCallback(function(L){c.current=L,M()},[M]);if(!n&&l!=="fixed"||!N)return null;var $=Ks("div",ii({ref:F},fl(Zs(Zs({},e),{},{offset:N.offset,position:l,rect:N.rect}),"menuPortal",{"menu-portal":!0}),a),r);return Ks(nEe.Provider,{value:y},n?_a.createPortal($,n):$)},gdt=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},bdt=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,a=e.isRtl;return Ks("div",ii({},fl(e,"container",{"--is-disabled":s,"--is-rtl":a}),r),n)},ydt=function(e,n){var r=e.theme.spacing,s=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return Zs({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")})},vdt=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,a=e.hasValue;return Ks("div",ii({},fl(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":a}),r),n)},wdt=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Cdt=function(e){var n=e.children,r=e.innerProps;return Ks("div",ii({},fl(e,"indicatorsContainer",{indicators:!0}),r),n)},Eme,Sdt=["size"],Ndt=["innerProps","isRtl","size"],jdt={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},sEe=function(e){var n=e.size,r=F1(e,Sdt);return Ks("svg",ii({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:jdt},r))},kae=function(e){return Ks(sEe,ii({size:20},e),Ks("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"}))},iEe=function(e){return Ks(sEe,ii({size:20},e),Ks("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"}))},aEe=function(e,n){var r=e.isFocused,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return Zs({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?o.neutral60:o.neutral20,padding:a*2,":hover":{color:r?o.neutral80:o.neutral40}})},Adt=aEe,_dt=function(e){var n=e.children,r=e.innerProps;return Ks("div",ii({},fl(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ks(iEe,null))},Edt=aEe,kdt=function(e){var n=e.children,r=e.innerProps;return Ks("div",ii({},fl(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ks(kae,null))},Tdt=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return Zs({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?o.neutral10:o.neutral20,marginBottom:a*2,marginTop:a*2})},Idt=function(e){var n=e.innerProps;return Ks("span",ii({},n,fl(e,"indicatorSeparator",{"indicator-separator":!0})))},Pdt=Eut(Eme||(Eme=kut([`
0%, 80%, 100% { opacity: 0; }
40% { opacity: 1; }
`]))),Fdt=function(e,n){var r=e.isFocused,s=e.size,a=e.theme,o=a.colors,l=a.spacing.baseUnit;return Zs({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})},XH=function(e){var n=e.delay,r=e.offset;return Ks("span",{css:jae({animation:"".concat(Pdt," 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"},"","")})},Odt=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,a=s===void 0?4:s,o=F1(e,Ndt);return Ks("div",ii({},fl(Zs(Zs({},o),{},{innerProps:n,isRtl:r,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ks(XH,{delay:0,offset:r}),Ks(XH,{delay:160,offset:!0}),Ks(XH,{delay:320,offset:!r}))},Mdt=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.theme,o=a.colors,l=a.borderRadius,c=a.spacing;return Zs({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}})},Rdt=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.innerRef,o=e.innerProps,l=e.menuIsOpen;return Ks("div",ii({ref:a},fl(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":l}),o,{"aria-disabled":r||void 0}),n)},Ldt=Rdt,Ddt=["data"],Bdt=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},$dt=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 Ks("div",ii({},fl(e,"group",{group:!0}),c),Ks(o,ii({},l,{selectProps:f,theme:d,getStyles:s,getClassNames:a,cx:r}),u),Ks("div",null,n))},Udt=function(e,n){var r=e.theme,s=r.colors,a=r.spacing;return Zs({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"})},zdt=function(e){var n=Z_e(e);n.data;var r=F1(n,Ddt);return Ks("div",ii({},fl(e,"groupHeading",{"group-heading":!0}),r))},Hdt=$dt,Vdt=["innerRef","isDisabled","isHidden","inputClassName"],Wdt=function(e,n){var r=e.isDisabled,s=e.value,a=e.theme,o=a.spacing,l=a.colors;return Zs(Zs({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},qdt),n?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:l.neutral80})},oEe={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},qdt={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Zs({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},oEe)},Gdt=function(e){return Zs({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},oEe)},Kdt=function(e){var n=e.cx,r=e.value,s=Z_e(e),a=s.innerRef,o=s.isDisabled,l=s.isHidden,c=s.inputClassName,u=F1(s,Vdt);return Ks("div",ii({},fl(e,"input",{"input-container":!0}),{"data-value":r||""}),Ks("input",ii({className:n({input:!0},c),ref:a,style:Gdt(l),disabled:o},u)))},Ydt=Kdt,Xdt=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors;return Zs({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:s.baseUnit/2})},Qdt=function(e,n){var r=e.theme,s=r.borderRadius,a=r.colors,o=e.cropWithEllipsis;return Zs({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})},Zdt=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors,l=e.isFocused;return Zs({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}})},lEe=function(e){var n=e.children,r=e.innerProps;return Ks("div",r,n)},Jdt=lEe,eft=lEe;function tft(t){var e=t.children,n=t.innerProps;return Ks("div",ii({role:"button"},n),e||Ks(kae,{size:14}))}var nft=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 Ks(u,{data:s,innerProps:Zs(Zs({},fl(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:c},Ks(d,{data:s,innerProps:Zs({},fl(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),Ks(f,{data:s,innerProps:Zs(Zs({},fl(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},rft=nft,sft=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.theme,l=o.spacing,c=o.colors;return Zs({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}})},ift=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.innerRef,l=e.innerProps;return Ks("div",ii({},fl(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":a}),{ref:o,"aria-disabled":r},l),n)},aft=ift,oft=function(e,n){var r=e.theme,s=r.spacing,a=r.colors;return Zs({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:a.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},lft=function(e){var n=e.children,r=e.innerProps;return Ks("div",ii({},fl(e,"placeholder",{placeholder:!0}),r),n)},cft=lft,uft=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing,o=s.colors;return Zs({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})},dft=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return Ks("div",ii({},fl(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},fft=dft,ma={ClearIndicator:kdt,Control:Ldt,DropdownIndicator:_dt,DownChevron:iEe,CrossIcon:kae,Group:Hdt,GroupHeading:zdt,IndicatorsContainer:Cdt,IndicatorSeparator:Idt,Input:Ydt,LoadingIndicator:Odt,Menu:ldt,MenuList:udt,MenuPortal:xdt,LoadingMessage:pdt,NoOptionsMessage:hdt,MultiValue:rft,MultiValueContainer:Jdt,MultiValueLabel:eft,MultiValueRemove:tft,Option:aft,Placeholder:cft,SelectContainer:bdt,SingleValue:fft,ValueContainer:vdt},hft=function(e){return Zs(Zs({},ma),e.components)},kme=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function pft(t,e){return!!(t===e||kme(t)&&kme(e))}function mft(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!pft(t[n],e[n]))return!1;return!0}function xft(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 gft={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"},bft=function(e){return Ks("span",ii({css:gft},e))},Tme=bft,yft={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:"",".")}},vft=function(e){var n=e.ariaSelection,r=e.focusedOption,s=e.focusedValue,a=e.focusableOptions,o=e.isFocused,l=e.selectValue,c=e.selectProps,u=e.id,d=e.isAppleDevice,f=c.ariaLiveMessages,x=c.getOptionLabel,g=c.inputValue,y=c.isMulti,v=c.isOptionDisabled,C=c.isSearchable,N=c.menuIsOpen,I=c.options,P=c.screenReaderStatus,M=c.tabSelectsValue,F=c.isLoading,$=c["aria-label"],L=c["aria-live"],z=h.useMemo(function(){return Zs(Zs({},yft),f||{})},[f]),Q=h.useMemo(function(){var G="";if(n&&z.onChange){var ie=n.option,ae=n.options,q=n.removedValue,W=n.removedValues,ne=n.value,oe=function(je){return Array.isArray(je)?null:je},he=q||ie||oe(ne),_e=he?x(he):"",xe=ae||W||void 0,Se=xe?xe.map(x):[],ge=Zs({isDisabled:he&&v(he,l),label:_e,labels:Se},n);G=z.onChange(ge)}return G},[n,z,v,l,x]),se=h.useMemo(function(){var G="",ie=r||s,ae=!!(r&&l&&l.includes(r));if(ie&&z.onFocus){var q={focused:ie,label:x(ie),isDisabled:v(ie,l),isSelected:ae,options:a,context:ie===r?"menu":"value",selectValue:l,isAppleDevice:d};G=z.onFocus(q)}return G},[r,s,x,v,z,a,l,d]),ee=h.useMemo(function(){var G="";if(N&&I.length&&!F&&z.onFilter){var ie=P({count:a.length});G=z.onFilter({inputValue:g,resultsMessage:ie})}return G},[a,g,N,z,I,P,F]),K=(n==null?void 0:n.action)==="initial-input-focus",re=h.useMemo(function(){var G="";if(z.guidance){var ie=s?"value":N?"menu":"input";G=z.guidance({"aria-label":$,context:ie,isDisabled:r&&v(r,l),isMulti:y,isSearchable:C,tabSelectsValue:M,isInitialFocus:K})}return G},[$,r,s,y,v,C,N,z,l,M,K]),de=Ks(h.Fragment,null,Ks("span",{id:"aria-selection"},Q),Ks("span",{id:"aria-focused"},se),Ks("span",{id:"aria-results"},ee),Ks("span",{id:"aria-guidance"},re));return Ks(h.Fragment,null,Ks(Tme,{id:u},K&&de),Ks(Tme,{"aria-live":L,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!K&&de))},wft=vft,TJ=[{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źẑżžẓẕƶȥɀⱬꝣ"}],Cft=new RegExp("["+TJ.map(function(t){return t.letters}).join("")+"]","g"),cEe={};for(var QH=0;QH<TJ.length;QH++)for(var ZH=TJ[QH],JH=0;JH<ZH.letters.length;JH++)cEe[ZH.letters[JH]]=ZH.base;var uEe=function(e){return e.replace(Cft,function(n){return cEe[n]})},Sft=xft(uEe),Ime=function(e){return e.replace(/^\s+|\s+$/g,"")},Nft=function(e){return"".concat(e.label," ").concat(e.value)},jft=function(e){return function(n,r){if(n.data.__isNew__)return!0;var s=Zs({ignoreCase:!0,ignoreAccents:!0,stringify:Nft,trim:!0,matchFrom:"any"},e),a=s.ignoreCase,o=s.ignoreAccents,l=s.stringify,c=s.trim,u=s.matchFrom,d=c?Ime(r):r,f=c?Ime(l(n)):l(n);return a&&(d=d.toLowerCase(),f=f.toLowerCase()),o&&(d=Sft(d),f=uEe(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},Aft=["innerRef"];function _ft(t){var e=t.innerRef,n=F1(t,Aft),r=edt(n,"onExited","in","enter","exit","appear");return Ks("input",ii({ref:e},r,{css:jae({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 Eft=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function kft(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,N){if(u.current!==null){var I=u.current,P=I.scrollTop,M=I.scrollHeight,F=I.clientHeight,$=u.current,L=N>0,z=M-F-P,Q=!1;z>N&&o.current&&(r&&r(C),o.current=!1),L&&l.current&&(a&&a(C),l.current=!1),L&&N>z?(n&&!o.current&&n(C),$.scrollTop=M,Q=!0,o.current=!0):!L&&-N>P&&(s&&!l.current&&s(C),$.scrollTop=0,Q=!0,l.current=!0),Q&&Eft(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 N=c.current-C.changedTouches[0].clientY;d(C,N)},[d]),y=h.useCallback(function(C){if(C){var N=Qut?{passive:!1}:!1;C.addEventListener("wheel",f,N),C.addEventListener("touchstart",x,N),C.addEventListener("touchmove",g,N)}},[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 Pme=["boxSizing","height","overflow","paddingRight","position"],Fme={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Ome(t){t.cancelable&&t.preventDefault()}function Mme(t){t.stopPropagation()}function Rme(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Lme(){return"ontouchstart"in window||navigator.maxTouchPoints}var Dme=!!(typeof window<"u"&&window.document&&window.document.createElement),VA=0,rC={capture:!1,passive:!1};function Tft(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(Dme){var u=document.body,d=u&&u.style;if(r&&Pme.forEach(function(y){var v=d&&d[y];s.current[y]=v}),r&&VA<1){var f=parseInt(s.current.paddingRight,10)||0,x=document.body?document.body.clientWidth:0,g=window.innerWidth-x+f||0;Object.keys(Fme).forEach(function(y){var v=Fme[y];d&&(d[y]=v)}),d&&(d.paddingRight="".concat(g,"px"))}u&&Lme()&&(u.addEventListener("touchmove",Ome,rC),c&&(c.addEventListener("touchstart",Rme,rC),c.addEventListener("touchmove",Mme,rC))),VA+=1}},[r]),l=h.useCallback(function(c){if(Dme){var u=document.body,d=u&&u.style;VA=Math.max(VA-1,0),r&&VA<1&&Pme.forEach(function(f){var x=s.current[f];d&&(d[f]=x)}),u&&Lme()&&(u.removeEventListener("touchmove",Ome,rC),c&&(c.removeEventListener("touchstart",Rme,rC),c.removeEventListener("touchmove",Mme,rC)))}},[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 Ift=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},Pft={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Fft(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=kft({isEnabled:s,onBottomArrive:a,onBottomLeave:o,onTopArrive:l,onTopLeave:c}),d=Tft({isEnabled:n}),f=function(g){u(g),d(g)};return Ks(h.Fragment,null,n&&Ks("div",{onClick:Ift,css:Pft}),e(f))}var Oft={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Mft=function(e){var n=e.name,r=e.onFocus;return Ks("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:Oft,value:"",onChange:function(){}})},Rft=Mft;function Tae(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 Lft(){return Tae(/^iPhone/i)}function dEe(){return Tae(/^Mac/i)}function Dft(){return Tae(/^iPad/i)||dEe()&&navigator.maxTouchPoints>1}function Bft(){return Lft()||Dft()}function $ft(){return dEe()||Bft()}var Uft=function(e){return e.label},zft=function(e){return e.label},Hft=function(e){return e.value},Vft=function(e){return!!e.isDisabled},Wft={clearIndicator:Edt,container:gdt,control:Mdt,dropdownIndicator:Adt,group:Bdt,groupHeading:Udt,indicatorsContainer:wdt,indicatorSeparator:Tdt,input:Wdt,loadingIndicator:Fdt,loadingMessage:fdt,menu:idt,menuList:cdt,menuPortal:mdt,multiValue:Xdt,multiValueLabel:Qdt,multiValueRemove:Zdt,noOptionsMessage:ddt,option:sft,placeholder:oft,singleValue:uft,valueContainer:ydt},qft={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%)"},Gft=4,fEe=4,Kft=38,Yft=fEe*2,Xft={baseUnit:fEe,controlHeight:Kft,menuGutter:Yft},eV={borderRadius:Gft,colors:qft,spacing:Xft},Qft={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:_me(),captureMenuScroll:!_me(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:jft(),formatGroupLabel:Uft,getOptionLabel:zft,getOptionValue:Hft,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Vft,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Yut(),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 Bme(t,e,n,r){var s=mEe(t,e,n),a=xEe(t,e,n),o=pEe(t,e),l=sR(t,e);return{type:"option",data:e,isDisabled:s,isSelected:a,label:o,value:l,index:r}}function FO(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(o,l){return Bme(t,o,e,l)}).filter(function(o){return Ume(t,o)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var a=Bme(t,n,e,r);return Ume(t,a)?a:void 0}).filter(Zut)}function hEe(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,vae(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function $me(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,vae(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 Zft(t,e){return hEe(FO(t,e))}function Ume(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,a=e.isSelected,o=e.label,l=e.value;return(!bEe(t)||!a)&&gEe(t,{label:o,value:l,data:s},r)}function Jft(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 eht(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var tV=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},pEe=function(e,n){return e.getOptionLabel(n)},sR=function(e,n){return e.getOptionValue(n)};function mEe(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function xEe(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=sR(t,e);return n.some(function(s){return sR(t,s)===r})}function gEe(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var bEe=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},tht=1,yEe=function(t){jct(n,t);var e=Ect(n);function n(r){var s;if(Sct(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=$ft(),s.controlRef=null,s.getControlRef=function(c){s.controlRef=c},s.focusedOptionRef=null,s.getFocusedOptionRef=function(c){s.focusedOptionRef=c},s.menuListRef=null,s.getMenuListRef=function(c){s.menuListRef=c},s.inputRef=null,s.getInputRef=function(c){s.inputRef=c},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(c,u){var d=s.props,f=d.onChange,x=d.name;u.name=x,s.ariaOnChange(c,u),f(c,u)},s.setValue=function(c,u,d){var f=s.props,x=f.closeMenuOnSelect,g=f.isMulti,y=f.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:y}),x&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(c,{action:u,option:d})},s.selectOption=function(c){var u=s.props,d=u.blurInputOnSelect,f=u.isMulti,x=u.name,g=s.state.selectValue,y=f&&s.isOptionSelected(c,g),v=s.isOptionDisabled(c,g);if(y){var C=s.getOptionValue(c);s.setValue(g.filter(function(N){return s.getOptionValue(N)!==C}),"deselect-option",c)}else if(!v)f?s.setValue([].concat(vae(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=wP(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(wP(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=wP(c,f,f[0]||null);d&&s.onChange(x,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(c){return tV(s.state.focusableOptionsWithIds,c)},s.getFocusableOptionsWithIds=function(){return $me(FO(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 Vut.apply(void 0,[s.props.classNamePrefix].concat(u))},s.getOptionLabel=function(c){return pEe(s.props,c)},s.getOptionValue=function(c){return sR(s.props,c)},s.getStyles=function(c,u){var d=s.props.unstyled,f=Wft[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 hft(s.props)},s.buildCategorizedOptions=function(){return FO(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return hEe(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(c,u){s.setState({ariaSelection:Zs({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&&YB(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 bEe(s.props)},s.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),s.focus()},s.onKeyDown=function(c){var u=s.props,d=u.isMulti,f=u.backspaceRemovesValue,x=u.escapeClearsValue,g=u.inputValue,y=u.isClearable,v=u.isDisabled,C=u.menuIsOpen,N=u.onKeyDown,I=u.tabSelectsValue,P=u.openMenuOnFocus,M=s.state,F=M.focusedOption,$=M.focusedValue,L=M.selectValue;if(!v&&!(typeof N=="function"&&(N(c),c.defaultPrevented))){switch(s.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if($)s.removeValue($);else{if(!f)return;d?s.popValue():y&&s.clearValue()}break;case"Tab":if(s.isComposing||c.shiftKey||!C||!I||!F||P&&s.isOptionSelected(F,L))return;s.selectOption(F);break;case"Enter":if(c.keyCode===229)break;if(C){if(!F||s.isComposing)return;s.selectOption(F);break}return;case"Escape":C?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):y&&x&&s.clearValue();break;case" ":if(g)return;if(!C){s.openMenu("first");break}if(!F)return;s.selectOption(F);break;case"ArrowUp":C?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":C?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!C)return;s.focusOption("pageup");break;case"PageDown":if(!C)return;s.focusOption("pagedown");break;case"Home":if(!C)return;s.focusOption("first");break;case"End":if(!C)return;s.focusOption("last");break;default:return}c.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++tht),s.state.selectValue=jme(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=tV(a,o[l])}return s}return Nct(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&&Ame(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&&(Ame(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(eV):Zs(Zs({},eV),this.props.theme):eV}},{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 mEe(this.props,s,a)}},{key:"isOptionSelected",value:function(s,a){return xEe(this.props,s,a)}},{key:"filterOption",value:function(s,a){return gEe(this.props,s,a)}},{key:"formatOptionLabel",value:function(s,a){if(typeof this.props.formatOptionLabel=="function"){var o=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(s,{context:a,inputValue:o,selectValue:l})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var s=this.props,a=s.isDisabled,o=s.isSearchable,l=s.inputId,c=s.inputValue,u=s.tabIndex,d=s.form,f=s.menuIsOpen,x=s.required,g=this.getComponents(),y=g.Input,v=this.state,C=v.inputIsHidden,N=v.ariaSelection,I=this.commonProps,P=l||this.getElementId("input"),M=Zs(Zs(Zs({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":x,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!o&&{"aria-readonly":!0}),this.hasValue()?(N==null?void 0:N.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?h.createElement(y,ii({},I,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:P,innerRef:this.getInputRef,isDisabled:a,isHidden:C,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},M)):h.createElement(_ft,ii({id:P,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:nR,onFocus:this.onInputFocus,disabled:a,tabIndex:u,inputMode:"none",form:d,value:""},M))}},{key:"renderPlaceholderOrValue",value:function(){var s=this,a=this.getComponents(),o=a.MultiValue,l=a.MultiValueContainer,c=a.MultiValueLabel,u=a.MultiValueRemove,d=a.SingleValue,f=a.Placeholder,x=this.commonProps,g=this.props,y=g.controlShouldRenderValue,v=g.isDisabled,C=g.isMulti,N=g.inputValue,I=g.placeholder,P=this.state,M=P.selectValue,F=P.focusedValue,$=P.isFocused;if(!this.hasValue()||!y)return N?null:h.createElement(f,ii({},x,{key:"placeholder",isDisabled:v,isFocused:$,innerProps:{id:this.getElementId("placeholder")}}),I);if(C)return M.map(function(z,Q){var se=z===F,ee="".concat(s.getOptionLabel(z),"-").concat(s.getOptionValue(z));return h.createElement(o,ii({},x,{components:{Container:l,Label:c,Remove:u},isFocused:se,isDisabled:v,key:ee,index:Q,removeProps:{onClick:function(){return s.removeValue(z)},onTouchEnd:function(){return s.removeValue(z)},onMouseDown:function(re){re.preventDefault()}},data:z}),s.formatOptionLabel(z,"value"))});if(N)return null;var L=M[0];return h.createElement(d,ii({},x,{data:L,isDisabled:v}),this.formatOptionLabel(L,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),a=s.ClearIndicator,o=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!a||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return h.createElement(a,ii({},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,ii({},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,ii({},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,ii({},o,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var s=this,a=this.getComponents(),o=a.Group,l=a.GroupHeading,c=a.Menu,u=a.MenuList,d=a.MenuPortal,f=a.LoadingMessage,x=a.NoOptionsMessage,g=a.Option,y=this.commonProps,v=this.state.focusedOption,C=this.props,N=C.captureMenuScroll,I=C.inputValue,P=C.isLoading,M=C.loadingMessage,F=C.minMenuHeight,$=C.maxMenuHeight,L=C.menuIsOpen,z=C.menuPlacement,Q=C.menuPosition,se=C.menuPortalTarget,ee=C.menuShouldBlockScroll,K=C.menuShouldScrollIntoView,re=C.noOptionsMessage,de=C.onMenuScrollToTop,G=C.onMenuScrollToBottom;if(!L)return null;var ie=function(_e,xe){var Se=_e.type,ge=_e.data,Ce=_e.isDisabled,je=_e.isSelected,Oe=_e.label,$e=_e.value,Ye=v===ge,Je=Ce?void 0:function(){return s.onOptionHover(ge)},ht=Ce?void 0:function(){return s.selectOption(ge)},rt="".concat(s.getElementId("option"),"-").concat(xe),st={id:rt,onClick:ht,onMouseMove:Je,onMouseOver:Je,tabIndex:-1,role:"option","aria-selected":s.isAppleDevice?void 0:je};return h.createElement(g,ii({},y,{innerProps:st,data:ge,isDisabled:Ce,isSelected:je,key:rt,label:Oe,type:Se,value:$e,isFocused:Ye,innerRef:Ye?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(_e.data,"menu"))},ae;if(this.hasOptions())ae=this.getCategorizedOptions().map(function(he){if(he.type==="group"){var _e=he.data,xe=he.options,Se=he.index,ge="".concat(s.getElementId("group"),"-").concat(Se),Ce="".concat(ge,"-heading");return h.createElement(o,ii({},y,{key:ge,data:_e,options:xe,Heading:l,headingProps:{id:Ce,data:he.data},label:s.formatGroupLabel(he.data)}),he.options.map(function(je){return ie(je,"".concat(Se,"-").concat(je.index))}))}else if(he.type==="option")return ie(he,"".concat(he.index))});else if(P){var q=M({inputValue:I});if(q===null)return null;ae=h.createElement(f,y,q)}else{var W=re({inputValue:I});if(W===null)return null;ae=h.createElement(x,y,W)}var ne={minMenuHeight:F,maxMenuHeight:$,menuPlacement:z,menuPosition:Q,menuShouldScrollIntoView:K},oe=h.createElement(adt,ii({},y,ne),function(he){var _e=he.ref,xe=he.placerProps,Se=xe.placement,ge=xe.maxHeight;return h.createElement(c,ii({},y,ne,{innerRef:_e,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:P,placement:Se}),h.createElement(Fft,{captureEnabled:N,onTopArrive:de,onBottomArrive:G,lockEnabled:ee},function(Ce){return h.createElement(u,ii({},y,{innerRef:function(Oe){s.getMenuListRef(Oe),Ce(Oe)},innerProps:{role:"listbox","aria-multiselectable":y.isMulti,id:s.getElementId("listbox")},isLoading:P,maxHeight:ge,focusedOption:v}),ae)}))});return se||Q==="fixed"?h.createElement(d,ii({},y,{appendTo:se,controlElement:this.controlRef,menuPlacement:z,menuPosition:Q}),oe):oe}},{key:"renderFormField",value:function(){var s=this,a=this.props,o=a.delimiter,l=a.isDisabled,c=a.isMulti,u=a.name,d=a.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return h.createElement(Rft,{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(wft,ii({},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,ii({},v,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:x,isFocused:y}),this.renderLiveRegion(),h.createElement(a,ii({},v,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:x,isFocused:y,menuIsOpen:g}),h.createElement(c,ii({},v,{isDisabled:x}),this.renderPlaceholderOrValue(),this.renderInput()),h.createElement(o,ii({},v,{isDisabled:x}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,a){var o=a.prevProps,l=a.clearFocusValueOnUpdate,c=a.inputIsHiddenAfterUpdate,u=a.ariaSelection,d=a.isFocused,f=a.prevWasFocused,x=a.instancePrefix,g=s.options,y=s.value,v=s.menuIsOpen,C=s.inputValue,N=s.isMulti,I=jme(y),P={};if(o&&(y!==o.value||g!==o.options||v!==o.menuIsOpen||C!==o.inputValue)){var M=v?Zft(s,I):[],F=v?$me(FO(s,I),"".concat(x,"-option")):[],$=l?Jft(a,I):null,L=eht(a,M),z=tV(F,L);P={selectValue:I,focusedOption:L,focusedOptionId:z,focusableOptionsWithIds:F,focusedValue:$,clearFocusValueOnUpdate:!1}}var Q=c!=null&&s!==o?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},se=u,ee=d&&f;return d&&!ee&&(se={value:wP(N,I,I[0]||null),options:I,action:"initial-input-focus"},ee=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(se=null),Zs(Zs(Zs({},P),Q),{},{prevProps:s,ariaSelection:se,prevWasFocused:ee})}}]),n}(h.Component);yEe.defaultProps=Qft;var nht=h.forwardRef(function(t,e){var n=Cct(t);return h.createElement(yEe,ii({ref:e},n))}),hl=nht;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 M3(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 Uo(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 rht(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 CP(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 sht(t){const e=new Date(t),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear();return String(e.getHours()).padStart(2,"0"),String(e.getMinutes()).padStart(2,"0"),`${n}/${r}/${s}`}function Ms(t){if(t==null||isNaN(t))return"-";const e=t.toString();if(e.includes(".")){const n=e.split(".")[0];return new Intl.NumberFormat("en-US").format(parseInt(n))}return new Intl.NumberFormat("en-US").format(parseInt(t))}function iht(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 Er(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 z7(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 fo(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 jy(t){if(t==null||isNaN(t)||t===0)return"--";const e=parseFloat(t),n=e%1!==0;return e.toLocaleString("en-US",{minimumFractionDigits:n?4:0,maximumFractionDigits:4,useGrouping:!0})}function zv(t){if(t==null||isNaN(t)||t===0)return"--";const e=parseFloat(t),n=e>=1e3;let r=e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n?2:4,useGrouping:!0});if(r.includes(".")){const[s,a]=r.split(".");r=`${s}.${a.slice(0,2)}`}return r.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")}const XB=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 d3(t){if(isNaN(t))return;const e=t.toString().replace(".",",");return Number(e.replace(",",".")).toLocaleString("en-US",{maximumFractionDigits:20})}const vEe="2.28.0";let WA={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${vEe}`},Br=class IJ extends Error{constructor(e,n={}){var l;const r=(()=>{var c;return n.cause instanceof IJ?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof IJ&&n.cause.docsPath||n.docsPath,a=(l=WA.getDocsUrl)==null?void 0:l.call(WA,{...n,docsPath:s}),o=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...WA.version?[`Version: ${WA.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=vEe}walk(e){return wEe(this,e)}};function wEe(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?wEe(t.cause,e):e?null:t}let CEe=class extends Br{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class aht extends Br{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class oht extends Br{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let lht=class extends Br{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}},SEe=class extends Br{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},NEe=class extends Br{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class zme extends Br{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Kj(t,{dir:e,size:n=32}={}){return typeof t=="string"?My(t,{dir:e,size:n}):cht(t,{dir:e,size:n})}function My(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new NEe({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function cht(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new NEe({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=e==="right";r[a?s:n-s-1]=t[a?s:t.length-s-1]}return r}function ix(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function cl(t){return ix(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function Jf(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=e==="left"?n.slice(r):n.slice(0,n.length-r),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}const uht=new TextEncoder;function Yj(t,e={}){return typeof t=="number"||typeof t=="bigint"?fht(t,e):typeof t=="boolean"?dht(t,e):ix(t)?hp(t,e):f3(t,e)}function dht(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(Cp(n,{size:e.size}),Kj(n,{size:e.size})):n}const qx={zero:48,nine:57,A:65,F:70,a:97,f:102};function Hme(t){if(t>=qx.zero&&t<=qx.nine)return t-qx.zero;if(t>=qx.A&&t<=qx.F)return t-(qx.A-10);if(t>=qx.a&&t<=qx.f)return t-(qx.a-10)}function hp(t,e={}){let n=t;e.size&&(Cp(n,{size:e.size}),n=Kj(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=Hme(r.charCodeAt(l++)),u=Hme(r.charCodeAt(l++));if(c===void 0||u===void 0)throw new Br(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);a[o]=c*16+u}return a}function fht(t,e){const n=Hs(t,e);return hp(n)}function f3(t,e={}){const n=uht.encode(t);return typeof e.size=="number"?(Cp(n,{size:e.size}),Kj(n,{dir:"right",size:e.size})):n}function Cp(t,{size:e}){if(cl(t)>e)throw new lht({givenSize:cl(t),maxSize:e})}function cd(t,e={}){const{signed:n}=e;e.size&&Cp(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function hht(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 oht(n)}function ax(t,e={}){return Number(cd(t,e))}function pht(t,e={}){let n=hp(t);return e.size&&(Cp(n,{size:e.size}),n=Jf(n,{dir:"right"})),new TextDecoder().decode(n)}const mht=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function pi(t,e={}){return typeof t=="number"||typeof t=="bigint"?Hs(t,e):typeof t=="string"?tN(t,e):typeof t=="boolean"?jEe(t,e):Yl(t,e)}function jEe(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(Cp(n,{size:e.size}),Kj(n,{size:e.size})):n}function Yl(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=mht[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(Cp(r,{size:e.size}),Kj(r,{dir:"right",size:e.size})):r}function Hs(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 CEe({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?Kj(l,{size:r}):l}const xht=new TextEncoder;function tN(t,e={}){const n=xht.encode(t);return Yl(n,e)}function Am(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new kht(t.type);return`${t.name}(${QB(t.inputs,{includeName:e})})`}function QB(t,{includeName:e=!1}={}){return t?t.map(n=>ght(n,{includeName:e})).join(e?", ":","):""}function ght(t,{includeName:e}){return t.type.startsWith("tuple")?`(${QB(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class bht extends Br{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Vme extends Br{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class AEe extends Br{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${QB(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 hT extends Br{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class yht extends Br{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class vht extends Br{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${cl(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class wht extends Br{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
`),{name:"AbiEncodingLengthMismatchError"})}}class Cht extends Br{constructor(e,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${e}", but "${e}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Wme extends Br{constructor(e,{docsPath:n}={}){super([`Error ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class _Ee extends Br{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Sht extends Br{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class EEe extends Br{constructor(e,{docsPath:n}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class qme extends Br{constructor(e,{docsPath:n}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class nN extends Br{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class kEe extends Br{constructor(e,{docsPath:n}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Nht extends Br{constructor(e,{docsPath:n}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class jht extends Br{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 Aht=class extends Br{constructor({expectedSize:e,givenSize:n}){super(`Expected bytes${e}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class w_ extends Br{constructor({abiItem:e,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(`
`),{metaMessages:[`Params: (${QB(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 ZB extends Br{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 _ht extends Br{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Eht extends Br{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let TEe=class extends Br{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
`),{name:"InvalidArrayError"})}};class kht extends Br{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`),{name:"InvalidDefinitionTypeError"})}}function m1(t){return typeof t[0]=="string"?Pm(t):Tht(t)}function Tht(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 Pm(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}let Sd=class extends Br{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},JB=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 iR(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Iht(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function pT(t,...e){if(!Iht(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 Pht(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");iR(t.outputLen),iR(t.blockLen)}function rN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function IEe(t,e){pT(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const SP=BigInt(2**32-1),Gme=BigInt(32);function Fht(t,e=!1){return e?{h:Number(t&SP),l:Number(t>>Gme&SP)}:{h:Number(t>>Gme&SP)|0,l:Number(t&SP)|0}}function Oht(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}=Fht(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const Mht=(t,e,n)=>t<<n|e>>>32-n,Rht=(t,e,n)=>e<<n|t>>>32-n,Lht=(t,e,n)=>e<<n-32|t>>>64-n,Dht=(t,e,n)=>t<<n-32|e>>>64-n,sC=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Bht(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function nV(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function n0(t,e){return t<<32-e|t>>>e}const Kme=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function $ht(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Yme(t){for(let e=0;e<t.length;e++)t[e]=$ht(t[e])}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function Uht(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function e$(t){return typeof t=="string"&&(t=Uht(t)),pT(t),t}function zht(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];pT(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 Iae=class{clone(){return this._cloneInto()}};function PEe(t){const e=r=>t().update(e$(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Hht(t=32){if(sC&&typeof sC.getRandomValues=="function")return sC.getRandomValues(new Uint8Array(t));if(sC&&typeof sC.randomBytes=="function")return Uint8Array.from(sC.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const FEe=[],OEe=[],MEe=[],Vht=BigInt(0),qA=BigInt(1),Wht=BigInt(2),qht=BigInt(7),Ght=BigInt(256),Kht=BigInt(113);for(let t=0,e=qA,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],FEe.push(2*(5*r+n)),OEe.push((t+1)*(t+2)/2%64);let s=Vht;for(let a=0;a<7;a++)e=(e<<qA^(e>>qht)*Kht)%Ght,e&Wht&&(s^=qA<<(qA<<BigInt(a))-qA);MEe.push(s)}const[Yht,Xht]=Oht(MEe,!0),Xme=(t,e,n)=>n>32?Lht(t,e,n):Mht(t,e,n),Qme=(t,e,n)=>n>32?Dht(t,e,n):Rht(t,e,n);function Qht(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const l=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=Xme(u,d,1)^n[l],x=Qme(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=OEe[o],c=Xme(s,a,l),u=Qme(s,a,l),d=FEe[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]^=Yht[r],t[1]^=Xht[r]}n.fill(0)}let Zht=class REe extends Iae{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,iR(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Bht(this.state)}keccak(){Kme||Yme(this.state32),Qht(this.state32,this.rounds),Kme||Yme(this.state32),this.posOut=0,this.pos=0}update(e){rN(this);const{blockLen:n,state:r}=this;e=e$(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){rN(this,!1),pT(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 iR(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(IEe(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 REe(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 Jht=(t,e,n)=>PEe(()=>new Zht(e,t,n)),ept=Jht(1,136,256/8);function au(t,e){const n=e||"hex",r=ept(ix(t,{strict:!1})?Yj(t):t);return n==="bytes"?r:pi(r)}const rV=new JB(8192);function t$(t,e){if(rV.has(`${t}.${e}`))return rV.get(`${t}.${e}`);const n=e?`${e}${t.toLowerCase()}`:t.substring(2).toLowerCase(),r=au(f3(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 rV.set(`${t}.${e}`,a),a}function Ic(t,e){if(!uc(t,{strict:!1}))throw new Sd({address:t});return t$(t,e)}const tpt=/^0x[a-fA-F0-9]{40}$/,sV=new JB(8192);function uc(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(sV.has(r))return sV.get(r);const s=tpt.test(t)?t.toLowerCase()===t?!0:n?t$(t)===t:!0:!1;return sV.set(r,s),s}function R3(t,e,n,{strict:r}={}){return ix(t,{strict:!1})?$Ee(t,e,n,{strict:r}):BEe(t,e,n,{strict:r})}function LEe(t,e){if(typeof e=="number"&&e>0&&e>cl(t)-1)throw new SEe({offset:e,position:"start",size:cl(t)})}function DEe(t,e,n){if(typeof e=="number"&&typeof n=="number"&&cl(t)!==n-e)throw new SEe({offset:n,position:"end",size:cl(t)})}function BEe(t,e,n,{strict:r}={}){LEe(t,e);const s=t.slice(e,n);return r&&DEe(s,e,n),s}function $Ee(t,e,n,{strict:r}={}){LEe(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&DEe(s,e,n),s}const npt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,UEe=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function C2(t,e){if(t.length!==e.length)throw new wht({expectedLength:t.length,givenLength:e.length});const n=rpt({params:t,values:e}),r=Fae(n);return r.length===0?"0x":r}function rpt({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(Pae({param:t[r],value:e[r]}));return n}function Pae({param:t,value:e}){const n=Oae(t.type);if(n){const[r,s]=n;return ipt(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return upt(e,{param:t});if(t.type==="address")return spt(e);if(t.type==="bool")return opt(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int"),[,,s="256"]=UEe.exec(t.type)??[];return lpt(e,{signed:r,size:Number(s)})}if(t.type.startsWith("bytes"))return apt(e,{param:t});if(t.type==="string")return cpt(e);throw new _ht(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Fae(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?e+=32:e+=cl(l)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?(n.push(Hs(e+s,{size:32})),r.push(l),s+=cl(l)):n.push(l)}return m1([...n,...r])}function spt(t){if(!uc(t))throw new Sd({address:t});return{dynamic:!1,encoded:My(t.toLowerCase())}}function ipt(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new TEe(t);if(!r&&t.length!==e)throw new yht({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let o=0;o<t.length;o++){const l=Pae({param:n,value:t[o]});l.dynamic&&(s=!0),a.push(l)}if(r||s){const o=Fae(a);if(r){const l=Hs(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?m1([l,o]):l}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:m1(a.map(({encoded:o})=>o))}}function apt(t,{param:e}){const[,n]=e.type.split("bytes"),r=cl(t);if(!n){let s=t;return r%32!==0&&(s=My(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:m1([My(Hs(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new vht({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:My(t,{dir:"right"})}}function opt(t){if(typeof t!="boolean")throw new Br(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:My(jEe(t))}}function lpt(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 CEe({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:Hs(t,{size:32,signed:e})}}function cpt(t){const e=tN(t),n=Math.ceil(cl(e)/32),r=[];for(let s=0;s<n;s++)r.push(My(R3(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:m1([My(Hs(cl(e),{size:32})),...r])}}function upt(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=Pae({param:a,value:t[o]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Fae(r):m1(r.map(({encoded:s})=>s))}}function Oae(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const iV="/docs/contract/encodeDeployData";function Mae(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:iV});if(!("inputs"in s))throw new Vme({docsPath:iV});if(!s.inputs||s.inputs.length===0)throw new Vme({docsPath:iV});const a=C2(s.inputs,n);return Pm([r,a])}function Vu(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class n$ extends Br{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class aV extends Br{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function dpt(t){const e=au(`0x${t.substring(4)}`).substring(26);return t$(`0x${e}`)}const fpt="modulepreload",hpt=function(t){return"/"+t},Zme={},os=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=hpt(c),c in Zme)return;Zme[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 ppt({hash:t,signature:e}){const n=ix(t)?t:pi(t),{secp256k1:r}=await os(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>X1t);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=Jme(g);return new r.Signature(cd(u),cd(d)).addRecoveryBit(y)}const o=ix(e)?e:pi(e),l=ax(`0x${o.slice(130)}`),c=Jme(l);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Jme(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 zEe({hash:t,signature:e}){return dpt(await ppt({hash:t,signature:e}))}class e0e extends Br{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class HEe extends Br{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class mpt extends Br{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const xpt={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 mpt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new HEe({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new e0e({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 e0e({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 Rae(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(xpt);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function Jy(t,e="hex"){const n=VEe(t),r=Rae(new Uint8Array(n.length));return n.encode(r),e==="hex"?Yl(r.bytes):r.bytes}function VEe(t){return Array.isArray(t)?gpt(t.map(e=>VEe(e))):bpt(t)}function gpt(t){const e=t.reduce((s,a)=>s+a.length,0),n=WEe(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=WEe(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 WEe(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new Br("Length is too large.")}function ypt(t){const{chainId:e,nonce:n,to:r}=t,s=t.contractAddress??t.address,a=au(Pm(["0x05",Jy([e?Hs(e):"0x",s,n?Hs(n):"0x"])]));return r==="bytes"?hp(a):a}async function qEe(t){const{authorization:e,signature:n}=t;return zEe({hash:ypt(e),signature:n??e})}class PJ extends Br{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}let vpt=class extends Br{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}};class wpt extends Br{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
`),{name:"ChainNotFoundError"})}}class GEe extends Br{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class r$ extends Br{constructor({chainId:e}){super(typeof e=="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function Cpt({chain:t,currentChainId:e}){if(!t)throw new wpt;if(e!==t.id)throw new vpt({chain:t,currentChainId:e})}const Spt={gwei:9,wei:18},Npt={ether:-9,wei:9},jpt={ether:-18,gwei:-9};function mT(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 mT(t,Npt[e])}class n4 extends Br{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(n4,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(n4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class L3 extends Br{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(L3,"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 FJ extends Br{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(FJ,"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 OJ extends Br{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(OJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class MJ extends Br{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(MJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class RJ extends Br{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(RJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class LJ extends Br{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(LJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class DJ extends Br{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(DJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class BJ extends Br{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(BJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class $J extends Br{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty($J,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class C_ extends Br{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(C_,"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 xT extends Br{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Lae(t,e="wei"){return mT(t,Spt[e])}function gT(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 Apt extends Br{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
`),{name:"FeeConflictError"})}}class _pt extends Br{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class Ept extends Br{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",gT(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 kpt extends Br{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class Tpt extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x}){var y;const g=gT({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"&&`${Lae(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 KEe extends Br{constructor({blockHash:e,blockNumber:n,blockTag:r,hash:s,index:a}){let o="Transaction";r&&a!==void 0&&(o=`Transaction at block time "${r}" at index "${a}"`),e&&a!==void 0&&(o=`Transaction at block hash "${e}" at index "${a}"`),n&&a!==void 0&&(o=`Transaction at block number "${n}" at index "${a}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class YEe extends Br{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Ipt extends Br{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Rc=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),Ppt=t=>t,Dae=t=>t;class S9 extends Br{constructor({body:e,cause:n,details:r,headers:s,status:a,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${Dae(o)}`,e&&`Request body: ${Rc(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 Bae extends Br{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Dae(r)}`,`Request body: ${Rc(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 t0e extends Br{constructor({body:e,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Dae(n)}`,`Request body: ${Rc(e)}`],name:"TimeoutError"})}}const Fpt=-1;let wf=class extends Br{constructor(e,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:o}){super(o,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof Bae?e.code:n??Fpt}};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 S_ extends wf{constructor(e){super(e,{code:S_.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(S_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class N_ extends wf{constructor(e){super(e,{code:N_.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(N_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class j_ extends wf{constructor(e,{method:n}={}){super(e,{code:j_.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(j_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class A_ extends wf{constructor(e){super(e,{code:A_.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(A_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class D3 extends wf{constructor(e){super(e,{code:D3.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(D3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class B3 extends wf{constructor(e){super(e,{code:B3.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(B3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class __ extends wf{constructor(e){super(e,{code:__.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(__,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ry extends wf{constructor(e){super(e,{code:Ry.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ry,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class E_ extends wf{constructor(e){super(e,{code:E_.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(E_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class uw extends wf{constructor(e,{method:n}={}){super(e,{code:uw.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(uw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class sN extends wf{constructor(e){super(e,{code:sN.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(sN,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class k_ extends wf{constructor(e){super(e,{code:k_.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(k_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class No extends oh{constructor(e){super(e,{code:No.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(No,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class T_ extends oh{constructor(e){super(e,{code:T_.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(T_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class I_ extends oh{constructor(e,{method:n}={}){super(e,{code:I_.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(I_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class P_ extends oh{constructor(e){super(e,{code:P_.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(P_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class F_ extends oh{constructor(e){super(e,{code:F_.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(F_,"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 O_ extends oh{constructor(e){super(e,{code:O_.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(O_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class M_ extends oh{constructor(e){super(e,{code:M_.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(M_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class R_ extends oh{constructor(e){super(e,{code:R_.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(R_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class L_ extends oh{constructor(e){super(e,{code:L_.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(L_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class D_ extends oh{constructor(e){super(e,{code:D_.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(D_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class B_ extends oh{constructor(e){super(e,{code:B_.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(B_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class $_ extends oh{constructor(e){super(e,{code:$_.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty($_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Opt extends wf{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function s$(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof Br?t.walk(s=>(s==null?void 0:s.code)===n4.code):t;return r instanceof Br?new n4({cause:t,message:r.details}):n4.nodeMessage.test(n)?new n4({cause:t,message:t.details}):L3.nodeMessage.test(n)?new L3({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):FJ.nodeMessage.test(n)?new FJ({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):OJ.nodeMessage.test(n)?new OJ({cause:t,nonce:e==null?void 0:e.nonce}):MJ.nodeMessage.test(n)?new MJ({cause:t,nonce:e==null?void 0:e.nonce}):RJ.nodeMessage.test(n)?new RJ({cause:t,nonce:e==null?void 0:e.nonce}):LJ.nodeMessage.test(n)?new LJ({cause:t}):DJ.nodeMessage.test(n)?new DJ({cause:t,gas:e==null?void 0:e.gas}):BJ.nodeMessage.test(n)?new BJ({cause:t,gas:e==null?void 0:e.gas}):$J.nodeMessage.test(n)?new $J({cause:t}):C_.nodeMessage.test(n)?new C_({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new xT({cause:t})}function Mpt(t,{docsPath:e,...n}){const r=(()=>{const s=s$(t,n);return s instanceof xT?t:s})();return new Tpt(r,{docsPath:e,...n})}function i$(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 $ae(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 Rpt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function bT(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=Lpt(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=>Yl(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=Hs(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Hs(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Hs(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Hs(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Hs(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Hs(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=Rpt[t.type]),typeof t.value<"u"&&(e.value=Hs(t.value)),e}function Lpt(t){return t.map(e=>({address:e.address,r:e.r?Hs(BigInt(e.r)):e.r,s:e.s?Hs(BigInt(e.s)):e.s,chainId:Hs(e.chainId),nonce:Hs(e.nonce),...typeof e.yParity<"u"?{yParity:Hs(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Hs(e.v)}:{}}))}function li(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 a$=2n**256n-1n;function Xj(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,o=e?Vu(e):void 0;if(o&&!uc(o.address))throw new Sd({address:o.address});if(a&&!uc(a))throw new Sd({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new Apt;if(r&&r>a$)throw new L3({maxFeePerGas:r});if(s&&r&&s>r)throw new C_({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function Uae(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return ax(e)}class Dpt extends Br{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class zae extends Br{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Bpt extends Br{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${uf(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class XEe extends Br{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const QEe={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function o$(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?ax(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?ax(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?QEe[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=Upt(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 $pt=$ae("transaction",o$);function Upt(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 Hae(t){const e=(t.transactions??[]).map(n=>typeof n=="string"?n:o$(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 zpt=$ae("block",Hae);async function L0(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,f,x;const a=r??"latest",o=s??!1,l=n!==void 0?Hs(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 XEe({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)||Hae)(c)}async function Vae(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Hpt(t,e){return ZEe(t,e)}async function ZEe(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 li(t,L0,"getBlock")({}),d=await l({block:u,client:t,request:s});if(d===null)throw new Error;return d}if(typeof l<"u")return l;const c=await t.request({method:"eth_maxPriorityFeePerGas"});return cd(c)}catch{const[l,c]=await Promise.all([n?Promise.resolve(n):li(t,L0,"getBlock")({}),li(t,Vae,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new zae;const u=c-l.baseFeePerGas;return u<0n?0n:u}}async function Vpt(t,e){return UJ(t,e)}async function UJ(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 Dpt;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 li(t,L0,"getBlock")({});if(typeof((g=r==null?void 0:r.fees)==null?void 0:g.estimateFeesPerGas)=="function"){const y=await r.fees.estimateFeesPerGas({block:n,client:t,multiply:u,request:s,type:a});if(y!==null)return y}if(a==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new zae;const y=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await ZEe(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 li(t,Vae,"getGasPrice")({}))}}class Wpt extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x}){var y;const g=gT({from:n==null?void 0:n.address,to:f,value:typeof x<"u"&&`${Lae(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 qpt(t,{docsPath:e,...n}){const r=(()=>{const s=s$(t,n);return s instanceof xT?t:s})();return new Wpt(r,{docsPath:e,...n})}class Gpt extends Br{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Kpt extends Br{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function n0e(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
`,"")}function Ypt(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+=n0e(r.state)),r.stateDiff&&(s+=` stateDiff:
`,s+=n0e(r.stateDiff)),s},` State Override:
`).slice(0,-1)}function r0e(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new zme({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new zme({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function Xpt(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=Hs(e)),n!==void 0&&(o.nonce=Hs(n)),r!==void 0&&(o.state=r0e(r)),s!==void 0){if(o.state)throw new Kpt;o.stateDiff=r0e(s)}return o}function Wae(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!uc(n,{strict:!1}))throw new Sd({address:n});if(e[n])throw new Gpt({address:n});e[n]=Xpt(r)}return e}async function qae(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?Hs(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function Gae(t,e){var s,a,o;const{account:n=t.account}=e,r=n?Vu(n):void 0;try{let de=function(ie){const{block:ae,request:q,rpcStateOverride:W}=ie;return t.request({method:"eth_estimateGas",params:W?[q,ae??"latest",W]:ae?[q,ae]:[q]})};const{accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:f,blockTag:x,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:N,maxPriorityFeePerGas:I,nonce:P,value:M,stateOverride:F,...$}=await Qae(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),z=(f?Hs(f):void 0)||x,Q=Wae(F),se=await(async()=>{if($.to)return $.to;if(c&&c.length>0)return await qEe({authorization:c[0]}).catch(()=>{throw new Br("`to` is required. Could not infer from `authorizationList`")})})();Xj(e);const ee=(o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:o.format,re=(ee||bT)({...i$($,{format:ee}),from:r==null?void 0:r.address,accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:N,maxPriorityFeePerGas:I,nonce:P,to:se,value:M});let G=BigInt(await de({block:z,request:re,rpcStateOverride:Q}));if(c){const ie=await qae(t,{address:re.from}),ae=await Promise.all(c.map(async q=>{const{address:W}=q,ne=await de({block:z,request:{authorizationList:void 0,data:g,from:r==null?void 0:r.address,to:W,value:Hs(ie)},rpcStateOverride:Q}).catch(()=>100000n);return 2n*BigInt(ne)}));G+=ae.reduce((q,W)=>q+W,0n)}return G}catch(l){throw qpt(l,{...e,account:r,chain:t.chain})}}async function JEe(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?Hs(r):n]},{dedupe:!!r});return ax(s)}function Kae(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=>Yl(a))}function Yae(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=>Yl(o))}function Qpt(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),a=BigInt(4294967295),o=Number(n>>s&a),l=Number(n&a),c=r?4:0,u=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+u,l,r)}function Zpt(t,e,n){return t&e^~t&n}function Jpt(t,e,n){return t&e^t&n^e&n}let emt=class extends Iae{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=nV(this.buffer)}update(e){rN(this);const{view:n,buffer:r,blockLen:s}=this;e=e$(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=nV(e);for(;s<=a-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){rN(this),IEe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:a}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;Qpt(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=nV(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 tmt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),bb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yb=new Uint32Array(64);let nmt=class extends emt{constructor(e=32){super(64,e,8,!1),this.A=bb[0]|0,this.B=bb[1]|0,this.C=bb[2]|0,this.D=bb[3]|0,this.E=bb[4]|0,this.F=bb[5]|0,this.G=bb[6]|0,this.H=bb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)yb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=yb[f-15],g=yb[f-2],y=n0(x,7)^n0(x,18)^x>>>3,v=n0(g,17)^n0(g,19)^g>>>10;yb[f]=v+yb[f-7]+y+yb[f-16]|0}let{A:r,B:s,C:a,D:o,E:l,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const x=n0(l,6)^n0(l,11)^n0(l,25),g=d+x+Zpt(l,c,u)+tmt[f]+yb[f]|0,v=(n0(r,2)^n0(r,13)^n0(r,22))+Jpt(r,s,a)|0;d=u,u=c,c=l,l=o+g|0,o=a,a=s,s=r,r=g+v|0}r=r+this.A|0,s=s+this.B|0,a=a+this.C|0,o=o+this.D|0,l=l+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,a,o,l,c,u,d)}roundClean(){yb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const eke=PEe(()=>new nmt);function rmt(t,e){return eke(ix(t,{strict:!1})?Yj(t):t)}function smt(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=rmt(e);return s.set([n],0),r==="bytes"?s:Yl(s)}function tke(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(smt({commitment:a,to:r,version:n}));return s}const s0e=6,nke=32,Xae=4096,rke=nke*Xae,i0e=rke*s0e-1-1*Xae*s0e,ske=1;class imt extends Br{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class ike extends Br{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class amt extends Br{constructor({hash:e,size:n}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class omt extends Br{constructor({hash:e,version:n}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${ske}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function lmt(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?hp(t.data):t.data,r=cl(n);if(!r)throw new ike;if(r>i0e)throw new imt({maxSize:i0e,size:r});const s=[];let a=!0,o=0;for(;a;){const l=Rae(new Uint8Array(rke));let c=0;for(;c<Xae;){const u=n.slice(o,o+(nke-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=>Yl(l.bytes))}function ake(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??lmt({data:e,to:r}),a=t.commitments??Kae({blobs:s,kzg:n,to:r}),o=t.proofs??Yae({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 oke(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 Ept({transaction:t})}const lke=["blobVersionedHashes","chainId","fees","gas","nonce","type"],a0e=new Map;async function Qae(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:o,nonce:l,nonceManager:c,parameters:u=lke,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 li(t,L0,"getBlock")({blockTag:"latest"}),g)}let v;async function C(){return v||(s?s.id:typeof e.chainId<"u"?e.chainId:(v=await li(t,Uae,"getChainId")({}),v))}if(u.includes("nonce")&&typeof l>"u"&&f)if(c){const N=await C();x.nonce=await c.consume({address:f.address,chainId:N,client:t})}else x.nonce=await li(t,JEe,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&o){const N=Kae({blobs:r,kzg:o});if(u.includes("blobVersionedHashes")){const I=tke({commitments:N,to:"hex"});x.blobVersionedHashes=I}if(u.includes("sidecars")){const I=Yae({blobs:r,commitments:N,kzg:o}),P=ake({blobs:r,commitments:N,proofs:I,to:"hex"});x.sidecars=P}}if(u.includes("chainId")&&(x.chainId=await C()),(u.includes("fees")||u.includes("type"))&&typeof d>"u")try{x.type=oke(x)}catch{let N=a0e.get(t.uid);if(typeof N>"u"){const I=await y();N=typeof(I==null?void 0:I.baseFeePerGas)=="bigint",a0e.set(t.uid,N)}x.type=N?"eip1559":"legacy"}if(u.includes("fees"))if(x.type!=="legacy"&&x.type!=="eip2930"){if(typeof x.maxFeePerGas>"u"||typeof x.maxPriorityFeePerGas>"u"){const N=await y(),{maxFeePerGas:I,maxPriorityFeePerGas:P}=await UJ(t,{block:N,chain:s,request:x});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<P)throw new Bpt({maxPriorityFeePerGas:P});x.maxPriorityFeePerGas=P,x.maxFeePerGas=I}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new zae;if(typeof e.gasPrice>"u"){const N=await y(),{gasPrice:I}=await UJ(t,{block:N,chain:s,request:x,type:"legacy"});x.gasPrice=I}}return u.includes("gas")&&typeof a>"u"&&(x.gas=await li(t,Gae,"estimateGas")({...x,account:f&&{address:f.address,type:"json-rpc"}})),Xj(x),delete x.parameters,x}async function cke(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const oV=new JB(128);async function cmt(t,e){var N,I,P,M;const{account:n=t.account,chain:r=t.chain,accessList:s,authorizationList:a,blobs:o,data:l,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:x,nonce:g,value:y,...v}=e;if(typeof n>"u")throw new n$({docsPath:"/docs/actions/wallet/sendTransaction"});const C=n?Vu(n):null;try{Xj(e);const F=await(async()=>{if(e.to)return e.to;if(e.to!==null&&a&&a.length>0)return await qEe({authorization:a[0]}).catch(()=>{throw new Br("`to` is required. Could not infer from `authorizationList`.")})})();if((C==null?void 0:C.type)==="json-rpc"||C===null){let $;r!==null&&($=await li(t,Uae,"getChainId")({}),Cpt({currentChainId:$,chain:r}));const L=(P=(I=(N=t.chain)==null?void 0:N.formatters)==null?void 0:I.transactionRequest)==null?void 0:P.format,Q=(L||bT)({...i$(v,{format:L}),accessList:s,authorizationList:a,blobs:o,chainId:$,data:l,from:C==null?void 0:C.address,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:x,nonce:g,to:F,value:y}),se=oV.get(t.uid),ee=se?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:ee,params:[Q]},{retryCount:0})}catch(K){if(se===!1)throw K;const re=K;if(re.name==="InvalidInputRpcError"||re.name==="InvalidParamsRpcError"||re.name==="MethodNotFoundRpcError"||re.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[Q]},{retryCount:0}).then(de=>(oV.set(t.uid,!0),de)).catch(de=>{const G=de;throw G.name==="MethodNotFoundRpcError"||G.name==="MethodNotSupportedRpcError"?(oV.set(t.uid,!1),re):G});throw re}}if((C==null?void 0:C.type)==="local"){const $=await li(t,Qae,"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:[...lke,"sidecars"],value:y,...v,to:F}),L=(M=r==null?void 0:r.serializers)==null?void 0:M.transaction,z=await C.signTransaction($,{serializer:L});return await li(t,cke,"sendRawTransaction")({serializedTransaction:z})}throw(C==null?void 0:C.type)==="smart"?new aV({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new aV({docsPath:"/docs/actions/wallet/sendTransaction",type:C==null?void 0:C.type})}catch(F){throw F instanceof aV?F:Mpt(F,{...e,account:C,chain:e.chain||void 0})}}const zJ=[{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"}],HJ=[{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"}]}],uke=[{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"}],dke=[...uke,{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"}]}],umt=[...uke,{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"}]}],o0e=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],l0e=[{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"}]}],c0e=[{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 dmt(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Yl(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 aht(n);return!!n[0]}function t1(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Yl(t,e);return ax(n,e)}function hmt(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 yT(t,e){const n=typeof e=="string"?hp(e):e,r=Rae(n);if(cl(n)===0&&t.length>0)throw new hT;if(cl(e)&&cl(e)<32)throw new AEe({data:typeof e=="string"?e:Yl(e),params:t,size:cl(e)});let s=0;const a=[];for(let o=0;o<t.length;++o){const l=t[o];r.setPosition(s);const[c,u]=C4(r,l,{staticPosition:0});s+=u,a.push(c)}return a}function C4(t,e,{staticPosition:n}){const r=Oae(e.type);if(r){const[s,a]=r;return mmt(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return ymt(t,e,{staticPosition:n});if(e.type==="address")return pmt(t);if(e.type==="bool")return xmt(t);if(e.type.startsWith("bytes"))return gmt(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return bmt(t,e);if(e.type==="string")return vmt(t,{staticPosition:n});throw new Eht(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const u0e=32,VJ=32;function pmt(t){const e=t.readBytes(32);return[t$(Yl(BEe(e,-20))),32]}function mmt(t,e,{length:n,staticPosition:r}){if(!n){const o=t1(t.readBytes(VJ)),l=r+o,c=l+u0e;t.setPosition(l);const u=t1(t.readBytes(u0e)),d=U_(e);let f=0;const x=[];for(let g=0;g<u;++g){t.setPosition(c+(d?g*32:f));const[y,v]=C4(t,e,{staticPosition:c});f+=v,x.push(y)}return t.setPosition(r+32),[x,32]}if(U_(e)){const o=t1(t.readBytes(VJ)),l=r+o,c=[];for(let u=0;u<n;++u){t.setPosition(l+u*32);const[d]=C4(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]=C4(t,e,{staticPosition:r+s});s+=c,a.push(l)}return[a,s]}function xmt(t){return[fmt(t.readBytes(32),{size:32}),32]}function gmt(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const o=t1(t.readBytes(32));t.setPosition(n+o);const l=t1(t.readBytes(32));if(l===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(l);return t.setPosition(n+32),[Yl(c),32]}return[Yl(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?dmt(s,{signed:n}):t1(s,{signed:n}),32]}function ymt(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:o})=>!o),s=r?[]:{};let a=0;if(U_(e)){const o=t1(t.readBytes(VJ)),l=n+o;for(let c=0;c<e.components.length;++c){const u=e.components[c];t.setPosition(l+a);const[d,f]=C4(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]=C4(t,l,{staticPosition:n});s[r?o:l==null?void 0:l.name]=c,a+=u}return[s,a]}function vmt(t,{staticPosition:e}){const n=t1(t.readBytes(32)),r=e+n;t.setPosition(r);const s=t1(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),o=hmt(Jf(a));return t.setPosition(e+32),[o,32]}function U_(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(U_);const n=Oae(t.type);return!!(n&&U_({...t,type:n[1]}))}const wmt=t=>au(Yj(t));function Cmt(t){return wmt(t)}const Smt="1.0.8";let lh=class WJ extends Error{constructor(e,n={}){var o;const r=n.cause instanceof WJ?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof WJ&&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@${Smt}`].join(`
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}};function O1(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const fke=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,hke=/^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)?$/,pke=/^\(.+?\).*?$/,d0e=/^tuple(?<array>(\[(\d*)\])*)$/;function qJ(t){let e=t.type;if(d0e.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+=qJ(a),s<n-1&&(e+=", ")}const r=O1(d0e,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,qJ({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function GA(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=qJ(s),r!==n-1&&(e+=", ")}return e}function aR(t){var e;return t.type==="function"?`function ${t.name}(${GA(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${GA(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${GA(t.inputs)})`:t.type==="error"?`error ${t.name}(${GA(t.inputs)})`:t.type==="constructor"?`constructor(${GA(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const mke=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Nmt(t){return mke.test(t)}function jmt(t){return O1(mke,t)}const xke=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Amt(t){return xke.test(t)}function _mt(t){return O1(xke,t)}const gke=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Emt(t){return gke.test(t)}function kmt(t){return O1(gke,t)}const bke=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Zae(t){return bke.test(t)}function Tmt(t){return O1(bke,t)}const yke=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Imt(t){return yke.test(t)}function Pmt(t){return O1(yke,t)}const vke=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Fmt(t){return vke.test(t)}function Omt(t){return O1(vke,t)}const Mmt=/^receive\(\) external payable$/;function Rmt(t){return Mmt.test(t)}const Lmt=new Set(["indexed"]),GJ=new Set(["calldata","memory","storage"]);class Dmt 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 Bmt 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 $mt 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 Umt extends lh{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class zmt 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 Hmt 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 Vmt 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 Wmt 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 Qj=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 qmt extends lh{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Gmt 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 Kmt 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 Ymt 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 Xmt(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 lV=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 KJ(t,e={}){if(Emt(t))return Qmt(t,e);if(Amt(t))return Zmt(t,e);if(Nmt(t))return Jmt(t,e);if(Imt(t))return e0t(t,e);if(Fmt(t))return t0t(t);if(Rmt(t))return{type:"receive",stateMutability:"payable"};throw new qmt({signature:t})}function Qmt(t,e={}){const n=kmt(t);if(!n)throw new Qj({signature:t,type:"function"});const r=dm(n.parameters),s=[],a=r.length;for(let l=0;l<a;l++)s.push($3(r[l],{modifiers:GJ,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($3(l[u],{modifiers:GJ,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function Zmt(t,e={}){const n=_mt(t);if(!n)throw new Qj({signature:t,type:"event"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push($3(r[o],{modifiers:Lmt,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}function Jmt(t,e={}){const n=jmt(t);if(!n)throw new Qj({signature:t,type:"error"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push($3(r[o],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}function e0t(t,e={}){const n=Pmt(t);if(!n)throw new Qj({signature:t,type:"constructor"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push($3(r[o],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function t0t(t){const e=Omt(t);if(!e)throw new Qj({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$_]*))?$/,r0t=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,s0t=/^u?int$/;function $3(t,e){var f,x;const n=Xmt(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(lV.has(n))return lV.get(n);const r=pke.test(t),s=O1(r?r0t:n0t,t);if(!s)throw new Umt({param:t});if(s.name&&a0t(s.name))throw new zmt({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($3(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(s0t.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!wke(c))throw new $mt({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 Hmt({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(GJ.has(s.modifier)&&!o0t(c,!!s.array))throw new Vmt({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...o,...u};return lV.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 Ymt({current:n,depth:r});return e.push(n.trim()),e}function wke(t){return t==="address"||t==="bool"||t==="function"||t==="string"||fke.test(t)||hke.test(t)}const i0t=/^(?: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 a0t(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||fke.test(t)||hke.test(t)||i0t.test(t)}function o0t(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function Cke(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!Zae(l))continue;const c=Tmt(l);if(!c)throw new Qj({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=$3(y,{type:"struct"});d.push(v)}if(!d.length)throw new Gmt({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]=Ske(c,e)}return r}const l0t=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ske(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(pke.test(o.type))r.push(o);else{const c=O1(l0t,o.type);if(!(c!=null&&c.type))throw new Wmt({abiParameter:o});const{array:u,type:d}=c;if(d in e){if(n.has(d))throw new Kmt({type:d});r.push({...o,type:`tuple${u??""}`,components:Ske(e[d]??[],e,new Set([...n,d]))})}else if(wke(d))r.push(o);else throw new Bmt({type:d})}}return r}function Nke(t){const e=Cke(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];Zae(a)||n.push(KJ(a,e))}return n}function f0e(t){let e;if(typeof t=="string")e=KJ(t);else{const n=Cke(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!Zae(a)){e=KJ(a,n);break}}}if(!e)throw new Dmt({signature:t});return e}function c0t(t){let e=!0,n="",r=0,s="",a=!1;for(let o=0;o<t.length;o++){const l=t[o];if(["(",")",","].includes(l)&&(e=!0),l==="("&&r++,l===")"&&r--,!!e){if(r===0){if(l===" "&&["event","function",""].includes(s))s="";else if(s+=l,l===")"){a=!0;break}continue}if(l===" "){t[o-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=l,n+=l}}if(!a)throw new Br("Unable to normalize signature.");return s}const u0t=t=>{const e=typeof t=="string"?t:aR(t);return c0t(e)};function jke(t){return Cmt(u0t(t))}const l$=jke,vT=t=>R3(jke(t),0,4);function _5(t){const{abi:e,args:n=[],name:r}=t,s=ix(r,{strict:!1}),a=e.filter(l=>s?l.type==="function"?vT(l)===r:l.type==="event"?l$(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?YJ(u,f):!1})){if(o&&"inputs"in o&&o.inputs){const u=Ake(l.inputs,o.inputs,n);if(u)throw new jht({abiItem:l,type:u[0]},{abiItem:o,type:u[1]})}o=l}}return o||a[0]}function YJ(t,e){const n=typeof t,r=e.type;switch(r){case"address":return uc(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>YJ(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=>YJ(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ake(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 Ake(s.components,a.components,n[r]);const o=[s.type,a.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uc(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?uc(n[r],{strict:!1}):!1)return o}}const cV="/docs/contract/decodeFunctionResult";function E5(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const l=_5({abi:e,args:n,name:r});if(!l)throw new nN(r,{docsPath:cV});a=l}if(a.type!=="function")throw new nN(void 0,{docsPath:cV});if(!a.outputs)throw new kEe(a.name,{docsPath:cV});const o=yT(a.outputs,s);if(o.length>1)return o;if(o.length===1)return o[0]}const h0e="/docs/contract/encodeFunctionData";function d0t(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=_5({abi:e,args:n,name:r});if(!a)throw new nN(r,{docsPath:h0e});s=a}if(s.type!=="function")throw new nN(void 0,{docsPath:h0e});return{abi:[s],functionName:vT(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:d0t(t)})(),s=n[0],a=r,o="inputs"in s&&s.inputs?C2(s.inputs,e??[]):void 0;return Pm([a,o??"0x"])}function Zj({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 PJ({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new PJ({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const _ke={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."},Eke={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},f0t={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function h0t(t){const{abi:e,data:n}=t,r=R3(n,0,4);if(r==="0x")throw new hT;const a=[...e||[],Eke,f0t].find(o=>o.type==="error"&&r===vT(Am(o)));if(!a)throw new _Ee(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?yT(a.inputs,R3(n,4)):void 0,errorName:a.name}}function kke({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"?Rc(e[a]):e[a]}`).join(", ")})`}class Tke extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x,stateOverride:g}){var C;const y=n?Vu(n):void 0;let v=gT({from:y==null?void 0:y.address,to:f,value:typeof x<"u"&&`${Lae(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+=`
${Ypt(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 Ike extends Br{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:o,sender:l}){const c=_5({abi:n,args:r,name:o}),u=c?kke({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=c?Am(c,{includeName:!0}):void 0,f=gT({address:s&&Ppt(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 XJ extends Br{constructor({abi:e,data:n,functionName:r,message:s}){let a,o,l,c;if(n&&n!=="0x")try{o=h0t({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=_ke[g]}else{const g=d?Am(d,{includeName:!0}):void 0,y=d&&x?kke({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 _Ee&&(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 p0t extends Br{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class m0t extends Br{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class c$ extends Br{constructor({data:e,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function Jae(t,e){var r,s,a,o,l,c;if(!(t instanceof Br))return!1;const n=t.walk(u=>u instanceof XJ);return n instanceof XJ?!!(((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===_ke[50]):!1}function x0t(t){const{abi:e,data:n}=t,r=R3(n,0,4),s=e.find(a=>a.type==="function"&&r===vT(Am(a)));if(!s)throw new Nht(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?yT(s.inputs,R3(n,4)):void 0}}const uV="/docs/contract/encodeErrorResult";function p0e(t){const{abi:e,errorName:n,args:r}=t;let s=e[0];if(n){const c=_5({abi:e,args:r,name:n});if(!c)throw new Wme(n,{docsPath:uV});s=c}if(s.type!=="error")throw new Wme(void 0,{docsPath:uV});const a=Am(s),o=vT(a);let l="0x";if(r&&r.length>0){if(!s.inputs)throw new Cht(s.name,{docsPath:uV});l=C2(s.inputs,r)}return Pm([o,l])}const dV="/docs/contract/encodeFunctionResult";function g0t(t){const{abi:e,functionName:n,result:r}=t;let s=e[0];if(n){const o=_5({abi:e,name:n});if(!o)throw new nN(n,{docsPath:dV});s=o}if(s.type!=="function")throw new nN(void 0,{docsPath:dV});if(!s.outputs)throw new kEe(s.name,{docsPath:dV});const a=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new TEe(r)})();return C2(s.outputs,a)}const Pke="x-batch-gateway:true";async function GCn(t){const{data:e,ccipRequest:n}=t,{args:[r]}=x0t({abi:HJ,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)}})),g0t({abi:HJ,functionName:"query",result:[s,a]})}function b0t(t){return t.name==="HttpRequestError"&&t.status?p0e({abi:HJ,errorName:"HttpError",args:[t.status,t.shortMessage]}):p0e({abi:[Eke],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}function Fke(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return ix(e)?e:null}function OO(t){let e=new Uint8Array(32).fill(0);if(!t)return Yl(e);const n=t.split(".");for(let r=n.length-1;r>=0;r-=1){const s=Fke(n[r]),a=s?Yj(s):au(f3(n[r]),"bytes");e=au(m1([e,a]),"bytes")}return Yl(e)}function y0t(t){return`[${t.slice(2)}]`}function v0t(t){const e=new Uint8Array(32).fill(0);return t?Fke(t)||au(f3(t)):Yl(e)}function u$(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const n=new Uint8Array(f3(e).byteLength+2);let r=0;const s=e.split(".");for(let a=0;a<s.length;a++){let o=f3(s[a]);o.byteLength>255&&(o=f3(y0t(v0t(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 w0t=3;function U3(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:o}){const l=t instanceof c$?t:t instanceof Br?t.walk(y=>"data"in y)||t.walk():{},{code:c,data:u,details:d,message:f,shortMessage:x}=l,g=t instanceof hT?new p0t({functionName:a}):[w0t,D3.code].includes(c)&&(u||d||f||x)?new XJ({abi:e,data:typeof u=="object"?u.data:u,functionName:a,message:l instanceof Bae?d:x??f}):t;return new Ike(g,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:o})}const C0t="0x82ad56cb",Oke="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",S0t="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",N0t="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";function Mke(t,{docsPath:e,...n}){const r=(()=>{const s=s$(t,n);return s instanceof xT?t:s})();return new Tke(r,{docsPath:e,...n})}function Rke(){let t=()=>{},e=()=>{};return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}const fV=new Map;function Lke({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=()=>fV.delete(e),l=()=>c().map(({args:d})=>d),c=()=>fV.get(e)||[],u=d=>fV.set(e,[...c(),d]);return{flush:o,async schedule(d){const{promise:f,resolve:x,reject:g}=Rke();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 d$(t,e){var ee,K,re,de;const{account:n=t.account,batch:r=!!((ee=t.batch)!=null&&ee.multicall),blockNumber:s,blockTag:a="latest",accessList:o,blobs:l,code:c,data:u,factory:d,factoryData:f,gas:x,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:C,nonce:N,to:I,value:P,stateOverride:M,...F}=e,$=n?Vu(n):void 0;if(c&&(d||f))throw new Br("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&I)throw new Br("Cannot provide both `code` & `to` as parameters.");const L=c&&u,z=d&&f&&I&&u,Q=L||z,se=L?_0t({code:c,data:u}):z?E0t({data:u,factory:d,factoryData:f,to:I}):u;try{Xj(e);const ie=(s?Hs(s):void 0)||a,ae=Wae(M),q=(de=(re=(K=t.chain)==null?void 0:K.formatters)==null?void 0:re.transactionRequest)==null?void 0:de.format,ne=(q||bT)({...i$(F,{format:q}),from:$==null?void 0:$.address,accessList:o,blobs:l,data:se,gas:x,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:C,nonce:N,to:Q?void 0:I,value:P});if(r&&j0t({request:ne})&&!ae)try{return await A0t(t,{...ne,blockNumber:s,blockTag:a})}catch(he){if(!(he instanceof GEe)&&!(he instanceof PJ))throw he}const oe=await t.request({method:"eth_call",params:ae?[ne,ie,ae]:[ne,ie]});return oe==="0x"?{data:void 0}:{data:oe}}catch(G){const ie=k0t(G),{offchainLookup:ae,offchainLookupSignature:q}=await os(async()=>{const{offchainLookup:W,offchainLookupSignature:ne}=await import("./ccip-B6IteBY5.js");return{offchainLookup:W,offchainLookupSignature:ne}},[]);if(t.ccipRead!==!1&&(ie==null?void 0:ie.slice(0,10))===q&&I)return{data:await ae(t,{data:ie,to:I})};throw Q&&(ie==null?void 0:ie.slice(0,10))==="0x101bb98d"?new m0t({factory:d}):Mke(G,{...e,account:$,chain:t.chain})}}function j0t({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(C0t)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function A0t(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 GEe;u=Zj({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=(s?Hs(s):void 0)||a,{schedule:x}=Lke({id:`${t.uid}.${f}`,wait:r,shouldSplitBatch(C){return C.reduce((I,{data:P})=>I+(P.length-2),0)>n*2},fn:async C=>{const N=C.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),I=Fm({abi:zJ,args:[N],functionName:"aggregate3"}),P=await t.request({method:"eth_call",params:[{data:I,to:u},f]});return E5({abi:zJ,args:[N],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:g,success:y}]=await x({data:o,to:c});if(!y)throw new c$({data:g});return g==="0x"?{data:void 0}:{data:g}}function _0t(t){const{code:e,data:n}=t;return Mae({abi:Nke(["constructor(bytes, bytes)"]),bytecode:Oke,args:[e,n]})}function E0t(t){const{data:e,factory:n,factoryData:r,to:s}=t;return Mae({abi:Nke(["constructor(address, bytes, address, bytes)"]),bytecode:S0t,args:[s,e,n,r]})}function k0t(t){var n;if(!(t instanceof Br))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function ox(t,e){const{abi:n,address:r,args:s,functionName:a,...o}=e,l=Fm({abi:n,args:s,functionName:a});try{const{data:c}=await li(t,d$,"call")({...o,data:l,to:r});return E5({abi:n,args:s,functionName:a,data:c||"0x"})}catch(c){throw U3(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function T0t(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 Zj({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:l0e,functionName:"addr",...s!=null?{args:[OO(a),BigInt(s)]}:{args:[OO(a)]}}),x={address:u,abi:dke,functionName:"resolve",args:[pi(u$(a)),f,o??[Pke]],blockNumber:n,blockTag:r},y=await li(t,ox,"readContract")(x);if(y[0]==="0x")return null;const v=E5({abi:l0e,args:s!=null?[OO(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(Jae(f,"resolve"))return null;throw f}}class I0t extends Br{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}}class KA extends Br{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class eoe extends Br{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class P0t extends Br{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const F0t=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,O0t=/^(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>\/.*)?$/,M0t=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,R0t=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function L0t(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 m0e(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function Dke({uri:t,gatewayUrls:e}){const n=M0t.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=m0e(e==null?void 0:e.ipfs,"https://ipfs.io"),s=m0e(e==null?void 0:e.arweave,"https://arweave.net"),a=t.match(F0t),{protocol:o,subpath:l,target:c,subtarget:u=""}=(a==null?void 0:a.groups)||{},d=o==="ipns:/"||l==="ipns/",f=o==="ipfs:/"||l==="ipfs/"||O0t.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(R0t,"");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 eoe({uri:t})}function Bke(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new I0t({data:t});return t.image||t.image_url||t.image_data}async function D0t({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await toe({gatewayUrls:t,uri:Bke(n)})}catch{throw new eoe({uri:e})}}async function toe({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=Dke({uri:e,gatewayUrls:t});if(r||await L0t(n))return n;throw new eoe({uri:e})}function B0t(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 KA({reason:"Only EIP-155 supported"});if(!o)throw new KA({reason:"Chain ID not found"});if(!c)throw new KA({reason:"Contract address not found"});if(!s)throw new KA({reason:"Token ID not found"});if(!l)throw new KA({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o),namespace:l.toLowerCase(),contractAddress:c,tokenID:s}}async function $0t(t,{nft:e}){if(e.namespace==="erc721")return ox(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return ox(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new P0t({namespace:e.namespace})}async function U0t(t,{gatewayUrls:e,record:n}){return/eip155:/i.test(n)?z0t(t,{gatewayUrls:e,record:n}):toe({uri:n,gatewayUrls:e})}async function z0t(t,{gatewayUrls:e,record:n}){const r=B0t(n),s=await $0t(t,{nft:r}),{uri:a,isOnChain:o,isEncoded:l}=Dke({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 toe({uri:Bke(d),gatewayUrls:e})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),D0t({gatewayUrls:e,uri:a.replace(/(?:0x)?{id}/,c)})}async function $ke(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 Zj({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:dke,functionName:"resolve",args:[pi(u$(a)),Fm({abi:o0e,functionName:"text",args:[OO(a),s]}),o??[Pke]],blockNumber:n,blockTag:r},g=await li(t,ox,"readContract")(f);if(g[0]==="0x")return null;const y=E5({abi:o0e,functionName:"text",data:g[0]});return y===""?null:y}catch(f){if(l)throw f;if(Jae(f,"resolve"))return null;throw f}}async function Uke(t,{blockNumber:e,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:a,strict:o,universalResolverAddress:l}){const c=await li(t,$ke,"getEnsText")({blockNumber:e,blockTag:n,key:"avatar",name:s,universalResolverAddress:l,gatewayUrls:a,strict:o});if(!c)return null;try{return await U0t(t,{record:c,gatewayUrls:r})}catch{return null}}async function zke(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=Zj({blockNumber:n,chain:t.chain,contract:"ensUniversalResolver"})}const c=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:l,abi:umt,functionName:"reverse",args:[pi(u$(c))],blockNumber:n,blockTag:r},d=li(t,ox,"readContract"),[f,x]=s?await d({...u,args:[...u.args,s]}):await d(u);return e.toLowerCase()!==x.toLowerCase()?null:f}catch(u){if(a)throw u;if(Jae(u,"reverse"))return null;throw u}}async function H0t(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 Zj({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 li(t,ox,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pi(u$(s))],blockNumber:n,blockTag:r});return c}async function Hke(t,e){var C,N,I;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{Xj(e);const M=(r?Hs(r):void 0)||s,F=(I=(N=(C=t.chain)==null?void 0:C.formatters)==null?void 0:N.transactionRequest)==null?void 0:I.format,L=(F||bT)({...i$(y,{format:F}),from:v==null?void 0:v.address,blobs:a,data:o,gas:l,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:d,maxPriorityFeePerGas:f,to:x,value:g}),z=await t.request({method:"eth_createAccessList",params:[L,M]});return{accessList:z.accessList,gasUsed:BigInt(z.gasUsed)}}catch(P){throw Mke(P,{...e,account:v,chain:t.chain})}}function f$(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 V0t(t){const e=f$(t,{method:"eth_newBlockFilter"}),n=await t.request({method:"eth_newBlockFilter"});return{id:n,request:e(n),type:"block"}}class W0t extends Br{constructor(e){super(`Filter type "${e}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const x0e="/docs/contract/encodeEventTopics";function wT(t){var c;const{abi:e,eventName:n,args:r}=t;let s=e[0];if(n){const u=_5({abi:e,name:n});if(!u)throw new qme(n,{docsPath:x0e});s=u}if(s.type!=="event")throw new qme(void 0,{docsPath:x0e});const a=Am(s),o=l$(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)=>g0e({param:f,value:d[x][y]})):typeof d[x]<"u"&&d[x]!==null?g0e({param:f,value:d[x]}):null))??[])}return[o,...l]}function g0e({param:t,value:e}){if(t.type==="string"||t.type==="bytes")return au(Yj(e));if(t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/))throw new W0t(t.type);return C2([t],[e])}async function Vke(t,e){const{address:n,abi:r,args:s,eventName:a,fromBlock:o,strict:l,toBlock:c}=e,u=f$(t,{method:"eth_newFilter"}),d=a?wT({abi:r,args:s,eventName:a}):void 0,f=await t.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?Hs(o):o,toBlock:typeof c=="bigint"?Hs(c):c,topics:d}]});return{abi:r,args:s,eventName:a,id:f,request:u(f),strict:!!l,type:"event"}}async function Wke(t,{address:e,args:n,event:r,events:s,fromBlock:a,strict:o,toBlock:l}={}){const c=s??(r?[r]:void 0),u=f$(t,{method:"eth_newFilter"});let d=[];c&&(d=[c.flatMap(g=>wT({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"?Hs(a):a,toBlock:typeof l=="bigint"?Hs(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 qke(t){const e=f$(t,{method:"eth_newPendingTransactionFilter"}),n=await t.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:e(n),type:"transaction"}}async function q0t(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 li(t,Gae,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...l})}catch(u){const d=l.account?Vu(l.account):void 0;throw U3(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:d==null?void 0:d.address})}}async function G0t(t){const e=await t.request({method:"eth_blobBaseFee"});return BigInt(e)}const K0t=new Map,Y0t=new Map;function X0t(t){const e=(s,a)=>({clear:()=>a.delete(s),get:()=>a.get(s),set:o=>a.set(s,o)}),n=e(t,K0t),r=e(t,Y0t);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function Q0t(t,{cacheKey:e,cacheTime:n=Number.POSITIVE_INFINITY}){const r=X0t(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 Z0t=t=>`blockNumber.${t}`;async function CT(t,{cacheTime:e=t.cacheTime}={}){const n=await Q0t(()=>t.request({method:"eth_blockNumber"}),{cacheKey:Z0t(t.uid),cacheTime:e});return BigInt(n)}async function J0t(t,{blockHash:e,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?Hs(n):void 0;let a;return e?a=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]},{dedupe:!0}):a=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),ax(a)}async function b0e(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?Hs(n):void 0,a=await t.request({method:"eth_getCode",params:[e,s||r]},{dedupe:!!s});if(a!=="0x")return a}function noe(t,e){if(!uc(t,{strict:!1}))throw new Sd({address:t});if(!uc(e,{strict:!1}))throw new Sd({address:e});return t.toLowerCase()===e.toLowerCase()}const y0e="/docs/contract/decodeEventLog";function roe(t){const{abi:e,data:n,strict:r,topics:s}=t,a=r??!0,[o,...l]=s;if(!o)throw new Sht({docsPath:y0e});const c=e.length===1?e[0]:e.find(v=>v.type==="event"&&o===l$(Am(v)));if(!(c&&"name"in c)||c.type!=="event")throw new EEe(o,{docsPath:y0e});const{name:u,inputs:d}=c,f=d==null?void 0:d.some(v=>!("name"in v&&v.name));let x=f?[]:{};const g=d.filter(v=>"indexed"in v&&v.indexed);for(let v=0;v<g.length;v++){const C=g[v],N=l[v];if(!N)throw new ZB({abiItem:c,param:C});x[f?v:C.name||v]=ext({param:C,value:N})}const y=d.filter(v=>!("indexed"in v&&v.indexed));if(y.length>0){if(n&&n!=="0x")try{const v=yT(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 AEe||v instanceof HEe?new w_({abiItem:c,data:n,params:y,size:cl(n)}):v}else if(a)throw new w_({abiItem:c,data:"0x",params:y,size:0})}return{eventName:u,args:Object.values(x).length>0?x:void 0}}function ext({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:yT([t],e)[0]}function soe(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]===l$(d));if(!c)return null;const u=roe({...o,abi:[c],strict:s});return a&&!a.includes(u.eventName)||!txt({args:u.args,inputs:c.inputs,matchArgs:n})?null:{...u,...o}}catch(c){let u,d;if(c instanceof EEe)return null;if(c instanceof w_||c instanceof ZB){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 txt(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"?noe(o,l):a.type==="string"||a.type==="bytes"?au(Yj(o))===l:o===l}catch{return!1}}return Array.isArray(e)&&Array.isArray(r)?r.every((a,o)=>{if(a==null)return!0;const l=n[o];return l?(Array.isArray(a)?a:[a]).some(u=>s(l,u,e[o])):!1}):typeof e=="object"&&!Array.isArray(e)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([a,o])=>{if(o==null)return!0;const l=n.find(u=>u.name===a);return l?(Array.isArray(o)?o:[o]).some(u=>s(l,u,e[a])):!1}):!1}function x1(t,{args:e,eventName:n}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...n?{args:e,eventName:n}:{}}}async function ioe(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=>wT({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"?Hs(r):r,toBlock:typeof s=="bigint"?Hs(s):s}]});const g=x.map(y=>x1(y));return d?soe({abi:d,args:l,logs:g,strict:u}):g}async function Gke(t,e){const{abi:n,address:r,args:s,blockHash:a,eventName:o,fromBlock:l,toBlock:c,strict:u}=e,d=o?_5({abi:n,name:o}):void 0,f=d?void 0:n.filter(x=>x.type==="event");return li(t,ioe,"getLogs")({address:r,args:s,blockHash:a,event:d,events:f,fromBlock:l,toBlock:c,strict:u})}class nxt extends Br{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function rxt(t,e){const{address:n,factory:r,factoryData:s}=e;try{const[a,o,l,c,u,d,f]=await li(t,ox,"readContract")({abi:sxt,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 sxt=[{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 ixt(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 axt(t,{blockCount:e,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const a=n?Hs(n):void 0,o=await t.request({method:"eth_feeHistory",params:[Hs(e),a||r,s]},{dedupe:!!a});return ixt(o)}async function h$(t,{filter:e}){const n="strict"in e&&e.strict,r=await e.request({method:"eth_getFilterChanges",params:[e.id]});if(typeof r[0]=="string")return r;const s=r.map(a=>x1(a));return!("abi"in e)||!e.abi?s:soe({abi:e.abi,logs:s,strict:n})}async function oxt(t,{filter:e}){const n=e.strict??!1,s=(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(a=>x1(a));return e.abi?soe({abi:e.abi,logs:s,strict:n}):s}async function lxt(t,{address:e,blockNumber:n,blockTag:r="latest",slot:s}){const a=n!==void 0?Hs(n):void 0;return await t.request({method:"eth_getStorageAt",params:[e,s,a||r]})}async function aoe(t,{blockHash:e,blockNumber:n,blockTag:r,hash:s,index:a}){var d,f,x;const o=r||"latest",l=n!==void 0?Hs(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,Hs(a)]},{dedupe:!0}):(l||o)&&(c=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||o,Hs(a)]},{dedupe:!!l})),!c)throw new KEe({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)||o$)(c)}async function cxt(t,{hash:e,transactionReceipt:n}){const[r,s]=await Promise.all([li(t,CT,"getBlockNumber")({}),e?li(t,aoe,"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 uxt={"0x0":"reverted","0x1":"success"};function Kke(t){const e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(n=>x1(n)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?ax(t.transactionIndex):null,status:t.status?uxt[t.status]:null,type:t.type?QEe[t.type]||t.type:null};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),e}const dxt=$ae("transactionReceipt",Kke);async function QJ(t,{hash:e}){var s,a,o;const n=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!n)throw new YEe({hash:e});return(((o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionReceipt)==null?void 0:o.format)||Kke)(n)}async function Yke(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=Zj({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=[[]];let x=0,g=0;for(let N=0;N<c.length;N++){const{abi:I,address:P,args:M,functionName:F}=c[N];try{const $=Fm({abi:I,args:M,functionName:F});g+=($.length-2)/2,u>0&&g>u&&f[x].length>0&&(x++,g=($.length-2)/2,f[x]=[]),f[x]=[...f[x],{allowFailure:!0,callData:$,target:P}]}catch($){const L=U3($,{abi:I,address:P,args:M,docsPath:"/docs/contract/multicall",functionName:F});if(!n)throw L;f[x]=[...f[x],{allowFailure:!0,callData:"0x",target:P}]}}const y=await Promise.allSettled(f.map(N=>li(t,ox,"readContract")({abi:zJ,address:d,args:[N],blockNumber:s,blockTag:a,functionName:"aggregate3",stateOverride:l}))),v=[];for(let N=0;N<y.length;N++){const I=y[N];if(I.status==="rejected"){if(!n)throw I.reason;for(let M=0;M<f[N].length;M++)v.push({status:"failure",error:I.reason,result:void 0});continue}const P=I.value;for(let M=0;M<P.length;M++){const{returnData:F,success:$}=P[M],{callData:L}=f[N][M],{abi:z,address:Q,functionName:se,args:ee}=c[v.length];try{if(L==="0x")throw new hT;if(!$)throw new c$({data:F});const K=E5({abi:z,args:ee,data:F,functionName:se});v.push(n?{result:K,status:"success"}:K)}catch(K){const re=U3(K,{abi:z,address:Q,args:ee,docsPath:"/docs/contract/multicall",functionName:se});if(!n)throw re;v.push({error:re,result:void 0,status:"failure"})}}}if(v.length!==c.length)throw new Br("multicall results mismatch");return v}const fxt="0.1.1";function hxt(){return fxt}let Tl=class ZJ extends Error{constructor(e,n={}){const r=(()=>{var c;if(n.cause instanceof ZJ){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 ZJ&&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@${hxt()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return Xke(this,e)}};function Xke(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?Xke(t.cause,e):e?null:t}const pxt="#__bigint";function mxt(t,e,n){return JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString()+pxt:s,n)}function xxt(t,e){if(w0e(t)>e)throw new Axt({givenSize:w0e(t),maxSize:e})}const Gx={zero:48,nine:57,A:65,F:70,a:97,f:102};function v0e(t){if(t>=Gx.zero&&t<=Gx.nine)return t-Gx.zero;if(t>=Gx.A&&t<=Gx.F)return t-(Gx.A-10);if(t>=Gx.a&&t<=Gx.f)return t-(Gx.a-10)}function gxt(t,e={}){const{dir:n,size:r=32}=e;if(r===0)return t;if(t.length>r)throw new _xt({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 ooe(t,e){if(mp(t)>e)throw new Pxt({givenSize:mp(t),maxSize:e})}function bxt(t,e){if(typeof e=="number"&&e>0&&e>mp(t)-1)throw new tTe({offset:e,position:"start",size:mp(t)})}function yxt(t,e,n){if(typeof e=="number"&&typeof n=="number"&&mp(t)!==n-e)throw new tTe({offset:n,position:"end",size:mp(t)})}function Qke(t,e={}){const{dir:n,size:r=32}=e;if(r===0)return t;const s=t.replace("0x","");if(s.length>r*2)throw new Fxt({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const vxt=new TextEncoder;function wxt(t){return t instanceof Uint8Array?t:typeof t=="string"?Sxt(t):Cxt(t)}function Cxt(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Sxt(t,e={}){const{size:n}=e;let r=t;n&&(ooe(t,n),r=H3(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=v0e(s.charCodeAt(c++)),d=v0e(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new Tl(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[l]=u*16+d}return o}function Nxt(t,e={}){const{size:n}=e,r=vxt.encode(t);return typeof n=="number"?(xxt(r,n),jxt(r,n)):r}function jxt(t,e){return gxt(t,{dir:"right",size:e})}function w0e(t){return t.length}let Axt=class extends Tl{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"})}},_xt=class extends Tl{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 Ext=new TextEncoder,kxt=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Txt(t,e={}){const{strict:n=!1}=e;if(!t)throw new C0e(t);if(typeof t!="string")throw new C0e(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new S0e(t);if(!t.startsWith("0x"))throw new S0e(t)}function lx(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function Zke(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(ooe(n,e.size),z3(n,e.size)):n}function Jke(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=kxt[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(ooe(r,e.size),H3(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 eTe({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?z3(c,r):c}function loe(t,e={}){return Jke(Ext.encode(t),e)}function z3(t,e){return Qke(t,{dir:"left",size:e})}function H3(t,e){return Qke(t,{dir:"right",size:e})}function coe(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&&yxt(a,e,n),a}function mp(t){return Math.ceil((t.length-2)/2)}function Ixt(t,e={}){const{strict:n=!1}=e;try{return Txt(t,{strict:n}),!0}catch{return!1}}class eTe extends Tl{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 C0e extends Tl{constructor(e){super(`Value \`${typeof e=="object"?mxt(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 S0e extends Tl{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 Pxt extends Tl{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 tTe extends Tl{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 Fxt extends Tl{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 Oxt(t){return{address:t.address,amount:od(t.amount),index:od(t.index),validatorIndex:od(t.validatorIndex)}}function Mxt(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(Oxt)}}}async function JJ(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?Mxt(x.blockOverrides):void 0,y=x.calls.map(C=>{const N=C,I=N.account?Vu(N.account):void 0,P={...N,data:N.abi?Fm(N):N.data,from:N.from??(I==null?void 0:I.address)};return Xj(P),bT(P)}),v=x.stateOverrides?Wae(x.stateOverrides):void 0;c.push({blockOverrides:g,calls:y,stateOverrides:v})}const d=(n?Hs(n):void 0)||r;return(await t.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:a,traceTransfers:o,validation:l},d]})).map((x,g)=>({...Hae(x),calls:x.calls.map((y,v)=>{var se,ee;const{abi:C,args:N,functionName:I,to:P}=s[g].calls[v],M=((se=y.error)==null?void 0:se.data)??y.returnData,F=BigInt(y.gasUsed),$=(ee=y.logs)==null?void 0:ee.map(K=>x1(K)),L=y.status==="0x1"?"success":"failure",z=C&&L==="success"&&M!=="0x"?E5({abi:C,data:M,functionName:I}):null,Q=(()=>{var re;if(L==="success")return;let K;if(((re=y.error)==null?void 0:re.data)==="0x"?K=new hT:y.error&&(K=new c$(y.error)),!!K)return U3(K,{abi:C??[],address:P,args:N,functionName:I??"<unknown>"})})();return{data:M,gasUsed:F,logs:$,status:L,...L==="success"?{result:z}:{error:Q}}})}))}catch(c){const u=c,d=s$(u,{});throw d instanceof xT?u:d}}function N0e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Rxt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function uoe(t,...e){if(!Rxt(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 j0e(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 Lxt(t,e){uoe(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 Dxt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),A0e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Bxt=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function _0e(t){for(let e=0;e<t.length;e++)t[e]=Bxt(t[e])}function $xt(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function nTe(t){return typeof t=="string"&&(t=$xt(t)),uoe(t),t}let Uxt=class{clone(){return this._cloneInto()}};function zxt(t){const e=r=>t().update(nTe(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}const NP=BigInt(2**32-1),E0e=BigInt(32);function Hxt(t,e=!1){return e?{h:Number(t&NP),l:Number(t>>E0e&NP)}:{h:Number(t>>E0e&NP)|0,l:Number(t&NP)|0}}function Vxt(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}=Hxt(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const Wxt=(t,e,n)=>t<<n|e>>>32-n,qxt=(t,e,n)=>e<<n|t>>>32-n,Gxt=(t,e,n)=>e<<n-32|t>>>64-n,Kxt=(t,e,n)=>t<<n-32|e>>>64-n,rTe=[],sTe=[],iTe=[],Yxt=BigInt(0),YA=BigInt(1),Xxt=BigInt(2),Qxt=BigInt(7),Zxt=BigInt(256),Jxt=BigInt(113);for(let t=0,e=YA,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],rTe.push(2*(5*r+n)),sTe.push((t+1)*(t+2)/2%64);let s=Yxt;for(let a=0;a<7;a++)e=(e<<YA^(e>>Qxt)*Jxt)%Zxt,e&Xxt&&(s^=YA<<(YA<<BigInt(a))-YA);iTe.push(s)}const[egt,tgt]=Vxt(iTe,!0),k0e=(t,e,n)=>n>32?Gxt(t,e,n):Wxt(t,e,n),T0e=(t,e,n)=>n>32?Kxt(t,e,n):qxt(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=k0e(u,d,1)^n[l],x=T0e(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=sTe[o],c=k0e(s,a,l),u=T0e(s,a,l),d=rTe[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]^=egt[r],t[1]^=tgt[r]}n.fill(0)}let rgt=class aTe extends Uxt{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,N0e(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Dxt(this.state)}keccak(){A0e||_0e(this.state32),ngt(this.state32,this.rounds),A0e||_0e(this.state32),this.posOut=0,this.pos=0}update(e){j0e(this);const{blockLen:n,state:r}=this;e=nTe(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){j0e(this,!1),uoe(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 N0e(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Lxt(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 aTe(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 sgt=(t,e,n)=>zxt(()=>new rgt(e,t,n)),igt=sgt(1,136,256/8);function oTe(t,e={}){const{as:n=typeof t=="string"?"Hex":"Bytes"}=e,r=igt(wxt(t));return n==="Bytes"?r:Jke(r)}class agt 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 ogt={checksum:new agt(8192)},hV=ogt.checksum,lgt=/^0x[a-fA-F0-9]{40}$/;function p$(t,e={}){const{strict:n=!0}=e;if(!lgt.test(t))throw new I0e({address:t,cause:new ugt});if(n){if(t.toLowerCase()===t)return;if(cgt(t)!==t)throw new I0e({address:t,cause:new dgt})}}function cgt(t){if(hV.has(t))return hV.get(t);p$(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=oTe(Nxt(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 hV.set(t,s),s}function eee(t,e={}){const{strict:n=!0}=e??{};try{return p$(t,{strict:n}),!0}catch{return!1}}let I0e=class extends Tl{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"})}},ugt=class extends Tl{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 dgt extends Tl{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function tee(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 Tl("Unable to normalize signature.");return s}function nee(t,e){const n=typeof t,r=e.type;switch(r){case"address":return eee(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)=>nee(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=>nee(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function lTe(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 lTe(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")?eee(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?eee(n[r],{strict:!1}):!1)return o}}function cTe(t,e={}){const{prepare:n=!0}=e,r=Array.isArray(t)||typeof t=="string"?f0e(t):t;return{...r,...n?{hash:r4(r)}:{}}}function fgt(t,e,n){const{args:r=[],prepare:s=!0}=n,a=Ixt(e,{strict:!1}),o=t.filter(u=>a?u.type==="function"||u.type==="error"?uTe(u)===coe(e,0,4):u.type==="event"?r4(u)===e:!1:"name"in u&&u.name===e);if(o.length===0)throw new ree({name:e});if(o.length===1)return{...o[0],...s?{hash:r4(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:r4(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?nee(f,g):!1})){if(l&&"inputs"in l&&l.inputs){const f=lTe(u.inputs,l.inputs,r);if(f)throw new pgt({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 ree({name:e});return{...c,...s?{hash:r4(c)}:{}}}function uTe(t){return coe(r4(t),0,4)}function hgt(t){const e=typeof t=="string"?t:aR(t);return tee(e)}function r4(t){return typeof t!="string"&&"hash"in t&&t.hash?t.hash:oTe(loe(hgt(t)))}class pgt extends Tl{constructor(e,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${tee(aR(e.abiItem))}\`, and`,`\`${n.type}\` in \`${tee(aR(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 ree extends Tl{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 mgt=/^(.*)\[([0-9]*)\]$/,xgt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,dTe=/^(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 ggt({checksumAddress:t,parameters:e,values:n}){const r=[];for(let s=0;s<e.length;s++)r.push(doe({checksumAddress:t,parameter:e[s],value:n[s]}));return r}function doe({checksumAddress:t=!1,parameter:e,value:n}){const r=e,s=jgt(r.type);if(s){const[a,o]=s;return ygt(n,{checksumAddress:t,length:a,parameter:{...r,type:o}})}if(r.type==="tuple")return Ngt(n,{checksumAddress:t,parameter:r});if(r.type==="address")return bgt(n,{checksum:t});if(r.type==="bool")return wgt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const a=r.type.startsWith("int"),[,,o="256"]=dTe.exec(r.type)??[];return Cgt(n,{signed:a,size:Number(o)})}if(r.type.startsWith("bytes"))return vgt(n,{type:r.type});if(r.type==="string")return Sgt(n);throw new xTe(r.type)}function foe(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?e+=32:e+=mp(l)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?(n.push(od(e+s,{size:32})),r.push(l),s+=mp(l)):n.push(l)}return lx(...n,...r)}function bgt(t,e){const{checksum:n=!1}=e;return p$(t,{strict:n}),{dynamic:!1,encoded:z3(t.toLowerCase())}}function ygt(t,e){const{checksumAddress:n,length:r,parameter:s}=e,a=r===null;if(!Array.isArray(t))throw new _gt(t);if(!a&&t.length!==r)throw new Agt({expectedLength:r,givenLength:t.length,type:`${s.type}[${r}]`});let o=!1;const l=[];for(let c=0;c<t.length;c++){const u=doe({checksumAddress:n,parameter:s,value:t[c]});u.dynamic&&(o=!0),l.push(u)}if(a||o){const c=foe(l);if(a){const u=od(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?lx(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:lx(...l.map(({encoded:c})=>c))}}function vgt(t,{type:e}){const[,n]=e.split("bytes"),r=mp(t);if(!n){let s=t;return r%32!==0&&(s=H3(s,Math.ceil((t.length-2)/2/32)*32)),{dynamic:!0,encoded:lx(z3(od(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new pTe({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:H3(t)}}function wgt(t){if(typeof t!="boolean")throw new Tl(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:z3(Zke(t))}}function Cgt(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 eTe({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 Sgt(t){const e=loe(t),n=Math.ceil(mp(e)/32),r=[];for(let s=0;s<n;s++)r.push(H3(coe(e,s*32,(s+1)*32)));return{dynamic:!0,encoded:lx(H3(od(mp(e),{size:32})),...r)}}function Ngt(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=doe({checksumAddress:n,parameter:l,value:t[c]});a.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?foe(a):lx(...a.map(({encoded:o})=>o))}}function jgt(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}function fTe(t,e,n){const{checksumAddress:r=!1}={};if(t.length!==e.length)throw new mTe({expectedLength:t.length,givenLength:e.length});const s=ggt({checksumAddress:r,parameters:t,values:e}),a=foe(s);return a.length===0?"0x":a}function hTe(t,e){if(t.length!==e.length)throw new mTe({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(hTe.encode(s,a))}return lx(...n)}(function(t){function e(n,r,s=!1){if(n==="address"){const c=r;return p$(c),z3(c.toLowerCase(),s?32:0)}if(n==="string")return loe(r);if(n==="bytes")return r;if(n==="bool")return z3(Zke(r),s?32:1);const a=n.match(dTe);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(xgt);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new pTe({expectedSize:Number.parseInt(u),value:r});return H3(r,s?32:0)}const l=n.match(mgt);if(l&&Array.isArray(r)){const[c,u]=l,d=[];for(let f=0;f<r.length;f++)d.push(e(u,r[f],!0));return d.length===0?"0x":lx(...d)}throw new xTe(n)}t.encode=e})(hTe);class Agt extends Tl{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 pTe extends Tl{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 mTe extends Tl{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 _gt extends Tl{constructor(e){super(`Value \`${e}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class xTe extends Tl{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 Egt(t,e){var s;const{bytecode:n,args:r}=e;return lx(n,(s=t.inputs)!=null&&s.length&&(r!=null&&r.length)?fTe(t.inputs,r):"0x")}function kgt(t){return cTe(t)}function Tgt(t,...e){const{overloads:n}=t,r=n?Igt([t,...n],t.name,{args:e[0]}):t,s=Pgt(r),a=e.length>0?fTe(r.inputs,e[0]):void 0;return a?lx(s,a):s}function iC(t,e={}){return cTe(t,e)}function Igt(t,e,n){const r=fgt(t,e,n);if(r.type!=="function")throw new ree({name:e,type:"function"});return r}function Pgt(t){return uTe(t)}const Fgt="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r0="0x0000000000000000000000000000000000000000",jP=new JB(8192);function Ogt(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(jP.get(n))return jP.get(n);const r=t().finally(()=>jP.delete(n));return jP.set(n,r),r}async function see(t){return new Promise(e=>setTimeout(e,t))}function oR(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 see(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 Mgt(t,e={}){return async(n,r={})=>{var f;const{dedupe:s=!1,methods:a,retryDelay:o=150,retryCount:l=3,uid:c}={...e,...r},{method:u}=n;if((f=a==null?void 0:a.exclude)!=null&&f.includes(u))throw new uw(new Error("method not supported"),{method:u});if(a!=null&&a.include&&!a.include.includes(u))throw new uw(new Error("method not supported"),{method:u});const d=s?tN(`${c}.${Rc(n)}`):void 0;return Ogt(()=>oR(async()=>{try{return await t(n)}catch(x){const g=x;switch(g.code){case S_.code:throw new S_(g);case N_.code:throw new N_(g);case j_.code:throw new j_(g,{method:n.method});case A_.code:throw new A_(g);case D3.code:throw new D3(g);case B3.code:throw new B3(g);case __.code:throw new __(g);case Ry.code:throw new Ry(g);case E_.code:throw new E_(g);case uw.code:throw new uw(g,{method:n.method});case sN.code:throw new sN(g);case k_.code:throw new k_(g);case No.code:throw new No(g);case T_.code:throw new T_(g);case I_.code:throw new I_(g);case P_.code:throw new P_(g);case F_.code:throw new F_(g);case pp.code:throw new pp(g);case O_.code:throw new O_(g);case M_.code:throw new M_(g);case R_.code:throw new R_(g);case L_.code:throw new L_(g);case D_.code:throw new D_(g);case B_.code:throw new B_(g);case $_.code:throw new $_(g);case 5e3:throw new No(g);default:throw x instanceof Br?x:new Opt(g)}}},{delay:({count:x,error:g})=>{var y;if(g&&g instanceof S9){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})=>Rgt(x)}),{enabled:s,id:d})}}function Rgt(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===sN.code||t.code===D3.code:t instanceof S9&&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 m$(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function hoe(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 Lgt(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const P0e=Lgt();function Dgt(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 hoe(async({signal:y})=>{const v={...l,body:Array.isArray(r)?Rc(r.map(P=>({jsonrpc:"2.0",id:P.id??P0e.take(),...P}))):Rc({jsonrpc:"2.0",id:r.id??P0e.take(),...r}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:d||(o>0?y:null)},C=new Request(t,v),N=await(s==null?void 0:s(C,v))??{...v,url:t};return await fetch(N.url??t,N)},{errorInstance:new t0e({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 S9({body:r,details:Rc(g.error)||x.statusText,headers:x.headers,status:x.status,url:t});return g}catch(x){throw x instanceof S9||x instanceof t0e?x:new S9({body:r,cause:x,url:t})}}}}class Bgt extends Br{constructor({domain:e}){super(`Invalid domain "${Rc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class $gt extends Br{constructor({primaryType:e,types:n}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class Ugt extends Br{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function zgt(t){const{domain:e={},message:n,primaryType:r}=t,s={EIP712Domain:CTe({domain:e}),...t.types};wTe({domain:e,message:n,primaryType:r,types:s});const a=["0x1901"];return e&&a.push(Hgt({domain:e,types:s})),r!=="EIP712Domain"&&a.push(gTe({data:n,primaryType:r,types:s})),au(m1(a))}function Hgt({domain:t,types:e}){return gTe({data:t,primaryType:"EIP712Domain",types:e})}function gTe({data:t,primaryType:e,types:n}){const r=bTe({data:t,primaryType:e,types:n});return au(r)}function bTe({data:t,primaryType:e,types:n}){const r=[{type:"bytes32"}],s=[Vgt({primaryType:e,types:n})];for(const a of n[e]){const[o,l]=vTe({types:n,name:a.name,type:a.type,value:t[a.name]});r.push(o),s.push(l)}return C2(r,s)}function Vgt({primaryType:t,types:e}){const n=pi(Wgt({primaryType:t,types:e}));return au(n)}function Wgt({primaryType:t,types:e}){let n="";const r=yTe({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 yTe({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])yTe({primaryType:a.type,types:e},n);return n}function vTe({types:t,name:e,type:n,value:r}){if(t[n]!==void 0)return[{type:"bytes32"},au(bTe({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=>vTe({name:e,type:s,types:t,value:o}));return[{type:"bytes32"},au(C2(a.map(([o])=>o),a.map(([,o])=>o)))]}return[{type:n},r]}function qgt(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 Rc({domain:o,message:l,primaryType:r,types:s})}function wTe(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(UEe);if(x&&(typeof f=="number"||typeof f=="bigint")){const[v,C,N]=x;Hs(f,{signed:C==="int",size:Number.parseInt(N)/8})}if(d==="address"&&typeof f=="string"&&!uc(f))throw new Sd({address:f});const g=d.match(npt);if(g){const[v,C]=g;if(C&&cl(f)!==Number.parseInt(C))throw new Aht({expectedSize:Number.parseInt(C),givenSize:cl(f)})}const y=s[d];y&&(Ggt(d),a(y,f))}};if(s.EIP712Domain&&e){if(typeof e!="object")throw new Bgt({domain:e});a(s.EIP712Domain,e)}if(r!=="EIP712Domain")if(s[r])a(s[r],n);else throw new $gt({primaryType:r,types:s})}function CTe({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 Ggt(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new Ugt({type:t})}function Kgt(t){const{authorizationList:e}=t;if(e)for(const n of e){const{chainId:r}=n,s=n.address;if(!uc(s))throw new Sd({address:s});if(r<0)throw new r$({chainId:r})}poe(t)}function Ygt(t){const{blobVersionedHashes:e}=t;if(e){if(e.length===0)throw new ike;for(const n of e){const r=cl(n),s=ax(R3(n,0,1));if(r!==32)throw new amt({hash:n,size:r});if(s!==ske)throw new omt({hash:n,version:s})}}poe(t)}function poe(t){const{chainId:e,maxPriorityFeePerGas:n,maxFeePerGas:r,to:s}=t;if(e<=0)throw new r$({chainId:e});if(s&&!uc(s))throw new Sd({address:s});if(r&&r>a$)throw new L3({maxFeePerGas:r});if(n&&r&&n>r)throw new C_({maxFeePerGas:r,maxPriorityFeePerGas:n})}function Xgt(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(e<=0)throw new r$({chainId:e});if(a&&!uc(a))throw new Sd({address:a});if(n||s)throw new Br("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>a$)throw new L3({maxFeePerGas:r})}function Qgt(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(a&&!uc(a))throw new Sd({address:a});if(typeof e<"u"&&e<=0)throw new r$({chainId:e});if(n||s)throw new Br("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>a$)throw new L3({maxFeePerGas:r})}function x$(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 kpt({storageKey:s[a]});if(!uc(r,{strict:!1}))throw new Sd({address:r});e.push([r,s])}return e}function Zgt(t,e){const n=oke(t);return n==="eip1559"?t1t(t,e):n==="eip2930"?n1t(t,e):n==="eip4844"?e1t(t,e):n==="eip7702"?Jgt(t,e):r1t(t,e)}function Jgt(t,e){const{authorizationList:n,chainId:r,gas:s,nonce:a,to:o,value:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;Kgt(t);const x=x$(d),g=s1t(n);return Pm(["0x04",Jy([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,...ST(t,e)])])}function e1t(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;Ygt(t);let x=t.blobVersionedHashes,g=t.sidecars;if(t.blobs&&(typeof x>"u"||typeof g>"u")){const P=typeof t.blobs[0]=="string"?t.blobs:t.blobs.map($=>Yl($)),M=t.kzg,F=Kae({blobs:P,kzg:M});if(typeof x>"u"&&(x=tke({commitments:F})),typeof g>"u"){const $=Yae({blobs:P,commitments:F,kzg:M});g=ake({blobs:P,commitments:F,proofs:$})}}const y=x$(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??[],...ST(t,e)],C=[],N=[],I=[];if(g)for(let P=0;P<g.length;P++){const{blob:M,commitment:F,proof:$}=g[P];C.push(M),N.push(F),I.push($)}return Pm(["0x03",Jy(g?[v,C,N,I]:v)])}function t1t(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerGas:l,maxPriorityFeePerGas:c,accessList:u,data:d}=t;poe(t);const f=x$(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,...ST(t,e)];return Pm(["0x02",Jy(x)])}function n1t(t,e){const{chainId:n,gas:r,data:s,nonce:a,to:o,value:l,accessList:c,gasPrice:u}=t;Xgt(t);const d=x$(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,...ST(t,e)];return Pm(["0x01",Jy(f)])}function r1t(t,e){const{chainId:n=0,gas:r,data:s,nonce:a,to:o,value:l,gasPrice:c}=t;Qgt(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 _pt({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 Jy(u)}function ST(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 s1t(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",...ST({},a)])}return e}const i1t=`Ethereum Signed Message:
`;function a1t(t){const e=typeof t=="string"?tN(t):typeof t.raw=="string"?t.raw:Yl(t.raw),n=tN(`${i1t}${cl(e)}`);return m1([n,e])}function STe(t,e){return au(a1t(t),e)}const NTe="0x6492649264926492649264926492649264926492649264926492649264926492";function o1t(t){return $Ee(t,-32)===NTe}function l1t(t){const{address:e,data:n,signature:r,to:s="hex"}=t,a=Pm([C2([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,n,r]),NTe]);return s==="hex"?a:hp(a)}class c1t extends Br{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function u1t(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new c1t({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 d1t="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 Br("`account` is required when `traceAssetChanges` is true");const d=u?Egt(kgt("constructor(bytes, bytes)"),{bytecode:Oke,args:[d1t,Tgt(iC("function getBalance(address)"),[u.address])]}):void 0,f=o?await Promise.all(e.calls.map(async W=>{if(!W.data&&!W.abi)return;const{accessList:ne}=await Hke(t,{account:u.address,...W,data:W.abi?Fm(W):W.data});return ne.map(({address:oe,storageKeys:he})=>he.length>0?oe:null)})).then(W=>W.flat().filter(Boolean)):[],x=a==null?void 0:a.map(W=>W.address===(u==null?void 0:u.address)?{...W,nonce:0}:W),g=await JJ(t,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:d}],stateOverrides:a},{calls:f.map((W,ne)=>({abi:[iC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:W,from:r0,nonce:ne})),stateOverrides:[{address:r0,nonce:0}]}]:[],{calls:[...s,{}].map((W,ne)=>({...W,from:u==null?void 0:u.address,nonce:ne})),stateOverrides:x},...o?[{calls:[{data:d}]},{calls:f.map((W,ne)=>({abi:[iC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:W,from:r0,nonce:ne})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((W,ne)=>({to:W,abi:[iC("function decimals() returns (uint256)")],functionName:"decimals",from:r0,nonce:ne})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((W,ne)=>({to:W,abi:[iC("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:r0,nonce:ne})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((W,ne)=>({to:W,abi:[iC("function symbol() returns (string)")],functionName:"symbol",from:r0,nonce:ne})),stateOverrides:[{address:r0,nonce:0}]}]:[]],traceTransfers:l,validation:c}),y=o?g[2]:g[0],[v,C,,N,I,P,M,F]=o?g:[],{calls:$,...L}=y,z=$.slice(0,-1)??[],Q=(v==null?void 0:v.calls)??[],se=(C==null?void 0:C.calls)??[],ee=[...Q,...se].map(W=>W.status==="success"?cd(W.data):null),K=(N==null?void 0:N.calls)??[],re=(I==null?void 0:I.calls)??[],de=[...K,...re].map(W=>W.status==="success"?cd(W.data):null),G=((P==null?void 0:P.calls)??[]).map(W=>W.status==="success"?W.result:null),ie=((F==null?void 0:F.calls)??[]).map(W=>W.status==="success"?W.result:null),ae=((M==null?void 0:M.calls)??[]).map(W=>W.status==="success"?W.result:null),q=[];for(const[W,ne]of de.entries()){const oe=ee[W];if(typeof ne!="bigint"||typeof oe!="bigint")continue;const he=G[W-1],_e=ie[W-1],xe=ae[W-1],Se=W===0?{address:Fgt,decimals:18,symbol:"ETH"}:{address:f[W-1],decimals:xe||he?Number(he??1):void 0,symbol:_e??void 0};q.some(ge=>ge.token.address===Se.address)||q.push({token:Se,value:{pre:oe,post:ne,diff:ne-oe}})}return{assetChanges:q,block:L,results:z}}const pV=new Map,F0e=new Map;let h1t=0;function e2(t,e,n){const r=++h1t,s=()=>pV.get(t)||[],a=()=>{const d=s();pV.set(t,d.filter(f=>f.id!==r))},o=()=>{const d=s();if(!d.some(x=>x.id===r))return;const f=F0e.get(t);d.length===1&&f&&f(),a()},l=s();if(pV.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"&&F0e.set(t,u),o}function NT(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 see(c);const u=async()=>{s&&(await t({unpoll:a}),await see(r),u())};u()})(),a}function p1t(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=Rc(["watchBlocks",t.uid,e,n,r,d,c]);return e2(y,{onBlock:s,onError:a},v=>NT(async()=>{var C;try{const N=await li(t,L0,"getBlock")({blockTag:e,includeTransactions:d});if(N.number&&(f!=null&&f.number)){if(N.number===f.number)return;if(N.number-f.number>1&&n)for(let I=(f==null?void 0:f.number)+1n;I<N.number;I++){const P=await li(t,L0,"getBlock")({blockNumber:I,includeTransactions:d});v.onBlock(P,f),f=P}}(!(f!=null&&f.number)||e==="pending"&&!(N!=null&&N.number)||N.number&&N.number>f.number)&&(v.onBlock(N,f),f=N)}catch(N){(C=v.onError)==null||C.call(v,N)}},{emitOnBegin:r,interval:c}))})():(()=>{let y=!0,v=!0,C=()=>y=!1;return(async()=>{try{r&&li(t,L0,"getBlock")({blockTag:e,includeTransactions:d}).then(P=>{y&&v&&(s(P,void 0),v=!1)});const N=(()=>{if(t.transport.type==="fallback"){const P=t.transport.transports.find(M=>M.config.type==="webSocket");return P?P.value:t.transport}return t.transport})(),{unsubscribe:I}=await N.subscribe({params:["newHeads"],async onData(P){if(!y)return;const M=await li(t,L0,"getBlock")({blockNumber:P.blockNumber,includeTransactions:d}).catch(()=>{});y&&(s(M,f),v=!1,f=M)},onError(P){a==null||a(P)}});C=I,y||C()}catch(N){a==null||a(N)}})(),()=>C()})()}function jTe(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=Rc(["watchBlockNumber",t.uid,e,n,o]);return e2(f,{onBlockNumber:r,onError:s},x=>NT(async()=>{var g;try{const y=await li(t,CT,"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=Rc(["watchBlockNumber",t.uid,e,n]);return e2(f,{onBlockNumber:r,onError:s},x=>{let g=!0,y=()=>g=!1;return(async()=>{try{const v=(()=>{if(t.transport.type==="fallback"){const N=t.transport.transports.find(I=>I.config.type==="webSocket");return N?N.value:t.transport}return t.transport})(),{unsubscribe:C}=await v.subscribe({params:["newHeads"],onData(N){var P;if(!g)return;const I=cd((P=N.result)==null?void 0:P.number);x.onBlockNumber(I,c),c=I},onError(N){var I;(I=x.onError)==null||I.call(x,N)}});y=C,g||y()}catch(v){s==null||s(v)}})(),()=>y()})})()}async function g$(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function m1t(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=Rc(["watchEvent",e,n,r,t.uid,s,d,o]);return e2(C,{onLogs:c,onError:l},N=>{let I;o!==void 0&&(I=o-1n);let P,M=!1;const F=NT(async()=>{var $;if(!M){try{P=await li(t,Wke,"createEventFilter")({address:e,args:n,event:s,events:a,strict:g,fromBlock:o})}catch{}M=!0;return}try{let L;if(P)L=await li(t,h$,"getFilterChanges")({filter:P});else{const z=await li(t,CT,"getBlockNumber")({});I&&I!==z?L=await li(t,ioe,"getLogs")({address:e,args:n,event:s,events:a,fromBlock:I+1n,toBlock:z}):L=[],I=z}if(L.length===0)return;if(r)N.onLogs(L);else for(const z of L)N.onLogs([z])}catch(L){P&&L instanceof B3&&(M=!1),($=N.onError)==null||$.call(N,L)}},{emitOnBegin:!0,interval:d});return async()=>{P&&await li(t,g$,"uninstallFilter")({filter:P}),F()}})})():(()=>{let C=!0,N=()=>C=!1;return(async()=>{try{const I=(()=>{if(t.transport.type==="fallback"){const $=t.transport.transports.find(L=>L.config.type==="webSocket");return $?$.value:t.transport}return t.transport})(),P=a??(s?[s]:void 0);let M=[];P&&(M=[P.flatMap(L=>wT({abi:[L],eventName:L.name,args:n}))],s&&(M=M[0]));const{unsubscribe:F}=await I.subscribe({params:["logs",{address:e,topics:M}],onData($){var z;if(!C)return;const L=$.result;try{const{eventName:Q,args:se}=roe({abi:P??[],data:L.data,topics:L.topics,strict:g}),ee=x1(L,{args:se,eventName:Q});c([ee])}catch(Q){let se,ee;if(Q instanceof w_||Q instanceof ZB){if(f)return;se=Q.abiItem.name,ee=(z=Q.abiItem.inputs)==null?void 0:z.some(re=>!("name"in re&&re.name))}const K=x1(L,{args:ee?[]:{},eventName:se});c([K])}},onError($){l==null||l($)}});N=F,C||N()}catch(I){l==null||l(I)}})(),()=>N()})()}function x1t(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=Rc(["watchPendingTransactions",t.uid,e,a]);return e2(u,{onTransactions:r,onError:n},d=>{let f;const x=NT(async()=>{var g;try{if(!f)try{f=await li(t,qke,"createPendingTransactionFilter")({});return}catch(v){throw x(),v}const y=await li(t,h$,"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 li(t,g$,"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 g1t(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?ax(t.nonce):void 0,storageProof:t.storageProof?g1t(t.storageProof):void 0}}async function y1t(t,{address:e,blockNumber:n,blockTag:r,storageKeys:s}){const a=r??"latest",o=n!==void 0?Hs(n):void 0,l=await t.request({method:"eth_getProof",params:[e,s,o||a]});return b1t(l)}async function v1t(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=Rc(["waitForTransactionReceipt",t.uid,n]);let u,d,f,x=!1;const{promise:g,resolve:y,reject:v}=Rke(),C=l?setTimeout(()=>v(new Ipt({hash:n})),l):void 0,N=e2(c,{onReplaced:r,resolve:y,reject:v},I=>{const P=li(t,jTe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:s,async onBlockNumber(M){const F=L=>{clearTimeout(C),P(),L(),N()};let $=M;if(!x)try{if(f){if(e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>I.resolve(f));return}if(u||(x=!0,await oR(async()=>{u=await li(t,aoe,"getTransaction")({hash:n}),u.blockNumber&&($=u.blockNumber)},{delay:o,retryCount:a}),x=!1),f=await li(t,QJ,"getTransactionReceipt")({hash:n}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>I.resolve(f))}catch(L){if(L instanceof KEe||L instanceof YEe){if(!u){x=!1;return}try{d=u,x=!0;const z=await oR(()=>li(t,L0,"getBlock")({blockNumber:$,includeTransactions:!0}),{delay:o,retryCount:a,shouldRetry:({error:ee})=>ee instanceof XEe});x=!1;const Q=z.transactions.find(({from:ee,nonce:K})=>ee===d.from&&K===d.nonce);if(!Q||(f=await li(t,QJ,"getTransactionReceipt")({hash:Q.hash}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e)))return;let se="replaced";Q.to===d.to&&Q.value===d.value&&Q.input===d.input?se="repriced":Q.from===Q.to&&Q.value===0n&&(se="cancelled"),F(()=>{var ee;(ee=I.onReplaced)==null||ee.call(I,{reason:se,replacedTransaction:d,transaction:Q,transactionReceipt:f}),I.resolve(f)})}catch(z){F(()=>I.reject(z))}}else F(()=>I.reject(L))}}})});return g}async function w1t(t,{account:e=t.account,message:n}){if(!e)throw new n$({docsPath:"/docs/actions/wallet/signMessage"});const r=Vu(e);if(r.signMessage)return r.signMessage({message:n});const s=typeof n=="string"?tN(n):n.raw instanceof Uint8Array?pi(n.raw):n.raw;return t.request({method:"personal_sign",params:[s,r.address]},{retryCount:0})}async function C1t(t,e){const{account:n=t.account,domain:r,message:s,primaryType:a}=e;if(!n)throw new n$({docsPath:"/docs/actions/wallet/signTypedData"});const o=Vu(n),l={EIP712Domain:CTe({domain:r}),...e.types};if(wTe({domain:r,message:s,primaryType:a,types:l}),o.signTypedData)return o.signTypedData({domain:r,message:s,primaryType:a,types:l});const c=qgt({domain:r,message:s,primaryType:a,types:l});return t.request({method:"eth_signTypedData_v4",params:[o.address,c]},{retryCount:0})}async function S1t(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 li(t,d$,"call")({batch:!1,data:`${u}${a?a.replace("0x",""):""}`,to:r,...l,account:c}),f=E5({abi:n,args:s,functionName:o,data:d||"0x"}),x=n.filter(g=>"name"in g&&g.name===e.functionName);return{result:f,request:{abi:x,address:r,args:s,dataSuffix:a,functionName:o,...l,account:c}}}catch(d){throw U3(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:o,sender:c==null?void 0:c.address})}}let ATe=class extends Iae{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Pht(e);const r=e$(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<a.length;o++)a[o]^=54;this.iHash.update(a),this.oHash=e.create();for(let o=0;o<a.length;o++)a[o]^=106;this.oHash.update(a),a.fill(0)}update(e){return rN(this),this.iHash.update(e),this}digestInto(e){rN(this),pT(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 _Te=(t,e,n)=>new ATe(t,e).update(n).digest();_Te.create=(t,e)=>new ATe(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const moe=BigInt(0),iee=BigInt(1);function iN(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function xoe(t){if(!iN(t))throw new Error("Uint8Array expected")}function z_(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function AP(t){const e=t.toString(16);return e.length&1?"0"+e:e}function ETe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?moe:BigInt("0x"+t)}const kTe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",N1t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function H_(t){if(xoe(t),kTe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=N1t[t[n]];return e}const Kx={_0:48,_9:57,A:65,F:70,a:97,f:102};function O0e(t){if(t>=Kx._0&&t<=Kx._9)return t-Kx._0;if(t>=Kx.A&&t<=Kx.F)return t-(Kx.A-10);if(t>=Kx.a&&t<=Kx.f)return t-(Kx.a-10)}function lR(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(kTe)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=O0e(t.charCodeAt(a)),l=O0e(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 h3(t){return ETe(H_(t))}function TTe(t){return xoe(t),ETe(H_(Uint8Array.from(t).reverse()))}function V_(t,e){return lR(t.toString(16).padStart(e*2,"0"))}function ITe(t,e){return V_(t,e).reverse()}function Gp(t,e,n){let r;if(typeof e=="string")try{r=lR(e)}catch(a){throw new Error(t+" must be hex string or Uint8Array, cause: "+a)}else if(iN(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return r}function cR(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];xoe(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 mV=t=>typeof t=="bigint"&&moe<=t;function goe(t,e,n){return mV(t)&&mV(e)&&mV(n)&&e<=t&&t<n}function S4(t,e,n,r){if(!goe(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function j1t(t){let e;for(e=0;t>moe;t>>=iee,e+=1);return e}const b$=t=>(iee<<BigInt(t))-iee,xV=t=>new Uint8Array(t),M0e=t=>Uint8Array.from(t);function A1t(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=xV(t),s=xV(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=xV(0))=>{s=l(M0e([0]),f),r=l(),f.length!==0&&(s=l(M0e([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 cR(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const _1t={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||iN(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function y$(t,e,n={}){const r=(s,a,o)=>{const l=_1t[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 R0e(t){const e=new WeakMap;return(n,...r)=>{const s=e.get(n);if(s!==void 0)return s;const a=t(n,...r);return e.set(n,a),a}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pc=BigInt(0),Sl=BigInt(1),Jv=BigInt(2),E1t=BigInt(3),aee=BigInt(4),L0e=BigInt(5),D0e=BigInt(8);function Xd(t,e){const n=t%e;return n>=Pc?n:e+n}function k1t(t,e,n){if(e<Pc)throw new Error("invalid exponent, negatives unsupported");if(n<=Pc)throw new Error("invalid modulus");if(n===Sl)return Pc;let r=Sl;for(;e>Pc;)e&Sl&&(r=r*t%n),t=t*t%n,e>>=Sl;return r}function jh(t,e,n){let r=t;for(;e-- >Pc;)r*=r,r%=n;return r}function oee(t,e){if(t===Pc)throw new Error("invert: expected non-zero number");if(e<=Pc)throw new Error("invert: expected positive modulus, got "+e);let n=Xd(t,e),r=e,s=Pc,a=Sl;for(;n!==Pc;){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 T1t(t){const e=(t-Sl)/Jv;let n,r,s;for(n=t-Sl,r=0;n%Jv===Pc;n/=Jv,r++);for(s=Jv;s<t&&k1t(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)/aee;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)/Jv;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,Sl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function I1t(t){if(t%aee===E1t){const e=(t+Sl)/aee;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%D0e===L0e){const e=(t-L0e)/D0e;return function(r,s){const a=r.mul(s,Jv),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,Jv),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return T1t(t)}const P1t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function F1t(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=P1t.reduce((r,s)=>(r[s]="function",r),e);return y$(t,n)}function O1t(t,e,n){if(n<Pc)throw new Error("invalid exponent, negatives unsupported");if(n===Pc)return t.ONE;if(n===Sl)return e;let r=t.ONE,s=e;for(;n>Pc;)n&Sl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Sl;return r}function M1t(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 PTe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function FTe(t,e,n=!1,r={}){if(t<=Pc)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:a}=PTe(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:b$(s),ZERO:Pc,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 Pc<=c&&c<t},is0:c=>c===Pc,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)=>O1t(l,c,u),div:(c,u)=>Xd(c*oee(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>oee(c,t),sqrt:r.sqrt||(c=>(o||(o=I1t(t)),o(l,c))),invertBatch:c=>M1t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?ITe(c,a):V_(c,a),fromBytes:c=>{if(c.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+c.length);return n?TTe(c):h3(c)}});return Object.freeze(l)}function OTe(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 MTe(t){const e=OTe(t);return e+Math.ceil(e/2)}function R1t(t,e,n=!1){const r=t.length,s=OTe(e),a=MTe(e);if(r<16||r<a||r>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+r);const o=n?TTe(t):h3(t),l=Xd(o,e-Sl)+Sl;return n?ITe(l,s):V_(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const B0e=BigInt(0),lee=BigInt(1);function gV(t,e){const n=e.negate();return t?n:e}function RTe(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function bV(t,e){RTe(t,e);const n=Math.ceil(e/t)+1,r=2**(t-1),s=2**t,a=b$(t),o=BigInt(t);return{windows:n,windowSize:r,mask:a,maxNumber:s,shiftBy:o}}function $0e(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+=lee);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 L1t(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 D1t(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 yV=new WeakMap,LTe=new WeakMap;function vV(t){return LTe.get(t)||1}function B1t(t,e){return{constTimeNegate:gV,hasPrecomputes(n){return vV(n)!==1},unsafeLadder(n,r,s=t.ZERO){let a=n;for(;r>B0e;)r&lee&&(s=s.add(a)),a=a.double(),r>>=lee;return s},precomputeWindow(n,r){const{windows:s,windowSize:a}=bV(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=bV(n,e);for(let c=0;c<l.windows;c++){const{nextN:u,offset:d,isZero:f,isNeg:x,isNegF:g,offsetF:y}=$0e(s,c,l);s=u,f?o=o.add(gV(g,r[y])):a=a.add(gV(x,r[d]))}return{p:a,f:o}},wNAFUnsafe(n,r,s,a=t.ZERO){const o=bV(n,e);for(let l=0;l<o.windows&&s!==B0e;l++){const{nextN:c,offset:u,isZero:d,isNeg:f}=$0e(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=yV.get(r);return a||(a=this.precomputeWindow(r,n),n!==1&&yV.set(r,s(a))),a},wNAFCached(n,r,s){const a=vV(n);return this.wNAF(a,this.getPrecomputes(a,n,s),r)},wNAFCachedUnsafe(n,r,s,a){const o=vV(n);return o===1?this.unsafeLadder(n,r,a):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,a)},setWindowSize(n,r){RTe(r,e),LTe.set(n,r),yV.delete(n)}}}function $1t(t,e,n,r){if(L1t(n,t),D1t(r,e),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,a=j1t(BigInt(n.length)),o=a>12?a-3:a>4?a-2:a?2:1,l=b$(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 DTe(t){return F1t(t.Fp),y$(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...PTe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function U0e(t){t.lowS!==void 0&&z_("lowS",t.lowS),t.prehash!==void 0&&z_("prehash",t.prehash)}function U1t(t){const e=DTe(t);y$(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 z1t extends Error{constructor(e=""){super(e)}}const yg={Err:z1t,_tlv:{encode:(t,e)=>{const{Err:n}=yg;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const r=e.length/2,s=AP(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const a=r>127?AP(s.length/2|128):"";return AP(t)+a+s+e},decode(t,e){const{Err:n}=yg;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[r++],a=!!(s&128);let o=0;if(!a)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=e.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of u)o=o<<8|d;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const l=e.subarray(r,r+o);if(l.length!==o)throw new n("tlv.decode: wrong value length");return{v:l,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=yg;if(t<Lg)throw new e("integer: negative integers are not allowed");let n=AP(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=yg;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return h3(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=yg,s=Gp("signature",t),{v:a,l:o}=r.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:l,l:c}=r.decode(2,a),{v:u,l:d}=r.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(u)}},hexFromSig(t){const{_tlv:e,_int:n}=yg,r=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),a=r+s;return e.encode(48,a)}},Lg=BigInt(0),_c=BigInt(1);BigInt(2);const z0e=BigInt(3);BigInt(4);function H1t(t){const e=U1t(t),{Fp:n}=e,r=FTe(e.n,e.nBitLength),s=e.toBytes||((v,C,N)=>{const I=C.toAffine();return cR(Uint8Array.from([4]),n.toBytes(I.x),n.toBytes(I.y))}),a=e.fromBytes||(v=>{const C=v.subarray(1),N=n.fromBytes(C.subarray(0,n.BYTES)),I=n.fromBytes(C.subarray(n.BYTES,2*n.BYTES));return{x:N,y:I}});function o(v){const{a:C,b:N}=e,I=n.sqr(v),P=n.mul(I,v);return n.add(n.add(P,n.mul(v,C)),N)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function l(v){return goe(v,_c,e.n)}function c(v){const{allowedPrivateKeyLengths:C,nByteLength:N,wrapPrivateKey:I,n:P}=e;if(C&&typeof v!="bigint"){if(iN(v)&&(v=H_(v)),typeof v!="string"||!C.includes(v.length))throw new Error("invalid private key");v=v.padStart(N*2,"0")}let M;try{M=typeof v=="bigint"?v:h3(Gp("private key",v,N))}catch{throw new Error("invalid private key, expected hex or "+N+" bytes, got "+typeof v)}return I&&(M=Xd(M,P)),S4("private key",M,_c,P),M}function u(v){if(!(v instanceof x))throw new Error("ProjectivePoint expected")}const d=R0e((v,C)=>{const{px:N,py:I,pz:P}=v;if(n.eql(P,n.ONE))return{x:N,y:I};const M=v.is0();C==null&&(C=M?n.ONE:n.inv(P));const F=n.mul(N,C),$=n.mul(I,C),L=n.mul(P,C);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(L,n.ONE))throw new Error("invZ was invalid");return{x:F,y:$}}),f=R0e(v=>{if(v.is0()){if(e.allowInfinityPoint&&!n.is0(v.py))return;throw new Error("bad point: ZERO")}const{x:C,y:N}=v.toAffine();if(!n.isValid(C)||!n.isValid(N))throw new Error("bad point: x or y not FE");const I=n.sqr(N),P=o(C);if(!n.eql(I,P))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class x{constructor(C,N,I){if(C==null||!n.isValid(C))throw new Error("x required");if(N==null||!n.isValid(N))throw new Error("y required");if(I==null||!n.isValid(I))throw new Error("z required");this.px=C,this.py=N,this.pz=I,Object.freeze(this)}static fromAffine(C){const{x:N,y:I}=C||{};if(!C||!n.isValid(N)||!n.isValid(I))throw new Error("invalid affine point");if(C instanceof x)throw new Error("projective point not allowed");const P=M=>n.eql(M,n.ZERO);return P(N)&&P(I)?x.ZERO:new x(N,I,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const N=n.invertBatch(C.map(I=>I.pz));return C.map((I,P)=>I.toAffine(N[P])).map(x.fromAffine)}static fromHex(C){const N=x.fromAffine(a(Gp("pointHex",C)));return N.assertValidity(),N}static fromPrivateKey(C){return x.BASE.multiply(c(C))}static msm(C,N){return $1t(x,r,C,N)}_setWindowSize(C){y.setWindowSize(this,C)}assertValidity(){f(this)}hasEvenY(){const{y:C}=this.toAffine();if(n.isOdd)return!n.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){u(C);const{px:N,py:I,pz:P}=this,{px:M,py:F,pz:$}=C,L=n.eql(n.mul(N,$),n.mul(M,P)),z=n.eql(n.mul(I,$),n.mul(F,P));return L&&z}negate(){return new x(this.px,n.neg(this.py),this.pz)}double(){const{a:C,b:N}=e,I=n.mul(N,z0e),{px:P,py:M,pz:F}=this;let $=n.ZERO,L=n.ZERO,z=n.ZERO,Q=n.mul(P,P),se=n.mul(M,M),ee=n.mul(F,F),K=n.mul(P,M);return K=n.add(K,K),z=n.mul(P,F),z=n.add(z,z),$=n.mul(C,z),L=n.mul(I,ee),L=n.add($,L),$=n.sub(se,L),L=n.add(se,L),L=n.mul($,L),$=n.mul(K,$),z=n.mul(I,z),ee=n.mul(C,ee),K=n.sub(Q,ee),K=n.mul(C,K),K=n.add(K,z),z=n.add(Q,Q),Q=n.add(z,Q),Q=n.add(Q,ee),Q=n.mul(Q,K),L=n.add(L,Q),ee=n.mul(M,F),ee=n.add(ee,ee),Q=n.mul(ee,K),$=n.sub($,Q),z=n.mul(ee,se),z=n.add(z,z),z=n.add(z,z),new x($,L,z)}add(C){u(C);const{px:N,py:I,pz:P}=this,{px:M,py:F,pz:$}=C;let L=n.ZERO,z=n.ZERO,Q=n.ZERO;const se=e.a,ee=n.mul(e.b,z0e);let K=n.mul(N,M),re=n.mul(I,F),de=n.mul(P,$),G=n.add(N,I),ie=n.add(M,F);G=n.mul(G,ie),ie=n.add(K,re),G=n.sub(G,ie),ie=n.add(N,P);let ae=n.add(M,$);return ie=n.mul(ie,ae),ae=n.add(K,de),ie=n.sub(ie,ae),ae=n.add(I,P),L=n.add(F,$),ae=n.mul(ae,L),L=n.add(re,de),ae=n.sub(ae,L),Q=n.mul(se,ie),L=n.mul(ee,de),Q=n.add(L,Q),L=n.sub(re,Q),Q=n.add(re,Q),z=n.mul(L,Q),re=n.add(K,K),re=n.add(re,K),de=n.mul(se,de),ie=n.mul(ee,ie),re=n.add(re,de),de=n.sub(K,de),de=n.mul(se,de),ie=n.add(ie,de),K=n.mul(re,ie),z=n.add(z,K),K=n.mul(ae,ie),L=n.mul(G,L),L=n.sub(L,K),K=n.mul(G,re),Q=n.mul(ae,Q),Q=n.add(Q,K),new x(L,z,Q)}subtract(C){return this.add(C.negate())}is0(){return this.equals(x.ZERO)}wNAF(C){return y.wNAFCached(this,C,x.normalizeZ)}multiplyUnsafe(C){const{endo:N,n:I}=e;S4("scalar",C,Lg,I);const P=x.ZERO;if(C===Lg)return P;if(this.is0()||C===_c)return this;if(!N||y.hasPrecomputes(this))return y.wNAFCachedUnsafe(this,C,x.normalizeZ);let{k1neg:M,k1:F,k2neg:$,k2:L}=N.splitScalar(C),z=P,Q=P,se=this;for(;F>Lg||L>Lg;)F&_c&&(z=z.add(se)),L&_c&&(Q=Q.add(se)),se=se.double(),F>>=_c,L>>=_c;return M&&(z=z.negate()),$&&(Q=Q.negate()),Q=new x(n.mul(Q.px,N.beta),Q.py,Q.pz),z.add(Q)}multiply(C){const{endo:N,n:I}=e;S4("scalar",C,_c,I);let P,M;if(N){const{k1neg:F,k1:$,k2neg:L,k2:z}=N.splitScalar(C);let{p:Q,f:se}=this.wNAF($),{p:ee,f:K}=this.wNAF(z);Q=y.constTimeNegate(F,Q),ee=y.constTimeNegate(L,ee),ee=new x(n.mul(ee.px,N.beta),ee.py,ee.pz),P=Q.add(ee),M=se.add(K)}else{const{p:F,f:$}=this.wNAF(C);P=F,M=$}return x.normalizeZ([P,M])[0]}multiplyAndAddUnsafe(C,N,I){const P=x.BASE,M=($,L)=>L===Lg||L===_c||!$.equals(P)?$.multiplyUnsafe(L):$.multiply(L),F=M(this,N).add(M(C,I));return F.is0()?void 0:F}toAffine(C){return d(this,C)}isTorsionFree(){const{h:C,isTorsionFree:N}=e;if(C===_c)return!0;if(N)return N(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:N}=e;return C===_c?this:N?N(x,this):this.multiplyUnsafe(e.h)}toRawBytes(C=!0){return z_("isCompressed",C),this.assertValidity(),s(x,this,C)}toHex(C=!0){return z_("isCompressed",C),H_(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=B1t(x,e.endo?Math.ceil(g/2):g);return{CURVE:e,ProjectivePoint:x,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:l}}function V1t(t){const e=DTe(t);return y$(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function W1t(t){const e=V1t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(de){return Xd(de,r)}function l(de){return oee(de,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=H1t({...e,toBytes(de,G,ie){const ae=G.toAffine(),q=n.toBytes(ae.x),W=cR;return z_("isCompressed",ie),ie?W(Uint8Array.from([G.hasEvenY()?2:3]),q):W(Uint8Array.from([4]),q,n.toBytes(ae.y))},fromBytes(de){const G=de.length,ie=de[0],ae=de.subarray(1);if(G===s&&(ie===2||ie===3)){const q=h3(ae);if(!goe(q,_c,n.ORDER))throw new Error("Point is not on curve");const W=d(q);let ne;try{ne=n.sqrt(W)}catch(_e){const xe=_e instanceof Error?": "+_e.message:"";throw new Error("Point is not on curve"+xe)}const oe=(ne&_c)===_c;return(ie&1)===1!==oe&&(ne=n.neg(ne)),{x:q,y:ne}}else if(G===a&&ie===4){const q=n.fromBytes(ae.subarray(0,n.BYTES)),W=n.fromBytes(ae.subarray(n.BYTES,2*n.BYTES));return{x:q,y:W}}else{const q=s,W=a;throw new Error("invalid Point, expected length of "+q+", or uncompressed "+W+", got "+G)}}}),x=de=>H_(V_(de,e.nByteLength));function g(de){const G=r>>_c;return de>G}function y(de){return g(de)?o(-de):de}const v=(de,G,ie)=>h3(de.slice(G,ie));class C{constructor(G,ie,ae){S4("r",G,_c,r),S4("s",ie,_c,r),this.r=G,this.s=ie,ae!=null&&(this.recovery=ae),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:ae}=yg.toSig(Gp("DER",G));return new C(ie,ae)}assertValidity(){}addRecoveryBit(G){return new C(this.r,this.s,G)}recoverPublicKey(G){const{r:ie,s:ae,recovery:q}=this,W=$(Gp("msgHash",G));if(q==null||![0,1,2,3].includes(q))throw new Error("recovery id invalid");const ne=q===2||q===3?ie+e.n:ie;if(ne>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const oe=q&1?"03":"02",he=c.fromHex(oe+x(ne)),_e=l(ne),xe=o(-W*_e),Se=o(ae*_e),ge=c.BASE.multiplyAndAddUnsafe(he,xe,Se);if(!ge)throw new Error("point at infinify");return ge.assertValidity(),ge}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new C(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return lR(this.toDERHex())}toDERHex(){return yg.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return lR(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const N={isValidPrivateKey(de){try{return u(de),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const de=MTe(e.n);return R1t(e.randomBytes(de),e.n)},precompute(de=8,G=c.BASE){return G._setWindowSize(de),G.multiply(BigInt(3)),G}};function I(de,G=!0){return c.fromPrivateKey(de).toRawBytes(G)}function P(de){const G=iN(de),ie=typeof de=="string",ae=(G||ie)&&de.length;return G?ae===s||ae===a:ie?ae===2*s||ae===2*a:de instanceof c}function M(de,G,ie=!0){if(P(de))throw new Error("first arg must be private key");if(!P(G))throw new Error("second arg must be public key");return c.fromHex(G).multiply(u(de)).toRawBytes(ie)}const F=e.bits2int||function(de){if(de.length>8192)throw new Error("input is too large");const G=h3(de),ie=de.length*8-e.nBitLength;return ie>0?G>>BigInt(ie):G},$=e.bits2int_modN||function(de){return o(F(de))},L=b$(e.nBitLength);function z(de){return S4("num < 2^"+e.nBitLength,de,Lg,L),V_(de,e.nByteLength)}function Q(de,G,ie=se){if(["recovered","canonical"].some(je=>je in ie))throw new Error("sign() legacy options not supported");const{hash:ae,randomBytes:q}=e;let{lowS:W,prehash:ne,extraEntropy:oe}=ie;W==null&&(W=!0),de=Gp("msgHash",de),U0e(ie),ne&&(de=Gp("prehashed msgHash",ae(de)));const he=$(de),_e=u(G),xe=[z(_e),z(he)];if(oe!=null&&oe!==!1){const je=oe===!0?q(n.BYTES):oe;xe.push(Gp("extraEntropy",je))}const Se=cR(...xe),ge=he;function Ce(je){const Oe=F(je);if(!f(Oe))return;const $e=l(Oe),Ye=c.BASE.multiply(Oe).toAffine(),Je=o(Ye.x);if(Je===Lg)return;const ht=o($e*o(ge+Je*_e));if(ht===Lg)return;let rt=(Ye.x===Je?0:2)|Number(Ye.y&_c),st=ht;return W&&g(ht)&&(st=y(ht),rt^=1),new C(Je,st,rt)}return{seed:Se,k2sig:Ce}}const se={lowS:e.lowS,prehash:!1},ee={lowS:e.lowS,prehash:!1};function K(de,G,ie=se){const{seed:ae,k2sig:q}=Q(de,G,ie),W=e;return A1t(W.hash.outputLen,W.nByteLength,W.hmac)(ae,q)}c.BASE._setWindowSize(8);function re(de,G,ie,ae=ee){var rt;const q=de;G=Gp("msgHash",G),ie=Gp("publicKey",ie);const{lowS:W,prehash:ne,format:oe}=ae;if(U0e(ae),"strict"in ae)throw new Error("options.strict was renamed to lowS");if(oe!==void 0&&oe!=="compact"&&oe!=="der")throw new Error("format must be compact or der");const he=typeof q=="string"||iN(q),_e=!he&&!oe&&typeof q=="object"&&q!==null&&typeof q.r=="bigint"&&typeof q.s=="bigint";if(!he&&!_e)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let xe,Se;try{if(_e&&(xe=new C(q.r,q.s)),he){try{oe!=="compact"&&(xe=C.fromDER(q))}catch(st){if(!(st instanceof yg.Err))throw st}!xe&&oe!=="der"&&(xe=C.fromCompact(q))}Se=c.fromHex(ie)}catch{return!1}if(!xe||W&&xe.hasHighS())return!1;ne&&(G=e.hash(G));const{r:ge,s:Ce}=xe,je=$(G),Oe=l(Ce),$e=o(je*Oe),Ye=o(ge*Oe),Je=(rt=c.BASE.multiplyAndAddUnsafe(Se,$e,Ye))==null?void 0:rt.toAffine();return Je?o(Je.x)===ge:!1}return{CURVE:e,getPublicKey:I,getSharedSecret:M,sign:K,verify:re,ProjectivePoint:c,Signature:C,utils:N}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function q1t(t){return{hash:t,hmac:(e,...n)=>_Te(t,e,zht(...n)),randomBytes:Hht}}function G1t(t,e){const n=r=>W1t({...t,...q1t(r)});return{...n(e),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const BTe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),H0e=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),K1t=BigInt(1),cee=BigInt(2),V0e=(t,e)=>(t+e/cee)/e;function Y1t(t){const e=BTe,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,N=jh(C,c,e)*C%e,I=jh(N,l,e)*v%e,P=jh(I,n,e)*d%e,M=jh(P,o,e)*y%e,F=jh(M,r,e)*u%e,$=jh(F,cee,e);if(!uee.eql(uee.sqr($),t))throw new Error("Cannot find square root");return $}const uee=FTe(BTe,void 0,void 0,{sqrt:Y1t}),boe=G1t({a:BigInt(0),b:BigInt(7),Fp:uee,n:H0e,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=H0e,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-K1t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=V0e(a*t,e),c=V0e(-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}}}},eke);BigInt(0);boe.ProjectivePoint;const X1t=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:boe},Symbol.toStringTag,{value:"Module"}));function Q1t({r:t,s:e,to:n="hex",v:r,yParity:s}){const a=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new boe.Signature(cd(t),cd(e)).toCompactHex()}${a===0?"1b":"1c"}`;return n==="hex"?o:hp(o)}async function yoe(t,e){var f,x,g;const{address:n,factory:r,factoryData:s,hash:a,signature:o,universalSignatureVerifierAddress:l=(g=(x=(f=t.chain)==null?void 0:f.contracts)==null?void 0:x.universalSignatureVerifier)==null?void 0:g.address,...c}=e,u=ix(o)?o:typeof o=="object"&&"r"in o&&"s"in o?Q1t(o):Yl(o),d=await(async()=>!r&&!s||o1t(u)?u:l1t({address:r,data:s,signature:u}))();try{const y=l?{to:l,data:Fm({abi:c0e,functionName:"isValidSig",args:[n,a,d]}),...c}:{data:Mae({abi:c0e,args:[n,a,d],bytecode:N0t}),...c},{data:v}=await li(t,d$,"call")(y);return hht(v??"0x0")}catch(y){try{if(noe(Ic(n),await zEe({hash:a,signature:o})))return!0}catch{}if(y instanceof Tke)return!1;throw y}}async function Z1t(t,{address:e,message:n,factory:r,factoryData:s,signature:a,...o}){const l=STe(n);return yoe(t,{address:e,factory:r,factoryData:s,hash:l,signature:a,...o})}async function J1t(t,e){const{address:n,factory:r,factoryData:s,signature:a,message:o,primaryType:l,types:c,domain:u,...d}=e,f=zgt({message:o,primaryType:l,types:c,domain:u});return yoe(t,{address:n,factory:r,factoryData:s,hash:f,signature:a,...d})}function ebt(t,e){const{abi:n,address:r,args:s,batch:a=!0,eventName:o,fromBlock:l,onError:c,onLogs:u,poll:d,pollingInterval:f=t.pollingInterval,strict:x}=e;return(typeof d<"u"?d:typeof l=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket"))?(()=>{const C=x??!1,N=Rc(["watchContractEvent",r,s,a,t.uid,o,f,C,l]);return e2(N,{onLogs:u,onError:c},I=>{let P;l!==void 0&&(P=l-1n);let M,F=!1;const $=NT(async()=>{var L;if(!F){try{M=await li(t,Vke,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:C,fromBlock:l})}catch{}F=!0;return}try{let z;if(M)z=await li(t,h$,"getFilterChanges")({filter:M});else{const Q=await li(t,CT,"getBlockNumber")({});P&&P<Q?z=await li(t,Gke,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:P+1n,toBlock:Q,strict:C}):z=[],P=Q}if(z.length===0)return;if(a)I.onLogs(z);else for(const Q of z)I.onLogs([Q])}catch(z){M&&z instanceof B3&&(F=!1),(L=I.onError)==null||L.call(I,z)}},{emitOnBegin:!0,interval:f});return async()=>{M&&await li(t,g$,"uninstallFilter")({filter:M}),$()}})})():(()=>{const C=x??!1,N=Rc(["watchContractEvent",r,s,a,t.uid,o,f,C]);let I=!0,P=()=>I=!1;return e2(N,{onLogs:u,onError:c},M=>((async()=>{try{const F=(()=>{if(t.transport.type==="fallback"){const z=t.transport.transports.find(Q=>Q.config.type==="webSocket");return z?z.value:t.transport}return t.transport})(),$=o?wT({abi:n,eventName:o,args:s}):[],{unsubscribe:L}=await F.subscribe({params:["logs",{address:r,topics:$}],onData(z){var se;if(!I)return;const Q=z.result;try{const{eventName:ee,args:K}=roe({abi:n,data:Q.data,topics:Q.topics,strict:x}),re=x1(Q,{args:K,eventName:ee});M.onLogs([re])}catch(ee){let K,re;if(ee instanceof w_||ee instanceof ZB){if(x)return;K=ee.abiItem.name,re=(se=ee.abiItem.inputs)==null?void 0:se.some(G=>!("name"in G&&G.name))}const de=x1(Q,{args:re?[]:{},eventName:K});M.onLogs([de])}},onError(z){var Q;(Q=M.onError)==null||Q.call(M,z)}});P=L,I||P()}catch(F){c==null||c(F)}})(),()=>P()))})()}async function tbt(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 n$({docsPath:"/docs/contract/writeContract"});const u=r?Vu(r):null,d=Fm({abi:n,args:a,functionName:l});try{return await li(t,cmt,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:s,account:u,...c})}catch(f){throw U3(f,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:l,sender:u==null?void 0:u.address})}}function S2(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const MO="2.16.7",nbt=()=>`@wagmi/core@${MO}`;var $Te=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)},uR,UTe;let M1=class dee extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return nbt()}constructor(e,n={}){var a;super(),uR.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 dee?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details,s=n.cause instanceof dee&&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 $Te(this,uR,"m",UTe).call(this,this,e)}};uR=new WeakSet,UTe=function t(e,n){return n!=null&&n(e)?e:e.cause?$Te(this,uR,"m",t).call(this,e.cause,n):e};class V3 extends M1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class rbt extends M1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class sbt extends M1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ibt extends M1{constructor({address:e,connector:n}){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class abt extends M1{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class obt extends M1{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function lbt(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 rbt;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 fee=256;let _P=fee,EP;function zTe(t=11){if(!EP||_P+t>fee*2){EP="",_P=0;for(let e=0;e<fee;e++)EP+=(256+Math.random()*256|0).toString(16).substring(1)}return EP.substring(_P,_P+++t)}function HTe(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:zTe()};function v(C){return N=>{const I=N(C);for(const M in y)delete I[M];const P={...C,...I};return Object.assign(P,{extend:v(P)})}}return Object.assign(y,{extend:v(y)})}function VTe({key:t,methods:e,name:n,request:r,retryCount:s=3,retryDelay:a=150,timeout:o,type:l},c){const u=zTe();return{config:{key:t,methods:e,name:n,request:r,retryCount:s,retryDelay:a,timeout:o,type:l},request:Mgt(r,{methods:e,retryCount:s,retryDelay:a,uid:u}),value:c}}function cbt(t,e={}){const{key:n="custom",methods:r,name:s="Custom Provider",retryDelay:a}=e;return({retryCount:o})=>VTe({key:n,methods:r,name:s,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:a,type:"custom"})}class ubt extends Br{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function H7(t,e={}){const{batch:n,fetchOptions:r,key:s="http",methods:a,name:o="HTTP JSON-RPC",onFetchRequest:l,onFetchResponse:c,retryDelay:u,raw:d}=e;return({chain:f,retryCount:x,timeout:g})=>{const{batchSize:y=1e3,wait:v=0}=typeof n=="object"?n:{},C=e.retryCount??x,N=g??e.timeout??1e4,I=f==null?void 0:f.rpcUrls.default.http[0];if(!I)throw new ubt;const P=Dgt(I,{fetchOptions:r,onRequest:l,onResponse:c,timeout:N});return VTe({key:s,methods:a,name:o,async request({method:M,params:F}){const $={method:M,params:F},{schedule:L}=Lke({id:I,wait:v,shouldSplitBatch(ee){return ee.length>y},fn:ee=>P.request({body:ee}),sort:(ee,K)=>ee.id-K.id}),z=async ee=>n?L(ee):[await P.request({body:ee})],[{error:Q,result:se}]=await z($);if(d)return{error:Q,result:se};if(Q)throw new Bae({body:$,error:Q,url:I});return se},retryCount:C,retryDelay:u,timeout:N,type:"http"},{fetchOptions:r,url:I})}}function dbt(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(hbt))==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)?/,hbt=/(?: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 pbt(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&&!noe(r.address,e))return!1}catch{return!1}return!0}async function mbt(t,e){const{address:n,domain:r,message:s,nonce:a,scheme:o,signature:l,time:c=new Date,...u}=e,d=dbt(s);if(!d.address||!pbt({address:n,domain:r,message:d,nonce:a,scheme:o,time:c}))return!1;const x=STe(s);return yoe(t,{address:d.address,hash:x,signature:l,...u})}function xbt(t){return{call:e=>d$(t,e),createAccessList:e=>Hke(t,e),createBlockFilter:()=>V0t(t),createContractEventFilter:e=>Vke(t,e),createEventFilter:e=>Wke(t,e),createPendingTransactionFilter:()=>qke(t),estimateContractGas:e=>q0t(t,e),estimateGas:e=>Gae(t,e),getBalance:e=>qae(t,e),getBlobBaseFee:()=>G0t(t),getBlock:e=>L0(t,e),getBlockNumber:e=>CT(t,e),getBlockTransactionCount:e=>J0t(t,e),getBytecode:e=>b0e(t,e),getChainId:()=>Uae(t),getCode:e=>b0e(t,e),getContractEvents:e=>Gke(t,e),getEip712Domain:e=>rxt(t,e),getEnsAddress:e=>T0t(t,e),getEnsAvatar:e=>Uke(t,e),getEnsName:e=>zke(t,e),getEnsResolver:e=>H0t(t,e),getEnsText:e=>$ke(t,e),getFeeHistory:e=>axt(t,e),estimateFeesPerGas:e=>Vpt(t,e),getFilterChanges:e=>h$(t,e),getFilterLogs:e=>oxt(t,e),getGasPrice:()=>Vae(t),getLogs:e=>ioe(t,e),getProof:e=>y1t(t,e),estimateMaxPriorityFeePerGas:e=>Hpt(t,e),getStorageAt:e=>lxt(t,e),getTransaction:e=>aoe(t,e),getTransactionConfirmations:e=>cxt(t,e),getTransactionCount:e=>JEe(t,e),getTransactionReceipt:e=>QJ(t,e),multicall:e=>Yke(t,e),prepareTransactionRequest:e=>Qae(t,e),readContract:e=>ox(t,e),sendRawTransaction:e=>cke(t,e),simulate:e=>JJ(t,e),simulateBlocks:e=>JJ(t,e),simulateCalls:e=>f1t(t,e),simulateContract:e=>S1t(t,e),verifyMessage:e=>Z1t(t,e),verifySiweMessage:e=>mbt(t,e),verifyTypedData:e=>J1t(t,e),uninstallFilter:e=>g$(t,e),waitForTransactionReceipt:e=>v1t(t,e),watchBlocks:e=>p1t(t,e),watchBlockNumber:e=>jTe(t,e),watchContractEvent:e=>ebt(t,e),watchEvent:e=>m1t(t,e),watchPendingTransactions:e=>x1t(t,e)}}async function voe(t,e={}){let n;if(e.connector){const{connector:u}=e;if(t.state.status==="reconnecting"&&!u.getAccounts&&!u.getChainId)throw new obt({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 sbt;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new abt({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=Ic(o.address)),e.account&&!n.accounts.some(u=>u.toLowerCase()===o.address.toLowerCase()))throw new ibt({address:o.address,connector:a});const l=t.chains.find(u=>u.id===r),c=await n.connector.getProvider({chainId:r});return HTe({account:o,chain:l,name:"Connector Client",transport:u=>cbt(c)({...u,retryCount:0})})}async function gbt(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 WTe(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(jpt[t])}function qTe(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 S2(o,Yke,"multicall")({allowFailure:n,contracts:s,...a})}function GTe(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,ox,"readContract")(r)}async function ybt(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 Ike)throw c;const u=()=>o.map(d=>GTe(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 vbt(t,e){const{address:n,blockNumber:r,blockTag:s,chainId:a,token:o,unit:l="ether"}=e;if(o)try{return await W0e(t,{balanceAddress:n,chainId:a,symbolType:"string",tokenAddress:o})}catch(x){if(x.name==="ContractFunctionExecutionError"){const g=await W0e(t,{balanceAddress:n,chainId:a,symbolType:"bytes32",tokenAddress:o}),y=pht(Jf(g.symbol,{dir:"right"}));return{...g,symbol:y}}throw x}const c=t.getClient({chainId:a}),d=await S2(c,qae,"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:mT(d,WTe(l)),symbol:f.nativeCurrency.symbol,value:d}}async function W0e(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 ybt(t,{allowFailure:!1,contracts:[{...l,functionName:"balanceOf",args:[n],chainId:r},{...l,functionName:"decimals",chainId:r},{...l,functionName:"symbol",chainId:r}]}),f=mT(c??"0",WTe(o??u));return{decimals:u,formatted:f,symbol:d,value:c}}function q0e(t){return t.state.chainId}function t2(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!t2(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(a&&!t2(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}let wV=[];function G0e(t){const e=t.chains;return t2(wV,e)?wV:(wV=e,e)}function wbt(t,e={}){let n;try{n=t.getClient(e)}catch{}return n}let kP=[];function hee(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||t2(kP,e)?kP:(kP=e,e)}let CV=[];function K0e(t){const e=t.connectors;return t2(CV,e)?CV:(CV=e,e)}function Cbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,Uke,"getEnsAvatar")(r)}function Sbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,zke,"getEnsName")(r)}function pee(t,e={}){const n=wbt(t,e);return n==null?void 0:n.extend(xbt)}let SV=!1;async function Nbt(t,e={}){var u,d;if(SV)return[];SV=!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"}))),SV=!1,l}async function jbt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await voe(t,{account:n,connector:r}),S2(a,w1t,"signMessage")({...s,...n?{account:n}:{}})}async function Abt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await voe(t,{account:n,connector:r}),S2(a,C1t,"signTypedData")({...s,...n?{account:n}:{}})}class tp extends M1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class _bt extends M1{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Ebt(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 _bt({connector:l});return await l.switchChain({addEthereumChainParameter:n,chainId:r})}const a=t.chains.find(l=>l.id===r);if(!a)throw new V3;return t.setState(l=>({...l,chainId:r})),a}function KTe(t,e){const{onChange:n}=e;return t.subscribe(()=>qTe(t),n,{equalityFn(r,s){const{connector:a,...o}=r,{connector:l,...c}=s;return t2(o,c)&&(a==null?void 0:a.id)===(l==null?void 0:l.id)&&(a==null?void 0:a.uid)===(l==null?void 0:l.uid)}})}function kbt(t,e){const{onChange:n}=e;return t.subscribe(r=>r.chainId,n)}function Tbt(t,e){const{onChange:n}=e;return t.subscribe(()=>hee(t),n,{equalityFn:t2})}function Ibt(t,e){const{onChange:n}=e;return t._internal.connectors.subscribe((r,s)=>{n(Object.values(r),s)})}function Pbt(t,e){const{onChange:n}=e;return t.subscribe(()=>pee(t),n,{equalityFn(r,s){return(r==null?void 0:r.uid)===(s==null?void 0:s.uid)}})}async function Fbt(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 voe(t,{account:n??void 0,chainId:r,connector:s}),await S2(o,tbt,"writeContract")({...a,...n?{account:n}:{},chain:r?{id:r}:null})}v$.type="injected";function v$(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"?{...Obt[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:v$.type,async setup(){const u=await this.getProvider();u!=null&&u.on&&t.target&&(o||(o=this.onConnect.bind(this),u.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),u.on("accountsChanged",s)))},async connect({chainId:u,isReconnecting:d}={}){var g,y,v,C,N,I;const f=await this.getProvider();if(!f)throw new tp;let x=[];if(d)x=await this.getAccounts().catch(()=>[]);else if(e)try{x=(C=(v=(y=(g=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:g.caveats)==null?void 0:y[0])==null?void 0:v.value)==null?void 0:C.map(M=>Ic(M)),x.length>0&&(x=await this.getAccounts())}catch(P){const M=P;if(M.code===No.code)throw new No(M);if(M.code===Ry.code)throw M}try{!(x!=null&&x.length)&&!d&&(x=(await f.request({method:"eth_requestAccounts"})).map(F=>Ic(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 P=await this.getChainId();if(u&&P!==u){const M=await this.switchChain({chainId:u}).catch(F=>{if(F.code===No.code)throw F;return{id:P}});P=(M==null?void 0:M.id)??P}return e&&await((N=c.storage)==null?void 0:N.removeItem(`${this.id}.disconnected`)),t.target||await((I=c.storage)==null?void 0:I.setItem("injected.connected",!0)),{accounts:x,chainId:P}}catch(P){const M=P;throw M.code===No.code?new No(M):M.code===Ry.code?new Ry(M):M}},async disconnect(){var d,f;const u=await this.getProvider();if(!u)throw new tp;a&&(u.removeListener("chainChanged",a),a=void 0),l&&(u.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),u.on("connect",o));try{await hoe(()=>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=>Ic(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=RO(window,d.provider):u=d.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){var u,d;try{if(e&&await((u=c.storage)==null?void 0:u.getItem(`${this.id}.disconnected`))||!t.target&&!await((d=c.storage)==null?void 0:d.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const y=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",y),!!await this.getProvider()),v=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(N=>window.addEventListener("ethereum#initialized",()=>N(y()),{once:!0}))]:[],new Promise(N=>setTimeout(()=>N(y()),v))]))return!0}throw new tp}return!!(await oR(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){var y,v,C,N;const f=await this.getProvider();if(!f)throw new tp;const x=c.chains.find(I=>I.id===d);if(!x)throw new pp(new V3);const g=new Promise(I=>{const P=M=>{"chainId"in M&&M.chainId===d&&(c.emitter.off("change",P),I())};c.emitter.on("change",P)});try{return await Promise.all([f.request({method:"wallet_switchEthereumChain",params:[{chainId:Hs(d)}]}).then(async()=>{await this.getChainId()===d&&c.emitter.emit("change",{chainId:d})}),g]),x}catch(I){const P=I;if(P.code===4902||((v=(y=P==null?void 0:P.data)==null?void 0:y.originalError)==null?void 0:v.code)===4902)try{const{default:M,...F}=x.blockExplorers??{};let $;u!=null&&u.blockExplorerUrls?$=u.blockExplorerUrls:M&&($=[M.url,...Object.values(F).map(Q=>Q.url)]);let L;(C=u==null?void 0:u.rpcUrls)!=null&&C.length?L=u.rpcUrls:L=[((N=x.rpcUrls.default)==null?void 0:N.http[0])??""];const z={blockExplorerUrls:$,chainId:Hs(d),chainName:(u==null?void 0:u.chainName)??x.name,iconUrls:u==null?void 0:u.iconUrls,nativeCurrency:(u==null?void 0:u.nativeCurrency)??x.nativeCurrency,rpcUrls:L};return await Promise.all([f.request({method:"wallet_addEthereumChain",params:[z]}).then(async()=>{if(await this.getChainId()===d)c.emitter.emit("change",{chainId:d});else throw new No(new Error("User rejected switch after adding network."))}),g]),x}catch(M){throw new No(M)}throw P.code===No.code?new No(P):new pp(P)}},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=>Ic(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 Obt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:RO(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return RO(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:RO(t,"isPhantom")}}};function RO(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 Mbt(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 Rbt(){const t=new Set;let e=[];const n=()=>Mbt(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 Lbt=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)},Dbt=Lbt;function Bbt(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 mee=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return mee(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return mee(r)(n)}}}},$bt=(t,e)=>(n,r,s)=>{let a={storage:Bbt(()=>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(I=>{var P;return I((P=r())!=null?P:x)});const N=((C=a.onRehydrateStorage)==null?void 0:C.call(a,(v=r())!=null?v:x))||void 0;return mee(u.getItem.bind(u))(a.name).then(I=>{if(I)if(typeof I.version=="number"&&I.version!==a.version){if(a.migrate)return[!0,a.migrate(I.state,I.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,I.state];return[!1,void 0]}).then(I=>{var P;const[M,F]=I;if(g=a.merge(F,(P=r())!=null?P:x),n(g,!0),M)return d()}).then(()=>{N==null||N(g,void 0),g=r(),o=!0,c.forEach(I=>I(g))}).catch(I=>{N==null||N(void 0,I)})};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},Ubt=$bt,Y0e=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},NV=t=>t?Y0e(t):Y0e;var jV={exports:{}},X0e;function zbt(){return X0e||(X0e=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,x){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new s(d,f||c,x),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],g]:c._events[y].push(g):(c._events[y]=g,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var x=0,g=f.length,y=new Array(g);x<g;x++)y[x]=f[x].fn;return y},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,x,g,y){var v=n?n+u:u;if(!this._events[v])return!1;var C=this._events[v],N=arguments.length,I,P;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),N){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,f),!0;case 4:return C.fn.call(C.context,d,f,x),!0;case 5:return C.fn.call(C.context,d,f,x,g),!0;case 6:return C.fn.call(C.context,d,f,x,g,y),!0}for(P=1,I=new Array(N-1);P<N;P++)I[P-1]=arguments[P];C.fn.apply(C.context,I)}else{var M=C.length,F;for(P=0;P<M;P++)switch(C[P].once&&this.removeListener(u,C[P].fn,void 0,!0),N){case 1:C[P].fn.call(C[P].context);break;case 2:C[P].fn.call(C[P].context,d);break;case 3:C[P].fn.call(C[P].context,d,f);break;case 4:C[P].fn.call(C[P].context,d,f,x);break;default:if(!I)for(F=1,I=new Array(N-1);F<N;F++)I[F-1]=arguments[F];C[P].fn.apply(C[P].context,I)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,x){var g=n?n+u:u;if(!this._events[g])return this;if(!d)return o(this,g),this;var y=this._events[g];if(y.fn)y.fn===d&&(!x||y.once)&&(!f||y.context===f)&&o(this,g);else{for(var v=0,C=[],N=y.length;v<N;v++)(y[v].fn!==d||x&&!y[v].once||f&&y[v].context!==f)&&C.push(y[v]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(jV)),jV.exports}var Hbt=zbt();const woe=Ti(Hbt);let Vbt=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 woe})}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 Wbt(t){return new Vbt(t)}function qbt(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 Q0e(t,e){return t.slice(0,e).join(".")||"."}function Z0e(t,e){const{length:n}=t;for(let r=0;r<n;++r)if(t[r]===e)return r+1;return 0}function Gbt(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=Z0e(s,this);u===0?s[s.length]=this:(s.splice(u),a.splice(u)),a[a.length]=l;const d=Z0e(s,c);if(d!==0)return r?e.call(this,l,c,Q0e(a,d)):`[ref=${Q0e(a,d)}]`}else s[0]=c,a[0]=l;return n?t.call(this,l,c):c}}function Kbt(t,e,n,r){return JSON.stringify(t,Gbt((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 Ybt(t){const{deserialize:e=qbt,key:n="wagmi",serialize:r=Kbt,storage:s=YTe}=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 YTe={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Xbt(){const t=typeof window<"u"&&window.localStorage?window.localStorage:YTe;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,n){try{t.setItem(e,n)}catch{}}}}const xee=256;let TP=xee,IP;function Qbt(t=11){if(!IP||TP+t>xee*2){IP="",TP=0;for(let e=0;e<xee;e++)IP+=(256+Math.random()*256|0).toString(16).substring(1)}return IP.substring(TP,TP+++t)}function Zbt(t){const{multiInjectedProviderDiscovery:e=!0,storage:n=Ybt({storage:Xbt()}),syncConnectedChain:r=!0,ssr:s=!1,...a}=t,o=typeof window<"u"&&e?Rbt():void 0,l=NV(()=>a.chains),c=NV(()=>{const F=[],$=new Set;for(const L of a.connectors??[]){const z=u(L);if(F.push(z),!s&&z.rdns){const Q=typeof z.rdns=="string"?[z.rdns]:z.rdns;for(const se of Q)$.add(se)}}if(!s&&o){const L=o.getProviders();for(const z of L)$.has(z.info.rdns)||F.push(u(d(z)))}return F});function u(F){var z;const $=Wbt(Qbt()),L={...F({emitter:$,chains:l.getState(),storage:n,transports:a.transports}),emitter:$,uid:$.uid};return $.on("connect",P),(z=L.setup)==null||z.call(L),L}function d(F){const{info:$}=F,L=F.provider;return v$({target:{...$,id:$.rdns,provider:L}})}const f=new Map;function x(F={}){const $=F.chainId??C.getState().chainId,L=l.getState().find(Q=>Q.id===$);if(F.chainId&&!L)throw new V3;{const Q=f.get(C.getState().chainId);if(Q&&!L)return Q;if(!L)throw new V3}{const Q=f.get($);if(Q)return Q}let z;if(a.client)z=a.client({chain:L});else{const Q=L.id,se=l.getState().map(re=>re.id),ee={},K=Object.entries(a);for(const[re,de]of K)if(!(re==="chains"||re==="client"||re==="connectors"||re==="transports"))if(typeof de=="object")if(Q in de)ee[re]=de[Q];else{if(se.some(ie=>ie in de))continue;ee[re]=de}else ee[re]=de;z=HTe({...ee,chain:L,batch:ee.batch??{multicall:!0},transport:re=>a.transports[Q]({...re,connectors:c})})}return f.set($,z),z}function g(){return{chainId:l.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let y;const v="0.0.0-canary-";MO.startsWith(v)?y=Number.parseInt(MO.replace(v,"")):y=Number.parseInt(MO.split(".")[0]??"0");const C=NV(Dbt(n?Ubt(g,{migrate(F,$){if($===y)return F;const L=g(),z=N(F,L.chainId);return{...L,chainId:z}},name:"store",partialize(F){return{connections:{__type:"Map",value:Array.from(F.connections.entries()).map(([$,L])=>{const{id:z,name:Q,type:se,uid:ee}=L.connector;return[$,{...L,connector:{id:z,name:Q,type:se,uid:ee}}]})},chainId:F.chainId,current:F.current}},merge(F,$){typeof F=="object"&&F&&"status"in F&&delete F.status;const L=N(F,$.chainId);return{...$,...F,chainId:L}},skipHydration:s,storage:n,version:y}):g));C.setState(g());function N(F,$){return F&&typeof F=="object"&&"chainId"in F&&typeof F.chainId=="number"&&l.getState().some(L=>L.id===F.chainId)?F.chainId:$}r&&C.subscribe(({connections:F,current:$})=>{var L;return $?(L=F.get($))==null?void 0:L.chainId:void 0},F=>{if(l.getState().some(L=>L.id===F))return C.setState(L=>({...L,chainId:F??L.chainId}))}),o==null||o.subscribe(F=>{const $=new Set,L=new Set;for(const Q of c.getState())if($.add(Q.id),Q.rdns){const se=typeof Q.rdns=="string"?[Q.rdns]:Q.rdns;for(const ee of se)L.add(ee)}const z=[];for(const Q of F){if(L.has(Q.info.rdns))continue;const se=u(d(Q));$.has(se.id)||z.push(se)}n&&!C.persist.hasHydrated()||c.setState(Q=>[...Q,...z],!0)});function I(F){C.setState($=>{const L=$.connections.get(F.uid);return L?{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts??L.accounts,chainId:F.chainId??L.chainId,connector:L.connector})}:$})}function P(F){C.getState().status==="connecting"||C.getState().status==="reconnecting"||C.setState($=>{const L=c.getState().find(z=>z.uid===F.uid);return L?(L.emitter.listenerCount("connect")&&L.emitter.off("connect",I),L.emitter.listenerCount("change")||L.emitter.on("change",I),L.emitter.listenerCount("disconnect")||L.emitter.on("disconnect",M),{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts,chainId:F.chainId,connector:L}),current:F.uid,status:"connected"}):$})}function M(F){C.setState($=>{const L=$.connections.get(F.uid);if(L){const Q=L.connector;Q.emitter.listenerCount("change")&&L.connector.emitter.off("change",I),Q.emitter.listenerCount("disconnect")&&L.connector.emitter.off("disconnect",M),Q.emitter.listenerCount("connect")||L.connector.emitter.on("connect",P)}if($.connections.delete(F.uid),$.connections.size===0)return{...$,connections:new Map,current:null,status:"disconnected"};const z=$.connections.values().next().value;return{...$,connections:new Map($.connections),current:z.connector.uid}})}return{get chains(){return l.getState()},get connectors(){return c.getState()},storage:n,getClient:x,get state(){return C.getState()},setState(F){let $;typeof F=="function"?$=F(C.getState()):$=F;const L=g();typeof $!="object"&&($=L),Object.keys(L).some(Q=>!(Q in $))&&($=L),C.setState($,!0)},subscribe(F,$,L){return C.subscribe(F,$,L?{...L,fireImmediately:L.emitImmediately}:void 0)},_internal:{mipd:o,store:C,ssr:!!s,syncConnectedChain:r,transports:a.transports,chains:{setState(F){const $=typeof F=="function"?F(l.getState()):F;if($.length!==0)return l.setState($,!0)},subscribe(F){return l.subscribe(F)}},connectors:{providerDetailToConnector:d,setup:u,setState(F){return c.setState(typeof F=="function"?F(c.getState()):F,!0)},subscribe(F){return c.subscribe(F)}},events:{change:I,connect:P,disconnect:M}}}}function Jbt(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?Nbt(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}function eyt(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 tyt(t){const{children:e,config:n,initialState:r,reconnectOnMount:s=!0}=t,{onMount:a}=Jbt(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 XTe=h.createContext(void 0);function nyt(t){const{children:e,config:n}=t,r={value:n};return h.createElement(tyt,t,h.createElement(XTe.Provider,r,e))}const ryt="2.14.16",syt=()=>`wagmi@${ryt}`;let iyt=class extends M1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return syt()}};class ayt extends iyt{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Il(t={}){const e=t.config??h.useContext(XTe);if(!e)throw new ayt;return e}function oyt(t,e){const{onChange:n}=e;return t._internal.chains.subscribe((r,s)=>{n(r,s)})}var AV={exports:{}},_V={},EV={exports:{}},kV={};/**
* @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 J0e;function lyt(){if(J0e)return kV;J0e=1;var t=xx();function e(f,x){return f===x&&(f!==0||1/f===1/x)||f!==f&&x!==x}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function l(f,x){var g=x(),y=r({inst:{value:g,getSnapshot:x}}),v=y[0].inst,C=y[1];return a(function(){v.value=g,v.getSnapshot=x,c(v)&&C({inst:v})},[f,g,x]),s(function(){return c(v)&&C({inst:v}),f(function(){c(v)&&C({inst:v})})},[f]),o(g),g}function c(f){var x=f.getSnapshot;f=f.value;try{var g=x();return!n(f,g)}catch{return!0}}function u(f,x){return x()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return kV.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,kV}var exe;function cyt(){return exe||(exe=1,EV.exports=lyt()),EV.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 txe;function uyt(){if(txe)return _V;txe=1;var t=xx(),e=cyt();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 _V.useSyncExternalStoreWithSelector=function(u,d,f,x,g){var y=a(null);if(y.current===null){var v={hasValue:!1,value:null};y.current=v}else v=y.current;y=l(function(){function N($){if(!I){if(I=!0,P=$,$=x($),g!==void 0&&v.hasValue){var L=v.value;if(g(L,$))return M=L}return M=$}if(L=M,r(P,$))return L;var z=x($);return g!==void 0&&g(L,z)?(P=$,L):(P=$,M=z)}var I=!1,P,M,F=f===void 0?null:f;return[function(){return N(d())},F===null?void 0:function(){return N(F())}]},[d,f,x,g]);var C=s(u,y[0],y[1]);return o(function(){v.hasValue=!0,v.value=C},[C]),c(C),C},_V}var nxe;function dyt(){return nxe||(nxe=1,AV.exports=uyt()),AV.exports}var QTe=dyt();const TV=t=>typeof t=="object"&&!Array.isArray(t);function fyt(t,e,n=e,r=t2){const s=h.useRef([]),a=QTe.useSyncExternalStoreWithSelector(t,e,n,o=>o,(o,l)=>{if(TV(o)&&TV(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(TV(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 es(t={}){const e=Il(t);return fyt(n=>KTe(e,{onChange:n}),()=>qTe(e))}function ZTe(t={}){const{onConnect:e,onDisconnect:n}=t,r=Il(t);h.useEffect(()=>KTe(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 Jj=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(){}},W3=typeof window>"u"||"Deno"in globalThis;function Qh(){}function hyt(t,e){return typeof t=="function"?t(e):t}function gee(t){return typeof t=="number"&&t>=0&&t!==1/0}function JTe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function N4(t,e){return typeof t=="function"?t(e):t}function lm(t,e){return typeof t=="function"?t(e):t}function rxe(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==Coe(o,e.options))return!1}else if(!W_(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 sxe(t,e){const{exact:n,status:r,predicate:s,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(q3(e.options.mutationKey)!==q3(a))return!1}else if(!W_(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function Coe(t,e){return((e==null?void 0:e.queryKeyHashFn)||q3)(t)}function q3(t){return JSON.stringify(t,(e,n)=>bee(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function W_(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>W_(t[n],e[n])):!1}function Soe(t,e){if(t===e)return t;const n=ixe(t)&&ixe(e);if(n||bee(t)&&bee(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]=Soe(t[d],e[d]),l[d]===t[d]&&t[d]!==void 0&&c++)}return s===o&&c===s?t:l}return e}function dR(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 ixe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function bee(t){if(!axe(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!axe(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function axe(t){return Object.prototype.toString.call(t)==="[object Object]"}function pyt(t){return new Promise(e=>{setTimeout(e,t)})}function yee(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Soe(t,e):e}function myt(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function xyt(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Noe=Symbol();function eIe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Noe?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Tw,Xb,W4,uAe,gyt=(uAe=class extends Jj{constructor(){super();Un(this,Tw);Un(this,Xb);Un(this,W4);Xt(this,W4,e=>{if(!W3&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Xe(this,Xb)||this.setEventListener(Xe(this,W4))}onUnsubscribe(){var e;this.hasListeners()||((e=Xe(this,Xb))==null||e.call(this),Xt(this,Xb,void 0))}setEventListener(e){var n;Xt(this,W4,e),(n=Xe(this,Xb))==null||n.call(this),Xt(this,Xb,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){Xe(this,Tw)!==e&&(Xt(this,Tw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Xe(this,Tw)=="boolean"?Xe(this,Tw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Tw=new WeakMap,Xb=new WeakMap,W4=new WeakMap,uAe),joe=new gyt,q4,Qb,G4,dAe,byt=(dAe=class extends Jj{constructor(){super();Un(this,q4,!0);Un(this,Qb);Un(this,G4);Xt(this,G4,e=>{if(!W3&&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(){Xe(this,Qb)||this.setEventListener(Xe(this,G4))}onUnsubscribe(){var e;this.hasListeners()||((e=Xe(this,Qb))==null||e.call(this),Xt(this,Qb,void 0))}setEventListener(e){var n;Xt(this,G4,e),(n=Xe(this,Qb))==null||n.call(this),Xt(this,Qb,e(this.setOnline.bind(this)))}setOnline(e){Xe(this,q4)!==e&&(Xt(this,q4,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return Xe(this,q4)}},q4=new WeakMap,Qb=new WeakMap,G4=new WeakMap,dAe),fR=new byt;function vee(){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 yyt(t){return Math.min(1e3*2**t,3e4)}function tIe(t){return(t??"online")==="online"?fR.isOnline():!0}var nIe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function IV(t){return t instanceof nIe}function rIe(t){let e=!1,n=0,r=!1,s;const a=vee(),o=v=>{var C;r||(x(new nIe(v)),(C=t.abort)==null||C.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>joe.isFocused()&&(t.networkMode==="always"||fR.isOnline())&&t.canRun(),d=()=>tIe(t.networkMode)&&t.canRun(),f=v=>{var C;r||(r=!0,(C=t.onSuccess)==null||C.call(t,v),s==null||s(),a.resolve(v))},x=v=>{var C;r||(r=!0,(C=t.onError)==null||C.call(t,v),s==null||s(),a.reject(v))},g=()=>new Promise(v=>{var C;s=N=>{(r||u())&&v(N)},(C=t.onPause)==null||C.call(t)}).then(()=>{var v;s=void 0,r||(v=t.onContinue)==null||v.call(t)}),y=()=>{if(r)return;let v;const C=n===0?t.initialPromise:void 0;try{v=C??t.fn()}catch(N){v=Promise.reject(N)}Promise.resolve(v).then(f).catch(N=>{var $;if(r)return;const I=t.retry??(W3?0:3),P=t.retryDelay??yyt,M=typeof P=="function"?P(n,N):P,F=I===!0||typeof I=="number"&&n<I||typeof I=="function"&&I(n,N);if(e||!F){x(N);return}n++,($=t.onFail)==null||$.call(t,n,N),pyt(M).then(()=>u()?void 0:g()).then(()=>{e?x(N):y()})})};return{promise:a,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?y():g().then(y),a)}}var vyt=t=>setTimeout(t,0);function wyt(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=vyt;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 ic=wyt(),Iw,fAe,sIe=(fAe=class{constructor(){Un(this,Iw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gee(this.gcTime)&&Xt(this,Iw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(W3?1/0:5*60*1e3))}clearGcTimeout(){Xe(this,Iw)&&(clearTimeout(Xe(this,Iw)),Xt(this,Iw,void 0))}},Iw=new WeakMap,fAe),K4,Y4,qh,Pw,Su,Ok,Fw,Xp,fg,hAe,Cyt=(hAe=class extends sIe{constructor(e){super();Un(this,Xp);Un(this,K4);Un(this,Y4);Un(this,qh);Un(this,Pw);Un(this,Su);Un(this,Ok);Un(this,Fw);Xt(this,Fw,!1),Xt(this,Ok,e.defaultOptions),this.setOptions(e.options),this.observers=[],Xt(this,Pw,e.client),Xt(this,qh,Xe(this,Pw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Xt(this,K4,Syt(this.options)),this.state=e.state??Xe(this,K4),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Xe(this,Su))==null?void 0:e.promise}setOptions(e){this.options={...Xe(this,Ok),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Xe(this,qh).remove(this)}setData(e,n){const r=yee(this.state.data,e,this.options);return Cr(this,Xp,fg).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Cr(this,Xp,fg).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=Xe(this,Su))==null?void 0:r.promise;return(s=Xe(this,Su))==null||s.cancel(e),n?n.then(Qh).catch(Qh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Xe(this,K4))}isActive(){return this.observers.some(e=>lm(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Noe||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||!JTe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Xe(this,Su))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Xe(this,Su))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Xe(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||(Xe(this,Su)&&(Xe(this,Fw)?Xe(this,Su).cancel({revert:!0}):Xe(this,Su).cancelRetry()),this.scheduleGc()),Xe(this,qh).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Cr(this,Xp,fg).call(this,{type:"invalidate"})}fetch(e,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Xe(this,Su))return Xe(this,Su).continueRetry(),Xe(this,Su).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(x=>x.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Xt(this,Fw,!0),r.signal)})},a=()=>{const f=eIe(this.options,n),x={client:Xe(this,Pw),queryKey:this.queryKey,meta:this.meta};return s(x),Xt(this,Fw,!1),this.options.persister?this.options.persister(f,x,this):f(x)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Xe(this,Pw),state:this.state,fetchFn:a};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),Xt(this,Y4,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Cr(this,Xp,fg).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var x,g,y,v;IV(f)&&f.silent||Cr(this,Xp,fg).call(this,{type:"error",error:f}),IV(f)||((g=(x=Xe(this,qh).config).onError)==null||g.call(x,f,this),(v=(y=Xe(this,qh).config).onSettled)==null||v.call(y,this.state.data,f,this)),this.scheduleGc()};return Xt(this,Su,rIe({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=Xe(this,qh).config).onSuccess)==null||g.call(x,f,this),(v=(y=Xe(this,qh).config).onSettled)==null||v.call(y,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,x)=>{Cr(this,Xp,fg).call(this,{type:"failed",failureCount:f,error:x})},onPause:()=>{Cr(this,Xp,fg).call(this,{type:"pause"})},onContinue:()=>{Cr(this,Xp,fg).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),Xe(this,Su).start()}},K4=new WeakMap,Y4=new WeakMap,qh=new WeakMap,Pw=new WeakMap,Su=new WeakMap,Ok=new WeakMap,Fw=new WeakMap,Xp=new WeakSet,fg=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...iIe(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 IV(s)&&s.revert&&Xe(this,Y4)?{...Xe(this,Y4),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),ic.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Xe(this,qh).notify({query:this,type:"updated",action:e})})},hAe);function iIe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tIe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Syt(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,pAe,Nyt=(pAe=class extends Jj{constructor(e={}){super();Un(this,p0);this.config=e,Xt(this,p0,new Map)}build(e,n,r){const s=n.queryKey,a=n.queryHash??Coe(s,n);let o=this.get(a);return o||(o=new Cyt({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){Xe(this,p0).has(e.queryHash)||(Xe(this,p0).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Xe(this,p0).get(e.queryHash);n&&(e.destroy(),n===e&&Xe(this,p0).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ic.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Xe(this,p0).get(e)}getAll(){return[...Xe(this,p0).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>rxe(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>rxe(e,r)):n}notify(e){ic.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){ic.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ic.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},p0=new WeakMap,pAe),m0,td,Ow,x0,Lb,mAe,jyt=(mAe=class extends sIe{constructor(e){super();Un(this,x0);Un(this,m0);Un(this,td);Un(this,Ow);this.mutationId=e.mutationId,Xt(this,td,e.mutationCache),Xt(this,m0,[]),this.state=e.state||aIe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Xe(this,m0).includes(e)||(Xe(this,m0).push(e),this.clearGcTimeout(),Xe(this,td).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Xt(this,m0,Xe(this,m0).filter(n=>n!==e)),this.scheduleGc(),Xe(this,td).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Xe(this,m0).length||(this.state.status==="pending"?this.scheduleGc():Xe(this,td).remove(this))}continue(){var e;return((e=Xe(this,Ow))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,u,d,f,x,g,y,v,C,N,I,P,M,F,$,L,z;const n=()=>{Cr(this,x0,Lb).call(this,{type:"continue"})};Xt(this,Ow,rIe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Q,se)=>{Cr(this,x0,Lb).call(this,{type:"failed",failureCount:Q,error:se})},onPause:()=>{Cr(this,x0,Lb).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Xe(this,td).canRun(this)}));const r=this.state.status==="pending",s=!Xe(this,Ow).canStart();try{if(r)n();else{Cr(this,x0,Lb).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(a=Xe(this,td).config).onMutate)==null?void 0:o.call(a,e,this));const se=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));se!==this.state.context&&Cr(this,x0,Lb).call(this,{type:"pending",context:se,variables:e,isPaused:s})}const Q=await Xe(this,Ow).start();return await((d=(u=Xe(this,td).config).onSuccess)==null?void 0:d.call(u,Q,e,this.state.context,this)),await((x=(f=this.options).onSuccess)==null?void 0:x.call(f,Q,e,this.state.context)),await((y=(g=Xe(this,td).config).onSettled)==null?void 0:y.call(g,Q,null,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,Q,null,e,this.state.context)),Cr(this,x0,Lb).call(this,{type:"success",data:Q}),Q}catch(Q){try{throw await((I=(N=Xe(this,td).config).onError)==null?void 0:I.call(N,Q,e,this.state.context,this)),await((M=(P=this.options).onError)==null?void 0:M.call(P,Q,e,this.state.context)),await(($=(F=Xe(this,td).config).onSettled)==null?void 0:$.call(F,void 0,Q,this.state.variables,this.state.context,this)),await((z=(L=this.options).onSettled)==null?void 0:z.call(L,void 0,Q,e,this.state.context)),Q}finally{Cr(this,x0,Lb).call(this,{type:"error",error:Q})}}finally{Xe(this,td).runNext(this)}}},m0=new WeakMap,td=new WeakMap,Ow=new WeakMap,x0=new WeakSet,Lb=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ic.batch(()=>{Xe(this,m0).forEach(r=>{r.onMutationUpdate(e)}),Xe(this,td).notify({mutation:this,type:"updated",action:e})})},mAe);function aIe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ng,Qp,Mk,xAe,Ayt=(xAe=class extends Jj{constructor(e={}){super();Un(this,Ng);Un(this,Qp);Un(this,Mk);this.config=e,Xt(this,Ng,new Set),Xt(this,Qp,new Map),Xt(this,Mk,0)}build(e,n,r){const s=new jyt({mutationCache:this,mutationId:++gb(this,Mk)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){Xe(this,Ng).add(e);const n=PP(e);if(typeof n=="string"){const r=Xe(this,Qp).get(n);r?r.push(e):Xe(this,Qp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Xe(this,Ng).delete(e)){const n=PP(e);if(typeof n=="string"){const r=Xe(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&&Xe(this,Qp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=PP(e);if(typeof n=="string"){const r=Xe(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=PP(e);if(typeof n=="string"){const s=(r=Xe(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(){ic.batch(()=>{Xe(this,Ng).forEach(e=>{this.notify({type:"removed",mutation:e})}),Xe(this,Ng).clear(),Xe(this,Qp).clear()})}getAll(){return Array.from(Xe(this,Ng))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>sxe(n,r))}findAll(e={}){return this.getAll().filter(n=>sxe(e,n))}notify(e){ic.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return ic.batch(()=>Promise.all(e.map(n=>n.continue().catch(Qh))))}},Ng=new WeakMap,Qp=new WeakMap,Mk=new WeakMap,xAe);function PP(t){var e;return(e=t.options.scope)==null?void 0:e.id}function oxe(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=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},N=eIe(e.options,e.fetchOptions),I=async(P,M,F)=>{if(v)return Promise.reject();if(M==null&&P.pages.length)return Promise.resolve(P);const $={client:e.client,queryKey:e.queryKey,pageParam:M,direction:F?"backward":"forward",meta:e.options.meta};C($);const L=await N($),{maxPages:z}=e.options,Q=F?xyt:myt;return{pages:Q(P.pages,L,z),pageParams:Q(P.pageParams,M,z)}};if(s&&a.length){const P=s==="backward",M=P?_yt:lxe,F={pages:a,pageParams:o},$=M(r,F);l=await I(F,$,P)}else{const P=t??a.length;do{const M=c===0?o[0]??r.initialPageParam:lxe(r,l);if(c>0&&M==null)break;l=await I(l,M),c++}while(c<P)}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 lxe(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 _yt(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var tl,Zb,Jb,X4,Q4,ey,Z4,J4,gAe,Eyt=(gAe=class{constructor(t={}){Un(this,tl);Un(this,Zb);Un(this,Jb);Un(this,X4);Un(this,Q4);Un(this,ey);Un(this,Z4);Un(this,J4);Xt(this,tl,t.queryCache||new Nyt),Xt(this,Zb,t.mutationCache||new Ayt),Xt(this,Jb,t.defaultOptions||{}),Xt(this,X4,new Map),Xt(this,Q4,new Map),Xt(this,ey,0)}mount(){gb(this,ey)._++,Xe(this,ey)===1&&(Xt(this,Z4,joe.subscribe(async t=>{t&&(await this.resumePausedMutations(),Xe(this,tl).onFocus())})),Xt(this,J4,fR.subscribe(async t=>{t&&(await this.resumePausedMutations(),Xe(this,tl).onOnline())})))}unmount(){var t,e;gb(this,ey)._--,Xe(this,ey)===0&&((t=Xe(this,Z4))==null||t.call(this),Xt(this,Z4,void 0),(e=Xe(this,J4))==null||e.call(this),Xt(this,J4,void 0))}isFetching(t){return Xe(this,tl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Xe(this,Zb).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Xe(this,tl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Xe(this,tl).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(N4(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return Xe(this,tl).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=Xe(this,tl).get(r.queryHash),a=s==null?void 0:s.state.data,o=hyt(e,a);if(o!==void 0)return Xe(this,tl).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return ic.batch(()=>Xe(this,tl).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Xe(this,tl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Xe(this,tl);ic.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Xe(this,tl);return ic.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=ic.batch(()=>Xe(this,tl).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Qh).catch(Qh)}invalidateQueries(t,e={}){return ic.batch(()=>(Xe(this,tl).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=ic.batch(()=>Xe(this,tl).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Qh)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Qh)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=Xe(this,tl).build(this,e);return n.isStaleByTime(N4(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=oxe(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Qh).catch(Qh)}ensureInfiniteQueryData(t){return t.behavior=oxe(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return fR.isOnline()?Xe(this,Zb).resumePausedMutations():Promise.resolve()}getQueryCache(){return Xe(this,tl)}getMutationCache(){return Xe(this,Zb)}getDefaultOptions(){return Xe(this,Jb)}setDefaultOptions(t){Xt(this,Jb,t)}setQueryDefaults(t,e){Xe(this,X4).set(q3(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Xe(this,X4).values()],n={};return e.forEach(r=>{W_(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){Xe(this,Q4).set(q3(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Xe(this,Q4).values()],n={};return e.forEach(r=>{W_(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Xe(this,Jb).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Coe(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===Noe&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Xe(this,Jb).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Xe(this,tl).clear(),Xe(this,Zb).clear()}},tl=new WeakMap,Zb=new WeakMap,Jb=new WeakMap,X4=new WeakMap,Q4=new WeakMap,ey=new WeakMap,Z4=new WeakMap,J4=new WeakMap,gAe),qd,ta,Rk,nd,Mw,eS,ty,ny,Lk,tS,nS,Rw,Lw,ry,rS,La,V7,wee,Cee,See,Nee,jee,Aee,_ee,oIe,bAe,kyt=(bAe=class extends Jj{constructor(e,n){super();Un(this,La);Un(this,qd);Un(this,ta);Un(this,Rk);Un(this,nd);Un(this,Mw);Un(this,eS);Un(this,ty);Un(this,ny);Un(this,Lk);Un(this,tS);Un(this,nS);Un(this,Rw);Un(this,Lw);Un(this,ry);Un(this,rS,new Set);this.options=n,Xt(this,qd,e),Xt(this,ny,null),Xt(this,ty,vee()),this.options.experimental_prefetchInRender||Xe(this,ty).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Xe(this,ta).addObserver(this),cxe(Xe(this,ta),this.options)?Cr(this,La,V7).call(this):this.updateResult(),Cr(this,La,Nee).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Eee(Xe(this,ta),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Eee(Xe(this,ta),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Cr(this,La,jee).call(this),Cr(this,La,Aee).call(this),Xe(this,ta).removeObserver(this)}setOptions(e){const n=this.options,r=Xe(this,ta);if(this.options=Xe(this,qd).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof lm(this.options.enabled,Xe(this,ta))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Cr(this,La,_ee).call(this),Xe(this,ta).setOptions(this.options),n._defaulted&&!dR(this.options,n)&&Xe(this,qd).getQueryCache().notify({type:"observerOptionsUpdated",query:Xe(this,ta),observer:this});const s=this.hasListeners();s&&uxe(Xe(this,ta),r,this.options,n)&&Cr(this,La,V7).call(this),this.updateResult(),s&&(Xe(this,ta)!==r||lm(this.options.enabled,Xe(this,ta))!==lm(n.enabled,Xe(this,ta))||N4(this.options.staleTime,Xe(this,ta))!==N4(n.staleTime,Xe(this,ta)))&&Cr(this,La,wee).call(this);const a=Cr(this,La,Cee).call(this);s&&(Xe(this,ta)!==r||lm(this.options.enabled,Xe(this,ta))!==lm(n.enabled,Xe(this,ta))||a!==Xe(this,ry))&&Cr(this,La,See).call(this,a)}getOptimisticResult(e){const n=Xe(this,qd).getQueryCache().build(Xe(this,qd),e),r=this.createResult(n,e);return Iyt(this,r)&&(Xt(this,nd,r),Xt(this,eS,this.options),Xt(this,Mw,Xe(this,ta).state)),r}getCurrentResult(){return Xe(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){Xe(this,rS).add(e)}getCurrentQuery(){return Xe(this,ta)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=Xe(this,qd).defaultQueryOptions(e),r=Xe(this,qd).getQueryCache().build(Xe(this,qd),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Cr(this,La,V7).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Xe(this,nd)))}createResult(e,n){var Q;const r=Xe(this,ta),s=this.options,a=Xe(this,nd),o=Xe(this,Mw),l=Xe(this,eS),u=e!==r?e.state:Xe(this,Rk),{state:d}=e;let f={...d},x=!1,g;if(n._optimisticResults){const se=this.hasListeners(),ee=!se&&cxe(e,n),K=se&&uxe(e,r,n,s);(ee||K)&&(f={...f,...iIe(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:C}=f;g=f.data;let N=!1;if(n.placeholderData!==void 0&&g===void 0&&C==="pending"){let se;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(se=a.data,N=!0):se=typeof n.placeholderData=="function"?n.placeholderData((Q=Xe(this,nS))==null?void 0:Q.state.data,Xe(this,nS)):n.placeholderData,se!==void 0&&(C="success",g=yee(a==null?void 0:a.data,se,n),x=!0)}if(n.select&&g!==void 0&&!N)if(a&&g===(o==null?void 0:o.data)&&n.select===Xe(this,Lk))g=Xe(this,tS);else try{Xt(this,Lk,n.select),g=n.select(g),g=yee(a==null?void 0:a.data,g,n),Xt(this,tS,g),Xt(this,ny,null)}catch(se){Xt(this,ny,se)}Xe(this,ny)&&(y=Xe(this,ny),g=Xe(this,tS),v=Date.now(),C="error");const I=f.fetchStatus==="fetching",P=C==="pending",M=C==="error",F=P&&I,$=g!==void 0,z={status:C,fetchStatus:f.fetchStatus,isPending:P,isSuccess:C==="success",isError:M,isInitialLoading:F,isLoading:F,data:g,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:I,isRefetching:I&&!P,isLoadingError:M&&!$,isPaused:f.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:M&&$,isStale:Aoe(e,n),refetch:this.refetch,promise:Xe(this,ty)};if(this.options.experimental_prefetchInRender){const se=re=>{z.status==="error"?re.reject(z.error):z.data!==void 0&&re.resolve(z.data)},ee=()=>{const re=Xt(this,ty,z.promise=vee());se(re)},K=Xe(this,ty);switch(K.status){case"pending":e.queryHash===r.queryHash&&se(K);break;case"fulfilled":(z.status==="error"||z.data!==K.value)&&ee();break;case"rejected":(z.status!=="error"||z.error!==K.reason)&&ee();break}}return z}updateResult(){const e=Xe(this,nd),n=this.createResult(Xe(this,ta),this.options);if(Xt(this,Mw,Xe(this,ta).state),Xt(this,eS,this.options),Xe(this,Mw).data!==void 0&&Xt(this,nS,Xe(this,ta)),dR(n,e))return;Xt(this,nd,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!Xe(this,rS).size)return!0;const o=new Set(a??Xe(this,rS));return this.options.throwOnError&&o.add("error"),Object.keys(Xe(this,nd)).some(l=>{const c=l;return Xe(this,nd)[c]!==e[c]&&o.has(c)})};Cr(this,La,oIe).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Cr(this,La,Nee).call(this)}},qd=new WeakMap,ta=new WeakMap,Rk=new WeakMap,nd=new WeakMap,Mw=new WeakMap,eS=new WeakMap,ty=new WeakMap,ny=new WeakMap,Lk=new WeakMap,tS=new WeakMap,nS=new WeakMap,Rw=new WeakMap,Lw=new WeakMap,ry=new WeakMap,rS=new WeakMap,La=new WeakSet,V7=function(e){Cr(this,La,_ee).call(this);let n=Xe(this,ta).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Qh)),n},wee=function(){Cr(this,La,jee).call(this);const e=N4(this.options.staleTime,Xe(this,ta));if(W3||Xe(this,nd).isStale||!gee(e))return;const r=JTe(Xe(this,nd).dataUpdatedAt,e)+1;Xt(this,Rw,setTimeout(()=>{Xe(this,nd).isStale||this.updateResult()},r))},Cee=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Xe(this,ta)):this.options.refetchInterval)??!1},See=function(e){Cr(this,La,Aee).call(this),Xt(this,ry,e),!(W3||lm(this.options.enabled,Xe(this,ta))===!1||!gee(Xe(this,ry))||Xe(this,ry)===0)&&Xt(this,Lw,setInterval(()=>{(this.options.refetchIntervalInBackground||joe.isFocused())&&Cr(this,La,V7).call(this)},Xe(this,ry)))},Nee=function(){Cr(this,La,wee).call(this),Cr(this,La,See).call(this,Cr(this,La,Cee).call(this))},jee=function(){Xe(this,Rw)&&(clearTimeout(Xe(this,Rw)),Xt(this,Rw,void 0))},Aee=function(){Xe(this,Lw)&&(clearInterval(Xe(this,Lw)),Xt(this,Lw,void 0))},_ee=function(){const e=Xe(this,qd).getQueryCache().build(Xe(this,qd),this.options);if(e===Xe(this,ta))return;const n=Xe(this,ta);Xt(this,ta,e),Xt(this,Rk,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},oIe=function(e){ic.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(Xe(this,nd))}),Xe(this,qd).getQueryCache().notify({query:Xe(this,ta),type:"observerResultsUpdated"})})},bAe);function Tyt(t,e){return lm(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function cxe(t,e){return Tyt(t,e)||t.state.data!==void 0&&Eee(t,e,e.refetchOnMount)}function Eee(t,e,n){if(lm(e.enabled,t)!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Aoe(t,e)}return!1}function uxe(t,e,n,r){return(t!==e||lm(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Aoe(t,n)}function Aoe(t,e){return lm(e.enabled,t)!==!1&&t.isStaleByTime(N4(e.staleTime,t))}function Iyt(t,e){return!dR(t.getCurrentResult(),e)}var sy,iy,Gd,jg,d1,LO,kee,yAe,Pyt=(yAe=class extends Jj{constructor(n,r){super();Un(this,d1);Un(this,sy);Un(this,iy);Un(this,Gd);Un(this,jg);Xt(this,sy,n),this.setOptions(r),this.bindMethods(),Cr(this,d1,LO).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=Xe(this,sy).defaultMutationOptions(n),dR(this.options,r)||Xe(this,sy).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Xe(this,Gd),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&q3(r.mutationKey)!==q3(this.options.mutationKey)?this.reset():((s=Xe(this,Gd))==null?void 0:s.state.status)==="pending"&&Xe(this,Gd).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Xe(this,Gd))==null||n.removeObserver(this)}onMutationUpdate(n){Cr(this,d1,LO).call(this),Cr(this,d1,kee).call(this,n)}getCurrentResult(){return Xe(this,iy)}reset(){var n;(n=Xe(this,Gd))==null||n.removeObserver(this),Xt(this,Gd,void 0),Cr(this,d1,LO).call(this),Cr(this,d1,kee).call(this)}mutate(n,r){var s;return Xt(this,jg,r),(s=Xe(this,Gd))==null||s.removeObserver(this),Xt(this,Gd,Xe(this,sy).getMutationCache().build(Xe(this,sy),this.options)),Xe(this,Gd).addObserver(this),Xe(this,Gd).execute(n)}},sy=new WeakMap,iy=new WeakMap,Gd=new WeakMap,jg=new WeakMap,d1=new WeakSet,LO=function(){var r;const n=((r=Xe(this,Gd))==null?void 0:r.state)??aIe();Xt(this,iy,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},kee=function(n){ic.batch(()=>{var r,s,a,o,l,c,u,d;if(Xe(this,jg)&&this.hasListeners()){const f=Xe(this,iy).variables,x=Xe(this,iy).context;(n==null?void 0:n.type)==="success"?((s=(r=Xe(this,jg)).onSuccess)==null||s.call(r,n.data,f,x),(o=(a=Xe(this,jg)).onSettled)==null||o.call(a,n.data,null,f,x)):(n==null?void 0:n.type)==="error"&&((c=(l=Xe(this,jg)).onError)==null||c.call(l,n.error,f,x),(d=(u=Xe(this,jg)).onSettled)==null||d.call(u,void 0,n.error,f,x))}this.listeners.forEach(f=>{f(Xe(this,iy))})})},yAe);function Fyt(t,e){return Soe(t,e)}function Oyt(t){return JSON.stringify(t,(e,n)=>Myt(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):typeof n=="bigint"?n.toString():n)}function Myt(t){if(!dxe(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const n=e.prototype;return!(!dxe(n)||!n.hasOwnProperty("isPrototypeOf"))}function dxe(t){return Object.prototype.toString.call(t)==="[object Object]"}function w$(t){const{_defaulted:e,behavior:n,gcTime:r,initialData:s,initialDataUpdatedAt:a,maxPages:o,meta:l,networkMode:c,queryFn:u,queryHash:d,queryKey:f,queryKeyHashFn:x,retry:g,retryDelay:y,structuralSharing:v,getPreviousPageParam:C,getNextPageParam:N,initialPageParam:I,_optimisticResults:P,enabled:M,notifyOnChangeProps:F,placeholderData:$,refetchInterval:L,refetchIntervalInBackground:z,refetchOnMount:Q,refetchOnReconnect:se,refetchOnWindowFocus:ee,retryOnMount:K,select:re,staleTime:de,suspense:G,throwOnError:ie,config:ae,connector:q,query:W,...ne}=t;return ne}function Ryt(t){return{mutationFn(e){return lbt(t,e)},mutationKey:["connect"]}}function Lyt(t){return{mutationFn(e){return gbt(t,e)},mutationKey:["disconnect"]}}function Dyt(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 vbt(t,{...a,address:r})??null},queryKey:Byt(e)}}function Byt(t={}){return["balance",w$(t)]}function $yt(t,e={}){return{async queryFn({queryKey:n}){const{name:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("name is required");return Cbt(t,{...a,name:r})},queryKey:Uyt(e)}}function Uyt(t={}){return["ensAvatar",w$(t)]}function zyt(t,e={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("address is required");return Sbt(t,{...a,address:r})},queryKey:Hyt(e)}}function Hyt(t={}){return["ensName",w$(t)]}function Vyt(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 GTe(t,{abi:r,functionName:s,args:o.args,...l,...o})},queryKey:Wyt(e)}}function Wyt(t={}){const{abi:e,...n}=t;return["readContract",w$(n)]}function qyt(t){return{mutationFn(e){return jbt(t,e)},mutationKey:["signMessage"]}}function Gyt(t){return{mutationFn(e){return Abt(t,e)},mutationKey:["signTypedData"]}}function Kyt(t){return{mutationFn(e){return Ebt(t,e)},mutationKey:["switchChain"]}}function Yyt(t){return{mutationFn(e){return Fbt(t,e)},mutationKey:["writeContract"]}}var lIe=h.createContext(void 0),cIe=t=>{const e=h.useContext(lIe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Xyt=({client:t,children:e})=>(h.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),i.jsx(lIe.Provider,{value:t,children:e})),uIe=h.createContext(!1),Qyt=()=>h.useContext(uIe);uIe.Provider;function Zyt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Jyt=h.createContext(Zyt()),e2t=()=>h.useContext(Jyt);function dIe(t,e){return typeof t=="function"?t(...e):!!t}function Tee(){}var t2t=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},n2t=t=>{h.useEffect(()=>{t.clearReset()},[t])},r2t=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||dIe(n,[t.error,r])),s2t=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)))},i2t=(t,e)=>t.isLoading&&t.isFetching&&!e,a2t=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,fxe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function o2t(t,e,n){var f,x,g,y,v;const r=cIe(),s=Qyt(),a=e2t(),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",s2t(o),t2t(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 N=d?c.subscribe(ic.batchCalls(C)):Tee;return c.updateResult(),N},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(o)},[o,c]),a2t(o,u))throw fxe(o,c,a);if(r2t({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&&!W3&&i2t(u,s)){const C=l?fxe(o,c,a):(v=r.getQueryCache().get(o.queryHash))==null?void 0:v.promise;C==null||C.catch(Tee).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function fIe(t,e){return o2t(t,kyt)}function e8(t,e){const n=cIe(),[r]=h.useState(()=>new Pyt(n,t));h.useEffect(()=>{r.setOptions(t)},[r,t]);const s=h.useSyncExternalStore(h.useCallback(o=>r.subscribe(ic.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((o,l)=>{r.mutate(o,l).catch(Tee)},[r]);if(s.error&&dIe(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function C$(t){const e=fIe({...t,queryKeyHashFn:Oyt});return e.queryKey=t.queryKey,e}function t8(t={}){const e=Il(t);return h.useSyncExternalStore(n=>kbt(e,{onChange:n}),()=>q0e(e),()=>q0e(e))}function hIe(t={}){const{address:e,query:n={}}=t,r=Il(t),s=t8({config:r}),a=Dyt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return C$({...n,...a,enabled:o})}function l2t(t={}){const e=Il(t);return h.useSyncExternalStore(n=>oyt(e,{onChange:n}),()=>G0e(e),()=>G0e(e))}function c2t(t={}){const e=Il(t);return h.useSyncExternalStore(n=>Ibt(e,{onChange:n}),()=>K0e(e),()=>K0e(e))}function u2t(t={}){const{mutation:e}=t,n=Il(t),r=Ryt(n),{mutate:s,mutateAsync:a,...o}=e8({...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:c2t({config:n})}}function d2t(t={}){const e=Il(t);return h.useSyncExternalStore(n=>Tbt(e,{onChange:n}),()=>hee(e),()=>hee(e))}function S$(t={}){const{mutation:e}=t,n=Il(t),r=Lyt(n),{mutate:s,mutateAsync:a,...o}=e8({...e,...r});return{...o,connectors:d2t({config:n}).map(l=>l.connector),disconnect:s,disconnectAsync:a}}function f2t(t={}){const{name:e,query:n={}}=t,r=Il(t),s=t8({config:r}),a=$yt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return C$({...n,...a,enabled:o})}function h2t(t={}){const{address:e,query:n={}}=t,r=Il(t),s=t8({config:r}),a=zyt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return C$({...n,...a,enabled:o})}function pIe(t={}){const e=Il(t);return QTe.useSyncExternalStoreWithSelector(n=>Pbt(e,{onChange:n}),()=>pee(e,t),()=>pee(e,t),n=>n,(n,r)=>(n==null?void 0:n.uid)===(r==null?void 0:r.uid))}function hxe(t={}){const{abi:e,address:n,functionName:r,query:s={}}=t,a=t.code,o=Il(t),l=t8({config:o}),c=Vyt(o,{...t,chainId:t.chainId??l}),u=!!((n||a)&&e&&r&&(s.enabled??!0));return C$({...s,...c,enabled:u,structuralSharing:s.structuralSharing??Fyt})}function _oe(t={}){const{mutation:e}=t,n=Il(t),r=qyt(n),{mutate:s,mutateAsync:a,...o}=e8({...e,...r});return{...o,signMessage:s,signMessageAsync:a}}function p2t(t={}){const{mutation:e}=t,n=Il(t),r=Gyt(n),{mutate:s,mutateAsync:a,...o}=e8({...e,...r});return{...o,signTypedData:s,signTypedDataAsync:a}}function Eoe(t={}){const{mutation:e}=t,n=Il(t),r=Kyt(n),{mutate:s,mutateAsync:a,...o}=e8({...e,...r});return{...o,chains:l2t({config:n}),switchChain:s,switchChainAsync:a}}function m2t(t={}){const{mutation:e}=t,n=Il(t),r=Yyt(n),{mutate:s,mutateAsync:a,...o}=e8({...e,...r});return{...o,writeContract:s,writeContractAsync:a}}const cx=Object.create(null);cx.open="0";cx.close="1";cx.ping="2";cx.pong="3";cx.message="4";cx.upgrade="5";cx.noop="6";const DO=Object.create(null);Object.keys(cx).forEach(t=>{DO[cx[t]]=t});const Iee={type:"error",data:"parser error"},mIe=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xIe=typeof ArrayBuffer=="function",gIe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,koe=({type:t,data:e},n,r)=>mIe&&e instanceof Blob?n?r(e):pxe(e,r):xIe&&(e instanceof ArrayBuffer||gIe(e))?n?r(e):pxe(new Blob([e]),r):r(cx[t]+(e||"")),pxe=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function mxe(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let PV;function x2t(t,e){if(mIe&&t.data instanceof Blob)return t.data.arrayBuffer().then(mxe).then(e);if(xIe&&(t.data instanceof ArrayBuffer||gIe(t.data)))return e(mxe(t.data));koe(t,!1,n=>{PV||(PV=new TextEncoder),e(PV.encode(n))})}const xxe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",W7=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<xxe.length;t++)W7[xxe.charCodeAt(t)]=t;const g2t=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=W7[t.charCodeAt(r)],o=W7[t.charCodeAt(r+1)],l=W7[t.charCodeAt(r+2)],c=W7[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",Toe=(t,e)=>{if(typeof t!="string")return{type:"message",data:bIe(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:y2t(t.substring(1),e)}:DO[n]?t.length>1?{type:DO[n],data:t.substring(1)}:{type:DO[n]}:Iee},y2t=(t,e)=>{if(b2t){const n=g2t(t);return bIe(n,e)}else return{base64:!0,data:t}},bIe=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},yIe="",v2t=(t,e)=>{const n=t.length,r=new Array(n);let s=0;t.forEach((a,o)=>{koe(a,!1,l=>{r[o]=l,++s===n&&e(r.join(yIe))})})},w2t=(t,e)=>{const n=t.split(yIe),r=[];for(let s=0;s<n.length;s++){const a=Toe(n[s],e);if(r.push(a),a.type==="error")break}return r};function C2t(){return new TransformStream({transform(t,e){x2t(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 FV;function FP(t){return t.reduce((e,n)=>e+n.length,0)}function OP(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 S2t(t,e){FV||(FV=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(FP(n)<1)break;const c=OP(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(FP(n)<2)break;const c=OP(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(FP(n)<8)break;const c=OP(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(Iee);break}s=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(FP(n)<s)break;const c=OP(n,s);l.enqueue(Toe(a?c:FV.decode(c),e)),r=0}if(s===0||s>t){l.enqueue(Iee);break}}}})}const vIe=4;function Wl(t){if(t)return N2t(t)}function N2t(t){for(var e in Wl.prototype)t[e]=Wl.prototype[e];return t}Wl.prototype.on=Wl.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Wl.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Wl.prototype.off=Wl.prototype.removeListener=Wl.prototype.removeAllListeners=Wl.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};Wl.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};Wl.prototype.emitReserved=Wl.prototype.emit;Wl.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Wl.prototype.hasListeners=function(t){return!!this.listeners(t).length};const N$=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")(),j2t="arraybuffer";function wIe(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const A2t=np.setTimeout,_2t=np.clearTimeout;function j$(t,e){e.useNativeTimers?(t.setTimeoutFn=A2t.bind(np),t.clearTimeoutFn=_2t.bind(np)):(t.setTimeoutFn=np.setTimeout.bind(np),t.clearTimeoutFn=np.clearTimeout.bind(np))}const E2t=1.33;function k2t(t){return typeof t=="string"?T2t(t):Math.ceil((t.byteLength||t.size)*E2t)}function T2t(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 CIe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function I2t(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function P2t(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 F2t extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}let Ioe=class extends Wl{constructor(e){super(),this.writable=!1,j$(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 F2t(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=Toe(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=I2t(e);return n.length?"?"+n:""}};class O2t extends Ioe{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)};w2t(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,v2t(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]=CIe()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let SIe=!1;try{SIe=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const M2t=SIe;function R2t(){}class L2t extends O2t{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 j4=class BO extends Wl{constructor(e,n,r){super(),this.createRequest=e,j$(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=wIe(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=BO.requestsCount++,BO.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=R2t,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete BO.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()}};j4.requestsCount=0;j4.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",gxe);else if(typeof addEventListener=="function"){const t="onpagehide"in np?"pagehide":"unload";addEventListener(t,gxe,!1)}}function gxe(){for(let t in j4.requests)j4.requests.hasOwnProperty(t)&&j4.requests[t].abort()}const D2t=function(){const t=NIe({xdomain:!1});return t&&t.responseType!==null}();class B2t extends L2t{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=D2t&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new j4(NIe,this.uri(),e)}}function NIe(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||M2t))return new XMLHttpRequest}catch{}if(!e)try{return new np[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const jIe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class $2t extends Ioe{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=jIe?{}:wIe(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;koe(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}s&&N$(()=>{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]=CIe()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const OV=np.WebSocket||np.MozWebSocket;let U2t=class extends $2t{createSocket(e,n,r){return jIe?new OV(e,n,r):n?new OV(e,n):new OV(e)}doWrite(e,n){this.ws.send(n)}};class z2t extends Ioe{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=S2t(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),s=C2t();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&&N$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const H2t={websocket:U2t,webtransport:z2t,polling:B2t},V2t=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,W2t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Pee(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=V2t.exec(t||""),a={},o=14;for(;o--;)a[W2t[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=q2t(a,a.path),a.queryKey=G2t(a,a.query),a}function q2t(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 G2t(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,a){s&&(n[s]=a)}),n}const Fee=typeof addEventListener=="function"&&typeof removeEventListener=="function",$O=[];Fee&&addEventListener("offline",()=>{$O.forEach(t=>t())},!1);class Ly extends Wl{constructor(e,n){if(super(),this.binaryType=j2t,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=Pee(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=Pee(n.host).host);j$(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=P2t(this.opts.query)),Fee&&(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"})},$O.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=vIe,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ly.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Ly.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=k2t(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,N$(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Ly.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Fee&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=$O.indexOf(this._offlineEventListener);r!==-1&&$O.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ly.protocol=vIe;class K2t extends Ly{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;Ly.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ly.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function a(){r||(r=!0,d(),n.close(),n=null)}const o=f=>{const x=new Error("probe error: "+f);x.transport=n.name,a(),this.emitReserved("upgradeError",x)};function l(){o("transport closed")}function c(){o("socket closed")}function u(f){n&&f.name!==n.name&&a()}const d=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let Y2t=class extends K2t{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=>H2t[s]).filter(s=>!!s)),super(e,r)}};function X2t(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=Pee(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+e,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const Q2t=typeof ArrayBuffer=="function",Z2t=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,AIe=Object.prototype.toString,J2t=typeof Blob=="function"||typeof Blob<"u"&&AIe.call(Blob)==="[object BlobConstructor]",evt=typeof File=="function"||typeof File<"u"&&AIe.call(File)==="[object FileConstructor]";function Poe(t){return Q2t&&(t instanceof ArrayBuffer||Z2t(t))||J2t&&t instanceof Blob||evt&&t instanceof File}function UO(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(UO(t[n]))return!0;return!1}if(Poe(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return UO(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&UO(t[n]))return!0;return!1}function tvt(t){const e=[],n=t.data,r=t;return r.data=Oee(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Oee(t,e){if(!t)return t;if(Poe(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]=Oee(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]=Oee(t[r],e));return n}return t}function nvt(t,e){return t.data=Mee(t.data,e),delete t.attachments,t}function Mee(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]=Mee(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Mee(t[n],e));return t}const rvt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],svt=5;var ra;(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"})(ra||(ra={}));let ivt=class{constructor(e){this.replacer=e}encode(e){return(e.type===ra.EVENT||e.type===ra.ACK)&&UO(e)?this.encodeAsBinary({type:e.type===ra.EVENT?ra.BINARY_EVENT:ra.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ra.BINARY_EVENT||e.type===ra.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=tvt(e),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}};function bxe(t){return Object.prototype.toString.call(t)==="[object Object]"}class Foe extends Wl{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===ra.BINARY_EVENT;r||n.type===ra.BINARY_ACK?(n.type=r?ra.EVENT:ra.ACK,this.reconstructor=new avt(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Poe(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(ra[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ra.BINARY_EVENT||r.type===ra.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(Foe.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 ra.CONNECT:return bxe(n);case ra.DISCONNECT:return n===void 0;case ra.CONNECT_ERROR:return typeof n=="string"||bxe(n);case ra.EVENT:case ra.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&rvt.indexOf(n[0])===-1);case ra.ACK:case ra.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class avt{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 ovt=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Foe,Encoder:ivt,get PacketType(){return ra},protocol:svt},Symbol.toStringTag,{value:"Module"}));function rm(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lvt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class _Ie extends Wl{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(lvt.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:ra.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:ra.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 ra.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 ra.EVENT:case ra.BINARY_EVENT:this.onevent(e);break;case ra.ACK:case ra.BINARY_ACK:this.onack(e);break;case ra.DISCONNECT:this.ondisconnect();break;case ra.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:ra.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:ra.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 n8(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}n8.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};n8.prototype.reset=function(){this.attempts=0};n8.prototype.setMin=function(t){this.ms=t};n8.prototype.setMax=function(t){this.max=t};n8.prototype.setJitter=function(t){this.jitter=t};class Ree extends Wl{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,j$(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 n8({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||ovt;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 Y2t(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){N$(()=>{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 _Ie(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 XA={};function Dy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=X2t(t,e.path||"/socket.io"),r=n.source,s=n.id,a=n.path,o=XA[s]&&a in XA[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return l?c=new Ree(r,e):(XA[s]||(XA[s]=new Ree(r,e)),c=XA[s]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(Dy,{Manager:Ree,Socket:_Ie,io:Dy,connect:Dy});function EIe(t,e){return function(){return t.apply(e,arguments)}}const{toString:cvt}=Object.prototype,{getPrototypeOf:Ooe}=Object,A$=(t=>e=>{const n=cvt.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Om=t=>(t=t.toLowerCase(),e=>A$(e)===t),_$=t=>e=>typeof e===t,{isArray:r8}=Array,q_=_$("undefined");function uvt(t){return t!==null&&!q_(t)&&t.constructor!==null&&!q_(t.constructor)&&eh(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const kIe=Om("ArrayBuffer");function dvt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&kIe(t.buffer),e}const fvt=_$("string"),eh=_$("function"),TIe=_$("number"),E$=t=>t!==null&&typeof t=="object",hvt=t=>t===!0||t===!1,zO=t=>{if(A$(t)!=="object")return!1;const e=Ooe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},pvt=Om("Date"),mvt=Om("File"),xvt=Om("Blob"),gvt=Om("FileList"),bvt=t=>E$(t)&&eh(t.pipe),yvt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||eh(t.append)&&((e=A$(t))==="formdata"||e==="object"&&eh(t.toString)&&t.toString()==="[object FormData]"))},vvt=Om("URLSearchParams"),[wvt,Cvt,Svt,Nvt]=["ReadableStream","Request","Response","Headers"].map(Om),jvt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jT(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),r8(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 IIe(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const dw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,PIe=t=>!q_(t)&&t!==dw;function Lee(){const{caseless:t}=PIe(this)&&this||{},e={},n=(r,s)=>{const a=t&&IIe(e,s)||s;zO(e[a])&&zO(r)?e[a]=Lee(e[a],r):zO(r)?e[a]=Lee({},r):r8(r)?e[a]=r.slice():e[a]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&jT(arguments[r],n);return e}const Avt=(t,e,n,{allOwnKeys:r}={})=>(jT(e,(s,a)=>{n&&eh(s)?t[a]=EIe(s,n):t[a]=s},{allOwnKeys:r}),t),_vt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Evt=(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)},kvt=(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&&Ooe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Tvt=(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},Ivt=t=>{if(!t)return null;if(r8(t))return t;let e=t.length;if(!TIe(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Pvt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ooe(Uint8Array)),Fvt=(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])}},Ovt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Mvt=Om("HTMLFormElement"),Rvt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),yxe=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Lvt=Om("RegExp"),FIe=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};jT(n,(s,a)=>{let o;(o=e(s,a,t))!==!1&&(r[a]=o||s)}),Object.defineProperties(t,r)},Dvt=t=>{FIe(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+"'")})}})},Bvt=(t,e)=>{const n={},r=s=>{s.forEach(a=>{n[a]=!0})};return r8(t)?r(t):r(String(t).split(e)),n},$vt=()=>{},Uvt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,MV="abcdefghijklmnopqrstuvwxyz",vxe="0123456789",OIe={DIGIT:vxe,ALPHA:MV,ALPHA_DIGIT:MV+MV.toUpperCase()+vxe},zvt=(t=16,e=OIe.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function Hvt(t){return!!(t&&eh(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const Vvt=t=>{const e=new Array(10),n=(r,s)=>{if(E$(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const a=r8(r)?[]:{};return jT(r,(o,l)=>{const c=n(o,s+1);!q_(c)&&(a[l]=c)}),e[s]=void 0,a}}return r};return n(t,0)},Wvt=Om("AsyncFunction"),qvt=t=>t&&(E$(t)||eh(t))&&eh(t.then)&&eh(t.catch),MIe=((t,e)=>t?setImmediate:e?((n,r)=>(dw.addEventListener("message",({source:s,data:a})=>{s===dw&&a===n&&r.length&&r.shift()()},!1),s=>{r.push(s),dw.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",eh(dw.postMessage)),Gvt=typeof queueMicrotask<"u"?queueMicrotask.bind(dw):typeof process<"u"&&process.nextTick||MIe,vr={isArray:r8,isArrayBuffer:kIe,isBuffer:uvt,isFormData:yvt,isArrayBufferView:dvt,isString:fvt,isNumber:TIe,isBoolean:hvt,isObject:E$,isPlainObject:zO,isReadableStream:wvt,isRequest:Cvt,isResponse:Svt,isHeaders:Nvt,isUndefined:q_,isDate:pvt,isFile:mvt,isBlob:xvt,isRegExp:Lvt,isFunction:eh,isStream:bvt,isURLSearchParams:vvt,isTypedArray:Pvt,isFileList:gvt,forEach:jT,merge:Lee,extend:Avt,trim:jvt,stripBOM:_vt,inherits:Evt,toFlatObject:kvt,kindOf:A$,kindOfTest:Om,endsWith:Tvt,toArray:Ivt,forEachEntry:Fvt,matchAll:Ovt,isHTMLForm:Mvt,hasOwnProperty:yxe,hasOwnProp:yxe,reduceDescriptors:FIe,freezeMethods:Dvt,toObjectSet:Bvt,toCamelCase:Rvt,noop:$vt,toFiniteNumber:Uvt,findKey:IIe,global:dw,isContextDefined:PIe,ALPHABET:OIe,generateString:zvt,isSpecCompliantForm:Hvt,toJSONObject:Vvt,isAsyncFn:Wvt,isThenable:qvt,setImmediate:MIe,asap:Gvt};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)}vr.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:vr.toJSONObject(this.config),code:this.code,status:this.status}}});const RIe=Ii.prototype,LIe={};["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=>{LIe[t]={value:t}});Object.defineProperties(Ii,LIe);Object.defineProperty(RIe,"isAxiosError",{value:!0});Ii.from=(t,e,n,r,s,a)=>{const o=Object.create(RIe);return vr.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 Kvt=null;function Dee(t){return vr.isPlainObject(t)||vr.isArray(t)}function DIe(t){return vr.endsWith(t,"[]")?t.slice(0,-2):t}function wxe(t,e,n){return t?t.concat(e).map(function(s,a){return s=DIe(s),!n&&a?"["+s+"]":s}).join(n?".":""):e}function Yvt(t){return vr.isArray(t)&&!t.some(Dee)}const Xvt=vr.toFlatObject(vr,{},null,function(e){return/^is[A-Z]/.test(e)});function k$(t,e,n){if(!vr.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=vr.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,C){return!vr.isUndefined(C[v])});const r=n.metaTokens,s=n.visitor||d,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&vr.isSpecCompliantForm(e);if(!vr.isFunction(s))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(vr.isDate(y))return y.toISOString();if(!c&&vr.isBlob(y))throw new Ii("Blob is not supported. Use a Buffer instead.");return vr.isArrayBuffer(y)||vr.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function d(y,v,C){let N=y;if(y&&!C&&typeof y=="object"){if(vr.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=JSON.stringify(y);else if(vr.isArray(y)&&Yvt(y)||(vr.isFileList(y)||vr.endsWith(v,"[]"))&&(N=vr.toArray(y)))return v=DIe(v),N.forEach(function(P,M){!(vr.isUndefined(P)||P===null)&&e.append(o===!0?wxe([v],M,a):o===null?v:v+"[]",u(P))}),!1}return Dee(y)?!0:(e.append(wxe(C,v,a),u(y)),!1)}const f=[],x=Object.assign(Xvt,{defaultVisitor:d,convertValue:u,isVisitable:Dee});function g(y,v){if(!vr.isUndefined(y)){if(f.indexOf(y)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(y),vr.forEach(y,function(N,I){(!(vr.isUndefined(N)||N===null)&&s.call(e,N,vr.isString(I)?I.trim():I,v,x))===!0&&g(N,v?v.concat(I):[I])}),f.pop()}}if(!vr.isObject(t))throw new TypeError("data must be an object");return g(t),e}function Cxe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Moe(t,e){this._pairs=[],t&&k$(t,this,e)}const BIe=Moe.prototype;BIe.append=function(e,n){this._pairs.push([e,n])};BIe.toString=function(e){const n=e?function(r){return e.call(this,r,Cxe)}:Cxe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Qvt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $Ie(t,e,n){if(!e)return t;const r=n&&n.encode||Qvt;vr.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let a;if(s?a=s(e,n):a=vr.isURLSearchParams(e)?e.toString():new Moe(e,n).toString(r),a){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Sxe{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vr.forEach(this.handlers,function(r){r!==null&&e(r)})}}const UIe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zvt=typeof URLSearchParams<"u"?URLSearchParams:Moe,Jvt=typeof FormData<"u"?FormData:null,ewt=typeof Blob<"u"?Blob:null,twt={isBrowser:!0,classes:{URLSearchParams:Zvt,FormData:Jvt,Blob:ewt},protocols:["http","https","file","blob","url","data"]},Roe=typeof window<"u"&&typeof document<"u",Bee=typeof navigator=="object"&&navigator||void 0,nwt=Roe&&(!Bee||["ReactNative","NativeScript","NS"].indexOf(Bee.product)<0),rwt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",swt=Roe&&window.location.href||"http://localhost",iwt=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Roe,hasStandardBrowserEnv:nwt,hasStandardBrowserWebWorkerEnv:rwt,navigator:Bee,origin:swt},Symbol.toStringTag,{value:"Module"})),Mu={...iwt,...twt};function awt(t,e){return k$(t,new Mu.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,a){return Mu.isNode&&vr.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function owt(t){return vr.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function lwt(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 zIe(t){function e(n,r,s,a){let o=n[a++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),c=a>=n.length;return o=!o&&vr.isArray(s)?s.length:o,c?(vr.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!vr.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],a)&&vr.isArray(s[o])&&(s[o]=lwt(s[o])),!l)}if(vr.isFormData(t)&&vr.isFunction(t.entries)){const n={};return vr.forEachEntry(t,(r,s)=>{e(owt(r),s,n,0)}),n}return null}function cwt(t,e,n){if(vr.isString(t))try{return(e||JSON.parse)(t),vr.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const AT={transitional:UIe,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,a=vr.isObject(e);if(a&&vr.isHTMLForm(e)&&(e=new FormData(e)),vr.isFormData(e))return s?JSON.stringify(zIe(e)):e;if(vr.isArrayBuffer(e)||vr.isBuffer(e)||vr.isStream(e)||vr.isFile(e)||vr.isBlob(e)||vr.isReadableStream(e))return e;if(vr.isArrayBufferView(e))return e.buffer;if(vr.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return awt(e,this.formSerializer).toString();if((l=vr.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return k$(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return a||s?(n.setContentType("application/json",!1),cwt(e)):e}],transformResponse:[function(e){const n=this.transitional||AT.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(vr.isResponse(e)||vr.isReadableStream(e))return e;if(e&&vr.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?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}}};vr.forEach(["delete","get","head","post","put","patch"],t=>{AT.headers[t]={}});const uwt=vr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dwt=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]&&uwt[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Nxe=Symbol("internals");function QA(t){return t&&String(t).trim().toLowerCase()}function HO(t){return t===!1||t==null?t:vr.isArray(t)?t.map(HO):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 hwt=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function RV(t,e,n,r,s){if(vr.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!vr.isString(e)){if(vr.isString(r))return e.indexOf(r)!==-1;if(vr.isRegExp(r))return r.test(e)}}function pwt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function mwt(t,e){const n=vr.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,a,o){return this[r].call(this,e,s,a,o)},configurable:!0})})}class df{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function a(l,c,u){const d=QA(c);if(!d)throw new Error("header name must be a non-empty string");const f=vr.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=HO(l))}const o=(l,c)=>vr.forEach(l,(u,d)=>a(u,d,c));if(vr.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(vr.isString(e)&&(e=e.trim())&&!hwt(e))o(dwt(e),n);else if(vr.isHeaders(e))for(const[l,c]of e.entries())a(c,l,r);else e!=null&&a(n,e,r);return this}get(e,n){if(e=QA(e),e){const r=vr.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return fwt(s);if(vr.isFunction(n))return n.call(this,s,r);if(vr.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=QA(e),e){const r=vr.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||RV(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function a(o){if(o=QA(o),o){const l=vr.findKey(r,o);l&&(!n||RV(r,r[l],l,n))&&(delete r[l],s=!0)}}return vr.isArray(e)?e.forEach(a):a(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const a=n[r];(!e||RV(this,this[a],a,e,!0))&&(delete this[a],s=!0)}return s}normalize(e){const n=this,r={};return vr.forEach(this,(s,a)=>{const o=vr.findKey(r,a);if(o){n[o]=HO(s),delete n[a];return}const l=e?pwt(a):String(a).trim();l!==a&&delete n[a],n[l]=HO(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return vr.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&vr.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Nxe]=this[Nxe]={accessors:{}}).accessors,s=this.prototype;function a(o){const l=QA(o);r[l]||(mwt(s,o),r[l]=!0)}return vr.isArray(e)?e.forEach(a):a(e),this}}df.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);vr.reduceDescriptors(df.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});vr.freezeMethods(df);function LV(t,e){const n=this||AT,r=e||n,s=df.from(r.headers);let a=r.data;return vr.forEach(t,function(l){a=l.call(n,a,s.normalize(),e?e.status:void 0)}),s.normalize(),a}function HIe(t){return!!(t&&t.__CANCEL__)}function s8(t,e,n){Ii.call(this,t??"canceled",Ii.ERR_CANCELED,e,n),this.name="CanceledError"}vr.inherits(s8,Ii,{__CANCEL__:!0});function VIe(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 xwt(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function gwt(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 hR=(t,e,n=3)=>{let r=0;const s=gwt(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)},jxe=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Axe=t=>(...e)=>vr.asap(()=>t(...e)),ywt=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,vwt=Mu.hasStandardBrowserEnv?{write(t,e,n,r,s,a){const o=[t+"="+encodeURIComponent(e)];vr.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),vr.isString(r)&&o.push("path="+r),vr.isString(s)&&o.push("domain="+s),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function wwt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Cwt(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function WIe(t,e){return t&&!wwt(e)?Cwt(t,e):e}const _xe=t=>t instanceof df?{...t}:t;function G3(t,e){e=e||{};const n={};function r(u,d,f,x){return vr.isPlainObject(u)&&vr.isPlainObject(d)?vr.merge.call({caseless:x},u,d):vr.isPlainObject(d)?vr.merge({},d):vr.isArray(d)?d.slice():d}function s(u,d,f,x){if(vr.isUndefined(d)){if(!vr.isUndefined(u))return r(void 0,u,f,x)}else return r(u,d,f,x)}function a(u,d){if(!vr.isUndefined(d))return r(void 0,d)}function o(u,d){if(vr.isUndefined(d)){if(!vr.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in e)return r(u,d);if(f in t)return r(void 0,u)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(_xe(u),_xe(d),f,!0)};return vr.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=c[d]||s,x=f(t[d],e[d],d);vr.isUndefined(x)&&f!==l||(n[d]=x)}),n}const qIe=t=>{const e=G3({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:l}=e;e.headers=o=df.from(o),e.url=$Ie(WIe(e.baseURL,e.url),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(vr.isFormData(n)){if(Mu.hasStandardBrowserEnv||Mu.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Mu.hasStandardBrowserEnv&&(r&&vr.isFunction(r)&&(r=r(e)),r||r!==!1&&ywt(e.url))){const u=s&&a&&vwt.read(a);u&&o.set(s,u)}return e},Swt=typeof XMLHttpRequest<"u",Nwt=Swt&&function(t){return new Promise(function(n,r){const s=qIe(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 N(){if(!C)return;const P=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:P,config:t,request:C};VIe(function(L){n(L),v()},function(L){r(L),v()},F),C=null}"onloadend"in C?C.onloadend=N:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(N)},C.onabort=function(){C&&(r(new 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 M=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||UIe;s.timeoutErrorMessage&&(M=s.timeoutErrorMessage),r(new Ii(M,F.clarifyTimeoutError?Ii.ETIMEDOUT:Ii.ECONNABORTED,t,C)),C=null},a===void 0&&o.setContentType(null),"setRequestHeader"in C&&vr.forEach(o.toJSON(),function(M,F){C.setRequestHeader(F,M)}),vr.isUndefined(s.withCredentials)||(C.withCredentials=!!s.withCredentials),l&&l!=="json"&&(C.responseType=s.responseType),u&&([x,y]=hR(u,!0),C.addEventListener("progress",x)),c&&C.upload&&([f,g]=hR(c),C.upload.addEventListener("progress",f),C.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=P=>{C&&(r(!P||P.type?new s8(null,t,C):P),C.abort(),C=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const I=xwt(s.url);if(I&&Mu.protocols.indexOf(I)===-1){r(new Ii("Unsupported protocol "+I+":",Ii.ERR_BAD_REQUEST,t));return}C.send(a||null)})},jwt=(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 s8(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=()=>vr.asap(l),c}},Awt=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},_wt=async function*(t,e){for await(const n of Ewt(t))yield*Awt(n,e)},Ewt=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()}},Exe=(t,e,n,r)=>{const s=_wt(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})},T$=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",GIe=T$&&typeof ReadableStream=="function",kwt=T$&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),KIe=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Twt=GIe&&KIe(()=>{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}),kxe=64*1024,$ee=GIe&&KIe(()=>vr.isReadableStream(new Response("").body)),pR={stream:$ee&&(t=>t.body)};T$&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!pR[e]&&(pR[e]=vr.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 Iwt=async t=>{if(t==null)return 0;if(vr.isBlob(t))return t.size;if(vr.isSpecCompliantForm(t))return(await new Request(Mu.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(vr.isArrayBufferView(t)||vr.isArrayBuffer(t))return t.byteLength;if(vr.isURLSearchParams(t)&&(t=t+""),vr.isString(t))return(await kwt(t)).byteLength},Pwt=async(t,e)=>{const n=vr.toFiniteNumber(t.getContentLength());return n??Iwt(e)},Fwt=T$&&(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}=qIe(t);u=u?(u+"").toLowerCase():"text";let g=jwt([s,a&&a.toAbortSignal()],o),y;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let C;try{if(c&&Twt&&n!=="get"&&n!=="head"&&(C=await Pwt(d,r))!==0){let F=new Request(e,{method:"POST",body:r,duplex:"half"}),$;if(vr.isFormData(r)&&($=F.headers.get("content-type"))&&d.setContentType($),F.body){const[L,z]=jxe(C,hR(Axe(c)));r=Exe(F.body,kxe,L,z)}}vr.isString(f)||(f=f?"include":"omit");const N="credentials"in Request.prototype;y=new Request(e,{...x,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:N?f:void 0});let I=await fetch(y);const P=$ee&&(u==="stream"||u==="response");if($ee&&(l||P&&v)){const F={};["status","statusText","headers"].forEach(Q=>{F[Q]=I[Q]});const $=vr.toFiniteNumber(I.headers.get("content-length")),[L,z]=l&&jxe($,hR(Axe(l),!0))||[];I=new Response(Exe(I.body,kxe,L,()=>{z&&z(),v&&v()}),F)}u=u||"text";let M=await pR[vr.findKey(pR,u)||"text"](I,t);return!P&&v&&v(),await new Promise((F,$)=>{VIe(F,$,{data:M,headers:df.from(I.headers),status:I.status,statusText:I.statusText,config:t,request:y})})}catch(N){throw v&&v(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new Ii("Network Error",Ii.ERR_NETWORK,t,y),{cause:N.cause||N}):Ii.from(N,N&&N.code,t,y)}}),Uee={http:Kvt,xhr:Nwt,fetch:Fwt};vr.forEach(Uee,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Txe=t=>`- ${t}`,Owt=t=>vr.isFunction(t)||t===null||t===!1,YIe={getAdapter:t=>{t=vr.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let a=0;a<e;a++){n=t[a];let o;if(r=n,!Owt(n)&&(r=Uee[(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(Txe).join(`
`):" "+Txe(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:Uee};function DV(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new s8(null,t)}function Ixe(t){return DV(t),t.headers=df.from(t.headers),t.data=LV.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),YIe.getAdapter(t.adapter||AT.adapter)(t).then(function(r){return DV(t),r.data=LV.call(t,t.transformResponse,r),r.headers=df.from(r.headers),r},function(r){return HIe(r)||(DV(t),r&&r.response&&(r.response.data=LV.call(t,t.transformResponse,r.response),r.response.headers=df.from(r.response.headers))),Promise.reject(r)})}const XIe="1.7.9",I$={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{I$[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Pxe={};I$.transitional=function(e,n,r){function s(a,o){return"[Axios v"+XIe+"] 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&&!Pxe[o]&&(Pxe[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}};I$.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Mwt(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 VO={assertOptions:Mwt,validators:I$},s0=VO.validators;class p3{constructor(e){this.defaults=e,this.interceptors={request:new Sxe,response:new Sxe}}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=G3(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&VO.assertOptions(r,{silentJSONParsing:s0.transitional(s0.boolean),forcedJSONParsing:s0.transitional(s0.boolean),clarifyTimeoutError:s0.transitional(s0.boolean)},!1),s!=null&&(vr.isFunction(s)?n.paramsSerializer={serialize:s}:VO.assertOptions(s,{encode:s0.function,serialize:s0.function},!0)),VO.assertOptions(n,{baseUrl:s0.spelling("baseURL"),withXsrfToken:s0.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&vr.merge(a.common,a[n.method]);a&&vr.forEach(["delete","get","head","post","put","patch","common"],y=>{delete a[y]}),n.headers=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=[Ixe.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=Ixe.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=G3(this.defaults,e);const n=WIe(e.baseURL,e.url);return $Ie(n,e.params,e.paramsSerializer)}}vr.forEach(["delete","get","head","options"],function(e){p3.prototype[e]=function(n,r){return this.request(G3(r||{},{method:e,url:n,data:(r||{}).data}))}});vr.forEach(["post","put","patch"],function(e){function n(r){return function(a,o,l){return this.request(G3(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:o}))}}p3.prototype[e]=n(),p3.prototype[e+"Form"]=n(!0)});class Loe{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 s8(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 Loe(function(s){e=s}),cancel:e}}}function Rwt(t){return function(n){return t.apply(null,n)}}function Lwt(t){return vr.isObject(t)&&t.isAxiosError===!0}const zee={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(zee).forEach(([t,e])=>{zee[e]=t});function QIe(t){const e=new p3(t),n=EIe(p3.prototype.request,e);return vr.extend(n,p3.prototype,e,{allOwnKeys:!0}),vr.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return QIe(G3(t,s))},n}const ps=QIe(AT);ps.Axios=p3;ps.CanceledError=s8;ps.CancelToken=Loe;ps.isCancel=HIe;ps.VERSION=XIe;ps.toFormData=k$;ps.AxiosError=Ii;ps.Cancel=ps.CanceledError;ps.all=function(e){return Promise.all(e)};ps.spread=Rwt;ps.isAxiosError=Lwt;ps.mergeConfig=G3;ps.AxiosHeaders=df;ps.formToJSON=t=>zIe(vr.isHTMLForm(t)?new FormData(t):t);ps.getAdapter=YIe.getAdapter;ps.HttpStatusCode=zee;ps.default=ps;var n2="https://dextrabothypev2.nftinit.io/";async function Dwt(t,e){if(e==1||e==null)return fetch(n2+"api/subscriber/sign_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t})}).then(n=>n.json());if(e>1)return fetch(n2+"api/subscriber/sign_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token_slot:e})}).then(n=>n.json())}async function Bwt(t,e,n,r){if(r==1||r==null)return fetch(n2+"api/subscriber/sign_complete_v2/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,temp_password:e,signature:n})}).then(s=>s.json());if(r>1)return fetch(n2+"api/subscriber/sign_complete_v2/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,temp_password:e,signature:n,token_slot:r})}).then(s=>s.json())}async function vi(t,e){if(t)return await fetch(n2+"api/subscriber/check_account/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function $wt(t,e){if(t)return await fetch(n2+"api/subscriber/telegram_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Uwt(t,e){if(t)return await fetch(n2+"api/hyper/following/list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function zwt(t,e){if(t)return await fetch(n2+"api/hyper/tracker/list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Hwt(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 BV=null;function Vwt(t){BV&&clearInterval(BV),BV=setInterval(async()=>{const e=localStorage.getItem("hyperTradeTokenExp"),n=Date.now()/1e3;(!e||e-n<600)&&await Hwt(t)&&(localStorage.setItem("hyperTradeTokenExp",n+259200),console.log("Trade token refreshed"))},5*60*1e3)}const Wwt=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)},Yr=h.createContext(),qwt=({children:t})=>{const e=Xl(),{isConnected:n,address:r}=es(),{signMessageAsync:s}=_oe(),[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),[N,I]=h.useState(!1),[P,M]=h.useState(0),[F,$]=h.useState(window.localStorage.getItem("hyperToken")),[L,z]=h.useState(window.localStorage.getItem("hyperAddress")),[Q,se]=h.useState(!1),[ee,K]=h.useState(!1),[re,de]=h.useState(!1),[G,ie]=h.useState(null),[ae,q]=h.useState(!1),[W,ne]=h.useState(null),[oe,he]=h.useState(null),[_e,xe]=h.useState([]),[Se,ge]=h.useState([]),[Ce,je]=h.useState([]),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState({activeRange:"",day:0,week:0,month:0}),[ht,rt]=h.useState([]),st=h.useCallback(async()=>{const tn=window.localStorage.getItem("hyperToken"),fn=window.localStorage.getItem("hyperAddress");if(!tn||!fn){rt([]);return}try{const rn=await vi(fn.toLowerCase(),tn);rn!=null&&rn.success&&rt((rn==null?void 0:rn.bot_slots_info)||[])}catch{}},[]);async function He(){var nt,it;const tn=window.localStorage.getItem("hyperToken"),fn=window.localStorage.getItem("hyperAddress"),rn=iht(tn);if(tn&&rn!==!1){const Ut=await vi(fn,tn);Ut.success?(rt((Ut==null?void 0:Ut.bot_slots_info)||[]),c(Ut.telegram_chat_id),o(Ut.subscriber_role),d((nt=Ut==null?void 0:Ut.mushboomer_counts)==null?void 0:nt.eth),x((it=Ut==null?void 0:Ut.mushboomer_counts)==null?void 0:it.sol),y(Ut==null?void 0:Ut.referral_code),C(Ut==null?void 0:Ut.refcode),I(Ut==null?void 0:Ut.whitelist),M(Ut==null?void 0:Ut.subs_expire_day),$(localStorage.getItem("hyperToken")),z(localStorage.getItem("hyperAddress")),cn(),Qt()):rt([])}else Ve(1)}async function Ve(tn){try{if(!r)throw new Error("No accounts found. Please connect your wallet.");const fn=await Dwt(r,tn);if(!fn.success)return{success:!1,message:fn.error_message};const rn=fn.temp_password,nt=`dextrabot.io verification code : ${rn}`,it=await s({message:nt}),Ut=await Bwt(fn.address,rn,it,tn);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 hn=Date.now()/1e3;window.localStorage.setItem("hyperTradeTokenExp",hn+(Ut.expires_in||259200)),Vwt(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(fn){return console.error("Error during sign-in:",fn),{success:!1,message:fn.message||"An unknown error occurred."}}}const[bt,xt]=h.useState([]);async function Qt(){const tn=window.localStorage.getItem("hyperToken"),fn=window.localStorage.getItem("hyperAddress");try{de(!0);const rn=await Uwt(r||fn,tn);if(!rn.success){rn.error_message!="User not verified"&&dn.error(rn.error_message),rn.error_message=="User not verified";return}rn.success?xt(rn==null?void 0:rn.data):xt([])}catch(rn){rn.name!=="AbortError"&&(ie(rn.message),dn.error(rn.message)),xt([])}finally{de(!1)}}const[St,on]=h.useState([]);async function cn(){const tn=window.localStorage.getItem("hyperToken"),fn=window.localStorage.getItem("hyperAddress");try{q(!0);const rn=await zwt(r||fn,tn);if(!rn.success){rn.error_message!="User not verified"&&dn.error(rn.error_message),rn.error_message=="User not verified";return}rn.success?on(rn==null?void 0:rn.data):on([])}catch(rn){rn.name!=="AbortError"&&(ne(rn.message),dn.error(rn.message)),on([])}finally{q(!1)}}h.useEffect(()=>{window.localStorage.getItem("hyperToken")==null&&e.pathname!="/tracked-wallets"&&ee&&se(!0)},[n]),h.useEffect(()=>{!n&&!F||(e.pathname=="/wallet-management"||e.pathname.includes("referral")||e.pathname=="/leaderboard")&&F!=null&&F&&Qt()},[F]),h.useRef(!1),h.useEffect(()=>{if(e.pathname==="/"||e.pathname==="/sitemap"||e.pathname==="/videos"||!window.localStorage.getItem("hyperToken"))return;const rn=`notificationsFeedSocket_${r==null?void 0:r.toLowerCase()}`,nt=localStorage.getItem(rn);xe(nt?JSON.parse(nt):[]);const it=Dy("https://dextrabothypesocketv2.nftinit.io/");return he(it),it.on("connect",()=>{console.log("Socket connected")}),it.on("disconnect",()=>{console.log("Socket disconnected")}),it.on("hyper_get_trade_message",async Ut=>{const hn=(Array.isArray(Ut)?Ut:[Ut]).map(pt=>({...pt,is_read:!1,trader_pnl:null}));xe(pt=>{const We=new Set(pt.map(ct=>ct==null?void 0:ct.oid)),Ge=[...hn==null?void 0:hn.filter(ct=>!(We!=null&&We.has(ct==null?void 0:ct.oid))),...pt].slice(0,100);return localStorage.setItem(rn,JSON.stringify(Ge)),Ge});const nn=window.localStorage.getItem("hyperToken");if(!r||!nn){console.log("User logged out before timeout - skipping PNL fetch.");return}const Vt=hn.map(pt=>pt==null?void 0:pt.trader_wallet).filter(Boolean)[0];try{const pt=await ps.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:Vt});if(pt.data){const We=Wwt(pt.data),It=new Map(We==null?void 0:We.map(Ge=>[Ge==null?void 0:Ge.oid,Ge==null?void 0:Ge.pnl]));xe(Ge=>{const ct=Ge==null?void 0:Ge.map(vt=>It!=null&&It.has(vt==null?void 0:vt.trader_oid)?{...vt,trader_pnl:It==null?void 0:It.get(vt==null?void 0:vt.trader_oid)}:vt);return localStorage.setItem(rn,JSON.stringify(ct)),ct})}else console.log("Unexpected API response")}catch(pt){console.error("PNL API error:",pt)}}),()=>{it.disconnect()}},[F]),h.useEffect(()=>{if(!oe||!r||!bt||bt.length===0)return;bt.map(fn=>fn.wallet_address);const tn=window.localStorage.getItem("hyperToken");return oe.emit("subscribe",{login:r==null?void 0:r.toLowerCase(),token:tn}),()=>{}},[oe,r,bt]);const Vn=async()=>{try{const tn=window.localStorage.getItem("hyperToken"),fn="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/getannouncements/";let rn={};r&&tn&&(rn={address:r.toLowerCase(),token:tn});const nt=await fetch(fn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(rn)});if(!nt.ok)throw new Error(`Server responded with status ${nt.status}`);const it=await nt.json();it.success?ge(it):console.log(it.error_message)}catch(tn){console.error("Error in handleAnnouncement:",tn)}};return h.useEffect(()=>{Vn();const tn=setInterval(()=>{Vn()},6e4);return()=>clearInterval(tn)},[n,F]),h.useEffect(()=>{(async()=>{try{const nt=(await(await fetch("https://dextradata.nftinit.io/api/hyper/terminal_coins/v2/")).json()).coins;je(nt)}catch(fn){console.error("Data retrieval error:",fn),$e(fn.message)}})()},[]),i.jsx(Yr.Provider,{value:{subscriberRole:a,setSubscriberRole:o,subsExpireDay:P,setSubsExpireDay:M,hyperToken:F,setHyperToken:$,hyperAddress:L,setHyperAddress:z,signModalOpen:Q,setSignModalOpen:se,walletLogin:He,signIn:Ve,copyTradeWatchList:bt,setCopyTradeWatchList:xt,trackedWatchList:St,setTrackedWatchList:on,getCopyTradeWatchList:Qt,getTrackedWatchList:cn,copyWatchListLoading:re,setCopyWatchListLoading:de,trackedWatchListLoading:ae,setTrackedWatchListLoading:q,copyWatchListError:G,setCopyWatchListError:ie,trackedWatchListError:W,setTrackedWatchListError:ne,signInConnectButtonOpen:ee,setSignInConnectButtonOpen:K,telegramChatId:l,setTelegramChatId:c,mushboomerETH:u,setMushboomerETH:d,isWhitelist:N,setIsWhitelist:I,mushboomerSOL:f,setMushboomerSOL:x,isReferralCode:g,setIsReferralCode:y,isReferralCodeName:v,setIsReferralCodeName:C,latestPnL:Ye,setLatestPnL:Je,notificationData:_e,setNotificationData:xe,announcementData:Se,setAnnouncementData:ge,handleAnnouncement:Vn,searchTerminalCoin:Ce,setSearchTerminalCoin:je,isSearchTerminalError:Oe,setIsSearchTerminalError:$e,botSlotsInfo:ht,setBotSlotsInfo:rt,refreshBotSlots:st},children:t})};function Gwt({open:t,setOpen:e,setGenModalOpen:n,setGenWalletSuccess:r,setGenWalletData:s,setShowPrivateKey:a}){return i.jsx(i.Fragment,{children:i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-[9999999999] font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[300px] sm:w-[480px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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),dn.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 Kwt=()=>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"})]}),Ba=Ie.memo(Kwt),Ywt=({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(Yr),{address:v}=es(),C=async()=>{const I=window.localStorage.getItem("hyperToken");if(!I){y(!0);return}if(!s){d("Please enter a name.");return}f(!0),d("");const P=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():P,token:I,wallet_name:s})})).json();F.success?(c(F==null?void 0:F.wallet),u(!0),a(""),x(),g(1)):(console.log("An error has occurred. Please try again."),d(F==null?void 0:F.error_message))}catch(M){console.error("An error has occurred:",M.message),d(M==null?void 0:M.message)}finally{f(!1)}},N=()=>{l(I=>!I)};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(Ba,{})}):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:I=>{I.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.address),dn.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:_o,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:I=>{I.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.private_key),dn.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:_o,alt:"",className:"cursor-pointer"}),i.jsx("span",{onClick:()=>{N()},className:"p-1 rounded cursor-pointer",children:r?i.jsx(Rrt,{className:"w-4 h-4"}):i.jsx(Ort,{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:I=>a(I.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:Hl,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:o})]})]})})},Xwt=({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(Yr),{address:v}=es(),C=async()=>{const N=window.localStorage.getItem("hyperToken");if(!N){y(!0);return}if(!n||!d||!x){n?d?x||a("Please enter the agent wallet private key."):a("Please enter the main public address."):a("Please enter a name.");return}l(!0),a("");const I=window.localStorage.getItem("hyperAddress");try{const M=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:v?v.toLowerCase():I,token:N,name:n,connet_wallet_address:d,agent_wallet_pkey:x})})).json();M.success?(e(M==null?void 0:M.wallet),r(""),c(),u(1)):(console.log("An error has occurred. Please try again."),a(M==null?void 0:M.error_message))}catch(P){console.error("An error has occurred:",P.message),a(P==null?void 0:P.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(Ba,{})}):Object.keys(t).length>0?i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4",children:[i.jsx("div",{className:"w-full flex justify-center items-center",children:i.jsx("span",{className:"flex justify-center items-center w-[400px] text-center text-white/60 text-[16px] leading-5 font-medium font-manrope tracking-tight",children:"Please copy the private key below and store it in a secure location. This private key will not be shown again."})}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-4 p-4 text-white",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Label"}),i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none",children:t==null?void 0:t.wallet_name})]}),i.jsx("div",{className:"w-[440px] h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Address"}),i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none",children:t==null?void 0:t.address})})]}),i.jsx("div",{className:"w-[440px] h-px bg-[#353535]"})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2",children:[i.jsx("div",{className:"font-bold text-white",children:"Manually add api & secret key"}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2",children:[i.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"Wallet Name",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"}),i.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Main Public Address",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"}),i.jsx("input",{type:"text",value:x,onChange:N=>g(N.target.value),placeholder:"Agent Wallet Private Key",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"})]}),i.jsxs("button",{onClick:()=>{C()},disabled:o,className:"w-[285px] h-8 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Connect"})]}),s&&i.jsx("p",{className:"mt-2 text-sm text-red-500",children:s})]})})},ZIe="6.15.0";function Qwt(t,e,n){const r=e.split("|").map(a=>a.trim());for(let a=0;a<r.length;a++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function 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 $s(t,e,n){for(let r in e){let s=e[r];const a=n?n[r]:null;a&&Qwt(s,a,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function s4(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=>s4(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 s4(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=>`${s4(r,e)}: ${s4(t[r],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function su(t,e){return t&&t.code===e}function Doe(t){return su(t,"CALL_EXCEPTION")}function Oo(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: ${s4(n)}`);for(const o in n){if(o==="shortMessage")continue;const l=n[o];a.push(o+"="+s4(l))}}a.push(`code=${e}`),a.push(`version=${ZIe}`),a.length&&(t+=" ("+a.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return $s(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&$s(s,{shortMessage:r}),s}function Dr(t,e,n,r){if(!t)throw Oo(e,n,r)}function An(t,e,n,r){Dr(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function JIe(t,e,n){n==null&&(n=""),n&&(n=": "+n),Dr(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Dr(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const Zwt=["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 ePe(t){Dr(Zwt.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function k5(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),Dr(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function tPe(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}An(!1,"invalid BytesLike value",e||"value",t)}function ms(t,e){return tPe(t,e,!1)}function iu(t,e){return tPe(t,e,!0)}function xo(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 P$(t){return xo(t,!0)||t instanceof Uint8Array}const Fxe="0123456789abcdef";function Kr(t){const e=ms(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=Fxe[(s&240)>>4]+Fxe[s&15]}return n}function Da(t){return"0x"+t.map(e=>Kr(e).substring(2)).join("")}function A4(t){return xo(t,!0)?(t.length-2)/2:ms(t).length}function So(t,e,n){const r=ms(t);return n!=null&&n>r.length&&Dr(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),Kr(r.slice(e??0,n??r.length))}function nPe(t,e,n){const r=ms(t);Dr(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),Kr(s)}function g1(t,e){return nPe(t,e,!0)}function Jwt(t,e){return nPe(t,e,!1)}const F$=BigInt(0),fm=BigInt(1),Hee=9007199254740991;function e3t(t,e){const n=O$(t,"value"),r=BigInt($i(e,"width"));if(Dr(n>>r===F$,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-fm){const s=(fm<<r)-fm;return-((~n&s)+fm)}return n}function rPe(t,e){let n=_s(t,"value");const r=BigInt($i(e,"width")),s=fm<<r-fm;if(n<F$){n=-n,Dr(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const a=(fm<<r)-fm;return(~n&a)+fm}else Dr(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function q7(t,e){const n=O$(t,"value"),r=BigInt($i(e,"bits"));return n&(fm<<r)-fm}function _s(t,e){switch(typeof t){case"bigint":return t;case"number":return An(Number.isInteger(t),"underflow",e||"value",t),An(t>=-9007199254740991&&t<=Hee,"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){An(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}An(!1,"invalid BigNumberish value",e||"value",t)}function O$(t,e){const n=_s(t,e);return Dr(n>=F$,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const Oxe="0123456789abcdef";function M$(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=Oxe[n>>4],e+=Oxe[n&15];return BigInt(e)}return _s(t)}function $i(t,e){switch(typeof t){case"bigint":return An(t>=-9007199254740991&&t<=Hee,"overflow",e||"value",t),Number(t);case"number":return An(Number.isInteger(t),"underflow",e||"value",t),An(t>=-9007199254740991&&t<=Hee,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return $i(BigInt(t),e)}catch(n){An(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}An(!1,"invalid numeric value",e||"value",t)}function t3t(t){return $i(M$(t))}function b1(t,e){let r=O$(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=$i(e,"width");for(Dr(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function ul(t){const e=O$(t,"value");if(e===F$)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const a=s*2;r[s]=parseInt(n.substring(a,a+2),16)}return r}function cm(t){let e=Kr(P$(t)?t:ul(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const mR="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let MP=null;function n3t(t){if(MP==null){MP={};for(let n=0;n<mR.length;n++)MP[mR[n]]=BigInt(n)}const e=MP[t];return An(e!=null,"invalid base58 value","letter",t),e}const r3t=BigInt(0),Vee=BigInt(58);function sPe(t){const e=ms(t);let n=M$(e),r="";for(;n;)r=mR[Number(n%Vee)]+r,n/=Vee;for(let s=0;s<e.length&&!e[s];s++)r=mR[0]+r;return r}function s3t(t){let e=r3t;for(let n=0;n<t.length;n++)e*=Vee,e+=n3t(t[n]);return e}function i3t(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ms(e)}function a3t(t){const e=ms(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}var sS;class iPe{constructor(e,n,r){Gn(this,"filter");Gn(this,"emitter");Un(this,sS);Xt(this,sS,n),$s(this,{emitter:e,filter:r})}async removeListener(){Xe(this,sS)!=null&&await this.emitter.off(this.filter,Xe(this,sS))}}sS=new WeakMap;function o3t(t,e,n,r,s){An(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function aPe(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 l3t(t,e,n,r,s){return t==="OVERLONG"?(An(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),aPe(t,e,n))}const c3t=Object.freeze({error:o3t,ignore:aPe,replace:l3t});function u3t(t,e){e==null&&(e=c3t.error);const n=ms(t,"bytes"),r=[];let s=0;for(;s<n.length;){const a=n[s++];if(!(a>>7)){r.push(a);continue}let o=null,l=null;if((a&224)===192)o=1,l=127;else if((a&240)===224)o=2,l=2047;else if((a&248)===240)o=3,l=65535;else{(a&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let c=a&(1<<8-o-1)-1;for(let u=0;u<o;u++){let d=n[s];if((d&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),c=null;break}c=c<<6|d&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,c);continue}if(c<=l){s+=e("OVERLONG",s-1-o,n,r,c);continue}r.push(c)}}return r}function bd(t,e){An(typeof t=="string","invalid string value","str",t),e!=null&&(ePe(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);An(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 d3t(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function xR(t,e){return d3t(u3t(t,e))}function oPe(t){async function e(n,r){Dr(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();Dr(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),Dr(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let a=null;const o=new AbortController,l=setTimeout(()=>{a=Oo("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{a=Oo("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,h3t=250;let Mxe=oPe();const p3t=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),m3t=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let $V=!1;async function lPe(t,e){try{const n=t.match(p3t);if(!n)throw new Error("invalid data");return new By(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?i3t(n[3]):g3t(n[3]))}catch{return new By(599,"BAD REQUEST (invalid data: URI)",{},null,new r2(t))}}function cPe(t){async function e(n,r){try{const s=n.match(m3t);if(!s)throw new Error("invalid link");return new r2(`${t}${s[2]}`)}catch{return new By(599,"BAD REQUEST (invalid IPFS URI)",{},null,new r2(n))}}return e}const RP={data:lPe,ipfs:cPe("https://gateway.ipfs.io/ipfs/")},uPe=new WeakMap;var Dw,ay;class x3t{constructor(e){Un(this,Dw);Un(this,ay);Xt(this,Dw,[]),Xt(this,ay,!1),uPe.set(e,()=>{if(!Xe(this,ay)){Xt(this,ay,!0);for(const n of Xe(this,Dw))setTimeout(()=>{n()},0);Xt(this,Dw,[])}})}addListener(e){Dr(!Xe(this,ay),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),Xe(this,Dw).push(e)}get cancelled(){return Xe(this,ay)}checkSignal(){Dr(!this.cancelled,"cancelled","CANCELLED",{})}}Dw=new WeakMap,ay=new WeakMap;function LP(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var iS,aS,Zp,Ag,oS,lS,jc,zf,_g,Bw,$w,Uw,g0,Jp,oy,zw,G7;const fB=class fB{constructor(e){Un(this,zw);Un(this,iS);Un(this,aS);Un(this,Zp);Un(this,Ag);Un(this,oS);Un(this,lS);Un(this,jc);Un(this,zf);Un(this,_g);Un(this,Bw);Un(this,$w);Un(this,Uw);Un(this,g0);Un(this,Jp);Un(this,oy);Xt(this,lS,String(e)),Xt(this,iS,!1),Xt(this,aS,!0),Xt(this,Zp,{}),Xt(this,Ag,""),Xt(this,oS,3e5),Xt(this,Jp,{slotInterval:h3t,maxAttempts:f3t}),Xt(this,oy,null)}get url(){return Xe(this,lS)}set url(e){Xt(this,lS,String(e))}get body(){return Xe(this,jc)==null?null:new Uint8Array(Xe(this,jc))}set body(e){if(e==null)Xt(this,jc,void 0),Xt(this,zf,void 0);else if(typeof e=="string")Xt(this,jc,bd(e)),Xt(this,zf,"text/plain");else if(e instanceof Uint8Array)Xt(this,jc,e),Xt(this,zf,"application/octet-stream");else if(typeof e=="object")Xt(this,jc,bd(JSON.stringify(e))),Xt(this,zf,"application/json");else throw new Error("invalid body")}hasBody(){return Xe(this,jc)!=null}get method(){return Xe(this,Ag)?Xe(this,Ag):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),Xt(this,Ag,String(e).toUpperCase())}get headers(){const e=Object.assign({},Xe(this,Zp));return Xe(this,_g)&&(e.authorization=`Basic ${a3t(bd(Xe(this,_g)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&Xe(this,zf)&&(e["content-type"]=Xe(this,zf)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){Xe(this,Zp)[String(e).toLowerCase()]=String(n)}clearHeaders(){Xt(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 Xe(this,_g)||null}setCredentials(e,n){An(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),Xt(this,_g,`${e}:${n}`)}get allowGzip(){return Xe(this,aS)}set allowGzip(e){Xt(this,aS,!!e)}get allowInsecureAuthentication(){return!!Xe(this,iS)}set allowInsecureAuthentication(e){Xt(this,iS,!!e)}get timeout(){return Xe(this,oS)}set timeout(e){An(e>=0,"timeout must be non-zero","timeout",e),Xt(this,oS,e)}get preflightFunc(){return Xe(this,Bw)||null}set preflightFunc(e){Xt(this,Bw,e)}get processFunc(){return Xe(this,$w)||null}set processFunc(e){Xt(this,$w,e)}get retryFunc(){return Xe(this,Uw)||null}set retryFunc(e){Xt(this,Uw,e)}get getUrlFunc(){return Xe(this,oy)||Mxe}set getUrlFunc(e){Xt(this,oy,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${Xe(this,jc)?Kr(Xe(this,jc)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(Xe(this,Jp).slotInterval=e.slotInterval),e.maxAttempts!=null&&(Xe(this,Jp).maxAttempts=e.maxAttempts)}send(){return Dr(Xe(this,g0)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),Xt(this,g0,new x3t(this)),Cr(this,zw,G7).call(this,0,Rxe()+this.timeout,0,this,new By(0,"",{},null,this))}cancel(){Dr(Xe(this,g0)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=uPe.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();Dr(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new fB(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,Xt(s,Zp,Object.assign({},Xe(this,Zp))),Xe(this,jc)&&Xt(s,jc,new Uint8Array(Xe(this,jc))),Xt(s,zf,Xe(this,zf)),s}clone(){const e=new fB(this.url);return Xt(e,Ag,Xe(this,Ag)),Xe(this,jc)&&Xt(e,jc,Xe(this,jc)),Xt(e,zf,Xe(this,zf)),Xt(e,Zp,Object.assign({},Xe(this,Zp))),Xt(e,_g,Xe(this,_g)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),Xt(e,Bw,Xe(this,Bw)),Xt(e,$w,Xe(this,$w)),Xt(e,Uw,Xe(this,Uw)),Xt(e,Jp,Object.assign({},Xe(this,Jp))),Xt(e,oy,Xe(this,oy)),e}static lockConfig(){$V=!0}static getGateway(e){return RP[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if($V)throw new Error("gateways locked");RP[e]=n}static registerGetUrl(e){if($V)throw new Error("gateways locked");Mxe=e}static createGetUrlFunc(e){return oPe(e)}static createDataGateway(){return lPe}static createIpfsGatewayFunc(e){return cPe(e)}};iS=new WeakMap,aS=new WeakMap,Zp=new WeakMap,Ag=new WeakMap,oS=new WeakMap,lS=new WeakMap,jc=new WeakMap,zf=new WeakMap,_g=new WeakMap,Bw=new WeakMap,$w=new WeakMap,Uw=new WeakMap,g0=new WeakMap,Jp=new WeakMap,oy=new WeakMap,zw=new WeakSet,G7=async function(e,n,r,s,a){var d,f,x;if(e>=Xe(this,Jp).maxAttempts)return a.makeServerError("exceeded maximum retry limit");Dr(Rxe()<=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 RP){const g=await RP[l](o.url,LP(Xe(s,g0)));if(g instanceof By){let y=g;if(this.processFunc){LP(Xe(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,LP(Xe(s,g0)));let u=new By(c.statusCode,c.statusMessage,c.headers,c.body,s);if(u.statusCode===301||u.statusCode===302){try{const g=u.headers.location||"";return Cr(d=o.redirect(g),zw,G7).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=Xe(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(y=parseInt(g)),Cr(f=o.clone(),zw,G7).call(f,e+1,n,y,s,u)}if(this.processFunc){LP(Xe(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=Xe(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(y=g.stall),Cr(x=o.clone(),zw,G7).call(x,e+1,n,y,s,u)}}return u};let r2=fB;var Dk,Bk,$k,Hf,cS,Hw;const Tfe=class Tfe{constructor(e,n,r,s,a){Un(this,Dk);Un(this,Bk);Un(this,$k);Un(this,Hf);Un(this,cS);Un(this,Hw);Xt(this,Dk,e),Xt(this,Bk,n),Xt(this,$k,Object.keys(r).reduce((o,l)=>(o[l.toLowerCase()]=String(r[l]),o),{})),Xt(this,Hf,s==null?null:new Uint8Array(s)),Xt(this,cS,a||null),Xt(this,Hw,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${Xe(this,Hf)?Kr(Xe(this,Hf)):"null"}>`}get statusCode(){return Xe(this,Dk)}get statusMessage(){return Xe(this,Bk)}get headers(){return Object.assign({},Xe(this,$k))}get body(){return Xe(this,Hf)==null?null:new Uint8Array(Xe(this,Hf))}get bodyText(){try{return Xe(this,Hf)==null?"":xR(Xe(this,Hf))}catch{Dr(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Dr(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new Tfe(599,r,this.headers,this.body,Xe(this,cS)||void 0);return Xt(s,Hw,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:An(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw $s(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return Xe(this,Hf)!=null}get request(){return Xe(this,cS)}ok(){return Xe(this,Hw).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=Xe(this,Hw);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{Xe(this,Hf)&&(s=xR(Xe(this,Hf)))}catch{}Dr(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Dk=new WeakMap,Bk=new WeakMap,$k=new WeakMap,Hf=new WeakMap,cS=new WeakMap,Hw=new WeakMap;let By=Tfe;function Rxe(){return new Date().getTime()}function g3t(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 y3t(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function Lxe(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function Dxe(t,e,n,r){const s=[];for(;n<e+1+r;){const a=dPe(t,n);s.push(a.result),n+=a.consumed,Dr(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function dPe(t,e){Dr(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{Dr(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=Lxe(t,e+1,r);return n(e+1+r+s),Dxe(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),Dxe(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=Lxe(t,e+1,r);n(e+1+r+s);const a=Kr(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:a}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=Kr(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:y3t(t[e])}}function _T(t){const e=ms(t,"data"),n=dPe(e,0);return An(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function Bxe(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function fPe(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(a){r=r.concat(fPe(a))}),r.length<=55)return r.unshift(192+r.length),r;const s=Bxe(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ms(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=Bxe(e.length);return n.unshift(183+n.length),n.concat(e)}const $xe="0123456789abcdef";function y1(t){let e="0x";for(const n of fPe(t))e+=$xe[n>>4],e+=$xe[n&15];return e}function v3t(t){const e=ms(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Kr(e);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const fd=32,Wee=new Uint8Array(fd),w3t=["then"],DP={},hPe=new WeakMap;function ew(t){return hPe.get(t)}function Uxe(t,e){hPe.set(t,e)}function ZA(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function qee(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof gR?qee(ew(r),r,n):r):t.reduce((r,s,a)=>{let o=e.getValue(s);return s in r||(n&&o instanceof gR&&(o=qee(ew(o),o,n)),r[s]=o),r},{})}var uS,Qg;let gR=(Qg=class extends Array{constructor(...n){const r=n[0];let s=n[1],a=(n[2]||[]).slice(),o=!0;r!==DP&&(s=n,a=[],o=!1);super(s.length);Un(this,uS);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(Uxe(this,Object.freeze(s.map((u,d)=>{const f=a[d];return f!=null&&l.get(f)===1?f:null}))),Xt(this,uS,[]),Xe(this,uS)==null&&Xe(this,uS),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(u,d,f)=>{if(typeof d=="string"){if(d.match(/^[0-9]+$/)){const g=$i(d,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const y=u[g];return y instanceof Error&&ZA(`index ${g}`,y),y}if(w3t.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 Uxe(c,ew(this)),c}toArray(n){const r=[];return this.forEach((s,a)=>{s instanceof Error&&ZA(`index ${a}`,s),n&&s instanceof Qg&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=ew(this);return r.reduce((s,a,o)=>(Dr(a!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),qee(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=ew(this),a=[],o=[];for(let l=n;l<r;l++)a.push(this[l]),o.push(s[l]);return new Qg(DP,a,o)}filter(n,r){const s=ew(this),a=[],o=[];for(let l=0;l<this.length;l++){const c=this[l];c instanceof Error&&ZA(`index ${l}`,c),n.call(r,c,l,this)&&(a.push(c),o.push(s[l]))}return new Qg(DP,a,o)}map(n,r){const s=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&ZA(`index ${a}`,o),s.push(n.call(r,o,a,this))}return s}getValue(n){const r=ew(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&ZA(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new Qg(DP,n,r)}},uS=new WeakMap,Qg);function zxe(t){let e=ul(t);return Dr(e.length<=fd,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:fd,offset:e.length}),e.length!==fd&&(e=iu(Da([Wee.slice(e.length%fd),e]))),e}class R1{constructor(e,n,r,s){Gn(this,"name");Gn(this,"type");Gn(this,"localName");Gn(this,"dynamic");$s(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){An(!1,e,this.localName,n)}}var Eg,Vw,dS,WO;class Gee{constructor(){Un(this,dS);Un(this,Eg);Un(this,Vw);Xt(this,Eg,[]),Xt(this,Vw,0)}get data(){return Da(Xe(this,Eg))}get length(){return Xe(this,Vw)}appendWriter(e){return Cr(this,dS,WO).call(this,iu(e.data))}writeBytes(e){let n=iu(e);const r=n.length%fd;return r&&(n=iu(Da([n,Wee.slice(r)]))),Cr(this,dS,WO).call(this,n)}writeValue(e){return Cr(this,dS,WO).call(this,zxe(e))}writeUpdatableValue(){const e=Xe(this,Eg).length;return Xe(this,Eg).push(Wee),Xt(this,Vw,Xe(this,Vw)+fd),n=>{Xe(this,Eg)[e]=zxe(n)}}}Eg=new WeakMap,Vw=new WeakMap,dS=new WeakSet,WO=function(e){return Xe(this,Eg).push(e),Xt(this,Vw,Xe(this,Vw)+e.length),e.length};var Kd,Vf,Ww,qw,ly,w5,Yee,pPe;const Ife=class Ife{constructor(e,n,r){Un(this,w5);Gn(this,"allowLoose");Un(this,Kd);Un(this,Vf);Un(this,Ww);Un(this,qw);Un(this,ly);$s(this,{allowLoose:!!n}),Xt(this,Kd,iu(e)),Xt(this,Ww,0),Xt(this,qw,null),Xt(this,ly,r??1024),Xt(this,Vf,0)}get data(){return Kr(Xe(this,Kd))}get dataLength(){return Xe(this,Kd).length}get consumed(){return Xe(this,Vf)}get bytes(){return new Uint8Array(Xe(this,Kd))}subReader(e){const n=new Ife(Xe(this,Kd).slice(Xe(this,Vf)+e),this.allowLoose,Xe(this,ly));return Xt(n,qw,this),n}readBytes(e,n){let r=Cr(this,w5,pPe).call(this,0,e,!!n);return Cr(this,w5,Yee).call(this,e),Xt(this,Vf,Xe(this,Vf)+r.length),r.slice(0,e)}readValue(){return M$(this.readBytes(fd))}readIndex(){return t3t(this.readBytes(fd))}};Kd=new WeakMap,Vf=new WeakMap,Ww=new WeakMap,qw=new WeakMap,ly=new WeakMap,w5=new WeakSet,Yee=function(e){var n;if(Xe(this,qw))return Cr(n=Xe(this,qw),w5,Yee).call(n,e);Xt(this,Ww,Xe(this,Ww)+e),Dr(Xe(this,ly)<1||Xe(this,Ww)<=Xe(this,ly)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${Xe(this,ly)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:iu(Xe(this,Kd)),offset:Xe(this,Vf),length:e,info:{bytesRead:Xe(this,Ww),dataLength:this.dataLength}})},pPe=function(e,n,r){let s=Math.ceil(n/fd)*fd;return Xe(this,Vf)+s>Xe(this,Kd).length&&(this.allowLoose&&r&&Xe(this,Vf)+n<=Xe(this,Kd).length?s=n:Dr(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:iu(Xe(this,Kd)),length:Xe(this,Kd).length,offset:Xe(this,Vf)+s})),Xe(this,Kd).slice(Xe(this,Vf),Xe(this,Vf)+s)};let Kee=Ife;function Kf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Boe(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 mPe(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 aN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function xPe(t,e){Boe(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const UV=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gPe=t=>t instanceof Uint8Array,qO=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),GO=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),i0=(t,e)=>t<<32-e|t>>>e,C3t=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!C3t)throw new Error("Non little-endian hardware is not supported");const S3t=async()=>{};async function Hxe(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 S3t(),r+=a)}}function N3t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function oN(t){if(typeof t=="string"&&(t=N3t(t)),!gPe(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function j3t(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!gPe(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}let $oe=class{clone(){return this._cloneInto()}};const A3t={}.toString;function bPe(t,e){if(e!==void 0&&A3t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function R$(t){const e=r=>t().update(oN(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function _3t(t=32){if(UV&&typeof UV.getRandomValues=="function")return UV.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let yPe=class extends $oe{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,mPe(e);const r=oN(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<a.length;o++)a[o]^=54;this.iHash.update(a),this.oHash=e.create();for(let o=0;o<a.length;o++)a[o]^=106;this.oHash.update(a),a.fill(0)}update(e){return aN(this),this.iHash.update(e),this}digestInto(e){aN(this),Boe(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 L$=(t,e,n)=>new yPe(t,e).update(n).digest();L$.create=(t,e)=>new yPe(t,e);function E3t(t,e,n,r){mPe(t);const s=bPe({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=oN(e),u=oN(n),d=new Uint8Array(o),f=L$.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function k3t(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function Uoe(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=E3t(t,e,n,r);let u;const d=new Uint8Array(4),f=GO(d),x=new Uint8Array(l.outputLen);for(let g=1,y=0;y<a;g++,y+=l.outputLen){const v=o.subarray(y,y+l.outputLen);f.setInt32(0,g,!1),(u=c._cloneInto(u)).update(d).digestInto(x),v.set(x.subarray(0,v.length));for(let C=1;C<s;C++){l._cloneInto(u).update(x).digestInto(x);for(let N=0;N<v.length;N++)v[N]^=x[N]}}return k3t(l,c,o,u,x)}function T3t(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 zoe extends $oe{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=GO(this.buffer)}update(e){aN(this);const{view:n,buffer:r,blockLen:s}=this;e=oN(e);const a=e.length;for(let o=0;o<a;){const l=Math.min(s-this.pos,a-o);if(l===s){const c=GO(e);for(;s<=a-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){aN(this),xPe(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;T3t(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=GO(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 I3t=(t,e,n)=>t&e^~t&n,P3t=(t,e,n)=>t&e^t&n^e&n,F3t=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 O3t=class extends zoe{constructor(){super(64,32,8,!1),this.A=vb[0]|0,this.B=vb[1]|0,this.C=vb[2]|0,this.D=vb[3]|0,this.E=vb[4]|0,this.F=vb[5]|0,this.G=vb[6]|0,this.H=vb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)wb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=wb[f-15],g=wb[f-2],y=i0(x,7)^i0(x,18)^x>>>3,v=i0(g,17)^i0(g,19)^g>>>10;wb[f]=v+wb[f-7]+y+wb[f-16]|0}let{A:r,B:s,C:a,D:o,E:l,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const x=i0(l,6)^i0(l,11)^i0(l,25),g=d+x+I3t(l,c,u)+F3t[f]+wb[f]|0,v=(i0(r,2)^i0(r,13)^i0(r,22))+P3t(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 i8=R$(()=>new O3t),BP=BigInt(2**32-1),Xee=BigInt(32);function vPe(t,e=!1){return e?{h:Number(t&BP),l:Number(t>>Xee&BP)}:{h:Number(t>>Xee&BP)|0,l:Number(t&BP)|0}}function wPe(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}=vPe(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const M3t=(t,e)=>BigInt(t>>>0)<<Xee|BigInt(e>>>0),R3t=(t,e,n)=>t>>>n,L3t=(t,e,n)=>t<<32-n|e>>>n,D3t=(t,e,n)=>t>>>n|e<<32-n,B3t=(t,e,n)=>t<<32-n|e>>>n,$3t=(t,e,n)=>t<<64-n|e>>>n-32,U3t=(t,e,n)=>t>>>n-32|e<<64-n,z3t=(t,e)=>e,H3t=(t,e)=>t,CPe=(t,e,n)=>t<<n|e>>>32-n,SPe=(t,e,n)=>e<<n|t>>>32-n,NPe=(t,e,n)=>e<<n-32|t>>>64-n,jPe=(t,e,n)=>t<<n-32|e>>>64-n;function V3t(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const W3t=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),q3t=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,G3t=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),K3t=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,Y3t=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),X3t=(t,e,n,r,s,a)=>e+n+r+s+a+(t/2**32|0)|0,Di={fromBig:vPe,split:wPe,toBig:M3t,shrSH:R3t,shrSL:L3t,rotrSH:D3t,rotrSL:B3t,rotrBH:$3t,rotrBL:U3t,rotr32H:z3t,rotr32L:H3t,rotlSH:CPe,rotlSL:SPe,rotlBH:NPe,rotlBL:jPe,add:V3t,add3L:W3t,add3H:q3t,add4L:G3t,add4H:K3t,add5H:X3t,add5L:Y3t},[Q3t,Z3t]=Di.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Cb=new Uint32Array(80),Sb=new Uint32Array(80);class J3t extends zoe{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 P=0;P<16;P++,n+=4)Cb[P]=e.getUint32(n),Sb[P]=e.getUint32(n+=4);for(let P=16;P<80;P++){const M=Cb[P-15]|0,F=Sb[P-15]|0,$=Di.rotrSH(M,F,1)^Di.rotrSH(M,F,8)^Di.shrSH(M,F,7),L=Di.rotrSL(M,F,1)^Di.rotrSL(M,F,8)^Di.shrSL(M,F,7),z=Cb[P-2]|0,Q=Sb[P-2]|0,se=Di.rotrSH(z,Q,19)^Di.rotrBH(z,Q,61)^Di.shrSH(z,Q,6),ee=Di.rotrSL(z,Q,19)^Di.rotrBL(z,Q,61)^Di.shrSL(z,Q,6),K=Di.add4L(L,ee,Sb[P-7],Sb[P-16]),re=Di.add4H(K,$,se,Cb[P-7],Cb[P-16]);Cb[P]=re|0,Sb[P]=K|0}let{Ah:r,Al:s,Bh:a,Bl:o,Ch:l,Cl:c,Dh:u,Dl:d,Eh:f,El:x,Fh:g,Fl:y,Gh:v,Gl:C,Hh:N,Hl:I}=this;for(let P=0;P<80;P++){const M=Di.rotrSH(f,x,14)^Di.rotrSH(f,x,18)^Di.rotrBH(f,x,41),F=Di.rotrSL(f,x,14)^Di.rotrSL(f,x,18)^Di.rotrBL(f,x,41),$=f&g^~f&v,L=x&y^~x&C,z=Di.add5L(I,F,L,Z3t[P],Sb[P]),Q=Di.add5H(z,N,M,$,Q3t[P],Cb[P]),se=z|0,ee=Di.rotrSH(r,s,28)^Di.rotrBH(r,s,34)^Di.rotrBH(r,s,39),K=Di.rotrSL(r,s,28)^Di.rotrBL(r,s,34)^Di.rotrBL(r,s,39),re=r&a^r&l^a&l,de=s&o^s&c^o&c;N=v|0,I=C|0,v=g|0,C=y|0,g=f|0,y=x|0,{h:f,l:x}=Di.add(u|0,d|0,Q|0,se|0),u=l|0,d=c|0,l=a|0,c=o|0,a=r|0,o=s|0;const G=Di.add3L(se,K,de);r=Di.add3H(G,Q,ee,re),s=G|0}({h:r,l:s}=Di.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:a,l:o}=Di.add(this.Bh|0,this.Bl|0,a|0,o|0),{h:l,l:c}=Di.add(this.Ch|0,this.Cl|0,l|0,c|0),{h:u,l:d}=Di.add(this.Dh|0,this.Dl|0,u|0,d|0),{h:f,l:x}=Di.add(this.Eh|0,this.El|0,f|0,x|0),{h:g,l:y}=Di.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:v,l:C}=Di.add(this.Gh|0,this.Gl|0,v|0,C|0),{h:N,l:I}=Di.add(this.Hh|0,this.Hl|0,N|0,I|0),this.set(r,s,a,o,l,c,u,d,f,x,g,y,v,C,N,I)}roundClean(){Cb.fill(0),Sb.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Hoe=R$(()=>new J3t);function e5t(){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 Vxe=e5t(),Wxe=Vxe.crypto||Vxe.msCrypto;function t5t(t){switch(t){case"sha256":return i8.create();case"sha512":return Hoe.create()}An(!1,"invalid hashing algorithm name","algorithm",t)}function n5t(t,e){const n={sha256:i8,sha512:Hoe}[t];return An(n!=null,"invalid hmac algorithm","algorithm",t),L$.create(n,e)}function r5t(t,e,n,r,s){const a={sha256:i8,sha512:Hoe}[s];return An(a!=null,"invalid pbkdf2 algorithm","algorithm",s),Uoe(a,t,e,{c:n,dkLen:r})}function s5t(t){Dr(Wxe!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),An(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return Wxe.getRandomValues(e),e}let APe=!1;const _Pe=function(t,e,n){return n5t(t,e).update(n).digest()};let EPe=_Pe;function a8(t,e,n){const r=ms(e,"key"),s=ms(n,"data");return Kr(EPe(t,r,s))}a8._=_Pe;a8.lock=function(){APe=!0};a8.register=function(t){if(APe)throw new Error("computeHmac is locked");EPe=t};Object.freeze(a8);const[kPe,TPe,IPe]=[[],[],[]],i5t=BigInt(0),JA=BigInt(1),a5t=BigInt(2),o5t=BigInt(7),l5t=BigInt(256),c5t=BigInt(113);for(let t=0,e=JA,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],kPe.push(2*(5*r+n)),TPe.push((t+1)*(t+2)/2%64);let s=i5t;for(let a=0;a<7;a++)e=(e<<JA^(e>>o5t)*c5t)%l5t,e&a5t&&(s^=JA<<(JA<<BigInt(a))-JA);IPe.push(s)}const[u5t,d5t]=wPe(IPe,!0),qxe=(t,e,n)=>n>32?NPe(t,e,n):CPe(t,e,n),Gxe=(t,e,n)=>n>32?jPe(t,e,n):SPe(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=qxe(u,d,1)^n[l],x=Gxe(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=TPe[o],c=qxe(s,a,l),u=Gxe(s,a,l),d=kPe[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]^=u5t[r],t[1]^=d5t[r]}n.fill(0)}let h5t=class PPe extends $oe{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=qO(this.state)}keccak(){f5t(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){aN(this);const{blockLen:n,state:r}=this;e=oN(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){aN(this,!1),Boe(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(xPe(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 PPe(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 p5t=(t,e,n)=>R$(()=>new h5t(e,t,n)),m5t=p5t(1,136,256/8);let FPe=!1;const OPe=function(t){return m5t(t)};let MPe=OPe;function mo(t){const e=ms(t,"data");return Kr(MPe(e))}mo._=OPe;mo.lock=function(){FPe=!0};mo.register=function(t){if(FPe)throw new TypeError("keccak256 is locked");MPe=t};Object.freeze(mo);const x5t=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),RPe=Uint8Array.from({length:16},(t,e)=>e),g5t=RPe.map(t=>(9*t+5)%16);let Voe=[RPe],Woe=[g5t];for(let t=0;t<4;t++)for(let e of[Voe,Woe])e.push(e[t].map(n=>x5t[n]));const LPe=[[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=Voe.map((t,e)=>t.map(n=>LPe[e][n])),y5t=Woe.map((t,e)=>t.map(n=>LPe[e][n])),v5t=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),w5t=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),$P=(t,e)=>t<<e|t>>>32-e;function Kxe(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 UP=new Uint32Array(16);class C5t extends zoe{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)UP[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=v5t[g],C=w5t[g],N=Voe[g],I=Woe[g],P=b5t[g],M=y5t[g];for(let F=0;F<16;F++){const $=$P(r+Kxe(g,a,l,u)+UP[N[F]]+v,P[F])+f|0;r=f,f=u,u=$P(l,10)|0,l=a,a=$}for(let F=0;F<16;F++){const $=$P(s+Kxe(y,o,c,d)+UP[I[F]]+C,M[F])+x|0;s=x,x=d,d=$P(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(){UP.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const S5t=R$(()=>new C5t);let DPe=!1;const BPe=function(t){return S5t(t)};let $Pe=BPe;function o8(t){const e=ms(t,"data");return Kr($Pe(e))}o8._=BPe;o8.lock=function(){DPe=!0};o8.register=function(t){if(DPe)throw new TypeError("ripemd160 is locked");$Pe=t};Object.freeze(o8);let UPe=!1;const zPe=function(t,e,n,r,s){return r5t(t,e,n,r,s)};let HPe=zPe;function N2(t,e,n,r,s){const a=ms(t,"password"),o=ms(e,"salt");return Kr(HPe(a,o,n,r,s))}N2._=zPe;N2.lock=function(){UPe=!0};N2.register=function(t){if(UPe)throw new Error("pbkdf2 is locked");HPe=t};Object.freeze(N2);let VPe=!1;const WPe=function(t){return new Uint8Array(s5t(t))};let qPe=WPe;function n1(t){return qPe(t)}n1._=WPe;n1.lock=function(){VPe=!0};n1.register=function(t){if(VPe)throw new Error("randomBytes is locked");qPe=t};Object.freeze(n1);const ga=(t,e)=>t<<e|t>>>32-e;function Yxe(t,e,n,r,s,a){let o=t[e++]^n[r++],l=t[e++]^n[r++],c=t[e++]^n[r++],u=t[e++]^n[r++],d=t[e++]^n[r++],f=t[e++]^n[r++],x=t[e++]^n[r++],g=t[e++]^n[r++],y=t[e++]^n[r++],v=t[e++]^n[r++],C=t[e++]^n[r++],N=t[e++]^n[r++],I=t[e++]^n[r++],P=t[e++]^n[r++],M=t[e++]^n[r++],F=t[e++]^n[r++],$=o,L=l,z=c,Q=u,se=d,ee=f,K=x,re=g,de=y,G=v,ie=C,ae=N,q=I,W=P,ne=M,oe=F;for(let he=0;he<8;he+=2)se^=ga($+q|0,7),de^=ga(se+$|0,9),q^=ga(de+se|0,13),$^=ga(q+de|0,18),G^=ga(ee+L|0,7),W^=ga(G+ee|0,9),L^=ga(W+G|0,13),ee^=ga(L+W|0,18),ne^=ga(ie+K|0,7),z^=ga(ne+ie|0,9),K^=ga(z+ne|0,13),ie^=ga(K+z|0,18),Q^=ga(oe+ae|0,7),re^=ga(Q+oe|0,9),ae^=ga(re+Q|0,13),oe^=ga(ae+re|0,18),L^=ga($+Q|0,7),z^=ga(L+$|0,9),Q^=ga(z+L|0,13),$^=ga(Q+z|0,18),K^=ga(ee+se|0,7),re^=ga(K+ee|0,9),se^=ga(re+K|0,13),ee^=ga(se+re|0,18),ae^=ga(ie+G|0,7),de^=ga(ae+ie|0,9),G^=ga(de+ae|0,13),ie^=ga(G+de|0,18),q^=ga(oe+ne|0,7),W^=ga(q+oe|0,9),ne^=ga(W+q|0,13),oe^=ga(ne+W|0,18);s[a++]=o+$|0,s[a++]=l+L|0,s[a++]=c+z|0,s[a++]=u+Q|0,s[a++]=d+se|0,s[a++]=f+ee|0,s[a++]=x+K|0,s[a++]=g+re|0,s[a++]=y+de|0,s[a++]=v+G|0,s[a++]=C+ie|0,s[a++]=N+ae|0,s[a++]=I+q|0,s[a++]=P+W|0,s[a++]=M+ne|0,s[a++]=F+oe|0}function _4(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)Yxe(n,o,t,e,n,a),l>0&&(o+=16),Yxe(n,a,t,e+=16,n,o)}function GPe(t,e,n){const r=bPe({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=Uoe(i8,t,e,{c:1,dkLen:f*o}),v=qO(y),C=qO(new Uint8Array(f*s)),N=qO(new Uint8Array(f));let I=()=>{};if(d){const P=2*s*o,M=Math.max(Math.floor(P/1e4),1);let F=0;I=()=>{F++,d&&(!(F%M)||F===P)&&d(F/P)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:N,blockMixCb:I,asyncTick:c}}function KPe(t,e,n,r,s){const a=Uoe(i8,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),s.fill(0),a}function N5t(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x}=GPe(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++)_4(c,C,c,C+=l,s),x();_4(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let N=0;N<l;N++)f[N]=u[y+N]^c[C*l+N];_4(f,0,u,y,s),x()}}return KPe(t,o,d,c,f)}async function j5t(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}=GPe(t,e,n);for(let y=0;y<a;y++){const v=l*y;for(let N=0;N<l;N++)c[N]=u[v+N];let C=0;await Hxe(r-1,g,()=>{_4(c,C,c,C+=l,s),x()}),_4(c,(r-1)*l,u,v,s),x(),await Hxe(r,g,()=>{const N=u[v+l-16]%r;for(let I=0;I<l;I++)f[I]=u[v+I]^c[N*l+I];_4(f,0,u,v,s),x()})}return KPe(t,o,d,c,f)}let YPe=!1,XPe=!1;const QPe=async function(t,e,n,r,s,a,o){return await j5t(t,e,{N:n,r,p:s,dkLen:a,onProgress:o})},ZPe=function(t,e,n,r,s,a){return N5t(t,e,{N:n,r,p:s,dkLen:a})};let JPe=QPe,eFe=ZPe;async function l8(t,e,n,r,s,a,o){const l=ms(t,"passwd"),c=ms(e,"salt");return Kr(await JPe(l,c,n,r,s,a,o))}l8._=QPe;l8.lock=function(){XPe=!0};l8.register=function(t){if(XPe)throw new Error("scrypt is locked");JPe=t};Object.freeze(l8);function c8(t,e,n,r,s,a){const o=ms(t,"passwd"),l=ms(e,"salt");return Kr(eFe(o,l,n,r,s,a))}c8._=ZPe;c8.lock=function(){YPe=!0};c8.register=function(t){if(YPe)throw new Error("scryptSync is locked");eFe=t};Object.freeze(c8);const tFe=function(t){return t5t("sha256").update(t).digest()};let nFe=tFe,rFe=!1;function xp(t){const e=ms(t,"data");return Kr(nFe(e))}xp._=tFe;xp.lock=function(){rFe=!0};xp.register=function(t){if(rFe)throw new Error("sha256 is locked");nFe=t};Object.freeze(xp);Object.freeze(xp);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sFe=BigInt(0),D$=BigInt(1),A5t=BigInt(2),B$=t=>t instanceof Uint8Array,_5t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function lN(t){if(!B$(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=_5t[t[n]];return e}function iFe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function qoe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function cN(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,a=t.slice(s,s+2),o=Number.parseInt(a,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function m3(t){return qoe(lN(t))}function Goe(t){if(!B$(t))throw new Error("Uint8Array expected");return qoe(lN(Uint8Array.from(t).reverse()))}function uN(t,e){return cN(t.toString(16).padStart(e*2,"0"))}function Koe(t,e){return uN(t,e).reverse()}function E5t(t){return cN(iFe(t))}function Kp(t,e,n){let r;if(typeof e=="string")try{r=cN(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(B$(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 G_(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!B$(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function k5t(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 T5t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function I5t(t){let e;for(e=0;t>sFe;t>>=D$,e+=1);return e}function P5t(t,e){return t>>BigInt(e)&D$}const F5t=(t,e,n)=>t|(n?D$:sFe)<<BigInt(e),Yoe=t=>(A5t<<BigInt(t-1))-D$,zV=t=>new Uint8Array(t),Xxe=t=>Uint8Array.from(t);function aFe(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=zV(t),s=zV(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=zV())=>{s=l(Xxe([0]),f),r=l(),f.length!==0&&(s=l(Xxe([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 G_(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const O5t={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 ET(t,e,n={}){const r=(s,a,o)=>{const l=O5t[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 M5t=Object.freeze(Object.defineProperty({__proto__:null,bitGet:P5t,bitLen:I5t,bitMask:Yoe,bitSet:F5t,bytesToHex:lN,bytesToNumberBE:m3,bytesToNumberLE:Goe,concatBytes:G_,createHmacDrbg:aFe,ensureBytes:Kp,equalBytes:k5t,hexToBytes:cN,hexToNumber:qoe,numberToBytesBE:uN,numberToBytesLE:Koe,numberToHexUnpadded:iFe,numberToVarBytesBE:E5t,utf8ToBytes:T5t,validateObject:ET},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fc=BigInt(0),Nl=BigInt(1),tw=BigInt(2),R5t=BigInt(3),Qee=BigInt(4),Qxe=BigInt(5),Zxe=BigInt(8);BigInt(9);BigInt(16);function Qd(t,e){const n=t%e;return n>=Fc?n:e+n}function L5t(t,e,n){if(n<=Fc||e<Fc)throw new Error("Expected power/modulo > 0");if(n===Nl)return Fc;let r=Nl;for(;e>Fc;)e&Nl&&(r=r*t%n),t=t*t%n,e>>=Nl;return r}function Ah(t,e,n){let r=t;for(;e-- >Fc;)r*=r,r%=n;return r}function Zee(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=Nl;for(;n!==Fc;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==Nl)throw new Error("invert: does not exist");return Qd(s,e)}function D5t(t){const e=(t-Nl)/tw;let n,r,s;for(n=t-Nl,r=0;n%tw===Fc;n/=tw,r++);for(s=tw;s<t&&L5t(s,e,t)!==t-Nl;s++);if(r===1){const o=(t+Nl)/Qee;return function(c,u){const d=c.pow(u,o);if(!c.eql(c.sqr(d),u))throw new Error("Cannot find square root");return d}}const a=(n+Nl)/tw;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,Nl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function B5t(t){if(t%Qee===R5t){const e=(t+Nl)/Qee;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%Zxe===Qxe){const e=(t-Qxe)/Zxe;return function(r,s){const a=r.mul(s,tw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,tw),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return D5t(t)}const $5t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function U5t(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=$5t.reduce((r,s)=>(r[s]="function",r),e);return ET(t,n)}function z5t(t,e,n){if(n<Fc)throw new Error("Expected power > 0");if(n===Fc)return t.ONE;if(n===Nl)return e;let r=t.ONE,s=e;for(;n>Fc;)n&Nl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Nl;return r}function H5t(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 oFe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function V5t(t,e,n=!1,r={}){if(t<=Fc)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=oFe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=B5t(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:Yoe(s),ZERO:Fc,ONE:Nl,create:c=>Qd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Fc<=c&&c<t},is0:c=>c===Fc,isOdd:c=>(c&Nl)===Nl,neg:c=>Qd(-c,t),eql:(c,u)=>c===u,sqr:c=>Qd(c*c,t),add:(c,u)=>Qd(c+u,t),sub:(c,u)=>Qd(c-u,t),mul:(c,u)=>Qd(c*u,t),pow:(c,u)=>z5t(l,c,u),div:(c,u)=>Qd(c*Zee(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Zee(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>H5t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?Koe(c,a):uN(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?Goe(c):m3(c)}});return Object.freeze(l)}function lFe(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 cFe(t){const e=lFe(t);return e+Math.ceil(e/2)}function W5t(t,e,n=!1){const r=t.length,s=lFe(e),a=cFe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?m3(t):Goe(t),l=Qd(o,e-Nl)+Nl;return n?Koe(l,s):uN(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const q5t=BigInt(0),HV=BigInt(1);function G5t(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>q5t;)a&HV&&(o=o.add(l)),l=l.double(),a>>=HV;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+=HV);const N=v,I=v+Math.abs(C)-1,P=y%2!==0,M=C<0;C===0?d=d.add(n(P,a[N])):u=u.add(n(M,a[I]))}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 uFe(t){return U5t(t.Fp),ET(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oFe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function K5t(t){const e=uFe(t);ET(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:Y5t,hexToBytes:X5t}=M5t,fw={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=fw;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Y5t(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=fw,n=typeof t=="string"?X5t(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:a}=fw._parseInt(n.subarray(2)),{d:o,l}=fw._parseInt(a);if(l.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const d=u.toString(16);return d.length&1?`0${d}`:d},r=e(n(t.s)),s=e(n(t.r)),a=r.length/2,o=s.length/2,l=n(a),c=n(o);return`30${n(o+a+4)}02${c}${s}02${l}${r}`}},Dg=BigInt(0),Zh=BigInt(1);BigInt(2);const Jxe=BigInt(3);BigInt(4);function Q5t(t){const e=K5t(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const N=v.toAffine();return G_(Uint8Array.from([4]),n.toBytes(N.x),n.toBytes(N.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),N=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:N}});function a(y){const{a:v,b:C}=e,N=n.sqr(y),I=n.mul(N,y);return n.add(n.add(I,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"&&Dg<y&&y<e.n}function l(y){if(!o(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(y){const{allowedPrivateKeyLengths:v,nByteLength:C,wrapPrivateKey:N,n:I}=e;if(v&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=lN(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let P;try{P=typeof y=="bigint"?y:m3(Kp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return N&&(P=Qd(P,I)),l(P),P}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,N){if(this.px=v,this.py=C,this.pz=N,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(N==null||!n.isValid(N))throw new Error("z required")}static fromAffine(v){const{x:C,y:N}=v||{};if(!v||!n.isValid(C)||!n.isValid(N))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const I=P=>n.eql(P,n.ZERO);return I(C)&&I(N)?f.ZERO:new f(C,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(N=>N.pz));return v.map((N,I)=>N.toAffine(C[I])).map(f.fromAffine)}static fromHex(v){const C=f.fromAffine(s(Kp("pointHex",v)));return C.assertValidity(),C}static fromPrivateKey(v){return f.BASE.multiply(c(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:C}=this.toAffine();if(!n.isValid(v)||!n.isValid(C))throw new Error("bad point: x or y not FE");const N=n.sqr(C),I=a(v);if(!n.eql(N,I))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(n.isOdd)return!n.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){d(v);const{px:C,py:N,pz:I}=this,{px:P,py:M,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(P,I)),L=n.eql(n.mul(N,F),n.mul(M,I));return $&&L}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,N=n.mul(C,Jxe),{px:I,py:P,pz:M}=this;let F=n.ZERO,$=n.ZERO,L=n.ZERO,z=n.mul(I,I),Q=n.mul(P,P),se=n.mul(M,M),ee=n.mul(I,P);return ee=n.add(ee,ee),L=n.mul(I,M),L=n.add(L,L),F=n.mul(v,L),$=n.mul(N,se),$=n.add(F,$),F=n.sub(Q,$),$=n.add(Q,$),$=n.mul(F,$),F=n.mul(ee,F),L=n.mul(N,L),se=n.mul(v,se),ee=n.sub(z,se),ee=n.mul(v,ee),ee=n.add(ee,L),L=n.add(z,z),z=n.add(L,z),z=n.add(z,se),z=n.mul(z,ee),$=n.add($,z),se=n.mul(P,M),se=n.add(se,se),z=n.mul(se,ee),F=n.sub(F,z),L=n.mul(se,Q),L=n.add(L,L),L=n.add(L,L),new f(F,$,L)}add(v){d(v);const{px:C,py:N,pz:I}=this,{px:P,py:M,pz:F}=v;let $=n.ZERO,L=n.ZERO,z=n.ZERO;const Q=e.a,se=n.mul(e.b,Jxe);let ee=n.mul(C,P),K=n.mul(N,M),re=n.mul(I,F),de=n.add(C,N),G=n.add(P,M);de=n.mul(de,G),G=n.add(ee,K),de=n.sub(de,G),G=n.add(C,I);let ie=n.add(P,F);return G=n.mul(G,ie),ie=n.add(ee,re),G=n.sub(G,ie),ie=n.add(N,I),$=n.add(M,F),ie=n.mul(ie,$),$=n.add(K,re),ie=n.sub(ie,$),z=n.mul(Q,G),$=n.mul(se,re),z=n.add($,z),$=n.sub(K,z),z=n.add(K,z),L=n.mul($,z),K=n.add(ee,ee),K=n.add(K,ee),re=n.mul(Q,re),G=n.mul(se,G),K=n.add(K,re),re=n.sub(ee,re),re=n.mul(Q,re),G=n.add(G,re),ee=n.mul(K,G),L=n.add(L,ee),ee=n.mul(ie,G),$=n.mul(de,$),$=n.sub($,ee),ee=n.mul(de,K),z=n.mul(ie,z),z=n.add(z,ee),new f($,L,z)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const N=n.invertBatch(C.map(I=>I.pz));return C.map((I,P)=>I.toAffine(N[P])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===Dg)return C;if(l(v),v===Zh)return this;const{endo:N}=e;if(!N)return g.unsafeLadder(this,v);let{k1neg:I,k1:P,k2neg:M,k2:F}=N.splitScalar(v),$=C,L=C,z=this;for(;P>Dg||F>Dg;)P&Zh&&($=$.add(z)),F&Zh&&(L=L.add(z)),z=z.double(),P>>=Zh,F>>=Zh;return I&&($=$.negate()),M&&(L=L.negate()),L=new f(n.mul(L.px,N.beta),L.py,L.pz),$.add(L)}multiply(v){l(v);let C=v,N,I;const{endo:P}=e;if(P){const{k1neg:M,k1:F,k2neg:$,k2:L}=P.splitScalar(C);let{p:z,f:Q}=this.wNAF(F),{p:se,f:ee}=this.wNAF(L);z=g.constTimeNegate(M,z),se=g.constTimeNegate($,se),se=new f(n.mul(se.px,P.beta),se.py,se.pz),N=z.add(se),I=Q.add(ee)}else{const{p:M,f:F}=this.wNAF(C);N=M,I=F}return f.normalizeZ([N,I])[0]}multiplyAndAddUnsafe(v,C,N){const I=f.BASE,P=(F,$)=>$===Dg||$===Zh||!F.equals(I)?F.multiplyUnsafe($):F.multiply($),M=P(this,C).add(P(v,N));return M.is0()?void 0:M}toAffine(v){const{px:C,py:N,pz:I}=this,P=this.is0();v==null&&(v=P?n.ONE:n.inv(I));const M=n.mul(C,v),F=n.mul(N,v),$=n.mul(I,v);if(P)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:M,y:F}}isTorsionFree(){const{h:v,isTorsionFree:C}=e;if(v===Zh)return!0;if(C)return C(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:C}=e;return v===Zh?this:C?C(f,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),r(f,this,v)}toHex(v=!0){return lN(this.toRawBytes(v))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const x=e.nBitLength,g=G5t(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function Z5t(t){const e=uFe(t);return ET(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function J5t(t){const e=Z5t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(G){return Dg<G&&G<n.ORDER}function l(G){return Qd(G,r)}function c(G){return Zee(G,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=Q5t({...e,toBytes(G,ie,ae){const q=ie.toAffine(),W=n.toBytes(q.x),ne=G_;return ae?ne(Uint8Array.from([ie.hasEvenY()?2:3]),W):ne(Uint8Array.from([4]),W,n.toBytes(q.y))},fromBytes(G){const ie=G.length,ae=G[0],q=G.subarray(1);if(ie===s&&(ae===2||ae===3)){const W=m3(q);if(!o(W))throw new Error("Point is not on curve");const ne=f(W);let oe=n.sqrt(ne);const he=(oe&Zh)===Zh;return(ae&1)===1!==he&&(oe=n.neg(oe)),{x:W,y:oe}}else if(ie===a&&ae===4){const W=n.fromBytes(q.subarray(0,n.BYTES)),ne=n.fromBytes(q.subarray(n.BYTES,2*n.BYTES));return{x:W,y:ne}}else throw new Error(`Point of length ${ie} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=G=>lN(uN(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,ae)=>m3(G.slice(ie,ae));class N{constructor(ie,ae,q){this.r=ie,this.s=ae,this.recovery=q,this.assertValidity()}static fromCompact(ie){const ae=e.nByteLength;return ie=Kp("compactSignature",ie,ae*2),new N(C(ie,0,ae),C(ie,ae,2*ae))}static fromDER(ie){const{r:ae,s:q}=fw.toSig(Kp("DER",ie));return new N(ae,q)}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 N(this.r,this.s,ie)}recoverPublicKey(ie){const{r:ae,s:q,recovery:W}=this,ne=L(Kp("msgHash",ie));if(W==null||![0,1,2,3].includes(W))throw new Error("recovery id invalid");const oe=W===2||W===3?ae+e.n:ae;if(oe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const he=W&1?"03":"02",_e=u.fromHex(he+g(oe)),xe=c(oe),Se=l(-ne*xe),ge=l(q*xe),Ce=u.BASE.multiplyAndAddUnsafe(_e,Se,ge);if(!Ce)throw new Error("point at infinify");return Ce.assertValidity(),Ce}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return cN(this.toDERHex())}toDERHex(){return fw.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return cN(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const I={isValidPrivateKey(G){try{return d(G),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const G=cFe(e.n);return W5t(e.randomBytes(G),e.n)},precompute(G=8,ie=u.BASE){return ie._setWindowSize(G),ie.multiply(BigInt(3)),ie}};function P(G,ie=!0){return u.fromPrivateKey(G).toRawBytes(ie)}function M(G){const ie=G instanceof Uint8Array,ae=typeof G=="string",q=(ie||ae)&&G.length;return ie?q===s||q===a:ae?q===2*s||q===2*a:G instanceof u}function F(G,ie,ae=!0){if(M(G))throw new Error("first arg must be private key");if(!M(ie))throw new Error("second arg must be public key");return u.fromHex(ie).multiply(d(G)).toRawBytes(ae)}const $=e.bits2int||function(G){const ie=m3(G),ae=G.length*8-e.nBitLength;return ae>0?ie>>BigInt(ae):ie},L=e.bits2int_modN||function(G){return l($(G))},z=Yoe(e.nBitLength);function Q(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(Dg<=G&&G<z))throw new Error(`bigint expected < 2^${e.nBitLength}`);return uN(G,e.nByteLength)}function se(G,ie,ae=ee){if(["recovered","canonical"].some(Oe=>Oe in ae))throw new Error("sign() legacy options not supported");const{hash:q,randomBytes:W}=e;let{lowS:ne,prehash:oe,extraEntropy:he}=ae;ne==null&&(ne=!0),G=Kp("msgHash",G),oe&&(G=Kp("prehashed msgHash",q(G)));const _e=L(G),xe=d(ie),Se=[Q(xe),Q(_e)];if(he!=null){const Oe=he===!0?W(n.BYTES):he;Se.push(Kp("extraEntropy",Oe))}const ge=G_(...Se),Ce=_e;function je(Oe){const $e=$(Oe);if(!x($e))return;const Ye=c($e),Je=u.BASE.multiply($e).toAffine(),ht=l(Je.x);if(ht===Dg)return;const rt=l(Ye*l(Ce+ht*xe));if(rt===Dg)return;let st=(Je.x===ht?0:2)|Number(Je.y&Zh),He=rt;return ne&&y(rt)&&(He=v(rt),st^=1),new N(ht,He,st)}return{seed:ge,k2sig:je}}const ee={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function re(G,ie,ae=ee){const{seed:q,k2sig:W}=se(G,ie,ae),ne=e;return aFe(ne.hash.outputLen,ne.nByteLength,ne.hmac)(q,W)}u.BASE._setWindowSize(8);function de(G,ie,ae,q=K){var Je;const W=G;if(ie=Kp("msgHash",ie),ae=Kp("publicKey",ae),"strict"in q)throw new Error("options.strict was renamed to lowS");const{lowS:ne,prehash:oe}=q;let he,_e;try{if(typeof W=="string"||W instanceof Uint8Array)try{he=N.fromDER(W)}catch(ht){if(!(ht instanceof fw.Err))throw ht;he=N.fromCompact(W)}else if(typeof W=="object"&&typeof W.r=="bigint"&&typeof W.s=="bigint"){const{r:ht,s:rt}=W;he=new N(ht,rt)}else throw new Error("PARSE");_e=u.fromHex(ae)}catch(ht){if(ht.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ne&&he.hasHighS())return!1;oe&&(ie=e.hash(ie));const{r:xe,s:Se}=he,ge=L(ie),Ce=c(Se),je=l(ge*Ce),Oe=l(xe*Ce),$e=(Je=u.BASE.multiplyAndAddUnsafe(_e,je,Oe))==null?void 0:Je.toAffine();return $e?l($e.x)===xe:!1}return{CURVE:e,getPublicKey:P,getSharedSecret:F,sign:re,verify:de,ProjectivePoint:u,Signature:N,utils:I}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function e6t(t){return{hash:t,hmac:(e,...n)=>L$(t,e,j3t(...n)),randomBytes:_3t}}function t6t(t,e){const n=r=>J5t({...t,...e6t(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const dFe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ege=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),n6t=BigInt(1),Jee=BigInt(2),tge=(t,e)=>(t+e/Jee)/e;function r6t(t){const e=dFe,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,Jee,e)*u%e,y=Ah(g,s,e)*g%e,v=Ah(y,a,e)*y%e,C=Ah(v,l,e)*v%e,N=Ah(C,c,e)*C%e,I=Ah(N,l,e)*v%e,P=Ah(I,n,e)*d%e,M=Ah(P,o,e)*y%e,F=Ah(M,r,e)*u%e,$=Ah(F,Jee,e);if(!ete.eql(ete.sqr($),t))throw new Error("Cannot find square root");return $}const ete=V5t(dFe,void 0,void 0,{sqrt:r6t}),Db=t6t({a:BigInt(0),b:BigInt(7),Fp:ete,n:ege,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=ege,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-n6t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=tge(a*t,e),c=tge(-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}}}},i8);BigInt(0);Db.ProjectivePoint;const K_="0x0000000000000000000000000000000000000000",nge="0x0000000000000000000000000000000000000000000000000000000000000000",s6t=`Ethereum Signed Message:
`,rge=BigInt(0),sge=BigInt(1),ige=BigInt(2),age=BigInt(27),oge=BigInt(28),zP=BigInt(35),aC={};function lge(t){return g1(ul(t),32)}var fS,b0,hS,Gw;const Wp=class Wp{constructor(e,n,r,s){Un(this,fS);Un(this,b0);Un(this,hS);Un(this,Gw);k5(e,aC,"Signature"),Xt(this,fS,n),Xt(this,b0,r),Xt(this,hS,s),Xt(this,Gw,null)}get r(){return Xe(this,fS)}set r(e){An(A4(e)===32,"invalid r","value",e),Xt(this,fS,Kr(e))}get s(){return An(parseInt(Xe(this,b0).substring(0,3))<8,"non-canonical s; use ._s","s",Xe(this,b0)),Xe(this,b0)}set s(e){An(A4(e)===32,"invalid s","value",e),Xt(this,b0,Kr(e))}get _s(){return Xe(this,b0)}isValid(){return parseInt(Xe(this,b0).substring(0,3))<8}get v(){return Xe(this,hS)}set v(e){const n=$i(e,"value");An(n===27||n===28,"invalid v","v",e),Xt(this,hS,n)}get networkV(){return Xe(this,Gw)}get legacyChainId(){const e=this.networkV;return e==null?null:Wp.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ms(this.s);return this.yParity&&(e[0]|=128),Kr(e)}get compactSerialized(){return Da([this.r,this.yParityAndS])}get serialized(){return Da([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Wp(aC,this.r,this._s,this.v);return this.networkV&&Xt(e,Gw,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(e){const n=_s(e,"v");return n==age||n==oge?rge:(An(n>=zP,"invalid EIP-155 v","v",e),(n-zP)/ige)}static getChainIdV(e,n){return _s(e)*ige+BigInt(35+n-27)}static getNormalizedV(e){const n=_s(e);return n===rge||n===age?27:n===sge||n===oge?28:(An(n>=zP,"invalid v","v",e),n&sge?27:28)}static from(e){function n(u,d){An(u,d,"signature",e)}if(e==null)return new Wp(aC,nge,nge,27);if(typeof e=="string"){const u=ms(e,"signature");if(u.length===64){const d=Kr(u.slice(0,32)),f=u.slice(32,64),x=f[0]&128?28:27;return f[0]&=127,new Wp(aC,d,Kr(f),x)}if(u.length===65){const d=Kr(u.slice(0,32)),f=Kr(u.slice(32,64)),x=Wp.getNormalizedV(u[64]);return new Wp(aC,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=lge(r),a=function(u,d){if(u!=null)return lge(u);if(d!=null){n(xo(d,32),"invalid yParityAndS");const f=ms(d);return f[0]&=127,Kr(f)}n(!1,"missing s")}(e.s,e.yParityAndS),{networkV:o,v:l}=function(u,d,f){if(u!=null){const x=_s(u);return{networkV:x>=zP?x:void 0,v:Wp.getNormalizedV(x)}}if(d!=null)return n(xo(d,32),"invalid yParityAndS"),{v:ms(d)[0]&128?28:27};if(f!=null){switch($i(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Wp(aC,s,a,l);return o&&Xt(c,Gw,o),n(e.yParity==null||$i(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};fS=new WeakMap,b0=new WeakMap,hS=new WeakMap,Gw=new WeakMap;let lu=Wp;var kg;const rw=class rw{constructor(e){Un(this,kg);An(A4(e)===32,"invalid private key","privateKey","[REDACTED]"),Xt(this,kg,Kr(e))}get privateKey(){return Xe(this,kg)}get publicKey(){return rw.computePublicKey(Xe(this,kg))}get compressedPublicKey(){return rw.computePublicKey(Xe(this,kg),!0)}sign(e){An(A4(e)===32,"invalid digest length","digest",e);const n=Db.sign(iu(e),iu(Xe(this,kg)),{lowS:!0});return lu.from({r:b1(n.r,32),s:b1(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=rw.computePublicKey(e);return Kr(Db.getSharedSecret(iu(Xe(this,kg)),ms(n),!1))}static computePublicKey(e,n){let r=ms(e,"key");if(r.length===32){const a=Db.getPublicKey(r,!!n);return Kr(a)}if(r.length===64){const a=new Uint8Array(65);a[0]=4,a.set(r,1),r=a}const s=Db.ProjectivePoint.fromHex(r);return Kr(s.toRawBytes(n))}static recoverPublicKey(e,n){An(A4(e)===32,"invalid digest length","digest",e);const r=lu.from(n);let s=Db.Signature.fromCompact(iu(Da([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const a=s.recoverPublicKey(iu(e));return An(a!=null,"invalid signature for digest","signature",n),"0x"+a.toHex(!1)}static addPoints(e,n,r){const s=Db.ProjectivePoint.fromHex(rw.computePublicKey(e).substring(2)),a=Db.ProjectivePoint.fromHex(rw.computePublicKey(n).substring(2));return"0x"+s.add(a).toHex(!!r)}};kg=new WeakMap;let G0=rw;const i6t=BigInt(0),a6t=BigInt(36);function cge(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let s=0;s<40;s++)n[s]=e[s].charCodeAt(0);const r=ms(mo(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 Xoe={};for(let t=0;t<10;t++)Xoe[String(t)]=String(t);for(let t=0;t<26;t++)Xoe[String.fromCharCode(65+t)]=String(10+t);const uge=15;function o6t(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>Xoe[r]).join("");for(;e.length>=uge;){let r=e.substring(0,uge);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 l6t=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function c6t(t){t=t.toLowerCase();let e=i6t;for(let n=0;n<t.length;n++)e=e*a6t+l6t[t[n]];return e}function la(t){if(An(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=cge(t);return An(!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}$/)){An(t.substring(2,4)===o6t(t),"bad icap checksum","address",t);let e=c6t(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return cge("0x"+e)}An(!1,"invalid address","address",t)}function u6t(t){const e=la(t.from);let r=_s(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,la(So(mo(y1([e,r])),12))}function fFe(t){return t&&typeof t.getAddress=="function"}async function VV(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(Dr(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),An(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),la(n)}function Oc(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?la(t):(Dr(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),VV(t,e.resolveName(t)));if(fFe(t))return VV(t,t.getAddress());if(t&&typeof t.then=="function")return VV(t,t);An(!1,"unsupported addressable value","target",t)}const xg={};function Ts(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Uu(xg,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function ba(t,e){return new Uu(xg,`bytes${e||""}`,t,{size:e})}const dge=Symbol.for("_ethers_typed");var Kw;const bg=class bg{constructor(e,n,r,s){Gn(this,"type");Gn(this,"value");Un(this,Kw);Gn(this,"_typedSymbol");s==null&&(s=null),k5(xg,e,"Typed"),$s(this,{_typedSymbol:dge,type:n,value:r}),Xt(this,Kw,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return Xe(this,Kw)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return Xe(this,Kw)===!0?-1:Xe(this,Kw)===!1?this.value.length:null}static from(e,n){return new bg(xg,e,n)}static uint8(e){return Ts(e,8)}static uint16(e){return Ts(e,16)}static uint24(e){return Ts(e,24)}static uint32(e){return Ts(e,32)}static uint40(e){return Ts(e,40)}static uint48(e){return Ts(e,48)}static uint56(e){return Ts(e,56)}static uint64(e){return Ts(e,64)}static uint72(e){return Ts(e,72)}static uint80(e){return Ts(e,80)}static uint88(e){return Ts(e,88)}static uint96(e){return Ts(e,96)}static uint104(e){return Ts(e,104)}static uint112(e){return Ts(e,112)}static uint120(e){return Ts(e,120)}static uint128(e){return Ts(e,128)}static uint136(e){return Ts(e,136)}static uint144(e){return Ts(e,144)}static uint152(e){return Ts(e,152)}static uint160(e){return Ts(e,160)}static uint168(e){return Ts(e,168)}static uint176(e){return Ts(e,176)}static uint184(e){return Ts(e,184)}static uint192(e){return Ts(e,192)}static uint200(e){return Ts(e,200)}static uint208(e){return Ts(e,208)}static uint216(e){return Ts(e,216)}static uint224(e){return Ts(e,224)}static uint232(e){return Ts(e,232)}static uint240(e){return Ts(e,240)}static uint248(e){return Ts(e,248)}static uint256(e){return Ts(e,256)}static uint(e){return Ts(e,256)}static int8(e){return Ts(e,-8)}static int16(e){return Ts(e,-16)}static int24(e){return Ts(e,-24)}static int32(e){return Ts(e,-32)}static int40(e){return Ts(e,-40)}static int48(e){return Ts(e,-48)}static int56(e){return Ts(e,-56)}static int64(e){return Ts(e,-64)}static int72(e){return Ts(e,-72)}static int80(e){return Ts(e,-80)}static int88(e){return Ts(e,-88)}static int96(e){return Ts(e,-96)}static int104(e){return Ts(e,-104)}static int112(e){return Ts(e,-112)}static int120(e){return Ts(e,-120)}static int128(e){return Ts(e,-128)}static int136(e){return Ts(e,-136)}static int144(e){return Ts(e,-144)}static int152(e){return Ts(e,-152)}static int160(e){return Ts(e,-160)}static int168(e){return Ts(e,-168)}static int176(e){return Ts(e,-176)}static int184(e){return Ts(e,-184)}static int192(e){return Ts(e,-192)}static int200(e){return Ts(e,-200)}static int208(e){return Ts(e,-208)}static int216(e){return Ts(e,-216)}static int224(e){return Ts(e,-224)}static int232(e){return Ts(e,-232)}static int240(e){return Ts(e,-240)}static int248(e){return Ts(e,-248)}static int256(e){return Ts(e,-256)}static int(e){return Ts(e,-256)}static bytes1(e){return ba(e,1)}static bytes2(e){return ba(e,2)}static bytes3(e){return ba(e,3)}static bytes4(e){return ba(e,4)}static bytes5(e){return ba(e,5)}static bytes6(e){return ba(e,6)}static bytes7(e){return ba(e,7)}static bytes8(e){return ba(e,8)}static bytes9(e){return ba(e,9)}static bytes10(e){return ba(e,10)}static bytes11(e){return ba(e,11)}static bytes12(e){return ba(e,12)}static bytes13(e){return ba(e,13)}static bytes14(e){return ba(e,14)}static bytes15(e){return ba(e,15)}static bytes16(e){return ba(e,16)}static bytes17(e){return ba(e,17)}static bytes18(e){return ba(e,18)}static bytes19(e){return ba(e,19)}static bytes20(e){return ba(e,20)}static bytes21(e){return ba(e,21)}static bytes22(e){return ba(e,22)}static bytes23(e){return ba(e,23)}static bytes24(e){return ba(e,24)}static bytes25(e){return ba(e,25)}static bytes26(e){return ba(e,26)}static bytes27(e){return ba(e,27)}static bytes28(e){return ba(e,28)}static bytes29(e){return ba(e,29)}static bytes30(e){return ba(e,30)}static bytes31(e){return ba(e,31)}static bytes32(e){return ba(e,32)}static address(e){return new bg(xg,"address",e)}static bool(e){return new bg(xg,"bool",!!e)}static bytes(e){return new bg(xg,"bytes",e)}static string(e){return new bg(xg,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new bg(xg,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===dge}static dereference(e,n){if(bg.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};Kw=new WeakMap;let Uu=bg;class d6t extends R1{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Uu.dereference(n,"string");try{r=la(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return la(b1(e.readValue(),20))}}class f6t extends R1{constructor(n){super(n.name,n.type,"_",n.dynamic);Gn(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 hFe(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let c={};r=e.map(u=>{const d=u.localName;return Dr(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),Dr(!c[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),c[d]=!0,n[d]})}else An(!1,"invalid tuple value","tuple",n);An(e.length===r.length,"types/value length mismatch","tuple",n);let s=new Gee,a=new Gee,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 pFe(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)}),gR.fromItems(n,r)}class h6t extends R1{constructor(n,r,s){const a=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",a,s,o);Gn(this,"coder");Gn(this,"length");$s(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Uu.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let a=this.length;a===-1&&(a=s.length,n.writeValue(s.length)),JIe(s.length,a,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let l=0;l<s.length;l++)o.push(this.coder);return hFe(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),Dr(r*fd<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*fd,length:n.dataLength}));let s=[];for(let a=0;a<r;a++)s.push(new f6t(this.coder));return pFe(n,s)}}class p6t extends R1{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Uu.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class mFe extends R1{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 m6t extends mFe{constructor(e){super("bytes",e)}decode(e){return Kr(super.decode(e))}}class x6t extends R1{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);Gn(this,"size");$s(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 Kr(n.readBytes(this.size))}}const g6t=new Uint8Array([]);class b6t extends R1{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(g6t)}decode(e){return e.readBytes(0),null}}const y6t=BigInt(0),v6t=BigInt(1),w6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class C6t extends R1{constructor(n,r,s){const a=(r?"int":"uint")+n*8;super(a,a,s,!1);Gn(this,"size");Gn(this,"signed");$s(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=_s(Uu.dereference(r,this.type)),a=q7(w6t,fd*8);if(this.signed){let o=q7(a,this.size*8-1);(s>o||s<-(o+v6t))&&this._throwError("value out-of-bounds",r),s=rPe(s,8*fd)}else(s<y6t||s>q7(a,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=q7(n.readValue(),this.size*8);return this.signed&&(r=e3t(r,this.size*8)),r}}class S6t extends mFe{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,bd(Uu.dereference(n,"string")))}decode(e){return xR(super.decode(e))}}class HP extends R1{constructor(n,r){let s=!1;const a=[];n.forEach(l=>{l.dynamic&&(s=!0),a.push(l.type)});const o="tuple("+a.join(",")+")";super("tuple",o,r,s);Gn(this,"coders");$s(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,a)=>{const o=a.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,a)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[a]))}),Object.freeze(n)}encode(n,r){const s=Uu.dereference(r,"tuple");return hFe(n,this.coders,s)}decode(n){return pFe(n,this.coders)}}function WV(t,e){return{address:la(t),storageKeys:e.map((n,r)=>(An(xo(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function T5(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?(An(n.length===2,"invalid slot set",`value[${r}]`,n),WV(n[0],n[1])):(An(n!=null&&typeof n=="object","invalid address-slot set","value",t),WV(n.address,n.storageKeys)));An(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 WV(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function xFe(t){return{address:la(t.address),nonce:_s(t.nonce!=null?t.nonce:0),chainId:_s(t.chainId!=null?t.chainId:0),signature:lu.from(t.signature)}}function kT(t){let e;return typeof t=="string"?e=G0.computePublicKey(t,!1):e=t.publicKey,la(mo("0x"+e.substring(4)).substring(26))}function N6t(t,e){return kT(G0.recoverPublicKey(t,e))}const Tc=BigInt(0),j6t=BigInt(2),A6t=BigInt(27),_6t=BigInt(28),E6t=BigInt(35),k6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qV=4096*32;function T6t(t){return{blobToKzgCommitment:r=>{if("computeBlobProof"in t){if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return ms(t.blobToKzgCommitment(Kr(r)))}else if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return ms(t.blobToKzgCommitment(r));if("blobToKZGCommitment"in t&&typeof t.blobToKZGCommitment=="function")return ms(t.blobToKZGCommitment(Kr(r)));An(!1,"unsupported KZG library","kzg",t)},computeBlobKzgProof:(r,s)=>{if("computeBlobProof"in t&&typeof t.computeBlobProof=="function")return ms(t.computeBlobProof(Kr(r),Kr(s)));if("computeBlobKzgProof"in t&&typeof t.computeBlobKzgProof=="function")return t.computeBlobKzgProof(r,s);if("computeBlobKZGProof"in t&&typeof t.computeBlobKZGProof=="function")return ms(t.computeBlobKZGProof(Kr(r),Kr(s)));An(!1,"unsupported KZG library","kzg",t)}}}function fge(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=xp(e).substring(4),"0x"+n}function u8(t){return t==="0x"?null:la(t)}function $$(t,e){try{return T5(t)}catch(n){An(!1,n.message,e,t)}}function I6t(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:u8(s[1]),nonce:qa(s[2],"nonce"),chainId:qa(s[0],"chainId"),signature:lu.from({yParity:I5(s[3],"yParity"),r:g1(s[4],32),s:g1(s[5],32)})})}return n}catch(n){An(!1,n.message,e,t)}}function I5(t,e){return t==="0x"?0:$i(t,e)}function qa(t,e){if(t==="0x")return Tc;const n=_s(t,e);return An(n<=k6t,"value exceeds uint size",e,n),n}function ia(t,e){const n=_s(t,"value"),r=ul(n);return An(r.length<=32,"value too large",`tx.${e}`,n),r}function U$(t){return T5(t).map(e=>[e.address,e.storageKeys])}function P6t(t){return t.map(e=>[ia(e.chainId,"chainId"),e.address,ia(e.nonce,"nonce"),ia(e.signature.yParity,"yParity"),ul(e.signature.r),ul(e.signature.s)])}function F6t(t,e){An(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)An(xo(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function O6t(t){const e=_T(t);An(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:I5(e[0],"nonce"),gasPrice:qa(e[1],"gasPrice"),gasLimit:qa(e[2],"gasLimit"),to:u8(e[3]),value:qa(e[4],"value"),data:Kr(e[5]),chainId:Tc};if(e.length===6)return n;const r=qa(e[6],"v"),s=qa(e[7],"r"),a=qa(e[8],"s");if(s===Tc&&a===Tc)n.chainId=r;else{let o=(r-E6t)/j6t;o<Tc&&(o=Tc),n.chainId=o,An(o!==Tc||r===A6t||r===_6t,"non-canonical legacy v","v",e[6]),n.signature=lu.from({r:g1(e[7],32),s:g1(e[8],32),v:r})}return n}function M6t(t,e){const n=[ia(t.nonce,"nonce"),ia(t.gasPrice||0,"gasPrice"),ia(t.gasLimit,"gasLimit"),t.to||"0x",ia(t.value,"value"),t.data];let r=Tc;if(t.chainId!=Tc)r=_s(t.chainId,"tx.chainId"),An(!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(ul(r)),n.push("0x"),n.push("0x")),y1(n);let s=BigInt(27+e.yParity);return r!==Tc?s=lu.getChainIdV(r,e.v):BigInt(e.v)!==s&&An(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(ul(s)),n.push(ul(e.r)),n.push(ul(e.s)),y1(n)}function z$(t,e){let n;try{if(n=I5(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{An(!1,"invalid yParity","yParity",e[0])}const r=g1(e[1],32),s=g1(e[2],32),a=lu.from({r,s,yParity:n});t.signature=a}function R6t(t){const e=_T(ms(t).slice(1));An(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Kr(t));const n={type:2,chainId:qa(e[0],"chainId"),nonce:I5(e[1],"nonce"),maxPriorityFeePerGas:qa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:qa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:qa(e[4],"gasLimit"),to:u8(e[5]),value:qa(e[6],"value"),data:Kr(e[7]),accessList:$$(e[8],"accessList")};return e.length===9||z$(n,e.slice(9)),n}function L6t(t,e){const n=[ia(t.chainId,"chainId"),ia(t.nonce,"nonce"),ia(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ia(t.maxFeePerGas||0,"maxFeePerGas"),ia(t.gasLimit,"gasLimit"),t.to||"0x",ia(t.value,"value"),t.data,U$(t.accessList||[])];return e&&(n.push(ia(e.yParity,"yParity")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x02",y1(n)])}function D6t(t){const e=_T(ms(t).slice(1));An(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Kr(t));const n={type:1,chainId:qa(e[0],"chainId"),nonce:I5(e[1],"nonce"),gasPrice:qa(e[2],"gasPrice"),gasLimit:qa(e[3],"gasLimit"),to:u8(e[4]),value:qa(e[5],"value"),data:Kr(e[6]),accessList:$$(e[7],"accessList")};return e.length===8||z$(n,e.slice(8)),n}function B6t(t,e){const n=[ia(t.chainId,"chainId"),ia(t.nonce,"nonce"),ia(t.gasPrice||0,"gasPrice"),ia(t.gasLimit,"gasLimit"),t.to||"0x",ia(t.value,"value"),t.data,U$(t.accessList||[])];return e&&(n.push(ia(e.yParity,"recoveryParam")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x01",y1(n)])}function $6t(t){let e=_T(ms(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const a=e[1],o=e[2],l=e[3];An(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),An(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),An(Array.isArray(l),"invalid network format: proofs not an array","fields[3]",l),An(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),An(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]}An(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",Kr(t));const s={type:3,chainId:qa(e[0],"chainId"),nonce:I5(e[1],"nonce"),maxPriorityFeePerGas:qa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:qa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:qa(e[4],"gasLimit"),to:u8(e[5]),value:qa(e[6],"value"),data:Kr(e[7]),accessList:$$(e[8],"accessList"),maxFeePerBlobGas:qa(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),An(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),An(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let a=0;a<s.blobVersionedHashes.length;a++)An(xo(s.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",t);return e.length===11||z$(s,e.slice(11)),s}function U6t(t,e,n){const r=[ia(t.chainId,"chainId"),ia(t.nonce,"nonce"),ia(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ia(t.maxFeePerGas||0,"maxFeePerGas"),ia(t.gasLimit,"gasLimit"),t.to||K_,ia(t.value,"value"),t.data,U$(t.accessList||[]),ia(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),F6t(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(ia(e.yParity,"yParity")),r.push(ul(e.r)),r.push(ul(e.s)),n)?Da(["0x03",y1([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):Da(["0x03",y1(r)])}function z6t(t){const e=_T(ms(t).slice(1));An(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",Kr(t));const n={type:4,chainId:qa(e[0],"chainId"),nonce:I5(e[1],"nonce"),maxPriorityFeePerGas:qa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:qa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:qa(e[4],"gasLimit"),to:u8(e[5]),value:qa(e[6],"value"),data:Kr(e[7]),accessList:$$(e[8],"accessList"),authorizationList:I6t(e[9],"authorizationList")};return e.length===10||z$(n,e.slice(10)),n}function H6t(t,e){const n=[ia(t.chainId,"chainId"),ia(t.nonce,"nonce"),ia(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ia(t.maxFeePerGas||0,"maxFeePerGas"),ia(t.gasLimit,"gasLimit"),t.to||"0x",ia(t.value,"value"),t.data,U$(t.accessList||[]),P6t(t.authorizationList||[])];return e&&(n.push(ia(e.yParity,"yParity")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x04",y1(n)])}var em,pS,mS,xS,gS,bS,yS,vS,wS,CS,SS,NS,Yw,cy,y0,uy,jS,AS,KO,Gf;let Qoe=(Gf=class{constructor(){Un(this,AS);Un(this,em);Un(this,pS);Un(this,mS);Un(this,xS);Un(this,gS);Un(this,bS);Un(this,yS);Un(this,vS);Un(this,wS);Un(this,CS);Un(this,SS);Un(this,NS);Un(this,Yw);Un(this,cy);Un(this,y0);Un(this,uy);Un(this,jS);Xt(this,em,null),Xt(this,pS,null),Xt(this,xS,0),Xt(this,gS,Tc),Xt(this,bS,null),Xt(this,yS,null),Xt(this,vS,null),Xt(this,mS,"0x"),Xt(this,wS,Tc),Xt(this,CS,Tc),Xt(this,SS,null),Xt(this,NS,null),Xt(this,Yw,null),Xt(this,cy,null),Xt(this,y0,null),Xt(this,uy,null),Xt(this,jS,null)}get type(){return Xe(this,em)}set type(e){switch(e){case null:Xt(this,em,null);break;case 0:case"legacy":Xt(this,em,0);break;case 1:case"berlin":case"eip-2930":Xt(this,em,1);break;case 2:case"london":case"eip-1559":Xt(this,em,2);break;case 3:case"cancun":case"eip-4844":Xt(this,em,3);break;case 4:case"pectra":case"eip-7702":Xt(this,em,4);break;default:An(!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=Xe(this,pS);return e==null&&this.type===3?K_:e}set to(e){Xt(this,pS,e==null?null:la(e))}get nonce(){return Xe(this,xS)}set nonce(e){Xt(this,xS,$i(e,"value"))}get gasLimit(){return Xe(this,gS)}set gasLimit(e){Xt(this,gS,_s(e))}get gasPrice(){const e=Xe(this,bS);return e==null&&(this.type===0||this.type===1)?Tc:e}set gasPrice(e){Xt(this,bS,e==null?null:_s(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=Xe(this,yS);return e??(this.type===2||this.type===3?Tc:null)}set maxPriorityFeePerGas(e){Xt(this,yS,e==null?null:_s(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=Xe(this,vS);return e??(this.type===2||this.type===3?Tc:null)}set maxFeePerGas(e){Xt(this,vS,e==null?null:_s(e,"maxFeePerGas"))}get data(){return Xe(this,mS)}set data(e){Xt(this,mS,Kr(e))}get value(){return Xe(this,wS)}set value(e){Xt(this,wS,_s(e,"value"))}get chainId(){return Xe(this,CS)}set chainId(e){Xt(this,CS,_s(e))}get signature(){return Xe(this,SS)||null}set signature(e){Xt(this,SS,e==null?null:lu.from(e))}get accessList(){const e=Xe(this,NS)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){Xt(this,NS,e==null?null:T5(e))}get authorizationList(){const e=Xe(this,jS)||null;return e==null&&this.type===4?[]:e}set authorizationList(e){Xt(this,jS,e==null?null:e.map(n=>xFe(n)))}get maxFeePerBlobGas(){const e=Xe(this,Yw);return e==null&&this.type===3?Tc:e}set maxFeePerBlobGas(e){Xt(this,Yw,e==null?null:_s(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=Xe(this,cy);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){An(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)An(xo(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}Xt(this,cy,e)}get blobs(){return Xe(this,uy)==null?null:Xe(this,uy).map(e=>Object.assign({},e))}set blobs(e){if(e==null){Xt(this,uy,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const a=e[s];if(P$(a)){Dr(Xe(this,y0),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ms(a);if(An(o.length<=qV,"blob is too large",`blobs[${s}]`,a),o.length!==qV){const u=new Uint8Array(qV);u.set(o),o=u}const l=Xe(this,y0).blobToKzgCommitment(o),c=Kr(Xe(this,y0).computeBlobKzgProof(o,l));n.push({data:Kr(o),commitment:Kr(l),proof:c}),r.push(fge(1,l))}else{const o=Kr(a.commitment);n.push({data:Kr(a.data),commitment:o,proof:Kr(a.proof)}),r.push(fge(1,o))}}Xt(this,uy,n),Xt(this,cy,r)}get kzg(){return Xe(this,y0)}set kzg(e){e==null?Xt(this,y0,null):Xt(this,y0,T6t(e))}get hash(){return this.signature==null?null:mo(Cr(this,AS,KO).call(this,!0,!1))}get unsignedHash(){return mo(this.unsignedSerialized)}get from(){return this.signature==null?null:N6t(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:G0.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return Cr(this,AS,KO).call(this,!0,!0)}get unsignedSerialized(){return Cr(this,AS,KO).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=Xe(this,Yw)!=null||Xe(this,cy);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Dr(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Dr(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Dr(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const a=[];return this.type!=null?a.push(this.type):this.authorizationList&&this.authorizationList.length?a.push(4):n?a.push(2):e?(a.push(1),r||a.push(0)):r?(a.push(1),a.push(2)):(s&&this.to||(a.push(0),a.push(1),a.push(2)),a.push(3)),a.sort(),a}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return 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=ms(e);if(r[0]>=127)return Gf.from(O6t(r));switch(r[0]){case 1:return Gf.from(D6t(r));case 2:return Gf.from(R6t(r));case 3:return Gf.from($6t(r));case 4:return Gf.from(z6t(r))}Dr(!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&&(An(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),An(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(An(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),An(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}},em=new WeakMap,pS=new WeakMap,mS=new WeakMap,xS=new WeakMap,gS=new WeakMap,bS=new WeakMap,yS=new WeakMap,vS=new WeakMap,wS=new WeakMap,CS=new WeakMap,SS=new WeakMap,NS=new WeakMap,Yw=new WeakMap,cy=new WeakMap,y0=new WeakMap,uy=new WeakMap,jS=new WeakMap,AS=new WeakSet,KO=function(e,n){Dr(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return M6t(this,r);case 1:return B6t(this,r);case 2:return L6t(this,r);case 3:return U6t(this,r,n?this.blobs:null);case 4:return H6t(this,r)}Dr(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})},Gf);function V6t(t){return An(typeof t.address=="string","invalid address for hashAuthorization","auth.address",t),mo(Da(["0x05",y1([t.chainId!=null?ul(t.chainId):"0x",la(t.address),t.nonce!=null?ul(t.nonce):"0x"])]))}function v1(t){return mo(bd(t))}var W6t="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 hge=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),pge=4;function q6t(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],I=0,P=x;for(;;){let F=Math.floor(((C-I+1)*s-1)/P),$=0,L=r;for(;L-$>1;){let se=$+L>>>1;F<a[se]?L=se:$=se}if($==0)break;N.push($);let z=I+Math.floor(P*a[$]/s),Q=I+Math.floor(P*a[$+1]/s)-1;for(;!((z^Q)&g);)C=C<<1&v|d(),z=z<<1&v,Q=Q<<1&v|1;for(;z&~Q&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,Q=(Q^g)<<1|g|1;I=z,P=1+Q-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function G6t(t){let e=0;return()=>t[e++]}function gFe(t){return G6t(q6t(K6t(t)))}function K6t(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 Y6t(t){return t&1?~t>>1:t>>1}function X6t(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=Y6t(e());return n}function Y_(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 bFe(t){return X_(()=>{let e=Y_(t);if(e.length)return e})}function yFe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(Q6t(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Z6t(n,t))}return e.flat()}function X_(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function vFe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)X6t(t,n).forEach((a,o)=>r[o].push(a));return r}function Q6t(t,e){let n=1+e(),r=e(),s=X_(e);return vFe(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 Z6t(t,e){let n=1+e();return vFe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function J6t(t){let e=[],n=Y_(t);return s(r([]),[]),e;function r(a){let o=t(),l=X_(()=>{let c=Y_(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 eCt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function wFe(t){return`{${eCt(t)}}`}function tCt(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function dN(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function 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 rCt="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 Q_=44032,bR=4352,yR=4449,vR=4519,CFe=19,SFe=21,fN=28,wR=SFe*fN,sCt=CFe*wR,iCt=Q_+sCt,aCt=bR+CFe,oCt=yR+SFe,lCt=vR+fN;function K7(t){return t>>24&255}function NFe(t){return t&16777215}let tte,mge,nte,YO;function cCt(){let t=gFe(rCt);tte=new Map(bFe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),mge=new Set(Y_(t)),nte=new Map,YO=new Map;for(let[e,n]of yFe(t)){if(!mge.has(e)&&n.length==2){let[r,s]=n,a=YO.get(r);a||(a=new Map,YO.set(r,a)),a.set(s,e)}nte.set(e,n.reverse())}}function jFe(t){return t>=Q_&&t<iCt}function uCt(t,e){if(t>=bR&&t<aCt&&e>=yR&&e<oCt)return Q_+(t-bR)*wR+(e-yR)*fN;if(jFe(t)&&e>vR&&e<lCt&&(t-Q_)%fN==0)return t+(e-vR);{let n=YO.get(t);return n&&(n=n.get(e),n)?n:-1}}function AFe(t){tte||cCt();let e=[],n=[],r=!1;function s(a){let o=tte.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(jFe(a)){let o=a-Q_,l=o/wR|0,c=o%wR/fN|0,u=o%fN;s(bR+l),s(yR+c),u>0&&s(vR+u)}else{let o=nte.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=K7(e[0]);for(let o=1;o<e.length;o++){let l=K7(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=K7(e[--c]),a<=l))break}a=K7(e[o])}}return e}function dCt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=K7(a),l=NFe(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=uCt(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 _Fe(t){return AFe(t).map(NFe)}function fCt(t){return dCt(AFe(t))}const xge=45,EFe=".",kFe=65039,TFe=1,CR=t=>Array.from(t);function Z_(t,e){return t.P.has(e)||t.Q.has(e)}let hCt=class extends Array{get is_emoji(){return!0}},rte,IFe,hw,ste,PFe,E4,GV,UC,Hv,gge,ite;function Zoe(){if(rte)return;let t=gFe(W6t);const e=()=>Y_(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));rte=new Map(yFe(t)),IFe=n(),hw=e(),ste=new Set(e().map(d=>hw[d])),hw=new Set(hw),PFe=n(),n();let s=bFe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};E4=X_(d=>{let f=X_(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=dN(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),GV=n(),UC=new Map;let l=e().concat(CR(GV)).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),GV.has(d)||UC.set(d,g)});for(let{V:d,M:f}of new Set(UC.values())){let x=[];for(let y of d){let v=E4.filter(N=>Z_(N,y)),C=x.find(({G:N})=>v.some(I=>N.has(I)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>CR(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}Hv=new Set;let c=new Set;const u=d=>Hv.has(d)?c.add(d):Hv.add(d);for(let d of E4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Hv)!UC.has(d)&&!c.has(d)&&UC.set(d,TFe);r(Hv,_Fe(Hv)),gge=J6t(t).map(d=>hCt.from(d)).sort(nCt),ite=new Map;for(let d of gge){let f=[ite];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===kFe?f.push(...g):f=g}for(let x of f)x.V=d}}function Joe(t){return(FFe(t)?"":`${ele(H$([t]))} `)+wFe(t)}function ele(t){return`"${t}"`}function pCt(t){if(t.length>=4&&t[2]==xge&&t[3]==xge)throw new Error(`invalid label extension: "${dN(t.slice(0,4))}"`)}function mCt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function xCt(t){let e=t[0],n=hge.get(e);if(n)throw N9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=hge.get(e);if(o){if(s==a)throw N9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw N9(`trailing ${n}`)}function H$(t,e=1/0,n=wFe){let r=[];gCt(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];FFe(l)&&(r.push(dN(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(dN(t.slice(s,a))),r.join("")}function gCt(t){return Zoe(),hw.has(t)}function FFe(t){return Zoe(),PFe.has(t)}function bCt(t){return CCt(yCt(t,fCt,jCt))}function yCt(t,e,n){if(!t)return[];Zoe();let r=0;return t.split(EFe).map(s=>{let a=tCt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=NCt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(mCt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))pCt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(hw.has(d[0]))throw N9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&hw.has(C[0]))throw N9(`emoji + combining mark: "${dN(l[v-1])} + ${H$([C[0]])}"`)}xCt(d);let g=CR(new Set(x)),[y]=wCt(g);SCt(y,x),vCt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function vCt(t,e){let n,r=[];for(let s of e){let a=UC.get(s);if(a===TFe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):CR(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>Z_(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function wCt(t){let e=E4;for(let n of t){let r=e.filter(s=>Z_(s,n));if(!r.length)throw E4.some(s=>Z_(s,n))?MFe(e[0],n):OFe(n);if(e=r,r.length==1)break}return e}function CCt(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 ${ele(H$(e,63))}: ${s}`)}return dN(r)}).join(EFe)}function OFe(t){return new Error(`disallowed character: ${Joe(t)}`)}function MFe(t,e){let n=Joe(e),r=E4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function N9(t){return new Error(`illegal placement: ${t}`)}function SCt(t,e){for(let n of e)if(!Z_(t,n))throw MFe(t,n);if(t.M){let n=_Fe(e);for(let r=1,s=n.length;r<s;r++)if(ste.has(n[r])){let a=r+1;for(let o;a<s&&ste.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${Joe(o)}`);if(a-r>pge)throw new Error(`excessive non-spacing marks: ${ele(H$(n.slice(r-1,a)))} (${a-r}/${pge})`);r=a}}}function NCt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=ACt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Hv.has(o))s.push(o);else{let l=rte.get(o);if(l)s.push(...l);else if(!IFe.has(o))throw OFe(o)}}}return s.length&&r.push(e(s)),r}function jCt(t){return t.filter(e=>e!=kFe)}function ACt(t,e){let n=ite,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 RFe=new Uint8Array(32);RFe.fill(0);function bge(t){return An(t.length!==0,"invalid ENS name; empty component","comp",t),t}function LFe(t){const e=bd(_Ct(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(bge(e.slice(r,s))),r=s+1);return An(r<e.length,"invalid ENS name; empty component","name",t),n.push(bge(e.slice(r))),n}function _Ct(t){try{if(t.length===0)throw new Error("empty label");return bCt(t)}catch(e){An(!1,`invalid ENS name (${e.message})`,"name",t)}}function ate(t){An(typeof t=="string","invalid ENS name; not a string","name",t),An(t.length,"invalid ENS name (empty label)","name",t);let e=RFe;const n=LFe(t);for(;n.length;)e=mo(Da([e,mo(n.pop())]));return Kr(e)}function ECt(t,e){const n=e;return An(n<=255,"DNS encoded label cannot exceed 255","length",n),Kr(Da(LFe(t).map(r=>{An(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 kCt(t){return typeof t=="string"&&(t=bd(t)),mo(Da([bd(s6t),bd(String(t.length)),t]))}const DFe=new Uint8Array(32);DFe.fill(0);const TCt=BigInt(-1),BFe=BigInt(0),$Fe=BigInt(1),ICt=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function PCt(t){const e=ms(t),n=e.length%32;return n?Da([e,DFe.slice(n)]):Kr(e)}const FCt=b1($Fe,32),OCt=b1(BFe,32),yge={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},KV=["name","version","chainId","verifyingContract","salt"];function vge(t){return function(e){return An(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const MCt={name:vge("name"),version:vge("version"),chainId:function(t){const e=_s(t,"domain.chainId");return An(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):cm(e)},verifyingContract:function(t){try{return la(t).toLowerCase()}catch{}An(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ms(t,"domain.salt");return An(e.length===32,'invalid domain value "salt"',"domain.salt",t),Kr(e)}};function YV(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);An(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=q7(ICt,n?r-1:r),a=n?(s+$Fe)*TCt:BFe;return function(o){const l=_s(o,"value");return An(l>=a&&l<=s,`value out-of-bounds for ${t}`,"value",l),b1(n?rPe(l,256):l,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return An(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ms(r);return An(s.length===n,`invalid length for ${t}`,"value",r),PCt(r)}}}switch(t){case"address":return function(e){return g1(la(e),32)};case"bool":return function(e){return e?FCt:OCt};case"bytes":return function(e){return mo(e)};case"string":return function(e){return v1(e)}}return null}function wge(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function VP(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 Uk,Tg,_S,hB,UFe;const zh=class zh{constructor(e){Un(this,hB);Gn(this,"primaryType");Un(this,Uk);Un(this,Tg);Un(this,_S);Xt(this,Tg,new Map),Xt(this,_S,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}=VP(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)}),Xt(this,Uk,JSON.stringify(a));for(const c in a){const u=new Set;for(const d of a[c]){An(!u.has(d.name),`duplicate variable name ${JSON.stringify(d.name)} in ${JSON.stringify(c)}`,"types",e),u.add(d.name);const f=VP(d.type).base;An(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!YV(f)&&(An(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);An(o.length!==0,"missing primary type","types",e),An(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),$s(this,{primaryType:o[0]});function l(c,u){An(!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(),Xe(this,Tg).set(c,wge(c,a[c])+d.map(f=>wge(f,a[f])).join(""))}}get types(){return JSON.parse(Xe(this,Uk))}getEncoder(e){let n=Xe(this,_S).get(e);return n||(n=Cr(this,hB,UFe).call(this,e),Xe(this,_S).set(e,n)),n}encodeType(e){const n=Xe(this,Tg).get(e);return An(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return mo(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(YV(e))return r(e,n);const s=VP(e).array;if(s)return An(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),{});An(!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=yge[r];An(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>KV.indexOf(r.name)-KV.indexOf(s.name)),zh.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return Da(["0x1901",zh.hashDomain(e),zh.from(n).hash(r)])}static hash(e,n,r){return mo(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&&!xo(e.verifyingContract,20)&&(a[e.verifyingContract]="0x");const o=zh.from(n);o.visit(r,(l,c)=>(l==="address"&&!xo(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=[];KV.forEach(c=>{const u=e[c];u!=null&&(s[c]=MCt[c](u),a.push({name:c,type:yge[c]}))});const o=zh.from(n);n=o.types;const l=Object.assign({},n);return An(l.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),l.EIP712Domain=a,o.encode(r),{types:l,domain:s,primaryType:o.primaryType,message:o.visit(r,(c,u)=>{if(c.match(/^bytes(\d*)/))return Kr(ms(u));if(c.match(/^u?int/))return _s(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return An(typeof u=="string","invalid string","value",u),u}An(!1,"unsupported type","type",c)})}}};Uk=new WeakMap,Tg=new WeakMap,_S=new WeakMap,hB=new WeakSet,UFe=function(e){{const s=YV(e);if(s)return s}const n=VP(e).array;if(n){const s=n.prefix,a=this.getEncoder(s);return o=>{An(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let l=o.map(a);return Xe(this,Tg).has(s)&&(l=l.map(mo)),mo(Da(l))}}const r=this.types[e];if(r){const s=v1(Xe(this,Tg).get(e));return a=>{const o=r.map(({name:l,type:c})=>{const u=this.getEncoder(c)(a[l]);return Xe(this,Tg).has(c)?mo(u):u});return o.unshift(s),Da(o)}}An(!1,`unknown type: ${e}`,"type",e)};let hN=zh;function hd(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const RCt="external public payable override",LCt=hd(RCt.split(" ")),zFe="constant external internal payable private public pure view override",DCt=hd(zFe.split(" ")),HFe="constructor error event fallback function receive struct",VFe=hd(HFe.split(" ")),WFe="calldata memory storage payable indexed",BCt=hd(WFe.split(" ")),$Ct="tuple returns",UCt=[HFe,WFe,$Ct,zFe].join(" "),zCt=hd(UCt.split(" ")),HCt={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},VCt=new RegExp("^(\\s*)"),WCt=new RegExp("^([0-9]+)"),qCt=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),qFe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),GFe=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Qc,tm,zk,ote;const pB=class pB{constructor(e){Un(this,zk);Un(this,Qc);Un(this,tm);Xt(this,Qc,0),Xt(this,tm,e.slice())}get offset(){return Xe(this,Qc)}get length(){return Xe(this,tm).length-Xe(this,Qc)}clone(){return new pB(Xe(this,tm))}reset(){Xt(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=Cr(this,zk,ote).call(this,Xe(this,Qc)+1,e.match+1);return Xt(this,Qc,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;Xe(this,Qc)<e.match-1;){const r=this.peek().linkNext;n.push(Cr(this,zk,ote).call(this,Xe(this,Qc)+1,r)),Xt(this,Qc,r)}return Xt(this,Qc,e.match+1),n}peek(){if(Xe(this,Qc)>=Xe(this,tm).length)throw new Error("out-of-bounds");return Xe(this,tm)[Xe(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 gb(this,Qc)._++,e}toString(){const e=[];for(let n=Xe(this,Qc);n<Xe(this,tm).length;n++){const r=Xe(this,tm)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Qc=new WeakMap,tm=new WeakMap,zk=new WeakSet,ote=function(e=0,n=0){return new pB(Xe(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=pB;function j2(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(VCt);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=HCt[o[0]]||"";if(u){if(c.type=u,c.text=o[0],a++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),c.match=r.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(u==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")c.type="BRACKET";else if(u==="CLOSE_BRACKET"){let d=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;d=f+d,e[e.length-1].value=$i(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=d}continue}if(l=o.match(qCt),l){if(c.text=l[1],a+=c.text.length,zCt.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(GFe)){c.type="TYPE";continue}c.type="ID";continue}if(l=o.match(WCt),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 Cge(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 V$(t,e){if(e.peekKeyword(VFe)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function w1(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function KFe(t){let e=w1(t,DCt);return Cge(e,hd("constant payable nonpayable".split(" "))),Cge(e,hd("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function r1(t,e){return t.popParams().map(n=>cu.from(n,e))}function YFe(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return _s(t.pop().text);throw new Error("invalid gas")}return null}function K3(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const GCt=new RegExp(/^(.*)\[([0-9]*)\]$/);function Sge(t){const e=t.match(GFe);if(An(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);An(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);An(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Wo={},gf=Symbol.for("_ethers_internal"),Nge="_ParamTypeInternal",jge="_ErrorInternal",Age="_EventInternal",_ge="_ConstructorInternal",Ege="_FallbackInternal",kge="_FunctionInternal",Tge="_StructInternal";var ES,XO;const Hh=class Hh{constructor(e,n,r,s,a,o,l,c){Un(this,ES);Gn(this,"name");Gn(this,"type");Gn(this,"baseType");Gn(this,"indexed");Gn(this,"components");Gn(this,"arrayLength");Gn(this,"arrayChildren");if(k5(e,Wo,"ParamType"),Object.defineProperty(this,gf,{value:Nge}),o&&(o=Object.freeze(o.slice())),s==="array"){if(l==null||c==null)throw new Error("")}else if(l!=null||c!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");$s(this,{name:n,type:r,baseType:s,indexed:a,components:o,arrayLength:l,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const a=JSON.parse(this.arrayChildren.format("json"));return a.name=r,a.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(a)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(a=>JSON.parse(a.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,a)=>r.components[a].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return Cr(this,ES,XO).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(j2(e),n)}catch{An(!1,"invalid param type","obj",e)}else if(e instanceof _m){let l="",c="",u=null;w1(e,hd(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(v=>Hh.from(v)),l=`tuple(${u.map(v=>v.format()).join(",")})`):(l=Sge(e.popType("TYPE")),c=l);let d=null,f=null;for(;e.length&&e.peekType("BRACKET");){const v=e.pop();d=new Hh(Wo,"",l,c,null,u,f,d),f=v.value,l+=v.text,c="array",u=null}let x=null;if(w1(e,BCt).has("indexed")){if(!n)throw new Error("");x=!0}const y=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Hh(Wo,y,l,c,x,u,f,d)}const r=e.name;An(!r||typeof r=="string"&&r.match(qFe),"invalid name","obj.name",r);let s=e.indexed;s!=null&&(An(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let a=e.type,o=a.match(GCt);if(o){const l=parseInt(o[2]||"-1"),c=Hh.from({type:o[1],components:e.components});return new Hh(Wo,r||"",a,"array",s,null,l,c)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){const l=e.components!=null?e.components.map(u=>Hh.from(u)):null;return new Hh(Wo,r||"",a,"tuple",s,l,null,null)}return a=Sge(e.type),new Hh(Wo,r||"",a,a,s,null,null,null)}static isParamType(e){return e&&e[gf]===Nge}};ES=new WeakSet,XO=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,l=n.slice();l.forEach((c,u)=>{var d;Cr(d=o,ES,XO).call(d,e,c,r,f=>{l[u]=f})}),s(l);return}if(this.isTuple()){const o=this.components;let l;if(Array.isArray(n))l=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");l=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in n))throw new Error(`missing value for component ${c.name}`);return n[c.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((c,u)=>{var d;Cr(d=o[u],ES,XO).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 Y3{constructor(e,n,r){Gn(this,"type");Gn(this,"inputs");k5(e,Wo,"Fragment"),r=Object.freeze(r.slice()),$s(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Y3.from(JSON.parse(e))}catch{}return Y3.from(j2(e))}if(e instanceof _m)switch(e.peekKeyword(VFe)){case"constructor":return Vg.from(e);case"error":return ef.from(e);case"event":return T0.from(e);case"fallback":case"receive":return vg.from(e);case"function":return I0.from(e);case"struct":return x3.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Vg.from(e);case"error":return ef.from(e);case"event":return T0.from(e);case"fallback":case"receive":return vg.from(e);case"function":return I0.from(e);case"struct":return x3.from(e)}Dr(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}An(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Vg.isFragment(e)}static isError(e){return ef.isFragment(e)}static isEvent(e){return T0.isFragment(e)}static isFunction(e){return I0.isFragment(e)}static isStruct(e){return x3.isFragment(e)}}class W$ extends Y3{constructor(n,r,s,a){super(n,r,a);Gn(this,"name");An(typeof s=="string"&&s.match(qFe),"invalid identifier","name",s),a=Object.freeze(a.slice()),$s(this,{name:s})}}function J_(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class ef extends W${constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,gf,{value:jge})}get selector(){return v1(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+J_(e,this.inputs)),n.join(" ")}static from(e){if(ef.isFragment(e))return e;if(typeof e=="string")return ef.from(j2(e));if(e instanceof _m){const n=V$("error",e),r=r1(e);return K3(e),new ef(Wo,n,r)}return new ef(Wo,e.name,e.inputs?e.inputs.map(cu.from):[])}static isFragment(e){return e&&e[gf]===jge}}class T0 extends W${constructor(n,r,s,a){super(n,"event",r,s);Gn(this,"anonymous");Object.defineProperty(this,gf,{value:Age}),$s(this,{anonymous:a})}get topicHash(){return v1(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+J_(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 T0(Wo,n,r,!1).topicHash}static from(n){if(T0.isFragment(n))return n;if(typeof n=="string")try{return T0.from(j2(n))}catch{An(!1,"invalid event fragment","obj",n)}else if(n instanceof _m){const r=V$("event",n),s=r1(n,!0),a=!!w1(n,hd(["anonymous"])).has("anonymous");return K3(n),new T0(Wo,r,s,a)}return new T0(Wo,n.name,n.inputs?n.inputs.map(r=>cu.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[gf]===Age}}class Vg extends Y3{constructor(n,r,s,a,o){super(n,r,s);Gn(this,"payable");Gn(this,"gas");Object.defineProperty(this,gf,{value:_ge}),$s(this,{payable:a,gas:o})}format(n){if(Dr(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${J_(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Vg.isFragment(n))return n;if(typeof n=="string")try{return Vg.from(j2(n))}catch{An(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof _m){w1(n,hd(["constructor"]));const r=r1(n),s=!!w1(n,LCt).has("payable"),a=YFe(n);return K3(n),new Vg(Wo,"constructor",r,s,a)}return new Vg(Wo,"constructor",n.inputs?n.inputs.map(cu.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[gf]===_ge}}class vg extends Y3{constructor(n,r,s){super(n,"fallback",r);Gn(this,"payable");Object.defineProperty(this,gf,{value:Ege}),$s(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(vg.isFragment(n))return n;if(typeof n=="string")try{return vg.from(j2(n))}catch{An(!1,"invalid fallback fragment","obj",n)}else if(n instanceof _m){const r=n.toString(),s=n.peekKeyword(hd(["fallback","receive"]));if(An(s,"type must be fallback or receive","obj",r),n.popKeyword(hd(["fallback","receive"]))==="receive"){const c=r1(n);return An(c.length===0,"receive cannot have arguments","obj.inputs",c),w1(n,hd(["payable"])),K3(n),new vg(Wo,[],!0)}let o=r1(n);o.length?An(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=KFe(n);if(An(l==="nonpayable"||l==="payable","fallback cannot be constants","obj.stateMutability",l),w1(n,hd(["returns"])).has("returns")){const c=r1(n);An(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return K3(n),new vg(Wo,o,l==="payable")}if(n.type==="receive")return new vg(Wo,[],!0);if(n.type==="fallback"){const r=[cu.from("bytes")],s=n.stateMutability==="payable";return new vg(Wo,r,s)}An(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[gf]===Ege}}class I0 extends W${constructor(n,r,s,a,o,l){super(n,"function",r,a);Gn(this,"constant");Gn(this,"outputs");Gn(this,"stateMutability");Gn(this,"payable");Gn(this,"gas");Object.defineProperty(this,gf,{value:kge}),o=Object.freeze(o.slice()),$s(this,{constant:s==="view"||s==="pure",gas:l,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return v1(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+J_(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(J_(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(Wo,n,"view",r,[],null).selector}static from(n){if(I0.isFragment(n))return n;if(typeof n=="string")try{return I0.from(j2(n))}catch{An(!1,"invalid function fragment","obj",n)}else if(n instanceof _m){const s=V$("function",n),a=r1(n),o=KFe(n);let l=[];w1(n,hd(["returns"])).has("returns")&&(l=r1(n));const c=YFe(n);return K3(n),new I0(Wo,s,o,a,l,c)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new I0(Wo,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]===kge}}class x3 extends W${constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,gf,{value:Tge})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return x3.from(j2(e))}catch{An(!1,"invalid struct fragment","obj",e)}else if(e instanceof _m){const n=V$("struct",e),r=r1(e);return K3(e),new x3(Wo,n,r)}return new x3(Wo,e.name,e.inputs?e.inputs.map(cu.from):[])}static isFragment(e){return e&&e[gf]===Tge}}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 KCt=new RegExp(/^bytes([0-9]*)$/),YCt=new RegExp(/^(u?int)([0-9]*)$/);let XV=null,Ige=1024;function XCt(t,e,n,r){let s="missing revert data",a=null;const o=null;let l=null;if(n){s="execution reverted";const u=ms(n);if(n=Kr(n),u.length===0)s+=" (no data present; likely require(false) occurred",a="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Kr(u.slice(0,4))==="0x08c379a0")try{a=r.decode(["string"],u.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[a]},s+=`: ${JSON.stringify(a)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Kr(u.slice(0,4))==="0x4e487b71")try{const d=Number(r.decode(["uint256"],u.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},a=`Panic due to ${Mm.get(d)||"UNKNOWN"}(${d})`,s+=`: ${a}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?la(e.to):null,data:e.data||"0x"};return e.from&&(c.from=la(e.from)),Oo(s,"CALL_EXCEPTION",{action:t,data:n,reason:a,transaction:c,invocation:o,revert:l})}var dy,zC;const mB=class mB{constructor(){Un(this,dy)}getDefaultValue(e){const n=e.map(s=>Cr(this,dy,zC).call(this,cu.from(s)));return new HP(n,"_").defaultValue()}encode(e,n){JIe(n.length,e.length,"types/values length mismatch");const r=e.map(o=>Cr(this,dy,zC).call(this,cu.from(o))),s=new HP(r,"_"),a=new Gee;return s.encode(a,n),a.data}decode(e,n,r){const s=e.map(o=>Cr(this,dy,zC).call(this,cu.from(o)));return new HP(s,"_").decode(new Kee(n,r,Ige))}static _setDefaultMaxInflation(e){An(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Ige=e}static defaultAbiCoder(){return XV==null&&(XV=new mB),XV}static getBuiltinCallException(e,n,r){return XCt(e,n,r,mB.defaultAbiCoder())}};dy=new WeakSet,zC=function(e){if(e.isArray())return new h6t(Cr(this,dy,zC).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new HP(e.components.map(r=>Cr(this,dy,zC).call(this,r)),e.name);switch(e.baseType){case"address":return new d6t(e.name);case"bool":return new p6t(e.name);case"string":return new S6t(e.name);case"bytes":return new m6t(e.name);case"":return new b6t(e.name)}let n=e.type.match(YCt);if(n){let r=parseInt(n[2]||"256");return An(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new C6t(r/8,n[1]==="int",e.name)}if(n=e.type.match(KCt),n){let r=parseInt(n[1]);return An(r!==0&&r<=32,"invalid bytes length","param",e),new x6t(r,e.name)}An(!1,"invalid type","type",e.type)};let eE=mB;class QCt{constructor(e,n,r){Gn(this,"fragment");Gn(this,"name");Gn(this,"signature");Gn(this,"topic");Gn(this,"args");const s=e.name,a=e.format();$s(this,{fragment:e,name:s,signature:a,topic:n,args:r})}}class ZCt{constructor(e,n,r,s){Gn(this,"fragment");Gn(this,"name");Gn(this,"args");Gn(this,"signature");Gn(this,"selector");Gn(this,"value");const a=e.name,o=e.format();$s(this,{fragment:e,name:a,args:r,signature:o,selector:n,value:s})}}class JCt{constructor(e,n,r){Gn(this,"fragment");Gn(this,"name");Gn(this,"args");Gn(this,"signature");Gn(this,"selector");const s=e.name,a=e.format();$s(this,{fragment:e,name:s,args:r,signature:a,selector:n})}}class Pge{constructor(e){Gn(this,"hash");Gn(this,"_isIndexed");$s(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const Fge={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"},Oge={"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&&Fge[t.toString()]&&(e=Fge[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var v0,w0,C0,Nu,tx,QO,ZO;const sw=class sw{constructor(e){Un(this,tx);Gn(this,"fragments");Gn(this,"deploy");Gn(this,"fallback");Gn(this,"receive");Un(this,v0);Un(this,w0);Un(this,C0);Un(this,Nu);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,Xt(this,C0,new Map),Xt(this,v0,new Map),Xt(this,w0,new Map);const r=[];for(const o of n)try{r.push(Y3.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}$s(this,{fragments:Object.freeze(r)});let s=null,a=!1;Xt(this,Nu,this.getAbiCoder()),this.fragments.forEach((o,l)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}$s(this,{deploy:o});return;case"fallback":o.inputs.length===0?a=!0:(An(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${l}]`,o),s=o,a=s.payable);return;case"function":c=Xe(this,C0);break;case"event":c=Xe(this,w0);break;case"error":c=Xe(this,v0);break;default:return}const u=o.format();c.has(u)||c.set(u,o)}),this.deploy||$s(this,{deploy:Vg.from("constructor()")}),$s(this,{fallback:s,receive:a})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return eE.defaultAbiCoder()}getFunctionName(e){const n=Cr(this,tx,QO).call(this,e,null,!1);return An(n,"no matching function","key",e),n.name}hasFunction(e){return!!Cr(this,tx,QO).call(this,e,null,!1)}getFunction(e,n){return Cr(this,tx,QO).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(Xe(this,C0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Xe(this,C0).get(s),r)}}getEventName(e){const n=Cr(this,tx,ZO).call(this,e,null,!1);return An(n,"no matching event","key",e),n.name}hasEvent(e){return!!Cr(this,tx,ZO).call(this,e,null,!1)}getEvent(e,n){return Cr(this,tx,ZO).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(Xe(this,w0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Xe(this,w0).get(s),r)}}getError(e,n){if(xo(e)){const s=e.toLowerCase();if(Oge[s])return ef.from(Oge[s].signature);for(const a of Xe(this,v0).values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of Xe(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(", ");An(!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=Xe(this,v0).get(e);return r||null}forEachError(e){const n=Array.from(Xe(this,v0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(Xe(this,v0).get(s),r)}}_decodeParams(e,n){return Xe(this,Nu).decode(e,n)}_encodeParams(e,n){return Xe(this,Nu).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);An(r,"unknown error","fragment",e),e=r}return An(So(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,So(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);An(r,"unknown error","fragment",e),e=r}return Da([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);An(r,"unknown function","fragment",e),e=r}return An(So(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,So(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);An(r,"unknown function","fragment",e),e=r}return Da([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const a=this.getFunction(e);An(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 Xe(this,Nu).decode(e.outputs,s)}catch{r="could not decode result data"}Dr(!1,r,"BAD_DATA",{value:Kr(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ms(e,"data"),s=eE.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const l=Kr(r.slice(0,4)),c=this.getError(l);if(c)try{const u=Xe(this,Nu).decode(c.inputs,r.slice(4));s.revert={name:c.name,signature:c.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);An(r,"unknown function","fragment",e),e=r}return Kr(Xe(this,Nu).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const a=this.getEvent(e);An(a,"unknown event","eventFragment",e),e=a}Dr(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(a,o)=>a.type==="string"?v1(o):a.type==="bytes"?mo(Kr(o)):(a.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":a.type.match(/^u?int/)?o=b1(o):a.type.match(/^bytes/)?o=Jwt(o,32):a.type==="address"&&Xe(this,Nu).encode(["address"],[o]),g1(Kr(o),32));for(n.forEach((a,o)=>{const l=e.inputs[o];if(!l.indexed){An(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"?An(!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);An(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],a=[];return e.anonymous||r.push(e.topicHash),An(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,l)=>{const c=n[l];if(o.indexed)if(o.type==="string")r.push(v1(c));else if(o.type==="bytes")r.push(mo(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(Xe(this,Nu).encode([o.type],[c]))}else s.push(o),a.push(c)}),{data:Xe(this,Nu).encode(s,a),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const g=this.getEvent(e);An(g,"unknown event","eventFragment",e),e=g}if(r!=null&&!e.anonymous){const g=e.topicHash;An(xo(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?Xe(this,Nu).decode(s,Da(r)):null,c=Xe(this,Nu).decode(a,n,!0),u=[],d=[];let f=0,x=0;return e.inputs.forEach((g,y)=>{let v=null;if(g.indexed)if(l==null)v=new Pge(null);else if(o[y])v=new Pge(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)}),gR.fromItems(u,d)}parseTransaction(e){const n=ms(e.data,"tx.data"),r=_s(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Kr(n.slice(0,4)));if(!s)return null;const a=Xe(this,Nu).decode(s.inputs,n.slice(4));return new ZCt(s,s.selector,a,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new QCt(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=Kr(e),r=this.getError(So(n,0,4));if(!r)return null;const s=Xe(this,Nu).decode(r.inputs,So(n,4));return new JCt(r,r.selector,s)}static from(e){return e instanceof sw?e:typeof e=="string"?new sw(JSON.parse(e)):typeof e.formatJson=="function"?new sw(e.formatJson()):typeof e.format=="function"?new sw(e.format("json")):new sw(e)}};v0=new WeakMap,w0=new WeakMap,C0=new WeakMap,Nu=new WeakMap,tx=new WeakSet,QO=function(e,n,r){if(xo(e)){const a=e.toLowerCase();for(const o of Xe(this,C0).values())if(a===o.selector)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of Xe(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(", ");An(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return a[0]}const s=Xe(this,C0).get(I0.from(e).format());return s||null},ZO=function(e,n,r){if(xo(e)){const a=e.toLowerCase();for(const o of Xe(this,w0).values())if(a===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of Xe(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(", ");An(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return a[0]}const s=Xe(this,w0).get(T0.from(e).format());return s||null};let lte=sw;const XFe=BigInt(0);function k4(t){return t??null}function Cl(t){return t==null?null:t.toString()}class Mge{constructor(e,n,r){Gn(this,"gasPrice");Gn(this,"maxFeePerGas");Gn(this,"maxPriorityFeePerGas");$s(this,{gasPrice:k4(e),maxFeePerGas:k4(n),maxPriorityFeePerGas:k4(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Cl(e),maxFeePerGas:Cl(n),maxPriorityFeePerGas:Cl(r)}}}function tE(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Kr(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=_s(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=$i(t[s],`request.${s}`));return t.accessList&&(e.accessList=T5(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=>P$(s)?Kr(s):Object.assign({},s))),e}var Ig;class e4t{constructor(e,n){Gn(this,"provider");Gn(this,"number");Gn(this,"hash");Gn(this,"timestamp");Gn(this,"parentHash");Gn(this,"parentBeaconBlockRoot");Gn(this,"nonce");Gn(this,"difficulty");Gn(this,"gasLimit");Gn(this,"gasUsed");Gn(this,"stateRoot");Gn(this,"receiptsRoot");Gn(this,"blobGasUsed");Gn(this,"excessBlobGas");Gn(this,"miner");Gn(this,"prevRandao");Gn(this,"extraData");Gn(this,"baseFeePerGas");Un(this,Ig);Xt(this,Ig,e.transactions.map(r=>typeof r!="string"?new nE(r,n):r)),$s(this,{provider:n,hash:k4(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:k4(e.prevRandao),extraData:e.extraData,baseFeePerGas:k4(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return Xe(this,Ig).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=Xe(this,Ig).slice();return e.length===0?[]:(Dr(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:a,hash:o,miner:l,prevRandao:c,nonce:u,number:d,parentHash:f,parentBeaconBlockRoot:x,stateRoot:g,receiptsRoot:y,timestamp:v,transactions:C}=this;return{_type:"Block",baseFeePerGas:Cl(e),difficulty:Cl(n),extraData:r,gasLimit:Cl(s),gasUsed:Cl(a),blobGasUsed:Cl(this.blobGasUsed),excessBlobGas:Cl(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 Xe(this,Ig).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=Xe(this,Ig)[e];else{const r=e.toLowerCase();for(const s of Xe(this,Ig))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;An(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return t4t(this)}}Ig=new WeakMap;class TT{constructor(e,n){Gn(this,"provider");Gn(this,"transactionHash");Gn(this,"blockHash");Gn(this,"blockNumber");Gn(this,"removed");Gn(this,"address");Gn(this,"data");Gn(this,"topics");Gn(this,"index");Gn(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());$s(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:a,removed:o,topics:l,transactionHash:c,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:a,removed:o,topics:l,transactionHash:c,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return Dr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return Dr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return Dr(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return n4t(this)}}var Hk;class QFe{constructor(e,n){Gn(this,"provider");Gn(this,"to");Gn(this,"from");Gn(this,"contractAddress");Gn(this,"hash");Gn(this,"index");Gn(this,"blockHash");Gn(this,"blockNumber");Gn(this,"logsBloom");Gn(this,"gasUsed");Gn(this,"blobGasUsed");Gn(this,"cumulativeGasUsed");Gn(this,"gasPrice");Gn(this,"blobGasPrice");Gn(this,"type");Gn(this,"status");Gn(this,"root");Un(this,Hk);Xt(this,Hk,Object.freeze(e.logs.map(s=>new TT(s,n))));let r=XFe;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),$s(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return Xe(this,Hk)}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:Cl(this.cumulativeGasUsed),from:n,gasPrice:Cl(this.gasPrice),blobGasUsed:Cl(this.blobGasUsed),blobGasPrice:Cl(this.blobGasPrice),gasUsed:Cl(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 JFe(this)}reorderedEvent(e){return Dr(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),ZFe(this,e)}}Hk=new WeakMap;var fy;const Pfe=class Pfe{constructor(e,n){Gn(this,"provider");Gn(this,"blockNumber");Gn(this,"blockHash");Gn(this,"index");Gn(this,"hash");Gn(this,"type");Gn(this,"to");Gn(this,"from");Gn(this,"nonce");Gn(this,"gasLimit");Gn(this,"gasPrice");Gn(this,"maxPriorityFeePerGas");Gn(this,"maxFeePerGas");Gn(this,"maxFeePerBlobGas");Gn(this,"data");Gn(this,"value");Gn(this,"chainId");Gn(this,"signature");Gn(this,"accessList");Gn(this,"blobVersionedHashes");Gn(this,"authorizationList");Un(this,fy);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,Xt(this,fy,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:a,to:o,from:l,nonce:c,data:u,signature:d,accessList:f,blobVersionedHashes:x}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:x,chainId:Cl(this.chainId),data:u,from:l,gasLimit:Cl(this.gasLimit),gasPrice:Cl(this.gasPrice),hash:s,maxFeePerGas:Cl(this.maxFeePerGas),maxPriorityFeePerGas:Cl(this.maxPriorityFeePerGas),maxFeePerBlobGas:Cl(this.maxFeePerBlobGas),nonce:c,signature:d,to:o,index:r,type:a,value:Cl(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=Xe(this,fy),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<Xe(this,fy)&&(o=Xe(this,fy)));o<=x;){if(l)return null;const v=await this.provider.getBlock(o,!0);if(v==null)return;for(const C of v)if(C===this.hash)return;for(let C=0;C<v.length;C++){const N=await v.getTransaction(C);if(N.from===this.from&&N.nonce===this.nonce){if(l)return null;const I=await this.provider.getTransactionReceipt(N.hash);if(I==null||x-I.blockNumber+1<r)return;let P="replaced";N.data===this.data&&N.to===this.to&&N.value===this.value?P="repriced":N.data==="0x"&&N.from===N.to&&N.value===XFe&&(P="cancelled"),Dr(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:P==="replaced"||P==="cancelled",reason:P,replacement:N.replaceableTransaction(a),hash:N.hash,receipt:I})}}o++}},u=x=>{if(x==null||x.status!==0)return x;Dr(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:x.to,from:x.from,data:""},receipt:x})},d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(d);if(d){if(r===1||await d.confirmations()>=r)return u(d)}else if(await c(),r===0)return null;return await new Promise((x,g)=>{const y=[],v=()=>{y.forEach(N=>N())};if(y.push(()=>{l=!0}),s>0){const N=setTimeout(()=>{v(),g(Oo("wait for transaction timeout","TIMEOUT"))},s);y.push(()=>{clearTimeout(N)})}const C=async N=>{if(await N.confirmations()>=r){v();try{x(u(N))}catch(I){g(I)}}};if(y.push(()=>{this.provider.off(this.hash,C)}),this.provider.on(this.hash,C),a>=0){const N=async()=>{try{await c()}catch(I){if(su(I,"TRANSACTION_REPLACED")){v(),g(I);return}}l||this.provider.once("block",N)};y.push(()=>{this.provider.off("block",N)}),this.provider.once("block",N)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Dr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),JFe(this)}reorderedEvent(e){return Dr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Dr(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ZFe(this,e)}replaceableTransaction(e){An(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new Pfe(this,this.provider);return Xt(n,fy,e),n}};fy=new WeakMap;let nE=Pfe;function t4t(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function ZFe(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function JFe(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 tle extends TT{constructor(n,r,s){super(n,n.provider);Gn(this,"interface");Gn(this,"fragment");Gn(this,"args");const a=r.decodeEventLog(s,n.data,n.topics);$s(this,{args:a,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class eOe extends TT{constructor(n,r){super(n,n.provider);Gn(this,"error");$s(this,{error:r})}}var kS;class r4t extends QFe{constructor(n,r,s){super(s,r);Un(this,kS);Xt(this,kS,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?Xe(this,kS).getEvent(n.topics[0]):null;if(r)try{return new tle(n,Xe(this,kS),r)}catch(s){return new eOe(n,s)}return n})}}kS=new WeakMap;var Vk;class nle extends nE{constructor(n,r,s){super(s,r);Un(this,Vk);Xt(this,Vk,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new r4t(Xe(this,Vk),this.provider,s)}}Vk=new WeakMap;class tOe extends iPe{constructor(n,r,s,a){super(n,r,s);Gn(this,"log");$s(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class s4t extends tOe{constructor(e,n,r,s,a){super(e,n,r,new tle(a,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);$s(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Rge=BigInt(0);function nOe(t){return t&&typeof t.call=="function"}function rOe(t){return t&&typeof t.estimateGas=="function"}function q$(t){return t&&typeof t.resolveName=="function"}function sOe(t){return t&&typeof t.sendTransaction=="function"}function iOe(t){if(t!=null){if(q$(t))return t;if(t.provider)return t.provider}}var Wk;class i4t{constructor(e,n,r){Un(this,Wk);Gn(this,"fragment");if($s(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=X3(e.runner,"resolveName"),a=q$(s)?s:null;Xt(this,Wk,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 Xe(this,Wk)}}Wk=new WeakMap;function X3(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function pw(t){return t==null?null:t.provider||null}async function aOe(t,e){const n=Uu.dereference(t,"overrides");An(typeof n=="object","invalid overrides parameter","overrides",t);const r=tE(n);return An(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),An(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function a4t(t,e,n){const r=X3(t,"resolveName"),s=q$(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 o4t(t){const e=async function(o){const l=await aOe(o,["data"]);l.to=await t.getAddress(),l.from&&(l.from=await Oc(l.from,iOe(t.runner)));const c=t.interface,u=_s(l.value||Rge,"overrides.value")===Rge,d=(l.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!d&&!u&&An(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),An(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);const f=c.receive||c.fallback&&c.fallback.payable;return An(f||u,"cannot send value to non-payable fallback","overrides.value",l.value),An(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},n=async function(o){const l=X3(t.runner,"call");Dr(nOe(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 Doe(u)&&u.data?t.interface.makeError(u.data,c):u}},r=async function(o){const l=t.runner;Dr(sOe(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await l.sendTransaction(await e(o)),u=pw(t.runner);return new nle(t.interface,u,c)},s=async function(o){const l=X3(t.runner,"estimateGas");return Dr(rOe(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await e(o))},a=async o=>await r(o);return $s(a,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),a}function l4t(t,e){const n=function(...u){const d=t.interface.getFunction(e,u);return Dr(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),d},r=async function(...u){const d=n(...u);let f={};if(d.inputs.length+1===u.length&&(f=await aOe(u.pop()),f.from&&(f.from=await Oc(f.from,iOe(t.runner)))),d.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const x=await a4t(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;Dr(sOe(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await d.sendTransaction(await r(...u)),x=pw(t.runner);return new nle(t.interface,x,f)},o=async function(...u){const d=X3(t.runner,"estimateGas");return Dr(rOe(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...u))},l=async function(...u){const d=X3(t.runner,"call");Dr(nOe(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 Doe(y)&&y.data?t.interface.makeError(y.data,f):y}const g=n(...u);return t.interface.decodeFunctionResult(g,x)},c=async(...u)=>n(...u).constant?await s(...u):await a(...u);return $s(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:a,staticCall:s,staticCallResult:l}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return Dr(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function c4t(t,e){const n=function(...s){const a=t.interface.getEvent(e,s);return Dr(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),a},r=function(...s){return new i4t(t,n(...s),s)};return $s(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return Dr(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const SR=Symbol.for("_ethersInternal_contract"),oOe=new WeakMap;function u4t(t,e){oOe.set(t[SR],e)}function $f(t){return oOe.get(t[SR])}function d4t(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function rle(t,e){let n,r=null;if(Array.isArray(e)){const a=function(o){if(xo(o,32))return o;const l=t.interface.getEvent(o);return An(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"?xo(e,32)?n=[e]:(r=t.interface.getEvent(e),An(r,"unknown fragment","event",e),n=[r.topicHash]):d4t(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):An(!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 Y7(t,e){const{subs:n}=$f(t);return n.get((await rle(t,e)).tag)||null}async function Lge(t,e,n){const r=pw(t.runner);Dr(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:a,topics:o}=await rle(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 N=s;if(N==null)try{N=t.interface.getEvent(C.topics[0])}catch{}if(N){const I=N,P=s?t.interface.decodeEventLog(s,C.data,C.topics):[];ute(t,n,P,M=>new s4t(t,M,n,I,C))}else ute(t,n,[],I=>new tOe(t,I,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 Y7(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 ute(t,e,n,r){try{await cte}catch{}const s=f4t(t,e,n,r);return cte=s,await s}const WP=["then"];var vAe;vAe=SR;const n_=class n_{constructor(e,n,r,s){Gn(this,"target");Gn(this,"interface");Gn(this,"runner");Gn(this,"filters");Gn(this,vAe);Gn(this,"fallback");An(typeof e=="string"||fFe(e),"invalid value for Contract target","target",e),r==null&&(r=null);const a=lte.from(n);$s(this,{target:e,runner:r,interface:a}),Object.defineProperty(this,SR,{value:{}});let o,l=null,c=null;if(s){const f=pw(r);c=new nle(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(xo(e))l=e,o=Promise.resolve(e);else{const f=X3(r,"resolveName");if(!q$(f))throw Oo("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(x=>{if(x==null)throw Oo("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});u4t(this,{addrPromise:o,addr:l,deployTx:c,subs:u});const d=new Proxy({},{get:(f,x,g)=>{if(typeof x=="symbol"||WP.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)=>WP.indexOf(x)>=0?Reflect.has(f,x):Reflect.has(f,x)||this.interface.hasEvent(String(x))});return $s(this,{filters:d}),$s(this,{fallback:a.receive||a.fallback?o4t(this):null}),new Proxy(this,{get:(f,x,g)=>{if(typeof x=="symbol"||x in f||WP.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||WP.indexOf(x)>=0?Reflect.has(f,x):f.interface.hasFunction(x)})}connect(e){return new n_(this.target,this.interface,e)}attach(e){return new n_(e,this.interface,this.runner)}async getAddress(){return await $f(this).addrPromise}async getDeployedCode(){const e=pw(this.runner);Dr(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=pw(this.runner);return Dr(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,a)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(l){a(l)}};o()})}deploymentTransaction(){return $f(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),l4t(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),c4t(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 rle(this,e),u={address:o,topics:c,fromBlock:n,toBlock:r},d=pw(this.runner);return Dr(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(u)).map(f=>{let x=l;if(x==null)try{x=this.interface.getEvent(f.topics[0])}catch{}if(x)try{return new tle(f,this.interface,x)}catch(g){return new eOe(f,g)}return new TT(f,d)})}async on(e,n){const r=await Lge(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await Lge(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await ute(this,e,n,null)}async listenerCount(e){if(e){const s=await Y7(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 Y7(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 Y7(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 Y7(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 n_{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 dte=n_;function h4t(){return dte}let j9=class extends h4t(){};function QV(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):An(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class p4t{constructor(e){Gn(this,"name");$s(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const lOe=new RegExp("^(ipfs)://(.*)$","i"),Dge=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),lOe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var hy,Xw,py,HC,xB,cOe;const g4=class g4{constructor(e,n,r){Un(this,py);Gn(this,"provider");Gn(this,"address");Gn(this,"name");Un(this,hy);Un(this,Xw);$s(this,{provider:e,address:n,name:r}),Xt(this,hy,null),Xt(this,Xw,new j9(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 Xe(this,hy)==null&&Xt(this,hy,(async()=>{try{return await Xe(this,Xw).supportsInterface("0x9061b923")}catch(e){if(su(e,"CALL_EXCEPTION"))return!1;throw Xt(this,hy,null),e}})()),await Xe(this,hy)}async getAddress(e){if(e==null&&(e=60),e===60)try{const a=await Cr(this,py,HC).call(this,"addr(bytes32)");return a==null||a===K_?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 Cr(this,py,HC).call(this,"addr(bytes32,uint)",[a]);if(xo(o,20))return la(o)}let n=null;for(const a of this.provider.plugins)if(a instanceof p4t&&a.supportsCoinType(e)){n=a;break}if(n==null)return null;const r=await Cr(this,py,HC).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;Dr(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await Cr(this,py,HC).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await Cr(this,py,HC).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}://${sPe("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;Dr(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<Dge.length;r++){const s=n.match(Dge[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=QV(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 j9(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(a==="erc721"){const v=await d.ownerOf(u);if(l!==v)return e.push({type:"!owner",value:v}),{url:null,linkage:e};e.push({type:"owner",value:v})}else if(a==="erc1155"){const v=await d.balanceOf(l,u);if(!v)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:v.toString()})}let f=await d[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),a==="erc1155"&&(f=f.replace("{id}",b1(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=QV(f)),e.push({type:"metadata-url",value:f});let x={};const g=await new r2(f).send();g.assertOk();try{x=g.bodyJson}catch{try{e.push({type:"!metadata",value:g.bodyText})}catch{const N=g.body;return N&&e.push({type:"!metadata",value:Kr(N)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!x)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(x)});let y=x.image;if(typeof y!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!y.match(/^(https:\/\/|data:)/i)){if(y.match(lOe)==null)return e.push({type:"!imageUrl-ipfs",value:y}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:y}),y=QV(y)}return e.push({type:"url",value:y}),{linkage:e,url:y}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return Dr(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const a=await Cr(s=g4,xB,cOe).call(s,e,r);if(a!=null){const o=new g4(e,a,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};hy=new WeakMap,Xw=new WeakMap,py=new WeakSet,HC=async function(e,n){n=(n||[]).slice();const r=Xe(this,Xw).interface;n.unshift(ate(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),Dr(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[ECt(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const a=await Xe(this,Xw)[e](...n);return s?r.decodeFunctionResult(s,a)[0]:a}catch(a){if(!su(a,"CALL_EXCEPTION"))throw a}return null},xB=new WeakSet,cOe=async function(e,n){const r=await g4.getEnsAddress(e);try{const a=await new j9(r,["function resolver(bytes32) view returns (address)"],e).resolver(ate(n),{enableCcipRead:!0});return a===K_?null:a}catch(s){throw s}return null},Un(g4,xB);let NR=g4;const Bge=BigInt(0);function sa(t,e){return function(n){return n==null?e:t(n)}}function rE(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 IT(t,e){return n=>{const r={};for(const s in t){let a=s;if(e&&s in e&&!(a in n)){for(const o of e[s])if(o in n){a=o;break}}try{const o=t[s](n[a]);o!==void 0&&(r[s]=o)}catch(o){const l=o instanceof Error?o.message:"not-an-error";Dr(!1,`invalid value for value.${s} (${l})`,"BAD_DATA",{value:n})}}return r}}function m4t(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}An(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function pN(t){return An(xo(t,!0),"invalid data","value",t),t}function ru(t){return An(xo(t,32),"invalid hash","value",t),t}const x4t=IT({address:la,blockHash:ru,blockNumber:$i,data:pN,index:$i,removed:sa(m4t,!1),topics:rE(ru),transactionHash:ru,transactionIndex:$i},{index:["logIndex"]});function g4t(t){return x4t(t)}const b4t=IT({hash:sa(ru),parentHash:ru,parentBeaconBlockRoot:sa(ru,null),number:$i,timestamp:$i,nonce:sa(pN),difficulty:_s,gasLimit:_s,gasUsed:_s,stateRoot:sa(ru,null),receiptsRoot:sa(ru,null),blobGasUsed:sa(_s,null),excessBlobGas:sa(_s,null),miner:sa(la),prevRandao:sa(ru,null),extraData:pN,baseFeePerGas:sa(_s)},{prevRandao:["mixHash"]});function y4t(t){const e=b4t(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:uOe(n)),e}const v4t=IT({transactionIndex:$i,blockNumber:$i,transactionHash:ru,address:la,topics:rE(ru),data:pN,index:$i,blockHash:ru},{index:["logIndex"]});function w4t(t){return v4t(t)}const C4t=IT({to:sa(la,null),from:sa(la,null),contractAddress:sa(la,null),index:$i,root:sa(Kr),gasUsed:_s,blobGasUsed:sa(_s,null),logsBloom:sa(pN),blockHash:ru,hash:ru,logs:rE(w4t),blockNumber:$i,cumulativeGasUsed:_s,effectiveGasPrice:sa(_s),blobGasPrice:sa(_s,null),status:sa($i),type:sa($i,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function S4t(t){return C4t(t)}function uOe(t){t.to&&_s(t.to)===Bge&&(t.to="0x0000000000000000000000000000000000000000");const e=IT({hash:ru,index:sa($i,void 0),type:n=>n==="0x"||n==null?0:$i(n),accessList:sa(T5,null),blobVersionedHashes:sa(rE(ru,!0),null),authorizationList:sa(rE(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:la(n.address),chainId:_s(n.chainId),nonce:_s(n.nonce),signature:lu.from(r)}},!1),null),blockHash:sa(ru,null),blockNumber:sa($i,null),transactionIndex:sa($i,null),from:la,gasPrice:sa(_s),maxPriorityFeePerGas:sa(_s),maxFeePerGas:sa(_s),maxFeePerBlobGas:sa(_s,null),gasLimit:_s,to:sa(la,null),value:_s,nonce:$i,data:pN,creates:sa(la,null),chainId:sa(_s,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=u6t(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&&_s(e.blockHash)===Bge&&(e.blockHash=null),e}const N4t="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class PT{constructor(e){Gn(this,"name");$s(this,{name:e})}clone(){return new PT(this.name)}}class G$ extends PT{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);Gn(this,"effectiveBlock");Gn(this,"txBase");Gn(this,"txCreate");Gn(this,"txDataZero");Gn(this,"txDataNonzero");Gn(this,"txAccessListStorageKey");Gn(this,"txAccessListAddress");const s={effectiveBlock:n};function a(o,l){let c=(r||{})[o];c==null&&(c=l),An(typeof c=="number",`invalud value for ${o}`,"costs",r),s[o]=c}a("txBase",21e3),a("txCreate",32e3),a("txDataZero",4),a("txDataNonzero",16),a("txAccessListStorageKey",1900),a("txAccessListAddress",2400),$s(this,s)}clone(){return new G$(this.effectiveBlock,this)}}class K$ extends PT{constructor(n,r){super("org.ethers.plugins.network.Ens");Gn(this,"address");Gn(this,"targetNetwork");$s(this,{address:n||N4t,targetNetwork:r??1})}clone(){return new K$(this.address,this.targetNetwork)}}var qk,Gk;class j4t extends PT{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");Un(this,qk);Un(this,Gk);Xt(this,qk,n),Xt(this,Gk,r)}get url(){return Xe(this,qk)}get processFunc(){return Xe(this,Gk)}clone(){return this}}qk=new WeakMap,Gk=new WeakMap;const ZV=new Map;var TS,IS,my,Zg;let Ay=(Zg=class{constructor(e,n){Un(this,TS);Un(this,IS);Un(this,my);Xt(this,TS,e),Xt(this,IS,_s(n)),Xt(this,my,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return Xe(this,TS)}set name(e){Xt(this,TS,e)}get chainId(){return Xe(this,IS)}set chainId(e){Xt(this,IS,_s(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===_s(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===_s(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===_s(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(Xe(this,my).values())}attachPlugin(e){if(Xe(this,my).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Xe(this,my).set(e.name,e.clone()),this}getPlugin(e){return Xe(this,my).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Zg(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 G$;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=T5(e.accessList);for(const a in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[a].storageKeys.length}return r}static from(e){if(A4t(),e==null)return Zg.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=ZV.get(e);if(n)return n();if(typeof e=="bigint")return new Zg("unknown",e);An(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){An(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Zg(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new K$(e.ensAddress,e.ensNetwork)),n}An(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=ZV.get(e);r&&An(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),ZV.set(e,n)}},TS=new WeakMap,IS=new WeakMap,my=new WeakMap,Zg);function $ge(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 Uge(t){return new j4t(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:$ge(l.maxFee,9),maxPriorityFeePerGas:$ge(l.maxPriorityFee,9)}}catch(a){Dr(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:a})}})}let zge=!1;function A4t(){if(zge)return;zge=!0;function t(e,n,r){const s=function(){const a=new Ay(e,n);return r.ensNetwork!=null&&a.attachPlugin(new K$(null,r.ensNetwork)),a.attachPlugin(new G$),(r.plugins||[]).forEach(o=>{a.attachPlugin(o)}),a};Ay.register(e,s),Ay.register(n,s),r.altNames&&r.altNames.forEach(a=>{Ay.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:[Uge("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[Uge("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 fte(t){return JSON.parse(JSON.stringify(t))}var Pg,Gh,xy,S0,PS,JO;class _4t{constructor(e){Un(this,PS);Un(this,Pg);Un(this,Gh);Un(this,xy);Un(this,S0);Xt(this,Pg,e),Xt(this,Gh,null),Xt(this,xy,4e3),Xt(this,S0,-2)}get pollingInterval(){return Xe(this,xy)}set pollingInterval(e){Xt(this,xy,e)}start(){Xe(this,Gh)||(Xt(this,Gh,Xe(this,Pg)._setTimeout(Cr(this,PS,JO).bind(this),Xe(this,xy))),Cr(this,PS,JO).call(this))}stop(){Xe(this,Gh)&&(Xe(this,Pg)._clearTimeout(Xe(this,Gh)),Xt(this,Gh,null))}pause(e){this.stop(),e&&Xt(this,S0,-2)}resume(){this.start()}}Pg=new WeakMap,Gh=new WeakMap,xy=new WeakMap,S0=new WeakMap,PS=new WeakSet,JO=async function(){try{const e=await Xe(this,Pg).getBlockNumber();if(Xe(this,S0)===-2){Xt(this,S0,e);return}if(e!==Xe(this,S0)){for(let n=Xe(this,S0)+1;n<=e;n++){if(Xe(this,Gh)==null)return;await Xe(this,Pg).emit("block",n)}Xt(this,S0,e)}}catch{}Xe(this,Gh)!=null&&Xt(this,Gh,Xe(this,Pg)._setTimeout(Cr(this,PS,JO).bind(this),Xe(this,xy)))};var Qw,Zw,gy;class sle{constructor(e){Un(this,Qw);Un(this,Zw);Un(this,gy);Xt(this,Qw,e),Xt(this,gy,!1),Xt(this,Zw,n=>{this._poll(n,Xe(this,Qw))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){Xe(this,gy)||(Xt(this,gy,!0),Xe(this,Zw).call(this,-2),Xe(this,Qw).on("block",Xe(this,Zw)))}stop(){Xe(this,gy)&&(Xt(this,gy,!1),Xe(this,Qw).off("block",Xe(this,Zw)))}pause(e){this.stop()}resume(){this.start()}}Qw=new WeakMap,Zw=new WeakMap,gy=new WeakMap;var FS,Fg;class E4t extends sle{constructor(n,r){super(n);Un(this,FS);Un(this,Fg);Xt(this,FS,r),Xt(this,Fg,-2)}pause(n){n&&Xt(this,Fg,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(Xe(this,FS));s!=null&&(Xe(this,Fg)===-2?Xt(this,Fg,s.number):s.number>Xe(this,Fg)&&(r.emit(Xe(this,FS),s.number),Xt(this,Fg,s.number)))}}FS=new WeakMap,Fg=new WeakMap;var gB;class k4t extends sle{constructor(n,r){super(n);Un(this,gB);Xt(this,gB,fte(r))}async _poll(n,r){throw new Error("@TODO")}}gB=new WeakMap;var OS;class T4t extends sle{constructor(n,r){super(n);Un(this,OS);Xt(this,OS,r)}async _poll(n,r){const s=await r.getTransactionReceipt(Xe(this,OS));s&&r.emit(Xe(this,OS),s)}}OS=new WeakMap;var Og,MS,RS,by,Kh,bB,dOe;class ile{constructor(e,n){Un(this,bB);Un(this,Og);Un(this,MS);Un(this,RS);Un(this,by);Un(this,Kh);Xt(this,Og,e),Xt(this,MS,fte(n)),Xt(this,RS,Cr(this,bB,dOe).bind(this)),Xt(this,by,!1),Xt(this,Kh,-2)}start(){Xe(this,by)||(Xt(this,by,!0),Xe(this,Kh)===-2&&Xe(this,Og).getBlockNumber().then(e=>{Xt(this,Kh,e)}),Xe(this,Og).on("block",Xe(this,RS)))}stop(){Xe(this,by)&&(Xt(this,by,!1),Xe(this,Og).off("block",Xe(this,RS)))}pause(e){this.stop(),e&&Xt(this,Kh,-2)}resume(){this.start()}}Og=new WeakMap,MS=new WeakMap,RS=new WeakMap,by=new WeakMap,Kh=new WeakMap,bB=new WeakSet,dOe=async function(e){if(Xe(this,Kh)===-2)return;const n=fte(Xe(this,MS));n.fromBlock=Xe(this,Kh)+1,n.toBlock=e;const r=await Xe(this,Og).getLogs(n);if(r.length===0){Xe(this,Kh)<e-60&&Xt(this,Kh,e-60);return}for(const s of r)Xe(this,Og).emit(Xe(this,MS),s),Xt(this,Kh,s.blockNumber)};const I4t=BigInt(2),P4t=10;function qP(t){return t&&typeof t.then=="function"}function eM(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 fOe{constructor(e){Gn(this,"name");$s(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function F4t(t){return JSON.parse(JSON.stringify(t))}function hte(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function JV(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(xo(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:eM("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:eM("orphan",n),filter:F4t(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?hte(s.map(a=>a.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],a=[],o=l=>{xo(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=hte(s.map(l=>l.toLowerCase()))}return{filter:r,tag:eM("event",r),type:"event"}}An(!1,"unknown ProviderEvent","event",t)}function eW(){return new Date().getTime()}const O4t={cacheTimeout:250,pollingInterval:4e3};var ju,yy,Au,LS,Wf,Jw,vy,Mg,Kk,Yh,DS,BS,Wi,Lf,pte,mte,X7,xte,Q7,tM;class M4t{constructor(e,n){Un(this,Wi);Un(this,ju);Un(this,yy);Un(this,Au);Un(this,LS);Un(this,Wf);Un(this,Jw);Un(this,vy);Un(this,Mg);Un(this,Kk);Un(this,Yh);Un(this,DS);Un(this,BS);if(Xt(this,BS,Object.assign({},O4t,n||{})),e==="any")Xt(this,Jw,!0),Xt(this,Wf,null);else if(e){const r=Ay.from(e);Xt(this,Jw,!1),Xt(this,Wf,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else Xt(this,Jw,!1),Xt(this,Wf,null);Xt(this,Mg,-1),Xt(this,vy,new Map),Xt(this,ju,new Map),Xt(this,yy,new Map),Xt(this,Au,null),Xt(this,LS,!1),Xt(this,Kk,1),Xt(this,Yh,new Map),Xt(this,DS,!1)}get pollingInterval(){return Xe(this,BS).pollingInterval}get provider(){return this}get plugins(){return Array.from(Xe(this,yy).values())}attachPlugin(e){if(Xe(this,yy).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Xe(this,yy).set(e.name,e.connect(this)),this}getPlugin(e){return Xe(this,yy).get(e)||null}get disableCcipRead(){return Xe(this,DS)}set disableCcipRead(e){Xt(this,DS,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),a=n.toLowerCase(),o=[];for(let l=0;l<r.length;l++){const c=r[l],u=c.replace("{sender}",s).replace("{data}",a),d=new r2(u);c.indexOf("{data}")===-1&&(d.body={data:a,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:d,index:l,urls:r});let f="unknown error",x;try{x=await d.send()}catch(g){o.push(g.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:{error:g}});continue}try{const g=x.bodyJson;if(g.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:d,result:g}),g.data;g.message&&(f=g.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:g})}catch{}Dr(x.statusCode<400||x.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:f}}),o.push(f)}Dr(!1,`error encountered during CCIP fetch: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new e4t(y4t(e),this)}_wrapLog(e,n){return new TT(g4t(e),this)}_wrapTransactionReceipt(e,n){return new QFe(S4t(e),this)}_wrapTransactionResponse(e,n){return new nE(uOe(e),this)}_detectNetwork(){Dr(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Dr(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=$i(await Cr(this,Wi,Lf).call(this,{method:"getBlockNumber"}),"%response");return Xe(this,Mg)>=0&&Xt(this,Mg,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(xo(e))return xo(e,32)?e:cm(e);if(typeof e=="bigint"&&(e=$i(e,"blockTag")),typeof e=="number")return e>=0?cm(e):Xe(this,Mg)>=0?cm(Xe(this,Mg)+e):this.getBlockNumber().then(n=>cm(n+e));An(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?hte(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=tE(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const a=Oc(n[s],this);qP(a)?r.push(async function(){n[s]=await a}()):n[s]=a}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);qP(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(Xe(this,Wf)==null){const s=(async()=>{try{const a=await this._detectNetwork();return this.emit("network",a,null),a}catch(a){throw Xe(this,Wf)===s&&Xt(this,Wf,null),a}})();return Xt(this,Wf,s),(await s).clone()}const e=Xe(this,Wf),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(Xe(this,Jw)?(this.emit("network",r,n),Xe(this,Wf)===e&&Xt(this,Wf,Promise.resolve(r))):Dr(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:a,priorityFee:o}=await Eu({_block:Cr(this,Wi,xte).call(this,"latest",!1),gasPrice:(async()=>{try{const d=await Cr(this,Wi,Lf).call(this,{method:"getGasPrice"});return _s(d,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const d=await Cr(this,Wi,Lf).call(this,{method:"getPriorityFee"});return _s(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*I4t+c),new Mge(a,l,c)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new r2(r.url),a=await r.processFunc(n,this,s);return new Mge(a.gasPrice,a.maxFeePerGas,a.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return qP(n)&&(n=await n),_s(await Cr(this,Wi,Lf).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 Cr(this,Wi,mte).call(this,Cr(this,Wi,pte).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return _s(await Cr(this,Wi,X7).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return $i(await Cr(this,Wi,X7).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return Kr(await Cr(this,Wi,X7).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=_s(n,"position");return Kr(await Cr(this,Wi,X7).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=Qoe.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:Cr(this,Wi,xte).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:Cr(this,Wi,Lf).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:Cr(this,Wi,Lf).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await Cr(this,Wi,Lf).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:Cr(this,Wi,Lf).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:Kr(n)}async getLogs(e){let n=this._getFilter(e);qP(n)&&(n=await n);const{network:r,params:s}=await Eu({network:this.getNetwork(),params:Cr(this,Wi,Lf).call(this,{method:"getLogs",filter:n})});return s.map(a=>this._wrapLog(a,r))}_getProvider(e){Dr(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await NR.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=la(e);const n=ate(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await NR.getEnsAddress(this),a=await new j9(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(a==null||a===K_)return null;const l=await new j9(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(Oo("timeout","TIMEOUT",{reason:"timeout"})))},r)),c(await this.getBlockNumber())})}async waitForBlock(e){Dr(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=Xe(this,Yh).get(e);n&&(n.timer&&clearTimeout(n.timer),Xe(this,Yh).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=gb(this,Kk)._++,s=()=>{Xe(this,Yh).delete(r),e()};if(this.paused)Xe(this,Yh).set(r,{timer:null,func:s,time:n});else{const a=setTimeout(s,n);Xe(this,Yh).set(r,{timer:a,func:s,time:eW()})}return r}_forEachSubscriber(e){for(const n of Xe(this,ju).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new fOe(e.type);case"block":{const n=new _4t(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new E4t(this,e.type);case"event":return new ile(this,e.filter);case"transaction":return new T4t(this,e.hash);case"orphan":return new k4t(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of Xe(this,ju).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),Xe(this,Au)!=null&&n.pause(Xe(this,Au));break}}async on(e,n){const r=await Cr(this,Wi,tM).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,Xe(this,Au)!=null&&r.subscriber.pause(Xe(this,Au))),this}async once(e,n){const r=await Cr(this,Wi,tM).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,Xe(this,Au)!=null&&r.subscriber.pause(Xe(this,Au))),this}async emit(e,...n){const r=await Cr(this,Wi,Q7).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 iPe(this,o?null:a,e);try{a.call(this,...n,l)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),Xe(this,ju).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await Cr(this,Wi,Q7).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of Xe(this,ju).values())n+=r.length;return n}async listeners(e){if(e){const r=await Cr(this,Wi,Q7).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of Xe(this,ju).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await Cr(this,Wi,Q7).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(),Xe(this,ju).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await Cr(this,Wi,tM).call(this,e);r&&s.stop(),Xe(this,ju).delete(n)}else for(const[n,{started:r,subscriber:s}]of Xe(this,ju))r&&s.stop(),Xe(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 Xe(this,LS)}destroy(){this.removeAllListeners();for(const e of Xe(this,Yh).keys())this._clearTimeout(e);Xt(this,LS,!0)}get paused(){return Xe(this,Au)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(Xt(this,Mg,-1),Xe(this,Au)!=null){if(Xe(this,Au)==!!e)return;Dr(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),Xt(this,Au,!!e);for(const n of Xe(this,Yh).values())n.timer&&clearTimeout(n.timer),n.time=eW()-n.time}resume(){if(Xe(this,Au)!=null){this._forEachSubscriber(e=>e.resume()),Xt(this,Au,null);for(const e of Xe(this,Yh).values()){let n=e.time;n<0&&(n=0),e.time=eW(),setTimeout(e.func,n)}}}}ju=new WeakMap,yy=new WeakMap,Au=new WeakMap,LS=new WeakMap,Wf=new WeakMap,Jw=new WeakMap,vy=new WeakMap,Mg=new WeakMap,Kk=new WeakMap,Yh=new WeakMap,DS=new WeakMap,BS=new WeakMap,Wi=new WeakSet,Lf=async function(e){const n=Xe(this,BS).cacheTimeout;if(n<0)return await this._perform(e);const r=eM(e.method,e);let s=Xe(this,vy).get(r);return s||(s=this._perform(e),Xe(this,vy).set(r,s),setTimeout(()=>{Xe(this,vy).get(r)===s&&Xe(this,vy).delete(r)},n)),await s},pte=async function(e,n,r){Dr(r<P4t,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=tE(e);try{return Kr(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(a){if(!this.disableCcipRead&&Doe(a)&&a.data&&r>=0&&n==="latest"&&s.to!=null&&So(a.data,0,4)==="0x556f1830"){const o=a.data,l=await Oc(s.to,this);let c;try{c=$4t(So(a.data,4))}catch(f){Dr(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}Dr(c.sender.toLowerCase()===l.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(s,c.calldata,c.urls);Dr(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:a.data,errorArgs:c.errorArgs}});const d={to:l,data:Da([c.selector,B4t([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:d});try{const f=await Cr(this,Wi,pte).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}},mte=async function(e){const{value:n}=await Eu({network:this.getNetwork(),value:e});return n},X7=async function(e,n,r){let s=this._getAddress(n),a=this._getBlockTag(r);return(typeof s!="string"||typeof a!="string")&&([s,a]=await Promise.all([s,a])),await Cr(this,Wi,mte).call(this,Cr(this,Wi,Lf).call(this,Object.assign(e,{address:s,blockTag:a})))},xte=async function(e,n){if(xo(e,32))return await Cr(this,Wi,Lf).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await Cr(this,Wi,Lf).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Q7=async function(e,n){let r=await JV(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await JV({orphan:"drop-log",log:n[0]},this)),Xe(this,ju).get(r.tag)||null},tM=async function(e){const n=await JV(e,this),r=n.tag;let s=Xe(this,ju).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},Xe(this,ju).set(r,s)),s};function R4t(t,e){try{const n=gte(t,e);if(n)return xR(n)}catch{}return null}function gte(t,e){if(t==="0x")return null;try{const n=$i(So(t,e,e+32)),r=$i(So(t,n,n+32));return So(t,n+32,n+32+r)}catch{}return null}function Hge(t){const e=ul(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function L4t(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const D4t=new Uint8Array([]);function B4t(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(D4t),n+=32;for(let r=0;r<t.length;r++){const s=ms(t[r]);e[r]=Hge(n),e.push(Hge(s.length)),e.push(L4t(s)),n+=32+Math.ceil(s.length/32)*32}return Da(e)}const Vge="0x0000000000000000000000000000000000000000000000000000000000000000";function $4t(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};Dr(A4(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=So(t,0,32);Dr(So(n,0,12)===So(Vge,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=So(n,12);try{const r=[],s=$i(So(t,32,64)),a=$i(So(t,s,s+32)),o=So(t,s+32);for(let l=0;l<a;l++){const c=R4t(o,l*32);if(c==null)throw new Error("abort");r.push(c)}e.urls=r}catch{Dr(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=gte(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{Dr(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}Dr(So(t,100,128)===So(Vge,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=So(t,96,100);try{const r=gte(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{Dr(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function jv(t,e){if(t.provider)return t.provider;Dr(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function Wge(t,e){let n=tE(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])=>(An(s.toLowerCase()===a.toLowerCase(),"transaction from mismatch","tx.from",a),s))}else n.from=t.getAddress();return await Eu(n)}class ale{constructor(e){Gn(this,"provider");$s(this,{provider:e||null})}async getNonce(e){return jv(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Wge(this,e)}async populateTransaction(e){const n=jv(this,"populateTransaction"),r=await Wge(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=_s(r.chainId);An(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)?An(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&a&&An(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();Dr(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,r.gasPrice!=null){const l=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=l,r.maxPriorityFeePerGas=l}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Dr(!a,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):Dr(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3||r.type===4)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await Eu(r)}async populateAuthorization(e){const n=Object.assign({},e);return n.chainId==null&&(n.chainId=(await jv(this,"getNetwork").getNetwork()).chainId),n.nonce==null&&(n.nonce=await this.getNonce()),n}async estimateGas(e){return jv(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return jv(this,"call").call(await this.populateCall(e))}async resolveName(e){return await jv(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=jv(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=Qoe.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}authorize(e){Dr(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}var $S,nM;const Ffe=class Ffe extends ale{constructor(n,r){super(r);Un(this,$S);Gn(this,"address");$s(this,{address:n})}async getAddress(){return this.address}connect(n){return new Ffe(this.address,n)}async signTransaction(n){Cr(this,$S,nM).call(this,"transactions","signTransaction")}async signMessage(n){Cr(this,$S,nM).call(this,"messages","signMessage")}async signTypedData(n,r,s){Cr(this,$S,nM).call(this,"typed-data","signTypedData")}};$S=new WeakSet,nM=function(n,r){Dr(!1,`VoidSigner cannot sign ${n}`,"UNSUPPORTED_OPERATION",{operation:r})};let bte=Ffe;function U4t(t){return JSON.parse(JSON.stringify(t))}var rd,N0,e3,wy,t3,US,x2,yte,vte;class hOe{constructor(e){Un(this,x2);Un(this,rd);Un(this,N0);Un(this,e3);Un(this,wy);Un(this,t3);Un(this,US);Xt(this,rd,e),Xt(this,N0,null),Xt(this,e3,Cr(this,x2,yte).bind(this)),Xt(this,wy,!1),Xt(this,t3,null),Xt(this,US,!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(){Xe(this,wy)||(Xt(this,wy,!0),Cr(this,x2,yte).call(this,-2))}stop(){Xe(this,wy)&&(Xt(this,wy,!1),Xt(this,US,!0),Cr(this,x2,vte).call(this),Xe(this,rd).off("block",Xe(this,e3)))}pause(e){e&&Cr(this,x2,vte).call(this),Xe(this,rd).off("block",Xe(this,e3))}resume(){this.start()}}rd=new WeakMap,N0=new WeakMap,e3=new WeakMap,wy=new WeakMap,t3=new WeakMap,US=new WeakMap,x2=new WeakSet,yte=async function(e){try{Xe(this,N0)==null&&Xt(this,N0,this._subscribe(Xe(this,rd)));let n=null;try{n=await Xe(this,N0)}catch(a){if(!su(a,"UNSUPPORTED_OPERATION")||a.operation!=="eth_newFilter")throw a}if(n==null){Xt(this,N0,null),Xe(this,rd)._recoverSubscriber(this,this._recover(Xe(this,rd)));return}const r=await Xe(this,rd).getNetwork();if(Xe(this,t3)||Xt(this,t3,r),Xe(this,t3).chainId!==r.chainId)throw new Error("chaid changed");if(Xe(this,US))return;const s=await Xe(this,rd).send("eth_getFilterChanges",[n]);await this._emitResults(Xe(this,rd),s)}catch(n){console.log("@TODO",n)}Xe(this,rd).once("block",Xe(this,e3))},vte=function(){const e=Xe(this,N0);e&&(Xt(this,N0,null),e.then(n=>{Xe(this,rd).destroyed||Xe(this,rd).send("eth_uninstallFilter",[n])}))};var n3;class z4t extends hOe{constructor(n,r){super(n);Un(this,n3);Xt(this,n3,U4t(r))}_recover(n){return new ile(n,Xe(this,n3))}async _subscribe(n){return await n.send("eth_newFilter",[Xe(this,n3)])}async _emitResults(n,r){for(const s of r)n.emit(Xe(this,n3),n._wrapLog(s,n._network))}}n3=new WeakMap;class H4t extends hOe{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const V4t="bigint,boolean,function,number,string,symbol".split(/,/g);function rM(t){if(t==null||V4t.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(rM);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 W4t(t){return new Promise(e=>{setTimeout(e,t)})}function oC(t){return t&&t.toLowerCase()}function qge(t){return t&&typeof t.pollingInterval=="number"}const pOe={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class tW extends ale{constructor(n,r){super(n);Gn(this,"address");r=la(r),$s(this,{address:r})}connect(n){Dr(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=rM(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const l=await Oc(o,this.provider);An(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",Oo("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=rM(n);if(r.from){const a=await Oc(r.from,this.provider);An(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",[Kr(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const a=rM(s),o=await hN.resolveNames(n,r,a,async l=>{const c=await Oc(l);return An(c!=null,"TypedData does not support null address","value",l),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(hN.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?bd(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Kr(r)])}}var r3,zS,Rg,j0,nm,Xh,Yd,Yk,wte;class q4t extends M4t{constructor(n,r){super(n,r);Un(this,Yk);Un(this,r3);Un(this,zS);Un(this,Rg);Un(this,j0);Un(this,nm);Un(this,Xh);Un(this,Yd);Xt(this,zS,1),Xt(this,r3,Object.assign({},pOe,r||{})),Xt(this,Rg,[]),Xt(this,j0,null),Xt(this,Xh,null),Xt(this,Yd,null);{let a=null;const o=new Promise(l=>{a=l});Xt(this,nm,{promise:o,resolve:a})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(An(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&Xt(this,Xh,Ay.from(n))):s&&(An(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),Xt(this,Xh,s))}_getOption(n){return Xe(this,r3)[n]}get _network(){return Dr(Xe(this,Xh),"network is not available yet","NETWORK_ERROR"),Xe(this,Xh)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&_s(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(Xe(this,Xh))return Xe(this,Xh)}else return n;return Xe(this,Yd)?await Xe(this,Yd):this.ready?(Xt(this,Yd,(async()=>{try{const r=Ay.from(_s(await this.send("eth_chainId",[])));return Xt(this,Yd,null),r}catch(r){throw Xt(this,Yd,null),r}})()),await Xe(this,Yd)):(Xt(this,Yd,(async()=>{const r={id:gb(this,zS)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],Xt(this,Yd,null)}catch(a){throw Xt(this,Yd,null),this.emit("debug",{action:"receiveRpcError",error:a}),a}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return Ay.from(_s(s.result));throw this.getRpcError(r,s)})()),await Xe(this,Yd))}_start(){Xe(this,nm)==null||Xe(this,nm).resolve==null||(Xe(this,nm).resolve(),Xt(this,nm,null),(async()=>{for(;Xe(this,Xh)==null&&!this.destroyed;)try{Xt(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",Oo("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await W4t(1e3)}Cr(this,Yk,wte).call(this)})())}async _waitUntilReady(){if(Xe(this,nm)!=null)return await Xe(this,nm).promise}_getSubscriber(n){return n.type==="pending"?new H4t(this):n.type==="event"?this._getOption("polling")?new ile(this,n.filter):new z4t(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new fOe("orphan"):super._getSubscriber(n)}get ready(){return Xe(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(_s(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=Kr(n[s]))}),n.accessList&&(r.accessList=T5(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),n.authorizationList&&(r.authorizationList=n.authorizationList.map(s=>{const a=xFe(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:[oC(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[oC(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[oC(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[oC(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(oC):n.filter.address=oC(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 Oo("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:a}});if(c.match(/nonce/i)&&c.match(/too low/i))return Oo("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=Cte(a),u=eE.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(K4t(a));if(typeof a.message=="string"&&a.message.match(/user denied|ethers-user-denied/i))return Oo("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 Oo("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:a}});if(o.match(/nonce/i)&&o.match(/too low/i))return Oo("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:a}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Oo("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:a}});if(o.match(/only replay-protected/i))return Oo("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?Oo("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:a,payload:n}}):Oo("could not coalesce error","UNKNOWN_ERROR",{error:a,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(Oo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=gb(this,zS)._++,a=new Promise((o,l)=>{Xe(this,Rg).push({resolve:o,reject:l,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return Cr(this,Yk,wte).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 tW(this,a[n])}const{accounts:s}=await Eu({network:this.getNetwork(),accounts:r});n=la(n);for(const a of s)if(la(a)===n)return new tW(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new tW(this,r))}destroy(){Xe(this,j0)&&(clearTimeout(Xe(this,j0)),Xt(this,j0,null));for(const{payload:n,reject:r}of Xe(this,Rg))r(Oo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));Xt(this,Rg,[]),super.destroy()}}r3=new WeakMap,zS=new WeakMap,Rg=new WeakMap,j0=new WeakMap,nm=new WeakMap,Xh=new WeakMap,Yd=new WeakMap,Yk=new WeakSet,wte=function(){if(Xe(this,j0))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");Xt(this,j0,setTimeout(()=>{Xt(this,j0,null);const r=Xe(this,Rg);for(Xt(this,Rg,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==Xe(this,r3).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>Xe(this,r3).batchMaxSize){r.unshift(s.pop());break}(async()=>{const a=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:a});try{const o=await this._send(a);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:l,reject:c,payload:u}of s){if(this.destroyed){c(Oo("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=Oo("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),c(f);continue}if("error"in d){c(this.getRpcError(u,d));continue}l(d.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:l}of s)l(o)}})()}},n))};var Cy;class G4t extends q4t{constructor(n,r){super(n,r);Un(this,Cy);let s=this._getOption("pollingInterval");s==null&&(s=pOe.pollingInterval),Xt(this,Cy,s)}_getSubscriber(n){const r=super._getSubscriber(n);return qge(r)&&(r.pollingInterval=Xe(this,Cy)),r}get pollingInterval(){return Xe(this,Cy)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");Xt(this,Cy,n),this._forEachSubscriber(r=>{qge(r)&&(r.pollingInterval=Xe(this,Cy))})}}Cy=new WeakMap;function Cte(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&xo(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=Cte(t[e]);if(n)return n}return null}if(typeof t=="string")try{return Cte(JSON.parse(t))}catch{}return null}function Ste(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)Ste(t[n],e);if(typeof t=="string")try{return Ste(JSON.parse(t),e)}catch{}}}function K4t(t){const e=[];return Ste(t,e),e}var HS,VS;const iw=class iw extends G4t{constructor(n,r,s){const a=Object.assign({},s??{},{batchMaxCount:1});An(n&&n.request,"invalid EIP-1193 provider","ethereum",n);super(r,a);Un(this,HS);Un(this,VS);Xt(this,VS,null),s&&s.providerInfo&&Xt(this,VS,s.providerInfo),Xt(this,HS,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 Xe(this,VS)}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){An(!Array.isArray(n),"EIP-1193 does not support batch request","payload",n);try{const r=await Xe(this,HS).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 Xe(this,HS).call(this,"eth_requestAccounts",[])}catch(r){const s=r.payload;throw this.getRpcError(s,{id:s.id,error:r})}return await super.getSigner(n)}static async discover(n){if(n==null&&(n={}),n.provider)return new iw(n.provider);const r=n.window?n.window:typeof window<"u"?window:null;if(r==null)return null;const s=n.anyProvider;if(s&&r.ethereum)return new iw(r.ethereum);if(!("addEventListener"in r&&"dispatchEvent"in r&&"removeEventListener"in r))return null;const a=n.timeout?n.timeout:300;return a===0?null:await new Promise((o,l)=>{let c=[];const u=x=>{c.push(x.detail),s&&d()},d=()=>{if(clearTimeout(f),c.length)if(n&&n.filter){const x=n.filter(c.map(g=>Object.assign({},g.info)));if(x==null)o(null);else if(x instanceof iw)o(x);else{let g=null;if(x.uuid&&(g=c.filter(v=>x.uuid===v.info.uuid)[0]),g){const{provider:y,info:v}=g;o(new iw(y,void 0,{providerInfo:v}))}else l(Oo("filter returned unknown info","UNSUPPORTED_OPERATION",{value:x}))}}else{const{provider:x,info:g}=c[0];o(new iw(x,void 0,{providerInfo:g}))}else o(null);r.removeEventListener("eip6963:announceProvider",u)},f=setTimeout(()=>{d()},a);r.addEventListener("eip6963:announceProvider",u),r.dispatchEvent(new Event("eip6963:requestProvider"))})}};HS=new WeakMap,VS=new WeakMap;let jR=iw;var WS;const Ofe=class Ofe extends ale{constructor(n,r){super(r);Gn(this,"address");Un(this,WS);An(n&&typeof n.sign=="function","invalid private key","privateKey","[ REDACTED ]"),Xt(this,WS,n);const s=kT(this.signingKey.publicKey);$s(this,{address:s})}get signingKey(){return Xe(this,WS)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(n){return new Ofe(Xe(this,WS),n)}async signTransaction(n){n=tE(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&&(An(la(n.from)===this.address,"transaction from address mismatch","tx.from",n.from),delete n.from);const a=Qoe.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(kCt(n)).serialized}authorizeSync(n){An(typeof n.address=="string","invalid address for authorizeSync","auth.address",n);const r=this.signingKey.sign(V6t(n));return Object.assign({},{address:la(n.address),nonce:_s(n.nonce||0),chainId:_s(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 hN.resolveNames(n,r,s,async o=>{Dr(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const l=await this.provider.resolveName(o);return Dr(l!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),l});return this.signingKey.sign(hN.hash(a.domain,r,a.value)).serialized}};WS=new WeakMap;let AR=Ofe;const _R=" !#$%&'()*+,-./<=>?@[]^_`{|}~",Y4t=/^[a-z]*$/i;function Gge(t,e){let n=97;return t.reduce((r,s)=>(s===e?n++:s.match(Y4t)?r.push(String.fromCharCode(n)+s):(n=97,r.push(s)),r),[])}function X4t(t,e){for(let s=_R.length-1;s>=0;s--)t=t.split(_R[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 Gge(Gge(n,";"),":")}function Q4t(t){return An(t[0]==="0","unsupported auwl data","data",t),X4t(t.substring(1+2*_R.length),t.substring(1,1+2*_R.length))}class Z4t{constructor(e){Gn(this,"locale");$s(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var qS,Xk,s3,Qk,Nte;class J4t extends Z4t{constructor(n,r,s){super(n);Un(this,Qk);Un(this,qS);Un(this,Xk);Un(this,s3);Xt(this,qS,r),Xt(this,Xk,s),Xt(this,s3,null)}get _data(){return Xe(this,qS)}_decodeWords(){return Q4t(Xe(this,qS))}getWord(n){const r=Cr(this,Qk,Nte).call(this);return An(n>=0&&n<r.length,`invalid word index: ${n}`,"index",n),r[n]}getWordIndex(n){return Cr(this,Qk,Nte).call(this).indexOf(n)}}qS=new WeakMap,Xk=new WeakMap,s3=new WeakMap,Qk=new WeakSet,Nte=function(){if(Xe(this,s3)==null){const n=this._decodeWords();if(v1(n.join(`
`)+`
`)!==Xe(this,Xk))throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);Xt(this,s3,n)}return Xe(this,s3)};const eSt="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",tSt="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let nW=null;class Q3 extends J4t{constructor(){super("en",eSt,tSt)}static wordlist(){return nW==null&&(nW=new Q3),nW}}function mOe(t){return(1<<t)-1<<8-t&255}function nSt(t){return(1<<t)-1&255}function rW(t,e){ePe("NFKD"),e==null&&(e=Q3.wordlist());const n=e.split(t);An(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"));An(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=mOe(o),c=ms(xp(r.slice(0,a/8)))[0]&l;return An(c===(r[r.length-1]&l),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),Kr(r.slice(0,a/8))}function sW(t,e){An(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=Q3.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]&nSt(8-r)),r+=3);const s=t.length/4,a=parseInt(xp(t).substring(2,4),16)&mOe(s);return n[n.length-1]<<=s,n[n.length-1]|=a>>8-s,e.join(n.map(o=>e.getWord(o)))}const iW={};class mN{constructor(e,n,r,s,a){Gn(this,"phrase");Gn(this,"password");Gn(this,"wordlist");Gn(this,"entropy");s==null&&(s=""),a==null&&(a=Q3.wordlist()),k5(e,iW,"Mnemonic"),$s(this,{phrase:r,password:s,wordlist:a,entropy:n})}computeSeed(){const e=bd("mnemonic"+this.password,"NFKD");return N2(bd(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,n,r){const s=rW(e,r);return e=sW(ms(s),r),new mN(iW,s,e,n,r)}static fromEntropy(e,n,r){const s=ms(e,"entropy"),a=sW(s,r);return new mN(iW,Kr(s),a,n,r)}static entropyToPhrase(e,n){const r=ms(e,"entropy");return sW(r,n)}static phraseToEntropy(e,n){return rW(e,n)}static isValidMnemonic(e,n){try{return rW(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)},aW=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},sM,Lh,d0;const rSt={16:10,24:12,32:14},sSt=[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],GP=[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],iSt=[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],aSt=[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],oSt=[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],lSt=[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],cSt=[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],uSt=[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],dSt=[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],fSt=[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],hSt=[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],pSt=[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],mSt=[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],xSt=[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 oW(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 ole{get key(){return Xc(this,sM,"f").slice()}constructor(e){if(sM.set(this,void 0),Lh.set(this,void 0),d0.set(this,void 0),!(this instanceof ole))throw Error("AES must be instanitated with `new`");aW(this,sM,new Uint8Array(e),"f");const n=rSt[this.key.length];if(n==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");aW(this,d0,[],"f"),aW(this,Lh,[],"f");for(let d=0;d<=n;d++)Xc(this,d0,"f").push([0,0,0,0]),Xc(this,Lh,"f").push([0,0,0,0]);const r=(n+1)*4,s=this.key.length/4,a=oW(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,Lh,"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]^sSt[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,Lh,"f")[n-f][x]=a[d++],c++}for(let d=1;d<n;d++)for(let f=0;f<4;f++)u=Xc(this,Lh,"f")[d][f],Xc(this,Lh,"f")[d][f]=hSt[u>>24&255]^pSt[u>>16&255]^mSt[u>>8&255]^xSt[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=oW(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]=iSt[s[c]>>24&255]^aSt[s[(c+1)%4]>>16&255]^oSt[s[(c+2)%4]>>8&255]^lSt[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,Lh,"f").length-1,r=[0,0,0,0];let s=oW(e);for(let l=0;l<4;l++)s[l]^=Xc(this,Lh,"f")[0][l];for(let l=1;l<n;l++){for(let c=0;c<4;c++)r[c]=cSt[s[c]>>24&255]^uSt[s[(c+3)%4]>>16&255]^dSt[s[(c+2)%4]>>8&255]^fSt[s[(c+1)%4]&255]^Xc(this,Lh,"f")[l][c];s=r.slice()}const a=new Uint8Array(16);let o=0;for(let l=0;l<4;l++)o=Xc(this,Lh,"f")[n][l],a[4*l]=(GP[s[l]>>24&255]^o>>24)&255,a[4*l+1]=(GP[s[(l+3)%4]>>16&255]^o>>16)&255,a[4*l+2]=(GP[s[(l+2)%4]>>8&255]^o>>8)&255,a[4*l+3]=(GP[s[(l+1)%4]&255]^o)&255;return a}}sM=new WeakMap,Lh=new WeakMap,d0=new WeakMap;class xOe{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 ole(n)},name:{enumerable:!0,value:e}})}}var KP=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},lC=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)},Z7,hg;class lle extends xOe{constructor(e,n){if(super("ECC",e,lle),Z7.set(this,void 0),hg.set(this,void 0),n){if(n.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");KP(this,Z7,new Uint8Array(n),"f")}else KP(this,Z7,new Uint8Array(16),"f");KP(this,hg,this.iv,"f")}get iv(){return new Uint8Array(lC(this,Z7,"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++)lC(this,hg,"f")[s]^=e[r+s];KP(this,hg,this.aes.encrypt(lC(this,hg,"f")),"f"),n.set(lC(this,hg,"f"),r)}return n}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const s=this.aes.decrypt(e.subarray(r,r+16));for(let a=0;a<16;a++)n[r+a]=s[a]^lC(this,hg,"f")[a],lC(this,hg,"f")[a]=e[r+a]}return n}}Z7=new WeakMap,hg=new WeakMap;var cC=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)},J7,Vv,Dh;class xN extends xOe{constructor(e,n){super("CTR",e,xN),J7.set(this,void 0),Vv.set(this,void 0),Dh.set(this,void 0),cC(this,Dh,new Uint8Array(16),"f"),Eh(this,Dh,"f").fill(0),cC(this,J7,Eh(this,Dh,"f"),"f"),cC(this,Vv,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,Vv,"f")===16&&(cC(this,J7,this.aes.encrypt(Eh(this,Dh,"f")),"f"),cC(this,Vv,0,"f"),this.increment()),s[a]^=Eh(this,J7,"f")[cC(this,Vv,(r=Eh(this,Vv,"f"),n=r++,r),"f"),n];return s}decrypt(e){return this.encrypt(e)}}J7=new WeakMap,Vv=new WeakMap,Dh=new WeakMap;function gSt(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 gOe(t){return typeof t=="string"&&!t.startsWith("0x")&&(t="0x"+t),iu(t)}function e7(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function FT(t){return typeof t=="string"?bd(t,"NFKC"):iu(t)}function wl(t,e){const n=e.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);An(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(An(!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 gOe(o);if(s==="array"&&Array.isArray(o)||s===typeof o)return o;An(!1,`wrong type found for ${s} `,"path",r)}return o}const bOe="m/44'/60'/0'/0/0";function Kge(t){try{const e=JSON.parse(t);if((e.version!=null?parseInt(e.version):0)===3)return!0}catch{}return!1}function bSt(t,e,n){if(wl(t,"crypto.cipher:string")==="aes-128-ctr"){const s=wl(t,"crypto.cipherparams.iv:data!"),a=new xN(e,s);return Kr(a.decrypt(n))}Dr(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function ER(t,e){const n=ms(e),r=wl(t,"crypto.ciphertext:data!"),s=Kr(mo(Da([n.slice(16,32),r]))).substring(2);An(s===wl(t,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const a=bSt(t,n.slice(0,16),r),o=kT(a);if(t.address){let u=t.address.toLowerCase();u.startsWith("0x")||(u="0x"+u),An(la(u)===o,"keystore address/privateKey mismatch","address",t.address)}const l={address:o,privateKey:a};if(wl(t,"x-ethers.version:string")==="0.1"){const u=n.slice(32,64),d=wl(t,"x-ethers.mnemonicCiphertext:data!"),f=wl(t,"x-ethers.mnemonicCounter:data!"),x=new xN(u,f);l.mnemonic={path:wl(t,"x-ethers.path:string")||bOe,locale:wl(t,"x-ethers.locale:string")||"en",entropy:Kr(ms(x.decrypt(d)))}}return l}function yOe(t){const e=wl(t,"crypto.kdf:string");if(e&&typeof e=="string"){if(e.toLowerCase()==="scrypt"){const n=wl(t,"crypto.kdfparams.salt:data!"),r=wl(t,"crypto.kdfparams.n:int!"),s=wl(t,"crypto.kdfparams.r:int!"),a=wl(t,"crypto.kdfparams.p:int!");An(r>0&&(r&r-1)===0,"invalid kdf.N","kdf.N",r),An(s>0&&a>0,"invalid kdf","kdf",e);const o=wl(t,"crypto.kdfparams.dklen:int!");return An(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=wl(t,"crypto.kdfparams.salt:data!"),r=wl(t,"crypto.kdfparams.prf:string!"),s=r.split("-").pop();An(s==="sha256"||s==="sha512","invalid kdf.pdf","kdf.pdf",r);const a=wl(t,"crypto.kdfparams.c:int!"),o=wl(t,"crypto.kdfparams.dklen:int!");return An(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:n,count:a,dkLen:o,algorithm:s}}}An(!1,"unsupported key-derivation function","kdf",e)}function ySt(t,e){const n=JSON.parse(t),r=FT(e),s=yOe(n);if(s.name==="pbkdf2"){const{salt:f,count:x,dkLen:g,algorithm:y}=s,v=N2(r,f,x,g,y);return ER(n,v)}Dr(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:a,N:o,r:l,p:c,dkLen:u}=s,d=c8(r,a,o,l,c,u);return ER(n,d)}function Yge(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function vSt(t,e,n){const r=JSON.parse(t),s=FT(e),a=yOe(r);if(a.name==="pbkdf2"){n&&(n(0),await Yge(0));const{salt:x,count:g,dkLen:y,algorithm:v}=a,C=N2(s,x,g,y,v);return n&&(n(1),await Yge(0)),ER(r,C)}Dr(a.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:a});const{salt:o,N:l,r:c,p:u,dkLen:d}=a,f=await l8(s,o,l,c,u,d,n);return ER(r,f)}function vOe(t){const e=t.salt!=null?ms(t.salt,"options.salt"):n1(32);let n=1<<17,r=8,s=1;return t.scrypt&&(t.scrypt.N&&(n=t.scrypt.N),t.scrypt.r&&(r=t.scrypt.r),t.scrypt.p&&(s=t.scrypt.p)),An(typeof n=="number"&&n>0&&Number.isSafeInteger(n)&&(BigInt(n)&BigInt(n-1))===BigInt(0),"invalid scrypt N parameter","options.N",n),An(typeof r=="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r),An(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 wOe(t,e,n,r){const s=ms(n.privateKey,"privateKey"),a=r.iv!=null?ms(r.iv,"options.iv"):n1(16);An(a.length===16,"invalid options.iv length","options.iv",r.iv);const o=r.uuid!=null?ms(r.uuid,"options.uuid"):n1(16);An(o.length===16,"invalid options.uuid length","options.uuid",r.iv);const l=t.slice(0,16),c=t.slice(16,32),u=new xN(l,a),d=ms(u.encrypt(s)),f=mo(Da([c,d])),x={address:n.address.substring(2).toLowerCase(),id:v3t(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Kr(a).substring(2)},ciphertext:Kr(d).substring(2),kdf:"scrypt",kdfparams:{salt:Kr(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:f.substring(2)}};if(n.mnemonic){const g=r.client!=null?r.client:`ethers/${ZIe}`,y=n.mnemonic.path||bOe,v=n.mnemonic.locale||"en",C=t.slice(32,64),N=ms(n.mnemonic.entropy,"account.mnemonic.entropy"),I=n1(16),P=new xN(C,I),M=ms(P.encrypt(N)),F=new Date,L="UTC--"+(F.getUTCFullYear()+"-"+e7(F.getUTCMonth()+1,2)+"-"+e7(F.getUTCDate(),2)+"T"+e7(F.getUTCHours(),2)+"-"+e7(F.getUTCMinutes(),2)+"-"+e7(F.getUTCSeconds(),2)+".0Z")+"--"+x.address;x["x-ethers"]={client:g,gethFilename:L,path:y,locale:v,mnemonicCounter:Kr(I).substring(2),mnemonicCiphertext:Kr(M).substring(2),version:"0.1"}}return JSON.stringify(x)}function COe(t,e,n){n==null&&(n={});const r=FT(e),s=vOe(n),a=c8(r,s.salt,s.N,s.r,s.p,64);return wOe(ms(a),s,t,n)}async function SOe(t,e,n){n==null&&(n={});const r=FT(e),s=vOe(n),a=await l8(r,s.salt,s.N,s.r,s.p,64,n.progressCallback);return wOe(ms(a),s,t,n)}const lW="m/44'/60'/0'/0/0",wSt=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),T4=2147483648,CSt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),SSt="0123456789abcdef";function kR(t,e){let n="";for(;t;)n=SSt[t%16]+n,t=Math.trunc(t/16);for(;n.length<e*2;)n="0"+n;return"0x"+n}function jte(t){const e=ms(t),n=So(xp(xp(e)),0,4),r=Da([e,n]);return sPe(r)}const f0={};function NOe(t,e,n,r){const s=new Uint8Array(37);t&T4?(Dr(r!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),s.set(ms(r),1)):s.set(ms(n));for(let o=24;o>=0;o-=8)s[33+(o>>3)]=t>>24-o&255;const a=ms(a8("sha512",e,s));return{IL:a.slice(0,32),IR:a.slice(32)}}function jOe(t,e){const n=e.split("/");An(n.length>0,"invalid path","path",e),n[0]==="m"&&(An(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));An(o<T4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(T4+o)}else if(a.match(/^[0-9]+$/)){const o=parseInt(a);An(o<T4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(o)}else An(!1,"invalid path component",`path[${s}]`,a)}return r}var Zk,Ate,i3,e9;const qp=class qp extends AR{constructor(n,r,s,a,o,l,c,u,d){super(r,d);Un(this,Zk);Gn(this,"publicKey");Gn(this,"fingerprint");Gn(this,"parentFingerprint");Gn(this,"mnemonic");Gn(this,"chainCode");Gn(this,"path");Gn(this,"index");Gn(this,"depth");k5(n,f0,"HDNodeWallet"),$s(this,{publicKey:r.compressedPublicKey});const f=So(o8(xp(this.publicKey)),0,4);$s(this,{parentFingerprint:s,fingerprint:f,chainCode:a,path:o,index:l,depth:c}),$s(this,{mnemonic:u})}connect(n){return new qp(f0,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,n)}async encrypt(n,r){return await SOe(Cr(this,Zk,Ate).call(this),n,{progressCallback:r})}encryptSync(n){return COe(Cr(this,Zk,Ate).call(this),n)}get extendedKey(){return Dr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),jte(Da(["0x0488ADE4",kR(this.depth,1),this.parentFingerprint,kR(this.index,4),this.chainCode,Da(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new sE(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(n){const r=$i(n,"index");An(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&T4&&(s+="'"));const{IR:a,IL:o}=NOe(r,this.chainCode,this.publicKey,this.privateKey),l=new G0(b1((M$(o)+BigInt(this.privateKey))%CSt,32));return new qp(f0,l,this.fingerprint,Kr(a),s,r,this.depth+1,this.mnemonic,this.provider)}derivePath(n){return jOe(this,n)}static fromExtendedKey(n){const r=ul(s3t(n));An(r.length===82||jte(r.slice(0,78))===n,"invalid extended key","extendedKey","[ REDACTED ]");const s=r[4],a=Kr(r.slice(5,9)),o=parseInt(Kr(r.slice(9,13)).substring(2),16),l=Kr(r.slice(13,45)),c=r.slice(45,78);switch(Kr(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const u=Kr(c);return new sE(f0,kT(u),u,a,l,null,o,s,null)}case"0x0488ade4":case"0x04358394 ":if(c[0]!==0)break;return new qp(f0,new G0(c.slice(1)),a,l,null,o,s,null,null)}An(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(n,r,s){var o;n==null&&(n=""),r==null&&(r=lW),s==null&&(s=Q3.wordlist());const a=mN.fromEntropy(n1(16),n,s);return Cr(o=qp,i3,e9).call(o,a.computeSeed(),a).derivePath(r)}static fromMnemonic(n,r){var s;return r||(r=lW),Cr(s=qp,i3,e9).call(s,n.computeSeed(),n).derivePath(r)}static fromPhrase(n,r,s,a){var l;r==null&&(r=""),s==null&&(s=lW),a==null&&(a=Q3.wordlist());const o=mN.fromPhrase(n,r,a);return Cr(l=qp,i3,e9).call(l,o.computeSeed(),o).derivePath(s)}static fromSeed(n){var r;return Cr(r=qp,i3,e9).call(r,n,null)}};Zk=new WeakSet,Ate=function(){const n={address:this.address,privateKey:this.privateKey},r=this.mnemonic;return this.path&&r&&r.wordlist.locale==="en"&&r.password===""&&(n.mnemonic={path:this.path,locale:"en",entropy:r.entropy}),n},i3=new WeakSet,e9=function(n,r){An(P$(n),"invalid seed","seed","[REDACTED]");const s=ms(n,"seed");An(s.length>=16&&s.length<=64,"invalid seed","seed","[REDACTED]");const a=ms(a8("sha512",wSt,s)),o=new G0(Kr(a.slice(0,32)));return new qp(f0,o,"0x00000000",Kr(a.slice(32)),"m",0,0,r,null)},Un(qp,i3);let A9=qp;class sE extends bte{constructor(n,r,s,a,o,l,c,u,d){super(r,d);Gn(this,"publicKey");Gn(this,"fingerprint");Gn(this,"parentFingerprint");Gn(this,"chainCode");Gn(this,"path");Gn(this,"index");Gn(this,"depth");k5(n,f0,"HDNodeVoidWallet"),$s(this,{publicKey:s});const f=So(o8(xp(s)),0,4);$s(this,{publicKey:s,fingerprint:f,parentFingerprint:a,chainCode:o,path:l,index:c,depth:u})}connect(n){return new sE(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,n)}get extendedKey(){return Dr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),jte(Da(["0x0488B21E",kR(this.depth,1),this.parentFingerprint,kR(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(n){const r=$i(n,"index");An(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&T4&&(s+="'"));const{IR:a,IL:o}=NOe(r,this.chainCode,this.publicKey,null),l=G0.addPoints(o,this.publicKey,!0),c=kT(l);return new sE(f0,c,l,this.fingerprint,Kr(a),s,r,this.depth+1,this.provider)}derivePath(n){return jOe(this,n)}}function Xge(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function Qge(t,e){const n=JSON.parse(t),r=FT(e),s=la(wl(n,"ethaddr:string!")),a=gOe(wl(n,"encseed:string!"));An(a&&a.length%16===0,"invalid encseed","json",t);const o=ms(N2(r,r,2e3,32,"sha256")).slice(0,16),l=a.slice(0,16),c=a.slice(16),u=new lle(o,l),d=gSt(ms(u.decrypt(c)));let f="";for(let x=0;x<d.length;x++)f+=String.fromCharCode(d[x]);return{address:s,privateKey:v1(f)}}function Zge(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}var Jk,H0,_te;let cle=(H0=class extends AR{constructor(e,n){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let r=typeof e=="string"?new G0(e):e;super(r,n)}connect(e){return new H0(this.signingKey,e)}async encrypt(e,n){const r={address:this.address,privateKey:this.privateKey};return await SOe(r,e,{progressCallback:n})}encryptSync(e){const n={address:this.address,privateKey:this.privateKey};return COe(n,e)}static async fromEncryptedJson(e,n,r){var a;let s=null;return Kge(e)?s=await vSt(e,n,r):Xge(e)&&(r&&(r(0),await Zge(0)),s=Qge(e,n),r&&(r(1),await Zge(0))),Cr(a=H0,Jk,_te).call(a,s)}static fromEncryptedJsonSync(e,n){var s;let r=null;return Kge(e)?r=ySt(e,n):Xge(e)?r=Qge(e,n):An(!1,"invalid JSON wallet","json","[ REDACTED ]"),Cr(s=H0,Jk,_te).call(s,r)}static createRandom(e){const n=A9.createRandom();return e?n.connect(e):n}static fromPhrase(e,n){const r=A9.fromPhrase(e);return n?r.connect(n):r}},Jk=new WeakSet,_te=function(e){if(An(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const r=mN.fromEntropy(e.mnemonic.entropy),s=A9.fromMnemonic(r,e.mnemonic.path);if(s.address===e.address&&s.privateKey===e.privateKey)return s;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const n=new H0(e.privateKey);return An(n.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),n},Un(H0,Jk),H0);async function Jge(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 gN=({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 AOe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},e1e=Ie.createContext&&Ie.createContext(AOe),NSt=["attr","size","title"];function jSt(t,e){if(t==null)return{};var n=ASt(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 ASt(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 TR(){return TR=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},TR.apply(this,arguments)}function t1e(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 IR(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?t1e(Object(n),!0).forEach(function(r){_St(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):t1e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _St(t,e,n){return e=ESt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ESt(t){var e=kSt(t,"string");return typeof e=="symbol"?e:e+""}function kSt(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 _Oe(t){return t&&t.map((e,n)=>Ie.createElement(e.tag,IR({key:n},e.attr),_Oe(e.child)))}function Pl(t){return e=>Ie.createElement(TSt,TR({attr:IR({},t.attr)},e),_Oe(t.child))}function TSt(t){var e=n=>{var{attr:r,size:s,title:a}=t,o=jSt(t,NSt),l=s||n.size||"1em",c;return n.className&&(c=n.className),t.className&&(c=(c?c+" ":"")+t.className),Ie.createElement("svg",TR({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:c,style:IR(IR({color:t.color||n.color},n.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),a&&Ie.createElement("title",null,a),t.children)};return e1e!==void 0?Ie.createElement(e1e.Consumer,null,n=>e(n)):e(AOe)}function ISt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M446.7 98.6l-67.6 318.8c-5.1 22.5-18.4 28.1-37.3 17.5l-103-75.9-49.7 47.8c-5.5 5.5-10.1 10.1-20.7 10.1l7.4-104.9 190.9-172.5c8.3-7.4-1.8-11.5-12.9-4.1L117.8 284 16.2 252.2c-22.1-6.9-22.5-22.1 4.6-32.7L418.2 66.4c18.4-6.9 34.5 4.1 28.5 32.2z"},child:[]}]})(t)}function OT(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(t)}function PSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(t)}function ule(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 168v-16c0-13.255 10.745-24 24-24h360V80c0-21.367 25.899-32.042 40.971-16.971l80 80c9.372 9.373 9.372 24.569 0 33.941l-80 80C409.956 271.982 384 261.456 384 240v-48H24c-13.255 0-24-10.745-24-24zm488 152H128v-48c0-21.314-25.862-32.08-40.971-16.971l-80 80c-9.372 9.373-9.372 24.569 0 33.941l80 80C102.057 463.997 128 453.437 128 432v-48h360c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24z"},child:[]}]})(t)}function aa(t){return Pl({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"},child:[]}]})(t)}function oa(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(t)}function FSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"},child:[]}]})(t)}function OSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z"},child:[]}]})(t)}function MSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M272 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h224c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM160 480c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm112-108c0 6.6-5.4 12-12 12H60c-6.6 0-12-5.4-12-12V60c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v312z"},child:[]}]})(t)}function RSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M476 3.2L12.5 270.6c-18.1 10.4-15.8 35.6 2.2 43.2L121 358.4l287.3-253.2c5.5-4.9 13.3 2.6 8.6 8.3L176 407v80.5c0 23.6 28.5 32.9 42.5 15.8L282 426l124.6 52.2c14.2 6 30.4-2.9 33-18.2l72-432C515 7.8 493.3-6.8 476 3.2z"},child:[]}]})(t)}function LSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"},child:[]}]})(t)}function s2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(t)}function i2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M279 224H41c-21.4 0-32.1-25.9-17-41L143 64c9.4-9.4 24.6-9.4 33.9 0l119 119c15.2 15.1 4.5 41-16.9 41z"},child:[]}]})(t)}function a2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41zm255-105L177 64c-9.4-9.4-24.6-9.4-33.9 0L24 183c-15.1 15.1-4.4 41 17 41h238c21.4 0 32.1-25.9 17-41z"},child:[]}]})(t)}function EOe(t){return Pl({tag:"svg",attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(t)}const DSt=({handleListRequest:t,isLighterInfoValue:e,handleLighterWalletInfo:n})=>{var de;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=h.useContext(Yr),[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),[N,I]=h.useState(""),[P,M]=h.useState(""),[F,$]=h.useState(!0),[L,z]=h.useState({}),Q=G=>/^\d*$/.test(G),se=G=>{["e","E","+","-"].includes(G.key)&&G.preventDefault()},ee=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!=="",K=async()=>{if(!ee){I("Please fill in all fields.");return}try{C(!0),I(""),M("");const G=window.localStorage.getItem("hyperToken"),ie=window.localStorage.getItem("hyperAddress");if(!G||!ie){s(!0),C(!1);return}const ae={address:ie.toLowerCase(),token:G,wallet_name:a,main_wallet:l,api_wallet_idx:f,api_wallet_private_key:u},W=await(await fetch(`${r}/api/wallet/generate-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ae)})).json();W!=null&&W.success?(dn.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(""),I(""),M(W==null?void 0:W.message)):I((W==null?void 0:W.error_message)||"An error has occurred.")}catch(G){I(G.message||"An error has occurred.")}finally{C(!1)}},re=async(G,ie)=>{console.log("id :>> ",G);const ae=`${G}_${ie}`;try{z(_e=>({..._e,[ae]:!0})),I(""),M("");const q=window.localStorage.getItem("hyperToken"),W=window.localStorage.getItem("hyperAddress");if(!q||!W){s(!0),z(_e=>({..._e,[ae]:!1}));return}const ne={address:W.toLowerCase(),token:q,wallet_id:Number(G)},he=await(await fetch(`${r}/api/wallet/delete-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ne)})).json();he!=null&&he.success?(dn.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(W),I(""),M(he==null?void 0:he.message)):I((he==null?void 0:he.error_message)||"An error has occurred.")}catch(q){I(q.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(Ba,{})}),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(aa,{size:14}):i.jsx(oa,{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("");Q(ie)&&x(ie)},onKeyDown:se,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${f===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:v})})]})]}),i.jsx("button",{onClick:()=>{!v&&K()},disabled:v,className:"w-full h-10 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] focus:ring-0 focus:outline-none justify-center items-center gap-1.5 inline-flex mt-2.5",children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Generate"})}),i.jsx("div",{className:"w-full mt-2",children:(e==null?void 0:e.length)>0?i.jsxs("div",{className:"flex flex-col items-start gap-3 w-full ",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 cursor-pointer text-sm text-zinc-300 w-full",onClick:()=>$(!F),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"Lighter Wallets"}),i.jsx(Mie,{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&&((de=[...e].sort((G,ie)=>(ie==null?void 0:ie.wallet_created_data)-(G==null?void 0:G.wallet_created_data)))==null?void 0:de.map((G,ie)=>{var ae,q;return i.jsx("div",{className:"flex flex-col items-start w-full",children:i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("span",{className:"text-[#929292] text-[11px] font-normal min-w-[110px]",children:((ae=G==null?void 0:G.wallet_name)==null?void 0:ae.length)>18?((q=G==null?void 0:G.wallet_name)==null?void 0:q.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:W=>{W.stopPropagation(),navigator.clipboard.writeText(G==null?void 0:G.wallet_address),dn.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:_o,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)}),L[`${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:()=>{re(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)}))})]}):""}),N&&i.jsxs("div",{className:"mt-2 w-full min-h-10 p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 max-w-[480px]",children:[i.jsx("img",{src:Hl,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:N})]}),P&&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:mae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:P})]})]})},n1e=({handleListRequest:t,isExtendedInfoValue:e,handleExtendedWalletInfo:n})=>{var xe;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=h.useContext(Yr),[a,o]=h.useState(""),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,x]=h.useState(""),[g,y]=h.useState(""),[v,C]=h.useState(""),[N,I]=h.useState(!1),[P,M]=h.useState(!1),[F,$]=h.useState(!1),[L,z]=h.useState(!1),[Q,se]=h.useState(!1),[ee,K]=h.useState(""),[re,de]=h.useState(""),[G,ie]=h.useState(!0),[ae,q]=h.useState({}),W=Se=>/^\d*$/.test(Se),ne=Se=>{["e","E","+","-"].includes(Se.key)&&Se.preventDefault()},oe=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!==""&&g.trim()!==""&&v.trim()!=="",he=async()=>{if(!oe){K("Please fill in all fields.");return}try{se(!0),K(""),de("");const Se=window.localStorage.getItem("hyperToken"),ge=window.localStorage.getItem("hyperAddress");if(!Se||!ge){s(!0),se(!1);return}const Ce={address:ge.toLowerCase(),token:Se,wallet_name:a,main_wallet:l,api_key:f,stark_public:u,stark_private:g,vault_number:v},Oe=await(await fetch(`${r}/api/wallet/generate-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Ce)})).json();Oe!=null&&Oe.success?(dn.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(ge),o(""),c(""),d(""),x(""),y(""),C(""),K(""),de(Oe==null?void 0:Oe.message)):K((Oe==null?void 0:Oe.error_message)||"An error has occurred.")}catch(Se){K(Se.message||"An error has occurred.")}finally{se(!1)}},_e=async(Se,ge)=>{console.log("id :>> ",Se);const Ce=`${Se}_${ge}`;try{q(ht=>({...ht,[Ce]:!0})),K(""),de("");const je=window.localStorage.getItem("hyperToken"),Oe=window.localStorage.getItem("hyperAddress");if(!je||!Oe){s(!0),q(ht=>({...ht,[Ce]:!1}));return}const $e={address:Oe.toLowerCase(),token:je,wallet_id:Number(Se)},Je=await(await fetch(`${r}/api/wallet/delete-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify($e)})).json();Je!=null&&Je.success?(t(),dn.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(Oe),K(""),de(Je==null?void 0:Je.message)):K((Je==null?void 0:Je.error_message)||"An error has occurred.")}catch(je){K(je.message||"An error has occurred.")}finally{se(!1)}};return i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full relative",children:[Q&&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(Ba,{})}),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:Se=>o(Se.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:Q})})]}),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:Se=>c(Se.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:Q})})]}),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:Se=>x(Se.target.value),autoComplete:"off",placeholder:"API_KEY",type:N?"text":"password",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${f===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:Q}),i.jsx("button",{type:"button",onClick:()=>I(Se=>!Se),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:Q,children:N?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se=>d(Se.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:P?"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:Q}),i.jsx("button",{type:"button",onClick:()=>M(Se=>!Se),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:Q,children:P?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se=>y(Se.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:Q}),i.jsx("button",{type:"button",onClick:()=>$(Se=>!Se),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:Q,children:F?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se=>{const ge=Se.target.value.trim();if(ge==="")return C("");W(ge)&&C(ge)},onKeyDown:ne,inputMode:"numeric",autoComplete:"off",type:L?"text":"password",placeholder:"VAULT_NUMBER",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${v===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:Q}),i.jsx("button",{type:"button",onClick:()=>z(Se=>!Se),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:Q,children:L?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]}),i.jsx("button",{onClick:()=>{!Q&&he()},disabled:Q,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(Mie,{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&&((xe=[...e].sort((Se,ge)=>(ge==null?void 0:ge.wallet_created_data)-(Se==null?void 0:Se.wallet_created_data)))==null?void 0:xe.map((Se,ge)=>{var Ce,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:((Ce=Se==null?void 0:Se.wallet_name)==null?void 0:Ce.length)>18?((je=Se==null?void 0:Se.wallet_name)==null?void 0:je.slice(0,18))+"...":Se==null?void 0:Se.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:(Se==null?void 0:Se.wallet_address.slice(0,6))+"..."+(Se==null?void 0:Se.wallet_address.slice(-4))}),i.jsx("img",{onClick:Oe=>{Oe.stopPropagation(),navigator.clipboard.writeText(Se==null?void 0:Se.wallet_address),dn.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:_o,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(Se==null?void 0:Se.wallet_created_data)}),ae[`${Se==null?void 0:Se.wallet_id}_${Se==null?void 0:Se.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:()=>{_e(Se==null?void 0:Se.wallet_id,Se==null?void 0:Se.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"})})]})},ge)}))})]}):""}),ee&&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:Hl,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:ee})]}),re&&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:mae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:re})]})]})},kOe=({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"})}),BSt=({errorConnectMessage:t,setErrorConnectMessage:e,loadingConnect:n,setLoadingConnect:r,handleListRequest:s,handlePageChange:a,isBalanceValue:o,isBalanceLoading:l,isAgentInfoLoading:c,isAgentInfoValue:u,handleAgentWalletInfo:d,isBuilderFeeLoading:f,isBuilderFeeValue:x,refreshAgent:g,handleBuilderFeeInfo:y,isLighterInfoValue:v,handleLighterWalletInfo:C,isExtendedInfoValue:N,handleExtendedWalletInfo:I,isPacificaInfoValue:P,handlePacificaWalletInfo:M,isSelectAPIMenu:F,setIsSelectAPIMenu:$})=>{var xe,Se;const{setSignModalOpen:L}=h.useContext(Yr),{address:z}=es(),Q=Xl(),[se,ee]=h.useState(!0),[K,re]=h.useState(!1),[de,G]=h.useState(!1);h.useEffect(()=>{const ge=Q.hash,Ce=localStorage.getItem("isWalletSelectMenu");if(ge){const je=ge.split("#").filter(Boolean);je[2]&&$(je[2].toUpperCase()),Ce==="LIGHTER"?$("LIGHTER"):Ce==="EXTENDED"?$("EXTENDED"):Ce==="PACIFICA"?$("PACIFICA"):Ce==="HYPER"&&$("HYPERLIQUID")}},[Q.hash]),h.useEffect(()=>{(async()=>{var Oe;const Ce=window.localStorage.getItem("hyperToken"),je=(Oe=z||window.localStorage.getItem("hyperAddress"))==null?void 0:Oe.toLowerCase();if(!Ce){L(!0);return}if(je&&Ce)try{const $e=await vi(je,Ce);re(!!($e!=null&&$e.is_generated))}catch{re(!1)}finally{G(!0)}})()},[z,L]);const ie=ge=>{var Ye,Je,ht,rt,st,He;const Ce=(ge==null?void 0:ge.code)||((Ye=ge==null?void 0:ge.error)==null?void 0:Ye.code)||((ht=(Je=ge==null?void 0:ge.info)==null?void 0:Je.error)==null?void 0:ht.code)||((rt=ge==null?void 0:ge.cause)==null?void 0:rt.code)||"",je=typeof Ce=="string"?Ce.toUpperCase():String(Ce).toUpperCase(),Oe=String((ge==null?void 0:ge.message)||"").toUpperCase();if(je==="ACTION_REJECTED"||je==="4001"||Oe.includes("USER REJECT")||Oe.includes("USER DENIED")){e("Request cancelled by user.");return}if([typeof ge=="string"?ge:"",ge==null?void 0:ge.message,ge==null?void 0:ge.code,ge==null?void 0:ge.name,ge==null?void 0:ge.shortMessage,(st=ge==null?void 0:ge.cause)==null?void 0:st.message,(He=ge==null?void 0:ge.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 ge=="string"?ge:(ge==null?void 0:ge.message)||"Something went wrong.")},ae=()=>{if(!window.ethereum)throw new Error("MetaMask not found.");return window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0xa4b1"}]})},q=async ge=>{var Oe,$e;if(K)return;const Ce=window.localStorage.getItem("hyperToken");if(!Ce||!z){L(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await ae();const ht=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate-agent",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():je,token:Ce})})).json();if(!(ht!=null&&ht.success)){ie((ht==null?void 0:ht.error_message)||"Agent could not be produced.");return}if(!window.ethereum)throw new Error("MetaMask not found.");const st=await new jR(window.ethereum).getSigner(),He=await Jge(ge,ht,st),bt=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:z?z.toLowerCase():je,token:Ce})})).json();if(bt!=null&&bt.success){if(((Oe=bt==null?void 0:bt.result)==null?void 0:Oe.status)==="err"){ie((($e=bt==null?void 0:bt.result)==null?void 0:$e.response)||"Approval failed."),r(!1);return}s(),a(1),d(z||je)}else ie((bt==null?void 0:bt.error_message)||"Approval failed.")}catch(Ye){ie(Ye)}finally{r(!1)}},W=async ge=>{var Oe,$e;if(K)return;const Ce=window.localStorage.getItem("hyperToken");if(!Ce||!z){L(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await ae();const ht=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate-agent",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():je,token:Ce})})).json();if(!(ht!=null&&ht.success))throw new Error((ht==null?void 0:ht.error_message)||"Generate builder fee failed");if(!window.ethereum)throw new Error("MetaMask not found.");const st=await new jR(window.ethereum).getSigner(),He=await Jge(ge,ht,st),bt=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:z?z.toLowerCase():je,token:Ce})})).json();if(bt!=null&&bt.success){if(((Oe=bt==null?void 0:bt.result)==null?void 0:Oe.status)==="err"){ie((($e=bt==null?void 0:bt.result)==null?void 0:$e.response)||"Approve builder fee failed"),r(!1);return}q(1),y(z||je)}else ie((bt==null?void 0:bt.error_message)||"Approval failed."),r(!1)}catch(Ye){ie(Ye),r(!1)}},ne=h.useMemo(()=>u?u.some(ge=>{var Ce;return((Ce=(ge==null?void 0:ge.name)??"")==null?void 0:Ce.trim().toLowerCase())==="dextrabot"}):!1,[u]),oe=Number(((xe=o==null?void 0:o.marginSummary)==null?void 0:xe.accountValue)??0),he=`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.`,_e=n||c||l||f||!de&&z;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-full",children:i.jsxs("div",{className:"flex flex-col items-start justify-center sm:flex-row sm:justify-between sm:items-center w-full gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(cW,{title:"HYPERLIQUID",set_click:()=>$("HYPERLIQUID"),isSelectAPIMenu:F}),i.jsx(cW,{title:"LIGHTER",set_click:()=>$("LIGHTER"),isSelectAPIMenu:F}),i.jsx(cW,{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(kOe,{className:"w-4 h-4"})]})]})}),_e?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx(Ba,{})}):F==="HYPERLIQUID"?i.jsxs("div",{className:"flex flex-col items-center justify-start gap-[24px] w-full",children:[i.jsxs("div",{className:"flex flex-col items-start gap-2 -mt-[8px] w-full",children:[i.jsx("label",{htmlFor:"address",className:"text-center justify-start text-white text-sm font-medium font-['Inter']",children:"Connected Wallet"}),i.jsxs("div",{id:"address",className:"min-h-10 px-2.5 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] outline outline-1 outline-offset-[-1px] outline-[#2a2a2a] gap-2 flex justify-start items-center w-full text-white text-sm font-medium font-['Inter'] leading-[16px] break-all",children:[z&&i.jsx("img",{src:ume,alt:"agent icon"}),z||"--"]}),!K&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex justify-start items-center gap-4 w-full mt-2",children:i.jsxs("div",{className:"flex flex-col items-start gap-1.5 text-[#929292] text-[13px] font-normal font-['Inter'] leading-4 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsx("span",{className:"text-[#929292]",children:"USDC Available "}),i.jsxs("div",{className:"flex justify-center items-center gap-4",children:[i.jsx("div",{onClick:()=>{g()},className:"flex justify-center items-center cursor-pointer",children:i.jsx(Jg,{className:"w-4 h-4 text-[#929292] hover:text-white"})}),i.jsx("span",{className:`${oe>=5?"text-[#1DE674]":"text-[#929292]"} `,children:oe===0||oe?"$"+Er(oe):"--"})]})]}),(oe===0&&!ne||oe<5&&!ne)&&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?ne?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:ume,alt:"agent icon"}),"You’re ready to trade!"]}):"":oe>0?oe>=5?"":i.jsxs("div",{className:"px-3 py-2.5 bg-[#ffb14b]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 w-full max-w-[480px] text-[#FFB14B] text-[13px] font-normal font-['Inter'] leading-4",children:[i.jsx(gN,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Your Hyperliquid perps balance is $",Er(oe)," USDC. A minimum of 5 USDC is required."]}):i.jsxs("div",{className:"px-3 py-2.5 bg-[#ffb14b]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 w-full max-w-[480px] text-[#FFB14B] text-[13px] font-normal font-['Inter'] leading-4",children:[i.jsx(gN,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Please fund your Hyperliquid Perpetual balance to start trading"]})})]})]}),K?i.jsxs("div",{className:"-mt-2.5 w-full p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] max-w-[480px] flex justify-start items-center gap-2.5",children:[i.jsx("img",{src:Hl,alt:"Dextrabot"}),i.jsx("p",{className:"whitespace-pre-line text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:he})]}):i.jsxs(i.Fragment,{children:[x!=null&&Number(x)>0?ne?"":i.jsx("div",{onClick:()=>{q(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:ge=>{ge.preventDefault(),oe>=5&&!l&&W(2)},className:`${oe>=5&&!l?"cursor-pointer bg-[#7445ff] border border-[#8860ff] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)]":"bg-[#6B7280] text-[#D1D5DB] cursor-auto"} w-full h-10 px-6 py-3 rounded-xl inline-flex justify-center items-center gap-2.5 text-white text-sm font-semibold font-['Inter'] leading-[8px] -mt-4`,children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Enable Trading"})}),i.jsx("div",{className:"w-full",children:(u==null?void 0:u.length)>0?i.jsxs("div",{className:"flex flex-col items-start gap-3 w-full ",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 cursor-pointer text-sm text-zinc-300 w-full",onClick:()=>ee(!se),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"API Wallets"}),i.jsx(Mie,{className:`w-3.5 h-3.5 transition-transform text-white ${se?"":"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:se&&((Se=[...u].sort((ge,Ce)=>(Ce==null?void 0:Ce.validUntil)-(ge==null?void 0:ge.validUntil)))==null?void 0:Se.map((ge,Ce)=>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:`${(ge==null?void 0:ge.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal min-w-[110px]`,children:ge==null?void 0:ge.name})}),i.jsxs("span",{className:`${(ge==null?void 0:ge.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal font-['Inter'] leading-4 min-w-max`,children:["Valid until:"," ",rht(ge==null?void 0:ge.validUntil)]})]})},Ce)))})]}):""}),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:Hl,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(DSt,{handleListRequest:s,isLighterInfoValue:v,handleLighterWalletInfo:C})}):F==="EXTENDED"?i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(n1e,{handleListRequest:s,isExtendedInfoValue:N,handleExtendedWalletInfo:I})}):i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(n1e,{handleListRequest:s,isExtendedInfoValue:N,handleExtendedWalletInfo:I})})]})},cW=({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}),r1e=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:t,children:[i.jsx("path",{d:"M3.75 11.25C3.045 11.25 2.3925 11.4975 1.875 11.91C1.185 12.4575 0.75 13.305 0.75 14.25C0.75 15.9075 2.0925 17.25 3.75 17.25C4.5075 17.25 5.1975 16.965 5.73 16.5C6.3525 15.9525 6.75 15.15 6.75 14.25C6.75 12.5925 5.4075 11.25 3.75 11.25ZM4.5 14.4375C4.5 14.6325 4.395 14.82 4.23 14.9175L3.2925 15.48C3.2025 15.54 3.0975 15.5625 3 15.5625C2.8125 15.5625 2.625 15.465 2.52 15.2925C2.3625 15.0225 2.445 14.6775 2.715 14.52L3.3825 14.1225V13.3125C3.375 13.005 3.63 12.75 3.9375 12.75C4.245 12.75 4.5 13.005 4.5 13.3125V14.4375Z",fill:"currentColor"}),i.jsx("path",{d:"M11.1375 2.96251V5.81251H10.0125V2.96251C10.0125 2.76001 9.8325 2.66251 9.7125 2.66251C9.675 2.66251 9.6375 2.67001 9.6 2.68501L3.6525 4.92751C3.255 5.07751 3 5.45251 3 5.88001V6.38251C2.3175 6.89251 1.875 7.71001 1.875 8.63251V5.88001C1.875 4.98751 2.4225 4.19251 3.255 3.87751L9.21 1.62751C9.375 1.56751 9.5475 1.53751 9.7125 1.53751C10.4625 1.53751 11.1375 2.14501 11.1375 2.96251Z",fill:"currentColor"}),i.jsx("path",{d:"M16.1245 10.875V11.625C16.1245 11.8275 15.967 11.9925 15.757 12H14.662C14.2645 12 13.9045 11.7075 13.8745 11.3175C13.852 11.085 13.942 10.8675 14.092 10.7175C14.227 10.575 14.4145 10.5 14.617 10.5H15.7495C15.967 10.5075 16.1245 10.6725 16.1245 10.875Z",fill:"currentColor"}),i.jsx("path",{d:"M14.61 9.7125H15.375C15.7875 9.7125 16.125 9.375 16.125 8.9625V8.6325C16.125 7.08 14.8575 5.8125 13.305 5.8125H4.695C4.0575 5.8125 3.4725 6.0225 3 6.3825C2.3175 6.8925 1.875 7.71 1.875 8.6325V9.9675C1.875 10.2525 2.175 10.4325 2.445 10.3425C2.865 10.2 3.3075 10.125 3.75 10.125C6.0225 10.125 7.875 11.9775 7.875 14.25C7.875 14.79 7.7325 15.3825 7.5075 15.9075C7.3875 16.1775 7.575 16.5 7.8675 16.5H13.305C14.8575 16.5 16.125 15.2325 16.125 13.68V13.5375C16.125 13.125 15.7875 12.7875 15.375 12.7875H14.7225C14.0025 12.7875 13.3125 12.345 13.125 11.6475C12.975 11.0775 13.155 10.5225 13.53 10.1625C13.8075 9.8775 14.19 9.7125 14.61 9.7125ZM10.5 9.5625H6.75C6.4425 9.5625 6.1875 9.3075 6.1875 9C6.1875 8.6925 6.4425 8.4375 6.75 8.4375H10.5C10.8075 8.4375 11.0625 8.6925 11.0625 9C11.0625 9.3075 10.8075 9.5625 10.5 9.5625Z",fill:"currentColor"})]});function P5({open:t,setOpen:e,handleListRequest:n,handlePageChange:r,source:s}){const{isConnected:a,address:o}=es(),{hyperToken:l}=h.useContext(Yr);Xl();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,N]=h.useState(""),[I,P]=h.useState(!1),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState("account"),[se,ee]=h.useState(!1),K=h.useRef(null),[re,de]=h.useState([]),[G,ie]=h.useState(""),[ae,q]=h.useState(""),[W,ne]=h.useState(!1),[oe,he]=h.useState(""),[_e,xe]=h.useState(""),[Se,ge]=h.useState(""),[Ce,je]=h.useState(!1),[Oe,$e]=h.useState(!1),[Ye,Je]=h.useState(null),[ht,rt]=h.useState(!1),[st,He]=h.useState([]),[Ve,bt]=h.useState([]),[xt,Qt]=h.useState([]),[St,on]=h.useState([]),[cn,Vn]=h.useState(!1),[tn,fn]=h.useState(null),rn=[{id:"account",name:"Add API Wallet",href:"#account",icon:r1e},{id:"generate",name:"Generate HL Wallet",href:"#generate",icon:r1e}];function nt(...We){return We.filter(Boolean).join(" ")}const it=async(We,It)=>{try{It===1&&$e(!0);const Ge=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:We})});if(!Ge.ok)throw new Error("Network response was not ok");const ct=await Ge.json();ct&&(Je(ct),$e(!1))}catch(Ge){console.error("Error fetching user balance info:",Ge),$e(!1)}},Ut=async We=>{try{rt(!0);const It=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"extraAgents",user:We})});if(!It.ok)throw new Error("Network response was not ok");const Ge=await It.json();Ge&&(He(Ge),rt(!1))}catch(It){console.error("Error fetching user balance info:",It),rt(!1)}},hn=async We=>{const It=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress");if(!(!It||!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():Ge,token:It})});if(!ct.ok)throw new Error("Network response was not ok");const vt=await ct.json();vt.success&&bt((vt==null?void 0:vt.data)||[])}catch(ct){console.error("Error fetching user balance info:",ct)}},nn=async We=>{const It=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress");if(!(!It||!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():Ge,token:It})});if(!ct.ok)throw new Error("Network response was not ok");const vt=await ct.json();vt.success&&Qt((vt==null?void 0:vt.data)||[])}catch(ct){console.error("Error fetching user balance info:",ct)}},Vt=async We=>{try{Vn(!0);const It=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(!It.ok)throw new Error("Network response was not ok");const Ge=await It.text(),ct=parseInt(Ge,10);fn(ct),Vn(!1)}catch(It){console.error("Error fetching user balance info:",It),Vn(!1)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&o&&t&&(it(o,1),Ut(o),hn(o),nn(o),Vt(o))},[t]),h.useEffect(()=>{var Ge;return!t||z!="account"||(st==null?void 0:st.some(ct=>((ct==null?void 0:ct.name)??"").trim().toLowerCase()==="dextrabot"))?void 0:(Number(((Ge=Ye==null?void 0:Ye.marginSummary)==null?void 0:Ge.accountValue)??0)<5?K.current||(K.current=setInterval(()=>{it(o,2)},1e4)):K.current&&(clearInterval(K.current),K.current=null),()=>{K.current&&(clearInterval(K.current),K.current=null)})},[Ye,t,z,o]),h.useEffect(()=>{const We=window.localStorage.getItem("hyperToken");(!o||!a||!We)&&(e(!1),g(""),N(""),ge(""))},[o,a,l]);const pt=()=>{window.localStorage.getItem("hyperToken")&&o&&t?(it(o,1),Ut(o),Vt(o)):dn.error("Please connect wallet")};return h.useEffect(()=>{if(t&&!se)if((st==null?void 0:st.length)>0){const We=st==null?void 0:st.some(Ge=>((Ge==null?void 0:Ge.name)??"").trim().toLowerCase()==="dextrabot"),It=localStorage.getItem("isWalletSelectMenu");Q(It==="LIGHTER"||It==="EXTENDED"||It==="PACIFICA"?"account":It==="HYPER"?We?"generate":"account":We&&(Ve==null?void 0:Ve.length)>0&&(xt==null?void 0:xt.length)>0&&(St==null?void 0:St.length)>0?"generate":"account"),ee(!0)}else Q("account"),ee(!0)},[st,se]),i.jsxs(i.Fragment,{children:[i.jsx(Gwt,{open:$,setOpen:L,setGenModalOpen:e,setGenWalletSuccess:F,setGenWalletData:f,setShowPrivateKey:P}),i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-[9999999998] font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,style:{boxShadow:"0 4px 24px 0 #000",backdropFilter:"blur(16px)"},className:"relative transform overflow-hidden bg-[rgba(16,16,16,0.64)] border border-[rgba(46,46,46,0.32)] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:`${M&&Object.keys(d).length>0?"w-max":"w-[400px]"} flex flex-col justify-start items-center gap-[26px] h-max relative bg-[#0f0f0f]/60 rounded-3xl pt-[29px] pb-[24px] px-[26px] w-full min-w-[320px]`,children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:We=>{We.preventDefault(),y&&z==="generate"||z==="account"&&Ce?dn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Please wait until completion."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}):z==="generate"&&M&&Object.keys(d).length>0?(L(!0),P(!1)):(e(!1),g(""),N(""),ge(""),He([]),fn(null),ee(!1))},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-3.5",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"flex justify-start text-white text-base font-medium font-manrope w-full",children:"Generate your wallet"}),i.jsxs("div",{className:"flex justify-start items-center w-full",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:hidden w-full",children:[i.jsx("select",{value:z,onChange:We=>{const It=We.target.value;if(!y){if(z==="generate"&&It!=="generate"&&M&&Object.keys(d).length>0){P(!1),L(!0);return}if(z==="account"&&It!=="account"&&Ce){dn.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}Q(It),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:rn==null?void 0:rn.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(u_,{"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:rn==null?void 0:rn.map(We=>{const It=(We==null?void 0:We.id)===z;return i.jsxs("a",{href:We==null?void 0:We.href,onClick:Ge=>{Ge.preventDefault();const ct=We==null?void 0:We.id;if(y)return;if(z==="generate"&&ct!=="generate"&&M&&Object.keys(d).length>0){P(!1),L(!0);return}if(z==="account"&&ct!=="account"&&Ce){dn.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}Q(ct);const vt=document.querySelector(We.href);vt&&vt.scrollIntoView({behavior:"smooth",block:"start"}),g("")},"aria-current":It?"page":void 0,className:nt(It?"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:nt(It?"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)})})})]}),z==="generate"?i.jsx(Ywt,{loading:y,genWalletSuccess:M,genWalletData:d,showPrivateKey:I,genWalletName:x,setGenWalletName:g,errorMessage:C,setShowPrivateKey:P,setErrorMessage:N,setLoading:v,setGenWalletData:f,setGenWalletSuccess:F,handleListRequest:n,handlePageChange:r}):z==="agent"?i.jsx(Xwt,{agentWalletData:re,setAgentWalletData:de,agentWalletName:G,setAgentWalletName:ie,errorAgentMessage:ae,setErrorAgentMessage:q,loadingAgent:W,setLoadingAgent:ne,handleListRequest:n,handlePageChange:r,agentWalletAddress:oe,setAgentWalletAddress:he,agentWalletPkey:_e,setAgentWalletPkey:xe}):z==="account"?i.jsx(BSt,{errorConnectMessage:Se,setErrorConnectMessage:ge,loadingConnect:Ce,setLoadingConnect:je,handleListRequest:n,handlePageChange:r,isBalanceValue:Ye,isBalanceLoading:Oe,isAgentInfoLoading:ht,isAgentInfoValue:st,handleAgentWalletInfo:Ut,isBuilderFeeLoading:cn,isBuilderFeeValue:tn,refreshAgent:pt,handleBuilderFeeInfo:Vt,isLighterInfoValue:Ve,handleLighterWalletInfo:hn,isExtendedInfoValue:xt,handleExtendedWalletInfo:nn,isPacificaInfoValue:St,handlePacificaWalletInfo:nn,isSelectAPIMenu:c,setIsSelectAPIMenu:u}):""]})})})})})]})]})}var ff="top",gp="bottom",bp="right",hf="left",dle="auto",MT=[ff,gp,bp,hf],bN="start",iE="end",$St="clippingParents",TOe="viewport",t7="popper",USt="reference",s1e=MT.reduce(function(t,e){return t.concat([e+"-"+bN,e+"-"+iE])},[]),IOe=[].concat(MT,[dle]).reduce(function(t,e){return t.concat([e,e+"-"+bN,e+"-"+iE])},[]),zSt="beforeRead",HSt="read",VSt="afterRead",WSt="beforeMain",qSt="main",GSt="afterMain",KSt="beforeWrite",YSt="write",XSt="afterWrite",QSt=[zSt,HSt,VSt,WSt,qSt,GSt,KSt,YSt,XSt];function ux(t){return t?(t.nodeName||"").toLowerCase():null}function sh(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Z3(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 fle(t){if(typeof ShadowRoot>"u")return!1;var e=sh(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function ZSt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},s=e.attributes[n]||{},a=e.elements[n];!cp(a)||!ux(a)||(Object.assign(a.style,r),Object.keys(s).forEach(function(o){var l=s[o];l===!1?a.removeAttribute(o):a.setAttribute(o,l===!0?"":l)}))})}function JSt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],a=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=o.reduce(function(c,u){return c[u]="",c},{});!cp(s)||!ux(s)||(Object.assign(s.style,l),Object.keys(a).forEach(function(c){s.removeAttribute(c)}))})}}const POe={name:"applyStyles",enabled:!0,phase:"write",fn:ZSt,effect:JSt,requires:["computeStyles"]};function K0(t){return t.split("-")[0]}var g3=Math.max,PR=Math.min,yN=Math.round;function Ete(){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 FOe(){return!/^((?!chrome|android).)*safari/i.test(Ete())}function vN(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&&yN(r.width)/t.offsetWidth||1,a=t.offsetHeight>0&&yN(r.height)/t.offsetHeight||1);var o=Z3(t)?sh(t):window,l=o.visualViewport,c=!FOe()&&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 hle(t){var e=vN(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 OOe(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&fle(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function C1(t){return sh(t).getComputedStyle(t)}function eNt(t){return["table","td","th"].indexOf(ux(t))>=0}function A2(t){return((Z3(t)?t.ownerDocument:t.document)||window.document).documentElement}function Y$(t){return ux(t)==="html"?t:t.assignedSlot||t.parentNode||(fle(t)?t.host:null)||A2(t)}function i1e(t){return!cp(t)||C1(t).position==="fixed"?null:t.offsetParent}function tNt(t){var e=/firefox/i.test(Ete()),n=/Trident/i.test(Ete());if(n&&cp(t)){var r=C1(t);if(r.position==="fixed")return null}var s=Y$(t);for(fle(s)&&(s=s.host);cp(s)&&["html","body"].indexOf(ux(s))<0;){var a=C1(s);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||e&&a.willChange==="filter"||e&&a.filter&&a.filter!=="none")return s;s=s.parentNode}return null}function RT(t){for(var e=sh(t),n=i1e(t);n&&eNt(n)&&C1(n).position==="static";)n=i1e(n);return n&&(ux(n)==="html"||ux(n)==="body"&&C1(n).position==="static")?e:n||tNt(t)||e}function ple(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function _9(t,e,n){return g3(t,PR(e,n))}function nNt(t,e,n){var r=_9(t,e,n);return r>n?n:r}function MOe(){return{top:0,right:0,bottom:0,left:0}}function ROe(t){return Object.assign({},MOe(),t)}function LOe(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var rNt=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,ROe(typeof e!="number"?e:LOe(e,MT))};function sNt(t){var e,n=t.state,r=t.name,s=t.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,l=K0(n.placement),c=ple(l),u=[hf,bp].indexOf(l)>=0,d=u?"height":"width";if(!(!a||!o)){var f=rNt(s.padding,n),x=hle(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],N=RT(a),I=N?c==="y"?N.clientHeight||0:N.clientWidth||0:0,P=v/2-C/2,M=f[g],F=I-x[d]-f[y],$=I/2-x[d]/2+P,L=_9(M,$,F),z=c;n.modifiersData[r]=(e={},e[z]=L,e.centerOffset=L-$,e)}}function iNt(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)||OOe(e.elements.popper,s)&&(e.elements.arrow=s))}const aNt={name:"arrow",enabled:!0,phase:"main",fn:sNt,effect:iNt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wN(t){return t.split("-")[1]}var oNt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function lNt(t,e){var n=t.x,r=t.y,s=e.devicePixelRatio||1;return{x:yN(n*s)/s||0,y:yN(r*s)/s||0}}function a1e(t){var e,n=t.popper,r=t.popperRect,s=t.placement,a=t.variation,o=t.offsets,l=t.position,c=t.gpuAcceleration,u=t.adaptive,d=t.roundOffsets,f=t.isFixed,x=o.x,g=x===void 0?0:x,y=o.y,v=y===void 0?0:y,C=typeof d=="function"?d({x:g,y:v}):{x:g,y:v};g=C.x,v=C.y;var N=o.hasOwnProperty("x"),I=o.hasOwnProperty("y"),P=hf,M=ff,F=window;if(u){var $=RT(n),L="clientHeight",z="clientWidth";if($===sh(n)&&($=A2(n),C1($).position!=="static"&&l==="absolute"&&(L="scrollHeight",z="scrollWidth")),$=$,s===ff||(s===hf||s===bp)&&a===iE){M=gp;var Q=f&&$===F&&F.visualViewport?F.visualViewport.height:$[L];v-=Q-r.height,v*=c?1:-1}if(s===hf||(s===ff||s===gp)&&a===iE){P=bp;var se=f&&$===F&&F.visualViewport?F.visualViewport.width:$[z];g-=se-r.width,g*=c?1:-1}}var ee=Object.assign({position:l},u&&oNt),K=d===!0?lNt({x:g,y:v},sh(n)):{x:g,y:v};if(g=K.x,v=K.y,c){var re;return Object.assign({},ee,(re={},re[M]=I?"0":"",re[P]=N?"0":"",re.transform=(F.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",re))}return Object.assign({},ee,(e={},e[M]=I?v+"px":"",e[P]=N?g+"px":"",e.transform="",e))}function cNt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,s=r===void 0?!0:r,a=n.adaptive,o=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,u={placement:K0(e.placement),variation:wN(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,a1e(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,a1e(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 uNt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:cNt,data:{}};var YP={passive:!0};function dNt(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,YP)}),l&&c.addEventListener("resize",n.update,YP),function(){a&&u.forEach(function(d){d.removeEventListener("scroll",n.update,YP)}),l&&c.removeEventListener("resize",n.update,YP)}}const fNt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dNt,data:{}};var hNt={left:"right",right:"left",bottom:"top",top:"bottom"};function iM(t){return t.replace(/left|right|bottom|top/g,function(e){return hNt[e]})}var pNt={start:"end",end:"start"};function o1e(t){return t.replace(/start|end/g,function(e){return pNt[e]})}function mle(t){var e=sh(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function xle(t){return vN(A2(t)).left+mle(t).scrollLeft}function mNt(t,e){var n=sh(t),r=A2(t),s=n.visualViewport,a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;var u=FOe();(u||!u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l+xle(t),y:c}}function xNt(t){var e,n=A2(t),r=mle(t),s=(e=t.ownerDocument)==null?void 0:e.body,a=g3(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=g3(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),l=-r.scrollLeft+xle(t),c=-r.scrollTop;return C1(s||n).direction==="rtl"&&(l+=g3(n.clientWidth,s?s.clientWidth:0)-a),{width:a,height:o,x:l,y:c}}function gle(t){var e=C1(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function DOe(t){return["html","body","#document"].indexOf(ux(t))>=0?t.ownerDocument.body:cp(t)&&gle(t)?t:DOe(Y$(t))}function E9(t,e){var n;e===void 0&&(e=[]);var r=DOe(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),a=sh(r),o=s?[a].concat(a.visualViewport||[],gle(r)?r:[]):r,l=e.concat(o);return s?l:l.concat(E9(Y$(o)))}function kte(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function gNt(t,e){var n=vN(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 l1e(t,e,n){return e===TOe?kte(mNt(t,n)):Z3(e)?gNt(e,n):kte(xNt(A2(t)))}function bNt(t){var e=E9(Y$(t)),n=["absolute","fixed"].indexOf(C1(t).position)>=0,r=n&&cp(t)?RT(t):t;return Z3(r)?e.filter(function(s){return Z3(s)&&OOe(s,r)&&ux(s)!=="body"}):[]}function yNt(t,e,n,r){var s=e==="clippingParents"?bNt(t):[].concat(e),a=[].concat(s,[n]),o=a[0],l=a.reduce(function(c,u){var d=l1e(t,u,r);return c.top=g3(d.top,c.top),c.right=PR(d.right,c.right),c.bottom=PR(d.bottom,c.bottom),c.left=g3(d.left,c.left),c},l1e(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 BOe(t){var e=t.reference,n=t.element,r=t.placement,s=r?K0(r):null,a=r?wN(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?ple(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(a){case bN:c[u]=c[u]-(e[d]/2-n[d]/2);break;case iE:c[u]=c[u]+(e[d]/2-n[d]/2);break}}return c}function aE(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?$St:l,u=n.rootBoundary,d=u===void 0?TOe:u,f=n.elementContext,x=f===void 0?t7:f,g=n.altBoundary,y=g===void 0?!1:g,v=n.padding,C=v===void 0?0:v,N=ROe(typeof C!="number"?C:LOe(C,MT)),I=x===t7?USt:t7,P=t.rects.popper,M=t.elements[y?I:x],F=yNt(Z3(M)?M:M.contextElement||A2(t.elements.popper),c,d,o),$=vN(t.elements.reference),L=BOe({reference:$,element:P,strategy:"absolute",placement:s}),z=kte(Object.assign({},P,L)),Q=x===t7?z:$,se={top:F.top-Q.top+N.top,bottom:Q.bottom-F.bottom+N.bottom,left:F.left-Q.left+N.left,right:Q.right-F.right+N.right},ee=t.modifiersData.offset;if(x===t7&&ee){var K=ee[s];Object.keys(se).forEach(function(re){var de=[bp,gp].indexOf(re)>=0?1:-1,G=[ff,gp].indexOf(re)>=0?"y":"x";se[re]+=K[G]*de})}return se}function vNt(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?IOe:c,d=wN(r),f=d?l?s1e:s1e.filter(function(y){return wN(y)===d}):MT,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]=aE(t,{placement:v,boundary:s,rootBoundary:a,padding:o})[K0(v)],y},{});return Object.keys(g).sort(function(y,v){return g[y]-g[v]})}function wNt(t){if(K0(t)===dle)return[];var e=iM(t);return[o1e(t),e,o1e(e)]}function CNt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var s=n.mainAxis,a=s===void 0?!0:s,o=n.altAxis,l=o===void 0?!0:o,c=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,x=n.altBoundary,g=n.flipVariations,y=g===void 0?!0:g,v=n.allowedAutoPlacements,C=e.options.placement,N=K0(C),I=N===C,P=c||(I||!y?[iM(C)]:wNt(C)),M=[C].concat(P).reduce(function(xe,Se){return xe.concat(K0(Se)===dle?vNt(e,{placement:Se,boundary:d,rootBoundary:f,padding:u,flipVariations:y,allowedAutoPlacements:v}):Se)},[]),F=e.rects.reference,$=e.rects.popper,L=new Map,z=!0,Q=M[0],se=0;se<M.length;se++){var ee=M[se],K=K0(ee),re=wN(ee)===bN,de=[ff,gp].indexOf(K)>=0,G=de?"width":"height",ie=aE(e,{placement:ee,boundary:d,rootBoundary:f,altBoundary:x,padding:u}),ae=de?re?bp:hf:re?gp:ff;F[G]>$[G]&&(ae=iM(ae));var q=iM(ae),W=[];if(a&&W.push(ie[K]<=0),l&&W.push(ie[ae]<=0,ie[q]<=0),W.every(function(xe){return xe})){Q=ee,z=!1;break}L.set(ee,W)}if(z)for(var ne=y?3:1,oe=function(Se){var ge=M.find(function(Ce){var je=L.get(Ce);if(je)return je.slice(0,Se).every(function(Oe){return Oe})});if(ge)return Q=ge,"break"},he=ne;he>0;he--){var _e=oe(he);if(_e==="break")break}e.placement!==Q&&(e.modifiersData[r]._skip=!0,e.placement=Q,e.reset=!0)}}const SNt={name:"flip",enabled:!0,phase:"main",fn:CNt,requiresIfExists:["offset"],data:{_skip:!1}};function c1e(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 u1e(t){return[ff,bp,gp,hf].some(function(e){return t[e]>=0})}function NNt(t){var e=t.state,n=t.name,r=e.rects.reference,s=e.rects.popper,a=e.modifiersData.preventOverflow,o=aE(e,{elementContext:"reference"}),l=aE(e,{altBoundary:!0}),c=c1e(o,r),u=c1e(l,s,a),d=u1e(c),f=u1e(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 jNt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:NNt};function ANt(t,e,n){var r=K0(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 _Nt(t){var e=t.state,n=t.options,r=t.name,s=n.offset,a=s===void 0?[0,0]:s,o=IOe.reduce(function(d,f){return d[f]=ANt(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 ENt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:_Nt};function kNt(t){var e=t.state,n=t.name;e.modifiersData[n]=BOe({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const TNt={name:"popperOffsets",enabled:!0,phase:"read",fn:kNt,data:{}};function INt(t){return t==="x"?"y":"x"}function PNt(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=aE(e,{boundary:c,rootBoundary:u,padding:f,altBoundary:d}),N=K0(e.placement),I=wN(e.placement),P=!I,M=ple(N),F=INt(M),$=e.modifiersData.popperOffsets,L=e.rects.reference,z=e.rects.popper,Q=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,se=typeof Q=="number"?{mainAxis:Q,altAxis:Q}:Object.assign({mainAxis:0,altAxis:0},Q),ee=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,K={x:0,y:0};if($){if(a){var re,de=M==="y"?ff:hf,G=M==="y"?gp:bp,ie=M==="y"?"height":"width",ae=$[M],q=ae+C[de],W=ae-C[G],ne=g?-z[ie]/2:0,oe=I===bN?L[ie]:z[ie],he=I===bN?-z[ie]:-L[ie],_e=e.elements.arrow,xe=g&&_e?hle(_e):{width:0,height:0},Se=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:MOe(),ge=Se[de],Ce=Se[G],je=_9(0,L[ie],xe[ie]),Oe=P?L[ie]/2-ne-je-ge-se.mainAxis:oe-je-ge-se.mainAxis,$e=P?-L[ie]/2+ne+je+Ce+se.mainAxis:he+je+Ce+se.mainAxis,Ye=e.elements.arrow&&RT(e.elements.arrow),Je=Ye?M==="y"?Ye.clientTop||0:Ye.clientLeft||0:0,ht=(re=ee==null?void 0:ee[M])!=null?re:0,rt=ae+Oe-ht-Je,st=ae+$e-ht,He=_9(g?PR(q,rt):q,ae,g?g3(W,st):W);$[M]=He,K[M]=He-ae}if(l){var Ve,bt=M==="x"?ff:hf,xt=M==="x"?gp:bp,Qt=$[F],St=F==="y"?"height":"width",on=Qt+C[bt],cn=Qt-C[xt],Vn=[ff,hf].indexOf(N)!==-1,tn=(Ve=ee==null?void 0:ee[F])!=null?Ve:0,fn=Vn?on:Qt-L[St]-z[St]-tn+se.altAxis,rn=Vn?Qt+L[St]+z[St]-tn-se.altAxis:cn,nt=g&&Vn?nNt(fn,Qt,rn):_9(g?fn:on,Qt,g?rn:cn);$[F]=nt,K[F]=nt-Qt}e.modifiersData[r]=K}}const FNt={name:"preventOverflow",enabled:!0,phase:"main",fn:PNt,requiresIfExists:["offset"]};function ONt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function MNt(t){return t===sh(t)||!cp(t)?mle(t):ONt(t)}function RNt(t){var e=t.getBoundingClientRect(),n=yN(e.width)/t.offsetWidth||1,r=yN(e.height)/t.offsetHeight||1;return n!==1||r!==1}function LNt(t,e,n){n===void 0&&(n=!1);var r=cp(e),s=cp(e)&&RNt(e),a=A2(e),o=vN(t,s,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((ux(e)!=="body"||gle(a))&&(l=MNt(e)),cp(e)?(c=vN(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):a&&(c.x=xle(a))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function DNt(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 BNt(t){var e=DNt(t);return QSt.reduce(function(n,r){return n.concat(e.filter(function(s){return s.phase===r}))},[])}function $Nt(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function UNt(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 d1e={placement:"bottom",modifiers:[],strategy:"absolute"};function f1e(){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 zNt(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,s=e.defaultOptions,a=s===void 0?d1e:s;return function(l,c,u){u===void 0&&(u=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},d1e,a),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},f=[],x=!1,g={state:d,setOptions:function(N){var I=typeof N=="function"?N(d.options):N;v(),d.options=Object.assign({},a,d.options,I),d.scrollParents={reference:Z3(l)?E9(l):l.contextElement?E9(l.contextElement):[],popper:E9(c)};var P=BNt(UNt([].concat(r,d.options.modifiers)));return d.orderedModifiers=P.filter(function(M){return M.enabled}),y(),g.update()},forceUpdate:function(){if(!x){var N=d.elements,I=N.reference,P=N.popper;if(f1e(I,P)){d.rects={reference:LNt(I,RT(P),d.options.strategy==="fixed"),popper:hle(P)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(se){return d.modifiersData[se.name]=Object.assign({},se.data)});for(var M=0;M<d.orderedModifiers.length;M++){if(d.reset===!0){d.reset=!1,M=-1;continue}var F=d.orderedModifiers[M],$=F.fn,L=F.options,z=L===void 0?{}:L,Q=F.name;typeof $=="function"&&(d=$({state:d,options:z,name:Q,instance:g})||d)}}}},update:$Nt(function(){return new Promise(function(C){g.forceUpdate(),C(d)})}),destroy:function(){v(),x=!0}};if(!f1e(l,c))return g;g.setOptions(u).then(function(C){!x&&u.onFirstUpdate&&u.onFirstUpdate(C)});function y(){d.orderedModifiers.forEach(function(C){var N=C.name,I=C.options,P=I===void 0?{}:I,M=C.effect;if(typeof M=="function"){var F=M({state:d,name:N,instance:g,options:P}),$=function(){};f.push(F||$)}})}function v(){f.forEach(function(C){return C()}),f=[]}return g}}var HNt=[fNt,TNt,uNt,POe,ENt,SNt,FNt,aNt,jNt],VNt=zNt({defaultModifiers:HNt}),WNt="tippy-box",$Oe="tippy-content",qNt="tippy-backdrop",UOe="tippy-arrow",zOe="tippy-svg-arrow",Wv={passive:!0,capture:!0},HOe=function(){return document.body};function uW(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function ble(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function VOe(t,e){return typeof t=="function"?t.apply(void 0,e):t}function h1e(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function GNt(t){return t.split(/\s+/).filter(Boolean)}function VC(t){return[].concat(t)}function p1e(t,e){t.indexOf(e)===-1&&t.push(e)}function KNt(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function YNt(t){return t.split("-")[0]}function FR(t){return[].slice.call(t)}function m1e(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function k9(){return document.createElement("div")}function X$(t){return["Element","Fragment"].some(function(e){return ble(t,e)})}function XNt(t){return ble(t,"NodeList")}function WOe(t){return ble(t,"MouseEvent")}function QNt(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function ZNt(t){return X$(t)?[t]:XNt(t)?FR(t):Array.isArray(t)?t:FR(document.querySelectorAll(t))}function dW(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function x1e(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function qOe(t){var e,n=VC(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function JNt(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=YNt(o.placement),d=o.modifiersData.offset;if(!d)return!0;var f=u==="bottom"?d.top.y:0,x=u==="top"?d.bottom.y:0,g=u==="right"?d.left.x:0,y=u==="left"?d.right.x:0,v=a.top-r+f>c,C=r-a.bottom-x>c,N=a.left-n+g>c,I=n-a.right-y>c;return v||C||N||I})}function fW(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){t[r](s,n)})}function g1e(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},b1e=0;function ejt(){E0.isTouch||(E0.isTouch=!0,window.performance&&document.addEventListener("mousemove",GOe))}function GOe(){var t=performance.now();t-b1e<20&&(E0.isTouch=!1,document.removeEventListener("mousemove",GOe)),b1e=t}function tjt(){var t=document.activeElement;if(QNt(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function njt(){document.addEventListener("touchstart",ejt,Wv),window.addEventListener("blur",tjt)}var rjt=typeof window<"u"&&typeof document<"u",sjt=rjt?!!window.msCrypto:!1,ijt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},ajt={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},mm=Object.assign({appendTo:HOe,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},ijt,ajt),ojt=Object.keys(mm),ljt=function(e){var n=Object.keys(e);n.forEach(function(r){mm[r]=e[r]})};function KOe(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 cjt(t,e){var n=e?Object.keys(KOe(Object.assign({},mm,{plugins:e}))):ojt,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 y1e(t,e){var n=Object.assign({},e,{content:VOe(e.content,[t])},e.ignoreAttributes?{}:cjt(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 ujt=function(){return"innerHTML"};function Tte(t,e){t[ujt()]=e}function v1e(t){var e=k9();return t===!0?e.className=UOe:(e.className=zOe,X$(t)?e.appendChild(t):Tte(e,t)),e}function w1e(t,e){X$(e.content)?(Tte(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Tte(t,e.content):t.textContent=e.content)}function Ite(t){var e=t.firstElementChild,n=FR(e.children);return{box:e,content:n.find(function(r){return r.classList.contains($Oe)}),arrow:n.find(function(r){return r.classList.contains(UOe)||r.classList.contains(zOe)}),backdrop:n.find(function(r){return r.classList.contains(qNt)})}}function YOe(t){var e=k9(),n=k9();n.className=WNt,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=k9();r.className=$Oe,r.setAttribute("data-state","hidden"),w1e(r,t.props),e.appendChild(n),n.appendChild(r),s(t.props,t.props);function s(a,o){var l=Ite(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)&&w1e(u,t.props),o.arrow?d?a.arrow!==o.arrow&&(c.removeChild(d),c.appendChild(v1e(o.arrow))):c.appendChild(v1e(o.arrow)):d&&c.removeChild(d)}return{popper:e,onUpdate:s}}YOe.$$tippy=!0;var djt=1,XP=[],hW=[];function fjt(t,e){var n=y1e(t,Object.assign({},mm,KOe(m1e(e)))),r,s,a,o=!1,l=!1,c=!1,u=!1,d,f,x,g=[],y=h1e(rt,n.interactiveDebounce),v,C=djt++,N=null,I=KNt(n.plugins),P={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},M={id:C,reference:t,popper:k9(),popperInstance:N,props:n,state:P,plugins:I,clearDelayTimeouts:fn,setProps:rn,setContent:nt,show:it,hide:Ut,hideWithInteractivity:hn,enable:Vn,disable:tn,unmount:nn,destroy:Vt};if(!n.render)return M;var F=n.render(M),$=F.popper,L=F.onUpdate;$.setAttribute("data-tippy-root",""),$.id="tippy-"+M.id,M.popper=$,t._tippy=M,$._tippy=M;var z=I.map(function(pt){return pt.fn(M)}),Q=t.hasAttribute("aria-expanded");return Ye(),ne(),ae(),q("onCreate",[M]),n.showOnCreate&&on(),$.addEventListener("mouseenter",function(){M.props.interactive&&M.state.isVisible&&M.clearDelayTimeouts()}),$.addEventListener("mouseleave",function(){M.props.interactive&&M.props.trigger.indexOf("mouseenter")>=0&&de().addEventListener("mousemove",y)}),M;function se(){var pt=M.props.touch;return Array.isArray(pt)?pt:[pt,0]}function ee(){return se()[0]==="hold"}function K(){var pt;return!!((pt=M.props.render)!=null&&pt.$$tippy)}function re(){return v||t}function de(){var pt=re().parentNode;return pt?qOe(pt):document}function G(){return Ite($)}function ie(pt){return M.state.isMounted&&!M.state.isVisible||E0.isTouch||d&&d.type==="focus"?0:uW(M.props.delay,pt?0:1,mm.delay)}function ae(pt){pt===void 0&&(pt=!1),$.style.pointerEvents=M.props.interactive&&!pt?"":"none",$.style.zIndex=""+M.props.zIndex}function q(pt,We,It){if(It===void 0&&(It=!0),z.forEach(function(ct){ct[pt]&&ct[pt].apply(ct,We)}),It){var Ge;(Ge=M.props)[pt].apply(Ge,We)}}function W(){var pt=M.props.aria;if(pt.content){var We="aria-"+pt.content,It=$.id,Ge=VC(M.props.triggerTarget||t);Ge.forEach(function(ct){var vt=ct.getAttribute(We);if(M.state.isVisible)ct.setAttribute(We,vt?vt+" "+It:It);else{var Ht=vt&&vt.replace(It,"").trim();Ht?ct.setAttribute(We,Ht):ct.removeAttribute(We)}})}}function ne(){if(!(Q||!M.props.aria.expanded)){var pt=VC(M.props.triggerTarget||t);pt.forEach(function(We){M.props.interactive?We.setAttribute("aria-expanded",M.state.isVisible&&We===re()?"true":"false"):We.removeAttribute("aria-expanded")})}}function oe(){de().removeEventListener("mousemove",y),XP=XP.filter(function(pt){return pt!==y})}function he(pt){if(!(E0.isTouch&&(c||pt.type==="mousedown"))){var We=pt.composedPath&&pt.composedPath()[0]||pt.target;if(!(M.props.interactive&&g1e($,We))){if(VC(M.props.triggerTarget||t).some(function(It){return g1e(It,We)})){if(E0.isTouch||M.state.isVisible&&M.props.trigger.indexOf("click")>=0)return}else q("onClickOutside",[M,pt]);M.props.hideOnClick===!0&&(M.clearDelayTimeouts(),M.hide(),l=!0,setTimeout(function(){l=!1}),M.state.isMounted||ge())}}}function _e(){c=!0}function xe(){c=!1}function Se(){var pt=de();pt.addEventListener("mousedown",he,!0),pt.addEventListener("touchend",he,Wv),pt.addEventListener("touchstart",xe,Wv),pt.addEventListener("touchmove",_e,Wv)}function ge(){var pt=de();pt.removeEventListener("mousedown",he,!0),pt.removeEventListener("touchend",he,Wv),pt.removeEventListener("touchstart",xe,Wv),pt.removeEventListener("touchmove",_e,Wv)}function Ce(pt,We){Oe(pt,function(){!M.state.isVisible&&$.parentNode&&$.parentNode.contains($)&&We()})}function je(pt,We){Oe(pt,We)}function Oe(pt,We){var It=G().box;function Ge(ct){ct.target===It&&(fW(It,"remove",Ge),We())}if(pt===0)return We();fW(It,"remove",f),fW(It,"add",Ge),f=Ge}function $e(pt,We,It){It===void 0&&(It=!1);var Ge=VC(M.props.triggerTarget||t);Ge.forEach(function(ct){ct.addEventListener(pt,We,It),g.push({node:ct,eventType:pt,handler:We,options:It})})}function Ye(){ee()&&($e("touchstart",ht,{passive:!0}),$e("touchend",st,{passive:!0})),GNt(M.props.trigger).forEach(function(pt){if(pt!=="manual")switch($e(pt,ht),pt){case"mouseenter":$e("mouseleave",st);break;case"focus":$e(sjt?"focusout":"blur",He);break;case"focusin":$e("focusout",He);break}})}function Je(){g.forEach(function(pt){var We=pt.node,It=pt.eventType,Ge=pt.handler,ct=pt.options;We.removeEventListener(It,Ge,ct)}),g=[]}function ht(pt){var We,It=!1;if(!(!M.state.isEnabled||Ve(pt)||l)){var Ge=((We=d)==null?void 0:We.type)==="focus";d=pt,v=pt.currentTarget,ne(),!M.state.isVisible&&WOe(pt)&&XP.forEach(function(ct){return ct(pt)}),pt.type==="click"&&(M.props.trigger.indexOf("mouseenter")<0||o)&&M.props.hideOnClick!==!1&&M.state.isVisible?It=!0:on(pt),pt.type==="click"&&(o=!It),It&&!Ge&&cn(pt)}}function rt(pt){var We=pt.target,It=re().contains(We)||$.contains(We);if(!(pt.type==="mousemove"&&It)){var Ge=St().concat($).map(function(ct){var vt,Ht=ct._tippy,Rt=(vt=Ht.popperInstance)==null?void 0:vt.state;return Rt?{popperRect:ct.getBoundingClientRect(),popperState:Rt,props:n}:null}).filter(Boolean);JNt(Ge,pt)&&(oe(),cn(pt))}}function st(pt){var We=Ve(pt)||M.props.trigger.indexOf("click")>=0&&o;if(!We){if(M.props.interactive){M.hideWithInteractivity(pt);return}cn(pt)}}function He(pt){M.props.trigger.indexOf("focusin")<0&&pt.target!==re()||M.props.interactive&&pt.relatedTarget&&$.contains(pt.relatedTarget)||cn(pt)}function Ve(pt){return E0.isTouch?ee()!==pt.type.indexOf("touch")>=0:!1}function bt(){xt();var pt=M.props,We=pt.popperOptions,It=pt.placement,Ge=pt.offset,ct=pt.getReferenceClientRect,vt=pt.moveTransition,Ht=K()?Ite($).arrow:null,Rt=ct?{getBoundingClientRect:ct,contextElement:ct.contextElement||re()}:t,mn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(_n){var In=_n.state;if(K()){var Sn=G(),Yn=Sn.box;["placement","reference-hidden","escaped"].forEach(function(Xn){Xn==="placement"?Yn.setAttribute("data-placement",In.placement):In.attributes.popper["data-popper-"+Xn]?Yn.setAttribute("data-"+Xn,""):Yn.removeAttribute("data-"+Xn)}),In.attributes.popper={}}}},un=[{name:"offset",options:{offset:Ge}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!vt}},mn];K()&&Ht&&un.push({name:"arrow",options:{element:Ht,padding:3}}),un.push.apply(un,(We==null?void 0:We.modifiers)||[]),M.popperInstance=VNt(Rt,$,Object.assign({},We,{placement:It,onFirstUpdate:x,modifiers:un}))}function xt(){M.popperInstance&&(M.popperInstance.destroy(),M.popperInstance=null)}function Qt(){var pt=M.props.appendTo,We,It=re();M.props.interactive&&pt===HOe||pt==="parent"?We=It.parentNode:We=VOe(pt,[It]),We.contains($)||We.appendChild($),M.state.isMounted=!0,bt()}function St(){return FR($.querySelectorAll("[data-tippy-root]"))}function on(pt){M.clearDelayTimeouts(),pt&&q("onTrigger",[M,pt]),Se();var We=ie(!0),It=se(),Ge=It[0],ct=It[1];E0.isTouch&&Ge==="hold"&&ct&&(We=ct),We?r=setTimeout(function(){M.show()},We):M.show()}function cn(pt){if(M.clearDelayTimeouts(),q("onUntrigger",[M,pt]),!M.state.isVisible){ge();return}if(!(M.props.trigger.indexOf("mouseenter")>=0&&M.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(pt.type)>=0&&o)){var We=ie(!1);We?s=setTimeout(function(){M.state.isVisible&&M.hide()},We):a=requestAnimationFrame(function(){M.hide()})}}function Vn(){M.state.isEnabled=!0}function tn(){M.hide(),M.state.isEnabled=!1}function fn(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(a)}function rn(pt){if(!M.state.isDestroyed){q("onBeforeUpdate",[M,pt]),Je();var We=M.props,It=y1e(t,Object.assign({},We,m1e(pt),{ignoreAttributes:!0}));M.props=It,Ye(),We.interactiveDebounce!==It.interactiveDebounce&&(oe(),y=h1e(rt,It.interactiveDebounce)),We.triggerTarget&&!It.triggerTarget?VC(We.triggerTarget).forEach(function(Ge){Ge.removeAttribute("aria-expanded")}):It.triggerTarget&&t.removeAttribute("aria-expanded"),ne(),ae(),L&&L(We,It),M.popperInstance&&(bt(),St().forEach(function(Ge){requestAnimationFrame(Ge._tippy.popperInstance.forceUpdate)})),q("onAfterUpdate",[M,pt])}}function nt(pt){M.setProps({content:pt})}function it(){var pt=M.state.isVisible,We=M.state.isDestroyed,It=!M.state.isEnabled,Ge=E0.isTouch&&!M.props.touch,ct=uW(M.props.duration,0,mm.duration);if(!(pt||We||It||Ge)&&!re().hasAttribute("disabled")&&(q("onShow",[M],!1),M.props.onShow(M)!==!1)){if(M.state.isVisible=!0,K()&&($.style.visibility="visible"),ae(),Se(),M.state.isMounted||($.style.transition="none"),K()){var vt=G(),Ht=vt.box,Rt=vt.content;dW([Ht,Rt],0)}x=function(){var un;if(!(!M.state.isVisible||u)){if(u=!0,$.offsetHeight,$.style.transition=M.props.moveTransition,K()&&M.props.animation){var yn=G(),_n=yn.box,In=yn.content;dW([_n,In],ct),x1e([_n,In],"visible")}W(),ne(),p1e(hW,M),(un=M.popperInstance)==null||un.forceUpdate(),q("onMount",[M]),M.props.animation&&K()&&je(ct,function(){M.state.isShown=!0,q("onShown",[M])})}},Qt()}}function Ut(){var pt=!M.state.isVisible,We=M.state.isDestroyed,It=!M.state.isEnabled,Ge=uW(M.props.duration,1,mm.duration);if(!(pt||We||It)&&(q("onHide",[M],!1),M.props.onHide(M)!==!1)){if(M.state.isVisible=!1,M.state.isShown=!1,u=!1,o=!1,K()&&($.style.visibility="hidden"),oe(),ge(),ae(!0),K()){var ct=G(),vt=ct.box,Ht=ct.content;M.props.animation&&(dW([vt,Ht],Ge),x1e([vt,Ht],"hidden"))}W(),ne(),M.props.animation?K()&&Ce(Ge,M.unmount):M.unmount()}}function hn(pt){de().addEventListener("mousemove",y),p1e(XP,y),y(pt)}function nn(){M.state.isVisible&&M.hide(),M.state.isMounted&&(xt(),St().forEach(function(pt){pt._tippy.unmount()}),$.parentNode&&$.parentNode.removeChild($),hW=hW.filter(function(pt){return pt!==M}),M.state.isMounted=!1,q("onHidden",[M]))}function Vt(){M.state.isDestroyed||(M.clearDelayTimeouts(),M.unmount(),Je(),delete t._tippy,M.state.isDestroyed=!0,q("onDestroy",[M]))}}function LT(t,e){e===void 0&&(e={});var n=mm.plugins.concat(e.plugins||[]);njt();var r=Object.assign({},e,{plugins:n}),s=ZNt(t),a=s.reduce(function(o,l){var c=l&&fjt(l,r);return c&&o.push(c),o},[]);return X$(t)?a[0]:a}LT.defaultProps=mm;LT.setDefaultProps=ljt;LT.currentInput=E0;Object.assign({},POe,{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 Pte={clientX:0,clientY:0},QP=[];function XOe(t){var e=t.clientX,n=t.clientY;Pte={clientX:e,clientY:n}}function hjt(t){t.addEventListener("mousemove",XOe)}function pjt(t){t.removeEventListener("mousemove",XOe)}var mjt={name:"followCursor",defaultValue:!1,fn:function(e){var n=e.reference,r=qOe(e.props.triggerTarget||n),s=!1,a=!1,o=!0,l=e.props;function c(){return e.props.followCursor==="initial"&&e.state.isVisible}function u(){r.addEventListener("mousemove",x)}function d(){r.removeEventListener("mousemove",x)}function f(){s=!0,e.setProps({getReferenceClientRect:null}),s=!1}function x(v){var C=v.target?n.contains(v.target):!0,N=e.props.followCursor,I=v.clientX,P=v.clientY,M=n.getBoundingClientRect(),F=I-M.left,$=P-M.top;(C||!e.props.interactive)&&e.setProps({getReferenceClientRect:function(){var z=n.getBoundingClientRect(),Q=I,se=P;N==="initial"&&(Q=z.left+F,se=z.top+$);var ee=N==="horizontal"?z.top:se,K=N==="vertical"?z.right:Q,re=N==="horizontal"?z.bottom:se,de=N==="vertical"?z.left:Q;return{width:K-de,height:re-ee,top:ee,right:K,bottom:re,left:de}}})}function g(){e.props.followCursor&&(QP.push({instance:e,doc:r}),hjt(r))}function y(){QP=QP.filter(function(v){return v.instance!==e}),QP.filter(function(v){return v.doc===r}).length===0&&pjt(r)}return{onCreate:g,onDestroy:y,onBeforeUpdate:function(){l=e.props},onAfterUpdate:function(C,N){var I=N.followCursor;s||I!==void 0&&l.followCursor!==I&&(y(),I?(g(),e.state.isMounted&&!a&&!c()&&u()):(d(),f()))},onMount:function(){e.props.followCursor&&!a&&(o&&(x(Pte),o=!1),c()||u())},onTrigger:function(C,N){WOe(N)&&(Pte={clientX:N.clientX,clientY:N.clientY}),a=N.type==="focus"},onHidden:function(){e.props.followCursor&&(f(),d(),o=!0)}}}};LT.setDefaultProps({render:YOe});function Us({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=NAe.createRoot(s.current),a.current.render(t));const c=LT(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:[mjt],delay:[0,0],offset:[10,10],animation:"scale-subtle",duration:[50,100],placement:"top",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["right","bottom","left"]}},{name:"preventOverflow",options:{padding:8}}]},interactive:!1,moveTransition:"",trigger:"mouseenter mousemove",theme:"custom",onShow(){setTimeout(()=>{window.dispatchEvent(new Event("resize"))},50)}});return o.current=c,()=>{a.current&&Promise.resolve().then(()=>{var u;(u=a.current)==null||u.unmount()})}},[t]),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 S1;(function(t){t.HEX="BYTES_HEX",t.UINT8ARRAY="BYTES_UINT8ARRAY"})(S1||(S1={}));const yd={number:ap.BIGINT,bytes:S1.HEX},bi={number:ap.HEX,bytes:S1.HEX};var Bg;(function(t){t.EARLIEST="earliest",t.LATEST="latest",t.PENDING="pending",t.SAFE="safe",t.FINALIZED="finalized",t.COMMITTED="committed"})(Bg||(Bg={}));var T9;(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"})(T9||(T9={}));const yle=Object.getPrototypeOf(Uint8Array);var C1e=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 S1e=Symbol.for("web3/base-provider");class DT{static isWeb3Provider(e){return e instanceof DT||!!(e&&e[S1e])}get[S1e](){return!0}send(e,n){this.request(e).then(r=>{n(null,r)}).catch(r=>{n(r)})}sendAsync(e){return C1e(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 C1e(this,void 0,void 0,function*(){return(yield n(s)).result})},e.asEIP1193Provider=void 0,e}}class xjt extends Array{constructor(e){super(),this._accountProvider=e}}const gjt=100,bjt=101,yjt=201,vjt=202,wjt=203,Cjt=204,Sjt=205,Njt=206,jjt=207,Ajt=208,_jt=300,Ejt=301,kjt=310,Tjt=311,Ijt=400,Pjt=402,Fjt=405,Ojt=407,Mjt=408,Rjt=410,Ljt=411,Djt=412,Bjt=413,$jt=414,Ujt=415,zjt=416,Hjt=417,Vjt=418,Wjt=419,qjt=420,Gjt=421,Kjt=422,Yjt=423,Xjt=424,Qjt=425,Zjt=426,Jjt=427,e8t=428,t8t=429,n8t=430,r8t=431,s8t=432,i8t=433,a8t=434,o8t=435,l8t=436,c8t=437,u8t=438,d8t=439,f8t=440,h8t=441,p8t=500,m8t=503,x8t=505,g8t=506,b8t=507,y8t=600,v8t=602,w8t=603,C8t=604,S8t=701,N8t=702,j8t=703,A8t=704,_8t=705,E8t=706,k8t=707,T8t=709,I8t=801,P8t=802,F8t=4001,O8t=4100,M8t=4200,R8t=4900,L8t=4901,D8t=902,B8t=903,$8t=1001,U8t=1002,z8t=1003,H8t=1004,V8t=1005,W8t=1006,q8t=1008,G8t=1009,K8t=1010,Y8t=1011,X8t=1012,Q8t=1014,Z8t=1015,J8t=1100,QOe=1101,eAt=1200,OR=-32700,MR=-32600,RR=-32601,LR=-32602,DR=-32603,BR=-32e3,$R=-32001,UR=-32002,zR=-32003,HR=-32004,VR=-32005,WR=-32006;class xi extends Error{get innerError(){return this.cause instanceof I9?this.cause.errors:this.cause}set innerError(e){Array.isArray(e)?this.cause=new I9(e):this.cause=e}constructor(e,n){super(e),Array.isArray(n)?this.cause=new I9(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 I9 extends xi{constructor(e){super(`Multiple errors occurred: [${e.map(n=>n.message).join("], [")}]`),this.code=Ajt,this.errors=e}}class Hi extends xi{constructor(e,n){super(`Invalid value given "${xi.convertToString(e,!0)}". Error: ${n}.`),this.name=this.constructor.name}}class N1e extends xi{constructor(){super("Private key must be 32 bytes."),this.code=S8t}}class tAt extends xi{constructor(){super("Invalid Private Key, Not a valid string or uint8Array"),this.code=N8t}}class nAt extends xi{constructor(e){super(`"${e}"`),this.code=P8t}}class ZOe extends xi{constructor(){super("Invalid key derivation function"),this.code=j8t}}class rAt extends xi{constructor(){super("Key derivation failed - possibly wrong password"),this.code=A8t}}class sAt extends xi{constructor(){super("Unsupported key store version"),this.code=_8t}}class iAt extends xi{constructor(){super("Password cannot be empty"),this.code=E8t}}class aAt extends xi{constructor(){super("Initialization vector must be 16 bytes"),this.code=k8t}}class oAt extends xi{constructor(){super("c > 1000, pbkdf2 is less secure with less iterations"),this.code=T8t}}class BT extends xi{constructor(e,n){super(e),this.code=p8t,n&&(this.errorCode=n.code,this.errorReason=n.reason)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{errorCode:this.errorCode,errorReason:this.errorReason})}}class Fte extends BT{constructor(e){super("Connection not open",e),this.code=m8t}}class lAt extends BT{constructor(e){super(`Maximum number of reconnect attempts reached! (${e})`),this.code=x8t}}class cAt extends BT{constructor(){super("CONNECTION ERROR: Provider started to reconnect before the response got received!"),this.code=g8t}}class uAt extends BT{constructor(e){super(`Request already sent with following id: ${e}`),this.code=b8t}}class vd extends xi{constructor(e,n){super(e),this.code=_jt,this.receipt=n}}class j1e extends xi{constructor(e,n){super(`The resolver at ${e} does not implement requested method: "${n}".`),this.address=e,this.name=n,this.code=Ejt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{address:this.address,name:this.name})}}class Q$ 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 Q$(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 b3 extends vd{constructor(e){super("Error happened while trying to execute a function inside a smart contract"),this.code=kjt,this.cause=new Q$(e)}}class dAt extends Hi{constructor(e){var n,r;super(`data: ${(n=e.data)!==null&&n!==void 0?n:"undefined"}, input: ${(r=e.input)!==null&&r!==void 0?r:"undefined"}`,`You can't have "data" and "input" as properties of a contract at the same time, please use either "data" or "input" instead.`),this.code=Tjt}}class fAt extends xi{constructor(e){super(`ENS is not supported on network ${e}`),this.code=D8t}}class hAt extends xi{constructor(){super("Network not synced"),this.code=B8t}}class A1e extends xi{constructor(e){super(`Invalid parameters passed. "${typeof e<"u"?e:""}"`),this.hint=e,this.code=jjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{hint:this.hint})}}class Ote extends xi{constructor(){super(...arguments),this.code=yjt}}class Yx extends xi{constructor(){super("The method you're trying to call is not implemented."),this.code=vjt}}class JOe extends xi{constructor(){super(...arguments),this.code=wjt}}class pAt extends xi{constructor(){super(...arguments),this.code=Cjt}}class Xi extends xi{constructor(e,n){super(e),this.code=Sjt,this.props=n??{}}}class mAt extends xi{constructor(e){super(`A plugin with the namespace: ${e} has already been registered.`),this.code=Njt}}class aM extends xi{constructor(){super(...arguments),this.code=y8t}}class Mte extends xi{constructor(e){super(`Client URL "${e}" is invalid.`),this.code=v8t}}class gg extends xi{constructor(){super(...arguments),this.code=w8t}}class xAt extends xi{constructor(){super(...arguments),this.code=C8t}}class gAt extends Hi{constructor(){super(...arguments),this.code=I8t}}class vle extends xi{constructor(e,n){super(e),this.receipt=n,this.code=Ijt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{receipt:this.receipt})}}class qR 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=Pjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,signature:this.signature,receipt:this.receipt,data:this.data})}}class eMe extends qR{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=u8t}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 tMe extends vle{constructor(e){super(`Transaction has been reverted by the EVM${e===void 0?"":`:
${xi.convertToString(e)}`}`,e),this.code=Fjt}}class bAt extends vle{constructor(){super("Raw transaction undefined"),this.code=Ojt}}class _1e extends vle{constructor(){super("Transaction not found"),this.code=n8t}}class yAt extends Hi{constructor(e){super(e,"invalid transaction with invalid sender"),this.code=Mjt}}class vAt extends Hi{constructor(e){super(e,"invalid transaction with invalid receiver"),this.code=c8t}}class wAt extends Hi{constructor(){super("MissingCustomChainError","If tx.common is provided it must have tx.common.customChain"),this.code=Rjt}}class CAt extends Hi{constructor(){super("MissingCustomChainIdError","If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId"),this.code=Ljt}}class SAt extends Hi{constructor(e){super(JSON.stringify(e),"Chain Id doesnt match in tx.chainId tx.common.customChain.chainId"),this.code=Djt}}class NAt extends Hi{constructor(e){super(JSON.stringify(e),"Chain doesnt match in tx.chain tx.common.basechain"),this.code=o8t}}class jAt extends Hi{constructor(e){super(JSON.stringify(e),"hardfork doesnt match in tx.hardfork tx.common.hardfork"),this.code=l8t}}class AAt extends Hi{constructor(){super("CommonOrChainAndHardforkError","Please provide the common object or the chain and hardfork property but not all together."),this.code=Bjt}}class _At extends Hi{constructor(e){var n,r;super("MissingChainOrHardforkError",`When specifying chain and hardfork, both values must be defined. Received "chain": ${(n=e.chain)!==null&&n!==void 0?n:"undefined"}, "hardfork": ${(r=e.hardfork)!==null&&r!==void 0?r:"undefined"}`),this.code=$jt}}class EAt 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=f8t}}class kAt extends Hi{constructor(e){var n,r,s,a;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}, maxPriorityFeePerGas: ${(s=e.maxPriorityFeePerGas)!==null&&s!==void 0?s:"undefined"}, maxFeePerGas: ${(a=e.maxFeePerGas)!==null&&a!==void 0?a:"undefined"}`,'"gas" is missing'),this.code=Ujt,this.cause=new EAt}}class TAt 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=h8t}}class IAt extends Hi{constructor(e){var n,r,s,a;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}, maxPriorityFeePerGas: ${(s=e.maxPriorityFeePerGas)!==null&&s!==void 0?s:"undefined"}, maxFeePerGas: ${(a=e.maxFeePerGas)!==null&&a!==void 0?a:"undefined"}`,"transaction must specify legacy or fee market gas properties, not both"),this.code=a8t,this.cause=new TAt}}class PAt extends Hi{constructor(e){var n,r;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}`,"Gas or gasPrice is lower than 0"),this.code=zjt}}class FAt extends Hi{constructor(e){var n,r;super(`maxPriorityFeePerGas: ${(n=e.maxPriorityFeePerGas)!==null&&n!==void 0?n:"undefined"}, maxFeePerGas: ${(r=e.maxFeePerGas)!==null&&r!==void 0?r:"undefined"}`,"maxPriorityFeePerGas or maxFeePerGas is lower than 0"),this.code=Hjt}}class OAt extends Hi{constructor(e){super(e,"eip-1559 transactions don't support gasPrice"),this.code=Vjt}}class nMe extends Hi{constructor(e){var n,r;super(`maxPriorityFeePerGas: ${(n=e.maxPriorityFeePerGas)!==null&&n!==void 0?n:"undefined"}, maxFeePerGas: ${(r=e.maxFeePerGas)!==null&&r!==void 0?r:"undefined"}`,"pre-eip-1559 transaction don't support maxFeePerGas/maxPriorityFeePerGas"),this.code=Wjt}}class MAt extends Hi{constructor(e){super(e,"invalid transaction object"),this.code=qjt}}class RAt extends Hi{constructor(e){var n,r;super(`nonce: ${(n=e.nonce)!==null&&n!==void 0?n:"undefined"}, chainId: ${(r=e.chainId)!==null&&r!==void 0?r:"undefined"}`,"Nonce or chainId is lower than 0"),this.code=Gjt}}class LAt extends Hi{constructor(){super("UnableToPopulateNonceError","unable to populate nonce, no from address available"),this.code=Kjt}}class DAt extends Hi{constructor(){super("Eip1559NotSupportedError","Network doesn't support eip-1559"),this.code=Yjt}}class E1e extends Hi{constructor(e){super(e,"unsupported transaction type"),this.code=Xjt}}class rMe extends Hi{constructor(e){var n,r;super(`data: ${(n=e.data)!==null&&n!==void 0?n:"undefined"}, input: ${(r=e.input)!==null&&r!==void 0?r:"undefined"}`,`You can't have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.`),this.code=Qjt}}class BAt 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=r8t}}function sMe(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 iMe extends xi{constructor(e){super(`Transaction was not mined within ${e.numberOfSeconds} seconds. ${sMe(e.transactionHash)}`),this.code=Zjt}}class aMe extends xi{constructor(e){super(`Transaction started at ${e.starterBlockNumber} but was not mined within ${e.numberOfBlocks} blocks. ${sMe(e.transactionHash)}`),this.code=s8t}}class $At extends Hi{constructor(e){var n,r;super(`receipt: ${JSON.stringify(e.receipt)}, blockHash: ${(n=e.blockHash)===null||n===void 0?void 0:n.toString()}, transactionHash: ${(r=e.transactionHash)===null||r===void 0?void 0:r.toString()}`,"Receipt missing or blockHash null"),this.code=Jjt}}class UAt extends Hi{constructor(e){super(`receipt: ${JSON.stringify(e.receipt)}`,"Receipt missing block number"),this.code=e8t}}class Rte extends xi{constructor(e){super(`Invalid signature. "${e}"`),this.code=i8t}}class k1e extends Hi{constructor(){super("LocalWalletNotAvailableError","Attempted to index account in local wallet, but no wallet is available"),this.code=t8t}}class zAt 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=d8t}}class I4 extends Hi{constructor(e){super(e,"can not parse as byte data"),this.code=U8t}}class wle extends Hi{constructor(e){super(e,"can not parse as number data"),this.code=z8t}}class Cle extends Hi{constructor(e){super(e,"invalid ethereum address"),this.code=V8t}}class HAt extends Hi{constructor(e){super(e,"not a valid string"),this.code=$8t}}class oMe extends Hi{constructor(e){super(e,"invalid unit"),this.code=H8t}}class lMe extends Hi{constructor(e){super(e,"not a valid unit. Must be a positive integer"),this.code=Z8t}}class VAt extends Hi{constructor(e){super(e,"can not be converted to hex"),this.code=W8t}}class cMe extends Hi{constructor(e){super(e,"value greater than the nibble width"),this.code=Q8t}}class Sle extends Hi{constructor(e){super(e,"not a valid boolean."),this.code=q8t}}class WAt extends Hi{constructor(e){super(e,"not a valid unsigned integer."),this.code=G8t}}class T1e extends Hi{constructor(e){super(e,"invalid size given."),this.code=K8t}}class I1e extends Hi{constructor(e){super(e,"value is larger than size."),this.code=Y8t}}class qAt extends Hi{constructor(e){super(e,"invalid string given"),this.code=X8t}}const GAt=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"),P1e=t=>GAt(t)?t.error.message:"";class P0 extends xi{constructor(e,n,r,s){var a;super(n??`Returned error: ${Array.isArray(e)?e.map(l=>P1e(l)).join(","):P1e(e)}`),this.code=gjt,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 I9(o):this.cause=o}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{data:this.data,request:this.request,statusCode:this.statusCode})}}class Z$ extends P0{constructor(e,n){super(e,void 0,n),this.code=bjt;let r;"error"in e?r=e.error:e instanceof Array&&(r=e.map(s=>s.error)),Array.isArray(r)?this.cause=new I9(r):this.cause=r}}class F1e extends xi{constructor(e,n){super(`Web3Config hardfork doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=QOe}}class O1e extends xi{constructor(e,n){super(`Web3Config chain doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=QOe}}const uMe="An Rpc error has occured with a code of *code*",Du={[OR]:{message:"Parse error",description:"Invalid JSON"},[MR]:{message:"Invalid request",description:"JSON is not a valid request object "},[RR]:{message:"Method not found",description:"Method does not exist "},[LR]:{message:"Invalid params",description:"Invalid method parameters"},[DR]:{message:"Internal error",description:"Internal JSON-RPC error"},[BR]:{message:"Invalid input",description:"Missing or invalid parameters"},[$R]:{message:"Resource not found",description:"Requested resource not found"},[UR]:{message:"Resource unavailable",description:"Requested resource not available"},[zR]:{message:"Transaction rejected",description:"Transaction creation failed"},[HR]:{message:"Method not supported",description:"Method is not implemented"},[VR]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[WR]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[F8t]:{name:"User Rejected Request",message:"The user rejected the request."},[O8t]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[M8t]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[R8t]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[L8t]:{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??uMe.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 KAt 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:uMe.replace("*code*",(o=e==null?void 0:e.toString())!==null&&o!==void 0?o:'""'))}this.code=e,this.data=n}}class YAt extends ch{constructor(e){super(e,Du[OR].message),this.code=OR}}class XAt extends ch{constructor(e){super(e,Du[MR].message),this.code=MR}}class QAt extends ch{constructor(e){super(e,Du[RR].message),this.code=RR}}class ZAt extends ch{constructor(e){super(e,Du[LR].message),this.code=LR}}class JAt extends ch{constructor(e){super(e,Du[DR].message),this.code=DR}}class e7t extends ch{constructor(e){super(e,Du[BR].message),this.code=BR}}class t7t extends ch{constructor(e){super(e,Du[HR].message),this.code=HR}}class n7t extends ch{constructor(e){super(e,Du[UR].message),this.code=UR}}class r7t extends ch{constructor(e){super(e,Du[$R].message),this.code=$R}}class s7t extends ch{constructor(e){super(e,Du[WR].message),this.code=WR}}class i7t extends ch{constructor(e){super(e,Du[zR].message),this.code=zR}}class a7t extends ch{constructor(e){super(e,Du[VR].message),this.code=VR}}const Nd=new Map;Nd.set(OR,{error:YAt});Nd.set(MR,{error:XAt});Nd.set(RR,{error:QAt});Nd.set(LR,{error:ZAt});Nd.set(DR,{error:JAt});Nd.set(BR,{error:e7t});Nd.set(HR,{error:t7t});Nd.set(UR,{error:n7t});Nd.set(zR,{error:i7t});Nd.set($R,{error:r7t});Nd.set(WR,{error:s7t});Nd.set(VR,{error:a7t});class o7t extends xi{constructor(e){super(`Format for the type ${e} is unsupported`),this.type=e,this.code=eAt}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 l7t(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function c7t(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function d8(t,...e){if(!c7t(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 Nle(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 J3(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 jle(t,e){d8(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const dMe={number:tf,bool:l7t,bytes:d8,hash:Nle,exists:J3,output:jle},ZP=BigInt(2**32-1),M1e=BigInt(32);function u7t(t,e=!1){return e?{h:Number(t&ZP),l:Number(t>>M1e&ZP)}:{h:Number(t>>M1e&ZP)|0,l:Number(t&ZP)|0}}function d7t(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}=u7t(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const f7t=(t,e,n)=>t<<n|e>>>32-n,h7t=(t,e,n)=>e<<n|t>>>32-n,p7t=(t,e,n)=>e<<n-32|t>>>64-n,m7t=(t,e,n)=>t<<n-32|e>>>64-n,oM=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const lM=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),cM=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a0=(t,e)=>t<<32-e|t>>>e,ya=(t,e)=>t<<e|t>>>32-e>>>0,GR=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,x7t=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function KR(t){for(let e=0;e<t.length;e++)t[e]=x7t(t[e])}function CN(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function SN(t){return typeof t=="string"&&(t=CN(t)),d8(t),t}function YR(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];d8(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 Ale{clone(){return this._cloneInto()}}const g7t={}.toString;function fMe(t,e){if(e!==void 0&&g7t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function hMe(t){const e=r=>t().update(SN(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function pMe(t=32){if(oM&&typeof oM.getRandomValues=="function")return oM.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const mMe=[],xMe=[],gMe=[],b7t=BigInt(0),n7=BigInt(1),y7t=BigInt(2),v7t=BigInt(7),w7t=BigInt(256),C7t=BigInt(113);for(let t=0,e=n7,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],mMe.push(2*(5*r+n)),xMe.push((t+1)*(t+2)/2%64);let s=b7t;for(let a=0;a<7;a++)e=(e<<n7^(e>>v7t)*C7t)%w7t,e&y7t&&(s^=n7<<(n7<<BigInt(a))-n7);gMe.push(s)}const[S7t,N7t]=d7t(gMe,!0),R1e=(t,e,n)=>n>32?p7t(t,e,n):f7t(t,e,n),L1e=(t,e,n)=>n>32?m7t(t,e,n):h7t(t,e,n);function j7t(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=R1e(u,d,1)^n[l],x=L1e(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=xMe[o],c=R1e(s,a,l),u=L1e(s,a,l),d=mMe[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]^=S7t[r],t[1]^=N7t[r]}n.fill(0)}class _le extends Ale{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=lM(this.state)}keccak(){GR||KR(this.state32),j7t(this.state32,this.rounds),GR||KR(this.state32),this.posOut=0,this.pos=0}update(e){J3(this);const{blockLen:n,state:r}=this;e=SN(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){J3(this,!1),d8(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(jle(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 _le(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 A7t=(t,e,n)=>hMe(()=>new _le(e,t,n)),D1e=A7t(1,136,256/8),XR=dMe.bytes;function bMe(t){if(!(t instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof t}`);return new TextDecoder().decode(t)}function _7t(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 E7t(t){return e=>(dMe.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=E7t(D1e);return t.create=D1e.create,t})();var ha;(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})(ha||(ha={}));var Lte;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Lte||(Lte={}));const Cs=ha.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wg=t=>{switch(typeof t){case"undefined":return Cs.undefined;case"string":return Cs.string;case"number":return Number.isNaN(t)?Cs.nan:Cs.number;case"boolean":return Cs.boolean;case"function":return Cs.function;case"bigint":return Cs.bigint;case"symbol":return Cs.symbol;case"object":return Array.isArray(t)?Cs.array:t===null?Cs.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Cs.promise:typeof Map<"u"&&t instanceof Map?Cs.map:typeof Set<"u"&&t instanceof Set?Cs.set:typeof Date<"u"&&t instanceof Date?Cs.date:Cs.object;default:return Cs.unknown}},Gr=ha.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"]),k7t=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,ha.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 NN=(t,e)=>{let n;switch(t.code){case Gr.invalid_type:t.received===Cs.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Gr.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ha.jsonStringifyReplacer)}`;break;case Gr.unrecognized_keys:n=`Unrecognized key(s) in object: ${ha.joinValues(t.keys,", ")}`;break;case Gr.invalid_union:n="Invalid input";break;case Gr.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ha.joinValues(t.options)}`;break;case Gr.invalid_enum_value:n=`Invalid enum value. Expected ${ha.joinValues(t.options)}, received '${t.received}'`;break;case Gr.invalid_arguments:n="Invalid function arguments";break;case Gr.invalid_return_type:n="Invalid function return type";break;case Gr.invalid_date:n="Invalid date";break;case Gr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:ha.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Gr.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Gr.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Gr.custom:n="Invalid input";break;case Gr.invalid_intersection_types:n="Intersection results could not be merged";break;case Gr.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Gr.not_finite:n="Number must be finite";break;default:n=e.defaultError,ha.assertNever(t)}return{message:n}};let yMe=NN;function T7t(t){yMe=t}function QR(){return yMe}const ZR=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}},I7t=[];function fs(t,e){const n=QR(),r=ZR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===NN?void 0:NN].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 oi;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 oi;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 oi=Object.freeze({status:"aborted"}),i4=t=>({status:"dirty",value:t}),jd=t=>({status:"valid",value:t}),Dte=t=>t.status==="aborted",Bte=t=>t.status==="dirty",e5=t=>t.status==="valid",oE=t=>typeof Promise<"u"&&t instanceof Promise;var Bs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Bs||(Bs={}));class dx{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const B1e=(t,e)=>{if(e5(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new th(t.common.issues);return this._error=n,this._error}}};function Pi(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,l)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:s}}class Ui{get description(){return this._def.description}_getType(e){return wg(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:wg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hu,ctx:{common:e.parent.common,data:e.data,parsedType:wg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(oE(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)},s=this._parseSync({data:e,path:r.path,parent:r});return B1e(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return e5(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=>e5(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(oE(s)?s:Promise.resolve(s));return B1e(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const o=e(s),l=()=>a.addIssue({code:Gr.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new 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 Y0.create(this,this._def)}nullable(){return u2.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vm.create(this)}promise(){return AN.create(this,this._def)}or(e){return dE.create([this,e],this._def)}and(e){return fE.create(this,e,this._def)}transform(e){return new Em({...Pi(this._def),schema:this,typeName:ui.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new gE({...Pi(this._def),innerType:this,defaultValue:n,typeName:ui.ZodDefault})}brand(){return new Ele({typeName:ui.ZodBranded,type:this,...Pi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new bE({...Pi(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 $T.create(this,e)}readonly(){return yE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const P7t=/^c[^\s-]{8,}$/i,F7t=/^[0-9a-z]+$/,O7t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M7t=/^[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,R7t=/^[a-z0-9_-]{21}$/i,L7t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D7t=/^[-+]?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)?)??$/,B7t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$7t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pW;const U7t=/^(?:(?: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])$/,z7t=/^(?:(?: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])$/,H7t=/^(([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]))$/,V7t=/^(([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])$/,W7t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,q7t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vMe="((\\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])))",G7t=new RegExp(`^${vMe}$`);function wMe(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 K7t(t){return new RegExp(`^${wMe(t)}$`)}function CMe(t){let e=`${vMe}T${wMe(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 Y7t(t,e){return!!((e==="v4"||!e)&&U7t.test(t)||(e==="v6"||!e)&&H7t.test(t))}function X7t(t,e){if(!L7t.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Q7t(t,e){return!!((e==="v4"||!e)&&z7t.test(t)||(e==="v6"||!e)&&V7t.test(t))}class xm extends Ui{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cs.string){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.string,received:a.parsedType}),oi}const r=new Hu;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,l=e.data.length<a.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?fs(s,{code:Gr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&fs(s,{code:Gr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")B7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"email",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")pW||(pW=new RegExp($7t,"u")),pW.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"emoji",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")M7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"uuid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")R7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"nanoid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")P7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cuid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")F7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cuid2",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")O7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"ulid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),fs(s,{validation:"url",code:Gr.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"regex",code:Gr.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?CMe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?G7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?K7t(a).test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?D7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"duration",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Y7t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"ip",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?X7t(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"jwt",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Q7t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cidr",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?W7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"base64",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?q7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"base64url",code:Gr.invalid_string,message:a.message}),r.dirty()):ha.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:Gr.invalid_string,...Bs.errToObj(r)})}_addCheck(e){return new xm({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Bs.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Bs.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Bs.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Bs.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Bs.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Bs.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Bs.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Bs.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Bs.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Bs.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Bs.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Bs.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Bs.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Bs.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Bs.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Bs.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Bs.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Bs.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Bs.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Bs.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Bs.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Bs.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Bs.errToObj(n)})}nonempty(e){return this.min(1,Bs.errToObj(e))}trim(){return new xm({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xm({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xm({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}xm.create=t=>new xm({checks:[],typeName:ui.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Pi(t)});function Z7t(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return a%o/10**s}class o2 extends Ui{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Cs.number){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.number,received:a.parsedType}),oi}let r;const s=new Hu;for(const a of this._def.checks)a.kind==="int"?ha.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Z7t(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_finite,message:a.message}),s.dirty()):ha.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,r,s){return new o2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bs.toString(s)}]})}_addCheck(e){return new o2({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Bs.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Bs.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Bs.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Bs.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ha.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}o2.create=t=>new o2({checks:[],typeName:ui.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Pi(t)});class l2 extends Ui{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Cs.bigint)return this._getInvalidInput(e);let r;const s=new Hu;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):ha.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return fs(n,{code:Gr.invalid_type,expected:Cs.bigint,received:n.parsedType}),oi}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,r,s){return new l2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bs.toString(s)}]})}_addCheck(e){return new l2({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}l2.create=t=>new l2({checks:[],typeName:ui.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Pi(t)});class lE extends Ui{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cs.boolean){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.boolean,received:r.parsedType}),oi}return jd(e.data)}}lE.create=t=>new lE({typeName:ui.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Pi(t)});class t5 extends Ui{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cs.date){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.date,received:a.parsedType}),oi}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_date}),oi}const r=new Hu;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):ha.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t5({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Bs.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Bs.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}t5.create=t=>new t5({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ui.ZodDate,...Pi(t)});class JR extends Ui{_parse(e){if(this._getType(e)!==Cs.symbol){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.symbol,received:r.parsedType}),oi}return jd(e.data)}}JR.create=t=>new JR({typeName:ui.ZodSymbol,...Pi(t)});class cE extends Ui{_parse(e){if(this._getType(e)!==Cs.undefined){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.undefined,received:r.parsedType}),oi}return jd(e.data)}}cE.create=t=>new cE({typeName:ui.ZodUndefined,...Pi(t)});class uE extends Ui{_parse(e){if(this._getType(e)!==Cs.null){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.null,received:r.parsedType}),oi}return jd(e.data)}}uE.create=t=>new uE({typeName:ui.ZodNull,...Pi(t)});class jN extends Ui{constructor(){super(...arguments),this._any=!0}_parse(e){return jd(e.data)}}jN.create=t=>new jN({typeName:ui.ZodAny,...Pi(t)});class y3 extends Ui{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jd(e.data)}}y3.create=t=>new y3({typeName:ui.ZodUnknown,...Pi(t)});class N1 extends Ui{_parse(e){const n=this._getOrReturnCtx(e);return fs(n,{code:Gr.invalid_type,expected:Cs.never,received:n.parsedType}),oi}}N1.create=t=>new N1({typeName:ui.ZodNever,...Pi(t)});class eL extends Ui{_parse(e){if(this._getType(e)!==Cs.undefined){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.void,received:r.parsedType}),oi}return jd(e.data)}}eL.create=t=>new eL({typeName:ui.ZodVoid,...Pi(t)});class vm extends Ui{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Cs.array)return fs(n,{code:Gr.invalid_type,expected:Cs.array,received:n.parsedType}),oi;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(fs(n,{code:o?Gr.too_big:Gr.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(fs(n,{code:Gr.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(fs(n,{code:Gr.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new dx(n,o,n.path,l)))).then(o=>Hu.mergeArray(r,o));const a=[...n.data].map((o,l)=>s.type._parseSync(new dx(n,o,n.path,l)));return Hu.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new vm({...this._def,minLength:{value:e,message:Bs.toString(n)}})}max(e,n){return new vm({...this._def,maxLength:{value:e,message:Bs.toString(n)}})}length(e,n){return new vm({...this._def,exactLength:{value:e,message:Bs.toString(n)}})}nonempty(e){return this.min(1,e)}}vm.create=(t,e)=>new vm({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ui.ZodArray,...Pi(e)});function WC(t){if(t instanceof Vo){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Y0.create(WC(r))}return new Vo({...t._def,shape:()=>e})}else return t instanceof vm?new vm({...t._def,type:WC(t.element)}):t instanceof Y0?Y0.create(WC(t.unwrap())):t instanceof u2?u2.create(WC(t.unwrap())):t instanceof fx?fx.create(t.items.map(e=>WC(e))):t}class Vo extends Ui{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=ha.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Cs.object){const u=this._getOrReturnCtx(e);return fs(u,{code:Gr.invalid_type,expected:Cs.object,received:u.parsedType}),oi}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof N1&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new dx(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof N1){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(fs(s,{code:Gr.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new dx(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,x=await d.value;u.push({key:f,value:x,alwaysSet:d.alwaysSet})}return u}).then(u=>Hu.mergeObjectSync(r,u)):Hu.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Bs.errToObj,new Vo({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var a,o;const s=((o=(a=this._def).errorMap)==null?void 0:o.call(a,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Bs.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Vo({...this._def,unknownKeys:"strip"})}passthrough(){return new Vo({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vo({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vo({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName: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 ha.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 ha.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Vo({...this._def,shape:()=>n})}deepPartial(){return WC(this)}partial(e){const n={};for(const r of ha.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 ha.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Y0;)a=a._def.innerType;n[r]=a}return new Vo({...this._def,shape:()=>n})}keyof(){return SMe(ha.objectKeys(this.shape))}}Vo.create=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strip",catchall:N1.create(),typeName:ui.ZodObject,...Pi(e)});Vo.strictCreate=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strict",catchall:N1.create(),typeName:ui.ZodObject,...Pi(e)});Vo.lazycreate=(t,e)=>new Vo({shape:t,unknownKeys:"strip",catchall:N1.create(),typeName:ui.ZodObject,...Pi(e)});class dE extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=a.map(l=>new th(l.ctx.common.issues));return fs(n,{code:Gr.invalid_union,unionErrors:o}),oi}if(n.common.async)return Promise.all(r.map(async a=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new th(c));return fs(n,{code:Gr.invalid_union,unionErrors:l}),oi}}get options(){return this._def.options}}dE.create=(t,e)=>new dE({options:t,typeName:ui.ZodUnion,...Pi(e)});const pg=t=>t instanceof pE?pg(t.schema):t instanceof Em?pg(t.innerType()):t instanceof mE?[t.value]:t instanceof c2?t.options:t instanceof xE?ha.objectValues(t.enum):t instanceof gE?pg(t._def.innerType):t instanceof cE?[void 0]:t instanceof uE?[null]:t instanceof Y0?[void 0,...pg(t.unwrap())]:t instanceof u2?[null,...pg(t.unwrap())]:t instanceof Ele||t instanceof yE?pg(t.unwrap()):t instanceof bE?pg(t._def.innerType):[];class J$ extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.object)return fs(n,{code:Gr.invalid_type,expected:Cs.object,received:n.parsedType}),oi;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(fs(n,{code:Gr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),oi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const o=pg(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);s.set(l,a)}}return new J$({typeName:ui.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Pi(r)})}}function $te(t,e){const n=wg(t),r=wg(e);if(t===e)return{valid:!0,data:t};if(n===Cs.object&&r===Cs.object){const s=ha.objectKeys(e),a=ha.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of a){const c=$te(t[l],e[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Cs.array&&r===Cs.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const o=t[a],l=e[a],c=$te(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Cs.date&&r===Cs.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class fE extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,o)=>{if(Dte(a)||Dte(o))return oi;const l=$te(a.value,o.value);return l.valid?((Bte(a)||Bte(o))&&n.dirty(),{status:n.value,value:l.data}):(fs(r,{code:Gr.invalid_intersection_types}),oi)};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}))}}fE.create=(t,e,n)=>new fE({left:t,right:e,typeName:ui.ZodIntersection,...Pi(n)});class fx extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.array)return fs(r,{code:Gr.invalid_type,expected:Cs.array,received:r.parsedType}),oi;if(r.data.length<this._def.items.length)return fs(r,{code:Gr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oi;!this._def.rest&&r.data.length>this._def.items.length&&(fs(r,{code:Gr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new dx(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>Hu.mergeArray(n,o)):Hu.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new fx({...this._def,rest:e})}}fx.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fx({items:t,typeName:ui.ZodTuple,rest:null,...Pi(e)})};class hE extends Ui{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.object)return fs(r,{code:Gr.invalid_type,expected:Cs.object,received:r.parsedType}),oi;const s=[],a=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:a._parse(new dx(r,l,r.path,l)),value:o._parse(new dx(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?Hu.mergeObjectAsync(n,s):Hu.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ui?new hE({keyType:e,valueType:n,typeName:ui.ZodRecord,...Pi(r)}):new hE({keyType:xm.create(),valueType:e,typeName:ui.ZodRecord,...Pi(n)})}}class tL extends Ui{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.map)return fs(r,{code:Gr.invalid_type,expected:Cs.map,received:r.parsedType}),oi;const s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new dx(r,l,r.path,[u,"key"])),value:a._parse(new dx(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return oi;(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 oi;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}tL.create=(t,e,n)=>new tL({valueType:e,keyType:t,typeName:ui.ZodMap,...Pi(n)});class n5 extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.set)return fs(r,{code:Gr.invalid_type,expected:Cs.set,received:r.parsedType}),oi;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(fs(r,{code:Gr.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(fs(r,{code:Gr.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return oi;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>a._parse(new dx(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(e,n){return new n5({...this._def,minSize:{value:e,message:Bs.toString(n)}})}max(e,n){return new n5({...this._def,maxSize:{value:e,message:Bs.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}n5.create=(t,e)=>new n5({valueType:t,minSize:null,maxSize:null,typeName:ui.ZodSet,...Pi(e)});class P4 extends Ui{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.function)return fs(n,{code:Gr.invalid_type,expected:Cs.function,received:n.parsedType}),oi;function r(l,c){return ZR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,QR(),NN].filter(u=>!!u),issueData:{code:Gr.invalid_arguments,argumentsError:c}})}function s(l,c){return ZR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,QR(),NN].filter(u=>!!u),issueData:{code:Gr.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof AN){const l=this;return 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 P4({...this._def,args:fx.create(e).rest(y3.create())})}returns(e){return new P4({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new P4({args:e||fx.create([]).rest(y3.create()),returns:n||y3.create(),typeName:ui.ZodFunction,...Pi(r)})}}class pE extends Ui{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}pE.create=(t,e)=>new pE({getter:t,typeName:ui.ZodLazy,...Pi(e)});class mE extends Ui{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return fs(n,{received:n.data,code:Gr.invalid_literal,expected:this._def.value}),oi}return{status:"valid",value:e.data}}get value(){return this._def.value}}mE.create=(t,e)=>new mE({value:t,typeName:ui.ZodLiteral,...Pi(e)});function SMe(t,e){return new c2({values:t,typeName:ui.ZodEnum,...Pi(e)})}class c2 extends Ui{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return fs(n,{expected:ha.joinValues(r),received:n.parsedType,code:Gr.invalid_type}),oi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return fs(n,{received:n.data,code:Gr.invalid_enum_value,options:r}),oi}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 c2.create(e,{...this._def,...n})}exclude(e,n=this._def){return c2.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}c2.create=SMe;class xE extends Ui{_parse(e){const n=ha.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Cs.string&&r.parsedType!==Cs.number){const s=ha.objectValues(n);return fs(r,{expected:ha.joinValues(s),received:r.parsedType,code:Gr.invalid_type}),oi}if(this._cache||(this._cache=new Set(ha.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=ha.objectValues(n);return fs(r,{received:r.data,code:Gr.invalid_enum_value,options:s}),oi}return jd(e.data)}get enum(){return this._def.values}}xE.create=(t,e)=>new xE({values:t,typeName:ui.ZodNativeEnum,...Pi(e)});class AN extends Ui{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.promise&&n.common.async===!1)return fs(n,{code:Gr.invalid_type,expected:Cs.promise,received:n.parsedType}),oi;const r=n.parsedType===Cs.promise?n.data:Promise.resolve(n.data);return jd(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}AN.create=(t,e)=>new AN({type:t,typeName:ui.ZodPromise,...Pi(e)});class Em extends Ui{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=>{fs(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return oi;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?oi:c.status==="dirty"||n.value==="dirty"?i4(c.value):c});{if(n.value==="aborted")return oi;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?oi:l.status==="dirty"||n.value==="dirty"?i4(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"?oi:(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"?oi:(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(!e5(o))return oi;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=>e5(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:n.value,value:l})):oi);ha.assertNever(s)}}Em.create=(t,e,n)=>new Em({schema:t,typeName:ui.ZodEffects,effect:e,...Pi(n)});Em.createWithPreprocess=(t,e,n)=>new Em({schema:e,effect:{type:"preprocess",transform:t},typeName:ui.ZodEffects,...Pi(n)});class Y0 extends Ui{_parse(e){return this._getType(e)===Cs.undefined?jd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Y0.create=(t,e)=>new Y0({innerType:t,typeName:ui.ZodOptional,...Pi(e)});class u2 extends Ui{_parse(e){return this._getType(e)===Cs.null?jd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}u2.create=(t,e)=>new u2({innerType:t,typeName:ui.ZodNullable,...Pi(e)});class gE extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Cs.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}gE.create=(t,e)=>new gE({innerType:t,typeName:ui.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pi(e)});class bE extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return oE(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}}bE.create=(t,e)=>new bE({innerType:t,typeName:ui.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pi(e)});class nL extends Ui{_parse(e){if(this._getType(e)!==Cs.nan){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.nan,received:r.parsedType}),oi}return{status:"valid",value:e.data}}}nL.create=t=>new nL({typeName:ui.ZodNaN,...Pi(t)});const J7t=Symbol("zod_brand");class Ele extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class $T extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?oi:a.status==="dirty"?(n.dirty(),i4(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"?oi: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 $T({in:e,out:n,typeName:ui.ZodPipeline})}}class yE extends Ui{_parse(e){const n=this._def.innerType._parse(e),r=s=>(e5(s)&&(s.value=Object.freeze(s.value)),s);return oE(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}yE.create=(t,e)=>new yE({innerType:t,typeName:ui.ZodReadonly,...Pi(e)});function $1e(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function NMe(t,e={},n){return t?jN.create().superRefine((r,s)=>{const a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){const l=$1e(e,r),c=l.fatal??n??!0;s.addIssue({code:"custom",...l,fatal:c})}});if(!a){const o=$1e(e,r),l=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:l})}}):jN.create()}const e9t={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 t9t=(t,e={message:`Input not instance of ${t.name}`})=>NMe(n=>n instanceof t,e),jMe=xm.create,AMe=o2.create,n9t=nL.create,r9t=l2.create,_Me=lE.create,s9t=t5.create,i9t=JR.create,a9t=cE.create,o9t=uE.create,Ute=jN.create,l9t=y3.create,c9t=N1.create,u9t=eL.create,EMe=vm.create,uM=Vo.create,d9t=Vo.strictCreate,kMe=dE.create,f9t=J$.create,h9t=fE.create,TMe=fx.create,p9t=hE.create,m9t=tL.create,x9t=n5.create,g9t=P4.create,b9t=pE.create,y9t=mE.create,v9t=c2.create,w9t=xE.create,C9t=AN.create,U1e=Em.create,S9t=Y0.create,N9t=u2.create,j9t=Em.createWithPreprocess,A9t=$T.create,_9t=()=>jMe().optional(),E9t=()=>AMe().optional(),k9t=()=>_Me().optional(),T9t={string:t=>xm.create({...t,coerce:!0}),number:t=>o2.create({...t,coerce:!0}),boolean:t=>lE.create({...t,coerce:!0}),bigint:t=>l2.create({...t,coerce:!0}),date:t=>t5.create({...t,coerce:!0})},I9t=oi,z1e=Object.freeze(Object.defineProperty({__proto__:null,BRAND:J7t,DIRTY:i4,EMPTY_PATH:I7t,INVALID:oi,NEVER:I9t,OK:jd,ParseStatus:Hu,Schema:Ui,ZodAny:jN,ZodArray:vm,ZodBigInt:l2,ZodBoolean:lE,ZodBranded:Ele,ZodCatch:bE,ZodDate:t5,ZodDefault:gE,ZodDiscriminatedUnion:J$,ZodEffects:Em,ZodEnum:c2,ZodError:th,get ZodFirstPartyTypeKind(){return ui},ZodFunction:P4,ZodIntersection:fE,ZodIssueCode:Gr,ZodLazy:pE,ZodLiteral:mE,ZodMap:tL,ZodNaN:nL,ZodNativeEnum:xE,ZodNever:N1,ZodNull:uE,ZodNullable:u2,ZodNumber:o2,ZodObject:Vo,ZodOptional:Y0,ZodParsedType:Cs,ZodPipeline:$T,ZodPromise:AN,ZodReadonly:yE,ZodRecord:hE,ZodSchema:Ui,ZodSet:n5,ZodString:xm,ZodSymbol:JR,ZodTransformer:Em,ZodTuple:fx,ZodType:Ui,ZodUndefined:cE,ZodUnion:dE,ZodUnknown:y3,ZodVoid:eL,addIssueToContext:fs,any:Ute,array:EMe,bigint:r9t,boolean:_Me,coerce:T9t,custom:NMe,date:s9t,datetimeRegex:CMe,defaultErrorMap:NN,discriminatedUnion:f9t,effect:U1e,enum:v9t,function:g9t,getErrorMap:QR,getParsedType:wg,instanceof:t9t,intersection:h9t,isAborted:Dte,isAsync:oE,isDirty:Bte,isValid:e5,late:e9t,lazy:b9t,literal:y9t,makeIssue:ZR,map:m9t,nan:n9t,nativeEnum:w9t,never:c9t,null:o9t,nullable:N9t,number:AMe,object:uM,get objectUtil(){return Lte},oboolean:k9t,onumber:E9t,optional:S9t,ostring:_9t,pipeline:A9t,preprocess:j9t,promise:C9t,quotelessJson:k7t,record:p9t,set:x9t,setErrorMap:T7t,strictObject:d9t,string:jMe,symbol:i9t,transformer:U1e,tuple:TMe,undefined:a9t,union:kMe,unknown:l9t,get util(){return ha},void:u9t},Symbol.toStringTag,{value:"Module"})),P9t=t=>t.message?t.message:"unspecified error";class _N extends xi{constructor(e){super(),this.code=J8t,this.errors=e,super.message=`Web3 validator found ${e.length} error[s]:
${this._compileErrors().join(`
`)}`}_compileErrors(){return this.errors.map(P9t)}}const F9t=["bool","int","uint","bytes","string","address","tuple"],IMe=t=>typeof t=="object"&&"type"in t&&"name"in t,kle=t=>typeof t=="string",Ea=t=>typeof t=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(t);function PMe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/))}const rL=t=>typeof t=="number"||typeof t=="bigint"||typeof t=="string"&&/^((-0x|0x|-)?[0-9a-f]+|(0x))$/i.test(t);function Tle(t){if(typeof t!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof t}`);return t.startsWith("0x")}const Ile=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()}`)},O9t=["hex","number","blockNumber","blockNumberOrTag","filter","bloom"],F5=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),F9t.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}},mW=(t,e={})=>{if(Object.keys(e).includes("type"))throw new _N([{keyword:"eth",message:'Either "eth" or "type" can be presented in schema',params:{eth:t},instancePath:"",schemaPath:""}]);const{baseType:r,baseTypeSize:s}=F5(t);if(!r&&!O9t.includes(t))throw new _N([{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}:{}},sL=(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=[];IMe(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}=F5(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=sL(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:sL(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:mW(a)},g>=0&&{minItems:g,maxItems:g});x.items.push(y)}else Array.isArray(x.items)?x.items.push(Object.assign({$id:o},mW(a))):x.items.push(Object.assign({$id:o},mW(a)));x=n}return n},Ple=t=>sL(t),Fle=(t,e)=>e===1?t:Fle(t[0],e-1),P9=(t,e,n)=>{const r=[];for(const[s,a]of t.entries()){let o,l,c=[];IMe(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}=F5(o),x=Array.isArray(e)?e[s]:e[l];if(u==="tuple"&&!d)r.push(P9(c,x,n));else if(u==="tuple"&&d){const g=[];for(const y of x)if(f.length>1){const v=Fle(y,f.length-1),C=[];for(const N of v)C.push(P9(c,N,n));g.push(C)}else g.push(P9(c,y,n));r.push(g)}else r.push(x)}return n=n??[],n.push(...r),n},FMe=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}`)},eU=t=>{if(!Ea(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)},tU=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"&&Ea(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"&&!Ea(t))return tU(BigInt(t));throw new wle(t)},iL=(t,e,n="0")=>{if(typeof t=="string"&&!Ea(t))return t.padStart(e,n);const r=typeof t=="string"&&Ea(t)?t:tU(t),[s,a]=r.startsWith("-")?["-0x",r.slice(3)]:["0x",r.slice(2)];return`${s}${a.padStart(e,n)}`};function L1(t){let e="0x";for(const n of t){const r=n.toString(16);e+=r.length===1?`0${r}`:r}return e}const Xx={zero:48,nine:57,A:65,F:70,a:97,f:102};function H1e(t){if(t>=Xx.zero&&t<=Xx.nine)return t-Xx.zero;if(t>=Xx.A&&t<=Xx.F)return t-(Xx.A-10);if(t>=Xx.a&&t<=Xx.f)return t-(Xx.a-10)}function O5(t){let e=0;if(t.startsWith("0")&&(t[1]==="x"||t[1]==="X")&&(e=2),t.length%2!==0)throw new I4(`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=H1e(t.charCodeAt(a++)),l=H1e(t.charCodeAt(a++));if(o===void 0||l===void 0)throw new I4(`Invalid byte sequence ("${t[a-2]}${t[a-1]}" in "${t}").`);r[s]=o*16+l}return r}function nU(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 OMe=Object.freeze(Object.defineProperty({__proto__:null,abiSchemaToJsonSchema:sL,codePointToInt:FMe,ensureIfUint8Array:nU,ethAbiToJsonSchema:Ple,fetchArrayElement:Fle,hexToNumber:eU,hexToUint8Array:O5,numberToHex:tU,padLeft:iL,parseBaseType:F5,transformJsonDataToAbiFormat:P9,uint8ArrayToHexString:L1},Symbol.toStringTag,{value:"Module"})),zte=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"},_2=(t,e={abiType:"bytes"})=>{if(typeof t!="string"&&!Array.isArray(t)&&!zte(t)||typeof t=="string"&&Ea(t)&&t.startsWith("-")||typeof t=="string"&&!Ea(t))return!1;let n;if(typeof t=="string"){if(t.length%2!==0)return!1;n=O5(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}=F5(e.abiType);return r?n.length===r:!0}return e!=null&&e.size?n.length===(e==null?void 0:e.size):!0},MMe=t=>{if(!/^(0x)?[0-9a-f]{40}$/i.test(t))return!1;const e=t.slice(2),n=CN(e.toLowerCase()),r=L1(pd(nU(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"&&!zte(t))return!1;let n;return zte(t)?n=L1(t):typeof t=="string"&&!Ea(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?MMe(n):!0:!1},r5=(t,e)=>{if(e===BigInt(0))return BigInt(1);let n=t;for(let r=1;r<e;r+=1)n*=t;return n},j1=(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}=F5(e.abiType);s&&(n=s)}else e.bitSize&&(n=e.bitSize);const r=r5(BigInt(2),BigInt(n??256))-BigInt(1);try{const s=typeof t=="string"&&Ea(t)?BigInt(eU(t)):BigInt(t);return s>=0&&s<=r}catch{return!1}},vE=(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}=F5(e.abiType);if(o!=="int")return!1;a&&(n=a)}else e.bitSize&&(n=e.bitSize);const r=r5(BigInt(2),BigInt((n??256)-1)),s=BigInt(-1)*r5(BigInt(2),BigInt((n??256)-1));try{const a=typeof t=="string"&&Ea(t)?BigInt(eU(t)):BigInt(t);return a>=s&&a<=r}catch{return!1}},RMe=t=>!!(vE(t)||typeof t=="string"&&/[0-9.]/.test(t)&&t.indexOf(".")===t.lastIndexOf(".")||typeof t=="number"),LMe=t=>j1(t),Uc=t=>Object.values(Bg).includes(t),Hte=t=>Uc(t)||LMe(t),f8=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)),rU=(t,e)=>{if(typeof e=="string"&&!Ea(e)||!f8(t))return!1;const n=typeof e=="string"?O5(e):e,r=L1(pd(n)).slice(2);for(let s=0;s<12;s+=4){const a=(parseInt(r.slice(s,s+2),16)<<8)+parseInt(r.slice(s+2,s+4),16)&2047,o=FMe(t.charCodeAt(t.length-1-Math.floor(a/4))),l=1<<a%4;if((o&l)!==l)return!1}return!0},M9t=(t,e)=>{if(!f8(t)||!ih(e))return!1;const n=iL(e,64);return rU(t,n)},R9t=(t,e)=>!f8(t)||!ih(e)?!1:rU(t,e),L9t=t=>["number","string","boolean"].includes(typeof t)?typeof t=="boolean"?!0:typeof t=="string"&&!Ea(t)?t==="1"||t==="0":typeof t=="string"&&Ea(t)?t==="0x1"||t==="0x0":t===1||t===0:!1,gr=t=>t==null,EN=t=>typeof t=="object"&&!gr(t)&&!Array.isArray(t)&&!(t instanceof yle),aL=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)),D9t=(t,e)=>!f8(t)||!aL(e)?!1:rU(t,e),B9t=t=>{const e=["fromBlock","toBlock","address","topics","blockHash"];if(gr(t)||typeof t!="object"||!Object.keys(t).every(n=>e.includes(n))||!gr(t.fromBlock)&&!Hte(t.fromBlock)||!gr(t.toBlock)&&!Hte(t.toBlock))return!1;if(!gr(t.address)){if(Array.isArray(t.address)){if(!t.address.every(n=>ih(n)))return!1}else if(!ih(t.address))return!1}return!(!gr(t.topics)&&!t.topics.every(n=>gr(n)?!0:Array.isArray(n)?n.every(r=>aL(r)):!!aL(n)))},s5={address:t=>ih(t),bloom:t=>f8(t),blockNumber:t=>LMe(t),blockTag:t=>Uc(t),blockNumberOrTag:t=>Hte(t),bool:t=>L9t(t),bytes:t=>_2(t),filter:t=>B9t(t),hex:t=>Ea(t),uint:t=>j1(t),int:t=>vE(t),number:t=>RMe(t),string:t=>kle(t)};for(let t=8;t<=256;t+=8)s5[`int${t}`]=e=>vE(e,{bitSize:t}),s5[`uint${t}`]=e=>j1(e,{bitSize:t});for(let t=1;t<=32;t+=1)s5[`bytes${t}`]=e=>_2(e,{size:t});s5.bytes256=s5.bytes;const t9=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=t9(t.properties[n]);r&&(e[n]=r)}return Array.isArray(t.required)?uM(e).partial().required(t.required.reduce((n,r)=>Object.assign(Object.assign({},n),{[r]:!0}),{})):uM(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=t9(s);a&&r.push(a)}return TMe(r)}const e=Array.isArray(t.items)?t.items[0]:t.items;let n=EMe(t9(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 kMe(t.oneOf.map(e=>t9(e)));if(t!=null&&t.format){if(!s5[t.format])throw new o7t(t.format);return Ute().refine(s5[t.format],e=>({params:{value:e,format:t.format}}))}return t!=null&&t.type&&(t==null?void 0:t.type)!=="object"&&typeof z1e[String(t.type)]=="function"?z1e[String(t.type)]():uM({data:Ute()}).partial()};class a4{static factory(){return a4.validatorInstance||(a4.validatorInstance=new a4),a4.validatorInstance}validate(e,n,r){var s,a;const l=t9(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 _N(c)}}}convertErrors(e){if(e&&Array.isArray(e)&&e.length>0)return e.map(n=>{var r;let s,a,o,l;l=n.path.join("/");const c=String(n.path[n.path.length-1]),u=n.path.join("/");if(n.code===Gr.too_big)a="maxItems",l=`${u}/maxItems`,o={limit:n.maximum},s=`must NOT have more than ${n.maximum} items`;else if(n.code===Gr.too_small)a="minItems",l=`${u}/minItems`,o={limit:n.minimum},s=`must NOT have fewer than ${n.minimum} items`;else if(n.code===Gr.custom){const{value:d,format:f}=(r=n.params)!==null&&r!==void 0?r:{};typeof d>"u"?s=`value at "/${l}" is required`:s=`value "${typeof d=="object"?JSON.stringify(d):d}" at "/${l}" must pass "${f}" validation`,o={value:d}}return{keyword:a??c,instancePath:u?`/${u}`:"",schemaPath:l?`#${l}`:"#",params:o??{value:n.message},message:s??n.message}})}}class $9t{constructor(){this._validator=a4.factory()}validateJSONSchema(e,n,r){return this._validator.validate(e,n,r)}validate(e,n,r={silent:!1}){var s,a;const o=Ple(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 _N([{instancePath:"/0",schemaPath:"/",keyword:"required",message:"empty schema against data can not be validated",params:n}]);return this._validator.validate(o,n,r)}}}const Xs=new $9t;function E2(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 sU(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 iU={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")},Vte="Warning: Using type `number` with values that are large or contain many decimals may cause loss of precision, it is recommended to use type `string` or `BigInt` when using conversion methods",hx=t=>{if(Xs.validate(["bytes"],[t]),E2(t))return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="string")return O5(t);throw new I4(t)},{uint8ArrayToHexString:U9t}=OMe,Gi=t=>U9t(hx(t)),po=t=>typeof t=="string"&&t.slice(0,2).toLowerCase()!=="0x"?hx(`0x${t}`):hx(t),UT=t=>(Xs.validate(["hex"],[t]),eU(t)),z9t=UT,oc=(t,e)=>{typeof t!="bigint"&&Xs.validate(["int"],[t]);let n=tU(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},H9t=oc,V9t=t=>UT(t).toString(),km=t=>{Xs.validate(["string"],[t]);let e=t.replace(/^(?:\u0000)/,"");return e=e.replace(/(?:\u0000)$/,""),Gi(new TextEncoder().encode(e))},DMe=km,W9t=km,aU=t=>bMe(po(t)),q9t=t=>typeof t=="string"?aU(t):(Xs.validate(["bytes"],[t]),bMe(t)),Ole=CN,G9t=aU,BMe=t=>{Xs.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}`},K9t=BMe,$Me=t=>new TextDecoder("ascii").decode(po(t)),Y9t=$Me,A1=(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":oc(t);if(typeof t=="bigint")return e?"bigint":oc(t);if(E2(t))return e?"bytes":Gi(t);if(typeof t=="object"&&t)return e?"string":km(JSON.stringify(t));if(typeof t=="string"){if(t.startsWith("-0x")||t.startsWith("-0X"))return e?"int256":oc(t);if(Ea(t))return e?"bytes":t;if(rL(t)&&!vE(t)&&!j1(t))return e?"bytes":`0x${t}`;if(rL(t)&&!vE(t)&&j1(t))return e?"uint":oc(t);if(!Number.isFinite(t))return e?"string":km(t)}throw new VAt(t)},af=t=>{if(typeof t=="number")return t>1e20?(console.warn(Vte),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"&&Ea(t))return UT(t);try{return af(BigInt(t))}catch{throw new wle(t)}},mw=t=>{if(typeof t=="number")return BigInt(t);if(typeof t=="bigint")return t;if(typeof t=="string"&&rL(t))return t.startsWith("-")?-BigInt(t.substring(1)):BigInt(t);throw new wle(t)},X9t=(t,e)=>{let n;if(typeof e=="string"){if(n=iU[e],!n)throw new oMe(e)}else{if(e<0||!Number.isInteger(e))throw new lMe(e);n=r5(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)},Q9t=(t,e)=>{Xs.validate(["number"],[t]);let n;if(typeof e=="string"){if(n=iU[e],!n)throw new oMe(e)}else{if(e<0||!Number.isInteger(e))throw new lMe(e);n=r5(BigInt(10),BigInt(e))}let r=t;typeof r=="number"&&(r<1e-15&&console.warn(Vte),r>1e20?(console.warn(Vte),r=BigInt(r)):r=r.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}));const[s,a]=String(typeof r=="string"&&!Ea(r)?r:af(r)).split(".").concat(""),l=BigInt(`${s}${a}`)*n,c=a.length;return c===0?l.toString():l.toString().slice(0,-c)},wx=t=>{if(!ih(t,!1))throw new Cle(t);const e=t.toLowerCase().replace(/^0x/i,""),n=L1(pd(nU(Ole(e))));if(gr(n)||n==="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")return"";let r="0x";const s=n.replace(/^0x/i,"");for(let a=0;a<e.length;a+=1)parseInt(s[a],16)>7?r+=e[a].toUpperCase():r+=e[a];return r},UMe=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"&&!Ea(t)&&(t==="1"||t==="0"||t==="false"||t==="true"))return t==="true"?!0:t==="false"?!1:!!Number(t);if(typeof t=="string"&&Ea(t)&&(t==="0x1"||t==="0x0"))return!!af(t);throw new Sle(t)};let Mle=class extends woe{constructor(){super(...arguments),this.maxListeners=Number.MAX_SAFE_INTEGER}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}};const Z9t=Ea,J9t=rL,e_t=MMe,t_t=ih,n_t=f8,r_t=rU,s_t=M9t,i_t=R9t,a_t=aL,o_t=D9t,l_t=(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={[Bg.EARLIEST]:1,[Bg.FINALIZED]:2,[Bg.SAFE]:3,[Bg.LATEST]:4,[Bg.PENDING]:5};return o[t]<o[e]?-1:1}if(n&&!r||!n&&r)throw new qAt("Cannot compare blocktag with provided non-blocktag input.");const s=BigInt(t),a=BigInt(e);return s<a?-1:s===a?0:1},_y=t=>typeof t=="object"&&!gr(t)&&Object.keys(t).length!==0&&["input","data","from","gas","gasPrice","gasLimit","address","jsonInterface","syncWithContext","dataInputFill"].some(e=>e in t),ai=gr,V1e=t=>typeof t=="object"&&!gr(t)&&!Array.isArray(t)&&!(t instanceof yle),k2=(t,...e)=>{if(!V1e(t))return t;const n=Object.assign({},t);for(const r of e)for(const s in r)V1e(r[s])?(n[s]||(n[s]={}),n[s]=k2(n[s],r[s])):!gr(r[s])&&Object.hasOwnProperty.call(r,s)&&(Array.isArray(r[s])||r[s]instanceof yle?n[s]=r[s].slice(0):n[s]=r[s]);return n},kN=(t,e,n="0")=>typeof t=="string"?Ea(t)?iL(t,e,n):t.padStart(e,n):(Xs.validate(["int"],[t]),iL(t,e,n)),zMe=(t,e,n="0")=>{if(typeof t=="string"&&!Ea(t))return t.padEnd(e,n);const r=typeof t=="string"&&Ea(t)?t:oc(t),s=r.startsWith("-")?3:2;return Xs.validate([r.startsWith("-")?"int":"uint"],[t]),r.padEnd(e+s,n)},HMe=zMe,wE=kN,VMe=(t,e=64)=>{Xs.validate(["int"],[t]);const n=af(t);if(n>=0)return kN(A1(n),e);const r=r5(BigInt(2),BigInt(e*4));if(-n>=r)throw new cMe(`value: ${t}, nibbleWidth: ${e}`);const a=BigInt(n)+r;return kN(oc(a),e)},c_t=(t,e=64)=>{Xs.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 cMe(`value: "${t}", nibbleWidth: "${e}"`);if(e*4!==r)return n;const s=r5(BigInt(2),BigInt(e)*BigInt(4));return af(BigInt(n)-s)},{parseBaseType:u_t}=OMe,Cg=t=>typeof t=="object"&&!gr(t)&&"number"in t&&"bytes"in t,d_t=(t,e,n=[])=>{let r=Object.assign({},t),s;for(const a of e){if(r.oneOf&&s){const o=s,l=n.find(([c])=>c===o);l&&l[0]===s&&(r=r.oneOf[l[1]])}if(!r.properties&&!r.items)return;r.properties?r=r.properties[a]:r.items&&r.items.properties?r=r.items.properties[a]:r.items&&EN(r.items)?r=r.items:r.items&&Array.isArray(r.items)&&(r=r.items[parseInt(a,10)]),r&&a&&(s=a)}return r},CE=(t,e,n)=>{try{const{baseType:r,baseTypeSize:s}=u_t(e);if(r==="int"||r==="uint")switch(n.number){case ap.NUMBER:return Number(mw(t));case ap.HEX:return oc(mw(t));case ap.STR:return mw(t).toString();case ap.BIGINT:return mw(t);default:throw new Ote(`Invalid format: ${String(n.number)}`)}if(r==="bytes"){let a;switch(s?typeof t=="string"?a=kN(t,s*2):E2(t)&&(a=Ad(new Uint8Array(s-t.length),t)):a=t,n.bytes){case S1.HEX:return Gi(hx(a));case S1.UINT8ARRAY:return hx(a);default:throw new Ote(`Invalid format: ${String(n.bytes)}`)}}if(r==="string")return String(t)}catch{return t}return t},W1e=({value:t,schemaProp:e,schema:n,object:r,key:s,dataPath:a,format:o,oneOfPath:l=[]})=>{var c,u;if(Array.isArray(t)){let d=e;if((e==null?void 0:e.oneOf)!==void 0&&e.oneOf.forEach((f,x)=>{var g,y;!Array.isArray(e==null?void 0:e.items)&&(typeof t[0]=="object"&&((g=f==null?void 0:f.items)===null||g===void 0?void 0:g.type)==="object"||typeof t[0]=="string"&&((y=f==null?void 0:f.items)===null||y===void 0?void 0:y.type)!=="object")&&(d=f,l.push([s,x]))}),gr(d==null?void 0:d.items))return delete r[s],a.pop(),!0;if(EN(d.items)&&!gr(d.items.format)){for(let f=0;f<t.length;f+=1)r[s][f]=CE(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)oU(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]=CE(t[f],d.items[f].format,o);return a.pop(),!0}}return!1},oU=(t,e,n,r,s=[])=>{var a;if(!EN(t)&&!Array.isArray(t))return CE(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")W1e({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=d_t(e,n,s);if(gr(u)){delete o[l],n.pop();continue}if(EN(c)){oU(c,e,n,r,s),n.pop();continue}if(!W1e({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]=CE(c,u.format,r),n.pop()}}return o},qr=(t,e,n=yd)=>{let r;EN(e)?r=k2({},e):Array.isArray(e)?r=[...e]:r=e;const s=EN(t)?t:Ple(t);if(!s.properties&&!s.items&&!s.format)throw new Ote("Invalid json schema for formatting");return oU(r,s,[],n)},WMe="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",TN=t=>{let e;return typeof t=="bigint"||typeof t=="number"?e=CN(t.toString()):Array.isArray(t)?e=new Uint8Array(t):typeof t=="string"&&!Ea(t)?e=CN(t):e=hx(t),Gi(pd(nU(e)))},zT=t=>{let e;typeof t=="string"?t.startsWith("0x")&&Ea(t)?e=po(t):e=CN(t):e=t;const n=TN(e);return n===WMe?void 0:n},ah=t=>{const e=zT(t);return gr(e)?WMe:e},f_t=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=A1(t,!0),n=A1(t),!e.startsWith("int")&&!e.startsWith("uint")&&(e="bytes")}return(e.startsWith("int")||e.startsWith("uint"))&&typeof n=="string"&&!/^(-)?0x/i.test(n)&&(n=mw(n)),[e,n]},h_t=t=>t.startsWith("int[")?`int256${t.slice(3)}`:t==="int"?"int256":t.startsWith("uint[")?`uint256'${t.slice(4)}`:t==="uint"?"uint256":t,xW=(t,e)=>{const n=/^(\d+).*$/.exec(t.slice(e));return n?parseInt(n[1],10):0},q1e=t=>t.toString(2).length,G1e=(t,e)=>{const n=e.toString();if(t==="string"){if(typeof e=="string")return km(e);throw new HAt(e)}if(t==="bool"||t==="boolean"){if(typeof e=="boolean")return e?"01":"00";throw new Sle(e)}if(t==="address"){if(!ih(n))throw new Cle(n);return n}const r=h_t(t);if(t.startsWith("uint")){const s=xW(r,4);if(s%8||s<8||s>256)throw new T1e(n);const a=af(n);if(q1e(a)>s)throw new I1e(n);if(a<BigInt(0))throw new WAt(n);return s?wE(a.toString(16),s/8*2):a.toString(16)}if(t.startsWith("int")){const s=xW(r,3);if(s%8||s<8||s>256)throw new T1e(t);const a=af(n);if(q1e(a)>s)throw new I1e(n);return a<BigInt(0)?VMe(a.toString(),s/8*2):s?wE(a.toString(16),s/4):a.toString(16)}if(r==="bytes"){if(n.replace(/^0x/i,"").length%2!==0)throw new I4(n);return n}if(t.startsWith("bytes")){if(n.replace(/^0x/i,"").length%2!==0)throw new I4(n);const s=xW(t,5);if(!s||s<1||s>64||s<n.replace(/^0x/i,"").length/2)throw new I4(n);return HMe(n,s*2)}return""},qMe=t=>{const[e,n]=f_t(t);return Array.isArray(n)?n.map(a=>G1e(e,a).replace("0x","")).join(""):G1e(e,n).replace("0x","")},Rle=(...t)=>`0x${t.map(qMe).join("").toLowerCase()}`,p_t=(...t)=>zT(Rle(...t)),m_t=(...t)=>ah(Rle(...t)),x_t=t=>zT(`0x${(typeof t=="number"?t.toString():t).padStart(64,"0")}`);function g_t(t){return pMe(t)}const SE=t=>g_t(t),b_t=t=>Gi(SE(t));var lU=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 GMe(t){return(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function KMe(t,e,n){return lU(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 Lle(t,e){let n;return[new Promise((s,a)=>{n=setInterval(function o(){return lU(this,void 0,void 0,function*(){try{const l=yield KMe(t,e);gr(l)||(clearInterval(n),s(l))}catch(l){clearInterval(n),a(l)}}),o}(),e)}),n]}function y_t(t,e){return lU(this,void 0,void 0,function*(){return Lle(t,e)[0]})}function Dle(t,e){let n;const r=new Promise((s,a)=>{n=setTimeout(()=>{a(e)},t)});return[n,r]}function YMe(t,e){let n;const r=new Promise((s,a)=>{n=setInterval(()=>{lU(this,void 0,void 0,function*(){const o=yield t();o&&(clearInterval(n),a(o))})},e)});return[n,r]}const Ble=()=>{const t=SE(16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Gi(t);return[e.substring(2,10),e.substring(10,14),e.substring(14,18),e.substring(18,22),e.substring(22,34)].join("-")},$le=t=>{const e=t.error.code;return Nd.has(e)||e>=-32099&&e<=-32e3},$y=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"result"in t&&gr(t.error)&&(typeof t.id=="number"||typeof t.id=="string"),Uy=t=>!Array.isArray(t)&&t.jsonrpc==="2.0"&&!!t&&gr(t.result)&&"error"in t&&(typeof t.id=="number"||typeof t.id=="string"),cU=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&!gr(t.params)&&!gr(t.method),XMe=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"id"in t&&"result"in t,oL=t=>$y(t)||Uy(t),Ule=t=>Array.isArray(t)?t.every(oL):oL(t),NE=t=>Array.isArray(t)&&t.length>0&&Ule(t);let dM;const QMe=t=>{dM=t},i5=t=>{var e,n,r,s;return typeof dM<"u"&&(dM+=1),{jsonrpc:(e=t.jsonrpc)!==null&&e!==void 0?e:"2.0",id:(r=(n=t.id)!==null&&n!==void 0?n:dM)!==null&&r!==void 0?r:Ble(),method:t.method,params:(s=t.params)!==null&&s!==void 0?s:void 0}},zle=t=>t.map(e=>i5(e)),h0=t=>Array.isArray(t)&&t.length>0,v_t=Object.freeze(Object.defineProperty({__proto__:null,isBatchRequest:h0,isBatchResponse:NE,isResponseRpcError:$le,isResponseWithError:Uy,isResponseWithNotification:cU,isResponseWithResult:$y,isSubscriptionResult:XMe,isValidResponse:Ule,setRequestIdStart:QMe,toBatchPayload:zle,toPayload:i5,validateResponse:oL},Symbol.toStringTag,{value:"Module"}));var gW=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},ZMe;class lL{constructor({timeout:e,eagerStart:n,timeoutMessage:r}={timeout:0,eagerStart:!1,timeoutMessage:"DeferredPromise timed out"}){this[ZMe]="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 gW(this,void 0,void 0,function*(){return this._promise.then(e,n)})}catch(e){return gW(this,void 0,void 0,function*(){return this._promise.catch(e)})}finally(e){return gW(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 JOe(this._timeoutMessage))}_clearTimeout(){this._timeoutId&&clearTimeout(this._timeoutId)}}ZMe=Symbol.toStringTag;class JMe{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 Z$({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 K1e=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 Hle extends DT{constructor(){super(...arguments),this._eventEmitter=new woe,this._chainId="",this._accounts=[]}_getChainId(){return K1e(this,void 0,void 0,function*(){var e;const n=yield this.request(i5({method:"eth_chainId",params:[]}));return(e=n==null?void 0:n.result)!==null&&e!==void 0?e:""})}_getAccounts(){return K1e(this,void 0,void 0,function*(){var e;const n=yield this.request(i5({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 KAt(e,n))}_onAccountsChanged(){this._eventEmitter.emit("accountsChanged",this._accounts)}}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())})};const w_t={autoReconnect:!0,delay:5e3,maxAttempts:5},C_t=1e3;class eRe extends Hle{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 Mte(e);this._socketPath=e,this._socketOptions=n,this._reconnectOptions=Object.assign(Object.assign({},w_t),r??{}),this._pendingRequestsQueue=new Map,this._sentRequestsQueue=new Map,this._init(),this.connect(),this.chunkResponseParser=new JMe(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 BT(`Error while connecting to ${this._socketPath}. Reason: ${e.message}`):new Mte(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??C_t;this._removeSocketListeners(),this.getStatus()!=="disconnected"&&this._closeSocketConnection(r,n),this._onDisconnect(r,n)}safeDisconnect(e,n){return bW(this,arguments,void 0,function*(r,s,a=!1,o=1e3){let l=0;yield bW(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 cAt),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 lAt(this._reconnectOptions.maxAttempts))))}request(e){return bW(this,void 0,void 0,function*(){if(ai(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 xAt("Request Id not defined");if(this._sentRequestsQueue.has(n))throw new uAt(n);const r=new lL;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(!(ai(n)||n.length===0))for(const r of n){if(cU(r)&&r.method.endsWith("_subscription")){this._eventEmitter.emit("message",r);return}const s=NE(r)?r[0].id:r.id,a=this._sentRequestsQueue.get(s);if(!a)return;(NE(r)||$y(r)||Uy(r))&&(this._eventEmitter.emit("message",r),a.deferredPromise.resolve(r)),this._sentRequestsQueue.delete(s)}}clearQueues(e){this._clearQueues(e)}_clearQueues(e){this._pendingRequestsQueue.size>0&&this._pendingRequestsQueue.forEach((n,r)=>{n.deferredPromise.reject(new Fte(e)),this._pendingRequestsQueue.delete(r)}),this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((n,r)=>{n.deferredPromise.reject(new Fte(e)),this._sentRequestsQueue.delete(r)}),this._removeSocketListeners()}}const tRe=Object.freeze(Object.defineProperty({__proto__:null,ChunkResponseParser:JMe,Eip1193Provider:Hle,EventEmitter:Mle,SocketProvider:eRe,Web3DeferredPromise:lL,asciiToHex:BMe,bytesToHex:Gi,bytesToUint8Array:hx,checkAddressCheckSum:e_t,compareBlockNumbers:l_t,convert:oU,convertScalarValue:CE,encodePacked:Rle,ethUnitMap:iU,format:qr,fromAscii:K9t,fromDecimal:H9t,fromTwosComplement:c_t,fromUtf8:DMe,fromWei:X9t,getStorageSlotNumForLongString:x_t,hexToAscii:$Me,hexToBytes:po,hexToNumber:UT,hexToNumberString:V9t,hexToString:G9t,hexToUtf8:aU,isAddress:t_t,isBatchRequest:h0,isBatchResponse:NE,isBloom:n_t,isContractAddressInBloom:i_t,isContractInitOptions:_y,isDataFormat:Cg,isHex:J9t,isHexStrict:Z9t,isInBloom:r_t,isNullish:ai,isPromise:GMe,isResponseRpcError:$le,isResponseWithError:Uy,isResponseWithNotification:cU,isResponseWithResult:$y,isSubscriptionResult:XMe,isTopic:a_t,isTopicInBloom:o_t,isUint8Array:E2,isUserEthereumAddressInBloom:s_t,isValidResponse:Ule,jsonRpc:v_t,keccak256:TN,keccak256Wrapper:TN,leftPad:wE,mergeDeep:k2,numberToHex:oc,padLeft:kN,padRight:zMe,pollTillDefined:y_t,pollTillDefinedAndReturnIntervalId:Lle,processSolidityEncodePackedArgs:qMe,randomBytes:SE,randomHex:b_t,rejectIfConditionAtInterval:YMe,rejectIfTimeout:Dle,rightPad:HMe,setRequestIdStart:QMe,sha3:zT,sha3Raw:ah,soliditySha3:p_t,soliditySha3Raw:m_t,stringToHex:W9t,toAscii:Y9t,toBatchPayload:zle,toBigInt:mw,toBool:UMe,toChecksumAddress:wx,toDecimal:z9t,toHex:A1,toNumber:af,toPayload:i5,toTwosComplement:VMe,toUtf8:q9t,toWei:Q9t,uint8ArrayConcat:Ad,uint8ArrayEquals:sU,utf8ToBytes:Ole,utf8ToHex:km,uuidV4:Ble,validateResponse:oL,waitWithTimeout:KMe},Symbol.toStringTag,{value:"Module"}));class uU{constructor(){this._emitter=new Mle}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 a5;(function(t){t.CONFIG_CHANGE="CONFIG_CHANGE"})(a5||(a5={}));class S_t extends uU{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:A1(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]),!ai(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(!ai(this.config.defaultCommon)&&!ai(this.config.defaultCommon.baseChain)&&e!==this.config.defaultCommon.baseChain)throw new O1e(this.config.defaultChain,e);this._triggerConfigChange("defaultChain",e),this.config.defaultChain=e}get defaultHardfork(){return this.config.defaultHardfork}set defaultHardfork(e){if(!ai(this.config.defaultCommon)&&!ai(this.config.defaultCommon.hardfork)&&e!==this.config.defaultCommon.hardfork)throw new F1e(this.config.defaultCommon.hardfork,e);this._triggerConfigChange("defaultHardfork",e),this.config.defaultHardfork=e}get defaultCommon(){return this.config.defaultCommon}set defaultCommon(e){if(!ai(this.config.defaultHardfork)&&!ai(e)&&!ai(e.hardfork)&&this.config.defaultHardfork!==e.hardfork)throw new F1e(this.config.defaultHardfork,e.hardfork);if(!ai(this.config.defaultChain)&&!ai(e)&&!ai(e.baseChain)&&this.config.defaultChain!==e.baseChain)throw new O1e(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(a5.CONFIG_CHANGE,{name:e,oldValue:this.config[e],newValue:n})}}var JP={exports:{}},Y1e;function N_t(){return Y1e||(Y1e=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ru<"u"&&Ru,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(o){var l=typeof a<"u"&&a||typeof self<"u"&&self||typeof l<"u"&&l,c={searchParams:"URLSearchParams"in l,iterable:"Symbol"in l&&"iterator"in Symbol,blob:"FileReader"in l&&"Blob"in l&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in l,arrayBuffer:"ArrayBuffer"in l};function u(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 ae=G.shift();return{done:ae===void 0,value:ae}}};return c.iterable&&(ie[Symbol.iterator]=function(){return ie}),ie}function v(G){this.map={},G instanceof v?G.forEach(function(ie,ae){this.append(ae,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 ae=this.map[G];this.map[G]=ae?ae+", "+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 ae in this.map)this.map.hasOwnProperty(ae)&&G.call(ie,this.map[ae],ae,this)},v.prototype.keys=function(){var G=[];return this.forEach(function(ie,ae){G.push(ae)}),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,ae){G.push([ae,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 N(G){return new Promise(function(ie,ae){G.onload=function(){ie(G.result)},G.onerror=function(){ae(G.error)}})}function I(G){var ie=new FileReader,ae=N(ie);return ie.readAsArrayBuffer(G),ae}function P(G){var ie=new FileReader,ae=N(ie);return ie.readAsText(G),ae}function M(G){for(var ie=new Uint8Array(G),ae=new Array(ie.length),q=0;q<ie.length;q++)ae[q]=String.fromCharCode(ie[q]);return ae.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(I)}),this.text=function(){var G=C(this);if(G)return G;if(this._bodyBlob)return P(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(M(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(se)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function z(G){var ie=G.toUpperCase();return L.indexOf(ie)>-1?ie:G}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||{};var ae=ie.body;if(G instanceof Q){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,!ae&&G._bodyInit!=null&&(ae=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=z(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")&&ae)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(ae),(this.method==="GET"||this.method==="HEAD")&&(ie.cache==="no-store"||ie.cache==="no-cache")){var q=/([?&])_=[^&]*/;if(q.test(this.url))this.url=this.url.replace(q,"$1_="+new Date().getTime());else{var W=/\?/;this.url+=(W.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Q.prototype.clone=function(){return new Q(this,{body:this._bodyInit})};function se(G){var ie=new FormData;return G.trim().split("&").forEach(function(ae){if(ae){var q=ae.split("="),W=q.shift().replace(/\+/g," "),ne=q.join("=").replace(/\+/g," ");ie.append(decodeURIComponent(W),decodeURIComponent(ne))}}),ie}function ee(G){var ie=new v,ae=G.replace(/\r?\n[\t ]+/g," ");return ae.split("\r").map(function(q){return q.indexOf(`
`)===0?q.substr(1,q.length):q}).forEach(function(q){var W=q.split(":"),ne=W.shift().trim();if(ne){var oe=W.join(":").trim();ie.append(ne,oe)}}),ie}$.call(Q.prototype);function K(G,ie){if(!(this instanceof K))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(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},K.error=function(){var G=new K(null,{status:0,statusText:""});return G.type="error",G};var re=[301,302,303,307,308];K.redirect=function(G,ie){if(re.indexOf(ie)===-1)throw new RangeError("Invalid status code");return new K(null,{status:ie,headers:{location:G}})},o.DOMException=l.DOMException;try{new o.DOMException}catch{o.DOMException=function(ie,ae){this.message=ie,this.name=ae;var q=Error(ie);this.stack=q.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function de(G,ie){return new Promise(function(ae,q){var W=new Q(G,ie);if(W.signal&&W.signal.aborted)return q(new o.DOMException("Aborted","AbortError"));var ne=new XMLHttpRequest;function oe(){ne.abort()}ne.onload=function(){var _e={status:ne.status,statusText:ne.statusText,headers:ee(ne.getAllResponseHeaders()||"")};_e.url="responseURL"in ne?ne.responseURL:_e.headers.get("X-Request-URL");var xe="response"in ne?ne.response:ne.responseText;setTimeout(function(){ae(new K(xe,_e))},0)},ne.onerror=function(){setTimeout(function(){q(new TypeError("Network request failed"))},0)},ne.ontimeout=function(){setTimeout(function(){q(new TypeError("Network request failed"))},0)},ne.onabort=function(){setTimeout(function(){q(new o.DOMException("Aborted","AbortError"))},0)};function he(_e){try{return _e===""&&l.location.href?l.location.href:_e}catch{return _e}}ne.open(W.method,he(W.url),!0),W.credentials==="include"?ne.withCredentials=!0:W.credentials==="omit"&&(ne.withCredentials=!1),"responseType"in ne&&(c.blob?ne.responseType="blob":c.arrayBuffer&&W.headers.get("Content-Type")&&W.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ne.responseType="arraybuffer")),ie&&typeof ie.headers=="object"&&!(ie.headers instanceof v)?Object.getOwnPropertyNames(ie.headers).forEach(function(_e){ne.setRequestHeader(_e,g(ie.headers[_e]))}):W.headers.forEach(function(_e,xe){ne.setRequestHeader(xe,_e)}),W.signal&&(W.signal.addEventListener("abort",oe),ne.onreadystatechange=function(){ne.readyState===4&&W.signal.removeEventListener("abort",oe)}),ne.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return de.polyfill=!0,l.fetch||(l.fetch=de,l.Headers=v,l.Request=Q,l.Response=K),o.Headers=v,o.Request=Q,o.Response=K,o.fetch=de,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}(JP,JP.exports)),JP.exports}var j_t=N_t();const A_t=Ti(j_t);var __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())})};class dU extends DT{constructor(e,n){if(super(),!dU.validateClientUrl(e))throw new Mte(e);this.clientUrl=e,this.httpProviderOptions=n}static validateClientUrl(e){return typeof e=="string"?/^http(s)?:\/\//i.test(e):!1}getStatus(){throw new Yx}supportsSubscriptions(){return!1}request(e,n){var r;return __t(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 A_t(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 P0(yield a.json(),void 0,void 0,a.status);return yield a.json()})}on(){throw new Yx}removeListener(){throw new Yx}once(){throw new Yx}removeAllListeners(){throw new Yx}connect(){throw new Yx}disconnect(){throw new Yx}reset(){throw new Yx}reconnect(){throw new Yx}}var 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 E_t=qC;class nRe extends eRe{constructor(e,n,r){super(e,n,r)}_validateProviderPath(e){return typeof e=="string"?/^ws(s)?:\/\//i.test(e):!1}getStatus(){if(this._socketConnection&&!ai(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 E_t(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 Fte;(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 rRe=t=>DT.isWeb3Provider(t),sRe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="Function",iRe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="AsyncFunction",aRe=t=>typeof t!="string"&&"send"in t,oRe=t=>typeof t!="string"&&"sendAsync"in t,cL=t=>t&&(rRe(t)||iRe(t)||sRe(t)||oRe(t)||aRe(t)),k_t=t=>t&&"supportsSubscriptions"in t?t.supportsSubscriptions():!!(t&&typeof t!="string"&&"on"in t);var yW=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())})},IN;(function(t){t.PROVIDER_CHANGED="PROVIDER_CHANGED",t.BEFORE_PROVIDER_CHANGE="BEFORE_PROVIDER_CHANGE"})(IN||(IN={}));const X1e={HttpProvider:dU,WebsocketProvider:nRe};class v3 extends uU{constructor(e,n,r){super(),ai(e)||this.setProvider(e),this.useRpcCallSpecification=n,ai(r)||(this.middleware=r)}static get providers(){return X1e}get provider(){return this._provider}get providers(){return X1e}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 aM(`Can't autodetect provider for "${e}"`);else ai(e)?n=void 0:n=e;return this.emit(IN.BEFORE_PROVIDER_CHANGE,this._provider),this._provider=n,this.emit(IN.PROVIDER_CHANGED,this._provider),!0}setMiddleware(e){this.middleware=e}send(e){return yW(this,void 0,void 0,function*(){const n=Object.assign({},e);let r=yield this._sendRequest(n);if(ai(this.middleware)||(r=yield this.middleware.processResponse(r)),$y(r))return r.result;throw new P0(r)})}sendBatch(e){return yW(this,void 0,void 0,function*(){return yield this._sendRequest(e)})}_sendRequest(e){return yW(this,void 0,void 0,function*(){const{provider:n}=this;if(ai(n))throw new aM("Provider not available. Use `.setProvider` or `.provider=` to initialize the provider.");let r=h0(e)?zle(e):i5(e);if(ai(this.middleware)||(r=yield this.middleware.processRequest(r)),rRe(n)){let s;try{s=yield n.request(r)}catch(a){s=a}return this._processJsonRpcResponse(r,s,{legacy:!1,error:!1})}if(iRe(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(sRe(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));GMe(c)&&c.then(l).catch(d=>{try{const f=this._processJsonRpcResponse(r,d,{legacy:!0,error:!0});a(f)}catch(f){a(f)}})});if(aRe(n))return new Promise((s,a)=>{n.send(r,(o,l)=>{if(o)return a(this._processJsonRpcResponse(r,o,{legacy:!0,error:!0}));if(ai(l))throw new P0({},'Got a "nullish" response from provider.');return s(this._processJsonRpcResponse(r,l,{legacy:!0,error:!1}))})});if(oRe(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 aM("Provider does not have a request or send method to use.")})}_processJsonRpcResponse(e,n,{legacy:r,error:s}){if(ai(n))return this._buildResponse(e,null,s);if(Uy(n)){if(this.useRpcCallSpecification&&$le(n)){const a=n;if(Nd.get(a.error.code)){const o=Nd.get(a.error.code).error;throw new o(a)}else throw new ch(a)}else if(!v3._isReverted(n))throw new Z$(n,e)}if($y(n))return n;if(n instanceof Error)throw v3._isReverted(n),n;if(!r&&h0(e)&&NE(n)||r&&!s&&h0(e))return n;if(r&&s&&h0(e))throw n;if(r&&!Uy(n)&&!$y(n))return this._buildResponse(e,n,s);throw h0(e)&&!Array.isArray(n)?new P0(n,"Got normal response for a batch request."):!h0(e)&&Array.isArray(n)?new P0(n,"Got batch response for a normal request."):new P0(n,"Invalid response")}static _isReverted(e){let n;if(Uy(e)?n=e.error:e instanceof Error&&(n=e),n!=null&&n.message.includes("revert"))throw new b3(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 r7=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class uL{constructor(e,n,r=!1){this.requestManager=e,this.registeredSubscriptions=n,this.tolerateUnlinkedSubscription=r,this._subscriptions=new Map,this.requestManager.on(IN.BEFORE_PROVIDER_CHANGE,()=>r7(this,void 0,void 0,function*(){yield this.unsubscribe()})),this.requestManager.on(IN.PROVIDER_CHANGED,()=>{this.clear(),this.listenToProviderEvents()}),this.listenToProviderEvents()}listenToProviderEvents(){const e=this.requestManager.provider;!this.requestManager.provider||typeof(e==null?void 0:e.supportsSubscriptions)=="function"&&!(e!=null&&e.supportsSubscriptions())||typeof this.requestManager.provider.on=="function"&&(typeof this.requestManager.provider.request=="function"?this.requestManager.provider.on("message",n=>this.messageListener(n)):e.on("data",n=>this.messageListener(n)))}messageListener(e){var n,r,s;if(!e)throw new gg("Should not call messageListener with no data. Type was");const a=((n=e.params)===null||n===void 0?void 0:n.subscription)||((r=e.data)===null||r===void 0?void 0:r.subscription)||((s=e.id)===null||s===void 0?void 0:s.toString(16));if(a){const o=this._subscriptions.get(a);o==null||o.processSubscriptionData(e)}}subscribe(e,n){return r7(this,arguments,void 0,function*(r,s,a=yd){const o=this.registeredSubscriptions[r];if(!o)throw new gg("Invalid subscription type");const l=new o(s??void 0,{subscriptionManager:this,returnFormat:a});return yield this.addSubscription(l),l})}get subscriptions(){return this._subscriptions}addSubscription(e){return r7(this,void 0,void 0,function*(){if(!this.requestManager.provider)throw new aM("Provider not available");if(!this.supportsSubscriptions())throw new gg("The current provider does not support subscriptions");if(e.id&&this._subscriptions.has(e.id))throw new gg(`Subscription with id "${e.id}" already exists`);if(yield e.sendSubscriptionRequest(),ai(e.id))throw new gg("Subscription is not subscribed yet.");return this._subscriptions.set(e.id,e),e.id})}removeSubscription(e){return r7(this,void 0,void 0,function*(){const{id:n}=e;if(ai(n))throw new gg("Subscription is not subscribed yet. Or, had already been unsubscribed but not through the Subscription Manager.");if(!this._subscriptions.has(n)&&!this.tolerateUnlinkedSubscription)throw new gg(`Subscription with id "${n.toString()}" does not exists`);return yield e.sendUnsubscribeRequest(),this._subscriptions.delete(n),n})}unsubscribe(e){return r7(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 ai(this.requestManager.provider)?!1:k_t(this.requestManager.provider)}}var s7=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 HT extends uU{constructor(e,n){var r;super(),this.args=e;const{requestManager:s}=n,{subscriptionManager:a}=n;s?this._subscriptionManager=new uL(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 s7(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&&cU(e)&&this._processSubscriptionResult(e==null?void 0:e.params.result)}sendSubscriptionRequest(){return s7(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 s7(this,void 0,void 0,function*(){yield this.unsubscribe(),yield this.subscribe()})}unsubscribe(){return s7(this,void 0,void 0,function*(){this.id&&(yield this._subscriptionManager.removeSubscription(this))})}sendUnsubscribeRequest(){return s7(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 uC=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 dL extends xjt{constructor(){super(...arguments),this._addressMap=new Map,this._defaultKeyName="web3js_wallet"}static getStorage(){let e;try{e=window.localStorage;const n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch(n){return n&&(n.code===22||n.code===1014||n.name==="QuotaExceededError"||n.name==="NS_ERROR_DOM_QUOTA_REACHED")&&!gr(e)&&e.length!==0?e:void 0}}create(e){for(let n=0;n<e;n+=1)this.add(this._accountProvider.create());return this}add(e){var n;if(typeof e=="string")return this.add(this._accountProvider.privateKeyToAccount(e));let r=this.length;return this.get(e.address)&&(console.warn(`Account ${e.address.toLowerCase()} already exists.`),r=(n=this._addressMap.get(e.address.toLowerCase()))!==null&&n!==void 0?n:r),this._addressMap.set(e.address.toLowerCase(),r),this[r]=e,this}get(e){if(typeof e=="string"){const n=this._addressMap.get(e.toLowerCase());return gr(n)?void 0:this[n]}return this[e]}remove(e){if(typeof e=="string"){const n=this._addressMap.get(e.toLowerCase());return gr(n)?!1:(this._addressMap.delete(e.toLowerCase()),this.splice(n,1),!0)}return this[e]?(this.splice(e,1),!0):!1}clear(){return this._addressMap.clear(),this.length=0,this}encrypt(e,n){return uC(this,void 0,void 0,function*(){return Promise.all(this.map(r=>uC(this,void 0,void 0,function*(){return r.encrypt(e,n)})))})}decrypt(e,n,r){return uC(this,void 0,void 0,function*(){const s=yield Promise.all(e.map(a=>uC(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 uC(this,void 0,void 0,function*(){const r=dL.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 uC(this,void 0,void 0,function*(){const r=dL.getStorage();if(!r)throw new Error("Local storage not available.");const s=r.getItem(n??this._defaultKeyName);return s&&(yield this.decrypt(JSON.parse(s)||[],e)),this})}}const D0={web:oM};function lRe(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 cRe(t,e,n){if(!D0.web)throw new Error("Browser crypto not available.");let r;if(["aes-128-cbc","aes-256-cbc"].includes(t)&&(r="cbc"),["aes-128-ctr","aes-256-ctr"].includes(t)&&(r="ctr"),!r)throw new Error("AES: unsupported mode");return[await D0.web.subtle.importKey("raw",e,{name:`AES-${r.toUpperCase()}`,length:e.length*8},!0,["encrypt","decrypt"]),{name:`aes-${r}`,iv:n,counter:n,length:128}]}async function Vle(t,e,n,r="aes-128-ctr",s=!0){if(lRe(e,n,r),D0.web){const[a,o]=await cRe(r,e,n),l=await D0.web.subtle.encrypt(o,a,t);let c=new Uint8Array(l);return!s&&o.name==="aes-cbc"&&!(t.length%16)&&(c=c.slice(0,-16)),c}else if(D0.node){const a=D0.node.createCipheriv(r,e,n);return a.setAutoPadding(s),YR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}async function T_t(t,e,n,r){const s=t.slice(-16);for(let o=0;o<16;o++)s[o]^=n[o]^16;return(await Vle(s,e,n,r)).slice(0,16)}async function I_t(t,e,n,r="aes-128-ctr",s=!0){if(lRe(e,n,r),D0.web){const[a,o]=await cRe(r,e,n);if(!s&&o.name==="aes-cbc"){const u=await T_t(t,e,n,r);t=YR(t,u)}const l=await D0.web.subtle.decrypt(o,a,t),c=new Uint8Array(l);if(o.name==="aes-cbc"){const u=await Vle(c,e,n,r);if(!_7t(u,t))throw new Error("AES: wrong padding")}return c}else if(D0.node){const a=D0.node.createDecipheriv(r,e,n);return a.setAutoPadding(s),YR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}class uRe extends Ale{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Nle(e);const r=SN(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 J3(this),this.iHash.update(e),this}digestInto(e){J3(this),d8(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 Wle=(t,e,n)=>new uRe(t,e).update(n).digest();Wle.create=(t,e)=>new uRe(t,e);function P_t(t,e,n,r){Nle(t);const s=fMe({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=SN(e),u=SN(n),d=new Uint8Array(o),f=Wle.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function F_t(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function qle(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=P_t(t,e,n,r);let u;const d=new Uint8Array(4),f=cM(d),x=new Uint8Array(l.outputLen);for(let g=1,y=0;y<a;g++,y+=l.outputLen){const v=o.subarray(y,y+l.outputLen);f.setInt32(0,g,!1),(u=c._cloneInto(u)).update(d).digestInto(x),v.set(x.subarray(0,v.length));for(let C=1;C<s;C++){l._cloneInto(u).update(x).digestInto(x);for(let N=0;N<v.length;N++)v[N]^=x[N]}}return F_t(l,c,o,u,x)}function O_t(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 M_t=(t,e,n)=>t&e^~t&n,R_t=(t,e,n)=>t&e^t&n^e&n;class L_t extends Ale{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=cM(this.buffer)}update(e){J3(this);const{view:n,buffer:r,blockLen:s}=this;e=SN(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=cM(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){J3(this),jle(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;O_t(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=cM(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 D_t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),jb=new Uint32Array(64);class B_t extends L_t{constructor(){super(64,32,8,!1),this.A=Nb[0]|0,this.B=Nb[1]|0,this.C=Nb[2]|0,this.D=Nb[3]|0,this.E=Nb[4]|0,this.F=Nb[5]|0,this.G=Nb[6]|0,this.H=Nb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)jb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=jb[f-15],g=jb[f-2],y=a0(x,7)^a0(x,18)^x>>>3,v=a0(g,17)^a0(g,19)^g>>>10;jb[f]=v+jb[f-7]+y+jb[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+M_t(l,c,u)+D_t[f]+jb[f]|0,v=(a0(r,2)^a0(r,13)^a0(r,22))+R_t(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(){jb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const fU=hMe(()=>new B_t);function dRe(t,e,n,r,s){if(!["sha256","sha512"].includes(s))throw new Error("Only sha256 and sha512 are supported");return XR(t),XR(e),qle(fU,t,e,{c:n,dkLen:r})}function Q1e(t,e,n,r,s,a){let o=t[e++]^n[r++],l=t[e++]^n[r++],c=t[e++]^n[r++],u=t[e++]^n[r++],d=t[e++]^n[r++],f=t[e++]^n[r++],x=t[e++]^n[r++],g=t[e++]^n[r++],y=t[e++]^n[r++],v=t[e++]^n[r++],C=t[e++]^n[r++],N=t[e++]^n[r++],I=t[e++]^n[r++],P=t[e++]^n[r++],M=t[e++]^n[r++],F=t[e++]^n[r++],$=o,L=l,z=c,Q=u,se=d,ee=f,K=x,re=g,de=y,G=v,ie=C,ae=N,q=I,W=P,ne=M,oe=F;for(let he=0;he<8;he+=2)se^=ya($+q|0,7),de^=ya(se+$|0,9),q^=ya(de+se|0,13),$^=ya(q+de|0,18),G^=ya(ee+L|0,7),W^=ya(G+ee|0,9),L^=ya(W+G|0,13),ee^=ya(L+W|0,18),ne^=ya(ie+K|0,7),z^=ya(ne+ie|0,9),K^=ya(z+ne|0,13),ie^=ya(K+z|0,18),Q^=ya(oe+ae|0,7),re^=ya(Q+oe|0,9),ae^=ya(re+Q|0,13),oe^=ya(ae+re|0,18),L^=ya($+Q|0,7),z^=ya(L+$|0,9),Q^=ya(z+L|0,13),$^=ya(Q+z|0,18),K^=ya(ee+se|0,7),re^=ya(K+ee|0,9),se^=ya(re+K|0,13),ee^=ya(se+re|0,18),ae^=ya(ie+G|0,7),de^=ya(ae+ie|0,9),G^=ya(de+ae|0,13),ie^=ya(G+de|0,18),q^=ya(oe+ne|0,7),W^=ya(q+oe|0,9),ne^=ya(W+q|0,13),oe^=ya(ne+W|0,18);s[a++]=o+$|0,s[a++]=l+L|0,s[a++]=c+z|0,s[a++]=u+Q|0,s[a++]=d+se|0,s[a++]=f+ee|0,s[a++]=x+K|0,s[a++]=g+re|0,s[a++]=y+de|0,s[a++]=v+G|0,s[a++]=C+ie|0,s[a++]=N+ae|0,s[a++]=I+q|0,s[a++]=P+W|0,s[a++]=M+ne|0,s[a++]=F+oe|0}function vW(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)Q1e(n,o,t,e,n,a),l>0&&(o+=16),Q1e(n,a,t,e+=16,n,o)}function $_t(t,e,n){const r=fMe({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=qle(fU,t,e,{c:1,dkLen:f*o}),v=lM(y),C=lM(new Uint8Array(f*s)),N=lM(new Uint8Array(f));let I=()=>{};if(d){const P=2*s*o,M=Math.max(Math.floor(P/1e4),1);let F=0;I=()=>{F++,d&&(!(F%M)||F===P)&&d(F/P)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:N,blockMixCb:I,asyncTick:c}}function U_t(t,e,n,r,s){const a=qle(fU,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),s.fill(0),a}function z_t(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x}=$_t(t,e,n);GR||KR(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++)vW(c,C,c,C+=l,s),x();vW(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let N=0;N<l;N++)f[N]=u[y+N]^c[C*l+N];vW(f,0,u,y,s),x()}}return GR||KR(u),U_t(t,o,d,c,f)}function fRe(t,e,n,r,s,a,o){return XR(t),XR(e),z_t(t,e,{N:n,r:s,p:r,dkLen:a,onProgress:o})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hRe=BigInt(0),hU=BigInt(1),H_t=BigInt(2);function o5(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function VT(t){if(!o5(t))throw new Error("Uint8Array expected")}const V_t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function PN(t){VT(t);let e="";for(let n=0;n<t.length;n++)e+=V_t[t[n]];return e}function pRe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function Gle(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Qx={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Z1e(t){if(t>=Qx._0&&t<=Qx._9)return t-Qx._0;if(t>=Qx._A&&t<=Qx._F)return t-(Qx._A-10);if(t>=Qx._a&&t<=Qx._f)return t-(Qx._a-10)}function FN(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=Z1e(t.charCodeAt(a)),l=Z1e(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 w3(t){return Gle(PN(t))}function Kle(t){return VT(t),Gle(PN(Uint8Array.from(t).reverse()))}function ON(t,e){return FN(t.toString(16).padStart(e*2,"0"))}function Yle(t,e){return ON(t,e).reverse()}function W_t(t){return FN(pRe(t))}function Yp(t,e,n){let r;if(typeof e=="string")try{r=FN(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(o5(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 jE(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];VT(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 q_t(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 G_t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function K_t(t){let e;for(e=0;t>hRe;t>>=hU,e+=1);return e}function Y_t(t,e){return t>>BigInt(e)&hU}function X_t(t,e,n){return t|(n?hU:hRe)<<BigInt(e)}const Xle=t=>(H_t<<BigInt(t-1))-hU,wW=t=>new Uint8Array(t),J1e=t=>Uint8Array.from(t);function mRe(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=wW(t),s=wW(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=wW())=>{s=l(J1e([0]),f),r=l(),f.length!==0&&(s=l(J1e([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 jE(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const Q_t={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"||o5(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 WT(t,e,n={}){const r=(s,a,o)=>{const l=Q_t[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 Z_t=Object.freeze(Object.defineProperty({__proto__:null,abytes:VT,bitGet:Y_t,bitLen:K_t,bitMask:Xle,bitSet:X_t,bytesToHex:PN,bytesToNumberBE:w3,bytesToNumberLE:Kle,concatBytes:jE,createHmacDrbg:mRe,ensureBytes:Yp,equalBytes:q_t,hexToBytes:FN,hexToNumber:Gle,isBytes:o5,numberToBytesBE:ON,numberToBytesLE:Yle,numberToHexUnpadded:pRe,numberToVarBytesBE:W_t,utf8ToBytes:G_t,validateObject:WT},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mc=BigInt(0),jl=BigInt(1),nw=BigInt(2),J_t=BigInt(3),Wte=BigInt(4),ebe=BigInt(5),tbe=BigInt(8);BigInt(9);BigInt(16);function Zd(t,e){const n=t%e;return n>=Mc?n:e+n}function eEt(t,e,n){if(n<=Mc||e<Mc)throw new Error("Expected power/modulo > 0");if(n===jl)return Mc;let r=jl;for(;e>Mc;)e&jl&&(r=r*t%n),t=t*t%n,e>>=jl;return r}function kh(t,e,n){let r=t;for(;e-- >Mc;)r*=r,r%=n;return r}function qte(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=jl;for(;n!==Mc;){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 Zd(s,e)}function tEt(t){const e=(t-jl)/nw;let n,r,s;for(n=t-jl,r=0;n%nw===Mc;n/=nw,r++);for(s=nw;s<t&&eEt(s,e,t)!==t-jl;s++);if(r===1){const o=(t+jl)/Wte;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)/nw;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,jl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function nEt(t){if(t%Wte===J_t){const e=(t+jl)/Wte;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%tbe===ebe){const e=(t-ebe)/tbe;return function(r,s){const a=r.mul(s,nw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,nw),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return tEt(t)}const rEt=["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=rEt.reduce((r,s)=>(r[s]="function",r),e);return WT(t,n)}function iEt(t,e,n){if(n<Mc)throw new Error("Expected power > 0");if(n===Mc)return t.ONE;if(n===jl)return e;let r=t.ONE,s=e;for(;n>Mc;)n&jl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=jl;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 xRe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function oEt(t,e,n=!1,r={}){if(t<=Mc)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=xRe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=nEt(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:Xle(s),ZERO:Mc,ONE:jl,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&jl)===jl,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)=>iEt(l,c,u),div:(c,u)=>Zd(c*qte(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>qte(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>aEt(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?Yle(c,a):ON(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?Kle(c):w3(c)}});return Object.freeze(l)}function gRe(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 bRe(t){const e=gRe(t);return e+Math.ceil(e/2)}function lEt(t,e,n=!1){const r=t.length,s=gRe(e),a=bRe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?w3(t):Kle(t),l=Zd(o,e-jl)+jl;return n?Yle(l,s):ON(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cEt=BigInt(0),CW=BigInt(1);function uEt(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>cEt;)a&CW&&(o=o.add(l)),l=l.double(),a>>=CW;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+=CW);const N=v,I=v+Math.abs(C)-1,P=y%2!==0,M=C<0;C===0?d=d.add(n(P,a[N])):u=u.add(n(M,a[I]))}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 yRe(t){return sEt(t.Fp),WT(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...xRe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dEt(t){const e=yRe(t);WT(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:fEt,hexToBytes:hEt}=Z_t,xw={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=xw;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:fEt(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=xw,n=typeof t=="string"?hEt(t):t;VT(n);let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:a}=xw._parseInt(n.subarray(2)),{d:o,l}=xw._parseInt(a);if(l.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const d=u.toString(16);return d.length&1?`0${d}`:d},r=e(n(t.s)),s=e(n(t.r)),a=r.length/2,o=s.length/2,l=n(a),c=n(o);return`30${n(o+a+4)}02${c}${s}02${l}${r}`}},$g=BigInt(0),Jh=BigInt(1);BigInt(2);const nbe=BigInt(3);BigInt(4);function pEt(t){const e=dEt(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const N=v.toAffine();return jE(Uint8Array.from([4]),n.toBytes(N.x),n.toBytes(N.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),N=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:N}});function a(y){const{a:v,b:C}=e,N=n.sqr(y),I=n.mul(N,y);return n.add(n.add(I,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:N,n:I}=e;if(v&&typeof y!="bigint"){if(o5(y)&&(y=PN(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let P;try{P=typeof y=="bigint"?y:w3(Yp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return N&&(P=Zd(P,I)),l(P),P}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,N){if(this.px=v,this.py=C,this.pz=N,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(N==null||!n.isValid(N))throw new Error("z required")}static fromAffine(v){const{x:C,y:N}=v||{};if(!v||!n.isValid(C)||!n.isValid(N))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const I=P=>n.eql(P,n.ZERO);return I(C)&&I(N)?f.ZERO:new f(C,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(N=>N.pz));return v.map((N,I)=>N.toAffine(C[I])).map(f.fromAffine)}static fromHex(v){const C=f.fromAffine(s(Yp("pointHex",v)));return C.assertValidity(),C}static fromPrivateKey(v){return f.BASE.multiply(c(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:C}=this.toAffine();if(!n.isValid(v)||!n.isValid(C))throw new Error("bad point: x or y not FE");const N=n.sqr(C),I=a(v);if(!n.eql(N,I))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(n.isOdd)return!n.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){d(v);const{px:C,py:N,pz:I}=this,{px:P,py:M,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(P,I)),L=n.eql(n.mul(N,F),n.mul(M,I));return $&&L}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,N=n.mul(C,nbe),{px:I,py:P,pz:M}=this;let F=n.ZERO,$=n.ZERO,L=n.ZERO,z=n.mul(I,I),Q=n.mul(P,P),se=n.mul(M,M),ee=n.mul(I,P);return ee=n.add(ee,ee),L=n.mul(I,M),L=n.add(L,L),F=n.mul(v,L),$=n.mul(N,se),$=n.add(F,$),F=n.sub(Q,$),$=n.add(Q,$),$=n.mul(F,$),F=n.mul(ee,F),L=n.mul(N,L),se=n.mul(v,se),ee=n.sub(z,se),ee=n.mul(v,ee),ee=n.add(ee,L),L=n.add(z,z),z=n.add(L,z),z=n.add(z,se),z=n.mul(z,ee),$=n.add($,z),se=n.mul(P,M),se=n.add(se,se),z=n.mul(se,ee),F=n.sub(F,z),L=n.mul(se,Q),L=n.add(L,L),L=n.add(L,L),new f(F,$,L)}add(v){d(v);const{px:C,py:N,pz:I}=this,{px:P,py:M,pz:F}=v;let $=n.ZERO,L=n.ZERO,z=n.ZERO;const Q=e.a,se=n.mul(e.b,nbe);let ee=n.mul(C,P),K=n.mul(N,M),re=n.mul(I,F),de=n.add(C,N),G=n.add(P,M);de=n.mul(de,G),G=n.add(ee,K),de=n.sub(de,G),G=n.add(C,I);let ie=n.add(P,F);return G=n.mul(G,ie),ie=n.add(ee,re),G=n.sub(G,ie),ie=n.add(N,I),$=n.add(M,F),ie=n.mul(ie,$),$=n.add(K,re),ie=n.sub(ie,$),z=n.mul(Q,G),$=n.mul(se,re),z=n.add($,z),$=n.sub(K,z),z=n.add(K,z),L=n.mul($,z),K=n.add(ee,ee),K=n.add(K,ee),re=n.mul(Q,re),G=n.mul(se,G),K=n.add(K,re),re=n.sub(ee,re),re=n.mul(Q,re),G=n.add(G,re),ee=n.mul(K,G),L=n.add(L,ee),ee=n.mul(ie,G),$=n.mul(de,$),$=n.sub($,ee),ee=n.mul(de,K),z=n.mul(ie,z),z=n.add(z,ee),new f($,L,z)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const N=n.invertBatch(C.map(I=>I.pz));return C.map((I,P)=>I.toAffine(N[P])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===$g)return C;if(l(v),v===Jh)return this;const{endo:N}=e;if(!N)return g.unsafeLadder(this,v);let{k1neg:I,k1:P,k2neg:M,k2:F}=N.splitScalar(v),$=C,L=C,z=this;for(;P>$g||F>$g;)P&Jh&&($=$.add(z)),F&Jh&&(L=L.add(z)),z=z.double(),P>>=Jh,F>>=Jh;return I&&($=$.negate()),M&&(L=L.negate()),L=new f(n.mul(L.px,N.beta),L.py,L.pz),$.add(L)}multiply(v){l(v);let C=v,N,I;const{endo:P}=e;if(P){const{k1neg:M,k1:F,k2neg:$,k2:L}=P.splitScalar(C);let{p:z,f:Q}=this.wNAF(F),{p:se,f:ee}=this.wNAF(L);z=g.constTimeNegate(M,z),se=g.constTimeNegate($,se),se=new f(n.mul(se.px,P.beta),se.py,se.pz),N=z.add(se),I=Q.add(ee)}else{const{p:M,f:F}=this.wNAF(C);N=M,I=F}return f.normalizeZ([N,I])[0]}multiplyAndAddUnsafe(v,C,N){const I=f.BASE,P=(F,$)=>$===$g||$===Jh||!F.equals(I)?F.multiplyUnsafe($):F.multiply($),M=P(this,C).add(P(v,N));return M.is0()?void 0:M}toAffine(v){const{px:C,py:N,pz:I}=this,P=this.is0();v==null&&(v=P?n.ONE:n.inv(I));const M=n.mul(C,v),F=n.mul(N,v),$=n.mul(I,v);if(P)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:M,y:F}}isTorsionFree(){const{h:v,isTorsionFree:C}=e;if(v===Jh)return!0;if(C)return C(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:C}=e;return v===Jh?this:C?C(f,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),r(f,this,v)}toHex(v=!0){return PN(this.toRawBytes(v))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const x=e.nBitLength,g=uEt(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function mEt(t){const e=yRe(t);return WT(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function xEt(t){const e=mEt(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 Zd(G,r)}function c(G){return qte(G,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=pEt({...e,toBytes(G,ie,ae){const q=ie.toAffine(),W=n.toBytes(q.x),ne=jE;return ae?ne(Uint8Array.from([ie.hasEvenY()?2:3]),W):ne(Uint8Array.from([4]),W,n.toBytes(q.y))},fromBytes(G){const ie=G.length,ae=G[0],q=G.subarray(1);if(ie===s&&(ae===2||ae===3)){const W=w3(q);if(!o(W))throw new Error("Point is not on curve");const ne=f(W);let oe;try{oe=n.sqrt(ne)}catch(xe){const Se=xe instanceof Error?": "+xe.message:"";throw new Error("Point is not on curve"+Se)}const he=(oe&Jh)===Jh;return(ae&1)===1!==he&&(oe=n.neg(oe)),{x:W,y:oe}}else if(ie===a&&ae===4){const W=n.fromBytes(q.subarray(0,n.BYTES)),ne=n.fromBytes(q.subarray(n.BYTES,2*n.BYTES));return{x:W,y:ne}}else throw new Error(`Point of length ${ie} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=G=>PN(ON(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,ae)=>w3(G.slice(ie,ae));class N{constructor(ie,ae,q){this.r=ie,this.s=ae,this.recovery=q,this.assertValidity()}static fromCompact(ie){const ae=e.nByteLength;return ie=Yp("compactSignature",ie,ae*2),new N(C(ie,0,ae),C(ie,ae,2*ae))}static fromDER(ie){const{r:ae,s:q}=xw.toSig(Yp("DER",ie));return new N(ae,q)}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 N(this.r,this.s,ie)}recoverPublicKey(ie){const{r:ae,s:q,recovery:W}=this,ne=L(Yp("msgHash",ie));if(W==null||![0,1,2,3].includes(W))throw new Error("recovery id invalid");const oe=W===2||W===3?ae+e.n:ae;if(oe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const he=W&1?"03":"02",_e=u.fromHex(he+g(oe)),xe=c(oe),Se=l(-ne*xe),ge=l(q*xe),Ce=u.BASE.multiplyAndAddUnsafe(_e,Se,ge);if(!Ce)throw new Error("point at infinify");return Ce.assertValidity(),Ce}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return FN(this.toDERHex())}toDERHex(){return xw.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return FN(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const I={isValidPrivateKey(G){try{return d(G),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const G=bRe(e.n);return lEt(e.randomBytes(G),e.n)},precompute(G=8,ie=u.BASE){return ie._setWindowSize(G),ie.multiply(BigInt(3)),ie}};function P(G,ie=!0){return u.fromPrivateKey(G).toRawBytes(ie)}function M(G){const ie=o5(G),ae=typeof G=="string",q=(ie||ae)&&G.length;return ie?q===s||q===a:ae?q===2*s||q===2*a:G instanceof u}function F(G,ie,ae=!0){if(M(G))throw new Error("first arg must be private key");if(!M(ie))throw new Error("second arg must be public key");return u.fromHex(ie).multiply(d(G)).toRawBytes(ae)}const $=e.bits2int||function(G){const ie=w3(G),ae=G.length*8-e.nBitLength;return ae>0?ie>>BigInt(ae):ie},L=e.bits2int_modN||function(G){return l($(G))},z=Xle(e.nBitLength);function Q(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!($g<=G&&G<z))throw new Error(`bigint expected < 2^${e.nBitLength}`);return ON(G,e.nByteLength)}function se(G,ie,ae=ee){if(["recovered","canonical"].some(Oe=>Oe in ae))throw new Error("sign() legacy options not supported");const{hash:q,randomBytes:W}=e;let{lowS:ne,prehash:oe,extraEntropy:he}=ae;ne==null&&(ne=!0),G=Yp("msgHash",G),oe&&(G=Yp("prehashed msgHash",q(G)));const _e=L(G),xe=d(ie),Se=[Q(xe),Q(_e)];if(he!=null&&he!==!1){const Oe=he===!0?W(n.BYTES):he;Se.push(Yp("extraEntropy",Oe))}const ge=jE(...Se),Ce=_e;function je(Oe){const $e=$(Oe);if(!x($e))return;const Ye=c($e),Je=u.BASE.multiply($e).toAffine(),ht=l(Je.x);if(ht===$g)return;const rt=l(Ye*l(Ce+ht*xe));if(rt===$g)return;let st=(Je.x===ht?0:2)|Number(Je.y&Jh),He=rt;return ne&&y(rt)&&(He=v(rt),st^=1),new N(ht,He,st)}return{seed:ge,k2sig:je}}const ee={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function re(G,ie,ae=ee){const{seed:q,k2sig:W}=se(G,ie,ae),ne=e;return mRe(ne.hash.outputLen,ne.nByteLength,ne.hmac)(q,W)}u.BASE._setWindowSize(8);function de(G,ie,ae,q=K){var Je;const W=G;if(ie=Yp("msgHash",ie),ae=Yp("publicKey",ae),"strict"in q)throw new Error("options.strict was renamed to lowS");const{lowS:ne,prehash:oe}=q;let he,_e;try{if(typeof W=="string"||o5(W))try{he=N.fromDER(W)}catch(ht){if(!(ht instanceof xw.Err))throw ht;he=N.fromCompact(W)}else if(typeof W=="object"&&typeof W.r=="bigint"&&typeof W.s=="bigint"){const{r:ht,s:rt}=W;he=new N(ht,rt)}else throw new Error("PARSE");_e=u.fromHex(ae)}catch(ht){if(ht.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ne&&he.hasHighS())return!1;oe&&(ie=e.hash(ie));const{r:xe,s:Se}=he,ge=L(ie),Ce=c(Se),je=l(ge*Ce),Oe=l(xe*Ce),$e=(Je=u.BASE.multiplyAndAddUnsafe(_e,je,Oe))==null?void 0:Je.toAffine();return $e?l($e.x)===xe:!1}return{CURVE:e,getPublicKey:P,getSharedSecret:F,sign:re,verify:de,ProjectivePoint:u,Signature:N,utils:I}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function gEt(t){return{hash:t,hmac:(e,...n)=>Wle(t,e,YR(...n)),randomBytes:pMe}}function bEt(t,e){const n=r=>xEt({...t,...gEt(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vRe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),rbe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yEt=BigInt(1),Gte=BigInt(2),sbe=(t,e)=>(t+e/Gte)/e;function vEt(t){const e=vRe,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,Gte,e)*u%e,y=kh(g,s,e)*g%e,v=kh(y,a,e)*y%e,C=kh(v,l,e)*v%e,N=kh(C,c,e)*C%e,I=kh(N,l,e)*v%e,P=kh(I,n,e)*d%e,M=kh(P,o,e)*y%e,F=kh(M,r,e)*u%e,$=kh(F,Gte,e);if(!Kte.eql(Kte.sqr($),t))throw new Error("Cannot find square root");return $}const Kte=oEt(vRe,void 0,void 0,{sqrt:vEt}),Qle=bEt({a:BigInt(0),b:BigInt(7),Fp:Kte,n:rbe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=rbe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-yEt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=sbe(a*t,e),c=sbe(-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}}}},fU);BigInt(0);Qle.ProjectivePoint;const wEt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Qle},Symbol.toStringTag,{value:"Module"}));var SW;const D1=(SW=Qle)!==null&&SW!==void 0?SW:wEt,ibe=BigInt("0xffffffffffffffff"),AE=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),CEt=D1.CURVE.n,SEt=CEt/BigInt(2),NEt={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 fL;(function(t){t[t.Mainnet=1]="Mainnet",t[t.Goerli=5]="Goerli",t[t.Sepolia=11155111]="Sepolia"})(fL||(fL={}));var co;(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"})(co||(co={}));var abe;(function(t){t.ProofOfStake="pos",t.ProofOfWork="pow",t.ProofOfAuthority="poa"})(abe||(abe={}));var obe;(function(t){t.Ethash="ethash",t.Clique="clique",t.Casper="casper"})(obe||(obe={}));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 wRe=t=>{if(typeof t!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof t}`);return Tle(t)?t.slice(2):t};function jEt(t){return!t||t==="0x0"?"0x0000000000000000":Tle(t)?`0x${wRe(t).padStart(16,"0")}`:`0x${t.padStart(16,"0")}`}const CRe=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Received an invalid integer type: ${t}`);return`0x${t.toString(16)}`};function AEt(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"),Tle(x)||(x=CRe(parseInt(x))),g.length!==18&&(g=jEt(g)),a.eip155Block!==a.eip158Block)throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork");const C={name:s,chainId:v,networkId:v,genesis:{timestamp:x,gasLimit:parseInt(c),difficulty:parseInt(o),nonce:g,extraData:f,mixHash:l,coinbase:u,baseFeePerGas:d},hardfork:void 0,hardforks:[],bootstrapNodes:[],consensus:a.clique!==void 0?{type:"poa",algorithm:"clique",clique:{period:(n=a.clique.period)!==null&&n!==void 0?n:a.clique.blockperiodseconds,epoch:(r=a.clique.epoch)!==null&&r!==void 0?r:a.clique.epochlength}}:{type:"pow",algorithm:"ethash",ethash:{}}},N={[co.Homestead]:{name:"homesteadBlock"},[co.Dao]:{name:"daoForkBlock"},[co.TangerineWhistle]:{name:"eip150Block"},[co.SpuriousDragon]:{name:"eip155Block"},[co.Byzantium]:{name:"byzantiumBlock"},[co.Constantinople]:{name:"constantinopleBlock"},[co.Petersburg]:{name:"petersburgBlock"},[co.Istanbul]:{name:"istanbulBlock"},[co.MuirGlacier]:{name:"muirGlacierBlock"},[co.Berlin]:{name:"berlinBlock"},[co.London]:{name:"londonBlock"},[co.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:e},[co.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[co.ShardingForkDev]:{name:"shardingForkTime",postMerge:!0,isTimestamp:!0}},I=Object.keys(N).reduce((F,$)=>(F[N[$].name]=$,F),{}),P=Object.keys(a).filter(F=>I[F]!==void 0&&a[F]!==void 0&&a[F]!==null);if(C.hardforks=P.map(F=>({name:I[F],block:N[I[F]].isTimestamp===!0||typeof a[F]!="number"?null:a[F],timestamp:N[I[F]].isTimestamp===!0&&typeof a[F]=="number"?a[F]:void 0})).filter(F=>F.block!==null||F.timestamp!==void 0),C.hardforks.sort((F,$)=>{var L,z;return((L=F.block)!==null&&L!==void 0?L:1/0)-((z=$.block)!==null&&z!==void 0?z:1/0)}),C.hardforks.sort((F,$)=>{var L,z;return((L=F.timestamp)!==null&&L!==void 0?L:y)-((z=$.timestamp)!==null&&z!==void 0?z:y)}),a.terminalTotalDifficulty!==void 0){const F={name:co.Merge,ttd:a.terminalTotalDifficulty,block:null},$=C.hardforks.findIndex(L=>{var z;return((z=N[L.name])===null||z===void 0?void 0:z.postMerge)===!0});$!==-1?C.hardforks.splice($,0,F):C.hardforks.push(F)}const M=C.hardforks.length>0?C.hardforks.slice(-1)[0]:void 0;return C.hardfork=M==null?void 0:M.name,C.hardforks.unshift({name:co.Chainstart,block:0}),C}function _Et(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),AEt(t,n)}catch(r){throw new Error(`Error parsing parameters file: ${r.message}`)}}function SRe(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 EEt=function(t){const e=CRe(t);return po(`0x${SRe(e.slice(2))}`)},Mo=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(!PMe(t))throw new Error(`Cannot convert string to Uint8Array. only supports 0x-prefixed hex strings and this string was given: ${t}`);return po(SRe(wRe(t)))}if(typeof t=="number")return Mo(oc(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}`),Mo(`0x${n}`)}if(t.toArray)return Uint8Array.from(t.toArray());throw new Error("invalid type")};function Qa(t){const e=Gi(t);return BigInt(e==="0x"?0:e)}function kEt(t){return Mo(`0x${t.toString(16)}`)}const NRe=function(t){return new Uint8Array(t).fill(0)},TEt=function(t,e,n){const r=NRe(e);return t.length<e?(r.set(t,e-t.length),r):t.subarray(-e)};function Zle(t){if(!E2(t)){const e=`This method only supports Uint8Array but input was: ${t}`;throw new Error(e)}}const lbe=function(t,e){return Zle(t),TEt(t,e)};function IEt(t){let e=t[0];for(;t.length>0&&e.toString()==="0";)t=t.slice(1),e=t[0];return t}const hL=function(t){return Zle(t),IEt(t)},Ro=t=>`0x${t.toString(16)}`;function fa(t){return hL(kEt(t))}function PEt(t,e){return t===BigInt(0)||t===BigInt(1)?t:e===void 0?t-BigInt(27):t-(e*BigInt(2)+BigInt(35))}function FEt(t){return t===BigInt(0)||t===BigInt(1)}const Jle=function(t,e,n,r,s){const a=PEt(e,s);if(!FEt(a))throw new Error("Invalid signature v value");return new D1.Signature(Qa(n),Qa(r)).addRecoveryBit(Number(a)).recoverPublicKey(t).toRawBytes(!1).slice(1)};function dC(t,e){if(t===null)return null;if(t===void 0)return;if(typeof t=="string"&&!PMe(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=Mo(t);switch(e){case rp.Uint8Array:return n;case rp.BigInt:return Qa(n);case rp.Number:{const r=Qa(n);if(r>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(r)}case rp.PrefixedHexString:return Gi(n);default:throw new Error("unknown outputType")}}var Bp={},cbe;function OEt(){if(cbe)return Bp;cbe=1,Object.defineProperty(Bp,"__esModule",{value:!0}),Bp.RLP=Bp.utils=Bp.decode=Bp.encode=void 0;function t(N){if(Array.isArray(N)){const P=[];let M=0;for(let F=0;F<N.length;F++){const $=t(N[F]);P.push($),M+=$.length}return d(r(M,192),...P)}const I=C(N);return I.length===1&&I[0]<128?I:d(r(I.length,128),I)}Bp.encode=t;function e(N,I,P){if(P>N.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return N.slice(I,P)}function n(N){if(N[0]===0)throw new Error("invalid RLP: extra zeros");return c(l(N))}function r(N,I){if(N<56)return Uint8Array.from([N+I]);const P=x(N),M=P.length/2,F=x(I+55+M);return Uint8Array.from(u(F+P))}function s(N,I=!1){if(typeof N>"u"||N===null||N.length===0)return Uint8Array.from([]);const P=C(N),M=a(P);if(I)return M;if(M.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return M.data}Bp.decode=s;function a(N){let I,P,M,F,$;const L=[],z=N[0];if(z<=127)return{data:N.slice(0,1),remainder:N.slice(1)};if(z<=183){if(I=z-127,z===128?M=Uint8Array.from([]):M=e(N,1,I),I===2&&M[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:M,remainder:N.slice(I)}}else if(z<=191){if(P=z-182,N.length-1<P)throw new Error("invalid RLP: not enough bytes for string length");if(I=n(e(N,1,P)),I<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return M=e(N,P,I+P),{data:M,remainder:N.slice(I+P)}}else if(z<=247){for(I=z-191,F=e(N,1,I);F.length;)$=a(F),L.push($.data),F=$.remainder;return{data:L,remainder:N.slice(I)}}else{if(P=z-246,I=n(e(N,1,P)),I<56)throw new Error("invalid RLP: encoded list too short");const Q=P+I;if(Q>N.length)throw new Error("invalid RLP: total length is larger than the data");for(F=e(N,P,Q);F.length;)$=a(F),L.push($.data),F=$.remainder;return{data:L,remainder:N.slice(Q)}}}const o=Array.from({length:256},(N,I)=>I.toString(16).padStart(2,"0"));function l(N){let I="";for(let P=0;P<N.length;P++)I+=o[N[P]];return I}function c(N){const I=Number.parseInt(N,16);if(Number.isNaN(I))throw new Error("Invalid byte sequence");return I}function u(N){if(typeof N!="string")throw new TypeError("hexToBytes: expected string, got "+typeof N);if(N.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const I=new Uint8Array(N.length/2);for(let P=0;P<I.length;P++){const M=P*2;I[P]=c(N.slice(M,M+2))}return I}function d(...N){if(N.length===1)return N[0];const I=N.reduce((M,F)=>M+F.length,0),P=new Uint8Array(I);for(let M=0,F=0;M<N.length;M++){const $=N[M];P.set($,F),F+=$.length}return P}function f(N){return new TextEncoder().encode(N)}function x(N){if(N<0)throw new Error("Invalid integer as argument, must be unsigned!");const I=N.toString(16);return I.length%2?`0${I}`:I}function g(N){return N.length%2?`0${N}`:N}function y(N){return N.length>=2&&N[0]==="0"&&N[1]==="x"}function v(N){return typeof N!="string"?N:y(N)?N.slice(2):N}function C(N){if(N instanceof Uint8Array)return N;if(typeof N=="string")return y(N)?u(g(v(N))):f(N);if(typeof N=="number"||typeof N=="bigint")return N?u(x(N)):Uint8Array.from([]);if(N==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof N)}return Bp.utils={bytesToHex:l,concatBytes:d,hexToBytes:u,utf8ToBytes:f},Bp.RLP={encode:t,decode:s},Bp}var sp=OEt(),NW={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var ube;function MEt(){return ube||(ube=1,function(t){(function(e){e(typeof DO_NOT_EXPORT_CRC>"u"?t:{})})(function(e){e.version="1.2.2";function n(){for(var z=0,Q=new Array(256),se=0;se!=256;++se)z=se,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,Q[se]=z;return typeof Int32Array<"u"?new Int32Array(Q):Q}var r=n();function s(z){var Q=0,se=0,ee=0,K=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(ee=0;ee!=256;++ee)K[ee]=z[ee];for(ee=0;ee!=256;++ee)for(se=z[ee],Q=256+ee;Q<4096;Q+=256)se=K[Q]=se>>>8^z[se&255];var re=[];for(ee=1;ee!=16;++ee)re[ee-1]=typeof Int32Array<"u"?K.subarray(ee*256,ee*256+256):K.slice(ee*256,ee*256+256);return re}var a=s(r),o=a[0],l=a[1],c=a[2],u=a[3],d=a[4],f=a[5],x=a[6],g=a[7],y=a[8],v=a[9],C=a[10],N=a[11],I=a[12],P=a[13],M=a[14];function F(z,Q){for(var se=Q^-1,ee=0,K=z.length;ee<K;)se=se>>>8^r[(se^z.charCodeAt(ee++))&255];return~se}function $(z,Q){for(var se=Q^-1,ee=z.length-15,K=0;K<ee;)se=M[z[K++]^se&255]^P[z[K++]^se>>8&255]^I[z[K++]^se>>16&255]^N[z[K++]^se>>>24]^C[z[K++]]^v[z[K++]]^y[z[K++]]^g[z[K++]]^x[z[K++]]^f[z[K++]]^d[z[K++]]^u[z[K++]]^c[z[K++]]^l[z[K++]]^o[z[K++]]^r[z[K++]];for(ee+=15;K<ee;)se=se>>>8^r[(se^z[K++])&255];return~se}function L(z,Q){for(var se=Q^-1,ee=0,K=z.length,re=0,de=0;ee<K;)re=z.charCodeAt(ee++),re<128?se=se>>>8^r[(se^re)&255]:re<2048?(se=se>>>8^r[(se^(192|re>>6&31))&255],se=se>>>8^r[(se^(128|re&63))&255]):re>=55296&&re<57344?(re=(re&1023)+64,de=z.charCodeAt(ee++)&1023,se=se>>>8^r[(se^(240|re>>8&7))&255],se=se>>>8^r[(se^(128|re>>2&63))&255],se=se>>>8^r[(se^(128|de>>6&15|(re&3)<<4))&255],se=se>>>8^r[(se^(128|de&63))&255]):(se=se>>>8^r[(se^(224|re>>12&15))&255],se=se>>>8^r[(se^(128|re>>6&63))&255],se=se>>>8^r[(se^(128|re&63))&255]);return~se}e.table=r,e.bstr=F,e.buf=$,e.str=L})}(NW)),NW}var REt=MEt();const LEt=Ti(REt),DEt={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"]},BEt={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"]},$Et={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"]},UEt={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:{}},zEt={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:{}},HEt={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:{}},VEt={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:{}},WEt={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:{}},qEt={name:"EIP-2718",comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{},vm:{},pow:{}},GEt={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:{}},KEt={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:{}},YEt={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:{}},XEt={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:{}},QEt={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:{}},ZEt={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:{}},JEt={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"}}},ekt={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:{}},tkt={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:{}},nkt={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:{}},rkt={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:{}},ikt={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"}}},okt={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:{}},lkt={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"}}},fC={1153:UEt,1559:zEt,2315:HEt,2537:VEt,2565:WEt,2718:qEt,2929:GEt,2930:KEt,3198:YEt,3529:XEt,3540:QEt,3541:ZEt,3554:JEt,3607:ekt,3651:tkt,3670:nkt,3675:rkt,3855:skt,3860:ikt,4345:akt,4399:okt,5133:lkt},ckt={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"}}},ukt={name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{}},dkt={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:{}},fkt={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:{}},hkt={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:{}},pkt={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"}}},xkt={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:{}},gkt={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:{}},bkt={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"}}},ykt={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]},vkt={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]},wkt={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]},Ckt={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:{}},Skt={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:{}},Nkt={name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Draft",eips:[]},jkt={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]},Akt={chainstart:ckt,homestead:dkt,dao:ukt,tangerineWhistle:fkt,spuriousDragon:hkt,byzantium:pkt,constantinople:mkt,petersburg:xkt,istanbul:gkt,muirGlacier:bkt,berlin:ykt,london:vkt,shanghai:wkt,arrowGlacier:Ckt,grayGlacier:Skt,mergeForkIdTransition:Nkt,merge:jkt},{buf:_kt}=LEt;class sc extends Mle{static custom(e,n={}){var r;const s=(r=n.baseChain)!==null&&r!==void 0?r:"mainnet",a=Object.assign({},sc._getChainParams(s));if(a.name="custom-chain",typeof e!="string")return new sc(Object.assign({chain:Object.assign(Object.assign({},a),e)},n));if(e===wu.PolygonMainnet)return sc.custom({name:wu.PolygonMainnet,chainId:137,networkId:137},n);if(e===wu.PolygonMumbai)return sc.custom({name:wu.PolygonMumbai,chainId:80001,networkId:80001},n);if(e===wu.ArbitrumRinkebyTestnet)return sc.custom({name:wu.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},n);if(e===wu.ArbitrumOne)return sc.custom({name:wu.ArbitrumOne,chainId:42161,networkId:42161},n);if(e===wu.xDaiChain)return sc.custom({name:wu.xDaiChain,chainId:100,networkId:100},n);if(e===wu.OptimisticKovan)return sc.custom({name:wu.OptimisticKovan,chainId:69,networkId:69},Object.assign({hardfork:co.Berlin},n));if(e===wu.OptimisticEthereum)return sc.custom({name:wu.OptimisticEthereum,chainId:10,networkId:10},Object.assign({hardfork:co.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=_Et(e,n,o),u=new sc({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:co.Merge,this.HARDFORK_CHANGES=this.hardforks().map(s=>[s.name,Akt[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=sc._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=dC(e,rp.BigInt),a=dC(n,rp.BigInt),o=dC(r,rp.Number),l=this.hardforks().filter(g=>g.block!==null||g.ttd!==null&&g.ttd!==void 0||g.timestamp!==void 0),c=l.findIndex(g=>g.ttd!==null&&g.ttd!==void 0);if(l.slice(c+1).findIndex(g=>g.ttd!==null&&g.ttd!==void 0)>=0)throw Error("More than one merge hardforks found with ttd specified");let d=l.findIndex(g=>g.block!==null&&g.block>s||o!==void 0&&Number(g.timestamp)>o);if(d===-1)d=l.length;else if(d===0)throw Error("Must have at least one hardfork at block 0");if(o===void 0){const g=l.slice(0,d).reverse().findIndex(y=>y.block!==null||y.ttd!==void 0);d-=g}if(d-=1,l[d].block===null&&l[d].timestamp===void 0)(a==null||BigInt(l[d].ttd)>a)&&(d-=1);else if(c>=0&&a!==void 0&&a!==null){if(d>=c&&BigInt(l[c].ttd)>a)throw Error("Maximum HF determined by total difficulty is lower than the block number HF");if(d<c&&BigInt(l[c].ttd)<=a)throw Error("HF determined by block number is lower than the minimum total difficulty HF")}const f=d;for(;d<l.length-1&&!(l[d].block!==l[d+1].block||l[d].timestamp!==l[d+1].timestamp);d+=1);if(o){if(l.slice(0,f).reduce((v,C)=>{var N;return Math.max(Number((N=C.timestamp)!==null&&N!==void 0?N:"0"),v)},0)>o)throw Error("Maximum HF determined by timestamp is lower than the block number/ttd HF");if(l.slice(d+1).reduce((v,C)=>{var N;return Math.min(Number((N=C.timestamp)!==null&&N!==void 0?N:o),v)},o)<o)throw Error("Maximum HF determined by block number/ttd is lower than timestamp HF")}return l[d].name}setHardforkByBlockNumber(e,n,r){const s=this.getHardforkByBlockNumber(e,n,r);return this.setHardfork(s),s}_getHardfork(e){const n=this.hardforks();for(const r of n)if(r.name===e)return r;return null}setEIPs(e=[]){for(const n of e){if(!(n in fC))throw new Error(`${n} not supported`);const r=this.gteHardfork(fC[n].minimumHardfork);if(!r)throw new Error(`${n} cannot be activated on hardfork ${this.hardfork()}, minimumHardfork: ${r}`);if(fC[n].requiredEIPs!==void 0){for(const s of fC[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 fC))throw new Error(`${r} not supported`);const s=fC[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=dC(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=dC(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===co.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!==co.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===co.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=dC(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!==co.Merge){const x=po(f.toString(16).padStart(16,"0"));r=Ad(r,x),s=f}if(l.name===e)break}const a=Ad(n,r);return Gi(EEt(_kt(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(fL))n[a]=s.toLowerCase();const r={mainnet:BEt,goerli:DEt,sepolia:$Et};if(e)for(const s of e){const{name:a}=s;n[s.chainId.toString()]=a,r[a]=s}return r.names=n,r}}var F0;(function(t){t[t.EIP155ReplayProtection=155]="EIP155ReplayProtection",t[t.EIP1559FeeMarket=1559]="EIP1559FeeMarket",t[t.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",t[t.EIP2930AccessLists=2930]="EIP2930AccessLists"})(F0||(F0={}));function Ekt(t){if(t.length===0)return!0;const e=t[0];return!!Array.isArray(e)}function kkt(t){return!Ekt(t)}class F4{constructor(e){if(e.length!==20)throw new Error("Invalid address length");this.buf=e}static zero(){return new F4(NRe(20))}equals(e){return sU(this.buf,e.buf)}isZero(){return this.equals(F4.zero())}toString(){return Gi(this.buf)}toArray(){return this.buf}static publicToAddress(e,n=!1){let r=e;if(Zle(r),n&&r.length!==64&&(r=D1.ProjectivePoint.fromHex(r).toRawBytes(!1).slice(1)),r.length!==64)throw new Error("Expected pubKey to be of length 64");return pd(r).slice(-20)}}const Tkt=(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")}`)},jRe=t=>{let e,n;if(kkt(t)){e=t;const r=[];for(let s=0;s<t.length;s+=1){const a=t[s],o=Mo(a.address),l=[];for(let c=0;c<a.storageKeys.length;c+=1)l.push(Mo(a.storageKeys[c]));r.push([o,l])}n=r}else{n=t??[];const r=[];for(let s=0;s<n.length;s+=1){const a=n[s],o=Gi(a[0]),l=[];for(let u=0;u<a[1].length;u+=1)l.push(Gi(a[1][u]));const c={address:o,storageKeys:l};r.push(c)}e=r}return{AccessListJSON:e,accessList:n}},ARe=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")}},_Re=t=>{const e=[];for(let n=0;n<t.length;n+=1){const r=t[n],s={address:Gi(lbe(r[0],20)),storageKeys:[]},a=r&&r[1];for(let o=0;o<a.length;o+=1){const l=a[o];s.storageKeys.push(Gi(lbe(l,32)))}e.push(s)}return e},ERe=(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 MN{constructor(e,n){var r,s;this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=fL.Mainnet,this.DEFAULT_HARDFORK=co.Merge;const{nonce:a,gasLimit:o,to:l,value:c,data:u,v:d,r:f,s:x,type:g}=e;this._type=Number(Qa(Mo(g))),this.txOptions=n;const y=Mo(l===""?"0x":l),v=Mo(d===""?"0x":d),C=Mo(f===""?"0x":f),N=Mo(x===""?"0x":x);this.nonce=Qa(Mo(a===""?"0x":a)),this.gasLimit=Qa(Mo(o===""?"0x":o)),this.to=y.length>0?new F4(y):void 0,this.value=Qa(Mo(c===""?"0x":c)),this.data=Mo(u===""?"0x":u),this.v=v.length>0?Qa(v):void 0,this.r=C.length>0?Qa(C):void 0,this.s=N.length>0?Qa(N):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0);const I=this.to===void 0||this.to===null,P=(r=n.allowUnlimitedInitCodeSize)!==null&&r!==void 0?r:!1,M=(s=n.common)!==null&&s!==void 0?s:this._getCommon();I&&M.isActivatedEIP(3860)&&!P&&Tkt(M,this.data.length)}get type(){return this._type}supports(e){return this.activeCapabilities.includes(e)}validate(e=!1){const n=[];return this.getBaseFee()>this.gasLimit&&n.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`),this.isSigned()&&!this.verifySignature()&&n.push("Invalid Signature"),e?n:n.length===0}_validateYParity(){const{v:e}=this;if(e!==void 0&&e!==BigInt(0)&&e!==BigInt(1)){const n=this._errorMsg("The y-parity of the transaction should either be 0 or 1");throw new Error(n)}}_validateHighS(){const{s:e}=this;if(this.common.gteHardfork("homestead")&&e!==void 0&&e>SEt){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 hL(e).length!==0}catch{return!1}}getSenderAddress(){return new F4(F4.publicToAddress(this.getSenderPublicKey()))}sign(e){if(e.length!==32){const c=this._errorMsg("Private key must be 32 bytes in length.");throw new Error(c)}let n=!1;this.type===0&&this.common.gteHardfork("spuriousDragon")&&!this.supports(F0.EIP155ReplayProtection)&&(this.activeCapabilities.push(F0.EIP155ReplayProtection),n=!0);const r=this.getMessageToSign(!0),{v:s,r:a,s:o}=this._ecsign(r,e),l=this._processSignature(s,a,o);if(n){const c=this.activeCapabilities.indexOf(F0.EIP155ReplayProtection);c>-1&&this.activeCapabilities.splice(c,1)}return l}_getCommon(e,n){var r,s,a,o;if(n!==void 0){const l=Qa(Mo(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 sc.isSupportedChainId(l)?new sc({chain:l,hardfork:this.DEFAULT_HARDFORK}):sc.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 sc.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 sc({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>=ibe){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>ibe){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>=AE){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>AE){const o=this._errorMsg(`${s} cannot exceed MAX_INTEGER (2^256-1), given ${a}`);throw new Error(o)}break;default:{const o=this._errorMsg("unimplemented bits value");throw new Error(o)}}}static _validateNotArray(e){const n=["nonce","gasPrice","gasLimit","to","value","data","v","r","s","type","baseFee","maxFeePerGas","chainId"];for(const[r,s]of Object.entries(e))if(n.includes(r)&&Array.isArray(s))throw new Error(`${r} cannot be an array`)}_getSharedErrorPostfix(){let e="";try{e=this.isSigned()?Gi(this.hash()):"not available (unsigned)"}catch{e="error"}let n="";try{n=this.isSigned().toString()}catch{e="error"}let r="";try{r=this.common.hardfork()}catch{r="error"}let s=`tx type=${this.type} hash=${e} nonce=${this.nonce} value=${this.value} `;return s+=`signed=${n} hf=${r}`,s}_ecsign(e,n,r){const s=D1.sign(e,n),a=s.toCompactRawBytes(),o=a.subarray(0,32),l=a.subarray(32,64),c=r===void 0?BigInt(s.recovery+27):BigInt(s.recovery+35)+BigInt(r)*BigInt(2);return{r:o,s:l,v:c}}static fromSerializedTx(e,n={}){}static fromTxData(e,n={}){}}const Yte=2,jW=po(Yte.toString(16).padStart(2,"0"));class gw extends MN{static fromTxData(e,n={}){return new gw(e,n)}static fromSerializedTx(e,n={}){if(!sU(e.subarray(0,1),jW))throw new Error(`Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ${Yte}, received: ${Gi(e.subarray(0,1))}`);const r=sp.RLP.decode(e.subarray(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return gw.fromValuesArray(r,n)}static fromValuesArray(e,n={}){if(e.length!==9&&e.length!==12)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");const[r,s,a,o,l,c,u,d,f,x,g,y]=e;return this._validateNotArray({chainId:r,v:x}),Ile({nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,value:u,v:x,r:g,s:y}),new gw({chainId:Qa(r),nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,to:c,value:u,data:d,accessList:f??[],v:x!==void 0?Qa(x):void 0,r:g,s:y},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:Yte}),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=jRe(a??[]);if(this.accessList=c.accessList,this.AccessListJSON=c.AccessListJSON,ARe(this.accessList),this.maxFeePerGas=Qa(Mo(o===""?"0x":o)),this.maxPriorityFeePerGas=Qa(Mo(l===""?"0x":l)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),MN._validateNotArray(e),this.gasLimit*this.maxFeePerGas>AE){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(ERe(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[fa(this.chainId),fa(this.nonce),fa(this.maxPriorityFeePerGas),fa(this.maxFeePerGas),fa(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),fa(this.value),this.data,this.accessList,this.v!==void 0?fa(this.v):Uint8Array.from([]),this.r!==void 0?fa(this.r):Uint8Array.from([]),this.s!==void 0?fa(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(jW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,9),r=Ad(jW,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 Jle(e,n+BigInt(27),fa(r),fa(s))}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){const s=Object.assign(Object.assign({},this.txOptions),{common:this.common});return gw.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:e-BigInt(27),r:Qa(n),s:Qa(r)},s)}toJSON(){const e=_Re(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:Gi(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 Xte=1,AW=po(Xte.toString(16).padStart(2,"0"));class bw extends MN{static fromTxData(e,n={}){return new bw(e,n)}static fromSerializedTx(e,n={}){if(!sU(e.subarray(0,1),AW))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${Xte}, received: ${Gi(e.subarray(0,1))}`);const r=sp.RLP.decode(Uint8Array.from(e.subarray(1)));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return bw.fromValuesArray(r,n)}static fromValuesArray(e,n={}){if(e.length!==8&&e.length!==11)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");const[r,s,a,o,l,c,u,d,f,x,g]=e;this._validateNotArray({chainId:r,v:f}),Ile({nonce:s,gasPrice:a,gasLimit:o,value:c,v:f,r:x,s:g});const y=[];return new bw({chainId:Qa(r),nonce:s,gasPrice:a,gasLimit:o,to:l,value:c,data:u,accessList:d??y,v:f!==void 0?Qa(f):void 0,r:x,s:g},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:Xte}),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=jRe(a??[]);if(this.accessList=l.accessList,this.AccessListJSON=l.AccessListJSON,ARe(this.accessList),this.gasPrice=Qa(Mo(o===""?"0x":o)),this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),MN._validateNotArray(e),this.gasPrice*this.gasLimit>AE){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(ERe(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[fa(this.chainId),fa(this.nonce),fa(this.gasPrice),fa(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),fa(this.value),this.data,this.accessList,this.v!==void 0?fa(this.v):Uint8Array.from([]),this.r!==void 0?fa(this.r):Uint8Array.from([]),this.s!==void 0?fa(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(AW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,8),r=Ad(AW,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 Jle(e,n+BigInt(27),fa(r),fa(s))}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){const s=Object.assign(Object.assign({},this.txOptions),{common:this.common});return bw.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:e-BigInt(27),r:Qa(n),s:Qa(r)},s)}toJSON(){const e=_Re(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:Gi(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 Ikt=0;function dbe(t,e){const n=Number(t),r=Number(e)*2;return n===r+35||n===r+36}class Ey extends MN{static fromTxData(e,n={}){return new Ey(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 Ile({nonce:r,gasPrice:s,gasLimit:a,value:l,v:u,r:d,s:f}),new Ey({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:Ikt}),n),this.common=this._validateTxV(this.v,n.common),this.gasPrice=Qa(Mo(e.gasPrice===""?"0x":e.gasPrice)),this.gasPrice*this.gasLimit>AE){const a=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(a)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),MN._validateNotArray(e),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?dbe(this.v,this.common.chainId())&&this.activeCapabilities.push(F0.EIP155ReplayProtection):this.activeCapabilities.push(F0.EIP155ReplayProtection)),((r=n==null?void 0:n.freeze)!==null&&r!==void 0?r:!0)&&Object.freeze(this)}raw(){return[fa(this.nonce),fa(this.gasPrice),fa(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),fa(this.value),this.data,this.v!==void 0?fa(this.v):Uint8Array.from([]),this.r!==void 0?fa(this.r):Uint8Array.from([]),this.s!==void 0?fa(this.s):Uint8Array.from([])]}serialize(){return sp.RLP.encode(this.raw())}_getMessageToSign(){const e=[fa(this.nonce),fa(this.gasPrice),fa(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),fa(this.value),this.data];return this.supports(F0.EIP155ReplayProtection)&&(e.push(Mo(this.common.chainId())),e.push(hL(Mo(0))),e.push(hL(Mo(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 Jle(e,n,fa(r),fa(s),this.supports(F0.EIP155ReplayProtection)?this.common.chainId():void 0)}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){let s=e;this.supports(F0.EIP155ReplayProtection)&&(s+=this.common.chainId()*BigInt(2)+BigInt(8));const a=Object.assign(Object.assign({},this.txOptions),{common:this.common});return Ey.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:s,r:Qa(n),s:Qa(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:Gi(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(!dbe(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 _W=new Map;class l5{constructor(){}static typeToInt(e){return Number(Qa(Mo(e)))}static registerTransactionType(e,n){const r=l5.typeToInt(e);_W.set(r,n)}static fromTxData(e,n={}){if(!("type"in e)||e.type===void 0)return Ey.fromTxData(e,n);const r=l5.typeToInt(e.type);if(r===0)return Ey.fromTxData(e,n);if(r===1)return bw.fromTxData(e,n);if(r===2)return gw.fromTxData(e,n);const s=_W.get(r);if(s!=null&&s.fromTxData)return s.fromTxData(e,n);throw new Error(`Tx instantiation with type ${r} not supported`)}static fromSerializedData(e,n={}){if(e[0]<=127)switch(e[0]){case 1:return bw.fromSerializedTx(e,n);case 2:return gw.fromSerializedTx(e,n);default:{const r=_W.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 Ey.fromSerializedTx(e,n)}static fromBlockBodyData(e,n={}){if(E2(e))return this.fromSerializedData(e,n);if(Array.isArray(e))return Ey.fromValuesArray(e,n);throw new Error("Cannot decode transaction: unknown type input")}}var pU=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 h8=(t,e)=>{let n;if(!e&&typeof t=="string"&&Ea(t)&&t.length!==66)throw new N1e;try{n=E2(t)?t:hx(t)}catch{throw new tAt}if(!e&&n.byteLength!==32)throw new N1e;return n},ece=(t,e=!1)=>{const n=Ea(t)?t:km(t),r=po(n),s=po(DMe(`Ethereum Signed Message:
${r.byteLength}`)),a=e?r:Ad(s,r);return ah(a)},Pkt=(t,e)=>{const n=h8(e),r=D1.sign(t.substring(2),n),s=r.toCompactRawBytes(),a=r.r.toString(16).padStart(64,"0"),o=r.s.toString(16).padStart(64,"0"),l=r.recovery+27;return{messageHash:t,v:oc(l),r:`0x${a}`,s:`0x${o}`,signature:`${Gi(s)}${l.toString(16)}`}},kRe=(t,e)=>{const n=ece(t),{messageHash:r,v:s,r:a,s:o,signature:l}=Pkt(n,e);return{message:t,messageHash:r,v:s,r:a,s:o,signature:l}},Fkt=(t,e)=>pU(void 0,void 0,void 0,function*(){const n=t.sign(po(e));if(gr(n.v)||gr(n.r)||gr(n.s))throw new Rte("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 Rte(o)}const s=Gi(n.serialize()),a=ah(s);return{messageHash:Gi(n.getMessageToSign(!0)),v:`0x${n.v.toString(16)}`,r:`0x${n.r.toString(16).padStart(64,"0")}`,s:`0x${n.s.toString(16).padStart(64,"0")}`,rawTransaction:s,transactionHash:Gi(a)}}),Okt=t=>{if(gr(t))throw new bAt;const e=l5.fromSerializedData(po(t));return wx(e.getSenderAddress().toString())},Qte=(t,e,n,r,s)=>{if(typeof t=="object"){const f=`${t.r}${t.s.slice(2)}${t.v.slice(2)}`;return Qte(t.messageHash,f,n)}if(typeof e=="string"&&typeof n=="string"&&!gr(r)){const f=`${n}${r.slice(2)}${e.slice(2)}`;return Qte(t,f,s)}if(gr(e))throw new nAt("signature string undefined");const a=130,o=n?t:ece(t);let l=parseInt(e.substring(a),16);l>26&&(l-=27);const c=D1.Signature.fromCompact(e.slice(2,a)).addRecoveryBit(l).recoverPublicKey(o.replace("0x","")).toRawBytes(!1),u=ah(c.subarray(1));return wx(`0x${u.slice(-40)}`)},mU=t=>{const e=h8(t),n=D1.getPublicKey(e,!1),s=ah(n.slice(1)).slice(-40);return wx(`0x${s}`)},Mkt=(t,e)=>{const n=h8(t);return`0x${Gi(D1.getPublicKey(n,e)).slice(4)}`},TRe=(t,e,n)=>pU(void 0,void 0,void 0,function*(){var r,s,a,o,l,c,u;const d=h8(t);let f;if(n!=null&&n.salt?f=typeof n.salt=="string"?po(n.salt):n.salt:f=SE(32),!(kle(e)||E2(e)))throw new iAt;const x=typeof e=="string"?po(km(e)):e;let g;if(n!=null&&n.iv){if(g=typeof n.iv=="string"?po(n.iv):n.iv,g.length!==16)throw new aAt}else g=SE(16);const y=(r=n==null?void 0:n.kdf)!==null&&r!==void 0?r:"scrypt";let v,C;if(y==="pbkdf2"){if(C={dklen:(s=n==null?void 0:n.dklen)!==null&&s!==void 0?s:32,salt:Gi(f).replace("0x",""),c:(a=n==null?void 0:n.c)!==null&&a!==void 0?a:262144,prf:"hmac-sha256"},C.c<1e3)throw new oAt;v=dRe(x,f,C.c,C.dklen,"sha256")}else if(y==="scrypt")C={n:(o=n==null?void 0:n.n)!==null&&o!==void 0?o:8192,r:(l=n==null?void 0:n.r)!==null&&l!==void 0?l:8,p:(c=n==null?void 0:n.p)!==null&&c!==void 0?c:1,dklen:(u=n==null?void 0:n.dklen)!==null&&u!==void 0?u:32,salt:Gi(f).replace("0x","")},v=fRe(x,f,C.n,C.p,C.r,C.dklen);else throw new ZOe;const N=yield Vle(d,v.slice(0,16),g,"aes-128-ctr"),I=Gi(N).slice(2),P=ah(Ad(v.slice(16,32),N)).replace("0x","");return{version:3,id:Ble(),address:mU(d).toLowerCase().replace("0x",""),crypto:{ciphertext:I,cipherparams:{iv:Gi(g).replace("0x","")},cipher:"aes-128-ctr",kdf:y,kdfparams:C,mac:P}}}),tce=(t,e)=>{const n=h8(t,e);return{address:mU(n),privateKey:Gi(n),signTransaction:r=>{throw new Rte("Do not have network access to sign the transaction")},sign:r=>kRe(typeof r=="string"?r:JSON.stringify(r),n),encrypt:(r,s)=>pU(void 0,void 0,void 0,function*(){return TRe(n,r,s)})}},Rkt=()=>{const t=D1.utils.randomPrivateKey();return tce(`${Gi(t)}`)},Lkt=(t,e,n)=>pU(void 0,void 0,void 0,function*(){const r=typeof t=="object"?t:JSON.parse(n?t.toLowerCase():t);if(Xs.validateJSONSchema(NEt,r),r.version!==3)throw new sAt;const s=typeof e=="string"?po(km(e)):e;Xs.validate(["bytes"],[s]);let a;if(r.crypto.kdf==="scrypt"){const u=r.crypto.kdfparams,d=typeof u.salt=="string"?po(u.salt):u.salt;a=fRe(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"?po(u.salt):u.salt;a=dRe(s,d,u.c,u.dklen,"sha256")}else throw new ZOe;const o=po(r.crypto.ciphertext);if(ah(Ad(a.slice(16,32),o)).replace("0x","")!==r.crypto.mac)throw new rAt;const c=yield I_t(po(r.crypto.ciphertext),a.slice(0,16),po(r.crypto.cipherparams.iv));return tce(c)});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())})};const Dkt=1e3;class Bkt{constructor(e){this._requestManager=e,this._requests=new Map}get requests(){return[...this._requests.values()].map(e=>e.payload)}add(e){const n=i5(e),r=new lL;return this._requests.set(n.id,{payload:n,promise:r}),r}execute(e){return fbe(this,void 0,void 0,function*(){var n;if(this.requests.length===0)return Promise.resolve([]);const r=new lL({timeout:(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Dkt,eagerStart:!0,timeoutMessage:"Batch request timeout"});return this._processBatchRequest(r).catch(s=>r.reject(s)),r.catch(s=>{s instanceof JOe&&this._abortAllRequests("Batch request timeout"),r.reject(s)}),r})}_processBatchRequest(e){return fbe(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 P0(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 P0(s,`Batch request mismatch the results. Requests: [${a.join()}], Responses: [${o.join()}]`);for(const l of s)$y(l)?(n=this._requests.get(l.id))===null||n===void 0||n.promise.resolve(l.result):Uy(l)&&((r=this._requests.get(l.id))===null||r===void 0||r.promise.reject(l.error));e.resolve(s)})}_abortAllRequests(e){for(const{promise:n}of this._requests.values())n.reject(new pAt(e))}}var $kt=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 S_t{constructor(e){var n;if(super(),this.providers=v3.providers,ai(e)||typeof e=="string"&&e.trim()!==""||cL(e)){this._requestManager=new v3(e),this._subscriptionManager=new uL(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 v3(s,(n=r==null?void 0:r.enableExperimentalFeatures)===null||n===void 0?void 0:n.useSubscriptionWhenCheckingBlockTimeout,d),o?this._subscriptionManager=o:this._subscriptionManager=new uL(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(a5.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(a5.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 Bkt.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)=>$kt(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=v3.providers;class Bl{constructor(e){if(this.toAddress=()=>{if(this.isDirect()){const n=this._iban.slice(4),r=Bl._parseInt(n,36),s=wE(r,40);return wx(s)}throw new Error("Iban is indirect and cannot be converted. Must be length of 34 or 35")},Bl.isIndirect(e)||Bl.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 Bl.isDirect(this._iban)}static isIndirect(e){return e.length===20}isIndirect(){return Bl.isIndirect(this._iban)}static isValid(e){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(e)&&Bl._mod9710(Bl._iso13616Prepare(e))===1}isValid(){return Bl.isValid(this._iban)}static fromBban(e){const n="XE",s=`0${(98-this._mod9710(this._iso13616Prepare(`${n}00${e}`))).toString()}`.slice(-2);return new Bl(`${n}${s}${e}`)}static createIndirect(e){return Bl.fromBban(`ETH${e.institution}${e.identifier}`)}static fromAddress(e){if(!ih(e))throw new Cle(e);const r=BigInt(UT(e)).toString(36),s=wE(r,15);return Bl.fromBban(s.toUpperCase())}static toIban(e){return Bl.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}}Bl._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("")};Bl._parseInt=(t,e)=>[...t].reduce((n,r)=>BigInt(parseInt(r,e))+BigInt(e)*n,BigInt(0));Bl._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};Bl.toAddress=t=>new Bl(t).toAddress();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())})},IRe;class PRe extends uU{constructor(e){super(),this[IRe]="Promise",this._promise=new Promise(e)}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)})}on(e,n){return super.on(e,n),this}once(e,n){return super.once(e,n),this}}IRe=Symbol.toStringTag;var kW={},hbe;function Ukt(){return hbe||(hbe=1,function(t,e){if(t.setImmediate)return;var n=1,r={},s=!1,a=t.document,o;function l(I){typeof I!="function"&&(I=new Function(""+I));for(var P=new Array(arguments.length-1),M=0;M<P.length;M++)P[M]=arguments[M+1];var F={callback:I,args:P};return r[n]=F,o(n),n++}function c(I){delete r[I]}function u(I){var P=I.callback,M=I.args;switch(M.length){case 0:P();break;case 1:P(M[0]);break;case 2:P(M[0],M[1]);break;case 3:P(M[0],M[1],M[2]);break;default:P.apply(e,M);break}}function d(I){if(s)setTimeout(d,0,I);else{var P=r[I];if(P){s=!0;try{u(P)}finally{c(I),s=!1}}}}function f(){o=function(I){process.nextTick(function(){d(I)})}}function x(){if(t.postMessage&&!t.importScripts){var I=!0,P=t.onmessage;return t.onmessage=function(){I=!1},t.postMessage("","*"),t.onmessage=P,I}}function g(){var I="setImmediate$"+Math.random()+"$",P=function(M){M.source===t&&typeof M.data=="string"&&M.data.indexOf(I)===0&&d(+M.data.slice(I.length))};t.addEventListener?t.addEventListener("message",P,!1):t.attachEvent("onmessage",P),o=function(M){t.postMessage(I+M,"*")}}function y(){var I=new MessageChannel;I.port1.onmessage=function(P){var M=P.data;d(M)},o=function(P){I.port2.postMessage(P)}}function v(){var I=a.documentElement;o=function(P){var M=a.createElement("script");M.onreadystatechange=function(){d(P),M.onreadystatechange=null,I.removeChild(M),M=null},I.appendChild(M)}}function C(){o=function(I){setTimeout(d,0,I)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf(t);N=N&&N.setTimeout?N:t,{}.toString.call(t.process)==="[object process]"?f():x()?g():t.MessageChannel?y():a&&"onreadystatechange"in a.createElement("script")?v():C(),N.setImmediate=l,N.clearImmediate=c}(typeof self>"u"?typeof Ru>"u"?kW:Ru:self)),kW}Ukt();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 zkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_protocolVersion",params:[]})})}function FRe(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_syncing",params:[]})})}function Hkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_coinbase",params:[]})})}function Vkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_mining",params:[]})})}function Wkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_hashrate",params:[]})})}function qkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_gasPrice",params:[]})})}function Gkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_maxPriorityFeePerGas",params:[]})})}function Kkt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_accounts",params:[]})})}function Ykt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_blockNumber",params:[]})})}function Xkt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getBalance",params:[e,n]})})}function Qkt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Xs.validate(["address","hex","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getStorageAt",params:[e,n,r]})})}function Zkt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getTransactionCount",params:[e,n]})})}function Jkt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32"],[e]),t.send({method:"eth_getBlockTransactionCountByHash",params:[e]})})}function eTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getBlockTransactionCountByNumber",params:[e]})})}function tTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32"],[e]),t.send({method:"eth_getUncleCountByBlockHash",params:[e]})})}function nTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getUncleCountByBlockNumber",params:[e]})})}function rTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.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 Xs.validate(["address","hex"],[e,n]),t.send({method:"eth_sign",params:[e,n]})})}function iTt(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 ORe(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["hex"],[e]),t.send({method:"eth_sendRawTransaction",params:[e]})})}function oTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_call",params:[e,n]})})}function lTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_estimateGas",params:[e,n]})})}function cTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32","bool"],[e,n]),t.send({method:"eth_getBlockByHash",params:[e,n]})})}function MRe(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag","bool"],[e,n]),t.send({method:"eth_getBlockByNumber",params:[e,n]})})}function uTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionByHash",params:[e]})})}function dTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockHashAndIndex",params:[e,n]})})}function fTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockNumberAndIndex",params:[e,n]})})}function hTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionReceipt",params:[e]})})}function pTt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.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 Xs.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getUncleByBlockNumberAndIndex",params:[e,n]})})}function xTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["filter"],[e]),t.send({method:"eth_newFilter",params:[e]})})}function gTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_newBlockFilter",params:[]})})}function bTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_newPendingTransactionFilter",params:[]})})}function yTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["hex"],[e]),t.send({method:"eth_uninstallFilter",params:[e]})})}function vTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["hex"],[e]),t.send({method:"eth_getFilterChanges",params:[e]})})}function wTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["hex"],[e]),t.send({method:"eth_getFilterLogs",params:[e]})})}function CTt(t,e){return gi(this,void 0,void 0,function*(){return Xs.validate(["filter"],[e]),t.send({method:"eth_getLogs",params:[e]})})}function STt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_getWork",params:[]})})}function NTt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Xs.validate(["bytes8","bytes32","bytes32"],[e,n,r]),t.send({method:"eth_submitWork",params:[e,n,r]})})}function jTt(t,e,n,r){return gi(this,void 0,void 0,function*(){Xs.validate(["hex","blockNumberOrTag"],[e,n]);for(const s of r)Xs.validate(["number"],[s]);return t.send({method:"eth_feeHistory",params:[e,n,r]})})}function ATt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_pendingTransactions",params:[]})})}function _Tt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_requestAccounts",params:[]})})}function ETt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"eth_chainId",params:[]})})}function kTt(t,e,n,r){return gi(this,void 0,void 0,function*(){return Xs.validate(["address","bytes32[]","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getProof",params:[e,n,r]})})}function TTt(t){return gi(this,void 0,void 0,function*(){return t.send({method:"web3_clientVersion",params:[]})})}function ITt(t,e,n){return gi(this,void 0,void 0,function*(){return Xs.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_createAccessList",params:[e,n]})})}function PTt(t,e,n,r=!1){return gi(this,void 0,void 0,function*(){return Xs.validate(["address"],[e]),t.send({method:`eth_signTypedData${r?"":"_v4"}`,params:[e,n]})})}var nce=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function FTt(t){return nce(this,void 0,void 0,function*(){return t.send({method:"net_version",params:[]})})}function OTt(t){return nce(this,void 0,void 0,function*(){return t.send({method:"net_peerCount",params:[]})})}function MTt(t){return nce(this,void 0,void 0,function*(){return t.send({method:"net_listening",params:[]})})}var B1=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const RTt=t=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_listAccounts",params:[]})}),LTt=(t,e)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_newAccount",params:[e]})}),DTt=(t,e,n,r)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_unlockAccount",params:[e,n,r]})}),BTt=(t,e)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_lockAccount",params:[e]})}),$Tt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_importRawKey",params:[e,n]})}),UTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sendTransaction",params:[e,n]})}),zTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_signTransaction",params:[e,n]})}),HTt=(t,e,n,r)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sign",params:[e,n,r]})}),VTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_ecRecover",params:[e,n]})}),pbe={type:"object",properties:{accessList:{type:"null"},maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},mbe={type:"object",properties:{maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},xbe={type:"object",properties:{gasPrice:{type:"null"}}},eF=(t,e,n)=>{try{Xs.validateJSONSchema(t,e)}catch(r){throw r instanceof _N?new zAt(r.errors,n):r}},WTt=t=>{var e,n;const r=t;if(!gr(r.type)){let a;switch(r.type){case"0x0":a=pbe;break;case"0x1":a=mbe;break;case"0x2":a=xbe;break;default:return qr({format:"uint"},r.type,bi)}return eF(a,r,r.type),qr({format:"uint"},r.type,bi)}if(!gr(r.maxFeePerGas)||!gr(r.maxPriorityFeePerGas))return eF(xbe,r,"0x2"),"0x2";if(!gr(r.accessList))return eF(mbe,r,"0x1"),"0x1";const s=(e=r.hardfork)!==null&&e!==void 0?e:(n=r.common)===null||n===void 0?void 0:n.hardfork;if(!gr(s)){const a=Object.keys(T9).indexOf(s);if(a>=Object.keys(T9).indexOf("london"))return gr(r.gasPrice)?"0x2":"0x0";if(a===Object.keys(T9).indexOf("berlin"))return"0x0"}if(!gr(r.gasPrice))return eF(pbe,r,"0x0"),"0x0"},qTt=(t,e)=>{var n;return((n=e==null?void 0:e.transactionTypeParser)!==null&&n!==void 0?n:WTt)(t)},GTt=t=>t[0]>127?"0x0":A1(t[0]),KTt={type:"object",properties:{address:{format:"address"},storageKeys:{type:"array",items:{format:"bytes32"}}}},rce={type:"array",items:Object.assign({},KTt)},YTt={type:"object",properties:{accessList:Object.assign({},rce),gasUsed:{type:"string"}}},gbe={type:"string",enum:["goerli","kovan","mainnet","rinkeby","ropsten","sepolia"]},bbe={type:"string",enum:["arrowGlacier","berlin","byzantium","chainstart","constantinople","dao","homestead","istanbul","london","merge","muirGlacier","petersburg","shanghai","spuriousDragon","tangerineWhistle"]},XTt={type:"object",properties:{name:{format:"string"},networkId:{format:"uint"},chainId:{format:"uint"}}},RRe={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({},rce),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},chain:Object.assign({},gbe),hardfork:Object.assign({},bbe),chainId:{format:"uint"},networkId:{format:"uint"},common:{type:"object",properties:{customChain:Object.assign({},XTt),baseChain:Object.assign({},gbe),hardfork:Object.assign({},bbe)}},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}}},Zte={type:"object",properties:Object.assign(Object.assign({},RRe.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({},rce),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}})},LRe={type:"object",properties:{index:{format:"uint"},validatorIndex:{format:"uint"},address:{format:"address"},amount:{format:"uint"}}},pL={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({},Zte)},{type:"array",items:{format:"bytes32"}}]},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},LRe)},withdrawalsRoot:{format:"bytes32"}}},QTt={type:"object",properties:{author:{format:"bytes32"},excessDataGas:{format:"uint"},baseFeePerGas:{format:"uint"},blobGasUsed:{format:"uint"},difficulty:{format:"uint"},excessBlobGas:{format:"uint"},extraData:{format:"bytes"},gasLimit:{format:"uint"},gasUsed:{format:"uint"},hash:{format:"bytes32"},logsBloom:{format:"bytes256"},miner:{format:"bytes"},mixHash:{format:"bytes32"},nonce:{format:"uint"},number:{format:"uint"},parentBeaconBlockRoot:{format:"bytes32"},parentHash:{format:"bytes32"},receiptsRoot:{format:"bytes32"},sha3Uncles:{format:"bytes32"},size:{format:"uint"},stateRoot:{format:"bytes32"},timestamp:{format:"uint"},totalDifficulty:{format:"uint"},transactions:{type:"array",items:{format:"bytes32"}},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},LRe)},withdrawalsRoot:{format:"bytes32"}}},p8={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"}}}},ZTt={type:"object",properties:{startingBlock:{format:"string"},currentBlock:{format:"string"},highestBlock:{format:"string"},knownStates:{format:"string"},pulledStates:{format:"string"}}},m8={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({},p8)},logsBloom:{format:"bytes"},root:{format:"bytes"},status:{format:"uint"},type:{format:"uint"}}},JTt={type:"object",properties:{messageHash:{format:"bytes"},r:{format:"bytes32"},s:{format:"bytes32"},v:{format:"bytes"},message:{format:"bytes"},signature:{format:"bytes"}}},eIt={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"}}}},tIt={type:"object",properties:{key:{format:"bytes32"},value:{format:"uint"},proof:{type:"array",items:{format:"bytes32"}}}},nIt={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({},tIt)}}};function bf(t,e=yd,n={transactionSchema:Zte,fillInputAndData:!1}){var r,s;let a=k2({},t);if(gr(t==null?void 0:t.common)||(a.common=Object.assign({},t.common),gr((r=t.common)===null||r===void 0?void 0:r.customChain)||(a.common.customChain=Object.assign({},t.common.customChain))),a=qr((s=n.transactionSchema)!==null&&s!==void 0?s:Zte,a,e),!gr(a.data)&&!gr(a.input)&&A1(a.data)!==A1(a.input))throw new rMe({data:Gi(a.data),input:Gi(a.input)});return n.fillInputAndData&&(gr(a.data)?gr(a.input)||(a.data=a.input):a.input=a.data),gr(a.gasLimit)||(a.gas=a.gasLimit,delete a.gasLimit),a}function rIt(t,e,n={fillInputAndData:!1}){return{raw:qr({format:"bytes"},t,e),tx:bf(Object.assign(Object.assign({},l5.fromSerializedData(po(t)).toJSON()),{hash:Gi(TN(po(t))),type:GTt(po(t))}),e,{fillInputAndData:n.fillInputAndData,transactionSchema:n.transactionSchema})}}var sce=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 ice(t,e){return sce(this,void 0,void 0,function*(){const n=yield FTt(t.requestManager);return qr({format:"uint"},n,e)})}function sIt(t,e){return sce(this,void 0,void 0,function*(){const n=yield OTt(t.requestManager);return qr({format:"uint"},n,e)})}const iIt=t=>sce(void 0,void 0,void 0,function*(){return MTt(t.requestManager)});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())})};class DRe extends of{getId(e=this.defaultReturnFormat){return TW(this,void 0,void 0,function*(){return ice(this,e)})}getPeerCount(e=this.defaultReturnFormat){return TW(this,void 0,void 0,function*(){return sIt(this,e)})}isListening(){return TW(this,void 0,void 0,function*(){return iIt(this)})}}const RN="ALLEVENTS",Jte={name:RN,signature:"",type:"event",inputs:[]},xU={bytes:S1.HEX,number:ap.NUMBER};var BRe=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 aIt(t,e,n){return BRe(this,void 0,void 0,function*(){var r,s,a,o;const l=yield pLe(e,e.defaultBlock,!1,bi);if(gr(l.baseFeePerGas))throw new DAt;let c;if(gr(t.gasPrice)&&BigInt(l.baseFeePerGas)===BigInt(0)&&(c=yield pce(e,n)),!gr(t.gasPrice)||!gr(c)){const u=qr({format:"uint"},(r=t.gasPrice)!==null&&r!==void 0?r:c,n);return{maxPriorityFeePerGas:u,maxFeePerGas:u}}return{maxPriorityFeePerGas:qr({format:"uint"},(s=t.maxPriorityFeePerGas)!==null&&s!==void 0?s:e.defaultMaxPriorityFeePerGas,n),maxFeePerGas:qr({format:"uint"},(a=t.maxFeePerGas)!==null&&a!==void 0?a:BigInt(l.baseFeePerGas)*BigInt(2)+BigInt((o=t.maxPriorityFeePerGas)!==null&&o!==void 0?o:e.defaultMaxPriorityFeePerGas),n)}})}function $Re(t,e,n){return BRe(this,void 0,void 0,function*(){const r=URe(t,e);if(!gr(r)){if(r.startsWith("-"))throw new E1e(r);if(Number(r)<0||Number(r)>127)throw new E1e(r);if(gr(t.gasPrice)&&(r==="0x0"||r==="0x1"))return{gasPrice:yield pce(e,n),maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};if(r==="0x2")return Object.assign({gasPrice:void 0},yield aIt(t,e,n))}})}var ace=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 ene=(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(!Ea(n[t])&&RMe(n[t])){if(e.wallet){const s=e.wallet.get(qr({format:"uint"},n[t],xU));if(!gr(s))return s.address;throw new k1e}throw new k1e}else throw t==="from"?new yAt(n.from):new vAt(n.to)}if(t==="from"){if(!gr(r))return mU(r);if(!gr(e.defaultAccount))return e.defaultAccount}},oIt=(t,e,...n)=>ace(void 0,[t,e,...n],void 0,function*(r,s,a=r.defaultReturnFormat){if(gr(s))throw new LAt;return xLe(r,s,r.defaultBlock,a)}),URe=(t,e)=>{const n=qTt(t,e);if(!gr(n))return n;if(!gr(e.defaultTransactionType))return qr({format:"uint"},e.defaultTransactionType,bi)};function lIt(t){return ace(this,void 0,void 0,function*(){var e,n;let r=qr(RRe,t.transaction,t.web3Context.defaultReturnFormat);if(gr(r.from)&&(r.from=ene("from",t.web3Context,void 0,t.privateKey)),gr(r.nonce)&&(r.nonce=yield oIt(t.web3Context,r.from,bi)),gr(r.value)&&(r.value="0x0"),gr(r.data))gr(r.input)?r.input="0x":r.input.startsWith("0x")||(r.input=`0x${r.input}`);else{if(!gr(r.input)&&r.data!==r.input)throw new rMe({data:Gi(r.data),input:Gi(r.input)});r.data.startsWith("0x")||(r.data=`0x${r.data}`)}if(gr(r.common)){if(t.web3Context.defaultCommon){const s=t.web3Context.defaultCommon,a=s.customChain.chainId,o=s.customChain.networkId,l=s.customChain.name;r.common=Object.assign(Object.assign({},s),{customChain:{chainId:a,networkId:o,name:l}})}gr(r.chain)&&(r.chain=t.web3Context.defaultChain),gr(r.hardfork)&&(r.hardfork=t.web3Context.defaultHardfork)}if(gr(r.chainId)&&gr((e=r.common)===null||e===void 0?void 0:e.customChain.chainId)&&(r.chainId=yield bLe(t.web3Context,bi)),gr(r.networkId)&&(r.networkId=(n=t.web3Context.defaultNetworkId)!==null&&n!==void 0?n:yield ice(t.web3Context,bi)),gr(r.gasLimit)&&!gr(r.gas)&&(r.gasLimit=r.gas),r.type=URe(r,t.web3Context),gr(r.accessList)&&(r.type==="0x1"||r.type==="0x2")&&(r.accessList=[]),t.fillGasPrice&&(r=Object.assign(Object.assign({},r),yield $Re(r,t.web3Context,bi))),gr(r.gas)&&gr(r.gasLimit)&&t.fillGasLimit){const s=yield gce(t.web3Context,r,"latest",bi);r=Object.assign(Object.assign({},r),{gas:qr({format:"uint"},s,bi)})}return r})}const cIt=t=>ace(void 0,void 0,void 0,function*(){var e;return((e=t.web3Context.transactionBuilder)!==null&&e!==void 0?e:lIt)(Object.assign(Object.assign({},t),{transaction:t.transaction}))});var oce=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 tne(t,e,n){const r=t.transactionPollingInterval,[s,a]=YMe(()=>oce(this,void 0,void 0,function*(){let l;try{l=yield mce(t,xU)}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 aMe({starterBlockNumber:e,numberOfBlocks:c,transactionHash:n})}),r);return[a,{clean:()=>{clearInterval(s)}}]}function uIt(t,e,n){return oce(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]=tne(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 tne(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 aMe({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 zRe(t,e){return oce(this,void 0,void 0,function*(){var n,r;const{provider:s}=t.requestManager;let a;const o=yield mce(t,xU);return!((r=(n=s).supportsSubscriptions)===null||r===void 0)&&r.call(n)&&t.enableExperimentalFeatures.useSubscriptionWhenCheckingBlockTimeout?a=yield uIt(t,o,e):a=tne(t,o,e),a})}var dIt=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 nne(t,e,n){return dIt(this,void 0,void 0,function*(){const[r,s]=Dle(t.transactionSendTimeout,new BAt({numberOfSeconds:t.transactionSendTimeout/1e3,transactionHash:n})),[a,o]=yield zRe(t,n);try{return yield Promise.race([e(),s,a])}finally{clearTimeout(r),o.clean()}})}var ybe=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 HRe(t,e,n,r){return ybe(this,void 0,void 0,function*(){var s;const a=(s=t.transactionReceiptPollingInterval)!==null&&s!==void 0?s:t.transactionPollingInterval,[o,l]=Lle(()=>ybe(this,void 0,void 0,function*(){try{return(r??mLe)(t,e,n)}catch(x){console.warn("An error happen while trying to get the transaction receipt",x);return}}),a),[c,u]=Dle(t.transactionPollingTimeout,new iMe({numberOfSeconds:t.transactionPollingTimeout/1e3,transactionHash:e})),[d,f]=yield zRe(t,e);try{return yield Promise.race([o,u,d])}finally{c&&clearTimeout(c),l&&clearInterval(l),f.clean()}})}var fIt=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 fM=({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})=>{var a;let o=1;const l=setInterval(()=>{fIt(void 0,void 0,void 0,function*(){if(o>=t.transactionConfirmationBlocks){clearInterval(l);return}const c=yield MRe(t.requestManager,oc(BigInt(e.blockNumber)+BigInt(o)),!1);c!=null&&c.hash&&(o+=1,n.emit("confirmation",{confirmations:qr({format:"uint"},o,s),receipt:qr(r??m8,e,s),latestBlockHash:qr({format:"bytes32"},c.hash,s)}))})},(a=t.transactionReceiptPollingInterval)!==null&&a!==void 0?a:t.transactionPollingInterval)};var vbe=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 hIt=({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=>vbe(void 0,void 0,void 0,function*(){var d;if(a=!1,!(u!=null&&u.number)||o===(u==null?void 0:u.parentHash))return;o=u==null?void 0:u.parentHash;const f=BigInt(u.number)-BigInt(e.blockNumber)+BigInt(1);n.emit("confirmation",{confirmations:qr({format:"uint"},f,s),receipt:qr(r??m8,e,s),latestBlockHash:qr({format:"bytes32"},u.parentHash,s)}),f>=t.transactionConfirmationBlocks&&(yield(d=t.subscriptionManager)===null||d===void 0?void 0:d.removeSubscription(c))})),c.on("error",()=>vbe(void 0,void 0,void 0,function*(){var u;yield(u=t.subscriptionManager)===null||u===void 0?void 0:u.removeSubscription(c),a=!1,fM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})}))}).catch(()=>{a=!1,fM({web3Context:t,transactionReceipt:e,customTransactionReceiptSchema:r,transactionPromiEvent:n,returnFormat:s})})}),setTimeout(()=>{a&&fM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,returnFormat:s})},t.blockHeaderTimeout*1e3)};function pIt(t,e,n,r,s,a){if(gr(n)||gr(n.blockHash))throw new $At({receipt:n,blockHash:qr({format:"bytes32"},n==null?void 0:n.blockHash,s),transactionHash:qr({format:"bytes32"},r,s)});if(!n.blockNumber)throw new UAt({receipt:n});e.emit("confirmation",{confirmations:qr({format:"uint"},1,s),receipt:qr(a??m8,n,s),latestBlockHash:qr({format:"bytes32"},n.blockHash,s)});const o=t.requestManager.provider;o&&"supportsSubscriptions"in o&&o.supportsSubscriptions()?hIt({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s}):fM({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s})}const gU=t=>!ai(t)&&typeof t=="object"&&!ai(t.type)&&t.type==="error",lce=t=>!ai(t)&&typeof t=="object"&&!ai(t.type)&&t.type==="event",bU=t=>!ai(t)&&typeof t=="object"&&!ai(t.type)&&t.type==="function",mIt=t=>!ai(t)&&typeof t=="object"&&!ai(t.type)&&t.type==="constructor",xIt=t=>typeof t=="object"&&typeof t.components>"u"&&typeof t.name>"u",VRe=t=>t.includes("[]")?{type:"tuple[]",name:t.slice(0,-2)}:{type:"tuple",name:t},WRe=t=>{const e=[];for(const n of Object.keys(t)){const r=t[n];typeof r=="object"?e.push(Object.assign(Object.assign({},VRe(n)),{components:WRe(r)})):e.push({name:n,type:t[n]})}return e},rne=(t,e)=>{const n=[];return e.forEach(r=>{if(typeof r.components=="object"){if(!r.type.startsWith("tuple"))throw new Xi(`Invalid value given "${r.type}". Error: components found but type is not tuple.`);const s=r.type.indexOf("["),a=s>=0?r.type.substring(s):"",o=rne(t,r.components);n.push(`(${o.join(",")})${a}`)}else n.push(r.type)}),n},s1=t=>{var e,n,r,s;return gU(t)||lce(t)||bU(t)?!((e=t.name)===null||e===void 0)&&e.includes("(")?t.name:`${(n=t.name)!==null&&n!==void 0?n:""}(${rne(!1,(r=t.inputs)!==null&&r!==void 0?r:[]).join(",")})`:`(${rne(!1,(s=t.inputs)!==null&&s!==void 0?s:[]).join(",")})`},gIt=t=>{if(typeof t!="string"&&!gU(t))throw new Xi("Invalid parameter value in encodeErrorSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e)},cce=t=>{if(typeof t!="string"&&!lce(t))throw new Xi("Invalid parameter value in encodeEventSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e)};function uce(t,e){const n=t.exec(e);return n==null?void 0:n.groups}var qRe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,GRe=/^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)?$/,KRe=/^\(.+?\).*?$/,bIt=Object.defineProperty,yIt=(t,e,n)=>e in t?bIt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,i7=(t,e,n)=>(yIt(t,typeof e!="symbol"?e+"":e,n),n),vIt="abitype",wIt="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: ${vIt}@${wIt}`].join(`
`);super(s),i7(this,"details"),i7(this,"docsPath"),i7(this,"metaMessages"),i7(this,"shortMessage"),i7(this,"name","AbiTypeError"),e.cause&&(this.cause=e.cause),this.details=n,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=t}},YRe=/^struct (?<name>[a-zA-Z0-9_]+) \{(?<properties>.*?)\}$/;function XRe(t){return YRe.test(t)}function CIt(t){return uce(YRe,t)}var wbe=new Set(["memory","indexed","storage","calldata"]),SIt=new Set(["calldata","memory","storage"]);function NIt(t,e){return e?`${e}:${t}`:t}var IW=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}]]),jIt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,AIt=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,_It=/^u?int$/;function mL(t,e){var f,x;const n=NIt(t,e==null?void 0:e.type);if(IW.has(n))return IW.get(n);const r=KRe.test(t),s=uce(r?AIt:jIt,t);if(!s)throw new rf("Invalid ABI parameter.",{details:t});if(s.name&&kIt(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=GC(s.type),y=[],v=g.length;for(let C=0;C<v;C++)y.push(mL(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(_It.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!QRe(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(SIt.has(s.modifier)&&!TIt(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 IW.set(n,d),d}function GC(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?GC(l,[...e,n.trim()]):GC(l,e,`${n}${o}`,r);case"(":return GC(l,e,`${n}${o}`,r+1);case")":return GC(l,e,`${n}${o}`,r-1);default:return GC(l,e,`${n}${o}`,r)}}return[]}function QRe(t){return t==="address"||t==="bool"||t==="function"||t==="string"||qRe.test(t)||GRe.test(t)}var EIt=/^(?: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 kIt(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||qRe.test(t)||GRe.test(t)||EIt.test(t)}function TIt(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function IIt(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!XRe(l))continue;const c=CIt(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=mL(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]=ZRe(c,e)}return r}var PIt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?$/;function ZRe(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(KRe.test(o.type))r.push(o);else{const c=uce(PIt,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:ZRe(e[d]??[],e,new Set([...n,d]))})}else if(QRe(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 FIt(t){let e;if(typeof t=="string")e=mL(t,{modifiers:wbe});else{const n=IIt(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!XRe(a)){e=mL(a,{modifiers:wbe,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 ol=32;function sne(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 JRe(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=>JRe(r))})}function OIt(t){return!ai(t)&&typeof t=="object"&&!ai(t.type)&&typeof t.type=="string"}function eLe(t){return t.map(e=>{var n;if(OIt(e))return e;if(typeof e=="string")return JRe(FIt(e.replace(/tuple/,"")));if(xIt(e)){const r=Object.keys(e)[0],s=VRe(r);return s.name=(n=s.name)!==null&&n!==void 0?n:"",Object.assign(Object.assign({},s),{components:WRe(e[r])})}throw new Xi("Invalid abi")})}function dce(t){const e=t.type.lastIndexOf("["),n=t.type.substring(0,e),r=t.type.substring(e);let s=-1;if(r!=="[]"&&(s=Number(r.slice(1,-1)),isNaN(s)))throw new Xi("Invalid fixed array size",{size:r});return{param:{type:n,name:"",components:t.components},size:s}}function xL(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(xL))!==null&&n!==void 0?n:!1:t.type.endsWith("]")?xL(dce(t).param):!1}const tLe=20,nLe=ol-tLe;function MIt(t,e){if(typeof e!="string")throw new Xi("address type expects string as input type",{value:e,name:t.name,type:t.type});let n=e.toLowerCase();if(n.startsWith("0x")||(n=`0x${n}`),!ih(n))throw new Xi("provided input is not valid address",{value:e,name:t.name,type:t.type});const r=O5(n),s=sne(ol);return s.set(r,nLe),{dynamic:!1,encoded:s}}function RIt(t,e){const n=e.subarray(nLe,ol);if(n.length!==tLe)throw new Xi("Invalid decoding input, not enough bytes to decode address",{bytes:e});const r=L1(n);return{result:wx(r),encoded:e.subarray(ol),consumed:ol}}const d2=new Map;let tF=BigInt(256);for(let t=8;t<=256;t+=8)d2.set(`uint${t}`,{min:BigInt(0),max:tF-BigInt(1)}),d2.set(`int${t}`,{min:-tF/BigInt(2),max:tF/BigInt(2)-BigInt(1)}),tF*=BigInt(256);d2.set("int",d2.get("int256"));d2.set("uint",d2.get("uint256"));const rLe=BigInt(1)<<BigInt(256);function LIt(t,e=ol){let n;return t<0?n=(rLe+t).toString(16):n=t.toString(16),n=kN(n,e*2),O5(n)}function DIt(t,e){const n=L1(t),r=BigInt(n);return r<=e?r:r-rLe}function qT(t,e){let n;try{n=mw(e)}catch{throw new Xi("provided input is not number value",{type:t.type,value:e,name:t.name})}const r=d2.get(t.type);if(!r)throw new Xi("provided abi contains invalid number datatype",{type:t.type});if(n<r.min)throw new Xi("provided input is less then minimum for given type",{type:t.type,value:e,name:t.name,minimum:r.min.toString()});if(n>r.max)throw new Xi("provided input is greater then maximum for given type",{type:t.type,value:e,name:t.name,maximum:r.max.toString()});return{dynamic:!1,encoded:LIt(n)}}function LN(t,e){if(e.length<ol)throw new Xi("Not enough bytes left to decode",{param:t,bytesLeft:e.length});const n=e.subarray(0,ol),r=d2.get(t.type);if(!r)throw new Xi("provided abi contains invalid number datatype",{type:t.type});const s=DIt(n,r.max);if(s<r.min)throw new Xi("decoded value is less then minimum for given type",{type:t.type,value:s,name:t.name,minimum:r.min.toString()});if(s>r.max)throw new Xi("decoded value is greater then maximum for given type",{type:t.type,value:s,name:t.name,maximum:r.max.toString()});return{result:s,encoded:e.subarray(ol),consumed:ol}}function BIt(t,e){let n;try{n=UMe(e)}catch(r){if(r instanceof Sle)throw new Xi("provided input is not valid boolean value",{type:t.type,value:e,name:t.name})}return qT({type:"uint8",name:""},Number(n))}function $It(t,e){const n=LN({type:"uint8",name:""},e);if(n.result>1||n.result<0)throw new Xi("Invalid boolean value encoded",{boolBytes:e.subarray(0,ol),numberResult:n});return{result:n.result===BigInt(1),encoded:n.encoded,consumed:ol}}const UIt=32;function sLe(t,e){if(typeof e=="string"&&e.length%2!==0&&(e+="0"),!_2(e))throw new Xi("provided input is not valid bytes value",{type:t.type,value:e,name:t.name});const n=hx(e),[,r]=t.type.split("bytes");if(r){if(Number(r)>UIt||Number(r)<1)throw new Xi("invalid bytes type. Static byte type can have between 1 and 32 bytes",{type:t.type});if(Number(r)<n.length)throw new Xi("provided input size is different than type size",{type:t.type,value:e,name:t.name});const o=sne(ol);return o.set(n),{dynamic:!1,encoded:o}}const s=Math.ceil(n.length/ol),a=sne(ol+s*ol);return a.set(qT({type:"uint32",name:""},n.length).encoded),a.set(n,ol),{dynamic:!0,encoded:a}}function iLe(t,e){const[,n]=t.type.split("bytes");let r=Number(n),s=e,a=1,o=0;if(!r){const l=LN({type:"uint32",name:""},s);r=Number(l.result),o+=l.consumed,s=l.encoded,a=Math.ceil(r/ol)}if(r>e.length)throw new Xi("there is not enough data to decode",{type:t.type,encoded:e,size:r});return{result:Gi(s.subarray(0,r)),encoded:s.subarray(a*ol),consumed:o+a*ol}}function zIt(t,e){if(typeof e!="string")throw new Xi("invalid input, should be string",{input:e});const n=Ole(e);return sLe({type:"bytes",name:""},n)}function HIt(t,e){const n=iLe({type:"bytes",name:""},e);return{result:aU(n.result),encoded:n.encoded,consumed:n.consumed}}function aLe(t){let e=0,n=0;const r=[],s=[];for(const a of t)a.dynamic?e+=ol:e+=a.encoded.length;for(const a of t)a.dynamic?(r.push(qT({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 VIt(t,e){if(!Array.isArray(e))throw new Xi("Expected value to be array",{abi:t,values:e});const{size:n,param:r}=dce(t),s=e.map(l=>ine(r,l)),a=n===-1,o=s.length>0&&s[0].dynamic;if(!a&&e.length!==n)throw new Xi("Given arguments count doesn't match array length",{arrayLength:n,argumentsLength:e.length});if(a||o){const l=aLe(s);if(a){const c=qT({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 WIt(t,e){let{size:n,param:r}=dce(t);const s=n===-1;let a=0;const o=[];let l=e;if(s){const u=LN({type:"uint32",name:""},e);n=Number(u.result),a=u.consumed,l=u.encoded}if(xL(r)){for(let u=0;u<n;u+=1){const d=LN({type:"uint32",name:""},l.subarray(u*ol));a+=d.consumed;const f=gL(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=gL(r,e.subarray(a));a+=d.consumed,o.push(d.result)}return{result:o,encoded:e.subarray(a),consumed:a}}function ine(t,e){if(t.type==="string")return zIt(t,e);if(t.type==="bool")return BIt(t,e);if(t.type==="address")return MIt(t,e);if(t.type==="tuple")return fce(t,e);if(t.type.endsWith("]"))return VIt(t,e);if(t.type.startsWith("bytes"))return sLe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return qT(t,e);throw new Xi("Unsupported",{param:t,value:e})}function gL(t,e){if(t.type==="string")return HIt(t,e);if(t.type==="bool")return $It(t,e);if(t.type==="address")return RIt(t,e);if(t.type==="tuple")return oLe(t,e);if(t.type.endsWith("]"))return WIt(t,e);if(t.type.startsWith("bytes"))return iLe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return LN(t,e);throw new Xi("Unsupported",{param:t,bytes:e})}function fce(t,e){var n,r,s;let a=!1;if(!Array.isArray(e)&&typeof e!="object")throw new Xi("param must be either Array or Object",{param:t,input:e});const o=e,l=[];for(let c=0;c<((r=(n=t.components)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0);c+=1){const u=t.components[c];let d;if(Array.isArray(o)){if(c>=o.length)throw new Xi("input param length missmatch",{param:t,input:e});d=ine(u,o[c])}else{const f=o[(s=u.name)!==null&&s!==void 0?s:""];if(f==null)throw new Xi("missing input defined in abi",{param:t,input:e,paramName:u.name});d=ine(u,f)}d.dynamic&&(a=!0),l.push(d)}return a?{dynamic:!0,encoded:aLe(l)}:{dynamic:!1,encoded:Ad(...l.map(c=>c.encoded))}}function oLe(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(xL(o)){const c=LN({type:"uint32",name:""},e.subarray(r));l=gL(o,e.subarray(Number(c.result))),r+=c.consumed,s+=l.consumed}else l=gL(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 qIt(t,e,n){const r=eLe(t),s=O5(e);return oLe({type:"tuple",name:"",components:r},s).result}function lLe(t){const e=[];return t.forEach(n=>{if(Array.isArray(n)){const r=lLe(n);e.push({type:"tuple",components:r,name:""})}else e.push({type:A1(n,!0)})}),e}function yU(t,e){if((t==null?void 0:t.length)!==e.length)throw new Xi("Invalid number of values received for given ABI",{expected:t==null?void 0:t.length,received:e.length});const n=eLe(t);return L1(fce({type:"tuple",name:"",components:n},e).encoded)}function GIt(t){try{const e=lLe(t);return L1(fce({type:"tuple",name:"",components:e},t).encoded)}catch{throw new Xi("Could not infer types from given params",{params:t})}}const ane=(t,e)=>yU([t],[e]),cLe=(t,e,n)=>{try{if(t.length>0&&(!e||e==="0x"||e==="0X"))throw new Xi("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.");return qIt(t,`0x${e.replace(/0x/i,"")}`,n)}catch(r){throw new Xi(`Parameter decoding error: ${r.message}`,{internalErr:r})}},C3=(t,e)=>cLe(t,e,!1),uLe=(t,e)=>C3([t],e)[0],_E=t=>{if(typeof t!="string"&&!bU(t))throw new Xi("Invalid parameter value in encodeFunctionSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e).slice(0,10)},KIt=(t,e)=>{var n;if(!bU(t))throw new Xi("Invalid parameter value in encodeFunctionCall");return`${_E(t)}${yU((n=t.inputs)!==null&&n!==void 0?n:[],e??[]).replace("0x","")}`},one=(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=C3([...t.inputs],r);return Object.assign(Object.assign({},s),{__method__:s1(t)})},YIt=(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=C3([...t.outputs],n);return r.__length__===1?r[0]:r},XIt=["bool","string","int","uint","address","fixed","ufixed"],QIt=(t,e)=>t==="string"?e:uLe(t,e),dLe=(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?cLe(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))?QIt(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},hM=(t,e)=>{if(e!=null&&e.data){let n,r,s;try{const a=e.data.slice(0,10),o=t.find(l=>gIt(l).startsWith(a));o!=null&&o.inputs?(n=o.name,r=s1(o),s=C3([...o.inputs],e.data.substring(10))):e.data.startsWith("0x08c379a0")?(n="Error",r="Error(string)",s=C3([{name:"message",type:"string"}],e.data.substring(10))):e.data.startsWith("0x4e487b71")?(n="Panic",r="Panic(uint256)",s=C3([{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 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,e)=>{var n,r,s,a,o;if(t instanceof b3&&t.cause instanceof Q$){if(e!==void 0){const l=e.filter(c=>gU(c));return hM(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 Z$&&!Array.isArray((o=t.cause)===null||o===void 0?void 0:o.errors)&&t.cause!==void 0)return t.cause.message;throw t};function fLe(t,e,n){return ZIt(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){try{yield xce(r,s,r.defaultBlock,o);return}catch(l){return JIt(l,a)}})}var ePt=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 PW(t,e,n,r,s,a){return ePt(this,void 0,void 0,function*(){let o=a;o===void 0&&t.handleRevert&&e!==void 0&&(o=yield fLe(t,e,s));let l;if(o===void 0)l=new tMe(n);else if(typeof o=="string")l=new qR(o,void 0,n);else if(o.customErrorName!==void 0&&o.customErrorDecodedSignature!==void 0&&o.customErrorArguments!==void 0){const c=o;l=new eMe(c.reason,c.customErrorName,c.customErrorDecodedSignature,c.customErrorArguments,c.signature,n,c.data)}else l=new qR(o.reason,o.signature,n,o.data);return l})}const hce=(t,e,n,r=yd)=>{var s,a,o,l,c,u;let d=Object.assign({},t);const f=qr(p8,e,r);if([RN,"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:dLe([...(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 Av=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 hLe{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=hce(Jte,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 Av(this,void 0,void 0,function*(){if(this.options.checkRevertBeforeSending!==!1){let n=e;gr(e.data)&&gr(e.input)&&gr(e.gas)&&(n=Object.assign(Object.assign({},e),{gas:21e3}));const r=yield fLe(this.web3Context,n,this.options.contractAbi);if(r!==void 0)throw yield PW(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 Av(this,arguments,void 0,function*({transactionFormatted:n,transaction:r}){var s;let a=n;return!this.web3Context.config.ignoreGasPricing&&!(!((s=this.options)===null||s===void 0)&&s.ignoreGasPricing)&&gr(n.gasPrice)&&(gr(r.maxPriorityFeePerGas)||gr(r.maxFeePerGas))&&(a=Object.assign(Object.assign({},n),yield $Re(n,this.web3Context,bi))),a})}signAndSend(e){return Av(this,arguments,void 0,function*({wallet:n,tx:r}){if(n){const s=yield n.signTransaction(r);return nne(this.web3Context,()=>Av(this,void 0,void 0,function*(){return ORe(this.web3Context.requestManager,s.rawTransaction)}),s.transactionHash)}return nne(this.web3Context,()=>Av(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 Av(this,arguments,void 0,function*({error:n,tx:r}){var s;let a=n;return a instanceof b3&&this.web3Context.handleRevert&&(a=yield PW(this.web3Context,r,void 0,void 0,(s=this.options)===null||s===void 0?void 0:s.contractAbi)),(a instanceof Z$||a instanceof b3||a instanceof eMe||a instanceof tMe||a instanceof qR||a instanceof iMe)&&this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",a),a})}emitConfirmation({receipt:e,transactionHash:n,customTransactionReceiptSchema:r}){this.promiEvent.listenerCount("confirmation")>0&&pIt(this.web3Context,this.promiEvent,e,n,this.returnFormat,r)}handleResolve(e){return Av(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 PW(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 $a=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())})},tPt=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 nPt=t=>$a(void 0,void 0,void 0,function*(){return FRe(t.requestManager)});function rPt(t,e){return $a(this,void 0,void 0,function*(){const n=yield Wkt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function pce(t,e){return $a(this,void 0,void 0,function*(){const n=yield qkt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function sPt(t,e){return $a(this,void 0,void 0,function*(){const n=yield Gkt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function mce(t,e){return $a(this,void 0,void 0,function*(){const n=yield Ykt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function iPt(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:qr({format:"uint"},s,bi),l=yield Xkt(n.requestManager,r,o);return qr({format:"uint"},l,a??n.defaultReturnFormat)})}function aPt(t,e,n){return $a(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=qr({format:"uint"},a,bi),u=Uc(o)?o:qr({format:"uint"},o,bi),d=yield Qkt(r.requestManager,s,c,u);return qr({format:"bytes"},d,l??r.defaultReturnFormat)})}function oPt(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:qr({format:"uint"},s,bi),l=yield rTt(n.requestManager,r,o);return qr({format:"bytes"},l,a??n.defaultReturnFormat)})}function pLe(t){return $a(this,arguments,void 0,function*(e,n=e.defaultBlock,r=!1,s){var a;let o;if(_2(n)){const c=qr({format:"bytes32"},n,bi);o=yield cTt(e.requestManager,c,r)}else{const c=Uc(n)?n:qr({format:"uint"},n,bi);o=yield MRe(e.requestManager,c,r)}const l=qr(pL,o,s??e.defaultReturnFormat);return gr(l)?l:Object.assign(Object.assign({},l),{transactions:(a=l.transactions)!==null&&a!==void 0?a:[]})})}function lPt(t){return $a(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(_2(n)){const a=qr({format:"bytes32"},n,bi);s=yield Jkt(e.requestManager,a)}else{const a=Uc(n)?n:qr({format:"uint"},n,bi);s=yield eTt(e.requestManager,a)}return qr({format:"uint"},s,r??e.defaultReturnFormat)})}function cPt(t){return $a(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(_2(n)){const a=qr({format:"bytes32"},n,bi);s=yield tTt(e.requestManager,a)}else{const a=Uc(n)?n:qr({format:"uint"},n,bi);s=yield nTt(e.requestManager,a)}return qr({format:"uint"},s,r??e.defaultReturnFormat)})}function uPt(t){return $a(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=qr({format:"uint"},r,bi);let o;if(_2(n)){const l=qr({format:"bytes32"},n,bi);o=yield pTt(e.requestManager,l,a)}else{const l=Uc(n)?n:qr({format:"uint"},n,bi);o=yield mTt(e.requestManager,l,a)}return qr(pL,o,s??e.defaultReturnFormat)})}function dPt(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=qr({format:"bytes32"},r,yd),o=yield uTt(n.requestManager,a);return gr(o)?o:bf(o,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})})}function fPt(t,e){return $a(this,void 0,void 0,function*(){return(yield ATt(t.requestManager)).map(r=>bf(r,e??t.defaultReturnFormat,{transactionSchema:t.config.customTransactionSchema,fillInputAndData:!0}))})}function hPt(t){return $a(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=qr({format:"uint"},r,bi);let o;if(_2(n)){const l=qr({format:"bytes32"},n,bi);o=yield dTt(e.requestManager,l,a)}else{const l=Uc(n)?n:qr({format:"uint"},n,bi);o=yield fTt(e.requestManager,l,a)}return gr(o)?o:bf(o,s??e.defaultReturnFormat,{transactionSchema:e.config.customTransactionSchema,fillInputAndData:!0})})}function mLe(t,e,n){return $a(this,void 0,void 0,function*(){const r=qr({format:"bytes32"},e,yd);let s;try{s=yield hTt(t.requestManager,r)}catch(a){if(typeof a=="object"&&!gr(a)&&"message"in a&&a.message==="transaction indexing is in progress")console.warn("Transaction indexing is in progress.");else throw a}return gr(s)?s:qr(m8,s,n??t.defaultReturnFormat)})}function xLe(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:qr({format:"uint"},s,bi),l=yield Zkt(n.requestManager,r,o);return qr({format:"uint"},l,a??n.defaultReturnFormat)})}function EE(t,e,n,r={checkRevertBeforeSending:!0},s){const a=new PRe((o,l)=>{setImmediate(()=>{$a(this,void 0,void 0,function*(){const c=new hLe({web3Context:t,promiEvent:a,options:r,returnFormat:n});let u=Object.assign({},e);gr(s)||(u=yield s.processTransaction(u));let d=bf(Object.assign(Object.assign({},u),{from:ene("from",t,u),to:ene("to",t,u)}),bi,{transactionSchema:t.config.customTransactionSchema});try{d=yield c.populateGasPrice({transaction:u,transactionFormatted:d}),yield c.checkRevertBeforeSending(d),c.emitSending(d);let f;t.wallet&&!gr(d.from)&&(f=t.wallet.get(d.from));const x=yield c.signAndSend({wallet:f,tx:d}),g=qr({format:"bytes32"},x,n??t.defaultReturnFormat);c.emitSent(d),c.emitTransactionHash(g);const y=yield HRe(t,x,n??t.defaultReturnFormat),v=c.getReceiptWithEvents(qr(m8,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 pPt(t,e,n,r={checkRevertBeforeSending:!0}){const s=new PRe((a,o)=>{setImmediate(()=>{$a(this,void 0,void 0,function*(){const l=new hLe({web3Context:t,promiEvent:s,options:r,returnFormat:n}),c=qr({format:"bytes"},e,bi),u=l5.fromSerializedData(hx(po(c))),d=Object.assign(Object.assign({},u.toJSON()),{from:u.getSenderAddress().toString()});try{const{v:f,r:x,s:g}=d,y=tPt(d,["v","r","s"]);yield l.checkRevertBeforeSending(y),l.emitSending(c);const v=yield nne(t,()=>$a(this,void 0,void 0,function*(){return ORe(t.requestManager,c)}));l.emitSent(c);const C=qr({format:"bytes32"},v,n??t.defaultReturnFormat);l.emitTransactionHash(C);const N=yield HRe(t,v,n??t.defaultReturnFormat),I=l.getReceiptWithEvents(qr(m8,N,n??t.defaultReturnFormat));l.emitReceipt(I),a(yield l.handleResolve({receipt:I,tx:d})),l.emitConfirmation({receipt:I,transactionHash:v})}catch(f){o(yield l.handleError({error:f,tx:d}))}})})});return s}function mPt(t,e,n){return $a(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){var l;const c=qr({format:"bytes"},s,yd);if(!((l=r.wallet)===null||l===void 0)&&l.get(a)){const f=r.wallet.get(a).sign(c);return qr(JTt,f,o)}if(typeof a=="number")throw new gAt(s,'RPC method "eth_sign" does not support index signatures');const u=yield sTt(r.requestManager,a,c);return qr({format:"bytes"},u,o)})}function xPt(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=yield iTt(n.requestManager,bf(r,bi,{transactionSchema:n.config.customTransactionSchema}));return kle(a)?rIt(a,s,{fillInputAndData:!0}):{raw:qr({format:"bytes"},a.raw,s),tx:bf(a.tx,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})}})}function xce(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a=n.defaultReturnFormat){const o=Uc(s)?s:qr({format:"uint"},s,bi),l=yield oTt(n.requestManager,bf(r,bi,{transactionSchema:n.config.customTransactionSchema}),o);return qr({format:"bytes"},l,a)})}function gce(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=bf(r,bi,{transactionSchema:n.config.customTransactionSchema}),l=Uc(s)?s:qr({format:"uint"},s,bi),c=yield lTt(n.requestManager,o,l);return qr({format:"uint"},c,a??n.defaultReturnFormat)})}function gLe(t,e,n){return $a(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;gr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=oc(r)),gr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=oc(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r});return(yield CTt(t.requestManager,a)).map(c=>typeof c=="string"?c:qr(p8,c,n??t.defaultReturnFormat))})}function bLe(t,e){return $a(this,void 0,void 0,function*(){const n=yield ETt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function gPt(t,e,n){return $a(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=a.map(f=>qr({format:"bytes"},f,bi)),u=Uc(o)?o:qr({format:"uint"},o,bi),d=yield kTt(r.requestManager,s,c,u);return qr(nIt,d,l??r.defaultReturnFormat)})}function bPt(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a,o){const l=qr({format:"uint"},r,bi),c=Uc(s)?s:qr({format:"uint"},s,bi),u=qr({type:"array",items:{format:"uint"}},a,xU),d=yield jTt(n.requestManager,l,c,u);return qr(eIt,d,o??n.defaultReturnFormat)})}function yLe(t,e){return $a(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Uc(s)?s:qr({format:"uint"},s,bi),l=yield ITt(n.requestManager,bf(r,bi,{transactionSchema:n.config.customTransactionSchema}),o);return qr(YTt,l,a??n.defaultReturnFormat)})}function yPt(t,e,n,r,s){return $a(this,void 0,void 0,function*(){const a=yield PTt(t.requestManager,e,n,r);return qr({format:"bytes"},a,s??t.defaultReturnFormat)})}var x8=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 vPt(t,e){return x8(this,void 0,void 0,function*(){const n=yield bTt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function wPt(t,e,n){return x8(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;gr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=oc(r)),gr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=oc(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r}),o=yield xTt(t.requestManager,a);return qr({format:"uint"},o,n??t.defaultReturnFormat)})}function CPt(t,e){return x8(this,void 0,void 0,function*(){const n=yield gTt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function SPt(t,e){return x8(this,void 0,void 0,function*(){return yield yTt(t.requestManager,oc(e))})}function NPt(t,e,n){return x8(this,void 0,void 0,function*(){return(yield vTt(t.requestManager,oc(e))).map(a=>typeof a=="string"?a:qr(p8,a,n??t.defaultReturnFormat))})}function jPt(t,e,n){return x8(this,void 0,void 0,function*(){return(yield wTt(t.requestManager,oc(e))).map(a=>typeof a=="string"?a:qr(p8,a,n??t.defaultReturnFormat))})}class vLe extends HT{_buildSubscriptionParams(){return["logs",this.args]}formatSubscriptionResult(e){return qr(p8,e,super.returnFormat)}}class Cbe extends HT{_buildSubscriptionParams(){return["newPendingTransactions"]}formatSubscriptionResult(e){return qr({format:"string"},e,super.returnFormat)}}class bL extends HT{_buildSubscriptionParams(){return["newHeads"]}formatSubscriptionResult(e){return qr(QTt,e,super.returnFormat)}}class wLe extends HT{_buildSubscriptionParams(){return["syncing"]}_processSubscriptionResult(e){if(typeof e=="boolean")this.emit("changed",e);else{const n=Object.fromEntries(Object.entries((e==null?void 0:e.status)||e).map(([r,s])=>[r.charAt(0).toLowerCase()+r.substring(1),s]));this.emit("changed",e.syncing),this.emit("data",qr(ZTt,n,super.returnFormat))}}}var Ci=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 lne={logs:vLe,newPendingTransactions:Cbe,newHeads:bL,syncing:wLe,pendingTransactions:Cbe,newBlockHeaders:bL};class vU extends of{constructor(e){if(typeof e=="string"||cL(e)){super({provider:e,registeredSubscriptions:lne});return}if(e.registeredSubscriptions){super(e);return}super(Object.assign(Object.assign({},e),{registeredSubscriptions:lne})),this.getFeeData=this.calculateFeeData}setTransactionMiddleware(e){this.transactionMiddleware=e}getTransactionMiddleware(){return this.transactionMiddleware}getProtocolVersion(){return Ci(this,void 0,void 0,function*(){return zkt(this.requestManager)})}isSyncing(){return Ci(this,void 0,void 0,function*(){return FRe(this.requestManager)})}getCoinbase(){return Ci(this,void 0,void 0,function*(){return Hkt(this.requestManager)})}isMining(){return Ci(this,void 0,void 0,function*(){return Vkt(this.requestManager)})}getHashrate(e){return Ci(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 Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return rPt(this,e)})}getGasPrice(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return pce(this,e)})}getMaxPriorityFeePerGas(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return sPt(this,e)})}calculateFeeData(){return Ci(this,arguments,void 0,function*(e=BigInt(2),n=iU.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 Ci(this,void 0,void 0,function*(){var e;return((e=yield Kkt(this.requestManager))!==null&&e!==void 0?e:[]).map(r=>wx(r))})}getBlockNumber(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return mce(this,e)})}getBalance(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return iPt(this,n,r,s)})}getStorageAt(e,n){return Ci(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return aPt(this,r,s,a,o)})}getCode(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return oPt(this,n,r,s)})}getBlock(){return Ci(this,arguments,void 0,function*(e=this.defaultBlock,n=!1,r=this.defaultReturnFormat){return pLe(this,e,n,r)})}getBlockTransactionCount(){return Ci(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return lPt(this,e,n)})}getBlockUncleCount(){return Ci(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return cPt(this,e,n)})}getUncle(){return Ci(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return uPt(this,e,n,r)})}getTransaction(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield dPt(this,n,r);if(!s)throw new _1e;return s})}getPendingTransactions(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return fPt(this,e)})}getTransactionFromBlock(){return Ci(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return hPt(this,e,n,r)})}getTransactionReceipt(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield mLe(this,n,r);if(!s)throw new _1e;return s})}getTransactionCount(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return xLe(this,n,r,s)})}sendTransaction(e,n=this.defaultReturnFormat,r){return EE(this,e,n,r,this.transactionMiddleware)}sendSignedTransaction(e,n=this.defaultReturnFormat,r){return pPt(this,e,n,r)}sign(e,n){return Ci(this,arguments,void 0,function*(r,s,a=this.defaultReturnFormat){return mPt(this,r,s,a)})}signTransaction(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return xPt(this,n,r)})}call(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return xce(this,n,r,s)})}estimateGas(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return gce(this,n,r,s)})}getPastLogs(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return gLe(this,n,r)})}getWork(){return Ci(this,void 0,void 0,function*(){return STt(this.requestManager)})}submitWork(e,n,r){return Ci(this,void 0,void 0,function*(){return NTt(this.requestManager,e,n,r)})}requestAccounts(){return Ci(this,void 0,void 0,function*(){return _Tt(this.requestManager)})}getChainId(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return bLe(this,e)})}getNodeInfo(){return Ci(this,void 0,void 0,function*(){return TTt(this.requestManager)})}getProof(e,n){return Ci(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return gPt(this,r,s,a,o)})}getFeeHistory(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s,a=this.defaultReturnFormat){return bPt(this,n,r,s,a)})}createAccessList(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return yLe(this,n,r,s)})}signTypedData(e,n,r,s){return Ci(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),yPt(this,e,n,r,s)})}subscribe(e,n,r){return Ci(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 vLe&&e==="logs"&&typeof n=="object"&&!ai(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 wLe)}clearSubscriptions(e=!1){var n;return(n=this.subscriptionManager)===null||n===void 0?void 0:n.unsubscribe(e?vU.shouldClearSubscription:void 0)}createNewPendingTransactionFilter(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return vPt(this,e)})}createNewFilter(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return wPt(this,n,r)})}createNewBlockFilter(){return Ci(this,arguments,void 0,function*(e=this.defaultReturnFormat){return CPt(this,e)})}uninstallFilter(e){return Ci(this,void 0,void 0,function*(){return SPt(this,e)})}getFilterChanges(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return NPt(this,n,r)})}getFilterLogs(e){return Ci(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return jPt(this,n,r)})}}const APt=t=>{if(!gr(t.common)){if(gr(t.common.customChain))throw new wAt;if(gr(t.common.customChain.chainId))throw new CAt;if(!gr(t.chainId)&&t.chainId!==t.common.customChain.chainId)throw new SAt({txChainId:t.chainId,customChainId:t.common.customChain.chainId})}},_Pt=t=>{if(!gr(t.common)&&!gr(t.chain)&&!gr(t.hardfork))throw new AAt;if(!gr(t.chain)&&gr(t.hardfork)||!gr(t.hardfork)&&gr(t.chain))throw new _At({chain:t.chain,hardfork:t.hardfork})},EPt=t=>{if(!gr(t.common)&&!gr(t.common.baseChain)&&!gr(t.chain)&&t.chain!==t.common.baseChain)throw new NAt({txChain:t.chain,baseChain:t.common.baseChain})},kPt=t=>{if(!gr(t.common)&&!gr(t.common.hardfork)&&!gr(t.hardfork)&&t.hardfork!==t.common.hardfork)throw new jAt({txHardfork:t.hardfork,commonHardfork:t.common.hardfork})},Sbe=t=>{if(gr(t.gas)||!j1(t.gas)||gr(t.gasPrice)||!j1(t.gasPrice))throw new PAt({gas:t.gas,gasPrice:t.gasPrice});if(!gr(t.maxFeePerGas)||!gr(t.maxPriorityFeePerGas))throw new nMe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas})},Nbe=t=>{if(!gr(t.gasPrice)&&t.type==="0x2")throw new OAt(t.gasPrice);if(t.type==="0x0"||t.type==="0x1")throw new nMe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});if(gr(t.maxFeePerGas)||!j1(t.maxFeePerGas)||gr(t.maxPriorityFeePerGas)||!j1(t.maxPriorityFeePerGas))throw new FAt({maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas})},TPt=t=>{const e=!gr(t.gas)||!gr(t.gasLimit),n=e&&!gr(t.gasPrice),r=e&&!gr(t.maxPriorityFeePerGas)&&!gr(t.maxFeePerGas);if(!n&&!r)throw new kAt({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});if(n&&r)throw new IAt({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});(n?Sbe:Nbe)(t),(!gr(t.type)&&t.type>"0x1"?Nbe:Sbe)(t)},IPt=(t,e,n={transactionSchema:void 0})=>{if(!gr(e)){e(t);return}if(typeof t!="object"||gr(t))throw new MAt(t);APt(t),_Pt(t),EPt(t),kPt(t);const r=bf(t,bi,{transactionSchema:n.transactionSchema});if(TPt(r),gr(r.nonce)||gr(r.chainId)||r.nonce.startsWith("-")||r.chainId.startsWith("-"))throw new RAt({nonce:t.nonce,chainId:t.chainId})};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())})};const FPt=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})},OPt=(t,e)=>{var n,r,s,a,o,l,c,u,d,f,x,g,y,v,C,N,I,P;const M=!gr(t.chain)&&!gr(t.hardfork)||!gr(t.common);let F;if(!M)e.defaultCommon?(F=Object.assign({},e.defaultCommon),gr(F.hardfork)&&(F.hardfork=(n=t.hardfork)!==null&&n!==void 0?n:e.defaultHardfork),gr(F.baseChain)&&(F.baseChain=e.defaultChain)):F=sc.custom({name:"custom-network",chainId:af(t.chainId),networkId:gr(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",L=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),z=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),Q=(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,se=(P=(I=(N=t.common)===null||N===void 0?void 0:N.baseChain)!==null&&I!==void 0?I:t.chain)!==null&&P!==void 0?P:e.defaultChain;L&&z&&$&&(F=sc.custom({name:$,chainId:L,networkId:z,defaultHardfork:Q},{baseChain:se}))}return{common:F}},MPt=(t,e,n,...r)=>PPt(void 0,[t,e,n,...r],void 0,function*(s,a,o,l=!1,c=!0){const u=yield cIt({transaction:s,web3Context:a,privateKey:o,fillGasPrice:l,fillGasLimit:c}),d=bf(u,bi,{transactionSchema:a.config.customTransactionSchema});return IPt(d,void 0,{transactionSchema:a.config.customTransactionSchema}),l5.fromTxData(FPt(d),OPt(d,a))}),jbe=({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(ai(n==null?void 0:n.fromBlock)||(l.fromBlock=qr(pL.properties.number,n==null?void 0:n.fromBlock,{number:ap.HEX,bytes:S1.HEX})),ai(n==null?void 0:n.toBlock)||(l.toBlock=qr(pL.properties.number,n==null?void 0:n.toBlock,{number:ap.HEX,bytes:S1.HEX})),a&&Array.isArray(a))l.topics=[...a];else if(l.topics=[],e&&!e.anonymous&&![RN,"allEvents"].includes(e.name)&&l.topics.push((s=e.signature)!==null&&s!==void 0?s:cce(s1(e))),![RN,"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=>ane(c.type,d))):c.type==="string"?l.topics.push(TN(u)):l.topics.push(ane(c.type,u))}return l.topics.length||delete l.topics,t&&(l.address=t.toLowerCase()),l},F9=(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=yU(Array.isArray(t.inputs)?t.inputs:[],e).replace("0x",""):s=GIt(e).replace("0x",""),mIt(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`${_E(t)}${s}`};class CLe extends HT{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 hce(this.abi,e,this.jsonInterface,super.returnFormat)}}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));const wU=(t,e,n,r)=>{var s,a;const o={};return(!ai(t.data)||r==="both")&&(o.data=F9(e,n,(s=t.data)!==null&&s!==void 0?s:t.input)),(!ai(t.input)||r==="both")&&(o.input=F9(e,n,(a=t.input)!==null&&a!==void 0?a:t.data)),ai(o.input)&&ai(o.data)&&(o[r]=F9(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=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const u=wU(c,t,e,n==null?void 0:n.dataInputFill);return c=Object.assign(Object.assign({},c),{data:u.data,input:u.input}),c},RPt=({abi:t,params:e,options:n,contractOptions:r})=>{if(!(n!=null&&n.to)&&!r.address)throw new vd("Contract address not specified");let s=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const a=wU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},LPt=({abi:t,params:e,options:n,contractOptions:r})=>{let s=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,data:r.data},n);const a=wU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},Abe=t=>typeof t=="object"&&!ai(t)&&Object.keys(t).length!==0&&!_y(t),DPt=({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=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const a=wU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s};var BPt=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 $Pt{_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 gr(this.parent.getTransactionMiddleware())?EE(this.parent,e,this.parent.defaultReturnFormat,n):EE(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=qr({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=qr({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 BPt(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 F9(this.constructorAbi,this.args,qr({format:"bytes"},this.deployData,this.parent.defaultReturnFormat))}decodeData(e){return Object.assign(Object.assign({},one(this.constructorAbi,e.replace(this.deployData,""),!1)),{__method__:this.constructorAbi.type})}}var UPt=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 zPt extends uL{constructor(e,n){super(e.requestManager,e.registeredSubscriptions),this.parentContract=n}subscribe(e,n){const r=Object.create(null,{subscribe:{get:()=>super.subscribe}});return UPt(this,arguments,void 0,function*(s,a,o=yd){return r.subscribe.call(this,s,a??this.parentContract.options,o)})}}var _v=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 HPt={logs:CLe,newHeads:bL,newBlockHeaders:bL};class S3 extends of{get subscriptionManager(){return this._subscriptionManager}constructor(e,n,r,s,a){var o,l,c;const u=_y(n)?n:_y(r)?r:void 0;let d;Abe(n)?d=n:Abe(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=S3.givenProvider,super(Object.assign(Object.assign({},d),{provider:f,registeredSubscriptions:HPt})),this.syncWithContext=!1,this._functions={},this._subscriptionManager=new zPt(super.subscriptionManager,this),d!=null&&d.wallet&&(this._wallet=d.wallet),d!=null&&d.accountProvider&&(this._accountProvider=d.accountProvider),!gr(u)&&!gr(u.data)&&!gr(u.input)&&this.config.contractDataInputFill!=="both")throw new dAt({data:u.data,input:u.input});this._overloadedMethodAbis=new Map;const x=Cg(s)?s:Cg(r)?r:a??this.defaultReturnFormat,g=typeof n=="string"?n:void 0;this.config.contractDataInputFill=(o=u==null?void 0:u.dataInputFill)!==null&&o!==void 0?o:this.config.contractDataInputFill,this._parseAndSetJsonInterface(e,x),this.defaultReturnFormat!==x&&(this.defaultReturnFormat=x),gr(g)||this._parseAndSetAddress(g,x),this.options={address:g,jsonInterface:this._jsonInterface,gas:(l=u==null?void 0:u.gas)!==null&&l!==void 0?l:u==null?void 0:u.gasLimit,gasPrice:u==null?void 0:u.gasPrice,from:u==null?void 0:u.from,input:u==null?void 0:u.input,data:u==null?void 0:u.data},this.syncWithContext=(c=u==null?void 0:u.syncWithContext)!==null&&c!==void 0?c:!1,d instanceof 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(a5.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 S3([...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 S3([...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 $Pt(this,e)}getPastEvents(e,n,r){return _v(this,void 0,void 0,function*(){var s;const a=typeof e=="string"?e:RN,o=typeof e!="string"&&!Cg(e)?e:Cg(n)?{}:n,l=Cg(e)?e:Cg(n)?n:r??this.defaultReturnFormat,c=a==="allEvents"||a===RN?Jte:this._jsonInterface.find(N=>"name"in N&&N.name===a);if(!c)throw new vd(`Event ${String(a)} not found.`);const{fromBlock:u,toBlock:d,topics:f,address:x}=jbe(this.options,c,o??{}),g=yield gLe(this,{fromBlock:u,toBlock:d,topics:f,address:x},l),y=g?g.map(N=>typeof N=="string"?N:hce(c,N,this._jsonInterface,l)):[],v=(s=o==null?void 0:o.filter)!==null&&s!==void 0?s:{},C=Object.keys(v);return C.length>0?y.filter(N=>typeof N=="string"?!0:C.every(I=>{var P;if(Array.isArray(v[I]))return v[I].some(F=>String(N.returnValues[I]).toUpperCase()===String(F).toUpperCase());const M=(P=c.inputs)===null||P===void 0?void 0:P.filter(F=>F.name===I)[0];return M!=null&&M.indexed&&M.type==="string"&&TN(v[I])===String(N.returnValues[I])?!0:String(N.returnValues[I]).toUpperCase()===String(v[I]).toUpperCase()})):y})}_parseAndSetAddress(e,n=this.defaultReturnFormat){this._address=e&&wx(qr({format:"address"},e,n))}decodeMethodData(e){const n=e.slice(0,10),s=this._jsonInterface.filter(a=>a.type!=="error").find(a=>n===_E(s1(a)));if(!s)throw new vd(`The ABI for the provided method signature ${n} was not found.`);return one(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=>gU(c));for(const c of o){const u=Object.assign(Object.assign({},c),{signature:""});if(bU(u)){const d=s1(u),f=_E(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(lce(u)){const d=s1(u),f=cce(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(Jte,n),this._jsonInterface=[...a],this._errorsInterface=l}_getAbiParams(e,n){var r;try{return P9((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),Xs.validate((c=s.inputs)!==null&&c!==void 0?c:[],u);else{const v=[],C=[];for(const N of g)try{u=this._getAbiParams(N,a),Xs.validate(N.inputs,u),C.push(N)}catch(I){v.push(I)}if(C.length===1?[f]=C:C.length>1&&([f]=C,console.warn(`Multiple methods found that is compatible with the given inputs.
Found ${C.length} compatible methods: ${JSON.stringify(C.map(N=>`${N.methodNameWithInputs} (signature: ${N.signature})`))}
The first one will be used: ${f.methodNameWithInputs}`)),v.length===g.length)throw new _N(v)}const y={arguments:u,call:(v,C)=>_v(this,void 0,void 0,function*(){return this._contractMethodCall(f,u,x,v,C)}),send:v=>this._contractMethodSend(f,u,x,v),populateTransaction:(v,C)=>{var N,I;let P=C??this.options;P=Object.assign(Object.assign({},P),{input:void 0,from:(I=(N=P==null?void 0:P.from)!==null&&N!==void 0?N:this.defaultAccount)!==null&&I!==void 0?I:void 0});const M=cne({abi:s,params:a,options:Object.assign(Object.assign({},v),{dataInputFill:this.config.contractDataInputFill}),contractOptions:P});return M.dataInputFill&&delete M.dataInputFill,M},estimateGas:(v,...C)=>_v(this,[v,...C],void 0,function*(N,I=this.defaultReturnFormat){return this.contractMethodEstimateGas({abi:f,params:u,returnFormat:I,options:N})}),encodeABI:()=>F9(f,u),decodeData:v=>one(f,v),createAccessList:(v,C)=>_v(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 _v(this,void 0,void 0,function*(){var o;const l=RPt({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 xce(this,l,a,this.defaultReturnFormat);return YIt(e,c)}catch(c){throw c instanceof b3&&hM(r,c.cause),c}})}_contractMethodCreateAccessList(e,n,r,s,a){return _v(this,void 0,void 0,function*(){var o;const l=DPt({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 yLe(this,l,a,this.defaultReturnFormat)}catch(c){throw c instanceof b3&&hM(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=gr(this.transactionMiddleware)?EE(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface}):EE(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface},this.transactionMiddleware);return d.on("error",f=>{f instanceof b3&&hM(r,f.cause)}),d}contractMethodEstimateGas(e){return _v(this,arguments,void 0,function*({abi:n,params:r,returnFormat:s,options:a,contractOptions:o}){const l=LPt({abi:n,params:r,options:Object.assign(Object.assign({},a),{dataInputFill:this.config.contractDataInputFill}),contractOptions:o??this.options});return gce(this,l,Bg.LATEST,s??this.defaultReturnFormat)})}_createContractEvent(e,n=this.defaultReturnFormat){return(...r)=>{var s;const{topics:a,fromBlock:o}=jbe(this.options,e,r[0]),l=new CLe({address:this.options.address,topics:a,abi:e,jsonInterface:this._jsonInterface},{subscriptionManager:this.subscriptionManager,returnFormat:n});return gr(o)||this.getPastEvents(e.name,{fromBlock:o,topics:a},n).then(c=>{c&&c.forEach(u=>l.emit("data",u))}).catch(c=>{l.emit("error",new gg("Failed to get past events.",c))}),(s=this.subscriptionManager)===null||s===void 0||s.addSubscription(l).catch(c=>{l.emit("error",new gg("Failed to subscribe.",c))}),l}}subscribeToContextEvents(e){const n=this;this.context=e,n.syncWithContext&&e.on(a5.CONFIG_CHANGE,r=>{n.setConfig({[r.name]:r.newValue})})}}const _be={addr:"0x3b3b57de",name:"0x691f3431",abi:"0x2203ab56",pubkey:"0xc8690233",text:"0x59d1d43c",contenthash:"0xbc1c58d1"},hC={setAddr:"addr",addr:"addr",setPubkey:"pubkey",pubkey:"pubkey",setContenthash:"contenthash",contenthash:"contenthash",text:"text",name:"name"},yL={main:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",goerli:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},VPt={"0x1":"main","0x5":"goerli"},WPt=[{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"}],qPt=[{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 GPt="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 Ebe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),kbe=4;function KPt(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],I=0,P=x;for(;;){let F=Math.floor(((C-I+1)*s-1)/P),$=0,L=r;for(;L-$>1;){let se=$+L>>>1;F<a[se]?L=se:$=se}if($==0)break;N.push($);let z=I+Math.floor(P*a[$]/s),Q=I+Math.floor(P*a[$+1]/s)-1;for(;!((z^Q)&g);)C=C<<1&v|d(),z=z<<1&v,Q=Q<<1&v|1;for(;z&~Q&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,Q=(Q^g)<<1|g|1;I=z,P=1+Q-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function YPt(t){let e=0;return()=>t[e++]}function SLe(t){return YPt(KPt(XPt(t)))}function XPt(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 QPt(t){return t&1?~t>>1:t>>1}function ZPt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=QPt(e());return n}function kE(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 NLe(t){return TE(()=>{let e=kE(t);if(e.length)return e})}function jLe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(JPt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(eFt(n,t))}return e.flat()}function TE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function ALe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)ZPt(t,n).forEach((a,o)=>r[o].push(a));return r}function JPt(t,e){let n=1+e(),r=e(),s=TE(e);return ALe(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 eFt(t,e){let n=1+e();return ALe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function tFt(t){let e=[],n=kE(t);return s(r([]),[]),e;function r(a){let o=t(),l=TE(()=>{let c=kE(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 nFt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function _Le(t){return`{${nFt(t)}}`}function rFt(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function DN(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function 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 iFt="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 IE=44032,vL=4352,wL=4449,CL=4519,ELe=19,kLe=21,BN=28,SL=kLe*BN,aFt=ELe*SL,oFt=IE+aFt,lFt=vL+ELe,cFt=wL+kLe,uFt=CL+BN;function n9(t){return t>>24&255}function TLe(t){return t&16777215}let une,Tbe,dne,pM;function dFt(){let t=SLe(iFt);une=new Map(NLe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),Tbe=new Set(kE(t)),dne=new Map,pM=new Map;for(let[e,n]of jLe(t)){if(!Tbe.has(e)&&n.length==2){let[r,s]=n,a=pM.get(r);a||(a=new Map,pM.set(r,a)),a.set(s,e)}dne.set(e,n.reverse())}}function ILe(t){return t>=IE&&t<oFt}function fFt(t,e){if(t>=vL&&t<lFt&&e>=wL&&e<cFt)return IE+(t-vL)*SL+(e-wL)*BN;if(ILe(t)&&e>CL&&e<uFt&&(t-IE)%BN==0)return t+(e-CL);{let n=pM.get(t);return n&&(n=n.get(e),n)?n:-1}}function PLe(t){une||dFt();let e=[],n=[],r=!1;function s(a){let o=une.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(ILe(a)){let o=a-IE,l=o/SL|0,c=o%SL/BN|0,u=o%BN;s(vL+l),s(wL+c),u>0&&s(CL+u)}else{let o=dne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=n9(e[0]);for(let o=1;o<e.length;o++){let l=n9(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=n9(e[--c]),a<=l))break}a=n9(e[o])}}return e}function hFt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=n9(a),l=TLe(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=fFt(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 FLe(t){return PLe(t).map(TLe)}function pFt(t){return hFt(PLe(t))}const Ibe=45,OLe=".",MLe=65039,RLe=1,NL=t=>Array.from(t);function PE(t,e){return t.P.has(e)||t.Q.has(e)}let mFt=class extends Array{get is_emoji(){return!0}},fne,LLe,yw,hne,DLe,O4,FW,KC,qv,Pbe,pne;function bce(){if(fne)return;let t=SLe(GPt);const e=()=>kE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));fne=new Map(jLe(t)),LLe=n(),yw=e(),hne=new Set(e().map(d=>yw[d])),yw=new Set(yw),DLe=n(),n();let s=NLe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};O4=TE(d=>{let f=TE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=DN(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),FW=n(),KC=new Map;let l=e().concat(NL(FW)).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),FW.has(d)||KC.set(d,g)});for(let{V:d,M:f}of new Set(KC.values())){let x=[];for(let y of d){let v=O4.filter(N=>PE(N,y)),C=x.find(({G:N})=>v.some(I=>N.has(I)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>NL(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}qv=new Set;let c=new Set;const u=d=>qv.has(d)?c.add(d):qv.add(d);for(let d of O4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of qv)!KC.has(d)&&!c.has(d)&&KC.set(d,RLe);r(qv,FLe(qv)),Pbe=tFt(t).map(d=>mFt.from(d)).sort(sFt),pne=new Map;for(let d of Pbe){let f=[pne];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===MLe?f.push(...g):f=g}for(let x of f)x.V=d}}function yce(t){return(BLe(t)?"":`${vce(CU([t]))} `)+_Le(t)}function vce(t){return`"${t}"`}function xFt(t){if(t.length>=4&&t[2]==Ibe&&t[3]==Ibe)throw new Error(`invalid label extension: "${DN(t.slice(0,4))}"`)}function gFt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function bFt(t){let e=t[0],n=Ebe.get(e);if(n)throw O9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=Ebe.get(e);if(o){if(s==a)throw O9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw O9(`trailing ${n}`)}function CU(t,e=1/0,n=_Le){let r=[];yFt(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];BLe(l)&&(r.push(DN(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(DN(t.slice(s,a))),r.join("")}function yFt(t,e){return bce(),yw.has(t)}function BLe(t){return bce(),DLe.has(t)}function vFt(t){return NFt(wFt(t,pFt,_Ft))}function wFt(t,e,n){if(!t)return[];bce();let r=0;return t.split(OLe).map(s=>{let a=rFt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=AFt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(gFt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))xFt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(yw.has(d[0]))throw O9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&yw.has(C[0]))throw O9(`emoji + combining mark: "${DN(l[v-1])} + ${CU([C[0]])}"`)}bFt(d);let g=NL(new Set(x)),[y]=SFt(g);jFt(y,x),CFt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function CFt(t,e){let n,r=[];for(let s of e){let a=KC.get(s);if(a===RLe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):NL(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>PE(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function SFt(t){let e=O4;for(let n of t){let r=e.filter(s=>PE(s,n));if(!r.length)throw O4.some(s=>PE(s,n))?ULe(e[0],n):$Le(n);if(e=r,r.length==1)break}return e}function NFt(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(CU(e,63))}: ${s}`)}return DN(r)}).join(OLe)}function $Le(t){return new Error(`disallowed character: ${yce(t)}`)}function ULe(t,e){let n=yce(e),r=O4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function O9(t){return new Error(`illegal placement: ${t}`)}function jFt(t,e){for(let n of e)if(!PE(t,n))throw ULe(t,n);if(t.M){let n=FLe(e);for(let r=1,s=n.length;r<s;r++)if(hne.has(n[r])){let a=r+1;for(let o;a<s&&hne.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${yce(o)}`);if(a-r>kbe)throw new Error(`excessive non-spacing marks: ${vce(CU(n.slice(r-1,a)))} (${a-r}/${kbe})`);r=a}}}function AFt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=EFt(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=fne.get(o);if(l)s.push(...l);else if(!LLe.has(o))throw $Le(o)}}}return s.length&&r.push(e(s)),r}function _Ft(t){return t.filter(e=>e!=MLe)}function EFt(t,e){let n=pne,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 kFt=t=>vFt(t),k0=t=>{let e="";for(let n=0;n<32;n+=1)e+="00";if(t){const r=kFt(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 nF=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 TFt{constructor(e,n){this.contract=new S3(WPt,n??yL.main,e),this.context=e}getOwner(e){return nF(this,void 0,void 0,function*(){try{return this.contract.methods.owner(k0(e)).call()}catch{throw new Error}})}getTTL(e){return nF(this,void 0,void 0,function*(){try{return this.contract.methods.ttl(k0(e)).call()}catch{throw new Error}})}recordExists(e){return nF(this,void 0,void 0,function*(){try{return this.contract.methods.recordExists(k0(e)).call()}catch{throw new Error}})}getResolver(e){return nF(this,void 0,void 0,function*(){try{return this.contract.methods.resolver(k0(e)).call().then(n=>{if(typeof n=="string")return new S3(qPt,n,this.context);throw new Error})}catch{throw new Error}})}get events(){return this.contract.events}}var Zx=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class IFt{constructor(e){this.registry=e}getResolverContractAdapter(e){return Zx(this,void 0,void 0,function*(){return this.registry.getResolver(e)})}checkInterfaceSupport(e,n){var r,s;return Zx(this,void 0,void 0,function*(){if(ai(_be[n]))throw new j1e((r=e.options.address)!==null&&r!==void 0?r:"",n);if(!(yield e.methods.supportsInterface(_be[n]).call()))throw new j1e((s=e.options.address)!==null&&s!==void 0?s:"",n)})}supportsInterface(e,n){var r;return Zx(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);let a=n;if(!Ea(a)){if(a=(r=zT(n))!==null&&r!==void 0?r:"",n==="")throw new Error("Invalid interface Id");a=a.slice(0,10)}return s.methods.supportsInterface(a).call()})}getAddress(e,n=60){return Zx(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,hC.addr),r.methods.addr(k0(e),n).call()})}getPubkey(e){return Zx(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,hC.pubkey),n.methods.pubkey(k0(e)).call()})}getContenthash(e){return Zx(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,hC.contenthash),n.methods.contenthash(k0(e)).call()})}setAddress(e,n,r){return Zx(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(s,hC.setAddr),s.methods.setAddr(k0(e),n).send(r)})}getText(e,n){return Zx(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,hC.text),r.methods.text(k0(e),n).call()})}getName(e,n=!0){return Zx(this,void 0,void 0,function*(){const r=`${e.toLowerCase().substring(2)}.addr.reverse`,s=yield this.getResolverContractAdapter(r);return n&&(yield this.checkInterfaceSupport(s,hC.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 zLe extends of{constructor(e,n){super(n??""),this.registryAddress=e??yL.main,this._registry=new TFt(this.getContextObject(),e),this._resolver=new IFt(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 nPt(this);if(!(typeof s=="boolean"&&!s))throw new hAt;this._lastSyncCheck=e}if(this._detectedAddress)return this._detectedAddress;const n=yield ice(this,Object.assign(Object.assign({},this.defaultReturnFormat),{number:ap.HEX})),r=yL[VPt[n]];if(typeof r>"u")throw new fAt(n);return this._detectedAddress=r,this._detectedAddress})}supportsInterface(e,n){return Th(this,void 0,void 0,function*(){return this._resolver.supportsInterface(e,n)})}get events(){return this._registry.events}setAddress(e,n,r){return Th(this,void 0,void 0,function*(){return this._resolver.setAddress(e,n,r)})}}var $1=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const PFt=t=>$1(void 0,void 0,void 0,function*(){return(yield RTt(t)).map(wx)}),FFt=(t,e)=>$1(void 0,void 0,void 0,function*(){Xs.validate(["string"],[e]);const n=yield LTt(t,e);return wx(n)}),OFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){return Xs.validate(["address","string","uint"],[e,n,r]),DTt(t,e,n,r)}),MFt=(t,e)=>$1(void 0,void 0,void 0,function*(){return Xs.validate(["address"],[e]),BTt(t,e)}),RFt=(t,e,n)=>$1(void 0,void 0,void 0,function*(){return Xs.validate(["string","string"],[e,n]),$Tt(t,e,n)}),LFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){const s=bf(e,bi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return UTt(t,s,n)}),DFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){const s=bf(e,bi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return zTt(t,s,n)}),BFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){Xs.validate(["string","address","string"],[e,n,r]);const s=Ea(e)?e:km(e);return HTt(t,s,n,r)}),$Ft=(t,e,n)=>$1(void 0,void 0,void 0,function*(){Xs.validate(["string","string"],[e,n]);const r=Ea(e)?e:km(e);return VTt(t,r,n)});var Jx=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class HLe extends of{getAccounts(){return Jx(this,void 0,void 0,function*(){return PFt(this.requestManager)})}newAccount(e){return Jx(this,void 0,void 0,function*(){return FFt(this.requestManager,e)})}unlockAccount(e,n,r){return Jx(this,void 0,void 0,function*(){return OFt(this.requestManager,e,n,r)})}lockAccount(e){return Jx(this,void 0,void 0,function*(){return MFt(this.requestManager,e)})}importRawKey(e,n){return Jx(this,void 0,void 0,function*(){return RFt(this.requestManager,e,n)})}sendTransaction(e,n){return Jx(this,void 0,void 0,function*(){return LFt(this.requestManager,e,n,this.config)})}signTransaction(e,n){return Jx(this,void 0,void 0,function*(){return DFt(this.requestManager,e,n,this.config)})}sign(e,n,r){return Jx(this,void 0,void 0,function*(){return BFt(this.requestManager,e,n,r)})}ecRecover(e,n){return Jx(this,void 0,void 0,function*(){return $Ft(this.requestManager,e,n)})}}var O0;(function(t){t.HTTPS="https",t.WebSocket="wss"})(O0||(O0={}));var ws;(function(t){t.ETH_MAINNET="eth_mainnet",t.ETH_SEPOLIA="eth_sepolia",t.ETH_HOLESKY="eth_holesky",t.POLYGON_MAINNET="polygon_mainnet",t.POLYGON_AMOY="polygon_amoy",t.AVALANCHE_C_MAINNET="avalanche_c_mainnet",t.AVALANCHE_P_MAINNET="avalanche_p_mainnet",t.AVALANCHE_X_MAINNET="avalanche_x_mainnet",t.ARBITRUM_MAINNET="arbitrum_mainnet",t.ARBITRUM_SEPOLIA="arbitrum_sepolia",t.BASE_MAINNET="base_mainnet",t.BASE_SEPOLIA="base_sepolia",t.OPTIMISM_MAINNET="optimism_mainnet",t.OPTIMISM_SEPOLIA="optimism_sepolia",t.FANTOM_MAINNET="fantom_mainnet",t.FANTOM_TESTNET="fantom_testnet",t.DYMENSION_MAINNET="dymension_mainnet",t.DYMENSION_TESTNET="dymension_testnet",t.BNB_MAINNET="bnb_mainnet",t.BNB_TESTNET="bnb_testnet",t.BSC_MAINNET="bsc_mainnet",t.BSC_TESTNET="bsc_testnet",t.ARBITRUM_ONE="arbitrum_one",t.ARBITRUM_NOVA="arbitrum_nova",t.AVALANCHE_FUJI_C="avalanche_fuji_c",t.AVALANCHE_FUJI_P="avalanche_fuji_p",t.AVALANCHE_FUJI_X="avalanche_fuji_x",t.BLAST_MAINNET="blast_mainnet",t.OPBNB_MAINNET="opbnb_mainnet",t.OPBNB_TESTNET="opbnb_testnet",t.GNOSIS_MAINNET="gnosis_mainnet",t.GNOSIS_CHIADO="gnosis_chiado",t.PULSECHAIN_MAINNET="pulsechain_mainnet",t.PULSECHAIN_TESTNET="pulsechain_testnet",t.KAVA_MAINNET="kava_mainnet",t.CRONOS_MAINNET="cronos_mainnet",t.MANTLE_MAINNET="mantle_mainnet",t.CHILIZ_MAINNET="chiliz_mainnet",t.CHILIZ_SPICY="chiliz_spicy",t.MOONBEAM_MAINNET="moonbeam_mainnet",t.TAIKO_MAINNET="taiko_mainnet",t.TAIKO_HEKLA="taiko_hekla",t.LINEA_MAINNET="linea_mainnet",t.LINEA_SEPOLIA="linea_sepolia",t.BAHAMUT_MAINNET="bahamut_mainnet",t.SCROLL_MAINNET="scroll_mainnet",t.SCROLL_SEPOLIA="scroll_sepolia",t.TRON_MAINNET="tron_mainnet",t.SYSCOIN_MAINNET="syscoin_mainnet",t.SYSCOIN_TANENBAUM="syscoin_tanenbaum",t.MOONRIVER_MAINNET="moonriver_mainnet",t.HAQQ_MAINNET="haqq_mainnet",t.EVMOS_MAINNET="evmos_mainnet",t.EVMOS_TESTNET="evmos_testnet",t.BERACHAIN_TESTNET="berachain_testnet"})(ws||(ws={}));const UFt=1300;class zFt 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=UFt}}const HFt=1301;class Fbe extends xi{constructor(e){super(`Invalid provider config options given for ${e}`),this.code=HFt}}var VFt=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 VLe extends Hle{constructor(e,n,r,s,a){if(super(),a!==void 0&&n===O0.HTTPS&&!("providerOptions"in a))throw new Fbe("HTTP Provider");if(a!==void 0&&n===O0.WebSocket&&!("socketOptions"in a||"reconnectOptions"in a))throw new Fbe("Websocket Provider");this.transport=n,n===O0.HTTPS?this.provider=new dU(this.getRPCURL(e,n,r,s),a):n===O0.WebSocket&&(this.provider=new nRe(this.getRPCURL(e,n,r,s),a==null?void 0:a.socketOptions,a==null?void 0:a.reconnectOptions))}request(e,n){return VFt(this,void 0,void 0,function*(){return this.transport===O0.HTTPS?yield this.provider.request(e,n):this.provider.request(e)})}getStatus(){return this.provider.getStatus()}supportsSubscriptions(){return this.provider.supportsSubscriptions()}once(e,n){var r;!((r=this.provider)===null||r===void 0)&&r.once&&this.provider.once(e,n)}removeAllListeners(e){var n;!((n=this.provider)===null||n===void 0)&&n.removeAllListeners&&this.provider.removeAllListeners(e)}connect(){var e;!((e=this.provider)===null||e===void 0)&&e.connect&&this.provider.connect()}disconnect(e,n){var r;!((r=this.provider)===null||r===void 0)&&r.disconnect&&this.provider.disconnect(e,n)}reset(){var e;!((e=this.provider)===null||e===void 0)&&e.reset&&this.provider.reset()}on(e,n){this.provider&&this.provider.on(e,n)}removeListener(e,n){this.provider&&this.provider.removeListener(e,n)}}var WFt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const Nc=t=>t!==void 0&&t.trim().length>0;class qFt extends VLe{constructor(e=ws.ETH_MAINNET,n=O0.HTTPS,r="",s="",a){super(e,n,r,s,a)}request(e,n){const r=Object.create(null,{request:{get:()=>super.request}});return WFt(this,void 0,void 0,function*(){try{return yield r.request.call(this,e,n)}catch(s){throw s instanceof P0&&s.statusCode===429?new zFt(s):s}})}getRPCURL(e,n,r,s){let a="",o="";switch(e){case ws.ETH_MAINNET:a=Nc(s)?s:"powerful-holy-bush.quiknode.pro",o=Nc(r)?r:"3240624a343867035925ff7561eb60dfdba2a668";break;case ws.ETH_SEPOLIA:a=Nc(s)?s:"dimensional-fabled-glitter.ethereum-sepolia.quiknode.pro",o=Nc(r)?r:"382a3b5a4b938f2d6e8686c19af4b22921fde2cd";break;case ws.ETH_HOLESKY:a=Nc(s)?s:"yolo-morning-card.ethereum-holesky.quiknode.pro",o=Nc(r)?r:"481ebe70638c4dcf176af617a16d02ab866b9af9";break;case ws.ARBITRUM_MAINNET:a=Nc(s)?s:"autumn-divine-dinghy.arbitrum-mainnet.quiknode.pro",o=Nc(r)?r:"a5d7bfbf60b5ae9ce3628e53d69ef50d529e9a8c";break;case ws.ARBITRUM_SEPOLIA:a=Nc(s)?s:"few-patient-pond.arbitrum-sepolia.quiknode.pro",o=Nc(r)?r:"3be985450970628c860b959c65cd2642dcafe53c";break;case ws.BNB_MAINNET:a=Nc(s)?s:"purple-empty-reel.bsc.quiknode.pro",o=Nc(r)?r:"ebf6c532961e21f092ff2facce1ec4c89c540158";break;case ws.BNB_TESTNET:a=Nc(s)?s:"floral-rough-scion.bsc-testnet.quiknode.pro",o=Nc(r)?r:"5b297e5acff5f81f4c37ebf6f235f7299b6f9d28";break;case ws.POLYGON_MAINNET:a=Nc(s)?s:"small-chaotic-moon.matic.quiknode.pro",o=Nc(r)?r:"847569f8a017e84d985e10d0f44365d965a951f1";break;case ws.POLYGON_AMOY:a=Nc(s)?s:"prettiest-side-shape.matic-amoy.quiknode.pro",o=Nc(r)?r:"79a9476eea661d4f82de614db1d8a895b14b881c";break;default:throw new Error("Network info not avalible.")}return`${n}://${a}/${o}`}}const GFt=t=>t!==void 0&&t.trim().length>0,KFt=[ws.DYMENSION_MAINNET,ws.DYMENSION_TESTNET,ws.KAVA_MAINNET,ws.CRONOS_MAINNET,ws.POLYGON_MAINNET];class jL extends VLe{constructor(e=ws.ETH_MAINNET,n=O0.HTTPS,r="",s){super(e,n,"",r,s)}getRPCURL(e,n,r,s){if(!jL.networkHostMap[e])throw new Error("Network info not avalible.");const a=`${jL.networkHostMap[e]}.publicnode.com`,o=GFt(s)?s:a;return KFt.includes(e)&&n===O0.WebSocket?`${n}://${o}/websocket`:`${n}://${o}`}}jL.networkHostMap={[ws.POLYGON_AMOY]:"polygon-amoy-bor-rpc",[ws.DYMENSION_MAINNET]:"dymension-evm-rpc",[ws.DYMENSION_TESTNET]:"dymension-testnet-evm-rpc",[ws.BLAST_MAINNET]:"blast-rpc",[ws.GNOSIS_MAINNET]:"gnosis-rpc",[ws.PULSECHAIN_MAINNET]:"pulsechain-rpc",[ws.PULSECHAIN_TESTNET]:"pulsechain-testnet-rpc",[ws.KAVA_MAINNET]:"kava-evm-rpc",[ws.CRONOS_MAINNET]:"cronos-evm-rpc",[ws.MANTLE_MAINNET]:"mantle-rpc",[ws.TAIKO_MAINNET]:"taiko-rpc",[ws.TAIKO_HEKLA]:"taiko-hekla-rpc",[ws.LINEA_MAINNET]:"linea-rpc",[ws.LINEA_SEPOLIA]:"linea-sepolia-rpc",[ws.SCROLL_MAINNET]:"scroll-rpc",[ws.SCROLL_SEPOLIA]:"scroll-sepolia-rpc",[ws.SYSCOIN_MAINNET]:"syscoin-evm-rpc",[ws.SYSCOIN_TANENBAUM]:"syscoin-tanenbaum-evm-rpc",[ws.HAQQ_MAINNET]:"haqq-evm-rpc",[ws.EVMOS_MAINNET]:"evmos-evm-rpc",[ws.EVMOS_TESTNET]:"evmos-testnet-evm-rpc",[ws.BERACHAIN_TESTNET]:"berachain-testnet-evm-rpc",[ws.ETH_MAINNET]:"ethereum-rpc",[ws.ETH_SEPOLIA]:"ethereum-sepolia-rpc",[ws.ETH_HOLESKY]:"ethereum-holesky-rpc",[ws.BSC_MAINNET]:"bsc-rpc",[ws.BSC_TESTNET]:"bsc-testnet-rpc",[ws.POLYGON_MAINNET]:"polygon-bor-rpc",[ws.BASE_MAINNET]:"base-rpc",[ws.BASE_SEPOLIA]:"base-sepolia-rpc",[ws.ARBITRUM_ONE]:"arbitrum-one-rpc",[ws.ARBITRUM_NOVA]:"arbitrum-nova-rpc",[ws.ARBITRUM_SEPOLIA]:"arbitrum-sepolia-rpc",[ws.AVALANCHE_C_MAINNET]:"avalanche-c-chain-rpc",[ws.AVALANCHE_P_MAINNET]:"avalanche-p-chain-rpc",[ws.AVALANCHE_X_MAINNET]:"avalanche-x-chain-rpc",[ws.AVALANCHE_FUJI_C]:"avalanche-fuji-c-chain-rpc",[ws.AVALANCHE_FUJI_P]:"avalanche-fuji-p-chain-rpc",[ws.AVALANCHE_FUJI_X]:"avalanche-fuji-x-chain-rpc",[ws.OPTIMISM_MAINNET]:"optimism-rpc",[ws.OPTIMISM_SEPOLIA]:"optimism-sepolia-rpc",[ws.FANTOM_MAINNET]:"fantom-rpc",[ws.FANTOM_TESTNET]:"fantom-testnet-rpc",[ws.OPBNB_MAINNET]:"opbnb-rpc",[ws.OPBNB_TESTNET]:"opbnb-testnet-rpc",[ws.GNOSIS_CHIADO]:"gnosis-chiado-rpc",[ws.CHILIZ_MAINNET]:"chiliz-rpc",[ws.CHILIZ_SPICY]:"chiliz-spicy-rpc",[ws.MOONBEAM_MAINNET]:"moonbeam-rpc",[ws.BAHAMUT_MAINNET]:"bahamut-rpc",[ws.TRON_MAINNET]:"tron-evm-rpc",[ws.MOONRIVER_MAINNET]:"moonriver-rpc"};const YFt=new qFt,XFt={encodeEventSignature:cce,encodeFunctionCall:KIt,encodeFunctionSignature:_E,encodeParameter:ane,encodeParameters:yU,decodeParameter:uLe,decodeParameters:C3,decodeLog:dLe};var a7=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const QFt=t=>{const e=(o,l)=>a7(void 0,void 0,void 0,function*(){const c=yield MPt(o,t),u=qr({format:"bytes"},l,bi);return Fkt(c,u)}),n=o=>{const l=tce(o);return Object.assign(Object.assign({},l),{signTransaction:c=>a7(void 0,void 0,void 0,function*(){return e(c,l.privateKey)})})},r=(o,l,c)=>a7(void 0,void 0,void 0,function*(){var u;const d=yield Lkt(o,l,(u=c==null?void 0:c.nonStrict)!==null&&u!==void 0?u:!0);return Object.assign(Object.assign({},d),{signTransaction:f=>a7(void 0,void 0,void 0,function*(){return e(f,d.privateKey)})})}),s=()=>{const o=Rkt();return Object.assign(Object.assign({},o),{signTransaction:l=>a7(void 0,void 0,void 0,function*(){return e(l,o.privateKey)})})},a=new dL({create:s,privateKeyToAccount:n,decrypt:r});return{signTransaction:e,create:s,privateKeyToAccount:n,decrypt:r,recoverTransaction:Okt,hashMessage:ece,sign:kRe,recover:Qte,encrypt:TRe,wallet:a,privateKeyToAddress:mU,parseAndValidatePrivateKey:h8,privateKeyToPublicKey:Mkt}},ZFt={version:"4.16.0"};var JFt=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())})},AL;(function(t){t.eip6963announceProvider="eip6963:announceProvider",t.eip6963requestProvider="eip6963:requestProvider"})(AL||(AL={}));const OW=new Map,WLe="web3:providersMapUpdated",eOt=()=>JFt(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(AL.eip6963announceProvider,n=>{OW.set(n.detail.info.uuid,n.detail);const r=new CustomEvent(WLe,{detail:OW});window.dispatchEvent(r),t(OW)}),window.dispatchEvent(new Event(AL.eip6963requestProvider))})}),tOt=t=>{if(typeof window>"u")throw new Error("window object not available, EIP-6963 is intended to be used within a browser");window.addEventListener(WLe,t)};class kl extends of{constructor(e=YFt){var n;(ai(e)||typeof e=="string"&&e.trim()===""||typeof e!="string"&&!cL(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"||cL(e)?r.provider=e:e?r=e:r={},r.registeredSubscriptions=Object.assign(Object.assign({},lne),(n=r.registeredSubscriptions)!==null&&n!==void 0?n:{}),super(r);const s=QFt(this);this._wallet=s.wallet,this._accountProvider=s,this.utils=tRe;const a=this;class o extends S3{constructor(u,d,f,x,g){if(_y(d)&&_y(f))throw new A1e("Should not provide options at both 2nd and 3rd parameters");let y,v={},C,N;if(!ai(d)&&typeof d!="object"&&typeof d!="string")throw new A1e;if(typeof d=="string"&&(y=d),_y(d)?v=d:_y(f)?v=f:v={},d instanceof of?C=d:f instanceof of?C=f:x instanceof of?C=x:C=a.getContextObject(),g?N=g:Cg(f)?N=f:Cg(x)&&(N=x),super(u,y,v,C,N),super.subscribeToContextEvents(a),!ai(l)){const I=l.getTransactionMiddleware();ai(I)||super.setTransactionMiddleware(I)}}}const l=a.use(vU);this.eth=Object.assign(l,{ens:a.use(zLe,yL.main),Iban:Bl,net:a.use(DRe),personal:a.use(HLe),Contract:o,abi:XFt,accounts:s})}}kl.version=ZFt.version;kl.utils=tRe;kl.requestEIP6963Providers=eOt;kl.onNewProviderDiscovered=tOt;kl.modules={Web3Eth:vU,Iban:Bl,Net:DRe,ENS:zLe,Personal:HLe};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),dn.success("TX Hash copied to clipboard!")}catch(f){console.error("Failed to copy: ",f),dn.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(Ca,{open:t,onClose:()=>{r||e(!1)},className:"relative z-[9001] font-inter",children:[i.jsx(wa,{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(xa,{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(Ba,{})}),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:Hl,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:__e,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:Hl,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(gN,{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(Ert,{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(Ba,{})}),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."})})]})]})})})})]})},qLe=[{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"}],nOt=qLe.reduce((t,e)=>(t[e.hash]=e.id,t),{}),T2=({current:t="",onCloseCurrent:e})=>{const n=Xl(),r=Ao(),s=t||nOt[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:qLe.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(Uj,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":""}`}):o.id==="basedapp"?i.jsx("img",{src:hct,alt:"BasedApp",className:"w-3.5 h-3.5"}):o.id==="lighter"?i.jsx(M0,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":"text-white"}`}):o.id==="apex"?i.jsx("img",{src:yae,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:uT,alt:"Variational",className:"w-3.5 h-3.5"}):o.id==="paradex"?i.jsx("img",{src:dT,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 wce({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,N]=h.useState(""),[I,P]=h.useState(2),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState(!1),[se,ee]=h.useState(!1),[K,re]=h.useState(!1),[de,G]=h.useState(""),[ie,ae]=h.useState(""),[q,W]=h.useState(!1),[ne,oe]=h.useState(!1),[he,_e]=h.useState(null),[xe,Se]=h.useState(""),[ge,Ce]=h.useState(!1),[je,Oe]=h.useState(!1),[$e,Ye]=h.useState(null),[Je,ht]=h.useState(!1),[rt,st]=h.useState([]),[He,Ve]=h.useState(!1),[bt,xt]=h.useState(!1),[Qt,St]=h.useState(""),[on,cn]=h.useState(!0),{setSignModalOpen:Vn,setTelegramChatId:tn,setSubscriberRole:fn,setSubsExpireDay:rn,setMushboomerETH:nt,setMushboomerSOL:it,setIsReferralCode:Ut,setIsReferralCodeName:hn,setIsWhitelist:nn,setHyperToken:Vt,setHyperAddress:pt}=h.useContext(Yr),We="https://dextrabothypev2.nftinit.io",It="https://api.hyperliquid.xyz/info",Ge="0x1924b8561eef20e70ede628a296175d358be80e5",ct=["HYPE","ETH","BTC","SOL","USDT0","PUP"],vt="0.01",Ht=ke=>{switch(ke){case"BTC":return"UBTC";case"ETH":return"UETH";case"SOL":return"USOL";case"USDT0":return"USDT0";case"HYPE":default:return ke}},Rt=ke=>{if(ke==null||ke==="")return"0.00";const m=Number(ke);return Number.isNaN(m)?"0.00":m.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},mn=ke=>/^\d*\.?\d{0,6}$/.test(ke),un=ke=>/^\d*$/.test(ke),yn=ke=>{["e","E","+","-"].includes(ke.key)&&ke.preventDefault()},_n=h.useMemo(()=>{if(c==="")return!1;const ke=Number(c);return!Number.isNaN(ke)&&ke>=11},[c]);h.useMemo(()=>{if(d==="")return!1;const ke=Number(d);return!Number.isNaN(ke)&&ke>0},[d]);const In=h.useMemo(()=>{if(x==="")return!1;const ke=Number(x);return!Number.isNaN(ke)&&ke>=0&&ke<=100},[x]),Sn=h.useMemo(()=>{if(y==="")return!1;const ke=Number(y);return!Number.isNaN(ke)&&ke>=0&&ke<=100},[y]),Yn=h.useMemo(()=>{if(C==="")return!1;const ke=Number(C);return Number.isInteger(ke)&&ke>0&&ke<=180},[C]),Xn=h.useMemo(()=>n.map(ke=>{const m=(ke==null?void 0:ke.wallet_name)??(ke==null?void 0:ke.name)??(ke==null?void 0:ke.label)??String(ke==null?void 0:ke.wallet_id),p=(ke==null?void 0:ke.version)===3?`${m} - (API-AGENT) Wallet`:m;return{value:(ke==null?void 0:ke.wallet_id)??(ke==null?void 0:ke.id)??(ke==null?void 0:ke.value)??"",label:p,raw:ke}}),[n]),zn=h.useMemo(()=>{var ke;return(ke=Xn.find(m=>String(m.value)===String(s)))==null?void 0:ke.raw},[Xn,s]),Kn=h.useMemo(()=>{const ke=zn||{};return ke.address||ke.evm_address||ke.wallet_address||ke.public_address||ke.eth_address||ke.addr||null},[zn]),jn=(zn==null?void 0:zn.version)===3,De=!jn||$e>0,pe=h.useMemo(()=>{if(!o)return{coin:Ht(o),total:"0",entryNtl:"0"};const ke=Ht(o);return(rt||[]).find(p=>(p==null?void 0:p.coin)===ke)??{coin:ke,total:"0",entryNtl:"0"}},[o,rt]),qe=s!==""&&o!==""&&(I===1?Yn&&Sn:_n&&In)&&ge&&De&&on;h.useEffect(()=>{if(!t)return;const ke=localStorage.getItem("hyperToken"),m=localStorage.getItem("hyperAddress");Ce(!!(ke&&m));const p=setInterval(()=>{const S=localStorage.getItem("hyperToken"),A=localStorage.getItem("hyperAddress");Ce(!!(S&&A))},800);return()=>clearInterval(p)},[t]),h.useEffect(()=>{t&&(G(""),ge&>())},[t,ge]),h.useEffect(()=>{t&&(Kn?zt(Kn):(_e(null),Se(""),st([])))},[t,Kn]),h.useEffect(()=>{!t||!ge||(ze(),Fn())},[t,ge]),h.useEffect(()=>{t&&I===1&&!y&&v(vt)},[t,I]),h.useEffect(()=>{if(!t||!ge)return;const ke=zn||{},m=ke.address||ke.evm_address||ke.wallet_address||ke.public_address||ke.eth_address||ke.addr||null;(ke==null?void 0:ke.version)===3&&m&&Ae(m)},[t,ge,s,zn]);async function Ae(ke){try{Oe(!0),Ye(null);const p=await(await fetch(It,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"maxBuilderFee",user:ke,builder:Ge})})).json();Ye(Number(p))}catch{Ye(null)}finally{Oe(!1)}}async function ze(){var ke,m,p;try{L(!0);const S=window.localStorage.getItem("hyperToken"),A=window.localStorage.getItem("hyperAddress");if(!S||!A){W(!1);return}const T=await(await fetch(`${We}/api/hyper/farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:A.toLowerCase(),token:S})})).json();if(T!=null&&T.success&&((ke=T==null?void 0:T.data)!=null&&ke.farming_params)){W(!0),((m=T==null?void 0:T.data)==null?void 0:m.wallet_id)!==void 0&&((p=T==null?void 0:T.data)==null?void 0:p.wallet_id)!==null&&a(String(T.data.wallet_id));const D=T.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?(P(2),D.spread!==void 0&&D.spread!==null&&g(String(D.spread))):V===2?(P(1),D.spread!==void 0&&D.spread!==null?v(String(D.spread)):v(vt),D.orderPerHour!==void 0&&D.orderPerHour!==null&&N(String(D.orderPerHour))):P(2)}else W(!1)}catch{W(!1)}finally{L(!1)}}async function zt(ke){try{Se(""),oe(!0),_e(null);const p=await(await fetch(It,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:ke})})).json(),S=Array.isArray(p==null?void 0:p.balances)?p.balances:[];st(S);const A=S.find(k=>(k==null?void 0:k.coin)==="USDC");_e(A?A.total:"0")}catch(m){Se(m.message||"Failed to load USDC balance.")}finally{oe(!1)}}function kt(){const ke=Kn||window.localStorage.getItem("hyperAddress");ke&&zt(ke)}async function gt(){try{F(!0);const ke=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!ke||!m){Ce(!1),Vn(!0);return}const S=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:ke})})).json();S!=null&&S.success?r((S==null?void 0:S.data)||[]):G((S==null?void 0:S.error_message)||"Failed to load wallets.")}catch(ke){G(ke.message||"Wallet list error.")}finally{F(!1)}}async function Mt(){if(!ge){Vn(!0);return}if(qe)try{ee(!0),G("");const ke=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!ke||!m){Ce(!1),Vn(!0);return}const S=I===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:ke,wallet_id:Number(s),farming_params:S},T=await(await fetch(`${We}/api/hyper/farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})).json();T!=null&&T.success?W(!0):G((T==null?void 0:T.message)||"Start failed.")}catch(ke){G(ke.message||"An error occurred while saving.")}finally{ee(!1)}}async function ln(){if(!ge)return Vn(!0);if(s)try{re(!0),G("");const ke=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!ke||!m){Ce(!1),Vn(!0);return}const S=await(await fetch(`${We}/api/hyper/farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:m.toLowerCase(),token:ke,wallet_id:Number(s)})})).json();S!=null&&S.success?W(!1):G((S==null?void 0:S.error_message)||"Stop failed.")}catch(ke){G(ke.message||"An error occurred while stopping.")}finally{re(!1)}}const vn=32,Wn={control:(ke,m)=>({...ke,backgroundColor:"#242424",borderColor:m.isFocused?"#67FFBD":"#353535",minHeight:vn,height:vn,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:ke=>({...ke,height:vn,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:ke=>({...ke,height:vn}),input:ke=>({...ke,color:"#FFFFFF",margin:0,padding:0}),singleValue:ke=>({...ke,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:ke=>({...ke,color:"#7F7F7F",fontSize:"12px"}),menu:ke=>({...ke,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:ke=>({...ke,paddingTop:0,paddingBottom:0}),option:(ke,m)=>({...ke,backgroundColor:m.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:vn,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:ke=>({...ke,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:ke=>({...ke,backgroundColor:"#353535"})},On=ke=>{var m;return i.jsx(ma.Option,{...ke,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((m=ke.data)==null?void 0:m.icon)&&i.jsx("img",{src:ke.data.icon,alt:ke.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:ke.data.label})]})})},$t=ke=>{var m;return i.jsx(ma.SingleValue,{...ke,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((m=ke.data)==null?void 0:m.icon)&&i.jsx("img",{src:ke.data.icon,alt:ke.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:ke.data.label})]})})},Nn=h.useMemo(()=>ct.map(ke=>{let p=`https://app.hyperliquid.xyz/coins/${ke==="USDT0"?"USDT":ke}.svg`;return ke==="PUP"&&(p="https://www.basedapp.io/_next/image?url=%2Ftokens%2Fpng%2FPUP_USDC.png&w=32&q=75"),{value:ke,label:ke,icon:p}}),[]),Fn=async()=>{var p,S;const ke=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!(!ke||!m))try{Q(!0);const A=await vi(m.toLowerCase(),ke);A!=null&&A.success?(tn(A==null?void 0:A.telegram_chat_id),fn(A==null?void 0:A.subscriber_role),rn(A==null?void 0:A.subs_expire_day),nt((p=A==null?void 0:A.mushboomer_counts)==null?void 0:p.eth),it((S=A==null?void 0:A.mushboomer_counts)==null?void 0:S.sol),Ut(A==null?void 0:A.referral_code),hn(A==null?void 0:A.refcode),nn(A==null?void 0:A.whitelist),Vt(ke),pt(m),cn(!0),Q(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Vt(""),pt(""),Q(!1))}catch(A){console.error("Token verification error:",A),console.error(A.message||"An unknown error occurred."),Q(!1)}},Tt=M||$||se||K||z,pn=q&&!K;return t?i.jsxs(i.Fragment,{children:[Je&&_a.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:Je,setOpen:ht,handleListRequest:gt,handlePageChange:()=>{}})}),document.body),i.jsx(_d,{open:bt,setOpen:xt,transactionHash:Qt,transactionLoading:He,paymentPresaleRole:on,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:()=>!Tt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"basedapp",onCloseCurrent:()=>!Tt&&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:I_e,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:ke=>{window.localStorage.getItem("hyperToken")?ht(!0):Vn(!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(OT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"YouTube"})]})]}),q&&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"})]})}),I===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."})}),ge&&jn&&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..."}):De?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:[de&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:de}),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 ${I===2?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${pn?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!pn&&P(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 ${I===1?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${pn?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!pn&&P(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(hl,{styles:Wn,isDisabled:Tt||M||pn,isLoading:M,options:Xn,value:Xn.find(ke=>String(ke.value)===String(s))||null,onChange:ke=>{if(pn)return;a((ke==null?void 0:ke.value)??""),Ye(null);const m=(ke==null?void 0:ke.raw)||{},p=m.address||m.evm_address||m.wallet_address||m.public_address||m.eth_address||m.addr||null;ge&&(m==null?void 0:m.version)===3&&p&&Ae(p)},placeholder:ge?M?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{ge||Vn(!0)},menuIsOpen:ge?void 0:!1}),!ge&&i.jsx("button",{type:"button",onClick:()=>Vn(!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(hl,{styles:Wn,components:{Option:On,SingleValue:$t},isDisabled:Tt||pn,options:Nn,value:Nn.find(ke=>ke.value===o)||null,onChange:ke=>{pn||l((ke==null?void 0:ke.value)??"")},placeholder:"Select",isSearchable:!0})]})]}),I===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:ke=>{const m=ke.target.value.trim();if(m==="")return N("");un(m)&&N(m)},onKeyDown:yn,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:Tt||pn}),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:ke=>{const m=ke.target.value.trim();if(m==="")return v("");mn(m)&&v(m)},onKeyDown:yn,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]":Sn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tt||pn})]}),y!==""&&!Sn&&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(Us,{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:ke=>{const m=ke.target.value.trim();if(m==="")return u("");mn(m)&&u(m)},onKeyDown:yn,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]":_n?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tt||pn}),c!==""&&!_n&&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:ke=>{const m=ke.target.value.trim();if(m==="")return g("");mn(m)&&g(m)},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-[14px] font-inter outline-none placeholder:text-[#7F7F7F] ${x===""?"border-[#353535]":In?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tt||pn})]}),x!==""&&!In&&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:[ge&&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:ne?"Loading...":xe?"—":Rt(he??"0")}),i.jsx("div",{onClick:kt,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(Jg,{className:`w-4 h-4 ${ne?"animate-spin":""}`})})]}),ge&&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(pe==null?void 0:pe.total)}),i.jsxs("span",{className:"text-[#9B9B9B]",children:["(~",Rt(pe==null?void 0:pe.entryNtl)," USDC)"]}),i.jsx("div",{onClick:kt,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(Jg,{className:`w-4 h-4 ${ne?"animate-spin":""}`})})]})]}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Tt&&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:Tt,children:"Cancel"}),ge?q?i.jsx("button",{onClick:ln,disabled:!s||Tt,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:K?"Stopping...":"Stop"}):i.jsx("button",{onClick:Mt,disabled:!qe||Tt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border ${!qe||Tt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:se?"Starting...":"Start"}):i.jsx("button",{onClick:()=>Vn(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})]}),(M||$)&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]}):null}const Cce=({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(Yr);es();const[y,v]=h.useState(!1),[C,N]=h.useState(!1),[I,P]=h.useState(""),[M,F]=h.useState(""),[$,L]=h.useState(""),[z,Q]=h.useState(""),[se,ee]=h.useState(""),[K,re]=h.useState("OFF"),[de,G]=h.useState(""),[ie,ae]=h.useState(""),[q,W]=h.useState("LONG"),[ne,oe]=h.useState("MARKET"),[he,_e]=h.useState(""),[xe,Se]=h.useState(""),[ge,Ce]=h.useState(""),[je,Oe]=h.useState(!1),[$e,Ye]=h.useState(!1),[Je,ht]=h.useState(!1),[rt,st]=h.useState(!1),[He,Ve]=h.useState(""),[bt,xt]=h.useState(""),[Qt,St]=h.useState(!0),[on,cn]=h.useState(!1),[Vn,tn]=h.useState(!1),[fn,rn]=h.useState(!1),[nt,it]=h.useState(!1),[Ut,hn]=h.useState(!1),[nn,Vt]=h.useState(!1),[pt,We]=h.useState(""),[It,Ge]=h.useState(!0),[ct,vt]=h.useState(2),Ht="https://dextrabothypev2.nftinit.io",Rt="",mn={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]]},un={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"}},yn=k=>{if(k==null||isNaN(k))return"";const T=Math.abs(k),D=V=>V.toFixed(1).replace(/\.0$/,"");return T>=1e9?`${D(k/1e9)}B`:T>=1e6?`${D(k/1e6)}M`:T>=1e3?`${D(k/1e3)}K`:`${k}`},_n=(k,T)=>{const D=mn[k]||[];if(!D.length||!T)return null;let V=null;for(const[X,le,ce]of D)T<=X&&(!V||X<V.maxLev)&&(V={min:le,max:ce,maxLev:X});return V},In=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}],[]),Sn=k=>{var T;return((T=In.find(D=>D.value===k))==null?void 0:T.maxLeverage)??100},Yn=k=>{["e","E","+","-"].includes(k.key)&&k.preventDefault()},Xn=k=>/^\d*\.?\d{0,6}$/.test(k),zn=k=>/^\d*$/.test(k),Kn=h.useMemo(()=>{if(de==="")return!1;const k=Number(de);return Number.isInteger(k)&&k>=1&&k<=180},[de]),jn=h.useMemo(()=>{if(ie==="")return!1;const k=Number(ie),T=Sn(se);return Number.isInteger(k)&&k>=1&&k<=T},[ie,se]),De=h.useMemo(()=>{if(he==="")return!1;const k=Number(he);return!Number.isNaN(k)&&k>=0&&k<=100},[he]),pe=h.useMemo(()=>{if(xe==="")return!1;const k=Number(xe);return!Number.isNaN(k)&&k>=0&&k<=100},[xe]),qe=h.useMemo(()=>{if(ge==="")return!1;const k=Number(ge);return!Number.isNaN(k)&&k>=0&&k<=100},[ge]),Ae=Number(ie||0),ze=jn&&se?_n(se,Ae):null,zt=y&&I.trim()!==""&&M.trim()!==""&&(K!=="ON"||$.trim()!==""&&z.trim()!=="")&&se!==""&&Kn&&jn&&(q==="LONG"||q==="SHORT")&&(ne==="LIMIT"||ne==="MARKET")&&It,kt=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),gt=()=>`asterCreds:${kt()}`,Mt=()=>{try{const k=localStorage.getItem(gt());if(!k)return;const T=JSON.parse(k);T.apiKey&&P(T.apiKey),T.apiSecret&&F(T.apiSecret),T.apiKeyTwo&&L(T.apiKeyTwo),T.apiSecretTwo&&Q(T.apiSecretTwo),typeof T.remember=="boolean"&&St(T.remember)}catch{}},ln=()=>{if(Qt)try{localStorage.setItem(gt(),JSON.stringify({apiKey:I,apiSecret:M,apiKeyTwo:$,apiSecretTwo:z,remember:!0}))}catch{}},vn=()=>{try{localStorage.removeItem(gt())}catch{}};h.useEffect(()=>{if(!t)return;const k=localStorage.getItem("hyperToken"),T=localStorage.getItem("hyperAddress");v(!!(k&&T));const D=setInterval(()=>{const V=localStorage.getItem("hyperToken"),X=localStorage.getItem("hyperAddress");v(!!(V&&X))},800);return()=>clearInterval(D)},[t]),h.useEffect(()=>{!t||!y||(Wn(),ke())},[t,y]),h.useEffect(()=>{t&&(xe===""&&Se(Rt),he===""&&_e(Rt),ge===""&&Ce(Rt))},[t]),h.useEffect(()=>{if(!se)return;const k=Sn(se),T=Number(ie);!Number.isNaN(T)&&T>k&&ae(String(k)),!Number.isNaN(T)&&T<1&&ie!==""&&ae("1")},[se]),h.useEffect(()=>{t&&(Qt&&ln(),Qt||vn())},[I,M,$,z,Qt,t]);async function Wn(){var k,T,D,V,X;try{Ye(!0),Ve("");const le=window.localStorage.getItem("hyperToken"),ce=window.localStorage.getItem("hyperAddress");if(!le||!ce){N(!1),Mt();return}const ye=await(await fetch(`${Ht}/api/hyper/ast_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ce.toLowerCase(),token:le})})).json(),Pe=(k=ye==null?void 0:ye.data)==null?void 0:k.farming_params;if(ye!=null&&ye.success&&Pe){N(!0);const Me=((T=ye==null?void 0:ye.data)==null?void 0:T.aster_apikey)??"",Ke=((D=ye==null?void 0:ye.data)==null?void 0:D.aster_apisecret)??"",we=(Pe==null?void 0:Pe.api_key_2)??"",Te=(Pe==null?void 0:Pe.api_secret_2)??"";Me&&P(String(Me)),Ke&&F(String(Ke)),we&&L(String(we)),Te&&Q(String(Te)),((V=ye==null?void 0:ye.data)==null?void 0:V.delta_neutral)!==void 0&&re((X=ye==null?void 0:ye.data)!=null&&X.delta_neutral?"ON":"OFF"),Pe!=null&&Pe.coin&&ee(String(Pe.coin)),(Pe==null?void 0:Pe.orderPerHour)!=null&&G(String(Pe.orderPerHour)),(Pe==null?void 0:Pe.leverage)!=null&&ae(String(Pe.leverage)),Pe!=null&&Pe.direction&&W(String(Pe.direction).toUpperCase()==="SHORT"?"SHORT":"LONG"),Pe!=null&&Pe.order_type&&oe(String(Pe.order_type)==="limit"?"LIMIT":"MARKET"),(Pe==null?void 0:Pe.upspread)!=null&&_e(String(Pe.upspread)),(Pe==null?void 0:Pe.downspread)!=null&&Se(String(Pe.downspread)),(Pe==null?void 0:Pe.upspread)!=null&&Ce(String(Pe.upspread))}else N(!1),re("OFF");(!I&&!M||K==="ON"&&!$&&!z)&&Mt()}catch{N(!1),Mt(),re("OFF")}finally{Ye(!1)}}async function On(){if(!y){r(!0);return}if(zt)try{ht(!0),Ve("");const k=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!k||!T){r(!0);return}const D={methodType:K==="ON"?2:1,coin:se,orderPerHour:Number(de),leverage:Number(ie),...K==="ON"?{api_key_2:$,api_secret_2:z}:ne==="LIMIT"?{upspread:Number(ge),direction:q,order_type:ne==="LIMIT"?"limit":"market"}:{upspread:Number(he),downspread:Number(xe),direction:q,order_type:ne==="LIMIT"?"limit":"market"}},V={address:T.toLowerCase(),token:k,apikey:I,apisecret:M,farming_params:D,delta_neutral:K==="ON"},le=await(await fetch(`${Ht}/api/hyper/ast_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)})).json();le!=null&&le.success?(N(!0),Qt&&ln()):Ve((le==null?void 0:le.error_message)||"Start failed.")}catch(k){Ve(k.message||"An error occurred while saving.")}finally{ht(!1)}}async function $t(){if(!y){r(!0);return}try{st(!0),Ve("");const k=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!k||!T){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:T.toLowerCase(),token:k})})).json();V!=null&&V.success?N(!1):Ve((V==null?void 0:V.error_message)||"Stop failed.")}catch(k){Ve(k.message||"An error occurred while stopping.")}finally{st(!1)}}const Nn={control:(k,T)=>({...k,backgroundColor:"#242424",borderColor:T.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,T)=>({...k,backgroundColor:T.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"})},Fn=({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"]}),Tt=k=>{var T;return i.jsx(ma.Option,{...k,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((T=k.data)==null?void 0:T.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(Fn,{max:k.data.maxLeverage})]})})},pn=k=>{var T;return i.jsx(ma.SingleValue,{...k,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((T=k.data)==null?void 0:T.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(Fn,{max:k.data.maxLeverage})]})})},ke=async()=>{var D,V;const k=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!(!k||!T))try{Oe(!0);const X=await vi(T.toLowerCase(),k);X!=null&&X.success?(s(X==null?void 0:X.telegram_chat_id),a(X==null?void 0:X.subscriber_role),o(X==null?void 0:X.subs_expire_day),l((D=X==null?void 0:X.mushboomer_counts)==null?void 0:D.eth),c((V=X==null?void 0:X.mushboomer_counts)==null?void 0:V.sol),u(X==null?void 0:X.referral_code),d(X==null?void 0:X.refcode),f(X==null?void 0:X.whitelist),x(k),g(T),Ge(!0),Oe(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),x(""),g(""),Oe(!1))}catch(X){console.error("Token verification error:",X),console.error(X.message||"An unknown error occurred."),Oe(!1)}},m=In;if(!t)return null;const p=$e||Je||rt||je,S=C&&!rt,A=Sn(se);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:nn,setOpen:Vt,transactionHash:pt,transactionLoading:Ut,paymentPresaleRole:It,errorFunds:bt,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!p&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"aster",onCloseCurrent:()=>!p&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:`${K==="ON"?"pb-3.5":"pb-2"} px-5 pt-5 border-b border-[#353535] rounded-t-3xl relative`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://static.asterdex.com/cloud-futures/static/images/aster/logo.svg",alt:"Dextrabot - Aster Farming"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#F8D4AB] mt-[1px]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Aster Farming module lets you set up automated farming by providing your API Key and Secret, selecting a pair, defining orders per hour, leverage, direction, and TP/SL percentages."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1",children:i.jsxs("div",{onClick:()=>window.open("https://www.youtube.com/watch?v=qFJxq-vzctE","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(OT,{})}),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:`${K==="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(Uj,{className:"w-4 h-4"}),"Stage 3"]})})})})})}),y&&!C&&ct===2&&It&&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:`${K==="ON"?"space-y-6":"space-y-3"} px-3 sm:px-5 py-2 `,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[K==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://www.asterdex.com/en/api-management",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:I,onChange:k=>P(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",type:on?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${I===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>cn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:on?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:M,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Vn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${M===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>tn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:Vn?i.jsx(aa,{size:14}):i.jsx(oa,{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:I,onChange:k=>P(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",type:on?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${I===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>cn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:on?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:M,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Vn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${M===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>tn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:Vn?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]}),K==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key 2"}),i.jsx("a",{href:"https://www.asterdex.com/en/api-management",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:$,onChange:k=>L(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY_2",type:fn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${$===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>rn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:fn?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret 2"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:z,onChange:k=>Q(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET_2",type:nt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${z===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>it(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:nt?i.jsx(aa,{size:14}):i.jsx(oa,{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(hl,{styles:Nn,components:{Option:Tt,SingleValue:pn},isDisabled:p||S,options:m,value:m.find(k=>k.value===se)||null,onChange:k=>ee((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:de,onChange:k=>{const T=k.target.value.trim();if(T==="")return G("");zn(T)&&G(T)},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] ${de===""?"border-[#353535]":Kn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S}),de!==""&&!Kn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:K==="ON"?"On":"Off"}),i.jsx(Fo,{checked:K==="ON",onChange:k=>re(k?"ON":"OFF"),disabled:p||S,className:`${K==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${p||S?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${K==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:ie,onChange:k=>{const T=k.target.value.trim();if(T==="")return ae("");zn(T)&&ae(T)},onKeyDown:Yn,inputMode:"numeric",autoComplete:"off",placeholder:se?`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]":jn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S}),ie!==""&&!jn&&i.jsxs("div",{className:"text-[#FF797C] text-[12px]",children:["Allowed: 1–",A,"x"]}),ze&&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:[Ae,"x"]}),":"," ",i.jsxs("b",{children:[yn(ze.min)," – ",yn(ze.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"})]}),un[se]&&i.jsxs("div",{children:["Trading Limit is"," ",i.jsxs("b",{children:[yn(un[se].market)," ",un[se].unit]})," ","for ",i.jsx("b",{children:se})," ",i.jsx("a",{href:"https://www.asterdex.com/en/futures/trading-rules/trading-rules",target:"_blank",rel:"noopener noreferrer",className:"underline text-[#F8D4AB] hover:text-white",children:"More Details"})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${K==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":ne==="MARKET",onClick:()=>!S&&oe("MARKET"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",ne==="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 ",ne==="MARKET"?" ✓":""]})}),i.jsx("button",{"aria-pressed":ne==="LIMIT",onClick:()=>!S&&oe("LIMIT"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",ne==="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 ",ne==="LIMIT"?" ✓":""]})})]})]}),i.jsxs("div",{className:`${K==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{"aria-pressed":q==="LONG",onClick:()=>!S&&W("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",q==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{children:["LONG",ie?` - ${ie}x`:""]})}),i.jsx("div",{"aria-pressed":q==="SHORT",onClick:()=>!S&&W("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",q==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{children:["SHORT",ie?` - ${ie}x`:""]})})]})]})]}),i.jsxs("div",{className:`${K==="ON"||ne==="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:he,onChange:k=>{const T=k.target.value.trim();if(T==="")return _e("");Xn(T)&&_e(T)},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] ${he===""?"border-[#353535]":De?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),he!==""&&!De&&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:xe,onChange:k=>{const T=k.target.value.trim();if(T==="")return Se("");Xn(T)&&Se(T)},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] ${xe===""?"border-[#353535]":pe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),xe!==""&&!pe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]})]}),i.jsx("div",{className:`${K==="OFF"&&ne==="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:ge,onChange:k=>{const T=k.target.value.trim();if(T==="")return Ce("");Xn(T)&&Ce(T)},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] ${ge===""?"border-[#353535]":qe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),ge!==""&&!qe&&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:$t,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:rt?"Stopping...":"Stop"}):i.jsx("button",{onClick:On,disabled:!zt||p,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!zt||p?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Je?"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"})]})}),$e&&ct===2&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},rOt=({linkTo:t,title:e,icon:n,activePaths:r=[]})=>{const{pathname:s}=Xl(),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"})]}),lo=({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"})})]}),Vs=({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"})]}),M5=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountLighter:r,tradeMarket:s,product:a})=>{const{address:o}=es(),{setSignModalOpen:l,setTelegramChatId:c,setSubscriberRole:u,setSubsExpireDay:d,setMushboomerETH:f,setMushboomerSOL:x,setIsReferralCode:g,setIsReferralCodeName:y,setIsWhitelist:v,setHyperToken:C,setHyperAddress:N}=h.useContext(Yr),[I,P]=h.useState(1),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState(""),[se,ee]=h.useState(""),[K,re]=h.useState(""),de=he=>/^\d*$/.test(he),G=he=>{["e","E","+","-"].includes(he.key)&&he.preventDefault()};h.useEffect(()=>{t||P(1)},[t]);const ie=h.useRef(K);h.useEffect(()=>{ie.current=K},[K]);const ae=h.useMemo(()=>{if(I==="")return!1;const he=Number(I);return Number.isInteger(he)&&he>=1},[I]),q=async()=>{var xe,Se,ge,Ce;const he=window.localStorage.getItem("hyperToken"),_e=window.localStorage.getItem("hyperAddress");if(!(!he||!_e))try{const je=await vi(_e.toLowerCase(),he);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((xe=je==null?void 0:je.mushboomer_counts)==null?void 0:xe.eth),x((Se=je==null?void 0:je.mushboomer_counts)==null?void 0:Se.sol),g(je==null?void 0:je.referral_code),y(je==null?void 0:je.refcode),v(je==null?void 0:je.whitelist),C(he),N(_e),re((Ce=(ge=je==null?void 0:je.slots_info)==null?void 0:ge[s])==null?void 0:Ce.total_qty)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),C(""),N(""))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred.")}},W=async()=>new kl(window.ethereum).eth.getAccounts(_e=>_e),ne=async(he="slot",_e=24,xe=5e3)=>{_e<=0||(await new Promise(Se=>setTimeout(Se,xe)),await q(),he==="slot"&&ie.current<=n?ne(he,_e-1,xe):r())},oe=async he=>{ee("");const _e=window.localStorage.getItem("hyperToken"),xe=window.localStorage.getItem("hyperAddress");if(!_e||!o){l(!0);return}L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Ce){console.error("Failed to switch network",Ce),F(!1);return}const Se=new kl(window.ethereum);var ge=await W();if(ge.length>0?ge=ge[0]:ge=void 0,ge){const je=he*.012,Oe=Se.utils.toWei(je.toString(),"ether"),$e={from:ge,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Oe};await Se.eth.sendTransaction($e).then(Ye=>{console.log("txHash :>> ",Ye),F(!1),Q(Ye.transactionHash);const Je=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():xe,token:_e,payment_tx:Ye.transactionHash,slot_role:Je,slot_qty:Number(I)})}),q(),ne("slot")}).catch(Ye=>{console.log(Ye),Ye.code===-32003||Ye.message.includes("insufficient funds")?ee("Insufficient funds."):Ye.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await Se.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:!(K<=n),errorFunds:se,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:()=>P(he=>{const _e=Number(he||0);return _e>1?String(_e-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:I,onChange:he=>{const _e=he.target.value.trim();if(_e==="")return P("");de(_e)&&P(_e)},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:()=>P(he=>{const _e=Number(he||0);return String(_e+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!==""&&!ae&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),i.jsxs("div",{className:"text-[13px] text-[#7C7C7C] font-semibold flex items-center gap-1",children:["Total Price:",i.jsxs("span",{className:"bg-[#1E1E1E] text-[#F8D4AB] font-bold px-2 py-[2px] rounded-md border border-[#3A3A3A]",children:[(I*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:he=>{he.preventDefault(),ae&&oe(I)},className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] min-w-max font-semibold ${ae?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},Sce=({open:t=!1,setOpen:e=()=>{}})=>{var ts,Qs,Es,br;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(Yr);es();const[g,y]=h.useState(1),[v,C]=h.useState(0),[N,I]=h.useState(0),[P,M]=h.useState(0),[F,$]=h.useState(0),[L,z]=h.useState({}),[Q,se]=h.useState(null),[ee,K]=h.useState(!1),[re,de]=h.useState(!1),[G,ie]=h.useState(!1),[ae,q]=h.useState("OFF"),[W,ne]=h.useState(""),[oe,he]=h.useState(""),[_e,xe]=h.useState(""),[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState(""),[ht,rt]=h.useState(""),[st,He]=h.useState([]),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState(""),[St,on]=h.useState(""),[cn,Vn]=h.useState("LONG"),[tn,fn]=h.useState("STANDARD"),[rn,nt]=h.useState("STANDARD"),[it,Ut]=h.useState("MARKET"),[hn,nn]=h.useState(""),[Vt,pt]=h.useState(""),[We,It]=h.useState(""),[Ge,ct]=h.useState(!1),[vt,Ht]=h.useState(!1),[Rt,mn]=h.useState(!1),[un,yn]=h.useState(!1),[_n,In]=h.useState(""),[Sn,Yn]=h.useState(""),[Xn,zn]=h.useState(!0),[Kn,jn]=h.useState(!1),[De,pe]=h.useState(!1),[qe,Ae]=h.useState(!1),[ze,zt]=h.useState(!1),[kt,gt]=h.useState(""),[Mt,ln]=h.useState(!0),[vn,Wn]=h.useState(!1),[On,$t]=h.useState("Hour"),[Nn,Fn]=h.useState(1),[Tt,pn]=h.useState("lighter"),[ke,m]=h.useState(!1),p=h.useRef(null),[S,A]=h.useState(""),[k,T]=h.useState(null),[D,V]=h.useState(""),[X,le]=h.useState(!1),ce=k?(k==null?void 0:k.getTime())<=Date.now():!1,fe="https://dextrabothypev2.nftinit.io",ye="",Pe={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"},Me=["BTC","ETH","SOL"];h.useEffect(()=>{async function Zt(){if(t)try{const dt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_lighter_coins/")).json();if(dt!=null&&dt.coins){let _t=dt.coins.map(At=>{const xn=(At==null?void 0:At.label)||"",Cn=Pe[xn]||xn,fr=Cn==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":Cn==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":Cn==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":Cn==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":Cn==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":Cn==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":Cn==="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=":Cn==="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=":Cn==="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==":Cn==="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=":Cn==="CC"?"https://app.lighter.xyz/assets/cc-D4WHZ-w6.png":`https://app.hyperliquid.xyz/coins/${Cn}.svg`;return{...At,icon:fr}});Tt==="variational"&&ae==="ON"&&(_t=_t.filter(At=>Me.includes(At.label))),He(_t)}}catch(me){console.error("Failed to fetch coin list:",me)}}Zt()},[t,Tt,ae]);const Ke=Zt=>{var me;return((me=st==null?void 0:st.find(dt=>dt.value===Zt))==null?void 0:me.maxLeverage)??100},we=Zt=>{["e","E","+","-"].includes(Zt.key)&&Zt.preventDefault()},Te=Zt=>/^\d*\.?\d{0,6}$/.test(Zt),te=Zt=>/^\d*$/.test(Zt),ve=h.useMemo(()=>{if(xt==="")return!1;const Zt=Number(xt);return Number.isInteger(Zt)&&Zt>=1&&Zt<=180},[xt]),Be=h.useMemo(()=>{if(St==="")return!1;const Zt=Number(St),me=Ke(ht);return Number.isInteger(Zt)&&Zt>=1&&Zt<=me},[St,ht,st]),Ue=h.useMemo(()=>{if(hn==="")return!1;const Zt=Number(hn);return Number.isNaN(Zt)?!1:Zt===0?!0:Zt>=1&&Zt<=1e7},[hn]),Fe=h.useMemo(()=>{if(Vt==="")return!1;const Zt=Number(Vt);if(Number.isNaN(Zt))return!1;const me=St===""?null:Number(St),dt=me?me*100-1:4999;return Zt===0?!0:Zt>0&&Zt<1?!1:Zt>=1&&Zt<=dt},[Vt,St]);h.useMemo(()=>{if(We==="")return!1;const Zt=Number(We);return!Number.isNaN(Zt)&&Zt>0&&Zt<=100},[We]);const at=re&&Ce.trim()!==""&&W.trim()!==""&&_e.trim()!==""&&ht!==""&&ve&&Be&&Ve&&(!hn||Ue)&&(!Vt||Fe)&&(cn==="LONG"||cn==="SHORT"||cn==="RANDOM")&&(it==="LIMIT"||it==="MARKET"||it==="RANDOM")&&Mt,ut=re&&W.trim()!==""&&_e.trim()!==""&&Ce.trim()!==""&&(Tt!=="lighter"||oe.trim()!=="")&&(Tt!=="lighter"||Se.trim()!=="")&&(Tt!=="lighter"||Oe.trim()!=="")&&(Tt!=="lighter"||W.trim()!==oe.trim())&&(Tt!=="lighter"||_e.trim()!==Se.trim())&&(Tt!=="lighter"||Ce.trim().toLowerCase()!==Oe.trim().toLowerCase())&&ht!==""&&ve&&Be&&Ve&&(Tt!=="variational"||S.trim()!=="")&&(Tt!=="variational"||!D)&&(Tt!=="variational"||!ce)&&Mt;h.useEffect(()=>{if(ae==="ON"&&Tt==="lighter"){if(_e&&Se&&_e.trim()===Se.trim()){In("Make sure the wallet API indexes are unique for each Slot.");return}if(Ce&&Oe&&Ce.trim().toLowerCase()===Oe.trim().toLowerCase()){In("Make sure both the Lighter wallet addresses are unique for each Slot.");return}if(W&&oe&&W.trim()===oe.trim()){In("Please create an API key for each wallet.");return}In("")}else In("")},[ae,_e,Se,W,oe,Ce,Oe]);const yt=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Lt=()=>`lighterCreds:${yt()}`,Gt=()=>{try{const Zt=localStorage.getItem(Lt());if(!Zt)return;const me=JSON.parse(Zt);me.apiKey&&ne(me.apiKey),me.apiKeyTwo&&he(me.apiKeyTwo),me.apiKeyIndex&&xe(me.apiKeyIndex),me.apiKeyIndexTwo&&ge(me.apiKeyIndexTwo),me.lighterLoginAddress&&je(me.lighterLoginAddress),me.lighterLoginAddressTwo&&$e(me.lighterLoginAddressTwo),typeof me.remember=="boolean"&&zn(me.remember)}catch{}},an=()=>{if(Xn)try{localStorage.setItem(Lt(),JSON.stringify({apiKey:W,apiKeyIndex:_e,lighterLoginAddress:Ce,remember:!0}))}catch{}},et=()=>{try{localStorage.removeItem(Lt())}catch{}};h.useEffect(()=>{if(!t)return;const Zt=localStorage.getItem("hyperToken"),me=localStorage.getItem("hyperAddress");de(!!(Zt&&me));const dt=setInterval(()=>{const _t=localStorage.getItem("hyperToken"),At=localStorage.getItem("hyperAddress");de(!!(_t&&At))},800);return()=>clearInterval(dt)},[t]),h.useEffect(()=>{!t||!re||(Pt(),Tr())},[t,re]),h.useEffect(()=>{t&&(Vt===""&&pt(ye),hn===""&&nn(ye),We===""&&It(ye))},[t]),h.useEffect(()=>{if(!ht)return;const Zt=Ke(ht),me=Number(St);!Number.isNaN(me)&&me>Zt&&on(String(Zt)),!Number.isNaN(me)&&me<1&&St!==""&&on("1")},[ht]),h.useEffect(()=>{t&&(Xn&&an(),Xn||et())},[W,_e,Ce,Ye,Xn,t]);async function Pt(){var Zt,me,dt,_t,At,xn,Cn,fr,_r,pr,hr,Xr,is,Pr,yr,nr;try{Ht(!0),In("");const gs=window.localStorage.getItem("hyperToken"),ei=window.localStorage.getItem("hyperAddress");if(!gs||!ei){ie(!1),Gt();return}const Fr=await(await fetch(`${fe}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ei.toLowerCase(),token:gs})})).json();if(!(Fr!=null&&Fr.success)){if(console.warn("INFO API RESPONSE:",Fr==null?void 0:Fr.error_message),(Fr==null?void 0:Fr.error_message)==="You have not a running process"){const En=Ve?Ve.toLowerCase().replace("-","_"):null,Bn=L==null?void 0:L[En];if(En&&Bn){const mt={...L,[En]:{...Bn,isStop:!0}};z(mt);const sr=Object.keys(mt).filter(Zn=>Zn.startsWith("lighter"));if(sr.length>0&&!Ve){const Ir=sr.sort((ns,Ls)=>{var Qn,Vr;const Ot=parseInt(((Qn=ns.match(/\d+/))==null?void 0:Qn[0])||0,10),lr=parseInt(((Vr=Ls.match(/\d+/))==null?void 0:Vr[0])||0,10);return Ot-lr})[0].match(/\d+/);Ir&&bt(`Lighter-${Ir[0]}`)}}else bt("Lighter-1")}Fr!=null&&Fr.slots_info&&(I((me=(Zt=Fr==null?void 0:Fr.slots_info)==null?void 0:Zt.lighter)==null?void 0:me.total_qty),C((_t=(dt=Fr==null?void 0:Fr.slots_info)==null?void 0:dt.lighter)==null?void 0:_t.active_qty),$((xn=(At=Fr==null?void 0:Fr.slots_info)==null?void 0:At.variational)==null?void 0:xn.total_qty),M((fr=(Cn=Fr==null?void 0:Fr.slots_info)==null?void 0:Cn.variational)==null?void 0:fr.active_qty));return}if(Fr!=null&&Fr.success&&(Fr!=null&&Fr.data)){const En=Ve?Ve.toLowerCase().replace("-","_"):null,Bn=L==null?void 0:L[En],mt=Fr.data||{};En&&!mt[En]&&Bn&&(mt[En]={...Bn,isStop:!0}),z(mt);const sr=Object.keys(mt).filter(Zn=>Zn.startsWith("lighter"));if(sr.length>0&&!Ve){const Ir=sr.sort((ns,Ls)=>{var Qn,Vr;const Ot=parseInt(((Qn=ns.match(/\d+/))==null?void 0:Qn[0])||0,10),lr=parseInt(((Vr=Ls.match(/\d+/))==null?void 0:Vr[0])||0,10);return Ot-lr})[0].match(/\d+/);Ir&&bt(`Lighter-${Ir[0]}`)}Fr!=null&&Fr.slots_info&&(I((pr=(_r=Fr==null?void 0:Fr.slots_info)==null?void 0:_r.lighter)==null?void 0:pr.total_qty),C((Xr=(hr=Fr==null?void 0:Fr.slots_info)==null?void 0:hr.lighter)==null?void 0:Xr.active_qty),$((Pr=(is=Fr==null?void 0:Fr.slots_info)==null?void 0:is.variational)==null?void 0:Pr.total_qty),M((nr=(yr=Fr==null?void 0:Fr.slots_info)==null?void 0:yr.variational)==null?void 0:nr.active_qty))}}catch{ie(!1),Gt(),q("OFF"),K(!1)}finally{Ht(!1)}}const qt=h.useMemo(()=>Ve?Ve.toLowerCase().replace("-","_"):"",[Ve]),ft=!!((ts=L==null?void 0:L[qt])!=null&&ts.delta)&&!!((Qs=L==null?void 0:L[qt])!=null&&Qs.from_slot),tt=ft?`lighter_${(Es=L==null?void 0:L[qt])==null?void 0:Es.from_slot}`:qt;h.useEffect(()=>{var dt,_t,At,xn,Cn,fr,_r,pr,hr,Xr,is,Pr,yr,nr,gs,ei,ci,Fr,En,Bn;if(!Ve||!L)return;const Zt=tt,me=L==null?void 0:L[Zt];if(!me){ne(""),he(""),xe(""),ge(""),je(""),$e(""),rt(""),Qt(""),on(""),Vn("LONG"),Ut("MARKET"),ie(!1),q("OFF"),K(!1),$t("Hour"),nn(""),pt(""),A(""),pn("lighter"),T(null);return}if(me!=null&&me.farming_params){me!=null&&me.isStop?ie(!1):ie(!0),q("OFF"),K(!1);const mt=me.farming_params,Kt=(me==null?void 0:me.lighter_api_pkey)??"",sr=(me==null?void 0:me.lighter_login_address)??"",Zn=(me==null?void 0:me.lighter_api_index)??"",Or=(me==null?void 0:me.slot_number)??"";Kt&&ne(String(Kt)),sr&&je(String(sr)),Zn&&xe(String(Zn)),Or&&!ft&&bt(`Lighter-${Or}`),mt!=null&&mt.cycleSeconds&&$t((mt==null?void 0:mt.cycleSeconds)===86400?"Day":"Hour"),mt!=null&&mt.coin&&rt(String(mt.coin)),(mt==null?void 0:mt.orderPerHour)!=null&&Qt(String(mt.orderPerHour)),(mt==null?void 0:mt.leverage)!=null&&on(String(mt.leverage)),mt!=null&&mt.direction&&Vn(String(mt.direction).toUpperCase()==="SHORT"?"SHORT":String(mt.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),mt!=null&&mt.orderType&&Ut(String(mt.orderType).toUpperCase()==="MARKET"?"MARKET":String(mt.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),mt!=null&&mt.accountType&&Fn(mt.accountType==="standart"?1:2),mt!=null&&mt.accountType&&fn(mt.accountType==="standart"?"STANDARD":"PREMIUM"),(mt==null?void 0:mt.tp)!=null&&nn(String(mt.tp)),(mt==null?void 0:mt.sl)!=null&&pt(String(mt.sl)),(mt==null?void 0:mt.spread)!=null&&It(String(mt.spread))}else if(me!=null&&me.source_params){me!=null&&me.isStop?ie(!1):ie(!0),q("ON"),K(!1);const mt=((dt=me==null?void 0:me.source_params)==null?void 0:dt.api_pkey)??"",Kt=((_t=me==null?void 0:me.source_params)==null?void 0:_t.login_wallet)??"",sr=((At=me==null?void 0:me.source_params)==null?void 0:At.api_index)??"",Zn=((xn=me==null?void 0:me.target_params)==null?void 0:xn.api_pkey)??"",Or=((Cn=me==null?void 0:me.target_params)==null?void 0:Cn.login_wallet)??"",Ir=((fr=me==null?void 0:me.target_params)==null?void 0:fr.api_index)??"",ns=(me==null?void 0:me.slot_number)??"";ns&&!ft&&bt(`Lighter-${ns}`),mt&&ne(String(mt)),Zn&&he(String(Zn)),Kt&&je(String(Kt)),Or&&$e(String(Or)),sr&&xe(String(sr)),Ir&&ge(String(Ir)),(_r=me==null?void 0:me.source_params)!=null&&_r.coin&&rt(String((pr=me==null?void 0:me.source_params)==null?void 0:pr.coin)),((hr=me==null?void 0:me.source_params)==null?void 0:hr.orderPerHour)!=null&&Qt(String((Xr=me==null?void 0:me.source_params)==null?void 0:Xr.orderPerHour)),((is=me==null?void 0:me.source_params)==null?void 0:is.leverage)!=null&&on(String((Pr=me==null?void 0:me.source_params)==null?void 0:Pr.leverage)),(yr=me==null?void 0:me.source_params)!=null&&yr.accountType&&Fn(((nr=me==null?void 0:me.source_params)==null?void 0:nr.accountType)==="standart"?1:2),(gs=me==null?void 0:me.source_params)!=null&&gs.accountType&&fn(((ei=me==null?void 0:me.source_params)==null?void 0:ei.accountType)==="standart"?"STANDARD":"PREMIUM"),(ci=me==null?void 0:me.target_params)!=null&&ci.accountType&&nt(((Fr=me==null?void 0:me.target_params)==null?void 0:Fr.accountType)==="standart"?"STANDARD":"PREMIUM"),me!=null&&me.target_app&&pn((me==null?void 0:me.target_app)==="lighter"?"lighter":"variational"),(En=me==null?void 0:me.target_params)!=null&&En.vr_token&&A((Bn=me==null?void 0:me.target_params)==null?void 0:Bn.vr_token)}else ie(!1),q("OFF"),K(!1)},[Ve,L,ft,tt]);const Bt=Zt=>{var me;return Number(((me=String(Zt||"").match(/\d+/))==null?void 0:me[0])||0)},gn=Zt=>(Zt||"").toLowerCase().replace("-","_"),tr=h.useMemo(()=>{const Zt=L==null?void 0:L[gn(Ve)];if(Zt!=null&&Zt.delta&&(Zt!=null&&Zt.from_slot))return Number(Zt.from_slot);const me=Number(Zt==null?void 0:Zt.slot_number);return Number.isFinite(me)?me:Bt(Ve)},[Ve,L]),Dn=h.useMemo(()=>{const Zt=Number(g)||0,me=Array.from({length:Zt},()=>({used:!1,kind:null})),dt=L||{};for(const[_t,At]of Object.entries(dt)){if(!_t.startsWith("lighter_"))continue;const xn=Bt(_t)-1;xn<0||xn>=Zt||((At==null?void 0:At.isStop)===!0?me[xn]={used:!1,kind:null}:At!=null&&At.source_params?me[xn]={used:!0,kind:"delta-src"}:At!=null&&At.target_params||At!=null&&At.delta?me[xn]={used:!0,kind:"delta-shadow"}:At!=null&&At.farming_params?me[xn]={used:!0,kind:"single"}:me[xn]={used:!0,kind:"unknown"})}return me},[L,g]),er=h.useMemo(()=>Dn.map((Zt,me)=>Zt.used&&Zt.kind!=="delta-src-inferred"?`Lighter-${me+1}`:null).filter(Boolean),[Dn]);h.useMemo(()=>Dn.filter(Zt=>!Zt.used).length,[Dn]);async function Sr(){if(!re){n(!0);return}if(at)try{mn(!0),In("");const Zt=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!Zt||!me){n(!0);return}const dt={coin:ht,orderPerHour:Number(xt),leverage:Number(St),direction:cn,orderType:it,tp:Number(hn),sl:Number(Vt),cycleSeconds:On==="Hour"?3600:86400},_t={address:me.toLowerCase(),token:Zt,api_pkey:W,api_index:Number(_e),login_wallet:Ce,slot_number:Number(Ve==null?void 0:Ve.replace("Lighter-","")),farming_params:dt},xn=await(await fetch(`${fe}/api/hyper/lighter_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_t)})).json();xn!=null&&xn.success?(ie(!0),Pt(),Xn&&an()):In((xn==null?void 0:xn.error_message)||"Start failed.")}catch(Zt){In(Zt.message||"An error occurred while saving.")}finally{mn(!1)}}async function dr(){var me;const Zt=Bt(Ve)-1;if(Zt<0){In("Please select a slot."),mn(!1);return}if((me=Dn[Zt])!=null&&me.used){In("Selected slot is already in use."),mn(!1);return}if(!re){n(!0);return}if(ut)try{mn(!0),In("");const dt=window.localStorage.getItem("hyperToken"),_t=window.localStorage.getItem("hyperAddress");if(!dt||!_t){n(!0);return}const At={api_pkey:W,api_index:_e,login_wallet:Ce,coin:ht,orderPerHour:Number(xt),leverage:Number(St)},xn={...Tt==="lighter"&&{api_pkey:oe,api_index:Se,login_wallet:Oe},coin:ht==null?void 0:ht.replace("USDT",""),orderPerHour:Number(xt),leverage:Number(St),...Tt==="variational"&&{vr_token:S}},Cn={address:_t.toLowerCase(),token:dt,slot_number:Number(Ve==null?void 0:Ve.replace("Lighter-","")),source_app:"lighter",source_params:At,target_app:Tt==="lighter"?"lighter":"variational_delta",target_params:xn},_r=await(await fetch(`${fe}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Cn)})).json();_r!=null&&_r.success?(ie(!0),Pt(),Xn&&an()):In((_r==null?void 0:_r.error_message)||fallback)}catch(dt){In(dt.message||"An error occurred while saving.")}finally{mn(!1)}}async function kr(){if(!re){n(!0);return}try{yn(!0),In("");const Zt=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!Zt||!me){n(!0);return}const _t=await(await fetch(`${fe}/api/hyper/lighter_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:me.toLowerCase(),token:Zt,slot_number:tr})})).json();_t!=null&&_t.success?(ie(!1),Pt()):In((_t==null?void 0:_t.error_message)||"Stop failed.")}catch(Zt){In(Zt.message||"An error occurred while stopping.")}finally{yn(!1)}}async function qn(){if(!re){n(!0);return}try{yn(!0),In("");const Zt=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!Zt||!me){n(!0);return}const _t=await(await fetch(`${fe}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:me.toLowerCase(),token:Zt,source_app:"lighter",target_app:Tt==="lighter"?"lighter":"variational_delta",slot_number:tr})})).json();_t!=null&&_t.success?(ie(!1),Pt()):In((_t==null?void 0:_t.error_message)||"Stop failed.")}catch(Zt){In(Zt.message||"An error occurred while stopping.")}finally{yn(!1)}}const Tn=Zt=>{pn(Zt??"lighter"),m(!1)},$n=[{value:"lighter",label:"Lighter"},{value:"variational",label:"Variational"}];function ir(Zt){try{const me=Zt.split(".");if(me.length!==3)throw new Error("Invalid JWT format");const _t=me[1].replace(/-/g,"+").replace(/_/g,"/"),At=decodeURIComponent(atob(_t).split("").map(xn=>"%"+("00"+xn.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(At)}catch{return null}}const ls={control:(Zt,me)=>({...Zt,backgroundColor:"#242424",borderColor:me.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:Zt=>({...Zt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Zt=>({...Zt,height:32}),input:Zt=>({...Zt,color:"#FFFFFF",margin:0,padding:0}),singleValue:Zt=>({...Zt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Zt=>({...Zt,color:"#7F7F7F",fontSize:"12px"}),menu:Zt=>({...Zt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Zt=>({...Zt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(Zt,me)=>({...Zt,backgroundColor:me.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Zt=>({...Zt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Zt=>({...Zt,backgroundColor:"#353535"})},cs=({max:Zt})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[Zt,"x"]}),lt=Zt=>{var me,dt,_t;return i.jsx(ma.Option,{...Zt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(me=Zt.data)!=null&&me.icon?i.jsx("img",{src:Zt.data.icon,alt:Zt.data.label,className:`${((dt=Zt.data)==null?void 0:dt.label)==="XRP"||((_t=Zt.data)==null?void 0:_t.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:At=>At.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:Zt.data.label}),i.jsx(cs,{max:Zt.data.maxLeverage})]})})},Nt=Zt=>{var me,dt,_t;return i.jsx(ma.SingleValue,{...Zt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(me=Zt.data)!=null&&me.icon?i.jsx("img",{src:Zt.data.icon,alt:Zt.data.label,className:`${((dt=Zt.data)==null?void 0:dt.label)==="XRP"||((_t=Zt.data)==null?void 0:_t.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:At=>At.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:Zt.data.label}),i.jsx(cs,{max:Zt.data.maxLeverage})]})})},Rn=Zt=>{const me=er.includes(Zt.data.value);return i.jsx(ma.Option,{...Zt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:Zt.data.label}),me&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},ar=Zt=>i.jsx(ma.SingleValue,{...Zt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:Zt.data.label})})}),Tr=async()=>{var dt,_t,At,xn,Cn,fr,_r,pr;const Zt=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!(!Zt||!me))try{ct(!0);const hr=await vi(me.toLowerCase(),Zt);hr!=null&&hr.success?(r(hr==null?void 0:hr.telegram_chat_id),s(hr==null?void 0:hr.subscriber_role),a(hr==null?void 0:hr.subs_expire_day),o((dt=hr==null?void 0:hr.mushboomer_counts)==null?void 0:dt.eth),l((_t=hr==null?void 0:hr.mushboomer_counts)==null?void 0:_t.sol),c(hr==null?void 0:hr.referral_code),u(hr==null?void 0:hr.refcode),d(hr==null?void 0:hr.whitelist),f(Zt),x(me),ln(!0),y((xn=(At=hr==null?void 0:hr.slots_info)==null?void 0:At.lighter)==null?void 0:xn.total_qty),I((fr=(Cn=hr==null?void 0:hr.slots_info)==null?void 0:Cn.lighter)==null?void 0:fr.total_qty),C((pr=(_r=hr==null?void 0:hr.slots_info)==null?void 0:_r.lighter)==null?void 0:pr.active_qty),ct(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),ct(!1))}catch(hr){console.error("Token verification error:",hr),console.error(hr.message||"An unknown error occurred."),ct(!1)}},Lr=st,$r=h.useMemo(()=>Array.from({length:g},(Zt,me)=>({value:`Lighter-${me+1}`,label:`Lighter-${me+1}`})),[g]);if(!t)return null;const cr=vt||Rt||un||Ge,wr=G&&!un,ss=Ke(ht),mr=P===F;return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:ze,setOpen:zt,transactionHash:kt,transactionLoading:qe,paymentPresaleRole:Mt,errorFunds:Sn,activeMethod:2}),i.jsx(M5,{open:vn,setOpen:Wn,paymentLighterRole:Mt,oldSlotCount:Q,checkAccountLighter:Tr,tradeMarket:"lighter"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!cr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"lighter",onCloseCurrent:()=>!cr&&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:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})}),i.jsxs("div",{onClick:()=>window.open("https://youtu.be/_TxVAzKU5LE","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(OT,{})}),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:[_n&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:_n==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:_n}),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:_n})}),re&&Mt&&N===v&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`No free Lighter slots. All ${($r==null?void 0:$r.length)||N} in use.`}),re&&mr&&Tt==="variational"&&!G&&ae==="ON"&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:'"No Variational slots available. Purchase Variational slot."'}),i.jsx("button",{onClick:()=>{window.open("#variational-farming","_self"),e(!1)},className:"bg-[#67FFBD]/10 text-[#67FFBD] border border-[#67FFBD]/30 hover:bg-[#67FFBD]/20 text-[11px] px-2 py-[3px] rounded-md transition-colors ml-4",children:"Variational Farming"})]})}),ee&&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."}),re&&Mt&&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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[v||0,"/",$r.length]})]})]}),i.jsx(hl,{styles:ls,components:{Option:Rn,SingleValue:ar},options:$r,value:$r.find(Zt=>Zt.value===Ve)||null,onChange:Zt=>bt((Zt==null?void 0:Zt.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:"py-1 space-y-3 px-3 sm:px-5",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"}),i.jsx("span",{className:"rounded-md w-max text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] bg-[#353535] px-2 h-6 flex items-center",children:"Lighter"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Lighter Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:Zt=>je(Zt.target.value),autoComplete:"off",placeholder:"1st Lighter Wallet Address ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:W,onChange:Zt=>ne(Zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${W===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr}),i.jsx("button",{type:"button",onClick:()=>jn(Zt=>!Zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:cr||wr,children:Kn?i.jsx(aa,{size:14}):i.jsx(oa,{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:_e,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return xe("");te(me)&&xe(me)},onKeyDown:we,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] ${_e===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Lighter Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:Zt=>je(Zt.target.value),autoComplete:"off",placeholder:"Lighter Wallet Address ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:W,onChange:Zt=>ne(Zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${W===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr}),i.jsx("button",{type:"button",onClick:()=>jn(Zt=>!Zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:cr||wr,children:Kn?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"}),i.jsx("div",{children:i.jsxs("div",{ref:p,className:"relative w-[120px]",children:[i.jsxs("div",{className:`${cr||wr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:Zt=>{Zt.preventDefault(),cr||wr||m(!ke)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(br=$n==null?void 0:$n.find(Zt=>(Zt==null?void 0:Zt.value)===Tt))==null?void 0:br.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${ke?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),ke&&i.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:$n==null?void 0:$n.map((Zt,me)=>i.jsxs("div",{onClick:dt=>{dt.preventDefault(),cr||wr||Tn(Zt==null?void 0:Zt.value)},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] min-w-max gap-1 ${(Zt==null?void 0:Zt.value)===Tt?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${cr||wr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:Zt==null?void 0:Zt.label}),(Zt==null?void 0:Zt.value)===Tt&&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"})})]},me))})})]})})]}),Tt==="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:Oe,onChange:Zt=>$e(Zt.target.value),autoComplete:"off",placeholder:"2nd Lighter Wallet Address",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:Zt=>he(Zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:De?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr}),i.jsx("button",{type:"button",onClick:()=>pe(Zt=>!Zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:cr||wr,children:De?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return ge("");te(me)&&ge(me)},onKeyDown:we,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]})]}),Tt==="variational"&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Variational Token"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Variational Token?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:S,onChange:Zt=>{const me=Zt.target.value;if(A(me),!me.trim()){T(null),V("");return}const dt=ir(me);if(dt&&(dt!=null&&dt.exp)){const _t=new Date((dt==null?void 0:dt.exp)*1e3);T(_t),V("")}else dt?(T(null),V("The token's expiration date could not be found.")):(T(null),V("Invalid token format."))},type:X?"text":"password",autoComplete:"off",placeholder:"Variational_Token",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${S===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr}),k&&i.jsxs("div",{className:"text-[12px] mt-1 pl-[3px] flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-[#CECECE] font-medium",children:"Valid Until:"})," ",i.jsx("span",{className:"text-[11px] font-semibold "+(ce?"text-[#FF797C]":"text-[#F8D4AB]"),children:k==null?void 0:k.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),ce&&i.jsx("span",{children:i.jsx("img",{src:Hl,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:()=>le(Zt=>!Zt),className:"absolute right-1 top-4 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:cr||wr,children:X?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:_e,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return xe("");te(me)&&xe(me)},onKeyDown:we,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] ${_e===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:cr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(hl,{styles:ls,components:{Option:lt,SingleValue:Nt},isDisabled:cr||wr,options:Lr,value:Lr.find(Zt=>Zt.value===ht)||null,onChange:Zt=>rt((Zt==null?void 0:Zt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:xt,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return Qt("");te(me)&&Qt(me)},onKeyDown:we,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${xt===""?"border-[#353535]":ve?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:cr||wr}),xt!==""&&!ve&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:On,onChange:Zt=>$t(Zt.target.value),className:`${cr||wr?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:cr||wr,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:xt,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return Qt("");te(me)&&Qt(me)},onKeyDown:we,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${xt===""?"border-[#353535]":ve?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:cr||wr}),xt!==""&&!ve&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]}),i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral (Requires 2 slots to work)"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Fo,{checked:ae==="ON",onChange:Zt=>q(Zt?"ON":"OFF"),disabled:cr||wr,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${cr||wr?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:St,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return on("");te(me)&&on(me)},onKeyDown:we,inputMode:"numeric",autoComplete:"off",placeholder:ht?`1–${ss}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${St===""?"border-[#353535]":Be?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:cr||wr})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":cn==="LONG",onClick:()=>!wr&&Vn("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",cr||wr?"cursor-not-allowed":"cursor-pointer",cn==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",St?` - ${St}x`:""]})}),i.jsx("div",{"aria-pressed":cn==="SHORT",onClick:()=>!wr&&Vn("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",cr||wr?"cursor-not-allowed":"cursor-pointer",cn==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",St?` - ${St}x`:""]})}),i.jsx("div",{"aria-pressed":cn==="RANDOM",onClick:()=>!wr&&Vn("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",cr||wr?"cursor-not-allowed":"cursor-pointer",cn==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",St?` - ${St}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":it==="MARKET",onClick:()=>!wr&&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",cr||wr?"cursor-not-allowed":"cursor-pointer",it==="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 ",it==="MARKET"?" ✓":""]})}),i.jsx("button",{"aria-pressed":it==="LIMIT",onClick:()=>!wr&&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",cr||wr?"cursor-not-allowed":"cursor-pointer",it==="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 ",it==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":it==="RANDOM",onClick:()=>!wr&&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",cr||wr?"cursor-not-allowed":"cursor-pointer",it==="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 ",it==="RANDOM"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:hn,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return nn("");Te(me)&&nn(me)},onKeyDown:we,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${hn===""?"border-[#353535]":Ue?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:cr||wr})]}),hn!==""&&!Ue&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:Vt,onChange:Zt=>{const me=Zt.target.value.trim();if(me==="")return pt("");Te(me)&&pt(me)},onKeyDown:we,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]":Fe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:cr||wr})]}),Vt!==""&&!Fe&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",St?Math.max(St*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),i.jsx("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Fo,{checked:ae==="ON",onChange:Zt=>q(Zt?"ON":"OFF"),disabled:cr||wr,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${cr||wr?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]})}),!1]}),i.jsx("div",{className:"py-3 flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl",children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!cr&&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:cr,children:"Cancel"}),re?ae==="ON"?G?i.jsx("button",{onClick:qn,disabled:cr,className:`${ee?"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:un?"Stopping...":"Stop"}):i.jsx("button",{onClick:dr,disabled:!ut||cr||Tt==="variational"&&mr&&ae==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!ut||cr||Tt==="variational"&&mr&&ae==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${ee?"hidden":""}`,children:Rt?"Starting...":"Start"}):G?i.jsx("button",{onClick:kr,disabled:cr,className:`${ee?"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:un?"Stopping...":"Stop"}):i.jsx("button",{onClick:Sr,disabled:!at||cr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!at||cr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${ee?"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"})]})}),vt&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},Nce=({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(Yr);es();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[N,I]=h.useState(""),[P,M]=h.useState(""),[F,$]=h.useState(""),[L,z]=h.useState(""),[Q,se]=h.useState(""),[ee,K]=h.useState(""),[re,de]=h.useState(""),[G,ie]=h.useState("LONG"),[ae,q]=h.useState(!1),[W,ne]=h.useState(!1),[oe,he]=h.useState(!1),[_e,xe]=h.useState(!1),[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(!0),[Ye,Je]=h.useState(!1),[ht,rt]=h.useState(!1),[st,He]=h.useState(!1),[Ve,bt]=h.useState(!1),[xt,Qt]=h.useState(!1),[St,on]=h.useState(!1),[cn,Vn]=h.useState(""),[tn,fn]=h.useState(!0);h.useState(1);const rn="https://dextrabothypev2.nftinit.io",nt=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}],[]),it=jn=>{var De;return((De=nt.find(pe=>pe.value===jn))==null?void 0:De.maxLeverage)??100},Ut=jn=>{["e","E","+","-"].includes(jn.key)&&jn.preventDefault()},hn=jn=>/^\d*$/.test(jn),nn=h.useMemo(()=>{if(ee==="")return!1;const jn=Number(ee);return Number.isInteger(jn)&&jn>=1&&jn<=100},[ee]),Vt=h.useMemo(()=>{if(re==="")return!1;const jn=Number(re),De=it(Q);return Number.isInteger(jn)&&jn>=1&&jn<=De},[re,Q]),pt=g&&N.trim()!==""&&F.trim()!==""&&P.trim()!==""&&L.trim()!==""&&Q!==""&&nn&&Vt&&(G==="LONG"||G==="SHORT"||G==="RANDOM"),We=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),It=()=>`apexCreds:${We()}`,Ge=()=>{try{const jn=localStorage.getItem(It());if(!jn)return;const De=JSON.parse(jn);De.apiKey&&I(De.apiKey),De.apiKeySecret&&M(De.apiKeySecret),De.omniKeySeed&&z(De.omniKeySeed),De.apiKeyPass&&$(De.apiKeyPass),typeof De.remember=="boolean"&&$e(De.remember)}catch{}},ct=()=>{if(Oe)try{localStorage.setItem(It(),JSON.stringify({apiKey:N,apiKeyPass:F,apiKeySecret:P,omniKeySeed:L,remember:!0}))}catch{}},vt=()=>{try{localStorage.removeItem(It())}catch{}};h.useEffect(()=>{if(!t)return;const jn=localStorage.getItem("hyperToken"),De=localStorage.getItem("hyperAddress");y(!!(jn&&De));const pe=setInterval(()=>{const qe=localStorage.getItem("hyperToken"),Ae=localStorage.getItem("hyperAddress");y(!!(qe&&Ae))},800);return()=>clearInterval(pe)},[t]),h.useEffect(()=>{!t||!g||(Ht(),Sn())},[t,g]),h.useEffect(()=>{if(!Q)return;const jn=it(Q),De=Number(re);!Number.isNaN(De)&&De>jn&&de(String(jn)),!Number.isNaN(De)&&De<1&&re!==""&&de("1")},[Q]),h.useEffect(()=>{t&&(Oe&&ct(),Oe||vt())},[N,F,P,L,Oe,t]);async function Ht(){var jn,De,pe,qe,Ae;try{ne(!0),ge("");const ze=window.localStorage.getItem("hyperToken"),zt=window.localStorage.getItem("hyperAddress");if(!ze||!zt){C(!1),Ge();return}const gt=await(await fetch(`${rn}/api/hyper/apex_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:zt.toLowerCase(),token:ze})})).json(),Mt=(jn=gt==null?void 0:gt.data)==null?void 0:jn.farming_params;if(gt!=null&>.success&&Mt){C(!0);const ln=((De=gt==null?void 0:gt.data)==null?void 0:De.apex_api_pkey)??"",vn=((pe=gt==null?void 0:gt.data)==null?void 0:pe.apex_api_pass)??"",Wn=((qe=gt==null?void 0:gt.data)==null?void 0:qe.apex_api_secret)??"",On=((Ae=gt==null?void 0:gt.data)==null?void 0:Ae.apex_key_seed)??"";ln&&I(String(ln)),vn&&$(String(vn)),Wn&&M(String(Wn)),On&&z(String(On)),Mt!=null&&Mt.symbol&&se(String(Mt.symbol)),(Mt==null?void 0:Mt.orderPerHour)!=null&&K(String(Mt.orderPerHour)),(Mt==null?void 0:Mt.leverage)!=null&&de(String(Mt.leverage)),Mt!=null&&Mt.direction&&ie(String(Mt.direction).toUpperCase()==="SHORT"?"SHORT":String(Mt.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG")}else C(!1);!N&&!F&&!P&&!L&&Ge()}catch{C(!1),Ge()}finally{ne(!1)}}async function Rt(){if(!g){n(!0);return}if(pt)try{he(!0),ge("");const jn=window.localStorage.getItem("hyperToken"),De=window.localStorage.getItem("hyperAddress");if(!jn||!De){n(!0);return}const pe={symbol:Q,orderPerHour:Number(ee),leverage:Number(re),direction:G},qe={address:De.toLowerCase(),token:jn,apex_api_pkey:N,apex_api_secret:P,apex_api_pass:F,apex_key_seed:L,farming_params:pe},ze=await(await fetch(`${rn}/api/hyper/apex_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(qe)})).json();ze!=null&&ze.success?(C(!0),Oe&&ct()):ge((ze==null?void 0:ze.error_message)||"Start failed.")}catch(jn){ge(jn.message||"An error occurred while saving.")}finally{he(!1)}}async function mn(){if(!g){n(!0);return}try{xe(!0),ge("");const jn=window.localStorage.getItem("hyperToken"),De=window.localStorage.getItem("hyperAddress");if(!jn||!De){n(!0);return}const qe=await(await fetch(`${rn}/api/hyper/apex_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:De.toLowerCase(),token:jn})})).json();qe!=null&&qe.success?C(!1):ge((qe==null?void 0:qe.error_message)||"Stop failed.")}catch(jn){ge(jn.message||"An error occurred while stopping.")}finally{xe(!1)}}const un={control:(jn,De)=>({...jn,backgroundColor:"#242424",borderColor:De.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:jn=>({...jn,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:jn=>({...jn,height:32}),input:jn=>({...jn,color:"#FFFFFF",margin:0,padding:0}),singleValue:jn=>({...jn,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:jn=>({...jn,color:"#7F7F7F",fontSize:"12px"}),menu:jn=>({...jn,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:jn=>({...jn,paddingTop:0,paddingBottom:0}),option:(jn,De)=>({...jn,backgroundColor:De.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:jn=>({...jn,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:jn=>({...jn,backgroundColor:"#353535"})},yn=({max:jn})=>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:[jn,"x"]}),_n=jn=>{var De;return i.jsx(ma.Option,{...jn,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((De=jn.data)==null?void 0:De.icon)&&i.jsx("img",{src:jn.data.icon,alt:jn.data.label,className:"w-4 h-4 rounded-[4px]",onError:pe=>pe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:jn.data.label}),i.jsx(yn,{max:jn.data.maxLeverage})]})})},In=jn=>{var De;return i.jsx(ma.SingleValue,{...jn,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((De=jn.data)==null?void 0:De.icon)&&i.jsx("img",{src:jn.data.icon,alt:jn.data.label,className:"w-4 h-4 rounded-[4px]",onError:pe=>pe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:jn.data.label}),i.jsx(yn,{max:jn.data.maxLeverage})]})})},Sn=async()=>{var pe,qe;const jn=window.localStorage.getItem("hyperToken"),De=window.localStorage.getItem("hyperAddress");if(!(!jn||!De))try{q(!0);const Ae=await vi(De.toLowerCase(),jn);Ae!=null&&Ae.success?(r(Ae==null?void 0:Ae.telegram_chat_id),s(Ae==null?void 0:Ae.subscriber_role),a(Ae==null?void 0:Ae.subs_expire_day),o((pe=Ae==null?void 0:Ae.mushboomer_counts)==null?void 0:pe.eth),l((qe=Ae==null?void 0:Ae.mushboomer_counts)==null?void 0:qe.sol),c(Ae==null?void 0:Ae.referral_code),u(Ae==null?void 0:Ae.refcode),d(Ae==null?void 0:Ae.whitelist),f(jn),x(De),fn(!0),q(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),q(!1))}catch(Ae){console.error("Token verification error:",Ae),console.error(Ae.message||"An unknown error occurred."),q(!1)}},Yn=nt;if(!t)return null;const Xn=W||oe||_e||ae,zn=v&&!_e,Kn=it(Q);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:St,setOpen:on,transactionHash:cn,transactionLoading:xt,paymentPresaleRole:tn,errorFunds:Ce,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:()=>!Xn&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"apex",onCloseCurrent:()=>!Xn&&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(OT,{})}),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:[Se&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Se}),i.jsxs("div",{className:"space-y-3 px-3 sm:px-5 py-2",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://omni.apex.exchange/keyManagement",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:N,onChange:jn=>I(jn.target.value),autoComplete:"off",placeholder:"API_KEY",type:Ye?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${N===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Xn||zn}),i.jsx("button",{type:"button",onClick:()=>Je(jn=>!jn),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:Xn||zn,children:Ye?i.jsx(aa,{size:14}):i.jsx(oa,{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:jn=>$(jn.target.value),autoComplete:"off",placeholder:"API_KEY_PAASSPHRASE",type:st?"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:Xn||zn}),i.jsx("button",{type:"button",onClick:()=>He(jn=>!jn),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:Xn||zn,children:st?i.jsx(aa,{size:14}):i.jsx(oa,{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:P,onChange:jn=>M(jn.target.value),autoComplete:"off",placeholder:"API_KEY_SECRET",type:ht?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${P===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Xn||zn}),i.jsx("button",{type:"button",onClick:()=>rt(jn=>!jn),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:Xn||zn,children:ht?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Omni Key Seed"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:L,onChange:jn=>z(jn.target.value),autoComplete:"off",placeholder:"OMNI_KEY_SEED",type:Ve?"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:Xn||zn}),i.jsx("button",{type:"button",onClick:()=>bt(jn=>!jn),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:Xn||zn,children:Ve?i.jsx(aa,{size:14}):i.jsx(oa,{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(hl,{styles:un,components:{Option:_n,SingleValue:In},isDisabled:Xn||zn,options:Yn,value:Yn.find(jn=>jn.value===Q)||null,onChange:jn=>se((jn==null?void 0:jn.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:ee,onChange:jn=>{const De=jn.target.value.trim();if(De==="")return K("");hn(De)&&K(De)},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] ${ee===""?"border-[#353535]":nn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Xn||zn}),ee!==""&&!nn&&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:re,onChange:jn=>{const De=jn.target.value.trim();if(De==="")return de("");hn(De)&&de(De)},onKeyDown:Ut,inputMode:"numeric",autoComplete:"off",placeholder:Q?`1–${Kn}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${re===""?"border-[#353535]":Vt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Xn||zn})]}),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:()=>!zn&&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",re?"text-[10px] px-1.5":"text-[11px] px-2",Xn||zn?"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",re?` - ${re}x`:""]})}),i.jsx("div",{"aria-pressed":G==="SHORT",onClick:()=>!zn&&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",re?"text-[10px] px-1.5":"text-[11px] px-2",Xn||zn?"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",re?` - ${re}x`:""]})}),i.jsx("div",{"aria-pressed":G==="RANDOM",onClick:()=>!zn&&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",re?"text-[10px] px-1.5":"text-[11px] px-2",Xn||zn?"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",re?` - ${re}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:()=>!Xn&&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:Xn,children:"Cancel"}),g?v?i.jsx("button",{onClick:mn,disabled:Xn,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:_e?"Stopping...":"Stop"}):i.jsx("button",{onClick:Rt,disabled:!pt||Xn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!pt||Xn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:oe?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})]}),W&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},jce=({open:t=!1,setOpen:e=()=>{}})=>{var ls,cs;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=h.useContext(Yr);es();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[N,I]=h.useState(1),[P,M]=h.useState(0),[F,$]=h.useState(0),[L,z]=h.useState({}),[Q,se]=h.useState(null),[ee,K]=h.useState(!1),[re,de]=h.useState("variational");h.useState(!1),h.useRef(null);const[G,ie]=h.useState(!1),[ae,q]=h.useState(!1),[W,ne]=h.useState(0),[oe,he]=h.useState("OFF"),[_e,xe]=h.useState(""),[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState(null),[ht,rt]=h.useState(""),[st,He]=h.useState(""),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState("");h.useState("");const[St,on]=h.useState("");h.useState([]);const[cn,Vn]=h.useState(""),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState("LONG"),[hn,nn]=h.useState("STANDARD"),[Vt,pt]=h.useState("STANDARD"),[We,It]=h.useState("MARKET"),[Ge,ct]=h.useState(""),[vt,Ht]=h.useState(""),[Rt,mn]=h.useState(""),[un,yn]=h.useState("Hour"),[_n,In]=h.useState(!1),[Sn,Yn]=h.useState(!1),[Xn,zn]=h.useState(!1),[Kn,jn]=h.useState(!1),[De,pe]=h.useState(""),[qe,Ae]=h.useState(""),[ze,zt]=h.useState(!0),[kt,gt]=h.useState(!1),[Mt,ln]=h.useState(!1),[vn,Wn]=h.useState(!1),[On,$t]=h.useState(!1),[Nn,Fn]=h.useState(!1),[Tt,pn]=h.useState(""),[ke,m]=h.useState(!0),[p,S]=h.useState(""),A=Ye?(Ye==null?void 0:Ye.getTime())<=Date.now():!1;h.useState(1);const k="https://dextrabothypev2.nftinit.io",T="",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 Nt;return((Nt=D.find(Rn=>Rn.value===lt))==null?void 0:Nt.maxLeverage)??100},X=lt=>{["e","E","+","-"].includes(lt.key)&<.preventDefault()},le=lt=>/^\d*\.?\d{0,6}$/.test(lt),ce=lt=>/^\d*$/.test(lt),fe=h.useMemo(()=>{if(tn==="")return!1;const lt=Number(tn);return Number.isInteger(lt)&<>=1&<<=120},[tn]),ye=h.useMemo(()=>{if(rn==="")return!1;const lt=Number(rn),Nt=V(St);return Number.isInteger(lt)&<>=1&<<=Nt},[rn,St]),Pe=h.useMemo(()=>{if(Ge==="")return!1;const lt=Number(Ge);return Number.isNaN(lt)?!1:lt===0?!0:lt>=1&<<=1e7},[Ge]),Me=h.useMemo(()=>{if(vt==="")return!1;const lt=Number(vt);if(Number.isNaN(lt))return!1;const Nt=rn===""?null:Number(rn),Rn=Nt?Nt*100-1:4999;return lt===0?!0:lt>0&<<1?!1:lt>=1&<<=Rn},[vt,rn]);h.useMemo(()=>{if(Rt==="")return!1;const lt=Number(Rt);return!Number.isNaN(lt)&<>0&<<=100},[Rt]);const Ke=g&&Oe.trim()!==""&&St!==""&&fe&&ye&&(!Ge||Pe)&&(!vt||Me)&&!A&&!ht&&cn&&(it==="LONG"||it==="SHORT"||it==="RANDOM")&&(We==="LIMIT"||We==="MARKET"||We==="RANDOM")&&ke,we=g&&Oe.trim()!==""&&St!==""&&fe&&cn&&ye&&cn&&ke,Te=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),te=()=>`variationalCreds:${Te()}`,ve=()=>{try{const lt=localStorage.getItem(te());if(!lt)return;const Nt=JSON.parse(lt);Nt.variationalToken&&$e(Nt.variationalToken),typeof Nt.remember=="boolean"&&zt(Nt.remember)}catch{}},Be=()=>{if(ze)try{localStorage.setItem(te(),JSON.stringify({variationalToken:Oe,remember:!0}))}catch{}},Ue=()=>{try{localStorage.removeItem(te())}catch{}};h.useEffect(()=>{if(!t)return;const lt=localStorage.getItem("hyperToken"),Nt=localStorage.getItem("hyperAddress");y(!!(lt&&Nt));const Rn=setInterval(()=>{const ar=localStorage.getItem("hyperToken"),Tr=localStorage.getItem("hyperAddress");y(!!(ar&&Tr))},800);return()=>clearInterval(Rn)},[t]),h.useEffect(()=>{!t||!g||(Fe(),Sr())},[t,g]),h.useEffect(()=>{t&&(vt===""&&Ht(T),Ge===""&&ct(T),Rt===""&&mn(T))},[t]),h.useEffect(()=>{if(!St)return;const lt=V(St),Nt=Number(rn);!Number.isNaN(Nt)&&Nt>lt&&nt(String(lt)),!Number.isNaN(Nt)&&Nt<1&&rn!==""&&nt("1")},[St]),h.useEffect(()=>{t&&(ze&&Be(),ze||Ue())},[Oe,ze,t]);async function Fe(){var lt,Nt,Rn,ar,Tr,Lr,$r,cr;try{Yn(!0),pe("");const wr=window.localStorage.getItem("hyperToken"),ss=window.localStorage.getItem("hyperAddress");if(!wr||!ss){C(!1),ve();return}const ts=await(await fetch(`${k}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ss.toLowerCase(),token:wr})})).json();if(!(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 Qs=cn?cn.toLowerCase().replace("-","_farming_"):null,Es=L==null?void 0:L[Qs];if(Qs&&Es){const br={...L,[Qs]:{...Es,isStop:!0}};z(br);const me=Object.keys(br).filter(dt=>dt.startsWith("variational"));if(me.length>0&&!cn){const At=me.sort((xn,Cn)=>{var pr,hr;const fr=parseInt(((pr=xn.match(/\d+/))==null?void 0:pr[0])||0,10),_r=parseInt(((hr=Cn.match(/\d+/))==null?void 0:hr[0])||0,10);return fr-_r})[0].match(/\d+/);At&&Vn(`Variational-${At[0]}`)}}else Vn("Variational-1")}ts!=null&&ts.slots_info&&($((Nt=(lt=ts==null?void 0:ts.slots_info)==null?void 0:lt.variational)==null?void 0:Nt.total_qty),M((ar=(Rn=ts==null?void 0:ts.slots_info)==null?void 0:Rn.variational)==null?void 0:ar.active_qty));return}if(ts!=null&&ts.success&&(ts!=null&&ts.data)){const Qs=cn?cn.toLowerCase().replace("-","_farming_"):null,Es=L==null?void 0:L[Qs],br=ts.data||{};Qs&&!br[Qs]&&Es&&(br[Qs]={...Es,isStop:!0}),z(br);const me=Object.keys(br).filter(dt=>dt.startsWith("variational"));if(me.length>0&&!cn){const At=me.sort((xn,Cn)=>{var pr,hr;const fr=parseInt(((pr=xn.match(/\d+/))==null?void 0:pr[0])||0,10),_r=parseInt(((hr=Cn.match(/\d+/))==null?void 0:hr[0])||0,10);return fr-_r})[0].match(/\d+/);At&&Vn(`Variational-${At[0]}`)}ts!=null&&ts.slots_info&&($((Lr=(Tr=ts==null?void 0:ts.slots_info)==null?void 0:Tr.variational)==null?void 0:Lr.total_qty),M((cr=($r=ts==null?void 0:ts.slots_info)==null?void 0:$r.variational)==null?void 0:cr.active_qty))}}catch{C(!1),ve(),he("OFF"),K(!1)}finally{Yn(!1)}}const at=h.useMemo(()=>cn?cn.toLowerCase().replace("-","_farming_"):"",[cn]),ut=!!((ls=L==null?void 0:L[at])!=null&&ls.delta)&&!!((cs=L==null?void 0:L[at])!=null&&cs.from_slot),yt=at;h.useEffect(()=>{var Rn,ar,Tr,Lr,$r,cr,wr,ss,mr,ts,Qs,Es,br,Zt,me,dt;if(!cn||!L)return;const lt=yt,Nt=L==null?void 0:L[lt];if(!Nt){xe(""),ge(""),je(""),He(""),bt(""),Qt(""),on(""),fn(""),S(""),nt(""),Ut("LONG"),It("MARKET"),C(!1),he("OFF"),K(!1),yn("Hour"),ct(""),Ht(""),$e(""),Je(null),de("variational"),q(!1),ne(0);return}if((Nt==null?void 0:Nt.target_params)==null&&Nt.source_params){Nt!=null&&Nt.isStop?C(!1):C(!0),he("OFF"),K(!1),q(!1);const _t=Nt.source_params,At=(Nt==null?void 0:Nt.slot_number)??"";At&&!ut&&Vn(`Variational-${At}`),_t!=null&&_t.cycleSeconds&&yn((_t==null?void 0:_t.cycleSeconds)===86400?"Day":"Hour"),_t!=null&&_t.vr_token&&$e(String(_t.vr_token)),_t!=null&&_t.coin&&on(String(_t.coin)),(_t==null?void 0:_t.orderPerHour)!=null&&fn(String(_t.orderPerHour)),(_t==null?void 0:_t.leverage)!=null&&nt(String(_t.leverage)),_t!=null&&_t.direction&&Ut(String(_t.direction).toUpperCase()==="SHORT"?"SHORT":String(_t.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),_t!=null&&_t.orderType&&It(String(_t.orderType).toUpperCase()==="MARKET"?"MARKET":String(_t.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(_t==null?void 0:_t.tp)!=null&&ct(String(_t.tp)),(_t==null?void 0:_t.sl)!=null&&Ht(String(_t.sl))}else if((Nt==null?void 0:Nt.target_params)!==null){Nt!=null&&Nt.isStop?(C(!1),q(!1)):(C(!0),q(!0)),he("OFF"),K(!1);const _t=(Nt==null?void 0:Nt.slot_number)??"";ne(_t),_t&&!ut&&Vn(`Variational-${_t}`),(Rn=Nt==null?void 0:Nt.source_params)!=null&&Rn.vr_token&&$e(String((ar=Nt==null?void 0:Nt.source_params)==null?void 0:ar.vr_token)),(Tr=Nt==null?void 0:Nt.target_params)!=null&&Tr.coin&&on(String((Lr=Nt==null?void 0:Nt.target_params)==null?void 0:Lr.coin)),(($r=Nt==null?void 0:Nt.source_params)==null?void 0:$r.orderPerHour)!=null&&fn(String((cr=Nt==null?void 0:Nt.source_params)==null?void 0:cr.orderPerHour)),Nt!=null&&Nt.source_app&&S(Nt==null?void 0:Nt.source_app),((wr=Nt==null?void 0:Nt.source_params)==null?void 0:wr.leverage)!=null&&nt(String((ss=Nt==null?void 0:Nt.source_params)==null?void 0:ss.leverage)),(mr=Nt==null?void 0:Nt.source_params)!=null&&mr.accountType&&nn(((ts=Nt==null?void 0:Nt.source_params)==null?void 0:ts.accountType)==="standart"?"STANDARD":"PREMIUM"),(Qs=Nt==null?void 0:Nt.target_params)!=null&&Qs.accountType&&pt(((Es=Nt==null?void 0:Nt.target_params)==null?void 0:Es.accountType)==="standart"?"STANDARD":"PREMIUM"),Nt!=null&&Nt.target_app&&de(((Nt==null?void 0:Nt.target_app)==="variational","variational")),(br=Nt==null?void 0:Nt.target_params)!=null&&br.vr_token&&$e((Zt=Nt==null?void 0:Nt.target_params)==null?void 0:Zt.vr_token),(me=Nt==null?void 0:Nt.target_params)!=null&&me.cycleSeconds&&yn(((dt=Nt==null?void 0:Nt.target_params)==null?void 0:dt.cycleSeconds)===86400?"Day":"Hour")}else C(!1),he("OFF"),K(!1)},[cn,L,ut,yt]);const Lt=lt=>{var Nt;return Number(((Nt=String(lt||"").match(/\d+/))==null?void 0:Nt[0])||0)},Gt=lt=>(lt||"").toLowerCase().replace("-","_"),an=h.useMemo(()=>{const lt=L==null?void 0:L[Gt(cn)];if(lt!=null&<.delta&&(lt!=null&<.from_slot))return Number(lt.from_slot);const Nt=Number(lt==null?void 0:lt.slot_number);return Number.isFinite(Nt)?Nt:Lt(cn)},[cn,L]),et=h.useMemo(()=>{const lt=Number(N)||0,Nt=Array.from({length:lt},()=>({used:!1,kind:null})),Rn=L||{};for(const[ar,Tr]of Object.entries(Rn)){if(!ar.startsWith("variational_farming"))continue;const Lr=Lt(ar)-1;Lr<0||Lr>=lt||((Tr==null?void 0:Tr.isStop)===!0?Nt[Lr]={used:!1,kind:null}:Tr!=null&&Tr.source_params?Nt[Lr]={used:!0,kind:"delta-src"}:Tr!=null&&Tr.target_params||Tr!=null&&Tr.delta?Nt[Lr]={used:!0,kind:"delta-shadow"}:Tr!=null&&Tr.farming_params?Nt[Lr]={used:!0,kind:"single"}:Nt[Lr]={used:!0,kind:"unknown"})}return Nt},[L,N]),Pt=h.useMemo(()=>et.map((lt,Nt)=>lt.used&<.kind!=="delta-src-inferred"?`Variational-${Nt+1}`:null).filter(Boolean),[et]);h.useMemo(()=>et.filter(lt=>!lt.used).length,[et]);async function qt(){if(!g){n(!0);return}if(Ke)try{zn(!0),pe("");const lt=window.localStorage.getItem("hyperToken"),Nt=window.localStorage.getItem("hyperAddress");if(!lt||!Nt){n(!0);return}const Rn={vr_token:Oe,coin:St,orderPerHour:Number(tn),leverage:Number(rn),direction:it,orderType:"MARKET",tp:Number(Ge),sl:Number(vt),cycleSeconds:un==="Hour"?3600:86400},ar={api_pkey:Se,api_index:st,login_wallet:xt,coin:St==null?void 0:St.replace("USDT",""),orderPerHour:Number(tn),leverage:Number(rn)},Tr={address:Nt.toLowerCase(),token:lt,source_app:"variational_farming",source_params:Rn,slot_number:Number(cn==null?void 0:cn.replace("Variational-",""))},$r=await(await fetch(`${k}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Tr)})).json();$r!=null&&$r.success?(C(!0),Fe(),ze&&Be()):pe(($r==null?void 0:$r.error_message)||"Start failed.")}catch(lt){pe(lt.message||"An error occurred while saving.")}finally{zn(!1)}}async function ft(){if(!g){n(!0);return}try{jn(!0),pe("");const lt=window.localStorage.getItem("hyperToken"),Nt=window.localStorage.getItem("hyperAddress");if(!lt||!Nt){n(!0);return}const ar=await(await fetch(`${k}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Nt.toLowerCase(),token:lt,...ae?{slot_number:W,target_app:"variational_delta",source_app:p}:{source_app:"variational_farming",slot_number:an}})})).json();ar!=null&&ar.success?(C(!1),Fe()):pe((ar==null?void 0:ar.error_message)||"Stop failed.")}catch(lt){pe(lt.message||"An error occurred while stopping.")}finally{jn(!1)}}const tt={control:(lt,Nt)=>({...lt,backgroundColor:"#242424",borderColor:Nt.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,Nt)=>({...lt,backgroundColor:Nt.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(!Oe){Je(null),rt("");return}const lt=dr(Oe);if(lt&&(lt!=null&<.exp)){const Nt=new Date(lt.exp*1e3);Je(Nt),rt("")}else lt?(Je(null),rt("The token's expiration date could not be found.")):(Je(null),rt("Invalid token format."))},[Oe]);const Bt=({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"]}),gn=lt=>{var Nt,Rn;return i.jsx(ma.Option,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Nt=lt.data)!=null&&Nt.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:`w-4 h-4 ${((Rn=lt==null?void 0:lt.data)==null?void 0:Rn.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:ar=>ar.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(Bt,{max:lt.data.maxLeverage})]})})},tr=lt=>{var Nt,Rn;return i.jsx(ma.SingleValue,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Nt=lt.data)!=null&&Nt.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:`w-4 h-4 ${((Rn=lt==null?void 0:lt.data)==null?void 0:Rn.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:ar=>ar.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(Bt,{max:lt.data.maxLeverage})]})})},Dn=lt=>{const Nt=Pt.includes(lt.data.value);return i.jsx(ma.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}),Nt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},er=lt=>i.jsx(ma.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})})}),Sr=async()=>{var Rn,ar,Tr,Lr,$r,cr,wr,ss;const lt=window.localStorage.getItem("hyperToken"),Nt=window.localStorage.getItem("hyperAddress");if(!(!lt||!Nt))try{In(!0);const mr=await vi(Nt.toLowerCase(),lt);mr!=null&&mr.success?(r(mr==null?void 0:mr.telegram_chat_id),s(mr==null?void 0:mr.subscriber_role),a(mr==null?void 0:mr.subs_expire_day),o((Rn=mr==null?void 0:mr.mushboomer_counts)==null?void 0:Rn.eth),l((ar=mr==null?void 0:mr.mushboomer_counts)==null?void 0:ar.sol),c(mr==null?void 0:mr.referral_code),u(mr==null?void 0:mr.refcode),d(mr==null?void 0:mr.whitelist),f(lt),x(Nt),m(!0),I((Lr=(Tr=mr==null?void 0:mr.slots_info)==null?void 0:Tr.variational)==null?void 0:Lr.total_qty),$((cr=($r=mr==null?void 0:mr.slots_info)==null?void 0:$r.variational)==null?void 0:cr.total_qty),M((ss=(wr=mr==null?void 0:mr.slots_info)==null?void 0:wr.variational)==null?void 0:ss.active_qty),In(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),In(!1))}catch(mr){console.error("Token verification error:",mr),console.error(mr.message||"An unknown error occurred."),In(!1)}};function dr(lt){try{const Nt=lt.split(".");if(Nt.length!==3)throw new Error("Invalid JWT format");const ar=Nt[1].replace(/-/g,"+").replace(/_/g,"/"),Tr=decodeURIComponent(atob(ar).split("").map(Lr=>"%"+("00"+Lr.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Tr)}catch{return null}}const kr=D,qn=h.useMemo(()=>Array.from({length:N},(lt,Nt)=>({value:`Variational-${Nt+1}`,label:`Variational-${Nt+1}`})),[N]);if(!t)return null;const Tn=Sn||Xn||Kn||_n,$n=v&&!Kn,ir=V(St);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Nn,setOpen:Fn,transactionHash:Tt,transactionLoading:On,paymentPresaleRole:ke,errorFunds:qe,activeMethod:2}),i.jsx(M5,{open:G,setOpen:ie,paymentLighterRole:ke,oldSlotCount:Q,checkAccountLighter:Sr,tradeMarket:"variational"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Tn&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"variational",onCloseCurrent:()=>!Tn&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://omni.variational.io/_app/immutable/assets/full_omni_wordmark.DwlcSpMk.svg",alt:"Variational",className:"h-[18px] text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] mt-[1px]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Variational Farming module lets you set up automated farming by providing your Variational Token, selecting a pair, defining orders per hour, leverage, direction and order type ."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[De&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:De}),g&&ke&&F===P&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:"No free Variational slots. Currently running on Delta Neutral."}),g&&ae&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`Currently used for Delta Neutral in ${p.charAt(0).toUpperCase()+p.slice(1)} Farming (Slot-${W})`}),g&&ke&&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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[P||0,"/",qn.length]})]})]}),i.jsx(hl,{styles:tt,components:{Option:Dn,SingleValue:er},options:qn,value:qn.find(lt=>lt.value===cn)||null,onChange:lt=>Vn((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:[oe==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Variational Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ve,onChange:lt=>bt(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] ${Ve===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n})})]}),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:_e,onChange:lt=>xe(lt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",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] ${_e===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n}),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:Tn||$n,children:kt?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return je("");ce(Nt)&&je(Nt)},onKeyDown:X,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n})})]})]}):i.jsx(i.Fragment,{}),oe==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Variational Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:xt,onChange:lt=>Qt(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] ${xt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n})})]}),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:Se,onChange:lt=>ge(lt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:vn?"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:Tn||$n}),i.jsx("button",{type:"button",onClick:()=>Wn(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:Tn||$n,children:vn?i.jsx(aa,{size:14}):i.jsx(oa,{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:st,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return He("");ce(Nt)&&He(Nt)},onKeyDown:X,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] ${st===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${oe==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Variational Token"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Variational Token?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Oe,onChange:lt=>{const Nt=lt.target.value;if($e(Nt),!Nt.trim()){Je(null),rt("");return}const Rn=dr(Nt);if(Rn&&(Rn!=null&&Rn.exp)){const ar=new Date((Rn==null?void 0:Rn.exp)*1e3);Je(ar),rt("")}else Rn?(Je(null),rt("The token's expiration date could not be found.")):(Je(null),rt("Invalid token format."))},type:Mt?"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] ${Oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Tn||$n}),Ye&&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:Ye==null?void 0:Ye.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),A&&i.jsx("span",{children:i.jsx("img",{src:Hl,alt:"",className:"w-3.5 h-3.5"})})]}),ht&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:ht}),i.jsx("button",{type:"button",onClick:()=>ln(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:Tn||$n,children:Mt?i.jsx(aa,{size:14}):i.jsx(oa,{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(hl,{styles:tt,components:{Option:gn,SingleValue:tr},isDisabled:Tn||$n,options:kr,value:kr.find(lt=>lt.value===St)||null,onChange:lt=>on((lt==null?void 0:lt.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:tn,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return fn("");ce(Nt)&&fn(Nt)},onKeyDown:X,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] ${tn===""?"border-[#353535]":fe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tn||$n}),tn!==""&&!fe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 120."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${oe==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:un,onChange:lt=>yn(lt.target.value),className:`${Tn||$n?"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:Tn||$n,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:tn,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return fn("");ce(Nt)&&fn(Nt)},onKeyDown:X,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] ${tn===""?"border-[#353535]":fe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tn||$n}),tn!==""&&!fe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 120."})]}),i.jsxs("div",{className:`${oe==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:oe==="ON"?"On":"Off"}),i.jsx(Fo,{checked:oe==="ON",onChange:lt=>he(lt?"ON":"OFF"),disabled:Tn||$n,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 ${Tn||$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 ${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:rn,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return nt("");ce(Nt)&&nt(Nt)},onKeyDown:X,inputMode:"numeric",autoComplete:"off",placeholder:St?`1–${ir}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${rn===""?"border-[#353535]":ye?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tn||$n})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":it==="LONG",onClick:()=>!$n&&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",Tn||$n?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})}),i.jsx("div",{"aria-pressed":it==="SHORT",onClick:()=>!$n&&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",Tn||$n?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})}),i.jsx("div",{"aria-pressed":it==="RANDOM",onClick:()=>!$n&&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",Tn||$n?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})})]})]}),i.jsxs("div",{className:`${ae?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{"aria-pressed":We==="MARKET",onClick:()=>!$n&&It("MARKET"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2 min-w-max",Tn||$n?"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:`${ae?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:Ge,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return ct("");le(Nt)&&ct(Nt)},onKeyDown:X,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] ${Ge===""?"border-[#353535]":Pe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tn||$n})]}),Ge!==""&&!Pe&&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:vt,onChange:lt=>{const Nt=lt.target.value.trim();if(Nt==="")return Ht("");le(Nt)&&Ht(Nt)},onKeyDown:X,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]":Me?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Tn||$n})]}),vt!==""&&!Me&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",rn?Math.max(rn*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]})]}),i.jsx("div",{className:`${oe==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Tn&&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:Tn,children:"Cancel"}),g?oe==="ON"?v?i.jsx("button",{onClick:stopLighterFarming,disabled:Tn,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:Kn?"Stopping...":"Stop"}):i.jsx("button",{onClick:saveLighterFarming,disabled:!we||Tn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!we||Tn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Xn?"Starting...":"Start"}):v?i.jsx("button",{onClick:ft,disabled:Tn,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:Kn?"Stopping...":"Stop"}):i.jsx("button",{onClick:qt,disabled:!Ke||Tn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Ke||Tn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Xn?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),Sn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},SU=({open:t=!1,setOpen:e=()=>{}})=>{var ci,Fr,En,Bn;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(Yr),{address:g}=es(),[y,v]=h.useState(!1),[C,N]=h.useState(!1),[I,P]=h.useState(1),[M,F]=h.useState(0),[$,L]=h.useState(0),[z,Q]=h.useState(0),[se,ee]=h.useState(0),[K,re]=h.useState({}),[de,G]=h.useState(null),[ie,ae]=h.useState("variational"),[q,W]=h.useState(!1),ne=h.useRef(null),[oe,he]=h.useState(!1),[_e,xe]=h.useState("Extended-1"),[Se,ge]=h.useState("ON"),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState(""),[ht,rt]=h.useState(""),[st,He]=h.useState(""),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState(""),[St,on]=h.useState(""),[cn,Vn]=h.useState([]),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState("LONG"),[hn,nn]=h.useState("STANDARD"),[Vt,pt]=h.useState("STANDARD"),[We,It]=h.useState("LIMIT"),[Ge,ct]=h.useState("LIMIT"),[vt,Ht]=h.useState("MARKET"),[Rt,mn]=h.useState(""),[un,yn]=h.useState(""),[_n,In]=h.useState(""),[Sn,Yn]=h.useState(!1),[Xn,zn]=h.useState(!1),[Kn,jn]=h.useState(!1),[De,pe]=h.useState(!1),[qe,Ae]=h.useState(""),[ze,zt]=h.useState(""),[kt,gt]=h.useState(!0),[Mt,ln]=h.useState(!1),[vn,Wn]=h.useState(!1),[On,$t]=h.useState(!1),[Nn,Fn]=h.useState(!1),[Tt,pn]=h.useState(!1),[ke,m]=h.useState(!1),[p,S]=h.useState(!1),[A,k]=h.useState(""),[T,D]=h.useState(!0),[V,X]=h.useState(""),[le,ce]=h.useState(null),[fe,ye]=h.useState(""),[Pe,Me]=h.useState(!1),Ke=le?(le==null?void 0:le.getTime())<=Date.now():!1,[we,Te]=h.useState("Hour"),[te,ve]=h.useState([]),[Be,Ue]=h.useState(""),[Fe,at]=h.useState(!1),[ut,yt]=h.useState(!1);h.useState(1);const Lt="https://dextrabothypev2.nftinit.io",Gt="",an=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}],[]),et=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}],[]),Pt={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"};h.useEffect(()=>{async function mt(){if(t)try{const sr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended")).json();if(sr!=null&&sr.coins){let Zn=sr.coins.map(Or=>{const Ir=(Or==null?void 0:Or.label)||"",ns=Pt[Ir]||Ir,Ls=ns==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":ns==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":ns==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":ns==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":ns==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":ns==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":ns==="4"||ns=="EUR"||ns=="EDEN"||ns=="XAU"?"":`https://app.hyperliquid.xyz/coins/${ns}.svg`;return{...Or,icon:Ls}});Vn(Zn)}}catch(Kt){console.error("Failed to fetch coin list:",Kt)}}mt()},[t]);async function qt(){try{at(!0);const mt=window.localStorage.getItem("hyperToken"),Kt=window.localStorage.getItem("hyperAddress");if(!mt||!Kt){n(!0);return}const sr=`${Lt}/api/wallet/list-extended`,Or=await(await fetch(`${sr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Kt.toLowerCase(),token:mt})})).json();Or!=null&&Or.success?ve((Or==null?void 0:Or.data)||[]):Ae((Or==null?void 0:Or.error_message)||"Failed to load wallets.")}catch(mt){Ae(mt.message||"Wallet list error.")}finally{at(!1)}}const ft=mt=>{var Kt;return((Kt=(Se==="ON"?et:an).find(sr=>sr.value===mt))==null?void 0:Kt.maxLeverage)??100},tt=mt=>{["e","E","+","-"].includes(mt.key)&&mt.preventDefault()},Bt=mt=>/^\d*\.?\d{0,6}$/.test(mt),gn=mt=>/^\d*$/.test(mt),tr=h.useMemo(()=>{if(tn==="")return!1;const mt=Number(tn);return Number.isInteger(mt)&&mt>=1&&mt<=120},[tn]),Dn=h.useMemo(()=>{if(rn==="")return!1;const mt=Number(rn),Kt=ft(St);return Number.isInteger(mt)&&mt>=1&&mt<=Kt},[rn,St]),er=h.useMemo(()=>{if(Rt==="")return!1;const mt=Number(Rt);return Number.isNaN(mt)?!1:mt===0?!0:mt>=1&&mt<=1e7},[Rt]),Sr=h.useMemo(()=>{if(un==="")return!1;const mt=Number(un);if(Number.isNaN(mt))return!1;const Kt=rn===""?null:Number(rn),sr=Kt?Kt*100-1:4999;return mt===0?!0:mt>0&&mt<1?!1:mt>=1&&mt<=sr},[un,rn]);h.useMemo(()=>{if(_n==="")return!1;const mt=Number(_n);return!Number.isNaN(mt)&&mt>0&&mt<=100},[_n]);const dr=Se=="ON"?et:an,kr=h.useMemo(()=>St?dr.some(mt=>mt.value===St):!1,[St,dr]),qn=y&&Ce.trim()!==""&&Ve.trim()!==""&&Ye.trim()!==""&&ht.trim()!==""&&St!==""&&tr&&Dn&&_e&&(!Rt||er)&&(!un||Sr)&&(it==="LONG"||it==="SHORT"||it==="RANDOM")&&(We==="LIMIT"||We==="MARKET"||We==="RANDOM")&&T,Tn=y&&Be&&_e&&St!==""&&kr&&tr&&Dn&&(ie!=="variational"||V.trim()!=="")&&(ie!=="variational"||!fe)&&(ie!=="variational"||!Ke)&&T,$n=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),ir=()=>`extendedCreds:${$n()}`,ls=()=>{try{const mt=localStorage.getItem(ir());if(!mt)return;const Kt=JSON.parse(mt);Kt.apiKey&&je(Kt.apiKey),Kt.apiPrivateKey&&Je(Kt.apiPrivateKey),Kt.vaultNumber&&rt(Kt.vaultNumber),Kt.apiPublicKey&&bt(Kt.apiPublicKey),typeof Kt.remember=="boolean"&>(Kt.remember)}catch{}},cs=()=>{if(kt)try{localStorage.setItem(ir(),JSON.stringify({apiKey:Ce,apiPrivateKey:Ye,apiPublicKey:Ve,vaultNumber:ht,remember:!0}))}catch{}},lt=()=>{try{localStorage.removeItem(ir())}catch{}};h.useEffect(()=>{if(!t)return;const mt=localStorage.getItem("hyperToken"),Kt=localStorage.getItem("hyperAddress");v(!!(mt&&Kt));const sr=setInterval(()=>{const Zn=localStorage.getItem("hyperToken"),Or=localStorage.getItem("hyperAddress");v(!!(Zn&&Or))},800);return()=>clearInterval(sr)},[t]),h.useEffect(()=>{!t||!y||(Nt(),qt(),pr())},[t,y]),h.useEffect(()=>{t&&(un===""&&yn(Gt),Rt===""&&mn(Gt),_n===""&&In(Gt))},[t]),h.useEffect(()=>{if(!St)return;const mt=ft(St),Kt=Number(rn);!Number.isNaN(Kt)&&Kt>mt&&nt(String(mt)),!Number.isNaN(Kt)&&Kt<1&&rn!==""&&nt("1")},[St]),h.useEffect(()=>{t&&(kt&&cs(),kt||lt())},[Ce,Ye,ht,Ve,kt,t]);async function Nt(){var mt,Kt,sr,Zn,Or,Ir,ns,Ls,Ot,lr,Qn,Vr,us,as,xs,bs;try{zn(!0),Ae("");const zi=window.localStorage.getItem("hyperToken"),zs=window.localStorage.getItem("hyperAddress");if(!zi||!zs){N(!1),ls();return}const Ss=await(await fetch(`${Lt}/api/test_app/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:zs.toLowerCase(),token:zi})})).json();if(!(Ss!=null&&Ss.success)){if(console.warn("INFO API RESPONSE:",Ss==null?void 0:Ss.error_message),(Ss==null?void 0:Ss.error_message)==="You have not a running process"){const pc=_e?_e.toLowerCase().replace("-","_"):null,ks=K==null?void 0:K[pc];if(pc&&ks){const ka={...K,[pc]:{...ks,isStop:!0}};re(ka);const Sa=Object.keys(ka).filter(Yo=>Yo.startsWith("extended"));if(Sa.length>0&&!_e){const Ql=Sa.sort((wi,Ed)=>{var E,O;const wt=parseInt(((E=wi.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((O=Ed.match(/\d+/))==null?void 0:O[0])||0,10);return wt-w})[0].match(/\d+/);Ql&&xe(`Extended-${Ql[0]}`)}}else xe("Extended-1")}Ss!=null&&Ss.slots_info&&(L((Kt=(mt=Ss==null?void 0:Ss.slots_info)==null?void 0:mt.extended)==null?void 0:Kt.total_qty),F((Zn=(sr=Ss==null?void 0:Ss.slots_info)==null?void 0:sr.extended)==null?void 0:Zn.active_qty),ee((Ir=(Or=Ss==null?void 0:Ss.slots_info)==null?void 0:Or.variational)==null?void 0:Ir.total_qty),Q((Ls=(ns=Ss==null?void 0:Ss.slots_info)==null?void 0:ns.variational)==null?void 0:Ls.active_qty));return}if(Ss!=null&&Ss.success&&(Ss!=null&&Ss.data)){const pc=_e?_e.toLowerCase().replace("-","_"):null,ks=K==null?void 0:K[pc],ka=Ss.data||{};pc&&!ka[pc]&&ks&&(ka[pc]={...ks,isStop:!0}),re(ka);const Sa=Object.keys(ka).filter(Yo=>Yo.startsWith("extended"));if(Sa.length>0&&!_e){const Ql=Sa.sort((wi,Ed)=>{var E,O;const wt=parseInt(((E=wi.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((O=Ed.match(/\d+/))==null?void 0:O[0])||0,10);return wt-w})[0].match(/\d+/);Ql&&xe(`Extended-${Ql[0]}`)}Ss!=null&&Ss.slots_info&&(L((lr=(Ot=Ss==null?void 0:Ss.slots_info)==null?void 0:Ot.extended)==null?void 0:lr.total_qty),F((Vr=(Qn=Ss==null?void 0:Ss.slots_info)==null?void 0:Qn.extended)==null?void 0:Vr.active_qty),ee((as=(us=Ss==null?void 0:Ss.slots_info)==null?void 0:us.variational)==null?void 0:as.total_qty),Q((bs=(xs=Ss==null?void 0:Ss.slots_info)==null?void 0:xs.variational)==null?void 0:bs.active_qty))}}catch{N(!1),ls(),ge("ON")}finally{zn(!1)}}const Rn=h.useMemo(()=>_e?_e.toLowerCase().replace("-","_"):"",[_e]),ar=!!((ci=K==null?void 0:K[Rn])!=null&&ci.delta)&&!!((Fr=K==null?void 0:K[Rn])!=null&&Fr.from_slot),Tr=ar?`extended_${(En=K==null?void 0:K[Rn])==null?void 0:En.from_slot}`:Rn;h.useEffect(()=>{var sr,Zn,Or,Ir,ns,Ls,Ot,lr,Qn,Vr,us,as,xs,bs,zi,zs,ys,Ss,pc;if(!_e||!K)return;const mt=Tr,Kt=K==null?void 0:K[mt];if(!Kt){je(""),Je(""),bt(""),He(""),rt(""),on(""),fn(""),nt(""),Ut("LONG"),It("LIMIT"),N(!1),ge("ON"),Te("Hour"),mn(""),yn(""),X(""),ct("LIMIT"),Ht("MARKET"),ae("variational"),ce(null);return}if((Kt==null?void 0:Kt.target_params)==null&&Kt.source_params){Kt!=null&&Kt.isStop?N(!1):N(!0),ge("OFF");const ks=Kt.source_params,ka=(Kt==null?void 0:Kt.slot_number)??"";ka&&!ar&&xe(`Extended-${ka}`),ks!=null&&ks.cycleSeconds&&Te((ks==null?void 0:ks.cycleSeconds)===86400?"Day":"Hour");const Wu=(ks==null?void 0:ks.extendedapikey)??"",Sa=(ks==null?void 0:ks.x10privatekey)??"",Yo=(ks==null?void 0:ks.x10publickey)??"",qu=(ks==null?void 0:ks.x10vault)??"";if(Wu&&je(String(Wu)),Sa&&Je(String(Sa)),Yo&&bt(String(Yo)),qu&&rt(String(qu)),ks!=null&&ks.coin){const Ql=String(ks.coin).replace(/-USD$/,"");on(Ql)}(ks==null?void 0:ks.orderPerHour)!=null&&fn(String(ks.orderPerHour)),(ks==null?void 0:ks.leverage)!=null&&nt(String(ks.leverage)),ks!=null&&ks.direction&&Ut(String(ks.direction).toUpperCase()==="SHORT"?"SHORT":String(ks.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),ks!=null&&ks.orderType&&It(String(ks.orderType).toUpperCase()==="MARKET"?"MARKET":String(ks.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(ks==null?void 0:ks.tp)!=null&&mn(String(ks.tp)),(ks==null?void 0:ks.sl)!=null&&yn(String(ks.sl))}else if((Kt==null?void 0:Kt.target_params)!==null){Kt!=null&&Kt.isStop?N(!1):N(!0),ge("ON");const ks=(Kt==null?void 0:Kt.slot_number)??"";ks&&!ar&&xe(`Extended-${ks}`);const ka=Kt.source_params,Wu=(ka==null?void 0:ka.extendedapikey)??"",Sa=(ka==null?void 0:ka.x10privatekey)??"",Yo=(ka==null?void 0:ka.x10publickey)??"",qu=(ka==null?void 0:ka.x10vault)??"";if(Wu&&je(String(Wu)),Sa&&Je(String(Sa)),Yo&&bt(String(Yo)),qu&&rt(String(qu)),(sr=Kt==null?void 0:Kt.source_params)!=null&&sr.wallet_id&&Ue(String((Zn=Kt==null?void 0:Kt.source_params)==null?void 0:Zn.wallet_id)),(Or=Kt==null?void 0:Kt.source_params)!=null&&Or.coin){const Ql=String((Ir=Kt==null?void 0:Kt.source_params)==null?void 0:Ir.coin).replace(/-USD$/,"");on(Ql)}((ns=Kt==null?void 0:Kt.source_params)==null?void 0:ns.orderPerHour)!=null&&fn(String((Ls=Kt==null?void 0:Kt.source_params)==null?void 0:Ls.orderPerHour)),((Ot=Kt==null?void 0:Kt.source_params)==null?void 0:Ot.leverage)!=null&&nt(String((lr=Kt==null?void 0:Kt.source_params)==null?void 0:lr.leverage)),(Qn=Kt==null?void 0:Kt.source_params)!=null&&Qn.accountType&&nn(((Vr=Kt==null?void 0:Kt.source_params)==null?void 0:Vr.accountType)==="standart"?"STANDARD":"PREMIUM"),(us=Kt==null?void 0:Kt.target_params)!=null&&us.accountType&&pt(((as=Kt==null?void 0:Kt.target_params)==null?void 0:as.accountType)==="standart"?"STANDARD":"PREMIUM"),Kt!=null&&Kt.target_app&&ae(((Kt==null?void 0:Kt.target_app)==="variational","variational")),(xs=Kt==null?void 0:Kt.target_params)!=null&&xs.vr_token&&X((bs=Kt==null?void 0:Kt.target_params)==null?void 0:bs.vr_token),(zi=Kt==null?void 0:Kt.source_params)!=null&&zi.source_orderType&&ct(String((zs=Kt==null?void 0:Kt.source_params)==null?void 0:zs.source_orderType).toUpperCase()==="MARKET"?"MARKET":String((ys=Kt==null?void 0:Kt.source_params)==null?void 0:ys.source_orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(Ss=Kt==null?void 0:Kt.source_params)!=null&&Ss.cycleSeconds&&Te(((pc=Kt==null?void 0:Kt.source_params)==null?void 0:pc.cycleSeconds)===86400?"Day":"Hour")}else N(!1),ge("OFF")},[_e,K,ar,Tr]);const Lr=mt=>{var Kt;return Number(((Kt=String(mt||"").match(/\d+/))==null?void 0:Kt[0])||0)},$r=mt=>(mt||"").toLowerCase().replace("-","_"),cr=h.useMemo(()=>{const mt=K==null?void 0:K[$r(_e)];if(mt!=null&&mt.delta&&(mt!=null&&mt.from_slot))return Number(mt.from_slot);const Kt=Number(mt==null?void 0:mt.slot_number);return Number.isFinite(Kt)?Kt:Lr(_e)},[_e,K]),wr=h.useMemo(()=>{const mt=Number(I)||0,Kt=Array.from({length:mt},()=>({used:!1,kind:null})),sr=K||{};for(const[Zn,Or]of Object.entries(sr)){if(!Zn.startsWith("extended"))continue;const Ir=Lr(Zn)-1;Ir<0||Ir>=mt||((Or==null?void 0:Or.isStop)===!0?Kt[Ir]={used:!1,kind:null}:Or!=null&&Or.source_params?Kt[Ir]={used:!0,kind:"delta-src"}:Or!=null&&Or.target_params||Or!=null&&Or.delta?Kt[Ir]={used:!0,kind:"delta-shadow"}:Or!=null&&Or.farming_params?Kt[Ir]={used:!0,kind:"single"}:Kt[Ir]={used:!0,kind:"unknown"})}return Kt},[K,I]),ss=h.useMemo(()=>wr.map((mt,Kt)=>mt.used&&mt.kind!=="delta-src-inferred"?`Extended-${Kt+1}`:null).filter(Boolean),[wr]);h.useMemo(()=>wr.filter(mt=>!mt.used).length,[wr]);async function mr(){var Kt;const mt=Lr(_e)-1;if(mt<0){Ae("Please select a slot."),jn(!1);return}if((Kt=wr[mt])!=null&&Kt.used){Ae("Selected slot is already in use."),jn(!1);return}if(!y){n(!0);return}if(Se==="OFF"){if(!qn)return}else if(!Tn)return;try{jn(!0),Ae("");const sr=window.localStorage.getItem("hyperToken"),Zn=window.localStorage.getItem("hyperAddress");if(!sr||!Zn){n(!0);return}const Or={coin:`${St}-USD`,leverage:Number(rn),orderPerHour:Number(tn),cycleSeconds:we==="Hour"?3600:86400,...Se==="ON"?{source_orderType:Ge,wallet_id:Be}:{extendedapikey:Ce,x10publickey:Ve,x10privatekey:Ye,x10vault:ht,orderType:We,tp:Number(Rt),sl:Number(un),direction:it}},Ir={...ie==="variational"&&{vr_token:V},coin:`${St}`,orderPerHour:Number(tn),leverage:Number(rn),target_orderType:vt,cycleSeconds:we==="Hour"?3600:86400},ns={address:Zn.toLowerCase(),token:sr,slot_number:Number(_e==null?void 0:_e.replace("Extended-","")),source_app:"extended",source_params:Or,...Se==="ON"?{target_app:ie==="extended"?"extended":"variational_delta",target_params:Ir}:{}},Ot=await(await fetch(`${Lt}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ns)})).json();Ot!=null&&Ot.success?(N(!0),Nt(),kt&&cs()):Ae((Ot==null?void 0:Ot.error_message)||"Start failed.")}catch(sr){Ae(sr.message||"An error occurred while saving.")}finally{jn(!1)}}async function ts(){if(!y){n(!0);return}try{pe(!0),Ae("");const mt=window.localStorage.getItem("hyperToken"),Kt=window.localStorage.getItem("hyperAddress");if(!mt||!Kt){n(!0);return}const Zn=await(await fetch(`${Lt}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Kt.toLowerCase(),token:mt,source_app:"extended",slot_number:cr,...Se==="ON"?{target_app:ie==="extended"?"extended":"variational_delta"}:{}})})).json();Zn!=null&&Zn.success?(N(!1),Nt()):Ae((Zn==null?void 0:Zn.error_message)||"Stop failed.")}catch(mt){Ae(mt.message||"An error occurred while stopping.")}finally{pe(!1)}}const Qs=mt=>{ae(mt??"variational"),W(!1)},Es=[{value:"variational",label:"Variational"}];function br(mt){try{const Kt=mt.split(".");if(Kt.length!==3)throw new Error("Invalid JWT format");const Zn=Kt[1].replace(/-/g,"+").replace(/_/g,"/"),Or=decodeURIComponent(atob(Zn).split("").map(Ir=>"%"+("00"+Ir.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Or)}catch{return null}}const Zt={control:(mt,Kt)=>({...mt,backgroundColor:"#242424",borderColor:Kt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:mt=>({...mt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:mt=>({...mt,height:32}),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:200}),option:(mt,Kt)=>({...mt,backgroundColor:Kt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:mt=>({...mt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:mt=>({...mt,backgroundColor:"#353535"})},me=({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"]}),dt=mt=>{var Kt;return i.jsx(ma.Option,{...mt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Kt=mt.data)!=null&&Kt.icon?i.jsx("img",{src:mt.data.icon,alt:mt.data.label,className:"w-4 h-4 rounded-[4px]",onError:sr=>sr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:mt.data.label}),i.jsx(me,{max:mt.data.maxLeverage})]})})},_t=mt=>{var Kt;return i.jsx(ma.SingleValue,{...mt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Kt=mt.data)!=null&&Kt.icon?i.jsx("img",{src:mt.data.icon,alt:mt.data.label,className:"w-4 h-4 rounded-[4px]",onError:sr=>sr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:mt.data.label}),i.jsx(me,{max:mt.data.maxLeverage})]})})},At=mt=>{const Kt=ss.includes(mt.data.value);return i.jsx(ma.Option,{...mt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:mt.data.label}),Kt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},xn=mt=>i.jsx(ma.SingleValue,{...mt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:mt.data.label})})}),Cn=h.useMemo(()=>te.map(mt=>{const Kt=(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),sr=(mt==null?void 0:mt.version)===3?`${Kt} - (API-AGENT) Wallet`:Kt;return{value:(mt==null?void 0:mt.wallet_id)??(mt==null?void 0:mt.id)??(mt==null?void 0:mt.value)??"",label:sr,raw:mt}}),[te]),fr=h.useMemo(()=>{var mt;return(mt=Cn.find(Kt=>String(Kt.value)===String(Be)))==null?void 0:mt.raw},[Cn,Be]);h.useMemo(()=>{const mt=fr||{};return mt.address||mt.evm_address||mt.wallet_address||mt.public_address||mt.eth_address||mt.addr||null},[fr]);const _r=mt=>i.jsxs(ma.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]}),pr=async()=>{var sr,Zn,Or,Ir,ns,Ls,Ot,lr;const mt=window.localStorage.getItem("hyperToken"),Kt=window.localStorage.getItem("hyperAddress");if(!(!mt||!Kt))try{Yn(!0);const Qn=await vi(Kt.toLowerCase(),mt);Qn!=null&&Qn.success?(r(Qn==null?void 0:Qn.telegram_chat_id),s(Qn==null?void 0:Qn.subscriber_role),a(Qn==null?void 0:Qn.subs_expire_day),o((sr=Qn==null?void 0:Qn.mushboomer_counts)==null?void 0:sr.eth),l((Zn=Qn==null?void 0:Qn.mushboomer_counts)==null?void 0:Zn.sol),c(Qn==null?void 0:Qn.referral_code),u(Qn==null?void 0:Qn.refcode),d(Qn==null?void 0:Qn.whitelist),f(mt),x(Kt),D(!0),P((Ir=(Or=Qn==null?void 0:Qn.slots_info)==null?void 0:Or.extended)==null?void 0:Ir.total_qty),L((Ls=(ns=Qn==null?void 0:Qn.slots_info)==null?void 0:ns.extended)==null?void 0:Ls.total_qty),F((lr=(Ot=Qn==null?void 0:Qn.slots_info)==null?void 0:Ot.extended)==null?void 0:lr.active_qty),Yn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Yn(!1))}catch(Qn){console.error("Token verification error:",Qn),console.error(Qn.message||"An unknown error occurred."),Yn(!1)}},hr=async()=>new kl(window.ethereum).eth.getAccounts(Kt=>Kt),Xr=async(mt="extended",Kt=24,sr=5e3)=>{Kt<=0||(await new Promise(Zn=>setTimeout(Zn,sr)),await pr(),mt==="extended"&&!T&&Xr(mt,Kt-1,sr))},is=async()=>{zt("");const mt=window.localStorage.getItem("hyperToken"),Kt=window.localStorage.getItem("hyperAddress");if(!mt||!g){n(!0);return}S(!0),m(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Or){console.error("Failed to switch network",Or),m(!1);return}const sr=new kl(window.ethereum);var Zn=await hr();if(Zn.length>0?Zn=Zn[0]:Zn=void 0,Zn){const Ir={from:Zn,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await sr.eth.sendTransaction(Ir).then(ns=>{console.log("txHash :>> ",ns),m(!1),k(ns.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():Kt,token:mt,payment_tx:ns.transactionHash,payment_role:"farming_tools"})}),pr(),Xr("extended")}).catch(ns=>{console.log(ns),ns.code===-32003||ns.message.includes("insufficient funds")?zt("Insufficient funds."):ns.message==="MetaMask Tx Signature: User denied transaction signature."&&S(!1)})}else await sr.eth.requestAccounts()},Pr=h.useMemo(()=>Array.from({length:I},(mt,Kt)=>({value:`Extended-${Kt+1}`,label:`Extended-${Kt+1}`})),[I]);if(!t)return null;const yr=Xn||Kn||De||Sn,nr=C&&!De,gs=ft(St),ei=z===se;return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:p,setOpen:S,transactionHash:A,transactionLoading:ke,paymentPresaleRole:T,errorFunds:ze,activeMethod:2}),i.jsx(M5,{open:oe,setOpen:he,paymentLighterRole:T,oldSlotCount:de,checkAccountLighter:pr,tradeMarket:"extended"}),ut&&_a.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:ut,setOpen:yt,handleListRequest:qt,handlePageChange:()=>{},source:"EXTENDED"})}),document.body),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!yr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"extended",onCloseCurrent:()=>!yr&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://app.extended.exchange/assets/logo/extended-long.svg",alt:"Extended",className:"h-[20px] text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Extended Farming module lets you set up automated farming by providing your Extended Token, selecting a pair, defining orders per hour, leverage, direction and order type ."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/extended-farming-module#getting-your-api-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[qe&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:qe==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:qe}),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:qe})}),y&&T&&$===M&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`No free Extended slots. All ${(Pr==null?void 0:Pr.length)||$} in use.`}),y&&ei&&ie==="variational"&&!C&&Se==="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&&!T&&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:Hl,alt:"",className:""}),i.jsx("span",{className:"text-[#FF797C] text-[12px] leading-4 font-manrope -mb-0.5",children:"You need an active subscription to start farming. Please complete your subscription first to unlock bot. Make sure you have sufficient Ethereum funds on the Ethereum Mainnet."})]}),i.jsx("div",{onClick:()=>{is()},className:"flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Subscribe / 0.12 ETH"})]})}),y&&T&&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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[M||0,"/",Pr.length]})]})]}),i.jsx(hl,{styles:Zt,components:{Option:At,SingleValue:xn},options:Pr,value:Pr.find(mt=>mt.value===_e)||null,onChange:mt=>xe((mt==null?void 0:mt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsx("div",{className:"flex justify-end items-end w-full ",children:i.jsxs("div",{onClick:mt=>{mt.preventDefault(),y?yt(!0):n(!0)},className:"h-6 sm:h-8 pl-2 sm:pl-3 pr-4 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] inline-flex justify-center items-center gap-1.5 cursor-pointer w-max",children:[i.jsx("span",{className:"text-[18px] leading-none",children:"+"}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] min-w-max",children:"Add Account"})]})})]}),i.jsxs("div",{className:"py-1 space-y-3 px-3 sm:px-5",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[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.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(hl,{styles:Zt,isDisabled:yr||Fe||nr,isLoading:Fe,options:Cn,components:{MenuList:_r},setIsGenWalletModal:yt,value:Cn.find(mt=>String(mt.value)===String(Be))||null,onChange:mt=>{nr||Ue((mt==null?void 0:mt.value)??"")},placeholder:y?Fe?"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":Ge==="LIMIT",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",Ge==="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 ",Ge==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Ge==="HYBRID",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",Ge==="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 ",Ge==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Ge==="MARKET",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",Ge==="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 ",Ge==="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:Ce,onChange:mt=>je(mt.target.value),autoComplete:"off",placeholder:"API_KEY",type:Mt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr}),i.jsx("button",{type:"button",onClick:()=>ln(mt=>!mt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:Mt?i.jsx(aa,{size:14}):i.jsx(oa,{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:Ve,onChange:mt=>bt(mt.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:vn?"text":"password",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:yr||nr}),i.jsx("button",{type:"button",onClick:()=>Wn(mt=>!mt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:vn?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]}),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.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:ne,className:"relative w-[120px]",children:[i.jsxs("div",{className:`${yr||nr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:mt=>{mt.preventDefault(),yr||nr||W(!q)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(Bn=Es==null?void 0:Es.find(mt=>(mt==null?void 0:mt.value)===ie))==null?void 0:Bn.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${q?"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"})})]}),q&&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:Es==null?void 0:Es.map((mt,Kt)=>i.jsxs("div",{onClick:sr=>{sr.preventDefault(),yr||nr||Qs(mt==null?void 0:mt.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 ${(mt==null?void 0:mt.value)===ie?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${yr||nr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:mt==null?void 0:mt.label}),(mt==null?void 0:mt.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"})})]},Kt))})})]})})]}),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:xt,onChange:mt=>Qt(mt.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] ${xt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr})})]}),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:Oe,onChange:mt=>$e(mt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:Tt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr}),i.jsx("button",{type:"button",onClick:()=>pn(mt=>!mt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:Tt?i.jsx(aa,{size:14}):i.jsx(oa,{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:st,onChange:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return He("");gn(Kt)&&He(Kt)},onKeyDown:tt,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] ${st===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr})})]})]}),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:mt=>{const Kt=mt.target.value;if(X(Kt),!Kt.trim()){ce(null),ye("");return}const sr=br(Kt);if(sr&&(sr!=null&&sr.exp)){const Zn=new Date((sr==null?void 0:sr.exp)*1e3);ce(Zn),ye("")}else sr?(ce(null),ye("The token's expiration date could not be found.")):(ce(null),ye("Invalid token format."))},type:Pe?"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:yr||nr}),le&&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 "+(Ke?"text-[#FF797C]":"text-[#F8D4AB]"),children:le==null?void 0:le.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),Ke&&i.jsx("span",{children:i.jsx("img",{src:Hl,alt:"",className:"w-3.5 h-3.5"})})]}),fe&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:fe}),i.jsx("button",{type:"button",onClick:()=>Me(mt=>!mt),className:"absolute right-1 top-4 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:Pe?i.jsx(aa,{size:14}):i.jsx(oa,{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":vt==="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",vt==="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 ",vt==="MARKET"?" ✓":""]})})})]})]})]})]}),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.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stark Key Private"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Ye,onChange:mt=>Je(mt.target.value),autoComplete:"off",placeholder:"STARK_KEY_PRIVATE",type:On?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ye===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr}),i.jsx("button",{type:"button",onClick:()=>$t(mt=>!mt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:On?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]}),i.jsxs("div",{className:`${Se==="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:ht,onChange:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return rt("");gn(Kt)&&rt(Kt)},onKeyDown:tt,inputMode:"numeric",autoComplete:"off",placeholder:"VAULT_NUMBER",type:Nn?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${ht===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||nr}),i.jsx("button",{type:"button",onClick:()=>Fn(mt=>!mt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||nr,children:Nn?i.jsx(aa,{size:14}):i.jsx(oa,{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(hl,{styles:Zt,components:{Option:dt,SingleValue:_t},isDisabled:yr||nr,options:dr,value:dr.find(mt=>mt.value===St)||null,onChange:mt=>on((mt==null?void 0:mt.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:we,onChange:mt=>Te(mt.target.value),className:`${yr||nr?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:yr||nr,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:tn,onChange:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return fn("");gn(Kt)&&fn(Kt)},onKeyDown:tt,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] ${tn===""?"border-[#353535]":tr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||nr}),tn!==""&&!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:`${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(Fo,{checked:Se==="ON",onChange:mt=>ge(mt?"ON":"OFF"),disabled:yr||nr,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 ${yr||nr?"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:rn,onChange:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return nt("");gn(Kt)&&nt(Kt)},onKeyDown:tt,inputMode:"numeric",autoComplete:"off",placeholder:St?`1–${gs}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${rn===""?"border-[#353535]":Dn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||nr})]})]}),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.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":it==="LONG",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})}),i.jsx("div",{"aria-pressed":it==="SHORT",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})}),i.jsx("div",{"aria-pressed":it==="RANDOM",onClick:()=>!nr&&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",yr||nr?"cursor-not-allowed":"cursor-pointer",it==="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",rn?` - ${rn}x`:""]})})]})]}),i.jsxs("div",{className:`${Se==="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:()=>!nr&&It("LIMIT"),className:["inline-flex flex-col justify-center items-center h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",yr||nr?"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:`${Se==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${Se==="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:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return mn("");Bt(Kt)&&mn(Kt)},onKeyDown:tt,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]":er?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||nr})]}),Rt!==""&&!er&&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:`${Se==="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:un,onChange:mt=>{const Kt=mt.target.value.trim();if(Kt==="")return yn("");Bt(Kt)&&yn(Kt)},onKeyDown:tt,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] ${un===""?"border-[#353535]":Sr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||nr})]}),un!==""&&!Sr&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",rn?Math.max(rn*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),i.jsx("div",{className:`${Se==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children: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(Fo,{checked:Se==="ON",onChange:mt=>ge(mt?"ON":"OFF"),disabled:yr||nr,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 ${yr||nr?"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.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:()=>!yr&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:yr,children:"Cancel"}),y?Se==="ON"?C?i.jsx("button",{onClick:ts,disabled:yr,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:mr,disabled:!Tn||yr||ie==="variational"&&ei&&Se==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Tn||yr||ie==="variational"&&ei&&Se==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Kn?"Starting...":"Start"}):C?i.jsx("button",{onClick:ts,disabled:yr,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:mr,disabled:!qn||yr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!qn||yr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Kn?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),Xn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},GLe=({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"})]})})})}),Ace=({open:t=!1,setOpen:e=()=>{}})=>{var Pt,qt,ft;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(Yr);es();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[N,I]=h.useState(1),[P,M]=h.useState(0),[F,$]=h.useState(0),[L,z]=h.useState({}),[Q,se]=h.useState(null),[ee,K]=h.useState("paradex");h.useState(!1),h.useRef(null);const[re,de]=h.useState(!1),[G,ie]=h.useState(""),[ae,q]=h.useState("OFF"),[W,ne]=h.useState(""),[oe,he]=h.useState(""),[_e,xe]=h.useState("");h.useState("");const[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState(""),[ht,rt]=h.useState([]),[st,He]=h.useState(""),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState("LONG"),[St,on]=h.useState("MARKET"),[cn,Vn]=h.useState(""),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState(!1),[hn,nn]=h.useState(!1),[Vt,pt]=h.useState(!1),[We,It]=h.useState(!1),[Ge,ct]=h.useState(""),[vt,Ht]=h.useState(""),[Rt,mn]=h.useState(!0),[un,yn]=h.useState(!1),[_n,In]=h.useState(!1),[Sn,Yn]=h.useState(!1),[Xn,zn]=h.useState(!1),[Kn,jn]=h.useState(!1),[De,pe]=h.useState(""),[qe,Ae]=h.useState(!0),[ze,zt]=h.useState("Hour"),[kt,gt]=h.useState("Limit"),[Mt,ln]=h.useState("Limit"),vn="https://dextrabothypev2.nftinit.io",Wn="";h.useEffect(()=>{async function tt(){if(t)try{const gn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=paradex")).json();if(gn!=null&&gn.coins){const tr=[...gn.coins].sort((er,Sr)=>(Sr.maxLeverage||0)-(er.maxLeverage||0)),Dn=tr==null?void 0:tr.map(er=>{const kr=`https://app.paradex.trade/static/market/${(er==null?void 0:er.label)||""}.svg`;return{...er,icon:kr}});rt(Dn)}}catch(Bt){console.error("Failed to fetch coin list:",Bt)}}tt()},[t]);const On=tt=>{var Bt;return((Bt=ht.find(gn=>gn.value===tt))==null?void 0:Bt.maxLeverage)??100},$t=tt=>{["e","E","+","-"].includes(tt.key)&&tt.preventDefault()},Nn=tt=>/^\d*\.?\d{0,6}$/.test(tt),Fn=tt=>/^\d*$/.test(tt),Tt=h.useMemo(()=>{if(st==="")return!1;const tt=Number(st);return Number.isInteger(tt)&&tt>=1&&tt<=180},[st]),pn=h.useMemo(()=>{if(Ve==="")return!1;const tt=Number(Ve),Bt=On(Ye);return Number.isInteger(tt)&&tt>=1&&tt<=Bt},[Ve,Ye,ht]),ke=h.useMemo(()=>{if(cn==="")return!1;const tt=Number(cn);return Number.isNaN(tt)?!1:tt===0?!0:tt>=1&&tt<=1e7},[cn]),m=h.useMemo(()=>{if(tn==="")return!1;const tt=Number(tn);if(Number.isNaN(tt))return!1;const Bt=Ve===""?null:Number(Ve),gn=Bt?Bt*100-1:4999;return tt===0?!0:tt>0&&tt<1?!1:tt>=1&&tt<=gn},[tn,Ve]);h.useMemo(()=>{if(rn==="")return!1;const tt=Number(rn);return!Number.isNaN(tt)&&tt>0&&tt<=100},[rn]);const p=g&&W.trim()!==""&&Ce.trim()!==""&&Ye!==""&&Tt&&pn&&(!cn||ke)&&(!tn||m)&&(xt==="LONG"||xt==="SHORT"||xt==="RANDOM")&&(St==="LIMIT"||St==="MARKET"||St==="HYBRID")&&qe,S=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),A=()=>`paradexCreds:${S()}`,k=()=>{try{const tt=localStorage.getItem(A());if(!tt)return;const Bt=JSON.parse(tt);Bt.privateKey&&ne(Bt.privateKey),Bt.paradexAddress&&je(Bt.paradexAddress),typeof Bt.remember=="boolean"&&mn(Bt.remember)}catch{}},T=()=>{if(Rt)try{localStorage.setItem(A(),JSON.stringify({privateKey:W,paradexAddress:Ce,remember:!0}))}catch{}},D=()=>{try{localStorage.removeItem(A())}catch{}};h.useEffect(()=>{if(!t)return;const tt=localStorage.getItem("hyperToken"),Bt=localStorage.getItem("hyperAddress");y(!!(tt&&Bt));const gn=setInterval(()=>{const tr=localStorage.getItem("hyperToken"),Dn=localStorage.getItem("hyperAddress");y(!!(tr&&Dn))},800);return()=>clearInterval(gn)},[t]),h.useEffect(()=>{!t||!g||(V(),ut())},[t,g]),h.useEffect(()=>{t&&(tn===""&&fn(Wn),cn===""&&Vn(Wn),rn===""&&nt(Wn))},[t]),h.useEffect(()=>{if(!Ye)return;const tt=On(Ye),Bt=Number(Ve);!Number.isNaN(Bt)&&Bt>tt&&bt(String(tt)),!Number.isNaN(Bt)&&Bt<1&&Ve!==""&&bt("1")},[Ye]),h.useEffect(()=>{t&&(Rt&&T(),Rt||D())},[W,Ce,Rt,t]);async function V(){var tt,Bt,gn,tr,Dn,er,Sr,dr;try{nn(!0),ct("");const kr=window.localStorage.getItem("hyperToken"),qn=window.localStorage.getItem("hyperAddress");if(!kr||!qn){C(!1),k();return}const $n=await(await fetch(`${vn}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:qn.toLowerCase(),token:kr})})).json();if(!($n!=null&&$n.success)){if(console.warn("INFO API RESPONSE:",$n==null?void 0:$n.error_message),($n==null?void 0:$n.error_message)==="You have not a running process"){const ir=G?G.toLowerCase().replace("-","_"):null,ls=L==null?void 0:L[ir];if(ir&&ls){const cs={...L,[ir]:{...ls,isStop:!0}};z(cs);const Nt=Object.keys(cs).filter(Rn=>Rn.startsWith("paradex"));if(Nt.length>0&&!G){const Tr=Nt.sort((Lr,$r)=>{var ss,mr;const cr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10),wr=parseInt(((mr=$r.match(/\d+/))==null?void 0:mr[0])||0,10);return cr-wr})[0].match(/\d+/);Tr&&ie(`Paradex-${Tr[0]}`)}}else ie("Paradex-1")}$n!=null&&$n.slots_info&&($((Bt=(tt=$n==null?void 0:$n.slots_info)==null?void 0:tt.paradex)==null?void 0:Bt.total_qty),M((tr=(gn=$n==null?void 0:$n.slots_info)==null?void 0:gn.paradex)==null?void 0:tr.active_qty));return}if($n!=null&&$n.success&&($n!=null&&$n.data)){const ir=G?G.toLowerCase().replace("-","_"):null,ls=L==null?void 0:L[ir],cs=$n.data||{};ir&&!cs[ir]&&ls&&(cs[ir]={...ls,isStop:!0}),z(cs);const Nt=Object.keys(cs).filter(Rn=>Rn.startsWith("paradex"));if(Nt.length>0&&!G){const Tr=Nt.sort((Lr,$r)=>{var ss,mr;const cr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10),wr=parseInt(((mr=$r.match(/\d+/))==null?void 0:mr[0])||0,10);return cr-wr})[0].match(/\d+/);Tr&&ie(`Paradex-${Tr[0]}`)}$n!=null&&$n.slots_info&&($((er=(Dn=$n==null?void 0:$n.slots_info)==null?void 0:Dn.paradex)==null?void 0:er.total_qty),M((dr=(Sr=$n==null?void 0:$n.slots_info)==null?void 0:Sr.paradex)==null?void 0:dr.active_qty))}}catch{C(!1),k(),q("OFF")}finally{nn(!1)}}const X=h.useMemo(()=>G?G.toLowerCase().replace("-","_"):"",[G]),le=!!((Pt=L==null?void 0:L[X])!=null&&Pt.delta)&&!!((qt=L==null?void 0:L[X])!=null&&qt.from_slot),ce=le?`paradex_${(ft=L==null?void 0:L[X])==null?void 0:ft.from_slot}`:X;h.useEffect(()=>{var gn,tr,Dn,er,Sr,dr,kr,qn,Tn,$n;if(!G||!L)return;const tt=ce,Bt=L==null?void 0:L[tt];if(!Bt){ne(""),je(""),Je(""),He(""),bt(""),Qt("LONG"),on("LIMIT"),gt("Limit"),ln("Limit"),C(!1),q("OFF"),zt("Hour"),Vn(""),fn(""),K("paradex");return}if((Bt==null?void 0:Bt.target_params)==null&&Bt.source_params){Bt!=null&&Bt.isStop?C(!1):C(!0),q("OFF");const ir=Bt.source_params,ls=(Bt==null?void 0:Bt.slot_number)??"";ls&&!le&&ie(`Paradex-${ls}`),ir!=null&&ir.cycleSeconds&&zt((ir==null?void 0:ir.cycleSeconds)===86400?"Day":"Hour"),ir!=null&&ir.tp_type&>(String(ir==null?void 0:ir.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),ir!=null&&ir.sl_type&&ln(String(ir==null?void 0:ir.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const cs=(ir==null?void 0:ir.paradex_pkey)??"",lt=(ir==null?void 0:ir.paradex_address)??"";if(cs&&ne(String(cs)),lt&&je(String(lt)),ir!=null&&ir.coin){const Nt=String(ir.coin).replace(/-USD$/,"");Je(Nt)}(ir==null?void 0:ir.orderPerHour)!=null&&He(String(ir.orderPerHour)),(ir==null?void 0:ir.leverage)!=null&&bt(String(ir.leverage)),ir!=null&&ir.direction&&Qt(String(ir.direction).toUpperCase()==="SHORT"?"SHORT":String(ir.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),ir!=null&&ir.orderType&&on(String(ir.orderType).toUpperCase()==="MARKET"?"MARKET":String(ir.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(ir==null?void 0:ir.tp)!=null&&Vn(String(ir.tp)),(ir==null?void 0:ir.sl)!=null&&fn(String(ir.sl))}else if((Bt==null?void 0:Bt.target_params)!==null){Bt!=null&&Bt.isStop?C(!1):C(!0),q("OFF");const ir=(Bt==null?void 0:Bt.slot_number)??"";ir&&!le&&ie(`Paradex-${ir}`),(gn=Bt==null?void 0:Bt.source_params)!=null&&gn.coin&&Je(String((tr=Bt==null?void 0:Bt.source_params)==null?void 0:tr.coin)),((Dn=Bt==null?void 0:Bt.source_params)==null?void 0:Dn.orderPerHour)!=null&&He(String((er=Bt==null?void 0:Bt.source_params)==null?void 0:er.orderPerHour)),((Sr=Bt==null?void 0:Bt.source_params)==null?void 0:Sr.leverage)!=null&&bt(String((dr=Bt==null?void 0:Bt.source_params)==null?void 0:dr.leverage)),(kr=Bt==null?void 0:Bt.source_params)!=null&&kr.accountType&&setStatusType(((qn=Bt==null?void 0:Bt.source_params)==null?void 0:qn.accountType)==="standart"?"STANDARD":"PREMIUM"),(Tn=Bt==null?void 0:Bt.target_params)!=null&&Tn.accountType&&setStatusTypeTwo((($n=Bt==null?void 0:Bt.target_params)==null?void 0:$n.accountType)==="standart"?"STANDARD":"PREMIUM"),Bt!=null&&Bt.target_app&&K(((Bt==null?void 0:Bt.target_app)==="paradex","paradex"))}else C(!1),q("OFF")},[G,L,le,ce]);const fe=tt=>{var Bt;return Number(((Bt=String(tt||"").match(/\d+/))==null?void 0:Bt[0])||0)},ye=tt=>(tt||"").toLowerCase().replace("-","_"),Pe=h.useMemo(()=>{const tt=L==null?void 0:L[ye(G)];if(tt!=null&&tt.delta&&(tt!=null&&tt.from_slot))return Number(tt.from_slot);const Bt=Number(tt==null?void 0:tt.slot_number);return Number.isFinite(Bt)?Bt:fe(G)},[G,L]),Me=h.useMemo(()=>{const tt=Number(N)||0,Bt=Array.from({length:tt},()=>({used:!1,kind:null})),gn=L||{};for(const[tr,Dn]of Object.entries(gn)){if(!tr.startsWith("paradex"))continue;const er=fe(tr)-1;er<0||er>=tt||((Dn==null?void 0:Dn.isStop)===!0?Bt[er]={used:!1,kind:null}:Dn!=null&&Dn.source_params?Bt[er]={used:!0,kind:"delta-src"}:Dn!=null&&Dn.target_params||Dn!=null&&Dn.delta?Bt[er]={used:!0,kind:"delta-shadow"}:Dn!=null&&Dn.farming_params?Bt[er]={used:!0,kind:"single"}:Bt[er]={used:!0,kind:"unknown"})}return Bt},[L,N]),Ke=h.useMemo(()=>Me.map((tt,Bt)=>tt.used&&tt.kind!=="delta-src-inferred"?`Paradex-${Bt+1}`:null).filter(Boolean),[Me]);h.useMemo(()=>Me.filter(tt=>!tt.used).length,[Me]);async function we(){if(!g){n(!0);return}if(p)try{pt(!0),ct("");const tt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!tt||!Bt){n(!0);return}const gn={paradex_address:Ce,paradex_pkey:W,cycleSeconds:ze==="Hour"?3600:86400,tp_type:kt.toUpperCase(),sl_type:Mt.toUpperCase(),tp:Number(cn),sl:Number(tn),coin:`${Ye}`,orderPerHour:Number(st),leverage:Number(Ve),direction:xt,orderType:St},tr={api_pkey:oe,login_wallet:Oe,coin:Ye==null?void 0:Ye.replace("USDT",""),orderPerHour:Number(st),leverage:Number(Ve)},Dn={address:Bt.toLowerCase(),token:tt,slot_number:Number(G==null?void 0:G.replace("Paradex-","")),source_app:"paradex",source_params:gn},Sr=await(await fetch(`${vn}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Dn)})).json();Sr!=null&&Sr.success?(C(!0),V(),Rt&&T()):ct((Sr==null?void 0:Sr.error_message)||"Start failed.")}catch(tt){ct(tt.message||"An error occurred while saving.")}finally{pt(!1)}}async function Te(){if(!g){n(!0);return}try{It(!0),ct("");const tt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!tt||!Bt){n(!0);return}const tr=await(await fetch(`${vn}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Bt.toLowerCase(),token:tt,source_app:"paradex",slot_number:Pe})})).json();tr!=null&&tr.success?(C(!1),V()):ct((tr==null?void 0:tr.error_message)||"Stop failed.")}catch(tt){ct(tt.message||"An error occurred while stopping.")}finally{It(!1)}}const te={control:(tt,Bt)=>({...tt,backgroundColor:"#242424",borderColor:Bt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:tt=>({...tt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:tt=>({...tt,height:32}),input:tt=>({...tt,color:"#FFFFFF",margin:0,padding:0}),singleValue:tt=>({...tt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:tt=>({...tt,color:"#7F7F7F",fontSize:"12px"}),menu:tt=>({...tt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:tt=>({...tt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(tt,Bt)=>({...tt,backgroundColor:Bt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:tt=>({...tt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:tt=>({...tt,backgroundColor:"#353535"})},ve=({max:tt})=>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:[tt,"x"]}),Be=tt=>{var Bt;return i.jsx(ma.Option,{...tt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Bt=tt.data)!=null&&Bt.icon?i.jsx("img",{src:tt.data.icon,alt:tt.data.label,className:"w-4 h-4 rounded-[4px]",onError:gn=>gn.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:tt.data.label}),i.jsx(ve,{max:tt.data.maxLeverage})]})})},Ue=tt=>{var Bt;return i.jsx(ma.SingleValue,{...tt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Bt=tt.data)!=null&&Bt.icon?i.jsx("img",{src:tt.data.icon,alt:tt.data.label,className:"w-4 h-4 rounded-[4px]",onError:gn=>gn.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:tt.data.label}),i.jsx(ve,{max:tt.data.maxLeverage})]})})},Fe=tt=>{const Bt=Ke.includes(tt.data.value);return i.jsx(ma.Option,{...tt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:tt.data.label}),Bt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},at=tt=>i.jsx(ma.SingleValue,{...tt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:tt.data.label})})}),ut=async()=>{var gn,tr,Dn,er,Sr,dr,kr,qn;const tt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!(!tt||!Bt))try{Ut(!0);const Tn=await vi(Bt.toLowerCase(),tt);Tn!=null&&Tn.success?(r(Tn==null?void 0:Tn.telegram_chat_id),s(Tn==null?void 0:Tn.subscriber_role),a(Tn==null?void 0:Tn.subs_expire_day),o((gn=Tn==null?void 0:Tn.mushboomer_counts)==null?void 0:gn.eth),l((tr=Tn==null?void 0:Tn.mushboomer_counts)==null?void 0:tr.sol),c(Tn==null?void 0:Tn.referral_code),u(Tn==null?void 0:Tn.refcode),d(Tn==null?void 0:Tn.whitelist),f(tt),x(Bt),Ae(!0),I((er=(Dn=Tn==null?void 0:Tn.slots_info)==null?void 0:Dn.paradex)==null?void 0:er.total_qty),$((dr=(Sr=Tn==null?void 0:Tn.slots_info)==null?void 0:Sr.paradex)==null?void 0:dr.total_qty),M((qn=(kr=Tn==null?void 0:Tn.slots_info)==null?void 0:kr.paradex)==null?void 0:qn.active_qty),Ut(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Ut(!1))}catch(Tn){console.error("Token verification error:",Tn),console.error(Tn.message||"An unknown error occurred."),Ut(!1)}},yt=ht,Lt=h.useMemo(()=>Array.from({length:N},(tt,Bt)=>({value:`Paradex-${Bt+1}`,label:`Paradex-${Bt+1}`})),[N]);if(!t)return null;const Gt=hn||Vt||We||it,an=v&&!We,et=On(Ye);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Kn,setOpen:jn,transactionHash:De,transactionLoading:Xn,paymentPresaleRole:qe,errorFunds:vt,activeMethod:2}),i.jsx(M5,{open:re,setOpen:de,paymentLighterRole:qe,oldSlotCount:Q,checkAccountLighter:ut,tradeMarket:"paradex"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Gt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"paradex",onCloseCurrent:()=>!Gt&&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(GLe,{className:"text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] -mt-1",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Paradex Farming module lets you set up automated farming by providing your Paradex Address, Paradex Private Key, selecting a pair, defining trade per hour, leverage, direction, order type, take profit and stop loss."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[Ge&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Ge}),g&&qe&&F===P&&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&&qe&&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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[P||0,"/",Lt.length]})]})]}),i.jsx(hl,{styles:te,components:{Option:Fe,SingleValue:at},options:Lt,value:Lt.find(tt=>tt.value===G)||null,onChange:tt=>ie((tt==null?void 0:tt.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${ae==="ON"?"py-1":"py-5"} space-y-3 px-3 sm:px-5`,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:tt=>je(tt.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] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an})})]}),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:W,onChange:tt=>ne(tt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_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] ${W===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an}),i.jsx("button",{type:"button",onClick:()=>yn(tt=>!tt),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:Gt||an,children:un?i.jsx(aa,{size:14}):i.jsx(oa,{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:_e,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return xe("");Fn(Bt)&&xe(Bt)},onKeyDown:$t,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] ${_e===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an})})]})]}):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:Ce,onChange:tt=>je(tt.target.value),autoComplete:"off",placeholder:"PARADEX_ADDRESS",type:_n?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an}),i.jsx("button",{type:"button",onClick:()=>In(tt=>!tt),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:Gt||an,children:_n?i.jsx(aa,{size:14}):i.jsx(oa,{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(kOe,{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:W,onChange:tt=>ne(tt.target.value),autoComplete:"off",placeholder:"PARADEX_PRIVATE_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] ${W===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an}),i.jsx("button",{type:"button",onClick:()=>yn(tt=>!tt),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:Gt||an,children:un?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Oe,onChange:tt=>$e(tt.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] ${Oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:tt=>he(tt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:Sn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an}),i.jsx("button",{type:"button",onClick:()=>Yn(tt=>!tt),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:Gt||an,children:Sn?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return ge("");Fn(Bt)&&ge(Bt)},onKeyDown:$t,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Gt||an})})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:st,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return He("");Fn(Bt)&&He(Bt)},onKeyDown:$t,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] ${st===""?"border-[#353535]":Tt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Gt||an}),st!==""&&!Tt&&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(hl,{styles:te,components:{Option:Be,SingleValue:Ue},isDisabled:Gt||an,options:yt,value:yt.find(tt=>tt.value===Ye)||null,onChange:tt=>Je((tt==null?void 0:tt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:ze,onChange:tt=>zt(tt.target.value),className:`${Gt||an?"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:Gt||an,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:st,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return He("");Fn(Bt)&&He(Bt)},onKeyDown:$t,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] ${st===""?"border-[#353535]":Tt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Gt||an}),st!==""&&!Tt&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Fo,{checked:ae==="ON",onChange:tt=>q(tt?"ON":"OFF"),disabled:Gt||an,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${Gt||an?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Ve,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return bt("");Fn(Bt)&&bt(Bt)},onKeyDown:$t,inputMode:"numeric",autoComplete:"off",placeholder:Ye?`1–${et}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ve===""?"border-[#353535]":pn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Gt||an})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":xt==="LONG",onClick:()=>!an&&Qt("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",Gt||an?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})}),i.jsx("div",{"aria-pressed":xt==="SHORT",onClick:()=>!an&&Qt("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",Gt||an?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})}),i.jsx("div",{"aria-pressed":xt==="RANDOM",onClick:()=>!an&&Qt("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",Gt||an?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":St==="LIMIT",onClick:()=>!an&&on("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",Gt||an?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":St==="HYBRID",onClick:()=>!an&&on("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",Gt||an?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":St==="MARKET",onClick:()=>!an&&on("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",Gt||an?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("select",{value:kt,onChange:tt=>gt(tt.target.value),className:`${Gt||an?"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:Gt||an,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:cn,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return Vn("");Nn(Bt)&&Vn(Bt)},onKeyDown:$t,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${cn===""?"border-[#353535]":ke?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Gt||an})]}),cn!==""&&!ke&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("select",{value:Mt,onChange:tt=>ln(tt.target.value),className:`${Gt||an?"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:Gt||an,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:tn,onChange:tt=>{const Bt=tt.target.value.trim();if(Bt==="")return fn("");Nn(Bt)&&fn(Bt)},onKeyDown:$t,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] ${tn===""?"border-[#353535]":m?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Gt||an})]}),tn!==""&&!m&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Ve?Math.max(Ve*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),i.jsx("div",{className:`${ae==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Gt&&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:Gt,children:"Cancel"}),g?ae==="ON"?v?i.jsx("button",{onClick:Te,disabled:Gt,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:we,disabled:!p||Gt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Gt?"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:Te,disabled:Gt,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:we,disabled:!p||Gt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Gt?"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"})]})}),hn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},_ce=({open:t=!1,setOpen:e=()=>{}})=>{var et,Pt,qt;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(Yr);es();const[g,y]=h.useState(!1),[v,C]=h.useState(!1),[N,I]=h.useState(1),[P,M]=h.useState(0),[F,$]=h.useState(0),[L,z]=h.useState({}),[Q,se]=h.useState(null),[ee,K]=h.useState("pacifica");h.useState(!1),h.useRef(null);const[re,de]=h.useState(!1),[G,ie]=h.useState(""),[ae,q]=h.useState("OFF"),[W,ne]=h.useState(""),[oe,he]=h.useState(""),[_e,xe]=h.useState("");h.useState("");const[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(""),[Ye,Je]=h.useState(""),[ht,rt]=h.useState([]),[st,He]=h.useState(""),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState("LONG"),[St,on]=h.useState("LIMIT"),[cn,Vn]=h.useState(""),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState(!1),[hn,nn]=h.useState(!1),[Vt,pt]=h.useState(!1),[We,It]=h.useState(!1),[Ge,ct]=h.useState(""),[vt,Ht]=h.useState(""),[Rt,mn]=h.useState(!0),[un,yn]=h.useState(!1),[_n,In]=h.useState(!1),[Sn,Yn]=h.useState(!1),[Xn,zn]=h.useState(!1),[Kn,jn]=h.useState(""),[De,pe]=h.useState(!0),[qe,Ae]=h.useState("Hour"),[ze,zt]=h.useState("Limit"),[kt,gt]=h.useState("Limit"),Mt="https://dextrabothypev2.nftinit.io",ln="";h.useEffect(()=>{async function ft(){if(t)try{const Bt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=pacifica")).json();if(Bt!=null&&Bt.coins){let gn=Bt.coins.map(tr=>{const Sr=`https://app.pacifica.fi/imgs/tokens/${(tr==null?void 0:tr.label)||""}.svg`;return{...tr,icon:Sr}});rt(gn)}}catch(tt){console.error("Failed to fetch coin list:",tt)}}ft()},[t]);const vn=ft=>{var tt;return((tt=ht.find(Bt=>Bt.value===ft))==null?void 0:tt.maxLeverage)??100},Wn=ft=>{["e","E","+","-"].includes(ft.key)&&ft.preventDefault()},On=ft=>/^\d*\.?\d{0,6}$/.test(ft),$t=ft=>/^\d*$/.test(ft),Nn=h.useMemo(()=>{if(st==="")return!1;const ft=Number(st);return Number.isInteger(ft)&&ft>=1&&ft<=180},[st]),Fn=h.useMemo(()=>{if(Ve==="")return!1;const ft=Number(Ve),tt=vn(Ye);return Number.isInteger(ft)&&ft>=1&&ft<=tt},[Ve,Ye,ht]),Tt=h.useMemo(()=>{const ft=W.trim();return ft?ft.length>86:!1},[W]),pn=h.useMemo(()=>{if(cn==="")return!1;const ft=Number(cn);return Number.isNaN(ft)?!1:ft===0?!0:ft>=1&&ft<=1e7},[cn]),ke=h.useMemo(()=>{if(tn==="")return!1;const ft=Number(tn);if(Number.isNaN(ft))return!1;const tt=Ve===""?null:Number(Ve),Bt=tt?tt*100-1:4999;return ft===0?!0:ft>0&&ft<1?!1:ft>=1&&ft<=Bt},[tn,Ve]);h.useMemo(()=>{if(rn==="")return!1;const ft=Number(rn);return!Number.isNaN(ft)&&ft>0&&ft<=100},[rn]);const m=g&&W.trim()!==""&&Ce.trim()!==""&&Ye!==""&&Nn&&Fn&&G&&(!cn||pn)&&(!tn||ke)&&(xt==="LONG"||xt==="SHORT"||xt==="RANDOM")&&(St==="LIMIT"||St==="MARKET"||St==="HYBRID")&&Tt&&De,p=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),S=()=>`pacificaCreds:${p()}`,A=()=>{try{const ft=localStorage.getItem(S());if(!ft)return;const tt=JSON.parse(ft);tt.privateKey&&ne(tt.privateKey),tt.loginAddress&&je(tt.loginAddress),typeof tt.remember=="boolean"&&mn(tt.remember)}catch{}},k=()=>{if(Rt)try{localStorage.setItem(S(),JSON.stringify({privateKey:W,loginAddress:Ce,remember:!0}))}catch{}},T=()=>{try{localStorage.removeItem(S())}catch{}};h.useEffect(()=>{if(!t)return;const ft=localStorage.getItem("hyperToken"),tt=localStorage.getItem("hyperAddress");y(!!(ft&&tt));const Bt=setInterval(()=>{const gn=localStorage.getItem("hyperToken"),tr=localStorage.getItem("hyperAddress");y(!!(gn&&tr))},800);return()=>clearInterval(Bt)},[t]),h.useEffect(()=>{!t||!g||(D(),at())},[t,g]),h.useEffect(()=>{t&&(tn===""&&fn(ln),cn===""&&Vn(ln),rn===""&&nt(ln))},[t]),h.useEffect(()=>{if(!Ye)return;const ft=vn(Ye),tt=Number(Ve);!Number.isNaN(tt)&&tt>ft&&bt(String(ft)),!Number.isNaN(tt)&&tt<1&&Ve!==""&&bt("1")},[Ye]),h.useEffect(()=>{t&&(Rt&&k(),Rt||T())},[W,Ce,Rt,t]);async function D(){var ft,tt,Bt,gn,tr,Dn,er,Sr;try{nn(!0),ct("");const dr=window.localStorage.getItem("hyperToken"),kr=window.localStorage.getItem("hyperAddress");if(!dr||!kr){C(!1),A();return}const Tn=await(await fetch(`${Mt}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:kr.toLowerCase(),token:dr})})).json();if(!(Tn!=null&&Tn.success)){if(console.warn("INFO API RESPONSE:",Tn==null?void 0:Tn.error_message),(Tn==null?void 0:Tn.error_message)==="You have not a running process"){const $n=G?G.toLowerCase().replace("-","_"):null,ir=L==null?void 0:L[$n];if($n&&ir){const ls={...L,[$n]:{...ir,isStop:!0}};z(ls);const lt=Object.keys(ls).filter(Nt=>Nt.startsWith("pacifica"));if(lt.length>0&&!G){const ar=lt.sort((Tr,Lr)=>{var wr,ss;const $r=parseInt(((wr=Tr.match(/\d+/))==null?void 0:wr[0])||0,10),cr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10);return $r-cr})[0].match(/\d+/);ar&&ie(`Pacifica-${ar[0]}`)}}else ie("Pacifica-1")}Tn!=null&&Tn.slots_info&&($((tt=(ft=Tn==null?void 0:Tn.slots_info)==null?void 0:ft.pacifica)==null?void 0:tt.total_qty),M((gn=(Bt=Tn==null?void 0:Tn.slots_info)==null?void 0:Bt.pacifica)==null?void 0:gn.active_qty));return}if(Tn!=null&&Tn.success&&(Tn!=null&&Tn.data)){const $n=G?G.toLowerCase().replace("-","_"):null,ir=L==null?void 0:L[$n],ls=Tn.data||{};$n&&!ls[$n]&&ir&&(ls[$n]={...ir,isStop:!0}),z(ls);const lt=Object.keys(ls).filter(Nt=>Nt.startsWith("pacifica"));if(lt.length>0&&!G){const ar=lt.sort((Tr,Lr)=>{var wr,ss;const $r=parseInt(((wr=Tr.match(/\d+/))==null?void 0:wr[0])||0,10),cr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10);return $r-cr})[0].match(/\d+/);ar&&ie(`Pacifica-${ar[0]}`)}Tn!=null&&Tn.slots_info&&($((Dn=(tr=Tn==null?void 0:Tn.slots_info)==null?void 0:tr.pacifica)==null?void 0:Dn.total_qty),M((Sr=(er=Tn==null?void 0:Tn.slots_info)==null?void 0:er.pacifica)==null?void 0:Sr.active_qty))}}catch{C(!1),A(),q("OFF")}finally{nn(!1)}}const V=h.useMemo(()=>G?G.toLowerCase().replace("-","_"):"",[G]),X=!!((et=L==null?void 0:L[V])!=null&&et.delta)&&!!((Pt=L==null?void 0:L[V])!=null&&Pt.from_slot),le=X?`pacifica_${(qt=L==null?void 0:L[V])==null?void 0:qt.from_slot}`:V;h.useEffect(()=>{var Bt,gn,tr,Dn,er,Sr,dr,kr,qn,Tn;if(!G||!L)return;const ft=le,tt=L==null?void 0:L[ft];if(!tt){ne(""),je(""),Je(""),He(""),bt(""),Qt("LONG"),on("LIMIT"),C(!1),q("OFF"),Ae("Hour"),zt("Limit"),gt("Limit"),Vn(""),fn(""),K("pacifica");return}if((tt==null?void 0:tt.target_params)==null&&tt.source_params){tt!=null&&tt.isStop?C(!1):C(!0),q("OFF");const $n=tt.source_params,ir=(tt==null?void 0:tt.slot_number)??"";ir&&!X&&ie(`Pacifica-${ir}`),$n!=null&&$n.cycleSeconds&&Ae(($n==null?void 0:$n.cycleSeconds)===86400?"Day":"Hour"),$n!=null&&$n.tp_type&&zt(String($n==null?void 0:$n.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),$n!=null&&$n.sl_type&>(String($n==null?void 0:$n.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const ls=($n==null?void 0:$n.agent_pkey)??"",cs=($n==null?void 0:$n.login_address)??"";if(ls&&ne(String(ls)),cs&&je(String(cs)),$n!=null&&$n.coin){const lt=String($n.coin);Je(lt)}($n==null?void 0:$n.orderPerHour)!=null&&He(String($n.orderPerHour)),($n==null?void 0:$n.leverage)!=null&&bt(String($n.leverage)),$n!=null&&$n.direction&&Qt(String($n.direction).toUpperCase()==="SHORT"?"SHORT":String($n.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),$n!=null&&$n.orderType&&on(String($n.orderType).toUpperCase()==="MARKET"?"MARKET":String($n.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),($n==null?void 0:$n.tp)!=null&&Vn(String($n.tp)),($n==null?void 0:$n.sl)!=null&&fn(String($n.sl))}else if((tt==null?void 0:tt.target_params)!==null){tt!=null&&tt.isStop?C(!1):C(!0),q("OFF");const $n=(tt==null?void 0:tt.slot_number)??"";$n&&!X&&ie(`Pacifica-${$n}`),(Bt=tt==null?void 0:tt.source_params)!=null&&Bt.coin&&Je(String((gn=tt==null?void 0:tt.source_params)==null?void 0:gn.coin)),((tr=tt==null?void 0:tt.source_params)==null?void 0:tr.orderPerHour)!=null&&He(String((Dn=tt==null?void 0:tt.source_params)==null?void 0:Dn.orderPerHour)),((er=tt==null?void 0:tt.source_params)==null?void 0:er.leverage)!=null&&bt(String((Sr=tt==null?void 0:tt.source_params)==null?void 0:Sr.leverage)),(dr=tt==null?void 0:tt.source_params)!=null&&dr.accountType&&setStatusType(((kr=tt==null?void 0:tt.source_params)==null?void 0:kr.accountType)==="standart"?"STANDARD":"PREMIUM"),(qn=tt==null?void 0:tt.target_params)!=null&&qn.accountType&&setStatusTypeTwo(((Tn=tt==null?void 0:tt.target_params)==null?void 0:Tn.accountType)==="standart"?"STANDARD":"PREMIUM"),tt!=null&&tt.target_app&&K(((tt==null?void 0:tt.target_app)==="pacifica","pacifica"))}else C(!1),q("OFF")},[G,L,X,le]);const ce=ft=>{var tt;return Number(((tt=String(ft||"").match(/\d+/))==null?void 0:tt[0])||0)},fe=ft=>(ft||"").toLowerCase().replace("-","_"),ye=h.useMemo(()=>{const ft=L==null?void 0:L[fe(G)];if(ft!=null&&ft.delta&&(ft!=null&&ft.from_slot))return Number(ft.from_slot);const tt=Number(ft==null?void 0:ft.slot_number);return Number.isFinite(tt)?tt:ce(G)},[G,L]),Pe=h.useMemo(()=>{const ft=Number(N)||0,tt=Array.from({length:ft},()=>({used:!1,kind:null})),Bt=L||{};for(const[gn,tr]of Object.entries(Bt)){if(!gn.startsWith("pacifica"))continue;const Dn=ce(gn)-1;Dn<0||Dn>=ft||((tr==null?void 0:tr.isStop)===!0?tt[Dn]={used:!1,kind:null}:tr!=null&&tr.source_params?tt[Dn]={used:!0,kind:"delta-src"}:tr!=null&&tr.target_params||tr!=null&&tr.delta?tt[Dn]={used:!0,kind:"delta-shadow"}:tr!=null&&tr.farming_params?tt[Dn]={used:!0,kind:"single"}:tt[Dn]={used:!0,kind:"unknown"})}return tt},[L,N]),Me=h.useMemo(()=>Pe.map((ft,tt)=>ft.used&&ft.kind!=="delta-src-inferred"?`Pacifica-${tt+1}`:null).filter(Boolean),[Pe]);h.useMemo(()=>Pe.filter(ft=>!ft.used).length,[Pe]);async function Ke(){if(!g){n(!0);return}if(m)try{pt(!0),ct("");const ft=window.localStorage.getItem("hyperToken"),tt=window.localStorage.getItem("hyperAddress");if(!ft||!tt){n(!0);return}const Bt={login_address:Ce,agent_pkey:W,cycleSeconds:qe==="Hour"?3600:86400,tp_type:ze.toUpperCase(),sl_type:kt.toUpperCase(),tp:Number(cn),sl:Number(tn),coin:`${Ye}`,orderPerHour:Number(st),leverage:Number(Ve),direction:xt,orderType:St},gn={api_pkey:oe,login_wallet:Oe,coin:Ye==null?void 0:Ye.replace("USDT",""),orderPerHour:Number(st),leverage:Number(Ve)},tr={address:tt.toLowerCase(),token:ft,slot_number:Number(G==null?void 0:G.replace("Pacifica-","")),source_app:"pacifica",source_params:Bt},er=await(await fetch(`${Mt}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tr)})).json();er!=null&&er.success?(C(!0),D(),Rt&&k()):ct((er==null?void 0:er.error_message)||"Start failed.")}catch(ft){ct(ft.message||"An error occurred while saving.")}finally{pt(!1)}}async function we(){if(!g){n(!0);return}try{It(!0),ct("");const ft=window.localStorage.getItem("hyperToken"),tt=window.localStorage.getItem("hyperAddress");if(!ft||!tt){n(!0);return}const gn=await(await fetch(`${Mt}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:tt.toLowerCase(),token:ft,source_app:"pacifica",slot_number:ye})})).json();gn!=null&&gn.success?(C(!1),D()):ct((gn==null?void 0:gn.error_message)||"Stop failed.")}catch(ft){ct(ft.message||"An error occurred while stopping.")}finally{It(!1)}}const Te={control:(ft,tt)=>({...ft,backgroundColor:"#242424",borderColor:tt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:ft=>({...ft,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:ft=>({...ft,height:32}),input:ft=>({...ft,color:"#FFFFFF",margin:0,padding:0}),singleValue:ft=>({...ft,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:ft=>({...ft,color:"#7F7F7F",fontSize:"12px"}),menu:ft=>({...ft,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:ft=>({...ft,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(ft,tt)=>({...ft,backgroundColor:tt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:ft=>({...ft,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:ft=>({...ft,backgroundColor:"#353535"})},te=({max:ft})=>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:[ft,"x"]}),ve=ft=>{var tt;return i.jsx(ma.Option,{...ft,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(tt=ft.data)!=null&&tt.icon?i.jsx("img",{src:ft.data.icon,alt:ft.data.label,className:"w-4 h-4 rounded-[4px]",onError:Bt=>Bt.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:ft.data.label}),i.jsx(te,{max:ft.data.maxLeverage})]})})},Be=ft=>{var tt;return i.jsx(ma.SingleValue,{...ft,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(tt=ft.data)!=null&&tt.icon?i.jsx("img",{src:ft.data.icon,alt:ft.data.label,className:"w-4 h-4 rounded-[4px]",onError:Bt=>Bt.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:ft.data.label}),i.jsx(te,{max:ft.data.maxLeverage})]})})},Ue=ft=>{const tt=Me.includes(ft.data.value);return i.jsx(ma.Option,{...ft,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:ft.data.label}),tt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},Fe=ft=>i.jsx(ma.SingleValue,{...ft,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:ft.data.label})})}),at=async()=>{var Bt,gn,tr,Dn,er,Sr,dr,kr;const ft=window.localStorage.getItem("hyperToken"),tt=window.localStorage.getItem("hyperAddress");if(!(!ft||!tt))try{Ut(!0);const qn=await vi(tt.toLowerCase(),ft);qn!=null&&qn.success?(r(qn==null?void 0:qn.telegram_chat_id),s(qn==null?void 0:qn.subscriber_role),a(qn==null?void 0:qn.subs_expire_day),o((Bt=qn==null?void 0:qn.mushboomer_counts)==null?void 0:Bt.eth),l((gn=qn==null?void 0:qn.mushboomer_counts)==null?void 0:gn.sol),c(qn==null?void 0:qn.referral_code),u(qn==null?void 0:qn.refcode),d(qn==null?void 0:qn.whitelist),f(ft),x(tt),pe(!0),I((Dn=(tr=qn==null?void 0:qn.slots_info)==null?void 0:tr.pacifica)==null?void 0:Dn.total_qty),$((Sr=(er=qn==null?void 0:qn.slots_info)==null?void 0:er.pacifica)==null?void 0:Sr.total_qty),M((kr=(dr=qn==null?void 0:qn.slots_info)==null?void 0:dr.pacifica)==null?void 0:kr.active_qty),Ut(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Ut(!1))}catch(qn){console.error("Token verification error:",qn),console.error(qn.message||"An unknown error occurred."),Ut(!1)}},ut=ht,yt=h.useMemo(()=>Array.from({length:N},(ft,tt)=>({value:`Pacifica-${tt+1}`,label:`Pacifica-${tt+1}`})),[N]);if(!t)return null;const Lt=hn||Vt||We||it,Gt=v&&!We,an=vn(Ye);return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:Xn,setOpen:zn,transactionHash:Kn,transactionLoading:Sn,paymentPresaleRole:De,errorFunds:vt,activeMethod:2}),i.jsx(M5,{open:re,setOpen:de,paymentLighterRole:De,oldSlotCount:Q,checkAccountLighter:at,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:()=>!Lt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"pacifica",onCloseCurrent:()=>!Lt&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-3",children:[i.jsx("img",{src:"https://app.pacifica.fi/imgs/logo.svg",alt:"",className:"h-9"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] mt-1",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Pacifica Farming module lets you set up automated farming by providing your Pacifica Address, Pacifica Private Key, selecting a pair, defining trade per hour, leverage, direction, order type, take profit and stop loss."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[Ge&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Ge}),g&&De&&F===P&&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&&De&&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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[P||0,"/",yt.length]})]})]}),i.jsx(hl,{styles:Te,components:{Option:Ue,SingleValue:Fe},options:yt,value:yt.find(ft=>ft.value===G)||null,onChange:ft=>ie((ft==null?void 0:ft.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${ae==="ON"?"py-1":"py-5"} space-y-3 px-3 sm:px-5`,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:ft=>je(ft.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] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt})})]}),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:W,onChange:ft=>ne(ft.target.value),autoComplete:"off",placeholder:"API_PRIVATE_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] ${W===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt}),i.jsx("button",{type:"button",onClick:()=>yn(ft=>!ft),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:Lt||Gt,children:un?i.jsx(aa,{size:14}):i.jsx(oa,{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:_e,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return xe("");$t(tt)&&xe(tt)},onKeyDown:Wn,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] ${_e===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt})})]})]}):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:Ce,onChange:ft=>je(ft.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] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt})})]}),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:W,onChange:ft=>ne(ft.target.value),autoComplete:"off",placeholder:"PACIFICA_PRIVATE_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] ${W===""?"border-[#353535]":Tt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt}),i.jsx("button",{type:"button",onClick:()=>yn(ft=>!ft),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:Lt||Gt,children:un?i.jsx(aa,{size:14}):i.jsx(oa,{size:14})})]}),W!==""&&!Tt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Please enter a valid private key."})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Oe,onChange:ft=>$e(ft.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] ${Oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:ft=>he(ft.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:_n?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt}),i.jsx("button",{type:"button",onClick:()=>In(ft=>!ft),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:Lt||Gt,children:_n?i.jsx(aa,{size:14}):i.jsx(oa,{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:Se,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return ge("");$t(tt)&&ge(tt)},onKeyDown:Wn,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] ${Se===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Lt||Gt})})]})]})]}),W!==""&&!Tt&&i.jsx("div",{children:i.jsx("img",{src:pct,alt:"",className:"mt-4 rounded-md w-full"})}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:st,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return He("");$t(tt)&&He(tt)},onKeyDown:Wn,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] ${st===""?"border-[#353535]":Nn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt}),st!==""&&!Nn&&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(hl,{styles:Te,components:{Option:ve,SingleValue:Be},isDisabled:Lt||Gt,options:ut,value:ut.find(ft=>ft.value===Ye)||null,onChange:ft=>Je((ft==null?void 0:ft.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:qe,onChange:ft=>Ae(ft.target.value),className:`${Lt||Gt?"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:Lt||Gt,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:st,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return He("");$t(tt)&&He(tt)},onKeyDown:Wn,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] ${st===""?"border-[#353535]":Nn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt}),st!==""&&!Nn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Fo,{checked:ae==="ON",onChange:ft=>q(ft?"ON":"OFF"),disabled:Lt||Gt,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${Lt||Gt?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Ve,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return bt("");$t(tt)&&bt(tt)},onKeyDown:Wn,inputMode:"numeric",autoComplete:"off",placeholder:Ye?`1–${an}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ve===""?"border-[#353535]":Fn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":xt==="LONG",onClick:()=>!Gt&&Qt("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})}),i.jsx("div",{"aria-pressed":xt==="SHORT",onClick:()=>!Gt&&Qt("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})}),i.jsx("div",{"aria-pressed":xt==="RANDOM",onClick:()=>!Gt&&Qt("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",xt==="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",Ve?` - ${Ve}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":St==="LIMIT",onClick:()=>!Gt&&on("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":St==="HYBRID",onClick:()=>!Gt&&on("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":St==="MARKET",onClick:()=>!Gt&&on("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",Lt||Gt?"cursor-not-allowed":"cursor-pointer",St==="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 ",St==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("select",{value:ze,onChange:ft=>zt(ft.target.value),className:`${Lt||Gt?"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:Lt||Gt,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:cn,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return Vn("");On(tt)&&Vn(tt)},onKeyDown:Wn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${cn===""?"border-[#353535]":pn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt})]}),cn!==""&&!pn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("select",{value:kt,onChange:ft=>gt(ft.target.value),className:`${Lt||Gt?"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:Lt||Gt,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:tn,onChange:ft=>{const tt=ft.target.value.trim();if(tt==="")return fn("");On(tt)&&fn(tt)},onKeyDown:Wn,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] ${tn===""?"border-[#353535]":ke?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Lt||Gt})]}),tn!==""&&!ke&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Ve?Math.max(Ve*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),i.jsx("div",{className:`${ae==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Lt&&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:Lt,children:"Cancel"}),g?ae==="ON"?v?i.jsx("button",{onClick:we,disabled:Lt,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:Ke,disabled:!m||Lt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!m||Lt?"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:we,disabled:Lt,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:Ke,disabled:!m||Lt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!m||Lt?"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"})]})}),hn&&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,N]=h.useState(!1),I=(P=[])=>P==null?void 0:P.map(M=>M.submenu?{...M,submenu:I(M.submenu)}:M.action==="openAster"?{...M,onClick:()=>{a(2),r(!0)}}:M.action==="openFarm"?{...M,onClick:()=>e(!0)}:M.action==="openLighter"?{...M,onClick:()=>l(!0)}:M.action==="openApex"?{...M,onClick:()=>u(!0)}:M.action==="openVariational"?{...M,onClick:()=>f(!0)}:M.action==="openExtended"?{...M,onClick:()=>g(!0)}:M.action==="openParadex"?{...M,onClick:()=>v(!0)}:M.action==="openPacifica"?{...M,onClick:()=>N(!0)}:M);return i.jsxs(i.Fragment,{children:[i.jsx(Po,{to:"https://dextrabot.com/",className:"cursor-pointer",children:i.jsx("div",{className:"flex items-center gap-2 font-manrope",children:i.jsx("img",{src:qj,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(P=>P.type==="link"?i.jsx(rOt,{linkTo:P.to,title:P.label,activePaths:P.activePaths},P.to):P.type==="dropdown"?i.jsx(glt,{label:P.label,items:I(P.items),activePaths:P.activePaths,badgeLabel:P.badgeLabel,badgeTone:P.badgeTone,border_color:P.border_color},P.label):null)}),i.jsx(wce,{open:t,setOpen:e}),i.jsx(Cce,{open:n,setOpen:r,defaultMethod:s}),i.jsx(Sce,{open:o,setOpen:l}),i.jsx(Nce,{open:c,setOpen:u}),i.jsx(jce,{open:d,setOpen:f}),i.jsx(SU,{open:x,setOpen:g}),i.jsx(Ace,{open:y,setOpen:v}),i.jsx(_ce,{open:C,setOpen:N})]})},zy=({className:t})=>i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M8.625 15.75C12.56 15.75 15.75 12.56 15.75 8.625C15.75 4.68997 12.56 1.5 8.625 1.5C4.68997 1.5 1.5 4.68997 1.5 8.625C1.5 12.56 4.68997 15.75 8.625 15.75Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M16.5 16.5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),wm=(t,e=null)=>{e&&t.target.src===e?t.target.src=qH:e&&t.target.src!==e?t.target.src=e:t.target.src!==qH&&(t.target.src=qH)},iOt=h.forwardRef(({setOpen:t},e)=>{const{searchTerminalCoin:n,isSearchTerminalError:r}=h.useContext(Yr),[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 N=JSON.parse(localStorage.getItem("recentCoins")||"[]");u(N)},[]);const g=C=>{a(C.target.value.toLowerCase())},y=C=>{C.key==="Enter"&&v()},v=()=>{if(s)if(s.match(/^0x[a-fA-F0-9]{40}$/)){const C=s==null?void 0:s.toLowerCase(),N=[C,...o.filter(I=>(I==null?void 0:I.toLowerCase())!==C)];N.length>12&&N.pop(),l(N),localStorage.setItem("recentWallets",JSON.stringify(N)),window.open(`/wallet-details/${s}`,"_blank"),t(!1)}else dn.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(),N=n.filter(I=>Array.isArray(I)&&I.some(P=>{var M;return(M=P==null?void 0:P.toLowerCase())==null?void 0:M.includes(C)})).map(I=>I[0]);f(N)}else f([])},[s,n]),i.jsxs("div",{children:[i.jsx("div",{className:"sm:w-[416px] h-12 font-manrope z-[999]",children:i.jsxs("div",{className:"flex justify-between items-center bg-[#303030] h-full px-4 gap-1 sm:gap-2.5",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2.5 w-full",children:[i.jsx(zy,{className:"text-white"}),i.jsx("input",{type:"text",ref:e,placeholder:"Search coin or wallet",value:s,onChange:g,onKeyDown:y,className:"w-full bg-transparent text-white placeholder-[#989898] text-sm font-medium font-manrope leading-[8px] placeholder:leading-[8px] tracking-tight focus:outline-none h-12"})]}),i.jsx("div",{onClick:()=>a(""),className:`${(s==null?void 0:s.length)>0?"":"hidden"} text-[#aaa] hover:text-white outline-none focus:outline-none focus:ring-0 border-none w-6 min-w-6 h-[24px] bg-[#353535] hover:bg-[#585858] rounded-md flex justify-center items-center cursor-pointer`,children:i.jsx("img",{src:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})}),i.jsx("div",{className:`${s.match(/^0x[a-fA-F0-9]{40}$/)?"":"hidden"}`,children:i.jsx("div",{onClick:v,className:"w-16 h-7 px-4 py-3 rounded-[256px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#989898] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-xs font-medium font-inter leading-[8px]",children:"Search"})})})]})}),i.jsxs("div",{className:"recent-wallets",children:[i.jsx("div",{className:`${(d==null?void 0:d.length)===0&&"hidden"} text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2 pt-4`,children:"SEARCH RESULTS"}),i.jsx("ul",{className:`${(c==null?void 0:c.length)===0&&(o==null?void 0:o.length)===0?"h-full max-h-[320px]":"max-h-[120px]"} overflow-y-scroll overflow-x-hidden h-full pl-4 pb-4 flex flex-wrap gap-1 sm:gap-2`,children:(d==null?void 0:d.length)===0?i.jsx("div",{className:`${!s.match(/^0x[a-fA-F0-9]{40}$/)&&(s==null?void 0:s.length)>0?"min-h-10":""} w-full h-full flex justify-center items-center`,children:i.jsx("div",{className:`${!s.match(/^0x[a-fA-F0-9]{40}$/)&&(s==null?void 0:s.length)>0?"":"hidden"} text-[#989898] text-[13px] font-semibold font-manrope leading-none pt-4`,children:"No results for your search."})}):d==null?void 0:d.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] max-w-max",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/terminal/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>{t(!1);const I=JSON.parse(localStorage.getItem("recentCoins")||"[]");I!=null&&I.includes(C)||(I.unshift(C),I.length>14&&I.pop(),localStorage.setItem("recentCoins",JSON.stringify(I)))},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:I=>wm(I)}),C]})})})},N))})]}),i.jsxs("div",{className:`${(c==null?void 0:c.length)===0?"hidden":""} recent-wallets pt-4`,children:[i.jsx("div",{className:"text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2",children:"RECENT COINS"}),i.jsx("ul",{className:"overflow-y-scroll overflow-x-hidden h-full max-h-[142px] sm:max-h-[132px] pl-4 pb-4 flex flex-wrap gap-1 sm:gap-2",children:Array.isArray(c)&&(c==null?void 0:c.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] max-w-max",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/terminal/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>t(!1),children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${x[C]||(C==null?void 0:C.split("/")[0])}.svg`,alt:C,className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-gray-700",loading:"lazy",onError:I=>wm(I)}),C]})})})},N)))})]}),i.jsxs("div",{className:`${(o==null?void 0:o.length)===0?"hidden":""} recent-wallets pt-4`,children:[i.jsx("div",{className:"text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2",children:"RECENT WALLETS"}),i.jsx("ul",{className:"overflow-y-scroll overflow-x-hidden h-full max-h-[120px] sm:max-h-[190px] pl-4 pb-4 sm:pb-8 flex flex-wrap gap-2",children:o==null?void 0:o.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] w-[120px]",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/wallet-details/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>t(!1),children:[i.jsx("img",{src:wlt,alt:"",className:"w-4 h-4"}),C&&C.slice(0,6)+"..."+C.slice(-4)]})})})},N))})]})]})}),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(Ca,{open:t,onClose:e,className:"relative z-50",children:[i.jsx(wa,{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(xa,{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(iOt,{ref:n,setOpen:e})})})})})]})},KLe=()=>{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(zy,{className:"text-[#646464] group-hover:text-[#e2e2e2]"})}),i.jsx("div",{className:"font-manrope leading-none text-[#666666] group-hover:text-[#e2e2e2] text-sm font-medium min-w-max",children:"Search..."})]})})]})};var Obe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',oOt={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${Obe}`,system:Obe},o7={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"}},lOt={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},YLe=({borderRadius:t="large",fontStack:e="rounded",overlayBlur:n="none"})=>({blurs:{modalOverlay:lOt[n].modalOverlay},fonts:{body:oOt[e]},radii:{actionButton:o7[t].actionButton,connectButton:o7[t].connectButton,menuButton:o7[t].connectButton,modal:o7[t].modal,modalMobile:o7[t].modalMobile}}),XLe={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"}},Mbe=XLe.blue,QLe=({accentColor:t=Mbe.accentColor,accentColorForeground:e=Mbe.accentColorForeground,...n}={})=>({...YLe(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)"}});QLe.accentColors=XLe;var mM="#1A1B1F",ZLe={blue:{accentColor:"#3898FF",accentColorForeground:"#FFF"},green:{accentColor:"#4BD166",accentColorForeground:mM},orange:{accentColor:"#FF983D",accentColorForeground:mM},pink:{accentColor:"#FF7AB8",accentColorForeground:mM},purple:{accentColor:"#7A70FF",accentColorForeground:"#FFF"},red:{accentColor:"#FF6257",accentColorForeground:"#FFF"}},Rbe=ZLe.blue,JLe=({accentColor:t=Rbe.accentColor,accentColorForeground:e=Rbe.accentColorForeground,...n}={})=>({...YLe(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:mM,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)"}});JLe.accentColors=ZLe;var mne=`{
"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 cOt(t,e){return Object.defineProperty(t,"__recipe__",{value:e,writable:!1}),t}var eDe=cOt;function tDe(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 eDe(n,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:t.conditions}]})}function uOt(t){var{conditions:e}=t;if(!e)throw new Error("Styles have no conditions");var n=tDe(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 eDe(r,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createMapValueFn",args:[{conditions:t.conditions}]})}function dOt(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 fOt(t){var e=dOt(t,"string");return typeof e=="symbol"?e:String(e)}function hOt(t,e,n){return e=fOt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lbe(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 MW(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lbe(Object(n),!0).forEach(function(r){hOt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lbe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var pOt=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=MW({},c),x=!1;for(var g of o){var y=c[g];if(y!=null){var v=s[g];x=!0;for(var C of v.mappings)d[C]=y,f[C]==null&&delete f[C]}}var N=x?MW(MW({},d),f):c,I=function(){var F=N[P],$=s[P];try{if($.mappings)return 1;if(typeof F=="string"||typeof F=="number")u.push($.values[F].defaultClass);else if(Array.isArray(F))for(var L=0;L<F.length;L++){var z=F[L];if(z!=null){var Q=$.responsiveArray[L];u.push($.values[z].conditions[Q])}}else for(var se in F){var ee=F[se];ee!=null&&u.push($.values[ee].conditions[se])}}catch(K){throw K}};for(var P in N)I();return t(u.join(" "))};return Object.assign(l,{properties:new Set(a)})},mOt=t=>t,xOt=function(){return pOt(mOt)(...arguments)};function nDe(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=nDe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function rDe(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=nDe(t))&&(r&&(r+=" "),r+=e);return r}var gOt="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 Dbe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Bbe=4;function bOt(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],I=0,P=x;for(;;){let F=Math.floor(((C-I+1)*s-1)/P),$=0,L=r;for(;L-$>1;){let se=$+L>>>1;F<a[se]?L=se:$=se}if($==0)break;N.push($);let z=I+Math.floor(P*a[$]/s),Q=I+Math.floor(P*a[$+1]/s)-1;for(;!((z^Q)&g);)C=C<<1&v|d(),z=z<<1&v,Q=Q<<1&v|1;for(;z&~Q&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,Q=(Q^g)<<1|g|1;I=z,P=1+Q-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function yOt(t){let e=0;return()=>t[e++]}function sDe(t){return yOt(bOt(vOt(t)))}function vOt(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 wOt(t){return t&1?~t>>1:t>>1}function COt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=wOt(e());return n}function FE(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 iDe(t){return OE(()=>{let e=FE(t);if(e.length)return e})}function aDe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(SOt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(NOt(n,t))}return e.flat()}function OE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function oDe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)COt(t,n).forEach((a,o)=>r[o].push(a));return r}function SOt(t,e){let n=1+e(),r=e(),s=OE(e);return oDe(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 NOt(t,e){let n=1+e();return oDe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function jOt(t){let e=[],n=FE(t);return s(r([]),[]),e;function r(a){let o=t(),l=OE(()=>{let c=FE(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 AOt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function lDe(t){return`{${AOt(t)}}`}function _Ot(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 $N(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 EOt(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 kOt="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 ME=44032,_L=4352,EL=4449,kL=4519,cDe=19,uDe=21,UN=28,TL=uDe*UN,TOt=cDe*TL,IOt=ME+TOt,POt=_L+cDe,FOt=EL+uDe,OOt=kL+UN;function r9(t){return t>>24&255}function dDe(t){return t&16777215}let xne,$be,gne,xM;function MOt(){let t=sDe(kOt);xne=new Map(iDe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),$be=new Set(FE(t)),gne=new Map,xM=new Map;for(let[e,n]of aDe(t)){if(!$be.has(e)&&n.length==2){let[r,s]=n,a=xM.get(r);a||(a=new Map,xM.set(r,a)),a.set(s,e)}gne.set(e,n.reverse())}}function fDe(t){return t>=ME&&t<IOt}function ROt(t,e){if(t>=_L&&t<POt&&e>=EL&&e<FOt)return ME+(t-_L)*TL+(e-EL)*UN;if(fDe(t)&&e>kL&&e<OOt&&(t-ME)%UN==0)return t+(e-kL);{let n=xM.get(t);return n&&(n=n.get(e),n)?n:-1}}function hDe(t){xne||MOt();let e=[],n=[],r=!1;function s(a){let o=xne.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(fDe(a)){let o=a-ME,l=o/TL|0,c=o%TL/UN|0,u=o%UN;s(_L+l),s(EL+c),u>0&&s(kL+u)}else{let o=gne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=r9(e[0]);for(let o=1;o<e.length;o++){let l=r9(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=r9(e[--c]),a<=l))break}a=r9(e[o])}}return e}function LOt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=r9(a),l=dDe(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=ROt(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 pDe(t){return hDe(t).map(dDe)}function DOt(t){return LOt(hDe(t))}const Ube=45,mDe=".",xDe=65039,gDe=1,IL=t=>Array.from(t);function RE(t,e){return t.P.has(e)||t.Q.has(e)}class BOt extends Array{get is_emoji(){return!0}}let bne,bDe,vw,yne,yDe,M4,RW,YC,Gv,zbe,vne;function Ece(){if(bne)return;let t=sDe(gOt);const e=()=>FE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));bne=new Map(aDe(t)),bDe=n(),vw=e(),yne=new Set(e().map(d=>vw[d])),vw=new Set(vw),yDe=n(),n();let s=iDe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};M4=OE(d=>{let f=OE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=$N(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),RW=n(),YC=new Map;let l=e().concat(IL(RW)).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),RW.has(d)||YC.set(d,g)});for(let{V:d,M:f}of new Set(YC.values())){let x=[];for(let y of d){let v=M4.filter(N=>RE(N,y)),C=x.find(({G:N})=>v.some(I=>N.has(I)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>IL(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}Gv=new Set;let c=new Set;const u=d=>Gv.has(d)?c.add(d):Gv.add(d);for(let d of M4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Gv)!YC.has(d)&&!c.has(d)&&YC.set(d,gDe);r(Gv,pDe(Gv)),zbe=jOt(t).map(d=>BOt.from(d)).sort(EOt),vne=new Map;for(let d of zbe){let f=[vne];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===xDe?f.push(...g):f=g}for(let x of f)x.V=d}}function kce(t){return(vDe(t)?"":`${Tce(NU([t]))} `)+lDe(t)}function Tce(t){return`"${t}"`}function $Ot(t){if(t.length>=4&&t[2]==Ube&&t[3]==Ube)throw new Error(`invalid label extension: "${$N(t.slice(0,4))}"`)}function UOt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function zOt(t){let e=t[0],n=Dbe.get(e);if(n)throw M9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=Dbe.get(e);if(o){if(s==a)throw M9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw M9(`trailing ${n}`)}function NU(t,e=1/0,n=lDe){let r=[];HOt(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];vDe(l)&&(r.push($N(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push($N(t.slice(s,a))),r.join("")}function HOt(t,e){return Ece(),vw.has(t)}function vDe(t){return Ece(),yDe.has(t)}function VOt(t){return KOt(WOt(t,DOt,QOt))}function WOt(t,e,n){if(!t)return[];Ece();let r=0;return t.split(mDe).map(s=>{let a=_Ot(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=XOt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(UOt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))$Ot(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(vw.has(d[0]))throw M9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&vw.has(C[0]))throw M9(`emoji + combining mark: "${$N(l[v-1])} + ${NU([C[0]])}"`)}zOt(d);let g=IL(new Set(x)),[y]=GOt(g);YOt(y,x),qOt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function qOt(t,e){let n,r=[];for(let s of e){let a=YC.get(s);if(a===gDe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):IL(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>RE(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function GOt(t){let e=M4;for(let n of t){let r=e.filter(s=>RE(s,n));if(!r.length)throw M4.some(s=>RE(s,n))?CDe(e[0],n):wDe(n);if(e=r,r.length==1)break}return e}function KOt(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 ${Tce(NU(e,63))}: ${s}`)}return $N(r)}).join(mDe)}function wDe(t){return new Error(`disallowed character: ${kce(t)}`)}function CDe(t,e){let n=kce(e),r=M4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function M9(t){return new Error(`illegal placement: ${t}`)}function YOt(t,e){for(let n of e)if(!RE(t,n))throw CDe(t,n);if(t.M){let n=pDe(e);for(let r=1,s=n.length;r<s;r++)if(yne.has(n[r])){let a=r+1;for(let o;a<s&&yne.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${kce(o)}`);if(a-r>Bbe)throw new Error(`excessive non-spacing marks: ${Tce(NU(n.slice(r-1,a)))} (${a-r}/${Bbe})`);r=a}}}function XOt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=ZOt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Gv.has(o))s.push(o);else{let l=bne.get(o);if(l)s.push(...l);else if(!bDe.has(o))throw wDe(o)}}}return s.length&&r.push(e(s)),r}function QOt(t){return t.filter(e=>e!=xDe)}function ZOt(t,e){let n=vne,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 JOt(t){return VOt(t)}function eMt(t){return JOt(t)}const tMt={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},nMt={block:zpt({format(t){var n;return{transactions:(n=t.transactions)==null?void 0:n.map(r=>{if(typeof r=="string")return r;const s=o$(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:$pt({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:dxt({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 rMt(t,e){return aMt(t)?iMt(t):Zgt(t,e)}const sMt={transaction:rMt};function iMt(t){oMt(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 Pm(["0x7e",Jy(u)])}function aMt(t){return t.type==="deposit"||typeof t.sourceHash<"u"}function oMt(t){const{from:e,to:n}=t;if(e&&!uc(e))throw new Sd({address:e});if(n&&!uc(n))throw new Sd({address:n})}const Hbe={contracts:tMt,formatters:nMt,serializers:sMt},Vbe=m$({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}}}),LE=m$({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}}}),l7=1,Wbe=m$({...Hbe,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:{...Hbe.contracts,disputeGameFactory:{[l7]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[l7]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[l7]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[l7]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:l7}),qbe=m$({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});var Gb=function(){return Gb=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Gb.apply(this,arguments)};function lMt(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 cMt(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 R9="right-scroll-bar-position",L9="width-before-scroll-bar",uMt="with-scroll-bars-hidden",dMt="--removed-body-scroll-bar-size";function LW(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function fMt(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 hMt=typeof window<"u"?h.useLayoutEffect:h.useEffect,Gbe=new WeakMap;function SDe(t,e){var n=fMt(null,function(r){return t.forEach(function(s){return LW(s,r)})});return hMt(function(){var r=Gbe.get(n);if(r){var s=new Set(r),a=new Set(t),o=n.current;s.forEach(function(l){a.has(l)||LW(l,null)}),a.forEach(function(l){s.has(l)||LW(l,o)})}Gbe.set(n,t)},[t]),n}var wne=function(t,e){return wne=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])},wne(t,e)};function NDe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");wne(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var zN=function(){return zN=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},zN.apply(this,arguments)};function Ice(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 jDe(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 ADe(t,e){return function(n,r){e(n,r,t)}}function _De(t,e,n,r,s,a){function o(N){if(N!==void 0&&typeof N!="function")throw new TypeError("Function expected");return N}for(var l=r.kind,c=l==="getter"?"get":l==="setter"?"set":"value",u=!e&&t?r.static?t:t.prototype:null,d=e||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),f,x=!1,g=n.length-1;g>=0;g--){var y={};for(var v in r)y[v]=v==="access"?{}:r[v];for(var v in r.access)y.access[v]=r.access[v];y.addInitializer=function(N){if(x)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(N||null))};var C=(0,n[g])(l==="accessor"?{get:d.get,set:d.set}:d[c],y);if(l==="accessor"){if(C===void 0)continue;if(C===null||typeof C!="object")throw new TypeError("Object expected");(f=o(C.get))&&(d.get=f),(f=o(C.set))&&(d.set=f),(f=o(C.init))&&s.unshift(f)}else(f=o(C))&&(l==="field"?s.unshift(f):d[c]=f)}u&&Object.defineProperty(u,r.name,d),x=!0}function EDe(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 kDe(t){return typeof t=="symbol"?t:"".concat(t)}function TDe(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 IDe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function PDe(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 FDe(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 jU=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 ODe(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jU(e,t,n)}function PL(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 Pce(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 MDe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Pce(arguments[e]));return t}function RDe(){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 LDe(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 HN(t){return this instanceof HN?(this.v=t,this):new HN(t)}function DDe(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),s,a=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(g){return function(y){return Promise.resolve(y).then(g,f)}}function l(g,y){r[g]&&(s[g]=function(v){return new Promise(function(C,N){a.push([g,v,C,N])>1||c(g,v)})},y&&(s[g]=y(s[g])))}function c(g,y){try{u(r[g](y))}catch(v){x(a[0][3],v)}}function u(g){g.value instanceof HN?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 BDe(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:HN(t[s](o)),done:!1}:a?a(o):o}:a}}function $De(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 PL=="function"?PL(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 UDe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var pMt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function zDe(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)&&jU(e,t,n);return pMt(e,t),e}function HDe(t){return t&&t.__esModule?t:{default:t}}function VDe(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 WDe(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 qDe(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 GDe(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 KDe(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 YDe(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 xMt={__extends:NDe,__assign:zN,__rest:Ice,__decorate:jDe,__param:ADe,__esDecorate:_De,__runInitializers:EDe,__propKey:kDe,__setFunctionName:TDe,__metadata:IDe,__awaiter:PDe,__generator:FDe,__createBinding:jU,__exportStar:ODe,__values:PL,__read:Pce,__spread:MDe,__spreadArrays:RDe,__spreadArray:LDe,__await:HN,__asyncGenerator:DDe,__asyncDelegator:BDe,__asyncValues:$De,__makeTemplateObject:UDe,__importStar:zDe,__importDefault:HDe,__classPrivateFieldGet:VDe,__classPrivateFieldSet:WDe,__classPrivateFieldIn:qDe,__addDisposableResource:GDe,__disposeResources:KDe,__rewriteRelativeImportExtension:YDe},x4n=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:GDe,get __assign(){return zN},__asyncDelegator:BDe,__asyncGenerator:DDe,__asyncValues:$De,__await:HN,__awaiter:PDe,__classPrivateFieldGet:VDe,__classPrivateFieldIn:qDe,__classPrivateFieldSet:WDe,__createBinding:jU,__decorate:jDe,__disposeResources:KDe,__esDecorate:_De,__exportStar:ODe,__extends:NDe,__generator:FDe,__importDefault:HDe,__importStar:zDe,__makeTemplateObject:UDe,__metadata:IDe,__param:ADe,__propKey:kDe,__read:Pce,__rest:Ice,__rewriteRelativeImportExtension:YDe,__runInitializers:EDe,__setFunctionName:TDe,__spread:MDe,__spreadArray:LDe,__spreadArrays:RDe,__values:PL,default:xMt},Symbol.toStringTag,{value:"Module"}));function gMt(t){return t}function bMt(t,e){e===void 0&&(e=gMt);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 XDe(t){t===void 0&&(t={});var e=bMt(null);return e.options=zN({async:!0,ssr:!1},t),e}var QDe=function(t){var e=t.sideCar,n=Ice(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,zN({},n))};QDe.isSideCarExport=!0;function ZDe(t,e){return t.useMedium(e),QDe}var JDe=XDe(),DW=function(){},AU=h.forwardRef(function(t,e){var n=h.useRef(null),r=h.useState({onScrollCapture:DW,onWheelCapture:DW,onTouchMoveCapture:DW}),s=r[0],a=r[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,x=t.sideCar,g=t.noIsolation,y=t.inert,v=t.allowPinchZoom,C=t.as,N=C===void 0?"div":C,I=t.gapMode,P=lMt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=x,F=SDe([n,e]),$=Gb(Gb({},P),s);return h.createElement(h.Fragment,null,d&&h.createElement(M,{sideCar:JDe,removeScrollBar:u,shards:f,noIsolation:g,inert:y,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:I}),o?h.cloneElement(h.Children.only(l),Gb(Gb({},$),{ref:F})):h.createElement(N,Gb({},$,{className:c,ref:F}),l))});AU.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};AU.classNames={fullWidth:L9,zeroRight:R9};var yMt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vMt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=yMt();return e&&t.setAttribute("nonce",e),t}function wMt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function CMt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var SMt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=vMt())&&(wMt(e,n),CMt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},NMt=function(){var t=SMt();return function(e,n){h.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Fce=function(){var t=NMt(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},jMt={left:0,top:0,right:0,gap:0},BW=function(t){return parseInt(t||"",10)||0},AMt=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[BW(n),BW(r),BW(s)]},_Mt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return jMt;var e=AMt(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])}},EMt=Fce(),R4="data-scroll-locked",kMt=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(uMt,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(l,"px ").concat(r,`;
}
body[`).concat(R4,`] {
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(R9,` {
right: `).concat(l,"px ").concat(r,`;
}
.`).concat(L9,` {
margin-right: `).concat(l,"px ").concat(r,`;
}
.`).concat(R9," .").concat(R9,` {
right: 0 `).concat(r,`;
}
.`).concat(L9," .").concat(L9,` {
margin-right: 0 `).concat(r,`;
}
body[`).concat(R4,`] {
`).concat(dMt,": ").concat(l,`px;
}
`)},Kbe=function(){var t=parseInt(document.body.getAttribute(R4)||"0",10);return isFinite(t)?t:0},TMt=function(){h.useEffect(function(){return document.body.setAttribute(R4,(Kbe()+1).toString()),function(){var t=Kbe()-1;t<=0?document.body.removeAttribute(R4):document.body.setAttribute(R4,t.toString())}},[])},eBe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;TMt();var a=h.useMemo(function(){return _Mt(s)},[s]);return h.createElement(EMt,{styles:kMt(a,!e,s,n?"":"!important")})},Cne=!1;if(typeof window<"u")try{var rF=Object.defineProperty({},"passive",{get:function(){return Cne=!0,!0}});window.addEventListener("test",rF,rF),window.removeEventListener("test",rF,rF)}catch{Cne=!1}var pC=Cne?{passive:!1}:!1,IMt=function(t){return t.tagName==="TEXTAREA"},tBe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!IMt(t)&&n[e]==="visible")},PMt=function(t){return tBe(t,"overflowY")},FMt=function(t){return tBe(t,"overflowX")},Ybe=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=nBe(t,r);if(s){var a=rBe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},OMt=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},MMt=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},nBe=function(t,e){return t==="v"?PMt(e):FMt(e)},rBe=function(t,e){return t==="v"?OMt(e):MMt(e)},RMt=function(t,e){return t==="h"&&e==="rtl"?-1:1},LMt=function(t,e,n,r,s){var a=RMt(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=rBe(t,l),y=g[0],v=g[1],C=g[2],N=v-C-a*y;(y||N)&&nBe(t,l)&&(f+=N,x+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&Math.abs(f)<1||!d&&Math.abs(x)<1)&&(u=!0),u},sF=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Xbe=function(t){return[t.deltaX,t.deltaY]},Qbe=function(t){return t&&"current"in t?t.current:t},DMt=function(t,e){return t[0]===e[0]&&t[1]===e[1]},BMt=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},$Mt=0,mC=[];function UMt(t){var e=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState($Mt++)[0],a=h.useState(Fce)[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=cMt([t.lockRef.current],(t.shards||[]).map(Qbe),!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 N=sF(v),I=n.current,P="deltaX"in v?v.deltaX:I[0]-N[0],M="deltaY"in v?v.deltaY:I[1]-N[1],F,$=v.target,L=Math.abs(P)>Math.abs(M)?"h":"v";if("touches"in v&&L==="h"&&$.type==="range")return!1;var z=Ybe(L,$);if(!z)return!0;if(z?F=L:(F=L==="v"?"h":"v",z=Ybe(L,$)),!z)return!1;if(!r.current&&"changedTouches"in v&&(P||M)&&(r.current=F),!F)return!0;var Q=r.current||F;return LMt(Q,C,v,Q==="h"?P:M)},[]),c=h.useCallback(function(v){var C=v;if(!(!mC.length||mC[mC.length-1]!==a)){var N="deltaY"in C?Xbe(C):sF(C),I=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&DMt(F.delta,N)})[0];if(I&&I.should){C.cancelable&&C.preventDefault();return}if(!I){var P=(o.current.shards||[]).map(Qbe).filter(Boolean).filter(function(F){return F.contains(C.target)}),M=P.length>0?l(C,P[0]):!o.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),u=h.useCallback(function(v,C,N,I){var P={name:v,delta:C,target:N,should:I,shadowParent:zMt(N)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(M){return M!==P})},1)},[]),d=h.useCallback(function(v){n.current=sF(v),r.current=void 0},[]),f=h.useCallback(function(v){u(v.type,Xbe(v),v.target,l(v,t.lockRef.current))},[]),x=h.useCallback(function(v){u(v.type,sF(v),v.target,l(v,t.lockRef.current))},[]);h.useEffect(function(){return mC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,pC),document.addEventListener("touchmove",c,pC),document.addEventListener("touchstart",d,pC),function(){mC=mC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,pC),document.removeEventListener("touchmove",c,pC),document.removeEventListener("touchstart",d,pC)}},[]);var g=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(a,{styles:BMt(s)}):null,g?h.createElement(eBe,{gapMode:t.gapMode}):null)}function zMt(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const HMt=ZDe(JDe,UMt);var sBe=h.forwardRef(function(t,e){return h.createElement(AU,Gb({},t,{ref:e,sideCar:HMt}))});sBe.classNames=AU.classNames;function Zbe(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function VMt(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 iBe(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]=iBe(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 Jbe(t,e){var n={};if(typeof e=="object"){var r=t;iBe(e,(l,c)=>{if(l!=null){var u=VMt(r,c);n[Zbe(u)]=String(l)}})}else{var s=t;for(var a in s){var o=s[a];o!=null&&(n[Zbe(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 s9={exports:{}},WMt=s9.exports,eye;function qMt(){return eye||(eye=1,function(t,e){(function(n,r){var s="1.0.40",a="",o="?",l="function",c="undefined",u="object",d="string",f="major",x="model",g="name",y="type",v="vendor",C="version",N="architecture",I="console",P="mobile",M="tablet",F="smarttv",$="wearable",L="embedded",z=500,Q="Amazon",se="Apple",ee="ASUS",K="BlackBerry",re="Browser",de="Chrome",G="Edge",ie="Firefox",ae="Google",q="Huawei",W="LG",ne="Microsoft",oe="Motorola",he="Opera",_e="Samsung",xe="Sharp",Se="Sony",ge="Xiaomi",Ce="Zebra",je="Facebook",Oe="Chromium OS",$e="Mac OS",Ye=" Browser",Je=function(fn,rn){var nt={};for(var it in fn)rn[it]&&rn[it].length%2===0?nt[it]=rn[it].concat(fn[it]):nt[it]=fn[it];return nt},ht=function(fn){for(var rn={},nt=0;nt<fn.length;nt++)rn[fn[nt].toUpperCase()]=fn[nt];return rn},rt=function(fn,rn){return typeof fn===d?st(rn).indexOf(st(fn))!==-1:!1},st=function(fn){return fn.toLowerCase()},He=function(fn){return typeof fn===d?fn.replace(/[^\d\.]/g,a).split(".")[0]:r},Ve=function(fn,rn){if(typeof fn===d)return fn=fn.replace(/^\s\s*/,a),typeof rn===c?fn:fn.substring(0,z)},bt=function(fn,rn){for(var nt=0,it,Ut,hn,nn,Vt,pt;nt<rn.length&&!Vt;){var We=rn[nt],It=rn[nt+1];for(it=Ut=0;it<We.length&&!Vt&&We[it];)if(Vt=We[it++].exec(fn),Vt)for(hn=0;hn<It.length;hn++)pt=Vt[++Ut],nn=It[hn],typeof nn===u&&nn.length>0?nn.length===2?typeof nn[1]==l?this[nn[0]]=nn[1].call(this,pt):this[nn[0]]=nn[1]:nn.length===3?typeof nn[1]===l&&!(nn[1].exec&&nn[1].test)?this[nn[0]]=pt?nn[1].call(this,pt,nn[2]):r:this[nn[0]]=pt?pt.replace(nn[1],nn[2]):r:nn.length===4&&(this[nn[0]]=pt?nn[3].call(this,pt.replace(nn[1],nn[2])):r):this[nn]=pt||r;nt+=2}},xt=function(fn,rn){for(var nt in rn)if(typeof rn[nt]===u&&rn[nt].length>0){for(var it=0;it<rn[nt].length;it++)if(rt(rn[nt][it],fn))return nt===o?r:nt}else if(rt(rn[nt],fn))return nt===o?r:nt;return rn.hasOwnProperty("*")?rn["*"]:fn},Qt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},St={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"},on={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,he+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[g,he+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[g,he]],[/\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"+re]],[/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 "+re]],[/(avast|avg)\/([\w\.]+)/i],[[g,/(.+)/,"$1 Secure "+re],C],[/\bfocus\/([\w\.]+)/i],[C,[g,ie+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[g,he+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[g,he+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[g,"MIUI"+Ye]],[/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"+Ye],C],[/samsungbrowser\/([\w\.]+)/i],[C,[g,_e+" 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,de+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,de+" WebView"],C],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[C,[g,"Android "+re]],[/(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,xt,Qt]],[/(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],[[N,"amd64"]],[/(ia32(?=;))/i],[[N,st]],[/((?:i[346]|x)86)[;\)]/i],[[N,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[N,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[N,"armhf"]],[/windows (ce|mobile); ppc;/i],[[N,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[N,/ower/,a,st]],[/(sun4\w)[;\)]/i],[[N,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[N,st]]],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,_e],[y,M]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[x,[v,_e],[y,P]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[x,[v,se],[y,P]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[x,[v,se],[y,M]],[/(macintosh);/i],[x,[v,se]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[x,[v,xe],[y,P]],[/(?:honor)([-\w ]+)[;\)]/i],[x,[v,"Honor"],[y,P]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[x,[v,q],[y,M]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[x,[v,q],[y,P]],[/\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,ge],[y,P]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[x,/_/g," "],[v,ge],[y,M]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[x,[v,"OPPO"],[y,P]],[/\b(opd2\d{3}a?) bui/i],[x,[v,"OPPO"],[y,M]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[x,[v,"Vivo"],[y,P]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[x,[v,"Realme"],[y,P]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[x,[v,oe],[y,P]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[x,[v,oe],[y,M]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[x,[v,W],[y,M]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[x,[v,W],[y,P]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[x,[v,"Lenovo"],[y,M]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[x,/_/g," "],[v,"Nokia"],[y,P]],[/(pixel c)\b/i],[x,[v,ae],[y,M]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[x,[v,ae],[y,P]],[/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,Se],[y,P]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[x,"Xperia Tablet"],[v,Se],[y,M]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[x,[v,"OnePlus"],[y,P]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[x,[v,Q],[y,M]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[x,/(.+)/g,"Fire Phone $1"],[v,Q],[y,P]],[/(playbook);[-\w\),; ]+(rim)/i],[x,v,[y,M]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[x,[v,K],[y,P]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[x,[v,ee],[y,M]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[x,[v,ee],[y,P]],[/(nexus 9)/i],[x,[v,"HTC"],[y,M]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[v,[x,/_/g," "],[y,P]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[x,[v,"TCL"],[y,M]],[/(itel) ((\w+))/i],[[v,st],x,[y,xt,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[x,[v,"Acer"],[y,M]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[x,[v,"Meizu"],[y,P]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[x,[v,"Ulefone"],[y,P]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[x,[v,"Energizer"],[y,P]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[x,[v,"Cat"],[y,P]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[x,[v,"Smartfren"],[y,P]],[/droid.+; (a(?:015|06[35]|142p?))/i],[x,[v,"Nothing"],[y,P]],[/(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,P]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[v,x,[y,M]],[/(surface duo)/i],[x,[v,ne],[y,M]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[x,[v,"Fairphone"],[y,P]],[/(u304aa)/i],[x,[v,"AT&T"],[y,P]],[/\bsie-(\w*)/i],[x,[v,"Siemens"],[y,P]],[/\b(rct\w+) b/i],[x,[v,"RCA"],[y,M]],[/\b(venue[\d ]{2,7}) b/i],[x,[v,"Dell"],[y,M]],[/\b(q(?:mv|ta)\w+) b/i],[x,[v,"Verizon"],[y,M]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[x,[v,"Barnes & Noble"],[y,M]],[/\b(tm\d{3}\w+) b/i],[x,[v,"NuVision"],[y,M]],[/\b(k88) b/i],[x,[v,"ZTE"],[y,M]],[/\b(nx\d{3}j) b/i],[x,[v,"ZTE"],[y,P]],[/\b(gen\d{3}) b.+49h/i],[x,[v,"Swiss"],[y,P]],[/\b(zur\d{3}) b/i],[x,[v,"Swiss"],[y,M]],[/\b((zeki)?tb.*\b) b/i],[x,[v,"Zeki"],[y,M]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[v,"Dragon Touch"],x,[y,M]],[/\b(ns-?\w{0,9}) b/i],[x,[v,"Insignia"],[y,M]],[/\b((nxa|next)-?\w{0,9}) b/i],[x,[v,"NextBook"],[y,M]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[v,"Voice"],x,[y,P]],[/\b(lvtel\-)?(v1[12]) b/i],[[v,"LvTel"],x,[y,P]],[/\b(ph-1) /i],[x,[v,"Essential"],[y,P]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[x,[v,"Envizen"],[y,M]],[/\b(trio[-\w\. ]+) b/i],[x,[v,"MachSpeed"],[y,M]],[/\btu_(1491) b/i],[x,[v,"Rotor"],[y,M]],[/(shield[\w ]+) b/i],[x,[v,"Nvidia"],[y,M]],[/(sprint) (\w+)/i],[v,x,[y,P]],[/(kin\.[onetw]{3})/i],[[x,/\./g," "],[v,ne],[y,P]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[x,[v,Ce],[y,M]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[x,[v,Ce],[y,P]],[/smart-tv.+(samsung)/i],[v,[y,F]],[/hbbtv.+maple;(\d+)/i],[[x,/^/,"SmartTV"],[v,_e],[y,F]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[v,W],[y,F]],[/(apple) ?tv/i],[v,[x,se+" TV"],[y,F]],[/crkey/i],[[x,de+"cast"],[v,ae],[y,F]],[/droid.+aft(\w+)( bui|\))/i],[x,[v,Q],[y,F]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[x,[v,xe],[y,F]],[/(bravia[\w ]+)( bui|\))/i],[x,[v,Se],[y,F]],[/(mitv-\w{5}) bui/i],[x,[v,ge],[y,F]],[/Hbbtv.*(technisat) (.*);/i],[v,x,[y,F]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[v,Ve],[x,Ve],[y,F]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,F]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[v,x,[y,I]],[/droid.+; (shield) bui/i],[x,[v,"Nvidia"],[y,I]],[/(playstation [345portablevi]+)/i],[x,[v,Se],[y,I]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[x,[v,ne],[y,I]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[x,[v,_e],[y,$]],[/((pebble))app/i],[v,x,[y,$]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[x,[v,se],[y,$]],[/droid.+; (glass) \d/i],[x,[v,ae],[y,$]],[/droid.+; (wt63?0{2,3})\)/i],[x,[v,Ce],[y,$]],[/droid.+; (glass) \d/i],[x,[v,ae],[y,$]],[/(pico) (4|neo3(?: link|pro)?)/i],[v,x,[y,$]],[/; (quest( \d| pro)?)/i],[x,[v,je],[y,$]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[v,[y,L]],[/(aeobc)\b/i],[x,[v,Q],[y,L]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[x,[y,P]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[x,[y,M]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,M]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,P]],[/(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,xt,St]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,xt,St],[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,$e],[C,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[C,g],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[g,C],[/\(bb(10);/i],[C,[g,K]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[g,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,de+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,Oe],C],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[g,C],[/(sunos) ?([\w\.\d]*)/i],[[g,"Solaris"],C],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[g,C]]},cn=function(fn,rn){if(typeof fn===u&&(rn=fn,fn=r),!(this instanceof cn))return new cn(fn,rn).getResult();var nt=typeof n!==c&&n.navigator?n.navigator:r,it=fn||(nt&&nt.userAgent?nt.userAgent:a),Ut=nt&&nt.userAgentData?nt.userAgentData:r,hn=rn?Je(on,rn):on,nn=nt&&nt.userAgent==it;return this.getBrowser=function(){var Vt={};return Vt[g]=r,Vt[C]=r,bt.call(Vt,it,hn.browser),Vt[f]=He(Vt[C]),nn&&nt&&nt.brave&&typeof nt.brave.isBrave==l&&(Vt[g]="Brave"),Vt},this.getCPU=function(){var Vt={};return Vt[N]=r,bt.call(Vt,it,hn.cpu),Vt},this.getDevice=function(){var Vt={};return Vt[v]=r,Vt[x]=r,Vt[y]=r,bt.call(Vt,it,hn.device),nn&&!Vt[y]&&Ut&&Ut.mobile&&(Vt[y]=P),nn&&Vt[x]=="Macintosh"&&nt&&typeof nt.standalone!==c&&nt.maxTouchPoints&&nt.maxTouchPoints>2&&(Vt[x]="iPad",Vt[y]=M),Vt},this.getEngine=function(){var Vt={};return Vt[g]=r,Vt[C]=r,bt.call(Vt,it,hn.engine),Vt},this.getOS=function(){var Vt={};return Vt[g]=r,Vt[C]=r,bt.call(Vt,it,hn.os),nn&&!Vt[g]&&Ut&&Ut.platform&&Ut.platform!="Unknown"&&(Vt[g]=Ut.platform.replace(/chrome os/i,Oe).replace(/macos/i,$e)),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 it},this.setUA=function(Vt){return it=typeof Vt===d&&Vt.length>z?Ve(Vt,z):Vt,this},this.setUA(it),this};cn.VERSION=s,cn.BROWSER=ht([g,C,f]),cn.CPU=ht([N]),cn.DEVICE=ht([x,v,y,I,P,F,M,$,L]),cn.ENGINE=cn.OS=ht([g,C]),t.exports&&(e=t.exports=cn),e.UAParser=cn;var Vn=typeof n!==c&&(n.jQuery||n.Zepto);if(Vn&&!Vn.ua){var tn=new cn;Vn.ua=tn.getResult(),Vn.ua.get=function(){return tn.getUA()},Vn.ua.set=function(fn){tn.setUA(fn);var rn=tn.getResult();for(var nt in rn)Vn.ua[nt]=rn[nt]}}})(typeof window=="object"?window:WMt)}(s9,s9.exports)),s9.exports}var GMt=qMt(),xC={},$W,tye;function KMt(){return tye||(tye=1,$W=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),$W}var UW={},Ab={},nye;function R5(){if(nye)return Ab;nye=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 Ab.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},Ab.getSymbolTotalCodewords=function(r){return e[r]},Ab.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},Ab.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},Ab.isKanjiModeEnabled=function(){return typeof t<"u"},Ab.toSJIS=function(r){return t(r)},Ab}var zW={},rye;function Oce(){return rye||(rye=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}}}(zW)),zW}var HW,sye;function YMt(){if(sye)return HW;sye=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++}},HW=t,HW}var VW,iye;function XMt(){if(iye)return VW;iye=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]},VW=t,VW}var WW={},aye;function QMt(){return aye||(aye=1,function(t){const e=R5().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}}(WW)),WW}var qW={},oye;function ZMt(){if(oye)return qW;oye=1;const t=R5().getSymbolSize,e=7;return qW.getPositions=function(r){const s=t(r);return[[0,0],[s-e,0],[0,s-e]]},qW}var GW={},lye;function JMt(){return lye||(lye=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}}(GW)),GW}var iF={},cye;function aBe(){if(cye)return iF;cye=1;const t=Oce(),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 iF.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}},iF.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}},iF}var KW={},c7={},uye;function eRt(){if(uye)return c7;uye=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]}(),c7.log=function(r){if(r<1)throw new Error("log("+r+")");return e[r]},c7.exp=function(r){return t[r]},c7.mul=function(r,s){return r===0||s===0?0:t[e[r]+e[s]]},c7}var dye;function tRt(){return dye||(dye=1,function(t){const e=eRt();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}}(KW)),KW}var YW,fye;function nRt(){if(fye)return YW;fye=1;const t=tRt();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},YW=e,YW}var XW={},QW={},ZW={},hye;function oBe(){return hye||(hye=1,ZW.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),ZW}var o0={},pye;function lBe(){if(pye)return o0;pye=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 mye;function L5(){return mye||(mye=1,function(t){const e=oBe(),n=lBe();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}}}(QW)),QW}var xye;function rRt(){return xye||(xye=1,function(t){const e=R5(),n=aBe(),r=Oce(),s=L5(),a=oBe(),o=7973,l=e.getBCHDigit(o);function c(x,g,y){for(let v=1;v<=40;v++)if(g<=t.getCapacity(v,y,x))return v}function u(x,g){return s.getCharCountIndicator(x,g)+4}function d(x,g){let y=0;return x.forEach(function(v){const C=u(v.mode,g);y+=C+v.getBitsLength()}),y}function f(x,g){for(let y=1;y<=40;y++)if(d(x,y)<=t.getCapacity(y,g,s.MIXED))return y}t.from=function(g,y){return a.isValid(g)?parseInt(g,10):y},t.getCapacity=function(g,y,v){if(!a.isValid(g))throw new Error("Invalid QR Code version");typeof v>"u"&&(v=s.BYTE);const C=e.getSymbolTotalCodewords(g),N=n.getTotalCodewordsCount(g,y),I=(C-N)*8;if(v===s.MIXED)return I;const P=I-u(v,g);switch(v){case s.NUMERIC:return Math.floor(P/10*3);case s.ALPHANUMERIC:return Math.floor(P/11*2);case s.KANJI:return Math.floor(P/13);case s.BYTE:default:return Math.floor(P/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}}(XW)),XW}var JW={},gye;function sRt(){if(gye)return JW;gye=1;const t=R5(),e=1335,n=21522,r=t.getBCHDigit(e);return JW.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},JW}var eq={},tq,bye;function iRt(){if(bye)return tq;bye=1;const t=L5();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))},tq=e,tq}var nq,yye;function aRt(){if(yye)return nq;yye=1;const t=L5(),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)},nq=n,nq}var rq,vye;function oRt(){if(vye)return rq;vye=1;const t=L5();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)},rq=e,rq}var sq,wye;function lRt(){if(wye)return sq;wye=1;const t=L5(),e=R5();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)}},sq=n,sq}var iq={exports:{}},Cye;function cRt(){return Cye||(Cye=1,function(t){var e={single_source_shortest_paths:function(n,r,s){var a={},o={};o[r]=0;var l=e.PriorityQueue.make();l.push(r,0);for(var c,u,d,f,x,g,y,v,C;!l.empty();){c=l.pop(),u=c.value,f=c.cost,x=n[u]||{};for(d in x)x.hasOwnProperty(d)&&(g=x[d],y=f+g,v=o[d],C=typeof o[d]>"u",(C||v>y)&&(o[d]=y,l.push(d,y),a[d]=u))}if(typeof s<"u"&&typeof o[s]>"u"){var N=["Could not find a path from ",r," to ",s,"."].join("");throw new Error(N)}return a},extract_shortest_path_from_predecessor_list:function(n,r){for(var s=[],a=r;a;)s.push(a),n[a],a=n[a];return s.reverse(),s},find_path:function(n,r,s){var a=e.single_source_shortest_paths(n,r,s);return e.extract_shortest_path_from_predecessor_list(a,s)},PriorityQueue:{make:function(n){var r=e.PriorityQueue,s={},a;n=n||{};for(a in r)r.hasOwnProperty(a)&&(s[a]=r[a]);return s.queue=[],s.sorter=n.sorter||r.default_sorter,s},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var s={value:n,cost:r};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e}(iq)),iq.exports}var Sye;function uRt(){return Sye||(Sye=1,function(t){const e=L5(),n=iRt(),r=aRt(),s=oRt(),a=lRt(),o=lBe(),l=R5(),c=cRt();function u(N){return unescape(encodeURIComponent(N)).length}function d(N,I,P){const M=[];let F;for(;(F=N.exec(P))!==null;)M.push({data:F[0],index:F.index,mode:I,length:F[0].length});return M}function f(N){const I=d(o.NUMERIC,e.NUMERIC,N),P=d(o.ALPHANUMERIC,e.ALPHANUMERIC,N);let M,F;return l.isKanjiModeEnabled()?(M=d(o.BYTE,e.BYTE,N),F=d(o.KANJI,e.KANJI,N)):(M=d(o.BYTE_KANJI,e.BYTE,N),F=[]),I.concat(P,M,F).sort(function(L,z){return L.index-z.index}).map(function(L){return{data:L.data,mode:L.mode,length:L.length}})}function x(N,I){switch(I){case e.NUMERIC:return n.getBitsLength(N);case e.ALPHANUMERIC:return r.getBitsLength(N);case e.KANJI:return a.getBitsLength(N);case e.BYTE:return s.getBitsLength(N)}}function g(N){return N.reduce(function(I,P){const M=I.length-1>=0?I[I.length-1]:null;return M&&M.mode===P.mode?(I[I.length-1].data+=P.data,I):(I.push(P),I)},[])}function y(N){const I=[];for(let P=0;P<N.length;P++){const M=N[P];switch(M.mode){case e.NUMERIC:I.push([M,{data:M.data,mode:e.ALPHANUMERIC,length:M.length},{data:M.data,mode:e.BYTE,length:M.length}]);break;case e.ALPHANUMERIC:I.push([M,{data:M.data,mode:e.BYTE,length:M.length}]);break;case e.KANJI:I.push([M,{data:M.data,mode:e.BYTE,length:u(M.data)}]);break;case e.BYTE:I.push([{data:M.data,mode:e.BYTE,length:u(M.data)}])}}return I}function v(N,I){const P={},M={start:{}};let F=["start"];for(let $=0;$<N.length;$++){const L=N[$],z=[];for(let Q=0;Q<L.length;Q++){const se=L[Q],ee=""+$+Q;z.push(ee),P[ee]={node:se,lastCount:0},M[ee]={};for(let K=0;K<F.length;K++){const re=F[K];P[re]&&P[re].node.mode===se.mode?(M[re][ee]=x(P[re].lastCount+se.length,se.mode)-x(P[re].lastCount,se.mode),P[re].lastCount+=se.length):(P[re]&&(P[re].lastCount=se.length),M[re][ee]=x(se.length,se.mode)+4+e.getCharCountIndicator(se.mode,I))}}F=z}for(let $=0;$<F.length;$++)M[F[$]].end=0;return{map:M,table:P}}function C(N,I){let P;const M=e.getBestModeForData(N);if(P=e.from(I,M),P!==e.BYTE&&P.bit<M.bit)throw new Error('"'+N+'" cannot be encoded with mode '+e.toString(P)+`.
Suggested mode is: `+e.toString(M));switch(P===e.KANJI&&!l.isKanjiModeEnabled()&&(P=e.BYTE),P){case e.NUMERIC:return new n(N);case e.ALPHANUMERIC:return new r(N);case e.KANJI:return new a(N);case e.BYTE:return new s(N)}}t.fromArray=function(I){return I.reduce(function(P,M){return typeof M=="string"?P.push(C(M,null)):M.data&&P.push(C(M.data,M.mode)),P},[])},t.fromString=function(I,P){const M=f(I,l.isKanjiModeEnabled()),F=y(M),$=v(F,P),L=c.find_path($.map,"start","end"),z=[];for(let Q=1;Q<L.length-1;Q++)z.push($.table[L[Q]].node);return t.fromArray(g(z))},t.rawSplit=function(I){return t.fromArray(f(I,l.isKanjiModeEnabled()))}}(eq)),eq}var Nye;function dRt(){if(Nye)return UW;Nye=1;const t=R5(),e=Oce(),n=YMt(),r=XMt(),s=QMt(),a=ZMt(),o=JMt(),l=aBe(),c=nRt(),u=rRt(),d=sRt(),f=L5(),x=uRt();function g($,L){const z=$.size,Q=a.getPositions(L);for(let se=0;se<Q.length;se++){const ee=Q[se][0],K=Q[se][1];for(let re=-1;re<=7;re++)if(!(ee+re<=-1||z<=ee+re))for(let de=-1;de<=7;de++)K+de<=-1||z<=K+de||(re>=0&&re<=6&&(de===0||de===6)||de>=0&&de<=6&&(re===0||re===6)||re>=2&&re<=4&&de>=2&&de<=4?$.set(ee+re,K+de,!0,!0):$.set(ee+re,K+de,!1,!0))}}function y($){const L=$.size;for(let z=8;z<L-8;z++){const Q=z%2===0;$.set(z,6,Q,!0),$.set(6,z,Q,!0)}}function v($,L){const z=s.getPositions(L);for(let Q=0;Q<z.length;Q++){const se=z[Q][0],ee=z[Q][1];for(let K=-2;K<=2;K++)for(let re=-2;re<=2;re++)K===-2||K===2||re===-2||re===2||K===0&&re===0?$.set(se+K,ee+re,!0,!0):$.set(se+K,ee+re,!1,!0)}}function C($,L){const z=$.size,Q=u.getEncodedBits(L);let se,ee,K;for(let re=0;re<18;re++)se=Math.floor(re/3),ee=re%3+z-8-3,K=(Q>>re&1)===1,$.set(se,ee,K,!0),$.set(ee,se,K,!0)}function N($,L,z){const Q=$.size,se=d.getEncodedBits(L,z);let ee,K;for(ee=0;ee<15;ee++)K=(se>>ee&1)===1,ee<6?$.set(ee,8,K,!0):ee<8?$.set(ee+1,8,K,!0):$.set(Q-15+ee,8,K,!0),ee<8?$.set(8,Q-ee-1,K,!0):ee<9?$.set(8,15-ee-1+1,K,!0):$.set(8,15-ee-1,K,!0);$.set(Q-8,8,1,!0)}function I($,L){const z=$.size;let Q=-1,se=z-1,ee=7,K=0;for(let re=z-1;re>0;re-=2)for(re===6&&re--;;){for(let de=0;de<2;de++)if(!$.isReserved(se,re-de)){let G=!1;K<L.length&&(G=(L[K]>>>ee&1)===1),$.set(se,re-de,G),ee--,ee===-1&&(K++,ee=7)}if(se+=Q,se<0||z<=se){se-=Q,Q=-Q;break}}}function P($,L,z){const Q=new n;z.forEach(function(de){Q.put(de.mode.bit,4),Q.put(de.getLength(),f.getCharCountIndicator(de.mode,$)),de.write(Q)});const se=t.getSymbolTotalCodewords($),ee=l.getTotalCodewordsCount($,L),K=(se-ee)*8;for(Q.getLengthInBits()+4<=K&&Q.put(0,4);Q.getLengthInBits()%8!==0;)Q.putBit(0);const re=(K-Q.getLengthInBits())/8;for(let de=0;de<re;de++)Q.put(de%2?17:236,8);return M(Q,$,L)}function M($,L,z){const Q=t.getSymbolTotalCodewords(L),se=l.getTotalCodewordsCount(L,z),ee=Q-se,K=l.getBlocksCount(L,z),re=Q%K,de=K-re,G=Math.floor(Q/K),ie=Math.floor(ee/K),ae=ie+1,q=G-ie,W=new c(q);let ne=0;const oe=new Array(K),he=new Array(K);let _e=0;const xe=new Uint8Array($.buffer);for(let Oe=0;Oe<K;Oe++){const $e=Oe<de?ie:ae;oe[Oe]=xe.slice(ne,ne+$e),he[Oe]=W.encode(oe[Oe]),ne+=$e,_e=Math.max(_e,$e)}const Se=new Uint8Array(Q);let ge=0,Ce,je;for(Ce=0;Ce<_e;Ce++)for(je=0;je<K;je++)Ce<oe[je].length&&(Se[ge++]=oe[je][Ce]);for(Ce=0;Ce<q;Ce++)for(je=0;je<K;je++)Se[ge++]=he[je][Ce];return Se}function F($,L,z,Q){let se;if(Array.isArray($))se=x.fromArray($);else if(typeof $=="string"){let G=L;if(!G){const ie=x.rawSplit($);G=u.getBestVersionForData(ie,z)}se=x.fromString($,G||40)}else throw new Error("Invalid data");const ee=u.getBestVersionForData(se,z);if(!ee)throw new Error("The amount of data is too big to be stored in a QR Code");if(!L)L=ee;else if(L<ee)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+ee+`.
`);const K=P(L,z,se),re=t.getSymbolSize(L),de=new r(re);return g(de,L),y(de),v(de,L),N(de,z,0),L>=7&&C(de,L),I(de,K),isNaN(Q)&&(Q=o.getBestMask(de,N.bind(null,de,z))),o.applyMask(Q,de),N(de,z,Q),{modules:de,version:L,errorCorrectionLevel:z,maskPattern:Q,segments:se}}return UW.create=function(L,z){if(typeof L>"u"||L==="")throw new Error("No input text");let Q=e.M,se,ee;return typeof z<"u"&&(Q=e.from(z.errorCorrectionLevel,e.M),se=u.from(z.version),ee=o.from(z.maskPattern),z.toSJISFunc&&t.setToSJISFunction(z.toSJISFunc)),F(L,se,Q,ee)},UW}var aq={},oq={},jye;function cBe(){return jye||(jye=1,function(t){function e(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(a){return[a,a]}))),r.length===6&&r.push("F","F");const s=parseInt(r.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const s=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,a=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:a,scale:a?4:o,margin:s,color:{dark:e(r.color.dark||"#000000ff"),light:e(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,s){return s.width&&s.width>=r+s.margin*2?s.width/(r+s.margin*2):s.scale},t.getImageWidth=function(r,s){const a=t.getScale(r,s);return Math.floor((r+s.margin*2)*a)},t.qrToImageData=function(r,s,a){const o=s.modules.size,l=s.modules.data,c=t.getScale(o,a),u=Math.floor((o+a.margin*2)*c),d=a.margin*c,f=[a.color.light,a.color.dark];for(let x=0;x<u;x++)for(let g=0;g<u;g++){let y=(x*u+g)*4,v=a.color.light;if(x>=d&&g>=d&&x<u-d&&g<u-d){const C=Math.floor((x-d)/c),N=Math.floor((g-d)/c);v=f[l[C*o+N]?1:0]}r[y++]=v.r,r[y++]=v.g,r[y++]=v.b,r[y]=v.a}}}(oq)),oq}var Aye;function fRt(){return Aye||(Aye=1,function(t){const e=cBe();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)}}(aq)),aq}var lq={},_ye;function hRt(){if(_ye)return lq;_ye=1;const t=cBe();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 lq.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},lq}var Eye;function pRt(){if(Eye)return xC;Eye=1;const t=KMt(),e=dRt(),n=fRt(),r=hRt();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 xC.create=e.create,xC.toCanvas=s.bind(null,n.render),xC.toDataURL=s.bind(null,n.renderToDataURL),xC.toString=s.bind(null,function(a,o,l){return r.render(a,l)}),xC}var mRt=pRt();const xRt=Ti(mRt);_U.type="coinbaseWallet";function _U(t={}){return t.version==="3"||t.headlessMode?bRt(t):gRt(t)}function gRt(t){let e,n,r,s;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:_U.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=>Ic(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===No.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 No(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=>Ic(l))},async getChainId(){const l=await(await this.getProvider()).request({method:"eth_chainId"});return Number(l)},async getProvider(){if(!e){const o=(()=>{var u;return typeof t.preference=="string"?{options:t.preference}:{...t.preference,options:((u=t.preference)==null?void 0:u.options)??"all"}})(),{createCoinbaseWalletSDK:l}=await os(async()=>{const{createCoinbaseWalletSDK:u}=await import("./index-3wm3rc-X.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 V3);const u=await this.getProvider();try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:Hs(c.id)}]}),c}catch(y){if(y.code===4902)try{let v;o!=null&&o.blockExplorerUrls?v=o.blockExplorerUrls:v=(d=c.blockExplorers)!=null&&d.default.url?[(f=c.blockExplorers)==null?void 0:f.default.url]:[];let C;(x=o==null?void 0:o.rpcUrls)!=null&&x.length?C=o.rpcUrls:C=[((g=c.rpcUrls.default)==null?void 0:g.http[0])??""];const N={blockExplorerUrls:v,chainId:Hs(l),chainName:(o==null?void 0:o.chainName)??c.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??c.nativeCurrency,rpcUrls:C};return await u.request({method:"wallet_addEthereumChain",params:[N]}),c}catch(v){throw new No(v)}throw new pp(y)}},onAccountsChanged(o){o.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:o.map(l=>Ic(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 bRt(t){let n,r,s,a,o;return l=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",type:_U.type,async connect({chainId:c}={}){try{const u=await this.getProvider(),d=(await u.request({method:"eth_requestAccounts"})).map(x=>Ic(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===No.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 No(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=>Ic(u))},async getChainId(){const u=await(await this.getProvider()).request({method:"eth_chainId"});return Number(u)},async getProvider(){var c;if(!r){const u=await(async()=>{const{default:y}=await os(async()=>{const{default:v}=await import("./index-DX3HZbqT.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 V3);const f=await this.getProvider();try{return await f.request({method:"wallet_switchEthereumChain",params:[{chainId:Hs(d.id)}]}),d}catch(C){if(C.code===4902)try{let N;c!=null&&c.blockExplorerUrls?N=c.blockExplorerUrls:N=(x=d.blockExplorers)!=null&&x.default.url?[(g=d.blockExplorers)==null?void 0:g.default.url]:[];let I;(y=c==null?void 0:c.rpcUrls)!=null&&y.length?I=c.rpcUrls:I=[((v=d.rpcUrls.default)==null?void 0:v.http[0])??""];const P={blockExplorerUrls:N,chainId:Hs(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:I};return await f.request({method:"wallet_addEthereumChain",params:[P]}),d}catch(N){throw new No(N)}throw new pp(C)}},onAccountsChanged(c){c.length===0?this.onDisconnect():l.emitter.emit("change",{accounts:c.map(u=>Ic(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)}})}Mce.type="safe";function Mce(t={}){const{shimDisconnect:e=!1}=t;let n,r;return s=>({id:"safe",name:"Safe",type:Mce.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(Ic)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!n){const{default:o}=await os(async()=>{const{default:d}=await import("./index-B8lqC164.js");return{default:d}},__vite__mapDeps([6,7,2])),l=new o(t),c=await hoe(()=>l.safe.getInfo(),{timeout:t.unstable_getInfoTimeout??10});if(!c)throw new Error("Could not load Safe information");const u=await(async()=>{const d=await os(()=>import("./index-fU4ef4IJ.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")}})}Rce.type="walletConnect";function Rce(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:Rce.type,async setup(){const x=await this.getProvider().catch(()=>null);x&&(l||(l=this.onConnect.bind(this),x.on("connect",l)),u||(u=this.onSessionDelete.bind(this),x.on("session_delete",u)))},async connect({chainId:x,...g}={}){var y,v;try{const C=await this.getProvider();if(!C)throw new tp;c||(c=this.onDisplayUri,C.on("display_uri",c));let N=x;if(!N){const F=await((y=f.storage)==null?void 0:y.getItem("state"))??{};f.chains.some(L=>L.id===F.chainId)?N=F.chainId:N=(v=f.chains[0])==null?void 0:v.id}if(!N)throw new Error("No chains found on connector.");const I=await this.isChainsStale();if(C.session&&I&&await C.disconnect(),!C.session||I){const F=f.chains.filter($=>$.id!==N).map($=>$.id);await C.connect({optionalChains:[N,...F],..."pairingTopic"in g?{pairingTopic:g.pairingTopic}:{}}),this.setRequestedChainsIds(f.chains.map($=>$.id))}const P=(await C.enable()).map(F=>Ic(F)),M=await this.getChainId();return c&&(C.removeListener("display_uri",c),c=void 0),l&&(C.removeListener("connect",l),l=void 0),a||(a=this.onAccountsChanged.bind(this),C.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),C.on("chainChanged",o)),d||(d=this.onDisconnect.bind(this),C.on("disconnect",d)),u||(u=this.onSessionDelete.bind(this),C.on("session_delete",u)),{accounts:P,chainId:M}}catch(C){throw/(user rejected|connection request reset)/i.test(C==null?void 0:C.message)?new No(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=>Ic(g))},async getProvider({chainId:x}={}){var y;async function g(){const v=f.chains.map(N=>N.id);if(!v.length)return;const{EthereumProvider:C}=await os(async()=>{const{EthereumProvider:N}=await import("./index.es-Cxpu7xZ1.js");return{EthereumProvider:N}},__vite__mapDeps([9,5]));return await C.init({...t,disableProviderPing:!0,optionalChains:v,projectId:t.projectId,rpcMap:Object.fromEntries(f.chains.map(N=>{const[I]=eyt({chain:N,transports:f.transports});return[N.id,I]})),showQrModal:t.showQrModal??!0})}return n||(r||(r=g()),n=await r,n==null||n.events.setMaxListeners(Number.POSITIVE_INFINITY)),x&&await((y=this.switchChain)==null?void 0:y.call(this,{chainId:x})),n},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[x,g]=await Promise.all([this.getAccounts(),this.getProvider()]);return x.length?await this.isChainsStale()&&g.session?(await g.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:x,chainId:g}){var C,N,I;const y=await this.getProvider();if(!y)throw new tp;const v=f.chains.find(P=>P.id===g);if(!v)throw new pp(new V3);try{await Promise.all([new Promise(M=>{const F=({chainId:$})=>{$===g&&(f.emitter.off("change",F),M())};f.emitter.on("change",F)}),y.request({method:"wallet_switchEthereumChain",params:[{chainId:Hs(g)}]})]);const P=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...P,g]),v}catch(P){const M=P;if(/(user rejected)/i.test(M.message))throw new No(M);try{let F;x!=null&&x.blockExplorerUrls?F=x.blockExplorerUrls:F=(C=v.blockExplorers)!=null&&C.default.url?[(N=v.blockExplorers)==null?void 0:N.default.url]:[];let $;(I=x==null?void 0:x.rpcUrls)!=null&&I.length?$=x.rpcUrls:$=[...v.rpcUrls.default.http];const L={blockExplorerUrls:F,chainId:Hs(g),chainName:(x==null?void 0:x.chainName)??v.name,iconUrls:x==null?void 0:x.iconUrls,nativeCurrency:(x==null?void 0:x.nativeCurrency)??v.nativeCurrency,rpcUrls:$};await y.request({method:"wallet_addEthereumChain",params:[L]});const z=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...z,g]),v}catch(F){throw new No(F)}}},onAccountsChanged(x){x.length===0?this.onDisconnect():f.emitter.emit("change",{accounts:x.map(g=>Ic(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 FL={},yRt=768;uOt({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}});var vRt=tDe({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}}),Sne=xOt({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"}}}}}),kye={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)"}},wRt={shrink:"_12cbo8i6",shrinkSm:"_12cbo8i7"},CRt="_12cbo8i3 ju367v8r",SRt={grow:"_12cbo8i4",growLg:"_12cbo8i5"};function uu({active:t,hover:e}){return[CRt,e&&SRt[e],wRt[t]]}var uBe=h.createContext(null);function NRt(){const{adapter:t}=h.useContext(uBe)??{};if(!t)throw new Error("No authentication adapter found");return t}function EU(){const t=h.useContext(uBe);return(t==null?void 0:t.status)??null}function dBe(){const t=EU(),{isConnected:e}=es();return e?t&&(t==="loading"||t==="unauthenticated")?t:"connected":"disconnected"}function Lce(){return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}function jRt(){return typeof navigator<"u"&&/iPhone|iPod/.test(navigator.userAgent)}function ARt(){return typeof navigator<"u"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function D5(){return jRt()||ARt()}function fu(){return Lce()||D5()}var _Rt="iekbcc0",ERt={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"},kRt=({reset:t,...e})=>{if(!t)return Sne(e);const n=ERt[t],r=Sne(e);return rDe(_Rt,n,r)},kn=Ie.forwardRef(({as:t="div",className:e,testId:n,...r},s)=>{const a={},o={};for(const c in r)Sne.properties.has(c)?a[c]=r[c]:o[c]=r[c];const l=kRt({reset:typeof t=="string"?t:"div",...a});return Ie.createElement(t,{className:rDe(l,e),...o,"data-testid":n?`rk-${n.replace(/^rk-/,"")}`:void 0,ref:s})});kn.displayName="Box";var fBe=new Map,cq=new Map;async function hBe(t){const e=cq.get(t);if(e)return e;const n=async()=>t().then(async s=>(fBe.set(t,s),s)),r=n().catch(s=>n().catch(a=>{cq.delete(t)}));return cq.set(t,r),r}async function px(...t){return await Promise.all(t.map(e=>typeof e=="function"?hBe(e):e))}function TRt(){const[,t]=h.useReducer(e=>e+1,0);return t}function Dce(t){const e=typeof t=="function"?fBe.get(t):void 0,n=TRt();return h.useEffect(()=>{typeof t=="function"&&!e&&hBe(t).then(n)},[t,e,n]),typeof t=="function"?e:t}function Lc({alt:t,background:e,borderColor:n,borderRadius:r,useAsImage:s,boxShadow:a,height:o,src:l,width:c,testId:u}){const d=D5(),f=Dce(l),x=f&&/^http/.test(f),[g,y]=h.useReducer(()=>!0,!1);return Ie.createElement(kn,{"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},Ie.createElement(kn,{...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?Ie.createElement(kn,{...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 IRt="_1luule42",PRt="_1luule43",FRt=t=>h.useMemo(()=>`${t}_${Math.round(Math.random()*1e9)}`,[t]),DE=({height:t=21,width:e=21})=>{const n=FRt("spinner");return Ie.createElement("svg",{className:IRt,fill:"none",height:t,viewBox:"0 0 21 21",width:e,xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Loading"),Ie.createElement("clipPath",{id:n},Ie.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"})),Ie.createElement("foreignObject",{clipPath:`url(#${n})`,height:"21",width:"21",x:"0",y:"0"},Ie.createElement("div",{className:PRt})))},ea=["#FC5C54","#FFD95A","#E95D72","#6A87C8","#5FD0F3","#75C06B","#FFDD86","#5FC6D4","#FF949A","#FF8024","#9BA1A4","#EC66FF","#FF8CBC","#FF9A23","#C5DADB","#A8CE63","#71ABFF","#FFE279","#B6B1B6","#FF6780","#A575FF","#4D82FF","#FFB35A"],Tye=[{color:ea[0],emoji:"🌶"},{color:ea[1],emoji:"🤑"},{color:ea[2],emoji:"🐙"},{color:ea[3],emoji:"🫐"},{color:ea[4],emoji:"🐳"},{color:ea[0],emoji:"🤶"},{color:ea[5],emoji:"🌲"},{color:ea[6],emoji:"🌞"},{color:ea[7],emoji:"🐒"},{color:ea[8],emoji:"🐵"},{color:ea[9],emoji:"🦊"},{color:ea[10],emoji:"🐼"},{color:ea[11],emoji:"🦄"},{color:ea[12],emoji:"🐷"},{color:ea[13],emoji:"🐧"},{color:ea[8],emoji:"🦩"},{color:ea[14],emoji:"👽"},{color:ea[0],emoji:"🎈"},{color:ea[8],emoji:"🍉"},{color:ea[1],emoji:"🎉"},{color:ea[15],emoji:"🐲"},{color:ea[16],emoji:"🌎"},{color:ea[17],emoji:"🍊"},{color:ea[18],emoji:"🐭"},{color:ea[19],emoji:"🍣"},{color:ea[1],emoji:"🐥"},{color:ea[20],emoji:"👾"},{color:ea[15],emoji:"🥦"},{color:ea[0],emoji:"👹"},{color:ea[17],emoji:"🙀"},{color:ea[4],emoji:"⛱"},{color:ea[21],emoji:"⛵️"},{color:ea[17],emoji:"🥳"},{color:ea[8],emoji:"🤯"},{color:ea[22],emoji:"🤠"}];function ORt(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 MRt(t){const n=Math.abs(ORt((typeof t=="string"?t:"").toLowerCase())%Tye.length);return Tye[n??0]}var RRt=({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(()=>MRt(t),[t]);return e?r?Ie.createElement(kn,{backgroundSize:"cover",borderRadius:"full",position:"absolute",style:{backgroundImage:`url(${e})`,backgroundPosition:"center",height:n,width:n}}):Ie.createElement(kn,{alignItems:"center",backgroundSize:"cover",borderRadius:"full",color:"modalText",display:"flex",justifyContent:"center",position:"absolute",style:{height:n,width:n}},Ie.createElement(DE,null)):Ie.createElement(kn,{alignItems:"center",display:"flex",justifyContent:"center",overflow:"hidden",style:{...!e&&{backgroundColor:a},height:n,width:n}},o)},pBe=RRt,mBe=h.createContext(pBe);function LRt({address:t,imageUrl:e,loading:n,size:r}){const s=h.useContext(mBe);return Ie.createElement(kn,{"aria-hidden":!0,borderRadius:"full",overflow:"hidden",position:"relative",style:{height:`${r}px`,width:`${r}px`},userSelect:"none"},Ie.createElement(kn,{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"},Ie.createElement(s,{address:t,ensImage:e,size:r})),n&&Ie.createElement(kn,{color:"accentColor",display:"flex",height:"full",position:"absolute",width:"full"},Ie.createElement(DE,{height:"100%",width:"100%"})))}var Iye={defaultLocale:"en",locale:"en"},DRt=class{constructor(t){this.listeners=new Set,this.defaultLocale=Iye.defaultLocale,this.enableFallback=!1,this.locale=Iye.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 DRt({en:JSON.parse(mne),"en-US":JSON.parse(mne)});ip.defaultLocale="en-US";ip.locale="en-US";ip.enableFallback=!0;var BRt=async t=>{switch(t){case"ar":case"ar-AR":return(await os(async()=>{const{default:e}=await import("./ar_AR-ZRPPM56D-d2WEfzQ_.js");return{default:e}},[])).default;case"de":case"de-DE":return(await os(async()=>{const{default:e}=await import("./de_DE-GYZFZXWH-CYZf24IR.js");return{default:e}},[])).default;case"en":case"en-US":return(await os(async()=>{const{default:e}=await Promise.resolve().then(()=>cAe);return{default:e}},void 0)).default;case"es":case"es-419":return(await os(async()=>{const{default:e}=await import("./es_419-OGVOQEFZ-D6BJPTeQ.js");return{default:e}},[])).default;case"fr":case"fr-FR":return(await os(async()=>{const{default:e}=await import("./fr_FR-Q5QBQBX2-lQoTmpTH.js");return{default:e}},[])).default;case"hi":case"hi-IN":return(await os(async()=>{const{default:e}=await import("./hi_IN-7I7LRHGW-CTQjmeYe.js");return{default:e}},[])).default;case"id":case"id-ID":return(await os(async()=>{const{default:e}=await import("./id_ID-ZMGZ2JFV-CgKQKAmU.js");return{default:e}},[])).default;case"ja":case"ja-JP":return(await os(async()=>{const{default:e}=await import("./ja_JP-NYBCHQTZ-CMaBl8Za.js");return{default:e}},[])).default;case"ko":case"ko-KR":return(await os(async()=>{const{default:e}=await import("./ko_KR-67WE736M-DHWhIjcm.js");return{default:e}},[])).default;case"ms":case"ms-MY":return(await os(async()=>{const{default:e}=await import("./ms_MY-65AJIBUS-BLlUrxe6.js");return{default:e}},[])).default;case"pt":case"pt-BR":return(await os(async()=>{const{default:e}=await import("./pt_BR-DMJANC65-DMs4DrlC.js");return{default:e}},[])).default;case"ru":case"ru-RU":return(await os(async()=>{const{default:e}=await import("./ru_RU-WER7RQ6A-DsJK55uv.js");return{default:e}},[])).default;case"th":case"th-TH":return(await os(async()=>{const{default:e}=await import("./th_TH-JOSHEZ6D-Cp87mIRZ.js");return{default:e}},[])).default;case"tr":case"tr-TR":return(await os(async()=>{const{default:e}=await import("./tr_TR-EAMG2YPO-C52_xfsf.js");return{default:e}},[])).default;case"ua":case"uk-UA":return(await os(async()=>{const{default:e}=await import("./uk_UA-GO2TRVWA-C1C1400t.js");return{default:e}},[])).default;case"vi":case"vi-VN":return(await os(async()=>{const{default:e}=await import("./vi_VN-5HLLSOJA-Dj7ferOp.js");return{default:e}},[])).default;case"zh":case"zh-CN":case"zh-Hans":return(await os(async()=>{const{default:e}=await import("./zh_CN-THPIFVWJ-Cbp71xMR.js");return{default:e}},[])).default;case"zh-HK":return(await os(async()=>{const{default:e}=await import("./zh_HK-R7XP4TGF-CyJtfKGw.js");return{default:e}},[])).default;case"zh-Hant":case"zh-TW":return(await os(async()=>{const{default:e}=await import("./zh_TW-F5LD752V-AHFgsYw-.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await Promise.resolve().then(()=>cAe);return{default:e}},void 0)).default}};async function Pye(t){if(ip.isLocaleCached(t)){ip.updateLocale(t);return}const n=await BRt(t);ip.setTranslations(t,JSON.parse(n))}var $Rt=()=>{var t;if(typeof window<"u"&&typeof navigator<"u"){if((t=navigator.languages)!=null&&t.length)return navigator.languages[0];if(navigator.language)return navigator.language}},fc=h.createContext({i18n:ip}),URt=({children:t,locale:e})=>{const[n,r]=h.useState(0),s=h.useMemo(()=>$Rt(),[]);h.useEffect(()=>ip.onChange(()=>{r(l=>l+1)}),[]),h.useEffect(()=>{e&&e!==ip.locale?Pye(e):!e&&s&&s!==ip.locale&&Pye(s)},[e,s]);const a=h.useMemo(()=>({t:(l,c)=>ip.t(l,c),i18n:ip}),[n]);return Ie.createElement(fc.Provider,{value:a},t)};function xBe(t){return t!=null}var Fye={iconBackground:"#7290CC",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./apechain-COEQ5RUI-0TDoXOYf.js");return{default:t}},[])).default},uq={iconBackground:"#96bedc",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./arbitrum-HW44W6XR-hPA5bMPt.js");return{default:t}},[])).default},Oye={iconBackground:"#e84141",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./avalanche-MXEFEDSW-DcC5FNt3.js");return{default:t}},[])).default},dq={iconBackground:"#0052ff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./base-Z4LFBE5D-DHfqMzJC.js");return{default:t}},[])).default},fq={iconBackground:"#814625",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./berachain-ZN3U5LDZ-CAvW_8ws.js");return{default:t}},[])).default},Mye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./blast-46UQLYYY-BV_Xlsq4.js");return{default:t}},[])).default},Rye={iconBackground:"#ebac0e",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./bsc-RVE67I5L-DVYEF0vl.js");return{default:t}},[])).default},Lye={iconBackground:"#FCFF52",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./celo-E6XU57FO-C5IguUgF.js");return{default:t}},[])).default},Dye={iconBackground:"#002D74",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./cronos-ROYR77VZ-Prn3LRPZ.js");return{default:t}},[])).default},zRt={iconBackground:"#A36EFD",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./degen-7ROC3GCY-9HqAkHtZ.js");return{default:t}},[])).default},_b={iconBackground:"#484c50",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ethereum-RFBAMUVK-WsW8NXqo.js");return{default:t}},[])).default},Bye={iconBackground:"transparent",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./flow-NBCRNYVF-D2XasjKk.js");return{default:t}},[])).default},HRt={iconBackground:"#04795c",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./gnosis-Y56LN66M-D4_J-ZQH.js");return{default:t}},[])).default},$ye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./gravity-LMEBVSFN-DLxWpxhy.js");return{default:t}},[])).default},VRt={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./hardhat-NEEC6JX7-DzuWQYyS.js");return{default:t}},[])).default},WRt={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./hyperevm-J6CONVCX-C6oeYIAP.js");return{default:t}},[])).default},Uye={iconBackground:"#7132F5",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ink-4U4ZVNAB-AlM1MLfQ.js");return{default:t}},[])).default},zye={iconBackground:"transparent",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./kaia-A33DVQBT-Fgclbhio.js");return{default:t}},[])).default},hq={iconBackground:"#ffffff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./linea-IALBSJQC-Cmyd7vgA.js");return{default:t}},[])).default},pq={iconBackground:"#ffffff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./manta-5V6W5D7G-BnjsGzeJ.js");return{default:t}},[])).default},Hye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./mantle-KBL3OIYT-DIpe0poV.js");return{default:t}},[])).default},aF={iconBackground:"#ff5a57",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./optimism-YWJ3IQHA-DYER-OR5.js");return{default:t}},[])).default},mq={iconBackground:"#9f71ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./polygon-WWEUOMKW-CNBYSB1T.js");return{default:t}},[])).default},qRt={iconBackground:"#1273EA",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ronin-PNHX5V6H-BS-WPXjQ.js");return{default:t}},[])).default},GRt={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./sanko-RHQYXGM5-OX010CbN.js");return{default:t}},[])).default},Vye={iconBackground:"#FFEEDA",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./scroll-MCKFTBRS-C2gqZSab.js");return{default:t}},[])).default},Wye={iconBackground:"#F50DB4",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./unichain-OQ3BZUDH-CyMLDmFg.js");return{default:t}},[])).default},qye={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./xdc-X7V4QFNF-CSGs0o6M.js");return{default:t}},[])).default},Gye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zetachain-BMJKVYBN-IK2CZBr3.js");return{default:t}},[])).default},Kye={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zksync-UWUXFL74-Bt0brpXu.js");return{default:t}},[])).default},xq={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zora-YZH32HP3-CY3tp3EJ.js");return{default:t}},[])).default},KRt={apechain:{chainId:33139,name:"ApeChain",...Fye},apechainCurtis:{chainId:33111,name:"ApeChain Curtis",...Fye},arbitrum:{chainId:42161,name:"Arbitrum",...uq},arbitrumGoerli:{chainId:421613,...uq},arbitrumSepolia:{chainId:421614,...uq},avalanche:{chainId:43114,...Oye},avalancheFuji:{chainId:43113,...Oye},base:{chainId:8453,name:"Base",...dq},baseGoerli:{chainId:84531,...dq},baseSepolia:{chainId:84532,...dq},berachain:{chainId:80094,name:"Berachain",...fq},berachainArtio:{chainId:80085,name:"Berachain Artio",...fq},berachainBArtio:{chainId:80084,name:"Berachain bArtio",...fq},blast:{chainId:81457,name:"Blast",...Mye},blastSepolia:{chainId:168587773,...Mye},bsc:{chainId:56,name:"BSC",...Rye},bscTestnet:{chainId:97,...Rye},celo:{chainId:42220,name:"Celo",...Lye},celoAlfajores:{chainId:44787,name:"Celo Alfajores",...Lye},cronos:{chainId:25,...Dye},cronosTestnet:{chainId:338,...Dye},degen:{chainId:666666666,name:"Degen",...zRt},flow:{chainId:747,...Bye},flowTestnet:{chainId:545,...Bye},gnosis:{chainId:100,name:"Gnosis",...HRt},goerli:{chainId:5,..._b},gravity:{chainId:1625,name:"Gravity",...$ye},gravitySepolia:{chainId:13505,name:"Gravity Sepolia",...$ye},hardhat:{chainId:31337,...VRt},holesky:{chainId:17e3,..._b},hyperevm:{chainId:999,...WRt},ink:{chainId:57073,...Uye},inkSepolia:{chainId:763373,...Uye},kaia:{chainId:8217,name:"Kaia",...zye},kairos:{chainId:1001,name:"Kairos",...zye},kovan:{chainId:42,..._b},linea:{chainId:59144,name:"Linea",...hq},lineaGoerli:{chainId:59140,name:"Linea Goerli",...hq},lineaSepolia:{chainId:59141,name:"Linea Sepolia",...hq},localhost:{chainId:1337,..._b},mainnet:{chainId:1,name:"Ethereum",..._b},manta:{chainId:169,name:"Manta",...pq},mantaSepolia:{chainId:3441006,...pq},mantaTestnet:{chainId:3441005,...pq},mantle:{chainId:5e3,...Hye},mantleTestnet:{chainId:5001,...Hye},optimism:{chainId:10,name:"Optimism",...aF},optimismGoerli:{chainId:420,...aF},optimismKovan:{chainId:69,...aF},optimismSepolia:{chainId:11155420,...aF},polygon:{chainId:137,name:"Polygon",...mq},polygonAmoy:{chainId:80002,...mq},polygonMumbai:{chainId:80001,...mq},rinkeby:{chainId:4,..._b},ronin:{chainId:2020,...qRt},ropsten:{chainId:3,..._b},sanko:{chainId:1996,name:"Sanko",...GRt},scroll:{chainId:534352,...Vye},scrollSepolia:{chainId:534351,...Vye},sepolia:{chainId:11155111,..._b},unichain:{chainId:130,...Wye},unichainSepolia:{chainId:1301,...Wye},xdc:{chainId:50,name:"XinFin",...qye},xdcTestnet:{chainId:51,...qye},zetachain:{chainId:7e3,name:"ZetaChain",...Gye},zetachainAthensTestnet:{chainId:7001,name:"Zeta Athens",...Gye},zkSync:{chainId:324,name:"zkSync",...Kye},zkSyncTestnet:{chainId:280,...Kye},zora:{chainId:7777777,name:"Zora",...xq},zoraSepolia:{chainId:999999999,...xq},zoraTestnet:{chainId:999,...xq}},YRt=Object.fromEntries(Object.values(KRt).filter(xBe).map(({chainId:t,...e})=>[t,e])),XRt=t=>t.map(e=>{const n=YRt[e.id]??{};return{...e,name:n.name??e.name,iconUrl:e.iconUrl??n.iconUrl,iconBackground:e.iconBackground??n.iconBackground}}),Bce=h.createContext({chains:[]});function QRt({children:t,initialChain:e}){const{chains:n}=Il();return Ie.createElement(Bce.Provider,{value:h.useMemo(()=>({chains:XRt(n),initialChainId:typeof e=="number"?e:e==null?void 0:e.id}),[n,e])},t)}var g8=()=>h.useContext(Bce).chains,ZRt=()=>h.useContext(Bce).initialChainId,JRt=()=>{const t=g8();return h.useMemo(()=>{const e={};for(const n of t)e[n.id]=n;return e},[t])},gBe=h.createContext({showBalance:void 0,setShowBalance:()=>{}});function eLt({children:t}){const[e,n]=h.useState();return Ie.createElement(gBe.Provider,{value:{showBalance:e,setShowBalance:n}},t)}var tLt=()=>h.useContext(gBe);function nLt(){const[t,e]=h.useState(!1);return h.useEffect(()=>(e(!0),()=>{e(!1)}),[]),h.useCallback(()=>t,[t])}function bBe(){const t=g8(),e=LE.id;return t.some(r=>r.id===e)}function rLt(t){const e=bBe(),n=s=>{try{return eMt(s)}catch{}},{data:r}=f2t({chainId:LE.id,name:t?n(t):void 0,query:{enabled:e}});return r}async function Ev(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}${iLt(a)}`,{...l,body:c,headers:{Accept:"application/json","Content-Type":"application/json",...o},signal:n.signal});clearTimeout(r);const d=await sLt(u);if(u.ok){const{headers:g,status:y}=u;return{data:d,headers:g,status:y}}throw aLt({requestBody:s,response:u,responseBody:typeof d=="string"?{error:d}:d})}function sLt(t){const e=t.headers.get("Content-Type");return e!=null&&e.startsWith("application/json")?t.json():t.text()}function iLt(t){return t&&Object.keys(t).length?`?${new URLSearchParams(t)}`:""}function aLt({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 oLt=class{constructor(t={}){const{baseUrl:e="",...n}=t;this.baseUrl=e,this.opts=n}get(t,e){return Ev(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"get"})}delete(t,e){return Ev(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"delete"})}head(t,e){return Ev(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"head"})}options(t,e){return Ev(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"options"})}post(t,e,n){return Ev(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"post"})}put(t,e,n){return Ev(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"put"})}patch(t,e,n){return Ev(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"patch"})}};function lLt({baseUrl:t,headers:e,params:n,timeout:r}){return new oLt({baseUrl:t,headers:e,params:n,timeout:r})}var cLt=!!(typeof process<"u"&&typeof FL<"u"&&FL.RAINBOW_PROVIDER_API_KEY),uLt=lLt({baseUrl:"https://enhanced-provider.rainbow.me",headers:{"x-api-key":typeof process<"u"&&typeof FL<"u"&&FL.RAINBOW_PROVIDER_API_KEY||"LzbasoBiLqltex3VkcQ7LRmL4PtfiiZ1EMJrizrgfonWN6byJReu/l6yrUoo3zLW"}});function dLt(t,e,n={}){return[t,e,n]}function gM(t){return`rk-ens-name-${t}`}function fLt(t){try{const e=t?JSON.parse(t):null;return typeof e=="object"?e:null}catch{return null}}function hLt(t,e){if(!uc(t))return;const n=new Date,r=new Date(n.getTime()+180*6e4);localStorage.setItem(gM(t),JSON.stringify({ensName:e,expires:r.getTime()}))}function pLt(t){const e=fLt(localStorage.getItem(gM(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(gM(t)),null):n}async function mLt({address:t}){const e=pLt(t);if(e)return e;const r=(await uLt.get("/v1/resolve-ens",{params:{address:t}})).data.data;return r&&hLt(t,r),r}function xLt(t){const e=bBe(),{data:n}=h2t({chainId:LE.id,address:t,query:{enabled:e}}),{data:r}=fIe({queryKey:dLt("address",t),queryFn:()=>mLt({address:t}),enabled:!e&&!!t&&cLt,staleTime:10*(60*1e3),retry:1});return n||r}function yBe({address:t,includeBalance:e}){const n=xLt(t),r=rLt(n),{data:s}=hIe({address:e?t:void 0});return{ensName:n,ensAvatar:r,balance:s}}function $ce(){const{chain:t}=es();return(t==null?void 0:t.id)??null}var vBe="rk-transactions";function gLt(t){try{const e=t?JSON.parse(t):{};return typeof e=="object"?e:{}}catch{return{}}}function Yye(){return gLt(typeof localStorage<"u"?localStorage.getItem(vBe):null)}var bLt=/^0x([A-Fa-f0-9]{64})$/;function yLt(t){const e=[];return bLt.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 vLt({provider:t}){let e=Yye(),n=t;const r=new Set,s=new Set,a=new Map;function o(I){n=I}function l(I,P){var M;return((M=e[I])==null?void 0:M[P])??[]}function c(I,P,M){const F=yLt(M);if(F.length>0)throw new Error(["Unable to add transaction",...F].join(`
`));x(I,P,$=>[{...M,status:"pending"},...$.filter(({hash:L})=>L!==M.hash)])}function u(I,P){x(I,P,()=>[])}function d(I,P,M,F){x(I,P,$=>$.map(L=>L.hash===M?{...L,status:F}:L))}async function f(I,P){await Promise.all(l(I,P).filter(M=>M.status==="pending").map(async M=>{const{confirmations:F,hash:$}=M,L=a.get($);if(L)return await L;const z=n.waitForTransactionReceipt({confirmations:F,hash:$,timeout:3e5}).then(({status:Q})=>{a.delete($),Q!==void 0&&(d(I,P,$,Q===0||Q==="reverted"?"failed":"confirmed"),v(Q))}).catch(()=>{d(I,P,$,"failed")});return a.set($,z),await z}))}function x(I,P,M){e=Yye(),e[I]=e[I]??{};let F=0;const $=10,L=M(e[I][P]??[]).filter(({status:z})=>z==="pending"?!0:F++<=$);e[I][P]=L.length>0?L:void 0,g(),y(),f(I,P)}function g(){localStorage.setItem(vBe,JSON.stringify(e))}function y(){for(const I of r)I()}function v(I){for(const P of s)P(I)}function C(I){return r.add(I),()=>{r.delete(I)}}function N(I){return s.add(I),()=>{s.delete(I)}}return{addTransaction:c,clearTransactions:u,getTransactions:l,onTransactionStatus:N,onChange:C,setProvider:o,waitForPendingTransactions:f}}var Xye,wBe=Ie.createContext(null);function wLt({children:t}){const e=pIe(),{address:n}=es(),r=$ce(),{refetch:s}=hIe({address:n,query:{enabled:!1}}),[a]=Ie.useState(()=>Xye??(Xye=vLt({provider:e}))),o=Ie.useCallback(l=>{l==="success"&&s()},[s]);return Ie.useEffect(()=>{a.setProvider(e)},[a,e]),Ie.useEffect(()=>{n&&r&&a.waitForPendingTransactions(n,r)},[a,n,r]),Ie.useEffect(()=>{if(a&&n&&r)return a.onTransactionStatus(o)},[a,n,r,o]),Ie.createElement(wBe.Provider,{value:a},t)}function CBe(){const t=Ie.useContext(wBe);if(!t)throw new Error("Transaction hooks must be used within RainbowKitProvider");return t}function SBe(){const t=CBe(),{address:e}=es(),n=$ce(),[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 Qye=t=>typeof t=="function"?t():t;function CLt(t,{extends:e}={}){const n={...Jbe(kye,Qye(t))};if(!e)return n;const r=Jbe(kye,Qye(e));return Object.fromEntries(Object.entries(n).filter(([a,o])=>o!==r[a]))}function Zye(t,e={}){return Object.entries(CLt(t,e)).map(([n,r])=>`${n}:${r.replace(/[:;{}</>]/g,"")};`).join("")}var NBe={appName:void 0,disclaimer:void 0,learnMoreUrl:"https://learn.rainbow.me/understanding-web3?utm_source=rainbowkit&utm_campaign=learnmore"},GT=h.createContext(NBe),jBe=h.createContext(!1);function SLt(t,e){let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{n=null,t()},e)}}var ABe=()=>{const[t,e]=h.useState({height:void 0,width:void 0});return h.useEffect(()=>{const n=SLt(()=>{e({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),t},KT=h.createContext({connector:null,setConnector:()=>{}});function NLt({children:t}){const[e,n]=h.useState(null);return Ie.createElement(KT.Provider,{value:h.useMemo(()=>({connector:e,setConnector:n}),[e])},t)}var YT={COMPACT:"compact",WIDE:"wide"},kU=h.createContext(YT.WIDE);function jLt({children:t,modalSize:e}){const{width:n}=ABe(),r=n&&n<yRt,{connector:s}=h.useContext(KT);return Ie.createElement(kU.Provider,{value:r||s?YT.COMPACT:e},t)}var Uce=h.createContext(!1),ALt="rk-version";function _Lt({version:t}){localStorage.setItem(ALt,t)}function ELt(){const t=h.useCallback(()=>{_Lt({version:"2.2.4"})},[]);h.useEffect(()=>{t()},[t])}function kLt(t,e){const n={};for(const r of t){const s=e(r);s&&(n[s]=r)}return n}function zce(){return typeof navigator<"u"&&typeof navigator.userAgent<"u"&&/Version\/([0-9._]+).*Safari/.test(navigator.userAgent)}function TLt(){return typeof document<"u"&&getComputedStyle(document.body).getPropertyValue("--arc-palette-focus")!==""}function Hce(){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":TLt()?"Arc":(t==null?void 0:t.indexOf("chrome"))>-1?"Chrome":(t==null?void 0:t.indexOf("firefox"))>-1?"Firefox":zce()?"Safari":"Browser"}var ILt=GMt.UAParser(),{os:Vce}=ILt;function PLt(){return Vce.name==="Windows"}function FLt(){return Vce.name==="Mac OS"}function OLt(){return["Ubuntu","Mint","Fedora","Debian","Arch","Linux"].includes(Vce.name)}function Wce(){return PLt()?"Windows":FLt()?"macOS":OLt()?"Linux":"Desktop"}var MLt=t=>{var n,r,s,a,o,l,c,u,d,f,x;const e=Hce();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)},RLt=t=>{var n,r,s;return(D5()?(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)},LLt=t=>{var n,r,s,a,o;const e=Wce();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)},_Be=(t,e)=>t.some(n=>n.id===e),DLt=t=>!!t.isRainbowKitConnector,Jye=t=>{var e;return!!(!t.isRainbowKitConnector&&((e=t.icon)!=null&&e.replace(/\n/g,"").startsWith("data:image"))&&t.uid&&t.name)},BLt=(t,e)=>t.id==="walletConnect"&&e?{...t,walletConnectModalConnector:e}:t,$Lt=({wallets:t,recentWallets:e})=>[...e,...t.filter(n=>!_Be(e,n.id))],EBe="rk-recent";function ULt(t){try{const e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}function kBe(){return typeof localStorage<"u"?ULt(localStorage.getItem(EBe)):[]}function zLt(t){return[...new Set(t)]}function HLt(t){const e=zLt([t,...kBe()]);localStorage.setItem(EBe,JSON.stringify(e))}function BE(t=!1){var M,F,$;const e=g8(),n=ZRt(),{connectAsync:r,connectors:s}=u2t(),a=s,{setIsWalletConnectModalOpen:o}=e$e(),l=a.map(L=>({...L,...L.rkDetails||{}}));async function c(L){var se,ee;const z=await L.getChainId(),Q=await r({chainId:n??((se=e.find(({id:K})=>K===z))==null?void 0:se.id)??((ee=e[0])==null?void 0:ee.id),connector:L});return Q&&HLt(L.id),Q}async function u(L){try{o(!0),await c(L),o(!1)}catch(z){const Q=z.name==="UserRejectedRequestError"||z.message==="Connection request reset. Please try again.";if(o(!1),!Q)throw z}}const d=async(L,z)=>{const Q=await L.getProvider();return L.id==="coinbase"?Q.qrUrl:new Promise(se=>Q.once("display_uri",ee=>{se(z(ee))}))},f=l.find(L=>L.id==="walletConnect"&&L.isWalletConnectModalConnector),x=l.filter(Jye).map(L=>({...L,groupIndex:0})),g=l.filter(DLt).filter(L=>!L.isWalletConnectModalConnector).filter(L=>t?!x.some(Q=>Q.id===L.rdns):!0).map(L=>BLt(L,f)),y=[...x,...g],v=kLt(y,L=>L.id),N=kBe().map(L=>v[L]).filter(Boolean).slice(0,3),I=[],P=$Lt({wallets:y,recentWallets:N});for(const L of P){if(!L)continue;const z=Jye(L),Q=_Be(N,L.id);if(z){I.push({...L,iconUrl:L.icon,ready:!0,connect:()=>c(L),groupName:"Installed",recent:Q});continue}I.push({...L,ready:L.installed??!0,connect:()=>c(L),desktopDownloadUrl:LLt(L),extensionDownloadUrl:MLt(L),groupName:L.groupName,mobileDownloadUrl:RLt(L),getQrCodeUri:(M=L.qrCode)!=null&&M.getUri?()=>d(L,L.qrCode.getUri):void 0,getDesktopUri:(F=L.desktop)!=null&&F.getUri?()=>d(L,L.desktop.getUri):void 0,getMobileUri:($=L.mobile)!=null&&$.getUri?()=>{var se;return d(L,(se=L.mobile)==null?void 0:se.getUri)}:void 0,recent:Q,showWalletConnectModal:L.walletConnectModalConnector?()=>u(L.walletConnectModalConnector):void 0})}return I}var TBe=async()=>(await os(async()=>{const{default:t}=await import("./assets-NU2OP443-COMs-Mo6.js");return{default:t}},[])).default,VLt=()=>px(TBe),WLt=()=>Ie.createElement(Lc,{background:"#d0d5de",borderRadius:"10",height:"48",src:TBe,width:"48"}),IBe=async()=>(await os(async()=>{const{default:t}=await import("./login-CWDTIDNK-DhDUYE4b.js");return{default:t}},[])).default,qLt=()=>px(IBe),GLt=()=>Ie.createElement(Lc,{background:"#d0d5de",borderRadius:"10",height:"48",src:IBe,width:"48"}),Rs=Ie.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)=>Ie.createElement(kn,{as:t,className:n,color:r,display:s,fontFamily:a,fontSize:l,fontWeight:f,id:o,ref:g,style:c,tabIndex:u,textAlign:d,testId:x},e));Rs.displayName="Text";var KLt={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}=KLt[a],N=!f||!d;return Ie.createElement(kn,{...e?t?{}:{as:"a",href:e,rel:s,target:o}:{as:"button",type:"button"},onClick:t?void 0:r,...N?{borderColor:f&&!d&&!u?"actionButtonBorderMobile":"actionButtonBorder",borderStyle:"solid",borderWidth:"1"}:{},borderRadius:"actionButton",className:!t&&uu({active:"shrinkSm",hover:"grow"}),display:"block",paddingX:v,paddingY:C,style:{willChange:"transform"},testId:l,textAlign:"center",transition:"transform",...x?{background:x}:{},...y?{height:y}:{}},Ie.createElement(Rs,{color:t?"modalTextSecondary":u?"accentColorForeground":"accentColor",size:g,weight:"bold"},n))}var YLt=()=>fu()?Ie.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"},Ie.createElement("title",null,"Close"),Ie.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"})):Ie.createElement("svg",{"aria-hidden":!0,fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Close"),Ie.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"})),c5=({"aria-label":t="Close",onClose:e})=>{const n=fu();return Ie.createElement(kn,{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"},Ie.createElement(YLt,null))},PBe=async()=>(await os(async()=>{const{default:t}=await import("./sign-A7IJEUT5-CGsRnPrd.js");return{default:t}},[])).default;function XLt({onClose:t,onCloseModal:e}){const{i18n:n}=h.useContext(fc),[{status:r,...s},a]=Ie.useState({status:"idle"}),o=NRt(),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);Ie.useEffect(()=>{c.current||(c.current=!0,l())},[l]);const u=fu(),{address:d,chain:f}=es(),{signMessageAsync:x}=_oe(),g=async()=>{try{const y=f==null?void 0:f.id,{nonce:v}=s;if(!d||!y||!v)return;a(I=>({...I,errorMessage:void 0,status:"signing"}));const C=o.createMessage({address:d,chainId:y,nonce:v});let N;try{N=await x({message:C})}catch(I){return I instanceof No?a(P=>({...P,status:"idle"})):a(P=>({...P,errorMessage:n.t("sign_in.signature.signing_error"),status:"idle"}))}a(I=>({...I,status:"verifying"}));try{if(await o.verify({message:C,signature:N})){e();return}throw new Error}catch{return a(I=>({...I,errorMessage:n.t("sign_in.signature.verifying_error"),status:"idle"}))}}catch{a({errorMessage:n.t("sign_in.signature.oops_error"),status:"idle"})}};return Ie.createElement(kn,{position:"relative"},Ie.createElement(kn,{display:"flex",paddingRight:"16",paddingTop:"16",position:"absolute",right:"0"},Ie.createElement(c5,{onClose:t})),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"24",padding:"24",paddingX:"18",style:{paddingTop:u?"60px":"36px"}},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"6":"4",style:{maxWidth:u?320:280}},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"16"},Ie.createElement(Lc,{height:40,src:PBe,width:40}),Ie.createElement(Rs,{color:"modalText",size:u?"20":"18",textAlign:"center",weight:"heavy"},n.t("sign_in.label"))),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"16":"12"},Ie.createElement(Rs,{color:"modalTextSecondary",size:u?"16":"14",textAlign:"center"},n.t("sign_in.description")),r==="idle"&&s.errorMessage?Ie.createElement(Rs,{color:"error",size:u?"16":"14",textAlign:"center",weight:"bold"},s.errorMessage):null)),Ie.createElement(kn,{alignItems:u?void 0:"center",display:"flex",flexDirection:"column",gap:"8",width:"full"},Ie.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?Ie.createElement(wd,{label:"Cancel",onClick:t,size:"large",type:"secondary"}):Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"closeButton",size:u?"16":"14",weight:"bold"},n.t("sign_in.message.cancel"))))))}function QLt(){const t=g8(),e=BE(),n=EU()==="unauthenticated",r=h.useCallback(()=>{px(...e.map(s=>s.iconUrl),...t.map(s=>s.iconUrl).filter(xBe)),fu()||(VLt(),qLt()),n&&px(PBe)},[e,t,n]);h.useEffect(()=>{r()},[r])}var FBe="WALLETCONNECT_DEEPLINK_CHOICE";function ZLt({mobileUri:t,name:e}){localStorage.setItem(FBe,JSON.stringify({href:t.split("?")[0],name:e}))}function JLt(){localStorage.removeItem(FBe)}var OBe=h.createContext(void 0),Nne="data-rk",MBe=t=>({[Nne]:t||""}),eDt=t=>{if(t&&!/^[a-zA-Z0-9_]+$/.test(t))throw new Error(`Invalid ID: ${t}`);return t?`[${Nne}="${t}"]`:`[${Nne}]`},tDt=()=>{const t=h.useContext(OBe);return MBe(t)},nDt=QLe();function rDt({appInfo:t,avatar:e,children:n,coolMode:r=!1,id:s,initialChain:a,locale:o,modalSize:l=YT.WIDE,showRecentTransactions:c=!1,theme:u=nDt}){if(QLt(),ELt(),ZTe({onDisconnect:JLt}),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=eDt(s),f={...NBe,...t},x=e??pBe;return Ie.createElement(QRt,{initialChain:a},Ie.createElement(NLt,null,Ie.createElement(URt,{locale:o},Ie.createElement(jBe.Provider,{value:r},Ie.createElement(jLt,{modalSize:l},Ie.createElement(Uce.Provider,{value:c},Ie.createElement(wLt,null,Ie.createElement(mBe.Provider,{value:x},Ie.createElement(GT.Provider,{value:f},Ie.createElement(OBe.Provider,{value:s},Ie.createElement(eLt,null,Ie.createElement(bBt,null,u?Ie.createElement("div",{...MBe(s)},Ie.createElement("style",{dangerouslySetInnerHTML:{__html:[`${d}{${Zye("lightMode"in u?u.lightMode:u)}}`,"darkMode"in u?`@media(prefers-color-scheme:dark){${d}{${Zye(u.darkMode,{extends:u.lightMode})}}}`:null].join("")}}),n):n))))))))))))}var sDt="_9pm4ki5 ju367va ju367v15 ju367v8r",iDt="_9pm4ki3 ju367v9h ju367vb3 ju367va ju367v2q ju367v8q",e2e=(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()}},[]),Ie.createElement(Ie.Fragment,null,Ie.createElement("div",{onFocus:h.useCallback(()=>e.current&&e2e(e.current,"end"),[]),tabIndex:0}),Ie.createElement("div",{ref:e,style:{outline:"none"},tabIndex:-1,...t}),Ie.createElement("div",{onFocus:h.useCallback(()=>e.current&&e2e(e.current,"start"),[]),tabIndex:0}))}var oDt=t=>t.stopPropagation();function OL({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=tDt(),c=fu();return Ie.createElement(Ie.Fragment,null,n?_a.createPortal(Ie.createElement(sBe,{enabled:s},Ie.createElement(kn,{...l},Ie.createElement(kn,{...l,alignItems:c?"flex-end":"center","aria-labelledby":r,"aria-modal":!0,className:iDt,onClick:o,position:"fixed",role:"dialog"},Ie.createElement(aDt,{className:sDt,onClick:oDt,role:"document"},t)))),document.body):null)}var lDt="_1ckjpok7",cDt="_1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",uDt="_1ckjpok4 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",dDt="_1ckjpok6 ju367vq",fDt="_1ckjpok3 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",hDt="_1ckjpok2 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r";function ML({bottomSheetOnMobile:t=!1,children:e,marginTop:n,padding:r="16",paddingBottom:s,wide:a=!1}){const o=fu(),c=h.useContext(kU)===YT.COMPACT;return Ie.createElement(kn,{marginTop:n},Ie.createElement(kn,{className:[a?o?hDt:c?uDt:fDt:cDt,o?dDt:null,o&&t?lDt:null].join(" ")},Ie.createElement(kn,{padding:r,paddingBottom:s??r},e)))}var t2e=["k","m","b","t"];function oF(t,e=1){return t.toString().replace(new RegExp(`(.+\\.\\d{${e}})\\d+`),"$1").replace(/(\.[1-9]*)0+$/,"$1").replace(/\.$/,"")}function RBe(t){if(t<1)return oF(t,3);if(t<10**2)return oF(t,2);if(t<10**4)return new Intl.NumberFormat().format(Number.parseFloat(oF(t,1)));const e=10**1;let n=String(t);for(let r=t2e.length-1;r>=0;r--){const s=10**((r+1)*3);if(s<=t){t=t*e/s/e,n=oF(t,1)+t2e[r];break}}return n}function LBe(t){return t.length<8?t:`${t.substring(0,4)}…${t.substring(t.length-4)}`}function DBe(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 pDt=()=>Ie.createElement("svg",{fill:"none",height:"13",viewBox:"0 0 13 13",width:"13",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Copied"),Ie.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=()=>Ie.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 17 16",width:"17",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Copy"),Ie.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"})),xDt=()=>Ie.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 18 16",width:"18",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Disconnect"),Ie.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 gDt(){const t=CBe(),{address:e}=es(),n=$ce();return h.useCallback(()=>{if(!e||!n)throw new Error("No address or chain ID found");t.clearTransactions(e,n)},[t,e,n])}var BBe=t=>{var e,n;return(n=(e=t==null?void 0:t.blockExplorers)==null?void 0:e.default)==null?void 0:n.url},$Be=()=>Ie.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Link"),Ie.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"})),bDt=()=>Ie.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Cancel"),Ie.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"})),yDt=()=>Ie.createElement("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Success"),Ie.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"})),vDt=t=>{switch(t){case"pending":return DE;case"confirmed":return yDt;case"failed":return bDt;default:return DE}};function wDt({tx:t}){const e=fu(),n=vDt(t.status),r=t.status==="failed"?"error":"accentColor",{chain:s}=es(),a=t.status==="confirmed"?"Confirmed":t.status==="failed"?"Failed":"Pending",o=BBe(s);return Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{...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"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:e?"16":"14"},Ie.createElement(kn,{color:r},Ie.createElement(n,null)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:e?"3":"1"},Ie.createElement(kn,null,Ie.createElement(Rs,{color:"modalText",font:"body",size:e?"16":"14",weight:"bold"},t==null?void 0:t.description)),Ie.createElement(kn,null,Ie.createElement(Rs,{color:t.status==="pending"?"modalTextSecondary":r,font:"body",size:"14",weight:e?"medium":"regular"},a)))),o&&Ie.createElement(kn,{alignItems:"center",color:"modalTextDim",display:"flex"},Ie.createElement($Be,null))))}var CDt=3;function SDt({address:t}){const e=SBe(),n=gDt(),{chain:r}=es(),s=BBe(r),a=e.slice(0,CDt),o=a.length>0,l=fu(),{appName:c}=h.useContext(GT),{i18n:u}=h.useContext(fc);return Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"10",paddingBottom:"2",paddingTop:"16",paddingX:l?"8":"18"},o&&Ie.createElement(kn,{paddingBottom:l?"4":"0",paddingTop:"8",paddingX:l?"12":"6"},Ie.createElement(kn,{display:"flex",justifyContent:"space-between"},Ie.createElement(Rs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.recent.title")),Ie.createElement(kn,{style:{marginBottom:-6,marginLeft:-10,marginRight:-10,marginTop:-6}},Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.clear.label")))))),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},o?a.map(d=>Ie.createElement(wDt,{key:d.hash,tx:d})):Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{padding:l?"12":"8"},Ie.createElement(Rs,{color:"modalTextDim",size:l?"16":"14",weight:l?"medium":"bold"},c?u.t("profile.transactions.description",{appName:c}):u.t("profile.transactions.description_fallback"))),l&&Ie.createElement(kn,{background:"generalBorderDim",height:"1",marginX:"12",marginY:"8"})))),s&&Ie.createElement(kn,{paddingBottom:"18",paddingX:l?"8":"18"},Ie.createElement(kn,{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"}:{}},Ie.createElement(Rs,{color:"modalText",font:"body",size:l?"16":"14",weight:l?"semibold":"bold"},u.t("profile.explorer.label")),Ie.createElement($Be,null))))}function n2e({action:t,icon:e,label:n,testId:r,url:s}){const a=fu();return Ie.createElement(kn,{...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"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"1",justifyContent:"center",paddingTop:"2",width:"full"},Ie.createElement(kn,{color:"modalText",height:"max"},e),Ie.createElement(kn,null,Ie.createElement(Rs,{color:"modalText",size:a?"12":"13",weight:"semibold"},n))))}function NDt({address:t,ensAvatar:e,ensName:n,balance:r,onClose:s,onDisconnect:a}){const o=h.useContext(Uce),[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?DBe(n):LBe(t),f=r==null?void 0:r.formatted,x=f?RBe(Number.parseFloat(f)):void 0,g="rk_profile_title",y=fu(),{i18n:v}=h.useContext(fc);return Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{display:"flex",flexDirection:"column"},Ie.createElement(kn,{background:"profileForeground",padding:"16"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:y?"16":"12",justifyContent:"center",margin:"8",style:{textAlign:"center"}},Ie.createElement(kn,{style:{position:"absolute",right:16,top:16,willChange:"transform"}},Ie.createElement(c5,{onClose:s}))," ",Ie.createElement(kn,{marginTop:y?"24":"0"},Ie.createElement(LRt,{address:t,imageUrl:e,size:y?82:74})),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:y?"4":"0",textAlign:"center"},Ie.createElement(kn,{textAlign:"center"},Ie.createElement(Rs,{as:"h1",color:"modalText",id:g,size:y?"20":"18",weight:"heavy"},d)),!!r&&Ie.createElement(kn,{textAlign:"center"},Ie.createElement(Rs,{as:"h1",color:"modalTextSecondary",id:g,size:y?"16":"14",weight:"semibold"},x," ",r.symbol)))),Ie.createElement(kn,{display:"flex",flexDirection:"row",gap:"8",margin:"2",marginTop:"16"},Ie.createElement(n2e,{action:u,icon:l?Ie.createElement(pDt,null):Ie.createElement(mDt,null),label:l?v.t("profile.copy_address.copied"):v.t("profile.copy_address.label")}),Ie.createElement(n2e,{action:a,icon:Ie.createElement(xDt,null),label:v.t("profile.disconnect.label"),testId:"disconnect-button"}))),o&&Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{background:"generalBorder",height:"1",marginTop:"-1"}),Ie.createElement(kn,null,Ie.createElement(SDt,{address:t})))))}function jDt({onClose:t,open:e}){const{address:n}=es(),{balance:r,ensAvatar:s,ensName:a}=yBe({address:n,includeBalance:e}),{disconnect:o}=S$();return n?Ie.createElement(Ie.Fragment,null,n&&Ie.createElement(OL,{onClose:t,open:e,titleId:"rk_account_modal_title"},Ie.createElement(ML,{bottomSheetOnMobile:!0,padding:"0"},Ie.createElement(NDt,{address:n,ensAvatar:s,ensName:a,balance:r,onClose:t,onDisconnect:o})))):null}var ADt=({size:t})=>Ie.createElement("svg",{fill:"none",height:t,viewBox:"0 0 28 28",width:t,xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Disconnect"),Ie.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"})),_Dt="v9horb0",qce=Ie.forwardRef(({children:t,currentlySelected:e=!1,onClick:n,testId:r,...s},a)=>{const o=fu();return Ie.createElement(kn,{as:"button",borderRadius:"menuButton",disabled:e,display:"flex",onClick:n,ref:a,testId:r,type:"button"},Ie.createElement(kn,{borderRadius:"menuButton",className:[o?_Dt: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))});qce.displayName="MenuButton";var EDt=({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(fc),f=g8(),x=e===t;return Ie.createElement(h.Fragment,null,Ie.createElement(qce,{currentlySelected:x,onClick:x?void 0:()=>n({chainId:t}),testId:`chain-option-${t}`},Ie.createElement(kn,{fontFamily:"body",fontSize:"16",fontWeight:"bold"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:r},a&&Ie.createElement(kn,{height:"full",marginRight:"8"},Ie.createElement(Lc,{alt:o,background:l,borderRadius:"full",height:r,src:a,width:r,testId:`chain-option-${t}-icon`})),Ie.createElement("div",null,o??o)),x&&Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},Ie.createElement(Rs,{color:"accentColorForeground",size:"14",weight:"medium"},d.t("chains.connected")),Ie.createElement(kn,{background:"connectionIndicator",borderColor:"selectedOptionBorder",borderRadius:"full",borderStyle:"solid",borderWidth:"1",height:"8",marginLeft:"8",width:"8"})),s&&Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"medium"},d.t("chains.confirm")),Ie.createElement(kn,{background:"standby",borderRadius:"full",height:"8",marginLeft:"8",width:"8"}))))),u&&c<f.length-1&&Ie.createElement(kn,{background:"generalBorderDim",height:"1",marginX:"8"}))},kDt=EDt,TDt="_18dqw9x0",IDt="_18dqw9x1";function PDt({onClose:t,open:e}){const{chainId:n}=es(),{chains:r}=Il(),[s,a]=h.useState(null),{switchChain:o}=Eoe({mutation:{onMutate:({chainId:y})=>{a(y)},onSuccess:()=>{s&&a(null)},onError:()=>{s&&a(null)},onSettled:()=>{t()}}}),{i18n:l}=h.useContext(fc),{disconnect:c}=S$(),u="rk_chain_modal_title",d=fu(),f=r.some(y=>y.id===n),x=d?"36":"28",g=g8();return n?Ie.createElement(OL,{onClose:t,open:e,titleId:u},Ie.createElement(ML,{bottomSheetOnMobile:!0,paddingBottom:"0"},Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"14"},Ie.createElement(kn,{display:"flex",flexDirection:"row",justifyContent:"space-between"},d&&Ie.createElement(kn,{width:"30"}),Ie.createElement(kn,{paddingBottom:"0",paddingLeft:"8",paddingTop:"4"},Ie.createElement(Rs,{as:"h1",color:"modalText",id:u,size:d?"20":"18",weight:"heavy"},l.t("chains.title"))),Ie.createElement(c5,{onClose:t})),!f&&Ie.createElement(kn,{marginX:"8",textAlign:d?"center":"left"},Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},l.t("chains.wrong_network"))),Ie.createElement(kn,{className:d?IDt:TDt,display:"flex",flexDirection:"column",gap:"4",padding:"2",paddingBottom:"16"},g.map(({iconBackground:y,iconUrl:v,id:C,name:N},I)=>Ie.createElement(kDt,{key:C,chainId:C,currentChainId:n,switchChain:o,chainIconSize:x,isLoading:s===C,src:v,name:N,iconBackground:y,idx:I})),!f&&Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{background:"generalBorderDim",height:"1",marginX:"8"}),Ie.createElement(qce,{onClick:()=>c(),testId:"chain-option-disconnect"},Ie.createElement(kn,{color:"error",fontFamily:"body",fontSize:"16",fontWeight:"bold"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:x},Ie.createElement(kn,{alignItems:"center",color:"error",height:x,justifyContent:"center",marginRight:"8"},Ie.createElement(ADt,{size:Number(x)})),Ie.createElement("div",null,l.t("chains.disconnect"))))))))))):null}function FDt(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 Gce=({children:t,href:e})=>Ie.createElement(kn,{as:"a",color:"accentColor",href:e,rel:"noreferrer",target:"_blank"},t),Kce=({children:t})=>Ie.createElement(Rs,{color:"modalTextSecondary",size:"12",weight:"medium"},t);function r2e({compactModeEnabled:t=!1,getWallet:e}){const{disclaimer:n,learnMoreUrl:r}=h.useContext(GT),{i18n:s}=h.useContext(fc);return Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{alignItems:"center",color:"accentColor",display:"flex",flexDirection:"column",height:"full",justifyContent:"space-around"},Ie.createElement(kn,{marginBottom:"10"},!t&&Ie.createElement(Rs,{color:"modalText",size:"18",weight:"heavy"},s.t("intro.title"))),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"32",justifyContent:"center",marginY:"20",style:{maxWidth:312}},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ie.createElement(kn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},Ie.createElement(WLt,null)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.digital_asset.title")),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.digital_asset.description")))),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ie.createElement(kn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},Ie.createElement(GLt,null)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.login.title")),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.login.description"))))),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",margin:"10"},Ie.createElement(wd,{label:s.t("intro.get.label"),onClick:e}),Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},s.t("intro.learn_more.label")))),n&&!t&&Ie.createElement(kn,{marginBottom:"8",marginTop:"12",textAlign:"center"},Ie.createElement(n,{Link:Gce,Text:Kce}))))}var UBe=()=>Ie.createElement("svg",{fill:"none",height:"17",viewBox:"0 0 11 17",width:"11",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Back"),Ie.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"})),ODt=()=>Ie.createElement("svg",{fill:"none",height:"12",viewBox:"0 0 8 12",width:"8",xmlns:"http://www.w3.org/2000/svg"},Ie.createElement("title",null,"Info"),Ie.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"})),MDt=({"aria-label":t="Info",onClick:e})=>{const n=fu();return Ie.createElement(kn,{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"},Ie.createElement(ODt,null))},zBe=t=>{const e=h.useRef(null),n=h.useContext(jBe),r=Dce(t);return h.useEffect(()=>{if(n&&e.current&&r)return LDt(e.current,r)},[n,r]),e},RDt=()=>{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},s2e=0;function LDt(t,e){s2e++;const n=[15,20,25,35,45],r=35;let s=[],a=!1,o=0,l=0;const c=RDt();function u(){const M=n[Math.floor(Math.random()*n.length)],F=Math.random()*10,$=Math.random()*25,L=Math.random()*360,z=Math.random()*35*(Math.random()<=.5?-1:1),Q=l-M/2,se=o-M/2,ee=Math.random()<=.5?-1:1,K=document.createElement("div");K.innerHTML=`<img src="${e}" width="${M}" height="${M}" style="border-radius: 25%">`,K.setAttribute("style",["position:absolute","will-change:transform",`top:${Q}px`,`left:${se}px`,`transform:rotate(${L}deg)`].join(";")),c.appendChild(K),s.push({direction:ee,element:K,left:se,size:M,speedHorz:F,speedUp:$,spinSpeed:z,spinVal:L,top:Q})}function d(){for(const M of s)M.left=M.left-M.speedHorz*M.direction,M.top=M.top-M.speedUp,M.speedUp=Math.min(M.size,M.speedUp-1),M.spinVal=M.spinVal+M.spinSpeed,M.top>=Math.max(window.innerHeight,document.body.clientHeight)+M.size&&(s=s.filter(F=>F!==M),M.element.remove()),M.element.setAttribute("style",["position:absolute","will-change:transform",`top:${M.top}px`,`left:${M.left}px`,`transform:rotate(${M.spinVal}deg)`].join(";"))}let f;function x(){a&&s.length<r&&u(),d(),f=requestAnimationFrame(x)}x();const g="ontouchstart"in window||navigator.msMaxTouchPoints,y=g?"touchstart":"mousedown",v=g?"touchend":"mouseup",C=g?"touchmove":"mousemove",N=M=>{var F,$;"touches"in M?(o=(F=M.touches)==null?void 0:F[0].clientX,l=($=M.touches)==null?void 0:$[0].clientY):(o=M.clientX,l=M.clientY)},I=M=>{N(M),a=!0},P=()=>{a=!1};return t.addEventListener(C,N,{passive:!1}),t.addEventListener(y,I),t.addEventListener(v,P),t.addEventListener("mouseleave",P),()=>{t.removeEventListener(C,N),t.removeEventListener(y,I),t.removeEventListener(v,P),t.removeEventListener("mouseleave",P);const M=setInterval(()=>{f&&s.length===0&&(cancelAnimationFrame(f),clearInterval(M),--s2e===0&&c.remove())},500)}}var DDt="g5kl0l0",HBe=({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=zBe(r),[x,g]=Ie.useState(!1),{i18n:y}=Ie.useContext(fc);return Ie.createElement(kn,{display:"flex",flexDirection:"column",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),ref:f},Ie.createElement(kn,{as:t,borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:e?void 0:[DDt,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},Ie.createElement(kn,{color:e?"accentColorForeground":"modalText",disabled:!o,fontFamily:"body",fontSize:"16",fontWeight:"bold",transition:"default"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"12"},Ie.createElement(Lc,{background:n,...!x&&u?{borderColor:"actionButtonBorder"}:{},useAsImage:!u,borderRadius:"6",height:"28",src:r,width:"28"}),Ie.createElement(kn,null,Ie.createElement(kn,{style:{marginTop:l?-2:void 0},maxWidth:"200"},s),l&&Ie.createElement(Rs,{color:e?"accentColorForeground":"accentColor",size:"12",style:{lineHeight:1,marginTop:-1},weight:"medium"},y.t("connect.recent")))))))};HBe.displayName="ModalSelection";var BDt="rk-latest-id";function $Dt(t){localStorage.setItem(BDt,t)}var gq=(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})`},UDt=t=>t?[gq(t,.2),gq(t,.14),gq(t,.1)]:null,zDt=t=>/^#([0-9a-f]{3}){1,2}$/i.test(t),VBe=async()=>(await os(async()=>{const{default:t}=await import("./connect-MR6XDLIE-BET5HMNk.js");return{default:t}},[])).default,HDt=()=>px(VBe),VDt=()=>Ie.createElement(Lc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:VBe,width:"48"}),WBe=async()=>(await os(async()=>{const{default:t}=await import("./create-X4WFHLCW-De9pC3ym.js");return{default:t}},[])).default,qBe=()=>px(WBe),WDt=()=>Ie.createElement(Lc,{background:"#e3a5e8",borderColor:"generalBorder",borderRadius:"10",height:"48",src:WBe,width:"48"}),GBe=async()=>(await os(async()=>{const{default:t}=await import("./refresh-HJGJRASX-D0rkc63_.js");return{default:t}},[])).default,qDt=()=>px(GBe),GDt=()=>Ie.createElement(Lc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:GBe,width:"48"}),KBe=async()=>(await os(async()=>{const{default:t}=await import("./scan-DEOT2M37-1-mJ5OyF.js");return{default:t}},[])).default,YBe=()=>px(KBe),KDt=()=>Ie.createElement(Lc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:KBe,width:"48"}),YDt="_1vwt0cg0",XDt="_1vwt0cg2 ju367v7a ju367v7v",QDt="_1vwt0cg3",ZDt="_1vwt0cg4",JDt=(t,e)=>{const n=Array.prototype.slice.call(xRt.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 XBe({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=JDt(o,t),y=c/g.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:P,y:M})=>{const F=(g.length-7)*y*P,$=(g.length-7)*y*M;for(let L=0;L<3;L++)x.push(Ie.createElement("rect",{fill:L%2!==0?"white":"black",height:y*(7-L*2),key:`${L}-${P}-${M}`,rx:(L-2)*-5+(L===0?2:0),ry:(L-2)*-5+(L===0?2:0),width:y*(7-L*2),x:F+y*L,y:$+y*L}))});const C=Math.floor((r+25)/y),N=g.length/2-C/2,I=g.length/2+C/2-1;return g.forEach((P,M)=>{P.forEach((F,$)=>{g[M][$]&&(M<7&&$<7||M>g.length-8&&$<7||M<7&&$>g.length-8||M>N&&M<I&&$>N&&$<I||x.push(Ie.createElement("circle",{cx:M*y+y/2,cy:$*y+y/2,fill:"black",key:`circle-${M}-${$}`,r:y/3})))})}),x},[t,r,c,o]),d=c/2-r/2,f=r+n*2;return Ie.createElement(kn,{borderColor:"generalBorder",borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:YDt,padding:l,width:"max"},Ie.createElement(kn,{style:{height:c,userSelect:"none",width:c},userSelect:"none"},Ie.createElement(kn,{display:"flex",justifyContent:"center",position:"relative",style:{height:0,top:d,width:c},width:"full"},Ie.createElement(Lc,{background:e,borderColor:{custom:"rgba(0, 0, 0, 0.06)"},borderRadius:"13",height:r,src:s,width:r})),Ie.createElement("svg",{height:c,style:{all:"revert"},width:c},Ie.createElement("title",null,"QR Code"),Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clip-wrapper"},Ie.createElement("rect",{height:f,width:f})),Ie.createElement("clipPath",{id:"clip-logo"},Ie.createElement("rect",{height:r,width:r}))),Ie.createElement("rect",{fill:"transparent",height:c,width:c}),u)))}var QBe=async()=>{switch(Hce()){case"Arc":return(await os(async()=>{const{default:e}=await import("./Arc-R3PUWRPJ-CUdEQO8X.js");return{default:e}},[])).default;case"Brave":return(await os(async()=>{const{default:e}=await import("./Brave-24BM36UM-C6C5mkTK.js");return{default:e}},[])).default;case"Chrome":return(await os(async()=>{const{default:e}=await import("./Chrome-TLI42HDP-BgiVz-ma.js");return{default:e}},[])).default;case"Edge":return(await os(async()=>{const{default:e}=await import("./Edge-AZ34LAFM-EBh9cG_z.js");return{default:e}},[])).default;case"Firefox":return(await os(async()=>{const{default:e}=await import("./Firefox-ZDK7RHKK-5nyhB0sj.js");return{default:e}},[])).default;case"Opera":return(await os(async()=>{const{default:e}=await import("./Opera-BKMCKUXC-CCypmVaM.js");return{default:e}},[])).default;case"Safari":return(await os(async()=>{const{default:e}=await import("./Safari-PXQIVS6N-B-Lfxb9r.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await import("./Browser-4R4QKTV2-D3ON1q-S.js");return{default:e}},[])).default}},eBt=()=>px(QBe),ZBe=async()=>{switch(Wce()){case"Windows":return(await os(async()=>{const{default:e}=await import("./Windows-GTAT3OTE-K9Pt3pUF.js");return{default:e}},[])).default;case"macOS":return(await os(async()=>{const{default:e}=await import("./Macos-5QL4JBJE-DLNYPiln.js");return{default:e}},[])).default;case"Linux":return(await os(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default}},tBt=()=>px(ZBe);function nBt({getWalletDownload:t,compactModeEnabled:e}){const r=BE().filter(a=>a.isRainbowKitConnector).splice(0,5),{i18n:s}=h.useContext(fc);return Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginTop:"18",width:"full"},Ie.createElement(kn,{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 Ie.createElement(kn,{alignItems:"center",display:"flex",gap:"16",justifyContent:"space-between",key:a.id,width:"full"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ie.createElement(Lc,{background:l,borderColor:"actionButtonBorder",borderRadius:"10",height:"48",src:c,width:"48"}),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"2"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},d),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},y?s.t("get.mobile_and_extension.description"):v?s.t("get.mobile_and_desktop.description"):x?s.t("get.mobile.description"):g?s.t("get.extension.description"):null))),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(wd,{label:s.t("get.action.label"),onClick:()=>t(u),type:"secondary"})))})),Ie.createElement(kn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"column",gap:"8",justifyContent:"space-between",marginBottom:"4",paddingY:"8",style:{maxWidth:275,textAlign:"center"}},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("get.looking_for.title")),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e?s.t("get.looking_for.desktop.compact_description"):s.t("get.looking_for.desktop.wide_description"))))}var bq="44";function rBt({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=zce(),{i18n:N}=h.useContext(fc),I=!!o.extensionDownloadUrl,P=(l==null?void 0:l.qrCode)&&I,M=(l==null?void 0:l.qrCode)&&!!o.desktopDownloadUrl,F=f&&s,$=async()=>{const se=await(y==null?void 0:y());window.open(se,C?"_blank":"_self")},L=g?{description:e?N.t("connect.walletconnect.description.compact"):N.t("connect.walletconnect.description.full"),label:N.t("connect.walletconnect.open.label"),onClick:()=>{r(),g()}}:F?{description:N.t("connect.secondary_action.get.description",{wallet:d}),label:N.t("connect.secondary_action.get.label"),onClick:()=>t(P||M?"DOWNLOAD_OPTIONS":"DOWNLOAD")}:null,{width:z}=ABe(),Q=z&&z<768;return h.useEffect(()=>{eBt(),tBt()},[]),Ie.createElement(kn,{display:"flex",flexDirection:"column",height:"full",width:"full"},F?Ie.createElement(kn,{alignItems:"center",display:"flex",height:"full",justifyContent:"center"},Ie.createElement(XBe,{logoBackground:c,logoSize:e?60:72,logoUrl:u,size:e?318:Q?Math.max(280,Math.min(z-308,382)):382,uri:s})):Ie.createElement(kn,{alignItems:"center",display:"flex",justifyContent:"center",style:{flexGrow:1}},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8"},Ie.createElement(kn,{borderRadius:"10",height:bq,overflow:"hidden"},Ie.createElement(Lc,{useAsImage:!o.isRainbowKitConnector,height:bq,src:u,width:bq})),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"4",paddingX:"32",style:{textAlign:"center"}},Ie.createElement(Rs,{color:"modalText",size:"18",weight:"bold"},x?N.t("connect.status.opening",{wallet:d}):I?N.t("connect.status.not_installed",{wallet:d}):N.t("connect.status.not_available",{wallet:d})),!x&&I?Ie.createElement(kn,{paddingTop:"20"},Ie.createElement(wd,{href:o.extensionDownloadUrl,label:N.t("connect.secondary_action.install.label"),type:"secondary"})):null,x&&!F&&Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",textAlign:"center",weight:"medium"},N.t("connect.status.confirm"))),Ie.createElement(kn,{alignItems:"center",color:"modalText",display:"flex",flexDirection:"row",height:"32",marginTop:"8"},n?Ie.createElement(wd,{label:N.t("connect.secondary_action.retry.label"),onClick:async()=>{v&&$(),a(o)}}):Ie.createElement(kn,{color:"modalTextSecondary"},Ie.createElement(DE,null))))))),Ie.createElement(kn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"28",justifyContent:"space-between",marginTop:"12"},x&&L&&Ie.createElement(Ie.Fragment,null,Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},L.description),Ie.createElement(wd,{label:L.label,onClick:L.onClick,type:"secondary"}))))}var yq=({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&&UDt(n);return Ie.createElement(kn,{alignItems:"center",borderRadius:"13",display:"flex",justifyContent:"center",overflow:"hidden",paddingX:a?"18":"44",position:"relative",style:{flex:1,isolation:"isolate"},width:"full"},Ie.createElement(kn,{borderColor:"actionButtonBorder",borderRadius:"13",borderStyle:"solid",borderWidth:"1",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0",zIndex:1}}),d&&Ie.createElement(kn,{background:"downloadTopCardBackground",height:"full",position:"absolute",style:{zIndex:0},width:"full"},Ie.createElement(kn,{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)"}},Ie.createElement(kn,{style:{filter:"blur(100px)",marginLeft:-27,marginTop:-20,opacity:.6,transform:"translate3d(0, 0, 0)"}},Ie.createElement(Lc,{borderRadius:"full",height:"200",src:s,width:"200"})),Ie.createElement(kn,{style:{filter:"blur(100px)",marginRight:0,marginTop:105,opacity:.6,overflow:"auto",transform:"translate3d(0, 0, 0)"}},Ie.createElement(Lc,{borderRadius:"full",height:"200",src:s,width:"200"})))),!d&&f&&Ie.createElement(kn,{background:"downloadBottomCardBackground",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0"}},Ie.createElement(kn,{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}}),Ie.createElement(kn,{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}})),Ie.createElement(kn,{alignItems:"flex-start",display:"flex",flexDirection:"row",gap:"24",height:"max",justifyContent:"center",style:{zIndex:1}},Ie.createElement(kn,null,Ie.createElement(Lc,{height:"60",src:s,width:"60",...r?{background:r,borderColor:"generalBorder",borderRadius:"10"}:null})),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4",style:{flex:1},width:"full"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},l),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e),Ie.createElement(kn,{marginTop:"14",width:"max"},Ie.createElement(wd,{href:c,label:t,onClick:o,size:"medium"})))))};function sBt({changeWalletStep:t,wallet:e}){const n=Hce(),r=Wce(),a=h.useContext(kU)==="compact",{desktop:o,desktopDownloadUrl:l,extension:c,extensionDownloadUrl:u,mobileDownloadUrl:d}=e,{i18n:f}=h.useContext(fc);return h.useEffect(()=>{qBe(),YBe(),qDt(),HDt()},[]),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",marginBottom:"8",marginTop:"4",width:"full"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8",height:"full",justifyContent:"center",width:"full"},u&&Ie.createElement(yq,{actionLabel:f.t("get_options.extension.download.label",{browser:n}),description:f.t("get_options.extension.description"),iconUrl:QBe,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&&Ie.createElement(yq,{actionLabel:f.t("get_options.desktop.download.label",{platform:r}),description:f.t("get_options.desktop.description"),iconUrl:ZBe,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&&Ie.createElement(yq,{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 iBt({changeWalletStep:t,wallet:e}){const{downloadUrls:n,qrCode:r}=e,{i18n:s}=h.useContext(fc);return h.useEffect(()=>{qBe(),YBe()},[]),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",width:"full"},Ie.createElement(kn,{style:{maxWidth:220,textAlign:"center"}},Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"semibold"},s.t("get_mobile.description"))),Ie.createElement(kn,{height:"full"},n!=null&&n.qrCode?Ie.createElement(XBe,{logoSize:0,size:268,uri:n.qrCode}):null),Ie.createElement(kn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"34",justifyContent:"space-between",marginBottom:"12",paddingY:"8"},Ie.createElement(wd,{label:s.t("get_mobile.continue.label"),onClick:()=>t(r!=null&&r.instructions?"INSTRUCTIONS_MOBILE":"CONNECT")})))}var i1={connect:()=>Ie.createElement(VDt,null),create:()=>Ie.createElement(WDt,null),install:t=>Ie.createElement(Lc,{background:t.iconBackground,borderColor:"generalBorder",borderRadius:"10",height:"48",src:t.iconUrl,width:"48"}),refresh:()=>Ie.createElement(GDt,null),scan:()=>Ie.createElement(KDt,null)};function aBt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=h.useContext(fc);return Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ie.createElement(kn,{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 Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},Ie.createElement(kn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=i1[l.step])==null?void 0:u.call(i1,e)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ie.createElement(wd,{label:n.t("get_instructions.mobile.connect.label"),onClick:()=>t(e)}),Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.mobile.learn_more.label")))))}function oBt({wallet:t}){var n,r,s,a;const{i18n:e}=h.useContext(fc);return Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ie.createElement(kn,{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 Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:l},Ie.createElement(kn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(c=i1[o.step])==null?void 0:c.call(i1,t)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},e.t(o.title,void 0,{rawKeyIfTranslationMissing:!0})),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e.t(o.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ie.createElement(wd,{label:e.t("get_instructions.extension.refresh.label"),onClick:window.location.reload.bind(window.location)}),Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},e.t("get_instructions.extension.learn_more.label")))))}function lBt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=h.useContext(fc);return Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ie.createElement(kn,{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 Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},Ie.createElement(kn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=i1[l.step])==null?void 0:u.call(i1,e)),Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Ie.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ie.createElement(wd,{label:n.t("get_instructions.desktop.connect.label"),onClick:()=>t(e)}),Ie.createElement(kn,{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"},Ie.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.desktop.learn_more.label")))))}function cBt({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(kU)===YT.COMPACT,{disclaimer:g}=h.useContext(GT),{i18n:y}=h.useContext(fc),v=zce(),C=h.useRef(!1),{connector:N}=h.useContext(KT),P=BE(!N).filter(xe=>xe.ready||!!xe.extensionDownloadUrl).sort((xe,Se)=>xe.groupIndex-Se.groupIndex),M=BE(),F=FDt(P,xe=>xe.groupName),$=["Recommended","Other","Popular","More","Others","Installed"];h.useEffect(()=>{N&&!C.current&&(re("CONNECT"),se(N),C.current=!0)},[N]);const L=xe=>{var Se,ge;d(!1),xe.ready&&((ge=(Se=xe==null?void 0:xe.connect)==null?void 0:Se.call(xe))==null||ge.catch(()=>{d(!0)}))},z=async xe=>{const Se=P.find(ge=>xe.id===ge.id);Se!=null&&Se.getDesktopUri&&setTimeout(async()=>{var Ce;const ge=await((Ce=Se==null?void 0:Se.getDesktopUri)==null?void 0:Ce.call(Se));ge&&window.open(ge,v?"_blank":"_self")},0)},Q=async xe=>{var Ce;const Se=P.find(je=>xe.id===je.id),ge=await((Ce=Se==null?void 0:Se.getQrCodeUri)==null?void 0:Ce.call(Se));l(ge),setTimeout(()=>{a(Se),re("CONNECT")},ge?0:50)},se=async xe=>{$Dt(xe.id),xe.ready&&(Q(xe),z(xe)),L(xe),r(xe.id),xe.ready||(a(xe),re(xe!=null&&xe.extensionDownloadUrl?"DOWNLOAD_OPTIONS":"CONNECT"))},ee=xe=>{var Oe;const Se=M.find($e=>xe===$e.id),ge=(Oe=Se==null?void 0:Se.downloadUrls)==null?void 0:Oe.qrCode,Ce=!!(Se!=null&&Se.desktopDownloadUrl),je=!!(Se!=null&&Se.extensionDownloadUrl);a(Se),re(ge&&(je||Ce)?"DOWNLOAD_OPTIONS":ge?"DOWNLOAD":Ce?"INSTRUCTIONS_DESKTOP":"INSTRUCTIONS_EXTENSION")},K=()=>{r(void 0),a(void 0),l(void 0)},re=(xe,Se=!1)=>{Se&&xe==="GET"&&de==="GET"?K():!Se&&xe==="GET"?G("GET"):!Se&&xe==="CONNECT"&&G("CONNECT"),ae(xe)},[de,G]=h.useState("NONE"),[ie,ae]=h.useState("NONE");let q=null,W=null,ne=null,oe;h.useEffect(()=>{d(!1)},[ie,s]);const _e=!!(!!(s!=null&&s.extensionDownloadUrl)&&(s!=null&&s.mobileDownloadUrl));switch(ie){case"NONE":q=Ie.createElement(r2e,{getWallet:()=>re("GET")});break;case"LEARN_COMPACT":q=Ie.createElement(r2e,{compactModeEnabled:x,getWallet:()=>re("GET")}),W=y.t("intro.title"),ne="NONE";break;case"GET":q=Ie.createElement(nBt,{getWalletDownload:ee,compactModeEnabled:x}),W=y.t("get.title"),ne=x?"LEARN_COMPACT":"NONE";break;case"CONNECT":q=s&&Ie.createElement(rBt,{changeWalletStep:re,compactModeEnabled:x,connectionError:u,onClose:t,qrCodeUri:o,reconnect:L,wallet:s}),W=c&&(s.name==="WalletConnect"?y.t("connect_scan.fallback_title"):y.t("connect_scan.title",{wallet:s.name})),ne=x?N?null:"NONE":null,oe=x?N?()=>{}:K:()=>{};break;case"DOWNLOAD_OPTIONS":q=s&&Ie.createElement(sBt,{changeWalletStep:re,wallet:s}),W=s&&y.t("get_options.short_title",{wallet:s.name}),ne=N?"CONNECT":x?"NONE":de;break;case"DOWNLOAD":q=s&&Ie.createElement(iBt,{changeWalletStep:re,wallet:s}),W=s&&y.t("get_mobile.title",{wallet:s.name}),ne=_e?"DOWNLOAD_OPTIONS":de;break;case"INSTRUCTIONS_MOBILE":q=s&&Ie.createElement(aBt,{connectWallet:se,wallet:s}),W=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ne="DOWNLOAD";break;case"INSTRUCTIONS_EXTENSION":q=s&&Ie.createElement(oBt,{wallet:s}),W=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ne="DOWNLOAD_OPTIONS";break;case"INSTRUCTIONS_DESKTOP":q=s&&Ie.createElement(lBt,{connectWallet:se,wallet:s}),W=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ne="DOWNLOAD_OPTIONS";break}return Ie.createElement(kn,{display:"flex",flexDirection:"row",style:{maxHeight:x?468:504}},(x?ie==="NONE":!0)&&Ie.createElement(kn,{className:x?ZDt:QDt,display:"flex",flexDirection:"column",marginTop:"16"},Ie.createElement(kn,{display:"flex",justifyContent:"space-between"},x&&g&&Ie.createElement(kn,{marginLeft:"16",width:"28"},Ie.createElement(MDt,{onClick:()=>re("LEARN_COMPACT")})),x&&!g&&Ie.createElement(kn,{marginLeft:"16",width:"28"}),Ie.createElement(kn,{marginLeft:x?"0":"6",paddingBottom:"8",paddingTop:"2",paddingX:"18"},Ie.createElement(Rs,{as:"h1",color:"modalText",id:e,size:"18",weight:"heavy",testId:"connect-header-label"},y.t("connect.title"))),x&&Ie.createElement(kn,{marginRight:"16"},Ie.createElement(c5,{onClose:t}))),Ie.createElement(kn,{className:XDt,paddingBottom:"18"},Object.entries(F).map(([xe,Se],ge)=>Se.length>0&&Ie.createElement(h.Fragment,{key:ge},xe?Ie.createElement(kn,{marginBottom:"8",marginTop:"16",marginX:"6"},Ie.createElement(Rs,{color:xe==="Installed"?"accentColor":"modalTextSecondary",size:"14",weight:"bold"},$.includes(xe)?y.t(`connector_group.${xe.toLowerCase()}`):xe)):null,Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"4"},Se.map(Ce=>Ie.createElement(HBe,{currentlySelected:Ce.id===n,iconBackground:Ce.iconBackground,iconUrl:Ce.iconUrl,key:Ce.id,name:Ce.name,onClick:()=>se(Ce),ready:Ce.ready,recent:Ce.recent,testId:`wallet-option-${Ce.id}`,isRainbowKitConnector:Ce.isRainbowKitConnector})))))),x&&Ie.createElement(Ie.Fragment,null,Ie.createElement(kn,{background:"generalBorder",height:"1",marginTop:"-1"}),g?Ie.createElement(kn,{paddingX:"24",paddingY:"16",textAlign:"center"},Ie.createElement(g,{Link:Gce,Text:Kce})):Ie.createElement(kn,{alignItems:"center",display:"flex",justifyContent:"space-between",paddingX:"24",paddingY:"16"},Ie.createElement(kn,{paddingY:"4"},Ie.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},y.t("connect.new_to_ethereum.description"))),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",justifyContent:"center"},Ie.createElement(kn,{className:uu({active:"shrink",hover:"grow"}),cursor:"pointer",onClick:()=>re("LEARN_COMPACT"),paddingY:"4",style:{willChange:"transform"},transition:"default"},Ie.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},y.t("connect.new_to_ethereum.learn_more.label"))))))),(x?ie!=="NONE":!0)&&Ie.createElement(Ie.Fragment,null,!x&&Ie.createElement(kn,{background:"generalBorder",minWidth:"1",width:"1"}),Ie.createElement(kn,{display:"flex",flexDirection:"column",margin:"16",style:{flexGrow:1}},Ie.createElement(kn,{alignItems:"center",display:"flex",justifyContent:"space-between",marginBottom:"12"},Ie.createElement(kn,{width:"28"},ne&&Ie.createElement(kn,{as:"button",className:uu({active:"shrinkSm",hover:"growLg"}),color:"accentColor",onClick:()=>{ne&&re(ne,!0),oe==null||oe()},paddingX:"8",paddingY:"4",style:{boxSizing:"content-box",height:17,willChange:"transform"},transition:"default",type:"button"},Ie.createElement(UBe,null))),Ie.createElement(kn,{display:"flex",justifyContent:"center",style:{flexGrow:1}},W&&Ie.createElement(Rs,{color:"modalText",size:"18",textAlign:"center",weight:"heavy"},W)),Ie.createElement(c5,{onClose:t})),Ie.createElement(kn,{display:"flex",flexDirection:"column",style:{minHeight:x?396:432}},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"6",height:"full",justifyContent:"center",marginX:"8"},q)))))}var uBt="_1am14412",dBt="_1am14410",fBt="_1am14413",hBt=({wallet:t})=>Ie.createElement("svg",{className:fBt,viewBox:"0 0 86 86",width:"86",height:"86"},Ie.createElement("title",null,"Loading"),Ie.createElement("rect",{x:"3",y:"3",width:80,height:80,rx:20,ry:20,strokeDasharray:`${160/3} ${2*160/3}`,strokeDashoffset:160,className:uBt,style:{stroke:(t==null?void 0:t.iconAccent)||"#0D3887"}}));function JBe({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=zBe(a),g=h.useRef(!1),{i18n:y}=h.useContext(fc),v=h.useCallback(async()=>{if(o!=="walletConnect"&&(async()=>{const N=await(c==null?void 0:c());if(N)if(N&&ZLt({mobileUri:N,name:l}),N.startsWith("http")){const I=document.createElement("a");I.href=N,I.target="_blank",I.rel="noreferrer noopener",I.click()}else window.location.href=N})(),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]),Ie.createElement(kn,{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"},Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},Ie.createElement(kn,{display:"flex",alignItems:"center",justifyContent:"center",paddingBottom:"8",paddingTop:"10",position:"relative"},n?Ie.createElement(hBt,{wallet:e}):null,Ie.createElement(Lc,{background:s,borderRadius:"13",boxShadow:"walletLogo",height:"60",src:a,width:"60"})),n?null:Ie.createElement(kn,{display:"flex",flexDirection:"column",textAlign:"center"},Ie.createElement(Rs,{as:"h2",color:e.ready?"modalText":"modalTextSecondary",size:"13",weight:"medium"},Ie.createElement(kn,{as:"span",position:"relative"},d??l,!e.ready&&" (unsupported)")),e.recent&&Ie.createElement(Rs,{color:"accentColor",size:"12",weight:"medium"},y.t("connect.recent")))))}function pBt({onClose:t}){var g;const e="rk_connect_title",n=BE().filter(y=>y.isRainbowKitConnector),{disclaimer:r,learnMoreUrl:s}=h.useContext(GT);let a=null,o=null,l=!1,c=null;const[u,d]=h.useState("CONNECT"),{i18n:f}=h.useContext(fc),x=D5();switch(u){case"CONNECT":{a=f.t("connect.title"),l=!0,o=Ie.createElement(kn,null,Ie.createElement(kn,{background:"profileForeground",className:dBt,display:"flex",paddingBottom:"20",paddingTop:"6"},Ie.createElement(kn,{display:"flex",style:{margin:"0 auto"}},n.filter(y=>y.ready).map(y=>Ie.createElement(kn,{key:y.id,paddingX:"20"},Ie.createElement(kn,{width:"60"},Ie.createElement(JBe,{onClose:t,wallet:y})))))),Ie.createElement(kn,{background:"generalBorder",height:"1",marginBottom:"32",marginTop:"-1"}),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"32",paddingX:"32",style:{textAlign:"center"}},Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"8",textAlign:"center"},Ie.createElement(Rs,{color:"modalText",size:"16",weight:"bold"},f.t("intro.title")),Ie.createElement(Rs,{color:"modalTextSecondary",size:"16"},f.t("intro.description")))),Ie.createElement(kn,{paddingTop:"32",paddingX:"20"},Ie.createElement(kn,{display:"flex",gap:"14",justifyContent:"center"},Ie.createElement(wd,{label:f.t("intro.get.label"),onClick:()=>d("GET"),size:"large",type:"secondary"}),Ie.createElement(wd,{href:s,label:f.t("intro.learn_more.label"),size:"large",type:"secondary"}))),r&&Ie.createElement(kn,{marginTop:"28",marginX:"32",textAlign:"center"},Ie.createElement(r,{Link:Gce,Text:Kce})));break}case"GET":{a=f.t("get.title"),c="CONNECT";const y=(g=n==null?void 0:n.filter(v=>{var C,N,I;return((C=v.downloadUrls)==null?void 0:C.ios)||((N=v.downloadUrls)==null?void 0:N.android)||((I=v.downloadUrls)==null?void 0:I.mobile)}))==null?void 0:g.splice(0,3);o=Ie.createElement(kn,null,Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginBottom:"36",marginTop:"5",paddingTop:"12",width:"full"},y.map((v,C)=>{const{downloadUrls:N,iconBackground:I,iconUrl:P,name:M}=v;return!(N!=null&&N.ios)&&!(N!=null&&N.android)&&!(N!=null&&N.mobile)?null:Ie.createElement(kn,{display:"flex",gap:"16",key:v.id,paddingX:"20",width:"full"},Ie.createElement(kn,{style:{minHeight:48,minWidth:48}},Ie.createElement(Lc,{background:I,borderColor:"generalBorder",borderRadius:"10",height:"48",src:P,width:"48"})),Ie.createElement(kn,{display:"flex",flexDirection:"column",width:"full"},Ie.createElement(kn,{alignItems:"center",display:"flex",height:"48"},Ie.createElement(kn,{width:"full"},Ie.createElement(Rs,{color:"modalText",size:"18",weight:"bold"},M)),Ie.createElement(wd,{href:(x?N==null?void 0:N.ios:N==null?void 0:N.android)||(N==null?void 0:N.mobile),label:f.t("get.action.label"),size:"small",type:"secondary"})),C<y.length-1&&Ie.createElement(kn,{background:"generalBorderDim",height:"1",marginY:"10",width:"full"})))})),Ie.createElement(kn,{style:{marginBottom:"42px"}}),Ie.createElement(kn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"36",paddingX:"36",style:{textAlign:"center"}},Ie.createElement(kn,{display:"flex",flexDirection:"column",gap:"12",textAlign:"center"},Ie.createElement(Rs,{color:"modalText",size:"16",weight:"bold"},f.t("get.looking_for.title")),Ie.createElement(Rs,{color:"modalTextSecondary",size:"16"},f.t("get.looking_for.mobile.description")))));break}}return Ie.createElement(kn,{display:"flex",flexDirection:"column",paddingBottom:"36"},Ie.createElement(kn,{background:l?"profileForeground":"modalBackground",display:"flex",flexDirection:"column",paddingBottom:"4",paddingTop:"14"},Ie.createElement(kn,{display:"flex",justifyContent:"center",paddingBottom:"6",paddingX:"20",position:"relative"},c&&Ie.createElement(kn,{display:"flex",position:"absolute",style:{left:0,marginBottom:-20,marginTop:-20}},Ie.createElement(kn,{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"},Ie.createElement(UBe,null))),Ie.createElement(kn,{marginTop:"4",textAlign:"center",width:"full"},Ie.createElement(Rs,{as:"h1",color:"modalText",id:e,size:"20",weight:"bold"},a)),Ie.createElement(kn,{alignItems:"center",display:"flex",height:"32",paddingRight:"14",position:"absolute",right:"0"},Ie.createElement(kn,{style:{marginBottom:-20,marginTop:-20}},Ie.createElement(c5,{onClose:t}))))),Ie.createElement(kn,{display:"flex",flexDirection:"column"},o))}var mBt=({onClose:t})=>{const{connector:e}=h.useContext(KT),{i18n:n}=h.useContext(fc),r=(e==null?void 0:e.name)||"";return Ie.createElement(kn,null,Ie.createElement(kn,{display:"flex",paddingBottom:"32",justifyContent:"center",alignItems:"center",background:"profileForeground",flexDirection:"column"},Ie.createElement(kn,{width:"full",display:"flex",justifyContent:"flex-end",marginTop:"18",marginRight:"24"},Ie.createElement(c5,{onClose:t})),Ie.createElement(kn,{width:"60"},Ie.createElement(JBe,{onClose:t,wallet:e,connecting:!0})),Ie.createElement(kn,{marginTop:"20"},Ie.createElement(Rs,{textAlign:"center",color:"modalText",size:"18",weight:"semibold"},n.t("connect.status.connect_mobile",{wallet:r}))),Ie.createElement(kn,{maxWidth:"full",marginTop:"8"},Ie.createElement(Rs,{textAlign:"center",color:"modalText",size:"16",weight:"medium"},n.t("connect.status.confirm_mobile",{wallet:r})))))};function xBt({onClose:t}){const{connector:e}=h.useContext(KT);return fu()?e?Ie.createElement(mBt,{onClose:t}):Ie.createElement(pBt,{onClose:t}):Ie.createElement(cBt,{onClose:t})}function gBt({onClose:t,open:e}){const n="rk_connect_title",r=dBe(),{disconnect:s}=S$(),{isConnecting:a}=es(),o=Ie.useCallback(()=>{t(),s()},[t,s]),l=Ie.useCallback(()=>{a&&s(),t()},[t,s,a]);return r==="disconnected"?Ie.createElement(OL,{onClose:l,open:e,titleId:n},Ie.createElement(ML,{bottomSheetOnMobile:!0,padding:"0",wide:!0},Ie.createElement(xBt,{onClose:l}))):r==="unauthenticated"?Ie.createElement(OL,{onClose:o,open:e,titleId:n},Ie.createElement(ML,{bottomSheetOnMobile:!0,padding:"0"},Ie.createElement(XLt,{onClose:o,onCloseModal:t}))):null}function vq(){const[t,e]=h.useState(!1);return{closeModal:h.useCallback(()=>e(!1),[]),isModalOpen:t,openModal:h.useCallback(()=>e(!0),[])}}var b8=h.createContext({accountModalOpen:!1,chainModalOpen:!1,connectModalOpen:!1,isWalletConnectModalOpen:!1,setIsWalletConnectModalOpen:()=>{}});function bBt({children:t}){const{closeModal:e,isModalOpen:n,openModal:r}=vq(),{closeModal:s,isModalOpen:a,openModal:o}=vq(),{closeModal:l,isModalOpen:c,openModal:u}=vq(),[d,f]=h.useState(!1),x=dBe(),{chainId:g}=es(),{chains:y}=Il(),v=y.some(I=>I.id===g),C=h.useCallback(({keepConnectModalOpen:I=!1}={})=>{I||e(),s(),l()},[e,s,l]),N=EU()==="unauthenticated";return ZTe({onConnect:()=>C({keepConnectModalOpen:N}),onDisconnect:()=>C()}),h.useEffect(()=>{N&&C()},[N,C]),Ie.createElement(b8.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,Ie.createElement(gBt,{onClose:e,open:n}),Ie.createElement(jDt,{onClose:s,open:a}),Ie.createElement(PDt,{onClose:l,open:c}))}function yBt(){const{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}=h.useContext(b8);return{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}}function vBt(){const{accountModalOpen:t,openAccountModal:e}=h.useContext(b8);return{accountModalOpen:t,openAccountModal:e}}function wBt(){const{chainModalOpen:t,openChainModal:e}=h.useContext(b8);return{chainModalOpen:t,openChainModal:e}}function e$e(){const{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}=h.useContext(b8);return{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}}function B5(){const{connectModalOpen:t,openConnectModal:e}=h.useContext(b8),{isWalletConnectModalOpen:n}=e$e();return{connectModalOpen:t||n,openConnectModal:e}}var wq=()=>{};function CBt({children:t}){const e=nLt(),{address:n}=es(),{chainId:r}=es(),{chains:s}=Il(),a=s.some(K=>K.id===r),o=JRt(),l=EU()??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=Dce(d),g=h.useContext(Uce),y=SBe().some(({status:K})=>K==="pending")&&g,{showBalance:v}=tLt(),N=typeof v=="boolean"?v:v?vRt(v)[fu()?"smallScreen":"largeScreen"]:!0,{balance:I,ensAvatar:P,ensName:M}=yBe({address:n,includeBalance:N}),F=I?`${RBe(Number.parseFloat(I.formatted))} ${I.symbol}`:void 0,{openConnectModal:$}=B5(),{openChainModal:L}=wBt(),{openAccountModal:z}=vBt(),{accountModalOpen:Q,chainModalOpen:se,connectModalOpen:ee}=yBt();return Ie.createElement(Ie.Fragment,null,t({account:n?{address:n,balanceDecimals:I==null?void 0:I.decimals,balanceFormatted:I==null?void 0:I.formatted,balanceSymbol:I==null?void 0:I.symbol,displayBalance:F,displayName:M?DBe(M):LBe(n),ensAvatar:P??void 0,ensName:M??void 0,hasPendingTransactions:y}:void 0,accountModalOpen:Q,authenticationStatus:l,chain:r?{hasIcon:!!d,iconBackground:f,iconUrl:x,id:r,name:u,unsupported:!a}:void 0,chainModalOpen:se,connectModalOpen:ee,mounted:e(),openAccountModal:z??wq,openChainModal:L??wq,openConnectModal:$??wq}))}CBt.displayName="ConnectButton.Custom";var t$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 SBt(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>n!==void 0))}function NBt(t,e){const n=[];for(const r of t)n.some(s=>s[e]===r[e])||n.push(r);return n}var jBt=(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=t$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 N=C({projectId:e,appName:r,appIcon:o,options:{metadata:f,...n},walletConnectParameters:{metadata:f,...n}});if(N!=null&&N.iconAccent&&!zDt(N==null?void 0:N.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${N.name}`);const I={...N,groupIndex:g+1,groupName:y,index:l};typeof N.hidden=="function"?d.push(I):u.push(I)}const x=NBt([...u,...d],"id");for(const{createConnector:g,groupIndex:y,groupName:v,hidden:C,...N}of x){if(typeof C=="function"&&C())continue;const I=F=>({rkDetails:SBt({...N,groupIndex:y,groupName:v,isRainbowKitConnector:!0,...F||{}})});N.id==="walletConnect"&&c.push(g(I({isWalletConnectModalConnector:!0,showQrModal:!0})));const M=g(I());c.push(M)}return c},i2e=new Map,ABt=({projectId:t,walletConnectParameters:e,rkDetailsShowQrModal:n})=>{let r={...e||{},projectId:t,showQrModal:!1};n&&(r={...r,showQrModal:!0});const s=JSON.stringify(r),a=i2e.get(s);if(a)return a;const o=Rce(r);return i2e.set(s,o),o};function _Bt({projectId:t,walletDetails:e,walletConnectParameters:n}){return r=>({...ABt({projectId:t,walletConnectParameters:n,rkDetailsShowQrModal:e.rkDetails.showQrModal})(r),...e})}function Yce({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=>_Bt({projectId:t,walletDetails:r,walletConnectParameters:e})}function n$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 r$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 s$e({flag:t,namespace:e}){return!!(e&&typeof r$e(e)<"u"||t&&typeof n$e(t)<"u")}function EBt({flag:t,namespace:e}){var s;const n=typeof window<"u"?window:void 0;if(typeof n>"u")return;if(e){const a=r$e(e);if(a)return a}const r=(s=n.ethereum)==null?void 0:s.providers;if(t){const a=n$e(t);if(a)return a}return typeof r<"u"&&r.length>0?r[0]:n.ethereum}function kBt(t){return e=>{const n=t?{target:()=>({id:e.rkDetails.id,name:e.rkDetails.name,provider:t})}:{};return r=>({...v$(n)(r),...e})}}function i$e({flag:t,namespace:e,target:n}){const r=n||EBt({flag:t,namespace:e});return kBt(r)}var a$e=({appName:t,appIcon:e})=>{const n=s=>s,r=D5();return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",rdns:"com.coinbase.wallet",iconUrl:async()=>(await os(async()=>{const{default:s}=await import("./coinbaseWallet-WWX6LF36-BMRj6mTC.js");return{default:s}},[])).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:!0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},...r?{}:{qrCode:{getUri:n,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}},createConnector:s=>{const a=_U({appName:t,appLogoUrl:e,preference:a$e.preference});return o=>({...a(o),...s})}}};function TBt(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 IBt=({projectId:t,walletConnectParameters:e})=>{var a,o;const n=s$e({flag:"isMetaMask"}),r=!n,s=l=>Lce()?l:D5()?`metamask://wc?uri=${encodeURIComponent(l)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(l)}`;return{id:"metaMask",name:"MetaMask",rdns:"io.metamask",iconUrl:async()=>(await os(async()=>{const{default:l}=await import("./metaMaskWallet-YFHEHW7V-BggUDXad.js");return{default:l}},[])).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:r?void 0:n,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},mobile:{getUri:r?s:void 0},qrCode:r?{getUri:s,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}},createConnector:r?Yce({projectId:t,walletConnectParameters:e}):i$e({target:typeof window<"u"?((o=(a=window.ethereum)==null?void 0:a.providers)==null?void 0:o.find(TBt))??window.ethereum:void 0})}},PBt=({projectId:t,walletConnectParameters:e})=>{const n=s$e({flag:"isRainbow"}),r=!n,s=a=>Lce()?a:D5()?`rainbow://wc?uri=${encodeURIComponent(a)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(a)}&connector=rainbowkit`;return{id:"rainbow",name:"Rainbow",rdns:"me.rainbow",iconUrl:async()=>(await os(async()=>{const{default:a}=await import("./rainbowWallet-2SR6TVBF-kimcGeuf.js");return{default:a}},[])).default,iconBackground:"#0c2f78",installed:r?void 0:n,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},mobile:{getUri:r?s:void 0},qrCode:r?{getUri:s,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0,createConnector:r?Yce({projectId:t,walletConnectParameters:e}):i$e({flag:"isRainbow"})}},FBt=()=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./safeWallet-VUYZPLY4-CXnodgMs.js");return{default:t}},[])).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:t=>e=>({...Mce()(e),...t})}),OBt=({projectId:t,options:e})=>({id:"walletConnect",name:"WalletConnect",installed:void 0,iconUrl:async()=>(await os(async()=>{const{default:r}=await import("./walletConnectWallet-FNSU4KNU-B0ci71fU.js");return{default:r}},[])).default,iconBackground:"#3b99fc",qrCode:{getUri:r=>r},createConnector:Yce({projectId:t,walletConnectParameters:e})}),MBt=t=>t.reduce((n,r)=>{const s=r.id;return n[s]=H7(),n},{}),RBt=({appName:t,appDescription:e,appUrl:n,appIcon:r,wallets:s,projectId:a,...o})=>{const{transports:l,chains:c,...u}=o,d=t$e({appName:t,appDescription:e,appUrl:n,appIcon:r}),f=jBt(s||[{groupName:"Popular",wallets:[FBt,PBt,a$e,IBt,OBt]}],{projectId:a,appName:t,appDescription:e,appUrl:n,appIcon:r,walletConnectParameters:{metadata:d}});return Zbt({connectors:f,chains:c,transports:l||MBt(c),...u})};function LBt({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 a2e=h.forwardRef(LBt);function DBt({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 ky=h.forwardRef(DBt);function BBt({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 $Bt=h.forwardRef(BBt);function UBt({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 zBt=h.forwardRef(UBt);function HBt({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 VBt=h.forwardRef(HBt),WBt=()=>{const{address:t}=es(),{disconnect:e}=S$(),{subsExpireDay:n}=h.useContext(Yr),[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(P5,{open:r,setOpen:s,handleListRequest:()=>{},handlePageChange:()=>{}}),i.jsxs(LB,{as:"div",className:"relative inline-block text-left font-manrope",children:[i.jsx("div",{children:i.jsxs(MB,{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($Bt,{className:"size-4 fill-white/60"})]})}),i.jsx(RB,{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(XC,{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:j_e,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"})]})})})]})]})},qBt=()=>{const t=Ao(),[e,n]=h.useState(Date.now()),{isConnected:r,address:s,isDisconnected:a}=es(),{walletLogin:o,signIn:l,hyperToken:c,hyperAddress:u,setTelegramChatId:d,setSubscriberRole:f,setSubsExpireDay:x,setIsReferralCode:g,setIsReferralCodeName:y,setMushboomerETH:v,setMushboomerSOL:C,setIsWhitelist:N,setHyperToken:I,setHyperAddress:P,setSignModalOpen:M,signInConnectButtonOpen:F,setSignInConnectButtonOpen:$}=h.useContext(Yr),{openConnectModal:L}=B5(),z=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches;h.useEffect(()=>{!a&&s==null&&!z&&(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),I(""),P(""))},[a]);const Q=()=>{window.localStorage.getItem("hyperToken")&&c?o():l(1)};h.useEffect(()=>{F&&(M(!0),$(!1))},[F]),h.useEffect(()=>{s!=null&&window.localStorage.getItem("hyperAddress")!=null&&window.localStorage.getItem("hyperAddress").toLowerCase()!==s.toLowerCase()&&!z&&(window.localStorage.removeItem("hyperToken"),I(""))},[s,u]);const se=h.useRef(!1);return h.useEffect(()=>{const ee=async()=>{var G,ie;if(se.current)return;se.current=!0;const re=window.localStorage.getItem("hyperToken"),de=window.localStorage.getItem("hyperAddress");if(!re||!de){se.current=!1;return}try{const ae=await vi(de.toLowerCase(),re);ae!=null&&ae.success?(d(ae==null?void 0:ae.telegram_chat_id),f(ae==null?void 0:ae.subscriber_role),x(ae==null?void 0:ae.subs_expire_day),v((G=ae==null?void 0:ae.mushboomer_counts)==null?void 0:G.eth),C((ie=ae==null?void 0:ae.mushboomer_counts)==null?void 0:ie.sol),g(ae==null?void 0:ae.referral_code),y(ae==null?void 0:ae.refcode),N(ae==null?void 0:ae.whitelist),I(re),P(de)):(window.localStorage.removeItem("hyperAddress"),window.localStorage.removeItem("hyperToken"),I(""),P(""))}catch(ae){console.error("Token verification error:",ae),ae.response?console.error("Server Error Response:",ae.response):ae.message?console.error("Network or Other Error:",ae.message):console.error("Unknown Error:",ae)}finally{se.current=!1}},K=()=>{if(document.visibilityState==="visible"){const re=Date.now();re-e>1e3&&ee(),n(re)}};return document.addEventListener("visibilitychange",K),()=>{document.removeEventListener("visibilitychange",K)}},[t,e]),i.jsx(i.Fragment,{children:r?s&&window.localStorage.getItem("hyperAddress")?i.jsxs("div",{className:"sm:block relative font-manrope",children:[i.jsx(WBt,{}),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:Clt,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:Slt,alt:""}),i.jsx("span",{className:"text-[#0A9C55] text-[10px] leading-4 font-medium",children:"Connected"})]})})]}):i.jsx("div",{onClick:ee=>Q(),style:{background:"linear-gradient(98deg, #FFF1FF 0%, #6FDBBF 28.15%, #57DCF5 57.96%, #D834D8 98.77%)"},className:"h-[30.60px] rounded-[256px] justify-center items-center gap-2.5 sm:inline-flex w-[91px] p-[1.4px] cursor-pointer font-manrope",children:i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-none w-full h-full flex items-center justify-center rounded-[256px] bg-[#161616]",children:"Sign In"})}):i.jsx("div",{onClick:()=>{L(),$(!0)},style:{background:"linear-gradient(98deg, #FFF1FF 0%, #6FDBBF 28.15%, #57DCF5 57.96%, #D834D8 98.77%)"},className:"h-[30.60px] rounded-[256px] justify-center items-center gap-2.5 sm:inline-flex w-[91px] p-[1.4px] cursor-pointer",children:i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-none w-full h-full flex items-center justify-center rounded-[256px] bg-[#161616]",children:"Connect"})})})};var gC={},Cq={exports:{}},Sq,o2e;function GBt(){if(o2e)return Sq;o2e=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Sq=t,Sq}var Nq,l2e;function KBt(){if(l2e)return Nq;l2e=1;var t=GBt();function e(){}function n(){}return n.resetWarningCache=e,Nq=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},Nq}var c2e;function TU(){return c2e||(c2e=1,Cq.exports=KBt()()),Cq.exports}var jq,u2e;function o$e(){return u2e||(u2e=1,jq={L:1,M:0,Q:3,H:2}),jq}var Aq,d2e;function l$e(){return d2e||(d2e=1,Aq={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),Aq}var _q,f2e;function YBt(){if(f2e)return _q;f2e=1;var t=l$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)}},_q=e,_q}var Eq,h2e;function XBt(){if(h2e)return Eq;h2e=1;var t=o$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}},Eq=e,Eq}var kq,p2e;function QBt(){if(p2e)return kq;p2e=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++}},kq=t,kq}var Tq,m2e;function c$e(){if(m2e)return Tq;m2e=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 Tq=t,Tq}var Iq,x2e;function u$e(){if(x2e)return Iq;x2e=1;var t=c$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)}},Iq=e,Iq}var Pq,g2e;function ZBt(){if(g2e)return Pq;g2e=1;var t=l$e(),e=u$e(),n=c$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 Pq=s,Pq}var Fq,b2e;function JBt(){if(b2e)return Fq;b2e=1;var t=YBt(),e=XBt(),n=QBt(),r=ZBt(),s=u$e();function a(l,c){this.typeNumber=l,this.errorCorrectLevel=c,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var o=a.prototype;return o.addData=function(l){var c=new t(l);this.dataList.push(c),this.dataCache=null},o.isDark=function(l,c){if(l<0||this.moduleCount<=l||c<0||this.moduleCount<=c)throw new Error(l+","+c);return this.modules[l][c]},o.getModuleCount=function(){return this.moduleCount},o.make=function(){if(this.typeNumber<1){var l=1;for(l=1;l<40;l++){for(var c=e.getRSBlocks(l,this.errorCorrectLevel),u=new n,d=0,f=0;f<c.length;f++)d+=c[f].dataCount;for(var f=0;f<this.dataList.length;f++){var x=this.dataList[f];u.put(x.mode,4),u.put(x.getLength(),r.getLengthInBits(x.mode,l)),x.write(u)}if(u.getLengthInBits()<=d*8)break}this.typeNumber=l}this.makeImpl(!1,this.getBestMaskPattern())},o.makeImpl=function(l,c){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var u=0;u<this.moduleCount;u++){this.modules[u]=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[u][d]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(l,c),this.typeNumber>=7&&this.setupTypeNumber(l),this.dataCache==null&&(this.dataCache=a.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},o.setupPositionProbePattern=function(l,c){for(var u=-1;u<=7;u++)if(!(l+u<=-1||this.moduleCount<=l+u))for(var d=-1;d<=7;d++)c+d<=-1||this.moduleCount<=c+d||(0<=u&&u<=6&&(d==0||d==6)||0<=d&&d<=6&&(u==0||u==6)||2<=u&&u<=4&&2<=d&&d<=4?this.modules[l+u][c+d]=!0:this.modules[l+u][c+d]=!1)},o.getBestMaskPattern=function(){for(var l=0,c=0,u=0;u<8;u++){this.makeImpl(!0,u);var d=r.getLostPoint(this);(u==0||l>d)&&(l=d,c=u)}return c},o.createMovieClip=function(l,c,u){var d=l.createEmptyMovieClip(c,u),f=1;this.make();for(var x=0;x<this.modules.length;x++)for(var g=x*f,y=0;y<this.modules[x].length;y++){var v=y*f,C=this.modules[x][y];C&&(d.beginFill(0,100),d.moveTo(v,g),d.lineTo(v+f,g),d.lineTo(v+f,g+f),d.lineTo(v,g+f),d.endFill())}return d},o.setupTimingPattern=function(){for(var l=8;l<this.moduleCount-8;l++)this.modules[l][6]==null&&(this.modules[l][6]=l%2==0);for(var c=8;c<this.moduleCount-8;c++)this.modules[6][c]==null&&(this.modules[6][c]=c%2==0)},o.setupPositionAdjustPattern=function(){for(var l=r.getPatternPosition(this.typeNumber),c=0;c<l.length;c++)for(var u=0;u<l.length;u++){var d=l[c],f=l[u];if(this.modules[d][f]==null)for(var x=-2;x<=2;x++)for(var g=-2;g<=2;g++)x==-2||x==2||g==-2||g==2||x==0&&g==0?this.modules[d+x][f+g]=!0:this.modules[d+x][f+g]=!1}},o.setupTypeNumber=function(l){for(var c=r.getBCHTypeNumber(this.typeNumber),u=0;u<18;u++){var d=!l&&(c>>u&1)==1;this.modules[Math.floor(u/3)][u%3+this.moduleCount-8-3]=d}for(var u=0;u<18;u++){var d=!l&&(c>>u&1)==1;this.modules[u%3+this.moduleCount-8-3][Math.floor(u/3)]=d}},o.setupTypeInfo=function(l,c){for(var u=this.errorCorrectLevel<<3|c,d=r.getBCHTypeInfo(u),f=0;f<15;f++){var x=!l&&(d>>f&1)==1;f<6?this.modules[f][8]=x:f<8?this.modules[f+1][8]=x:this.modules[this.moduleCount-15+f][8]=x}for(var f=0;f<15;f++){var x=!l&&(d>>f&1)==1;f<8?this.modules[8][this.moduleCount-f-1]=x:f<9?this.modules[8][15-f-1+1]=x:this.modules[8][15-f-1]=x}this.modules[this.moduleCount-8][8]=!l},o.mapData=function(l,c){for(var u=-1,d=this.moduleCount-1,f=7,x=0,g=this.moduleCount-1;g>0;g-=2)for(g==6&&g--;;){for(var y=0;y<2;y++)if(this.modules[d][g-y]==null){var v=!1;x<l.length&&(v=(l[x]>>>f&1)==1);var C=r.getMask(c,d,g-y);C&&(v=!v),this.modules[d][g-y]=v,f--,f==-1&&(x++,f=7)}if(d+=u,d<0||this.moduleCount<=d){d-=u,u=-u;break}}},a.PAD0=236,a.PAD1=17,a.createData=function(l,c,u){for(var d=e.getRSBlocks(l,c),f=new n,x=0;x<u.length;x++){var g=u[x];f.put(g.mode,4),f.put(g.getLength(),r.getLengthInBits(g.mode,l)),g.write(f)}for(var y=0,x=0;x<d.length;x++)y+=d[x].dataCount;if(f.getLengthInBits()>y*8)throw new Error("code length overflow. ("+f.getLengthInBits()+">"+y*8+")");for(f.getLengthInBits()+4<=y*8&&f.put(0,4);f.getLengthInBits()%8!=0;)f.putBit(!1);for(;!(f.getLengthInBits()>=y*8||(f.put(a.PAD0,8),f.getLengthInBits()>=y*8));)f.put(a.PAD1,8);return a.createBytes(f,d)},a.createBytes=function(l,c){for(var u=0,d=0,f=0,x=new Array(c.length),g=new Array(c.length),y=0;y<c.length;y++){var v=c[y].dataCount,C=c[y].totalCount-v;d=Math.max(d,v),f=Math.max(f,C),x[y]=new Array(v);for(var N=0;N<x[y].length;N++)x[y][N]=255&l.buffer[N+u];u+=v;var I=r.getErrorCorrectPolynomial(C),P=new s(x[y],I.getLength()-1),M=P.mod(I);g[y]=new Array(I.getLength()-1);for(var N=0;N<g[y].length;N++){var F=N+M.getLength()-g[y].length;g[y][N]=F>=0?M.get(F):0}}for(var $=0,N=0;N<c.length;N++)$+=c[N].totalCount;for(var L=new Array($),z=0,N=0;N<d;N++)for(var y=0;y<c.length;y++)N<x[y].length&&(L[z++]=x[y][N]);for(var N=0;N<f;N++)for(var y=0;y<c.length;y++)N<g[y].length&&(L[z++]=g[y][N]);return L},Fq=a,Fq}var lF={},y2e;function e$t(){if(y2e)return lF;y2e=1,Object.defineProperty(lF,"__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=TU(),n=a(e),r=xx(),s=a(r);function a(u){return u&&u.__esModule?u:{default:u}}function o(u,d){var f={};for(var x in u)d.indexOf(x)>=0||Object.prototype.hasOwnProperty.call(u,x)&&(f[x]=u[x]);return f}var l={bgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,bgD:n.default.string.isRequired,fgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,fgD:n.default.string.isRequired,size:n.default.number.isRequired,title:n.default.string,viewBoxSize:n.default.number.isRequired,xmlns:n.default.string},c=(0,r.forwardRef)(function(u,d){var f=u.bgColor,x=u.bgD,g=u.fgD,y=u.fgColor,v=u.size,C=u.title,N=u.viewBoxSize,I=u.xmlns,P=I===void 0?"http://www.w3.org/2000/svg":I,M=o(u,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return s.default.createElement("svg",t({},M,{height:v,ref:d,viewBox:"0 0 "+N+" "+N,width:v,xmlns:P}),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,lF.default=c,lF}var v2e;function t$t(){if(v2e)return gC;v2e=1,Object.defineProperty(gC,"__esModule",{value:!0}),gC.QRCode=void 0;var t=Object.assign||function(v){for(var C=1;C<arguments.length;C++){var N=arguments[C];for(var I in N)Object.prototype.hasOwnProperty.call(N,I)&&(v[I]=N[I])}return v},e=TU(),n=f(e),r=o$e(),s=f(r),a=JBt(),o=f(a),l=xx(),c=f(l),u=e$t(),d=f(u);function f(v){return v&&v.__esModule?v:{default:v}}function x(v,C){var N={};for(var I in v)C.indexOf(I)>=0||Object.prototype.hasOwnProperty.call(v,I)&&(N[I]=v[I]);return N}var g={bgColor:n.default.oneOfType([n.default.object,n.default.string]),fgColor:n.default.oneOfType([n.default.object,n.default.string]),level:n.default.string,size:n.default.number,value:n.default.string.isRequired},y=(0,l.forwardRef)(function(v,C){var N=v.bgColor,I=N===void 0?"#FFFFFF":N,P=v.fgColor,M=P===void 0?"#000000":P,F=v.level,$=F===void 0?"L":F,L=v.size,z=L===void 0?256:L,Q=v.value,se=x(v,["bgColor","fgColor","level","size","value"]),ee=new o.default(-1,s.default[$]);ee.addData(Q),ee.make();var K=ee.modules;return c.default.createElement(d.default,t({},se,{bgColor:I,bgD:K.map(function(re,de){return re.map(function(G,ie){return G?"":"M "+ie+" "+de+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:M,fgD:K.map(function(re,de){return re.map(function(G,ie){return G?"M "+ie+" "+de+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:C,size:z,viewBoxSize:K.length}))});return gC.QRCode=y,y.displayName="QRCode",y.propTypes=g,gC.default=y,gC}var n$t=t$t();const r$t=Ti(n$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?_a.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"})]})},i$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 I=null;return n&&(l(15),I=setInterval(()=>{l(P=>P<=1?(clearInterval(I),y(),0):P-1)},1e3)),()=>{I&&clearInterval(I)}},[n]);const g=()=>{r(null),a(0),e(!0)},y=()=>{e(!1),N()},v=()=>{a(0),f.current=Date.now(),d.current=setInterval(()=>{const P=(Date.now()-f.current)/x,M=Math.min(P*100,100);a(M),P>=1&&(clearInterval(d.current),d.current=null,a(100),ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/sign_mobile_start/",{address:u,token:c}).then(F=>{const{temp_mobile_password:$}=F.data;r($)}).catch(F=>{console.error("Axios error:",F)}))},30)},C=()=>{N()},N=()=>{d.current&&(clearInterval(d.current),d.current=null),a(0)};return 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(MSt,{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:Ki,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(r$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:Ki,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"})]})]})})})]})},Os=({className:t})=>i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M13.5525 10.8225L9.00001 15.375L4.44751 10.8225",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9 2.62506V15.2476",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ma=({content:t,positionTop:e,alignRight:n})=>i.jsxs("span",{className:`tooltip ${n?"left-5 top-1/2 -translate-y-1/2 ":e?"-top-6 -translate-x-1/2 left-1/2":"-bottom-6 -translate-x-1/2 left-1/2"} transform bg-[#353535] text-white font-manrope font-semibold text-xs leading-3 py-1 px-1.5 rounded-sm relative whitespace-nowrap`,children:[t,i.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`absolute transform -z-1 ${n?"-rotate-90 left-1 -translate-x-full -translate-y-1/2 top-1/2 ":e?"-bottom-1 rotate-180 -translate-x-1/2 left-1/2":"-top-1 -translate-x-1/2 left-1/2"}`,children:i.jsx("path",{d:"M3.70096 1.25C4.27831 0.25 5.72169 0.25 6.29904 1.25L8.89711 5.75C9.47446 6.75 8.75278 8 7.59808 8H2.40192C1.24722 8 0.525536 6.75 1.10289 5.75L3.70096 1.25Z",fill:"#353535"})})]}),a$t=()=>{const{hyperToken:t,notificationData:e,setNotificationData:n,announcementData:r,setAnnouncementData:s,handleAnnouncement:a}=h.useContext(Yr),{isConnected:o,address:l}=es(),[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,N]=h.useState(v),[I,P]=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 Q=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`,se=ee=>{if(ee.key===Q){const K=JSON.parse(ee.newValue||"[]");n(K)}};return window.addEventListener("storage",se),()=>window.removeEventListener("storage",se)},[t,l]),h.useEffect(()=>{const L=window.localStorage.getItem("hyperToken");if(!I||c!="notification"||!L)return;const Q=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`;if(!e.some(K=>!K.is_read))return;const ee=setTimeout(()=>{const K=e.map(re=>re.is_read?re:{...re,is_read:!0});n(K),localStorage.setItem(Q,JSON.stringify(K))},1e3);return()=>clearTimeout(ee)},[e,I,c]),h.useEffect(()=>{var Q;if(!I||c!=="announcement"||!(r!=null&&r.announcements)||((Q=r==null?void 0:r.announcements)==null?void 0:Q.length)===0)return;const L="readNotSignAnnouncementIds",z=setTimeout(()=>{const se=JSON.parse(localStorage.getItem(L)||"[]"),ee=r==null?void 0:r.announcements.map(K=>K.id).filter(K=>!se.includes(K));if(ee.length>0){const K=[...se,...ee];localStorage.setItem(L,JSON.stringify(K))}},1e3);return()=>clearTimeout(z)},[r,I,c,t]);const M=async()=>{try{const L=window.localStorage.getItem("hyperToken"),z="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/setlastseenannouncement/";if(!o||!L)return;const Q=await fetch(z,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l==null?void 0:l.toLowerCase(),token:L})});if(!Q.ok)throw new Error(`Server responded with status ${Q.status}`);const se=await Q.json();se.success?a():console.log(se.error_message)}catch(L){console.error("Error in handleAnnouncement:",L)}};h.useEffect(()=>{!I||c!=="announcement"||(r==null?void 0:r.new_announcement_count)>0&&t&&o&&M()},[I,c]);const F=e.filter(L=>!L.is_read).length,$=(()=>{var Q,se;const L=l==null?void 0:l.toLowerCase(),z=window.localStorage.getItem("hyperToken");if(!L||!z){const ee="readNotSignAnnouncementIds",K=new Set(JSON.parse(localStorage.getItem(ee)||"[]").map(String)),re=new Date,de=new Date;return de.setDate(re.getDate()-2),(Q=r==null?void 0:r.announcements)==null?void 0:Q.filter(G=>{const ie=new Date(G==null?void 0:G.created_at);return!K.has(String(G==null?void 0:G.id))&&ie>=de}).length}if(L&&z&&(r==null?void 0:r.new_announcement_count)>0){const ee="readNotSignAnnouncementIds",K=new Set(JSON.parse(localStorage.getItem(ee)||"[]").map(String));return((se=r==null?void 0:r.announcements)==null?void 0:se.filter(de=>de.is_new&&!K.has(String(de.id))).length)||0}return(r==null?void 0:r.new_announcement_count)||0})();return i.jsx(LB,{as:"div",className:"relative hidden sm:inline-block text-left",children:({open:L,close:z})=>{var Q,se;return h.useEffect(()=>{P(L)},[L]),i.jsxs(i.Fragment,{children:[i.jsx("div",{children:i.jsxs(MB,{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:Ylt,alt:"",className:`${$>0?"bg-transparent":"bg-[#1a1a1a]"} w-[18px] h-[18px] min-w-[18px] min-h-[18px] relative z-10`})]}),($>0||F>0)&&i.jsx("span",{className:`${$+F>99?"":"w-5 h-5"} absolute -top-1 bg-[#FF373B] text-white rounded-full flex items-center justify-center text-[10px] -right-1 p-0.5 z-20`,children:$+F>99?"99+":$+F})]})}),i.jsx(Q7e,{as: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(RB,{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:j_e})}),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(VBt,{onClick:ee=>{ee.preventDefault();const K=window.localStorage.getItem("hyperToken");if(!l||!K)return;const re=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`;n([]),localStorage.removeItem(re)},className:`${(e==null?void 0:e.length)>0?"text-[#7f7f7f] hover:text-[#c8c6c6]":"text-[#7f7f7f]"} w-4 h-4 cursor-pointer -mt-[2px]`}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Clear All",positionTop:!1,alignRight:!1})})]})})]}),i.jsx("div",{className:"flex flex-col justify-start items-start w-full",children:i.jsxs("div",{className:"flex justify-stretch w-full gap-[15px]",children:[i.jsxs("div",{onClick:()=>{u("notification"),window.localStorage.setItem("selectedNotificationTab","notification")},className:`relative ${c==="notification"?"text-white bg-[#494949] rounded-lg inline-flex justify-center items-center gap-1":"text-[#919191]"} flex h-7 px-1.5 py-1 justify-center items-center gap-2 itext-white text-[13px] font-semibold font-['Manrope'] leading-[18px] cursor-pointer select-none`,children:["Notifications",F>0&&i.jsx("div",{className:"w-[18px] h-[18px] bg-[#ff373b] rounded-[256px] inline-flex justify-center items-center gap-2.5",children:i.jsx("div",{className:"justify-start text-white text-[11px] font-bold font-['Manrope'] leading-[10px]",children:F})})]}),i.jsxs("div",{onClick:()=>{u("announcement"),window.localStorage.setItem("selectedNotificationTab","announcement")},className:`relative ${c==="announcement"?"text-white bg-[#494949] rounded-lg inline-flex justify-center items-center gap-1":"text-[#919191]"} flex h-7 px-1.5 py-1 justify-center items-center gap-2 itext-white text-[13px] font-semibold font-['Manrope'] leading-[18px] cursor-pointer select-none`,children:["Announcements",$>0&&i.jsx("div",{className:"w-[18px] h-[18px] bg-[#ff373b] rounded-[256px] inline-flex justify-center items-center gap-2.5",children:i.jsx("div",{className:"justify-start text-white text-[11px] font-bold font-['Manrope'] leading-[10px]",children:$})})]})]})})]}),i.jsx("div",{className:"px-2 mb-4 overflow-auto text-[13px] leading-4 font-semibold",children:c==="notification"&&(e==null?void 0:e.length)>0?i.jsx("div",{className:"flex flex-col items-start justify-center gap-1 w-full",children:e==null?void 0:e.map((ee,K)=>i.jsx(o$t,{listenUser:ee==null?void 0:ee.listen_user,asset:ee==null?void 0:ee.coin,feeToken:ee==null?void 0:ee.feeToken,dir:ee==null?void 0:ee.dir,leverage:ee==null?void 0:ee.leverage,type:ee==null?void 0:ee.fill_direction_type,time:ee==null?void 0:ee.time,status:ee.message,isDateFormat:x,setIsDateFormat:g,close:z,isError:ee==null?void 0:ee.success,traderPNL:ee==null?void 0:ee.trader_pnl,targetPlatform:ee==null?void 0:ee.target_platform},K))}):c==="announcement"&&((Q=r==null?void 0:r.announcements)==null?void 0:Q.length)>0?i.jsx("div",{className:"flex flex-col items-start justify-center gap-1 w-full",children:(se=r==null?void 0:r.announcements)==null?void 0:se.map((ee,K)=>i.jsx(l$t,{address:ee==null?void 0:ee.address,content:ee==null?void 0:ee.content,createdAt:ee==null?void 0:ee.created_at,typeId:ee==null?void 0:ee.type_id,isDateAnnouncementFormat:C,setIsDateAnnouncementFormat:N},K))}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center gap-2 py-9",children:[i.jsx("span",{children:i.jsx("img",{src:Mlt,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"})]})})]})})]})}})},o$t=({asset:t,type:e,status:n,feeToken:r,dir:s,leverage:a,listenUser:o,time:l,isDateFormat:c,setIsDateFormat:u,close:d,isError:f,traderPNL:x,targetPlatform:g})=>{function y({date:C}){const[N,I]=h.useState(Uo(C));return h.useEffect(()=>{const P=setInterval(()=>{I(Uo(C))},1e3);return()=>clearInterval(P)},[C]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:N.dateTime})}const v={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("span",{onClick:()=>{window.location.pathname+window.location.hash==="/tracker#my-activities"?d():window.open("/tracker","_self")},className:"flex gap-2 items-start justify-start px-3 pt-3 pb-2 bg-[#2b2b2b] rounded-2xl min-w-full hover:bg-[#373737] cursor-pointer min-h-16 relative",children:[i.jsx("div",{className:`${f?"bg-[#67ffbd]":"bg-[#ff787b]"} w-0.5 h-10 min-h-10 absolute left-0 top-[27.5%]`}),i.jsxs("div",{className:"flex flex-col items-center gap-3",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${v[t]||(t==null?void 0:t.split("/")[0])}.svg`||dummyImage,alt:t,className:"rounded-full w-8 h-8 min-w-8 min-h-8 bg-white",loading:"lazy",onError:C=>wm(C)}),g==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("img",{src:P1,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(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-2.5 h-2.5"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):i.jsx(Os,{className:"text-[#FF797C] w-2.5 h-2.5"})})}),i.jsxs("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:[s=="Sell"?"Sell":s=="Buy"?"Buy":s=="Close Short"?"Short":s=="Close Long"?"Long":s=="Open Short"?"Short":s=="Open Long"?"Long":s||"--",a?" - "+a+"X":""]})]}),i.jsxs("div",{onClick:C=>{C.stopPropagation(),window.open(`/wallet-details/${o}`,"_blank")},className:"flex justify-start items-center gap-1 cursor-pointer min-w-max h-[18px] px-1.5 py-[3px] bg-white/20 rounded-md",children:[i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-none ",children:o&&(o==null?void 0:o.slice(0,5))+"..."+(o==null?void 0:o.slice(-4))}),i.jsx("img",{onClick:C=>{C.stopPropagation(),navigator.clipboard.writeText(o),dn.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:_o,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:gae,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?`+$${Er(x)}`:`-$${Er(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)})]})]})]})},l$t=({address:t,content:e,createdAt:n,typeId:r,isDateAnnouncementFormat:s,setIsDateAnnouncementFormat:a})=>{function o({date:u}){const[d,f]=h.useState(Uo(u));return h.useEffect(()=>{const x=setInterval(()=>{f(Uo(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?Klt:r==2?c||Qlt:Xlt,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:gae,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)})})]})]})},c$t=()=>{const{hyperToken:t}=h.useContext(Yr),[e,n]=h.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(SU,{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.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(sOt,{}),i.jsxs("div",{onClick:()=>{window.location.href="/standx-mm"},className:`${location.pathname==="/standx-mm"?"bg-[#1F2A44] shadow-[0_0_6px_rgba(116,192,252,0.35)]":"bg-transparent"} flex font-manrope justify-center items-center gap-2 text-[13px] font-semibold text-white 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`,children:[i.jsx("img",{src:"https://standx.com/logo_white.png",alt:"Standx Logo",className:"w-3 h-3"}),"StandX",i.jsx("span",{className:"-mt-1",children:i.jsx(u3,{label:"BETA",tone:"emerald"})})]})]})}),i.jsxs("div",{className:"ml-auto flex items-center",children:[i.jsx("div",{className:"hidden sm:block w-[140px] mr-[12px]",children:i.jsx(KLe,{})}),t&&i.jsx(i$t,{}),i.jsx(a$t,{}),i.jsx("span",{className:"hidden sm:block ml-2",children:i.jsx(qBt,{})})]})]})})]})},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 As;(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"})(As||(As={}));var w2e=new Map([[As.QR_CODE,"QR_CODE"],[As.AZTEC,"AZTEC"],[As.CODABAR,"CODABAR"],[As.CODE_39,"CODE_39"],[As.CODE_93,"CODE_93"],[As.CODE_128,"CODE_128"],[As.DATA_MATRIX,"DATA_MATRIX"],[As.MAXICODE,"MAXICODE"],[As.ITF,"ITF"],[As.EAN_13,"EAN_13"],[As.EAN_8,"EAN_8"],[As.PDF_417,"PDF_417"],[As.RSS_14,"RSS_14"],[As.RSS_EXPANDED,"RSS_EXPANDED"],[As.UPC_A,"UPC_A"],[As.UPC_E,"UPC_E"],[As.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),C2e;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.URL=1]="URL"})(C2e||(C2e={}));function u$t(t){return Object.values(As).includes(t)}var RL;(function(t){t[t.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",t[t.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(RL||(RL={}));var d$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=[RL.SCAN_TYPE_CAMERA,RL.SCAN_TYPE_FILE],t}(),d$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(!w2e.has(e))throw"".concat(e," not in html5QrcodeSupportedFormatsTextMap");return new t(e,w2e.get(e))},t}(),S2e=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}(),jne;(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"})(jne||(jne={}));var f$t=function(){function t(){}return t.createFrom=function(e){return{errorMessage:e,type:jne.UNKWOWN_ERROR}},t}(),h$t=function(){function t(e){this.verbose=e}return t.prototype.log=function(e){this.verbose&&console.log(e)},t.prototype.warn=function(e){this.verbose&&console.warn(e)},t.prototype.logError=function(e,n){(this.verbose||n===!0)&&console.error(e)},t.prototype.logErrors=function(e){if(e.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},t}();function mg(t){return typeof t>"u"||t===null}var o4=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}(),f$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}(),i9={exports:{}},p$t=i9.exports,N2e;function m$t(){return N2e||(N2e=1,function(t,e){(function(n,r){r(e)})(p$t,function(n){function r(wt){return wt==null}var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(wt,w){wt.__proto__=w}||function(wt,w){for(var E in w)w.hasOwnProperty(E)&&(wt[E]=w[E])};function a(wt,w){s(wt,w);function E(){this.constructor=wt}wt.prototype=w===null?Object.create(w):(E.prototype=w.prototype,new E)}function o(wt,w){var E=Object.setPrototypeOf;E?E(wt,w):wt.__proto__=w}function l(wt,w){w===void 0&&(w=wt.constructor);var E=Error.captureStackTrace;E&&E(wt,w)}var c=function(wt){a(w,wt);function w(E){var O=this.constructor,U=wt.call(this,E)||this;return Object.defineProperty(U,"name",{value:O.name,enumerable:!1}),o(U,O.prototype),l(U),U}return w}(Error);class u extends c{constructor(w=void 0){super(w),this.message=w}getKind(){return this.constructor.kind}}u.kind="Exception";class d extends u{}d.kind="ArgumentException";class f extends u{}f.kind="IllegalArgumentException";class x{constructor(w){if(this.binarizer=w,w===null)throw new f("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(w,E){return this.binarizer.getBlackRow(w,E)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(w,E,O,U){const H=this.binarizer.getLuminanceSource().crop(w,E,O,U);return new x(this.binarizer.createBinarizer(H))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const w=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new x(this.binarizer.createBinarizer(w))}rotateCounterClockwise45(){const w=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new x(this.binarizer.createBinarizer(w))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class g extends u{static getChecksumInstance(){return new g}}g.kind="ChecksumException";class y{constructor(w){this.source=w}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class v{static arraycopy(w,E,O,U,H){for(;H--;)O[U++]=w[E++]}static currentTimeMillis(){return Date.now()}}class C extends u{}C.kind="IndexOutOfBoundsException";class N extends C{constructor(w=void 0,E=void 0){super(E),this.index=w,this.message=E}}N.kind="ArrayIndexOutOfBoundsException";class I{static fill(w,E){for(let O=0,U=w.length;O<U;O++)w[O]=E}static fillWithin(w,E,O,U){I.rangeCheck(w.length,E,O);for(let H=E;H<O;H++)w[H]=U}static rangeCheck(w,E,O){if(E>O)throw new f("fromIndex("+E+") > toIndex("+O+")");if(E<0)throw new N(E);if(O>w)throw new N(O)}static asList(...w){return w}static create(w,E,O){return Array.from({length:w}).map(H=>Array.from({length:E}).fill(O))}static createInt32Array(w,E,O){return Array.from({length:w}).map(H=>Int32Array.from({length:E}).fill(O))}static equals(w,E){if(!w||!E||!w.length||!E.length||w.length!==E.length)return!1;for(let O=0,U=w.length;O<U;O++)if(w[O]!==E[O])return!1;return!0}static hashCode(w){if(w===null)return 0;let E=1;for(const O of w)E=31*E+O;return E}static fillUint8Array(w,E){for(let O=0;O!==w.length;O++)w[O]=E}static copyOf(w,E){return w.slice(0,E)}static copyOfUint8Array(w,E){if(w.length<=E){const O=new Uint8Array(E);return O.set(w),O}return w.slice(0,E)}static copyOfRange(w,E,O){const U=O-E,H=new Int32Array(U);return v.arraycopy(w,E,H,0,U),H}static binarySearch(w,E,O){O===void 0&&(O=I.numberComparator);let U=0,H=w.length-1;for(;U<=H;){const Z=H+U>>1,ue=O(E,w[Z]);if(ue>0)U=Z+1;else if(ue<0)H=Z-1;else return Z}return-U-1}static numberComparator(w,E){return w-E}}class P{static numberOfTrailingZeros(w){let E;if(w===0)return 32;let O=31;return E=w<<16,E!==0&&(O-=16,w=E),E=w<<8,E!==0&&(O-=8,w=E),E=w<<4,E!==0&&(O-=4,w=E),E=w<<2,E!==0&&(O-=2,w=E),O-(w<<1>>>31)}static numberOfLeadingZeros(w){if(w===0)return 32;let E=1;return w>>>16||(E+=16,w<<=16),w>>>24||(E+=8,w<<=8),w>>>28||(E+=4,w<<=4),w>>>30||(E+=2,w<<=2),E-=w>>>31,E}static toHexString(w){return w.toString(16)}static toBinaryString(w){return String(parseInt(String(w),2))}static bitCount(w){return w=w-(w>>>1&1431655765),w=(w&858993459)+(w>>>2&858993459),w=w+(w>>>4)&252645135,w=w+(w>>>8),w=w+(w>>>16),w&63}static truncDivision(w,E){return Math.trunc(w/E)}static parseInt(w,E=void 0){return parseInt(w,E)}}P.MIN_VALUE_32_BITS=-2147483648,P.MAX_VALUE=Number.MAX_SAFE_INTEGER;class M{constructor(w,E){w===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=w,E==null?this.bits=M.makeArray(w):this.bits=E)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(w){if(w>this.bits.length*32){const E=M.makeArray(w);v.arraycopy(this.bits,0,E,0,this.bits.length),this.bits=E}}get(w){return(this.bits[Math.floor(w/32)]&1<<(w&31))!==0}set(w){this.bits[Math.floor(w/32)]|=1<<(w&31)}flip(w){this.bits[Math.floor(w/32)]^=1<<(w&31)}getNextSet(w){const E=this.size;if(w>=E)return E;const O=this.bits;let U=Math.floor(w/32),H=O[U];H&=~((1<<(w&31))-1);const Z=O.length;for(;H===0;){if(++U===Z)return E;H=O[U]}const ue=U*32+P.numberOfTrailingZeros(H);return ue>E?E:ue}getNextUnset(w){const E=this.size;if(w>=E)return E;const O=this.bits;let U=Math.floor(w/32),H=~O[U];H&=~((1<<(w&31))-1);const Z=O.length;for(;H===0;){if(++U===Z)return E;H=~O[U]}const ue=U*32+P.numberOfTrailingZeros(H);return ue>E?E:ue}setBulk(w,E){this.bits[Math.floor(w/32)]=E}setRange(w,E){if(E<w||w<0||E>this.size)throw new f;if(E===w)return;E--;const O=Math.floor(w/32),U=Math.floor(E/32),H=this.bits;for(let Z=O;Z<=U;Z++){const ue=Z>O?0:w&31,Re=(2<<(Z<U?31:E&31))-(1<<ue);H[Z]|=Re}}clear(){const w=this.bits.length,E=this.bits;for(let O=0;O<w;O++)E[O]=0}isRange(w,E,O){if(E<w||w<0||E>this.size)throw new f;if(E===w)return!0;E--;const U=Math.floor(w/32),H=Math.floor(E/32),Z=this.bits;for(let ue=U;ue<=H;ue++){const Ee=ue>U?0:w&31,ot=(2<<(ue<H?31:E&31))-(1<<Ee)&4294967295;if((Z[ue]&ot)!==(O?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 O=E;O>0;O--)this.appendBit((w>>O-1&1)===1)}appendBitArray(w){const E=w.size;this.ensureCapacity(this.size+E);for(let O=0;O<E;O++)this.appendBit(w.get(O))}xor(w){if(this.size!==w.size)throw new f("Sizes don't match");const E=this.bits;for(let O=0,U=E.length;O<U;O++)E[O]^=w.bits[O]}toBytes(w,E,O,U){for(let H=0;H<U;H++){let Z=0;for(let ue=0;ue<8;ue++)this.get(w)&&(Z|=1<<7-ue),w++;E[O+H]=Z}}getBitArray(){return this.bits}reverse(){const w=new Int32Array(this.bits.length),E=Math.floor((this.size-1)/32),O=E+1,U=this.bits;for(let H=0;H<O;H++){let Z=U[H];Z=Z>>1&1431655765|(Z&1431655765)<<1,Z=Z>>2&858993459|(Z&858993459)<<2,Z=Z>>4&252645135|(Z&252645135)<<4,Z=Z>>8&16711935|(Z&16711935)<<8,Z=Z>>16&65535|(Z&65535)<<16,w[E-H]=Z}if(this.size!==O*32){const H=O*32-this.size;let Z=w[0]>>>H;for(let ue=1;ue<O;ue++){const Ee=w[ue];Z|=Ee<<32-H,w[ue-1]=Z,Z=Ee>>>H}w[O-1]=Z}this.bits=w}static makeArray(w){return new Int32Array(Math.floor((w+31)/32))}equals(w){if(!(w instanceof M))return!1;const E=w;return this.size===E.size&&I.equals(this.bits,E.bits)}hashCode(){return 31*this.size+I.hashCode(this.bits)}toString(){let w="";for(let E=0,O=this.size;E<O;E++)E&7||(w+=" "),w+=this.get(E)?"X":".";return w}clone(){return new M(this.size,this.bits.slice())}}var F;(function(wt){wt[wt.OTHER=0]="OTHER",wt[wt.PURE_BARCODE=1]="PURE_BARCODE",wt[wt.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",wt[wt.TRY_HARDER=3]="TRY_HARDER",wt[wt.CHARACTER_SET=4]="CHARACTER_SET",wt[wt.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",wt[wt.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",wt[wt.ASSUME_GS1=7]="ASSUME_GS1",wt[wt.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",wt[wt.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",wt[wt.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(F||(F={}));var $=F;class L extends u{static getFormatInstance(){return new L}}L.kind="FormatException";var z;(function(wt){wt[wt.Cp437=0]="Cp437",wt[wt.ISO8859_1=1]="ISO8859_1",wt[wt.ISO8859_2=2]="ISO8859_2",wt[wt.ISO8859_3=3]="ISO8859_3",wt[wt.ISO8859_4=4]="ISO8859_4",wt[wt.ISO8859_5=5]="ISO8859_5",wt[wt.ISO8859_6=6]="ISO8859_6",wt[wt.ISO8859_7=7]="ISO8859_7",wt[wt.ISO8859_8=8]="ISO8859_8",wt[wt.ISO8859_9=9]="ISO8859_9",wt[wt.ISO8859_10=10]="ISO8859_10",wt[wt.ISO8859_11=11]="ISO8859_11",wt[wt.ISO8859_13=12]="ISO8859_13",wt[wt.ISO8859_14=13]="ISO8859_14",wt[wt.ISO8859_15=14]="ISO8859_15",wt[wt.ISO8859_16=15]="ISO8859_16",wt[wt.SJIS=16]="SJIS",wt[wt.Cp1250=17]="Cp1250",wt[wt.Cp1251=18]="Cp1251",wt[wt.Cp1252=19]="Cp1252",wt[wt.Cp1256=20]="Cp1256",wt[wt.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",wt[wt.UTF8=22]="UTF8",wt[wt.ASCII=23]="ASCII",wt[wt.Big5=24]="Big5",wt[wt.GB18030=25]="GB18030",wt[wt.EUC_KR=26]="EUC_KR"})(z||(z={}));class Q{constructor(w,E,O,...U){this.valueIdentifier=w,this.name=O,typeof E=="number"?this.values=Int32Array.from([E]):this.values=E,this.otherEncodingNames=U,Q.VALUE_IDENTIFIER_TO_ECI.set(w,this),Q.NAME_TO_ECI.set(O,this);const H=this.values;for(let Z=0,ue=H.length;Z!==ue;Z++){const Ee=H[Z];Q.VALUES_TO_ECI.set(Ee,this)}for(const Z of U)Q.NAME_TO_ECI.set(Z,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(w){if(w<0||w>=900)throw new L("incorect value");const E=Q.VALUES_TO_ECI.get(w);if(E===void 0)throw new L("incorect value");return E}static getCharacterSetECIByName(w){const E=Q.NAME_TO_ECI.get(w);if(E===void 0)throw new L("incorect value");return E}equals(w){if(!(w instanceof Q))return!1;const E=w;return this.getName()===E.getName()}}Q.VALUE_IDENTIFIER_TO_ECI=new Map,Q.VALUES_TO_ECI=new Map,Q.NAME_TO_ECI=new Map,Q.Cp437=new Q(z.Cp437,Int32Array.from([0,2]),"Cp437"),Q.ISO8859_1=new Q(z.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),Q.ISO8859_2=new Q(z.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),Q.ISO8859_3=new Q(z.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),Q.ISO8859_4=new Q(z.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),Q.ISO8859_5=new Q(z.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),Q.ISO8859_6=new Q(z.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),Q.ISO8859_7=new Q(z.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),Q.ISO8859_8=new Q(z.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),Q.ISO8859_9=new Q(z.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),Q.ISO8859_10=new Q(z.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),Q.ISO8859_11=new Q(z.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),Q.ISO8859_13=new Q(z.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),Q.ISO8859_14=new Q(z.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),Q.ISO8859_15=new Q(z.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),Q.ISO8859_16=new Q(z.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),Q.SJIS=new Q(z.SJIS,20,"SJIS","Shift_JIS"),Q.Cp1250=new Q(z.Cp1250,21,"Cp1250","windows-1250"),Q.Cp1251=new Q(z.Cp1251,22,"Cp1251","windows-1251"),Q.Cp1252=new Q(z.Cp1252,23,"Cp1252","windows-1252"),Q.Cp1256=new Q(z.Cp1256,24,"Cp1256","windows-1256"),Q.UnicodeBigUnmarked=new Q(z.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),Q.UTF8=new Q(z.UTF8,26,"UTF8","UTF-8"),Q.ASCII=new Q(z.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),Q.Big5=new Q(z.Big5,28,"Big5"),Q.GB18030=new Q(z.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),Q.EUC_KR=new Q(z.EUC_KR,30,"EUC_KR","EUC-KR");class se extends u{}se.kind="UnsupportedOperationException";class ee{static decode(w,E){const O=this.encodingName(E);return this.customDecoder?this.customDecoder(w,O):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(O)?this.decodeFallback(w,O):new TextDecoder(O).decode(w)}static shouldDecodeOnFallback(w){return!ee.isBrowser()&&w==="ISO-8859-1"}static encode(w,E){const O=this.encodingName(E);return this.customEncoder?this.customEncoder(w,O):typeof TextEncoder>"u"?this.encodeFallback(w):new TextEncoder().encode(w)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(w){return typeof w=="string"?w:w.getName()}static encodingCharacterSet(w){return w instanceof Q?w:Q.getCharacterSetECIByName(w)}static decodeFallback(w,E){const O=this.encodingCharacterSet(E);if(ee.isDecodeFallbackSupported(O)){let U="";for(let H=0,Z=w.length;H<Z;H++){let ue=w[H].toString(16);ue.length<2&&(ue="0"+ue),U+="%"+ue}return decodeURIComponent(U)}if(O.equals(Q.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(w.buffer));throw new se(`Encoding ${this.encodingName(E)} not supported by fallback.`)}static isDecodeFallbackSupported(w){return w.equals(Q.UTF8)||w.equals(Q.ISO8859_1)||w.equals(Q.ASCII)}static encodeFallback(w){const O=btoa(unescape(encodeURIComponent(w))).split(""),U=[];for(let H=0;H<O.length;H++)U.push(O[H].charCodeAt(0));return new Uint8Array(U)}}class K{static castAsNonUtf8Char(w,E=null){const O=E?E.getName():this.ISO88591;return ee.decode(new Uint8Array([w]),O)}static guessEncoding(w,E){if(E!=null&&E.get($.CHARACTER_SET)!==void 0)return E.get($.CHARACTER_SET).toString();const O=w.length;let U=!0,H=!0,Z=!0,ue=0,Ee=0,Re=0,ot=0,Ct=0,Dt=0,sn=0,Et=0,Yt=0,Jt=0,Pn=0;const xr=w.length>3&&w[0]===239&&w[1]===187&&w[2]===191;for(let Nr=0;Nr<O&&(U||H||Z);Nr++){const Ar=w[Nr]&255;Z&&(ue>0?Ar&128?ue--:Z=!1:Ar&128&&(Ar&64?(ue++,Ar&32?(ue++,Ar&16?(ue++,Ar&8?Z=!1:ot++):Re++):Ee++):Z=!1)),U&&(Ar>127&&Ar<160?U=!1:Ar>159&&(Ar<192||Ar===215||Ar===247)&&Pn++),H&&(Ct>0?Ar<64||Ar===127||Ar>252?H=!1:Ct--:Ar===128||Ar===160||Ar>239?H=!1:Ar>160&&Ar<224?(Dt++,Et=0,sn++,sn>Yt&&(Yt=sn)):Ar>127?(Ct++,sn=0,Et++,Et>Jt&&(Jt=Et)):(sn=0,Et=0))}return Z&&ue>0&&(Z=!1),H&&Ct>0&&(H=!1),Z&&(xr||Ee+Re+ot>0)?K.UTF8:H&&(K.ASSUME_SHIFT_JIS||Yt>=3||Jt>=3)?K.SHIFT_JIS:U&&H?Yt===2&&Dt===2||Pn*10>=O?K.SHIFT_JIS:K.ISO88591:U?K.ISO88591:H?K.SHIFT_JIS:Z?K.UTF8:K.PLATFORM_DEFAULT_ENCODING}static format(w,...E){let O=-1;function U(Z,ue,Ee,Re,ot,Ct){if(Z==="%%")return"%";if(E[++O]===void 0)return;Z=Re?parseInt(Re.substr(1)):void 0;let Dt=ot?parseInt(ot.substr(1)):void 0,sn;switch(Ct){case"s":sn=E[O];break;case"c":sn=E[O][0];break;case"f":sn=parseFloat(E[O]).toFixed(Z);break;case"p":sn=parseFloat(E[O]).toPrecision(Z);break;case"e":sn=parseFloat(E[O]).toExponential(Z);break;case"x":sn=parseInt(E[O]).toString(Dt||16);break;case"d":sn=parseFloat(parseInt(E[O],Dt||10).toPrecision(Z)).toFixed(0);break}sn=typeof sn=="object"?JSON.stringify(sn):(+sn).toString(Dt);let Et=parseInt(Ee),Yt=Ee&&Ee[0]+""=="0"?"0":" ";for(;sn.length<Et;)sn=ue!==void 0?sn+Yt:Yt+sn;return sn}let H=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(H,U)}static getBytes(w,E){return ee.encode(w,E)}static getCharCode(w,E=0){return w.charCodeAt(E)}static getCharAt(w){return String.fromCharCode(w)}}K.SHIFT_JIS=Q.SJIS.getName(),K.GB2312="GB2312",K.ISO88591=Q.ISO8859_1.getName(),K.EUC_JP="EUC_JP",K.UTF8=Q.UTF8.getName(),K.PLATFORM_DEFAULT_ENCODING=K.UTF8,K.ASSUME_SHIFT_JIS=!1;class re{constructor(w=""){this.value=w}enableDecoding(w){return this.encoding=w,this}append(w){return typeof w=="string"?this.value+=w.toString():this.encoding?this.value+=K.castAsNonUtf8Char(w,this.encoding):this.value+=String.fromCharCode(w),this}appendChars(w,E,O){for(let U=E;E<E+O;U++)this.append(w[U]);return this}length(){return this.value.length}charAt(w){return this.value.charAt(w)}deleteCharAt(w){this.value=this.value.substr(0,w)+this.value.substring(w+1)}setCharAt(w,E){this.value=this.value.substr(0,w)+E+this.value.substr(w+1)}substring(w,E){return this.value.substring(w,E)}setLengthToZero(){this.value=""}toString(){return this.value}insert(w,E){this.value=this.value.substr(0,w)+E+this.value.substr(w+E.length)}}class de{constructor(w,E,O,U){if(this.width=w,this.height=E,this.rowSize=O,this.bits=U,E==null&&(E=w),this.height=E,w<1||E<1)throw new f("Both dimensions must be greater than 0");O==null&&(O=Math.floor((w+31)/32)),this.rowSize=O,U==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(w){const E=w.length,O=w[0].length,U=new de(O,E);for(let H=0;H<E;H++){const Z=w[H];for(let ue=0;ue<O;ue++)Z[ue]&&U.set(ue,H)}return U}static parseFromString(w,E,O){if(w===null)throw new f("stringRepresentation cannot be null");const U=new Array(w.length);let H=0,Z=0,ue=-1,Ee=0,Re=0;for(;Re<w.length;)if(w.charAt(Re)===`
`||w.charAt(Re)==="\r"){if(H>Z){if(ue===-1)ue=H-Z;else if(H-Z!==ue)throw new f("row lengths do not match");Z=H,Ee++}Re++}else if(w.substring(Re,Re+E.length)===E)Re+=E.length,U[H]=!0,H++;else if(w.substring(Re,Re+O.length)===O)Re+=O.length,U[H]=!1,H++;else throw new f("illegal character encountered: "+w.substring(Re));if(H>Z){if(ue===-1)ue=H-Z;else if(H-Z!==ue)throw new f("row lengths do not match");Ee++}const ot=new de(ue,Ee);for(let Ct=0;Ct<H;Ct++)U[Ct]&&ot.set(Math.floor(Ct%ue),Math.floor(Ct/ue));return ot}get(w,E){const O=E*this.rowSize+Math.floor(w/32);return(this.bits[O]>>>(w&31)&1)!==0}set(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]|=1<<(w&31)&4294967295}unset(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]&=~(1<<(w&31)&4294967295)}flip(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]^=1<<(w&31)&4294967295}xor(w){if(this.width!==w.getWidth()||this.height!==w.getHeight()||this.rowSize!==w.getRowSize())throw new f("input matrix dimensions do not match");const E=new M(Math.floor(this.width/32)+1),O=this.rowSize,U=this.bits;for(let H=0,Z=this.height;H<Z;H++){const ue=H*O,Ee=w.getRow(H,E).getBitArray();for(let Re=0;Re<O;Re++)U[ue+Re]^=Ee[Re]}}clear(){const w=this.bits,E=w.length;for(let O=0;O<E;O++)w[O]=0}setRegion(w,E,O,U){if(E<0||w<0)throw new f("Left and top must be nonnegative");if(U<1||O<1)throw new f("Height and width must be at least 1");const H=w+O,Z=E+U;if(Z>this.height||H>this.width)throw new f("The region must fit inside the matrix");const ue=this.rowSize,Ee=this.bits;for(let Re=E;Re<Z;Re++){const ot=Re*ue;for(let Ct=w;Ct<H;Ct++)Ee[ot+Math.floor(Ct/32)]|=1<<(Ct&31)&4294967295}}getRow(w,E){E==null||E.getSize()<this.width?E=new M(this.width):E.clear();const O=this.rowSize,U=this.bits,H=w*O;for(let Z=0;Z<O;Z++)E.setBulk(Z*32,U[H+Z]);return E}setRow(w,E){v.arraycopy(E.getBitArray(),0,this.bits,w*this.rowSize,this.rowSize)}rotate180(){const w=this.getWidth(),E=this.getHeight();let O=new M(w),U=new M(w);for(let H=0,Z=Math.floor((E+1)/2);H<Z;H++)O=this.getRow(H,O),U=this.getRow(E-1-H,U),O.reverse(),U.reverse(),this.setRow(H,U),this.setRow(E-1-H,O)}getEnclosingRectangle(){const w=this.width,E=this.height,O=this.rowSize,U=this.bits;let H=w,Z=E,ue=-1,Ee=-1;for(let Re=0;Re<E;Re++)for(let ot=0;ot<O;ot++){const Ct=U[Re*O+ot];if(Ct!==0){if(Re<Z&&(Z=Re),Re>Ee&&(Ee=Re),ot*32<H){let Dt=0;for(;!(Ct<<31-Dt&4294967295);)Dt++;ot*32+Dt<H&&(H=ot*32+Dt)}if(ot*32+31>ue){let Dt=31;for(;!(Ct>>>Dt);)Dt--;ot*32+Dt>ue&&(ue=ot*32+Dt)}}}return ue<H||Ee<Z?null:Int32Array.from([H,Z,ue-H+1,Ee-Z+1])}getTopLeftOnBit(){const w=this.rowSize,E=this.bits;let O=0;for(;O<E.length&&E[O]===0;)O++;if(O===E.length)return null;const U=O/w;let H=O%w*32;const Z=E[O];let ue=0;for(;!(Z<<31-ue&4294967295);)ue++;return H+=ue,Int32Array.from([H,U])}getBottomRightOnBit(){const w=this.rowSize,E=this.bits;let O=E.length-1;for(;O>=0&&E[O]===0;)O--;if(O<0)return null;const U=Math.floor(O/w);let H=Math.floor(O%w)*32;const Z=E[O];let ue=31;for(;!(Z>>>ue);)ue--;return H+=ue,Int32Array.from([H,U])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(w){if(!(w instanceof de))return!1;const E=w;return this.width===E.width&&this.height===E.height&&this.rowSize===E.rowSize&&I.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+I.hashCode(this.bits),w}toString(w="X ",E=" ",O=`
`){return this.buildToString(w,E,O)}buildToString(w,E,O){let U=new re;for(let H=0,Z=this.height;H<Z;H++){for(let ue=0,Ee=this.width;ue<Ee;ue++)U.append(this.get(ue,H)?w:E);U.append(O)}return U.toString()}clone(){return new de(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 O=this.getLuminanceSource(),U=O.getWidth();E==null||E.getSize()<U?E=new M(U):E.clear(),this.initArrays(U);const H=O.getRow(w,this.luminances),Z=this.buckets;for(let Ee=0;Ee<U;Ee++)Z[(H[Ee]&255)>>ie.LUMINANCE_SHIFT]++;const ue=ie.estimateBlackPoint(Z);if(U<3)for(let Ee=0;Ee<U;Ee++)(H[Ee]&255)<ue&&E.set(Ee);else{let Ee=H[0]&255,Re=H[1]&255;for(let ot=1;ot<U-1;ot++){const Ct=H[ot+1]&255;(Re*4-Ee-Ct)/2<ue&&E.set(ot),Ee=Re,Re=Ct}}return E}getBlackMatrix(){const w=this.getLuminanceSource(),E=w.getWidth(),O=w.getHeight(),U=new de(E,O);this.initArrays(E);const H=this.buckets;for(let Ee=1;Ee<5;Ee++){const Re=Math.floor(O*Ee/5),ot=w.getRow(Re,this.luminances),Ct=Math.floor(E*4/5);for(let Dt=Math.floor(E/5);Dt<Ct;Dt++){const sn=ot[Dt]&255;H[sn>>ie.LUMINANCE_SHIFT]++}}const Z=ie.estimateBlackPoint(H),ue=w.getMatrix();for(let Ee=0;Ee<O;Ee++){const Re=Ee*E;for(let ot=0;ot<E;ot++)(ue[Re+ot]&255)<Z&&U.set(ot,Ee)}return U}createBinarizer(w){return new ie(w)}initArrays(w){this.luminances.length<w&&(this.luminances=new Uint8ClampedArray(w));const E=this.buckets;for(let O=0;O<ie.LUMINANCE_BUCKETS;O++)E[O]=0}static estimateBlackPoint(w){const E=w.length;let O=0,U=0,H=0;for(let ot=0;ot<E;ot++)w[ot]>H&&(U=ot,H=w[ot]),w[ot]>O&&(O=w[ot]);let Z=0,ue=0;for(let ot=0;ot<E;ot++){const Ct=ot-U,Dt=w[ot]*Ct*Ct;Dt>ue&&(Z=ot,ue=Dt)}if(U>Z){const ot=U;U=Z,Z=ot}if(Z-U<=E/16)throw new G;let Ee=Z-1,Re=-1;for(let ot=Z-1;ot>U;ot--){const Ct=ot-U,Dt=Ct*Ct*(Z-ot)*(O-w[ot]);Dt>Re&&(Ee=ot,Re=Dt)}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 ae extends ie{constructor(w){super(w),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const w=this.getLuminanceSource(),E=w.getWidth(),O=w.getHeight();if(E>=ae.MINIMUM_DIMENSION&&O>=ae.MINIMUM_DIMENSION){const U=w.getMatrix();let H=E>>ae.BLOCK_SIZE_POWER;E&ae.BLOCK_SIZE_MASK&&H++;let Z=O>>ae.BLOCK_SIZE_POWER;O&ae.BLOCK_SIZE_MASK&&Z++;const ue=ae.calculateBlackPoints(U,H,Z,E,O),Ee=new de(E,O);ae.calculateThresholdForBlock(U,H,Z,E,O,ue,Ee),this.matrix=Ee}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(w){return new ae(w)}static calculateThresholdForBlock(w,E,O,U,H,Z,ue){const Ee=H-ae.BLOCK_SIZE,Re=U-ae.BLOCK_SIZE;for(let ot=0;ot<O;ot++){let Ct=ot<<ae.BLOCK_SIZE_POWER;Ct>Ee&&(Ct=Ee);const Dt=ae.cap(ot,2,O-3);for(let sn=0;sn<E;sn++){let Et=sn<<ae.BLOCK_SIZE_POWER;Et>Re&&(Et=Re);const Yt=ae.cap(sn,2,E-3);let Jt=0;for(let xr=-2;xr<=2;xr++){const Nr=Z[Dt+xr];Jt+=Nr[Yt-2]+Nr[Yt-1]+Nr[Yt]+Nr[Yt+1]+Nr[Yt+2]}const Pn=Jt/25;ae.thresholdBlock(w,Et,Ct,Pn,U,ue)}}}static cap(w,E,O){return w<E?E:w>O?O:w}static thresholdBlock(w,E,O,U,H,Z){for(let ue=0,Ee=O*H+E;ue<ae.BLOCK_SIZE;ue++,Ee+=H)for(let Re=0;Re<ae.BLOCK_SIZE;Re++)(w[Ee+Re]&255)<=U&&Z.set(E+Re,O+ue)}static calculateBlackPoints(w,E,O,U,H){const Z=H-ae.BLOCK_SIZE,ue=U-ae.BLOCK_SIZE,Ee=new Array(O);for(let Re=0;Re<O;Re++){Ee[Re]=new Int32Array(E);let ot=Re<<ae.BLOCK_SIZE_POWER;ot>Z&&(ot=Z);for(let Ct=0;Ct<E;Ct++){let Dt=Ct<<ae.BLOCK_SIZE_POWER;Dt>ue&&(Dt=ue);let sn=0,Et=255,Yt=0;for(let Pn=0,xr=ot*U+Dt;Pn<ae.BLOCK_SIZE;Pn++,xr+=U){for(let Nr=0;Nr<ae.BLOCK_SIZE;Nr++){const Ar=w[xr+Nr]&255;sn+=Ar,Ar<Et&&(Et=Ar),Ar>Yt&&(Yt=Ar)}if(Yt-Et>ae.MIN_DYNAMIC_RANGE)for(Pn++,xr+=U;Pn<ae.BLOCK_SIZE;Pn++,xr+=U)for(let Nr=0;Nr<ae.BLOCK_SIZE;Nr++)sn+=w[xr+Nr]&255}let Jt=sn>>ae.BLOCK_SIZE_POWER*2;if(Yt-Et<=ae.MIN_DYNAMIC_RANGE&&(Jt=Et/2,Re>0&&Ct>0)){const Pn=(Ee[Re-1][Ct]+2*Ee[Re][Ct-1]+Ee[Re-1][Ct-1])/4;Et<Pn&&(Jt=Pn)}Ee[Re][Ct]=Jt}}return Ee}}ae.BLOCK_SIZE_POWER=3,ae.BLOCK_SIZE=1<<ae.BLOCK_SIZE_POWER,ae.BLOCK_SIZE_MASK=ae.BLOCK_SIZE-1,ae.MINIMUM_DIMENSION=ae.BLOCK_SIZE*5,ae.MIN_DYNAMIC_RANGE=24;class q{constructor(w,E){this.width=w,this.height=E}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(w,E,O,U){throw new se("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new se("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new se("This luminance source does not support rotation by 45 degrees.")}toString(){const w=new Uint8ClampedArray(this.width);let E=new re;for(let O=0;O<this.height;O++){const U=this.getRow(O,w);for(let H=0;H<this.width;H++){const Z=U[H]&255;let ue;Z<64?ue="#":Z<128?ue="+":Z<192?ue=".":ue=" ",E.append(ue)}E.append(`
`)}return E.toString()}}class W extends q{constructor(w){super(w.getWidth(),w.getHeight()),this.delegate=w}getRow(w,E){const O=this.delegate.getRow(w,E),U=this.getWidth();for(let H=0;H<U;H++)O[H]=255-(O[H]&255);return O}getMatrix(){const w=this.delegate.getMatrix(),E=this.getWidth()*this.getHeight(),O=new Uint8ClampedArray(E);for(let U=0;U<E;U++)O[U]=255-(w[U]&255);return O}isCropSupported(){return this.delegate.isCropSupported()}crop(w,E,O,U){return new W(this.delegate.crop(w,E,O,U))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new W(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new W(this.delegate.rotateCounterClockwise45())}}class ne extends q{constructor(w){super(w.width,w.height),this.canvas=w,this.tempCanvasElement=null,this.buffer=ne.makeBufferFromCanvasImageData(w)}static makeBufferFromCanvasImageData(w){const E=w.getContext("2d").getImageData(0,0,w.width,w.height);return ne.toGrayscaleBuffer(E.data,w.width,w.height)}static toGrayscaleBuffer(w,E,O){const U=new Uint8ClampedArray(E*O);for(let H=0,Z=0,ue=w.length;H<ue;H+=4,Z++){let Ee;if(w[H+3]===0)Ee=255;else{const ot=w[H],Ct=w[H+1],Dt=w[H+2];Ee=306*ot+601*Ct+117*Dt+512>>10}U[Z]=Ee}return U}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth(),U=w*O;return E===null?E=this.buffer.slice(U,U+O):(E.length<O&&(E=new Uint8ClampedArray(O)),E.set(this.buffer.slice(U,U+O))),E}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(w,E,O,U){return super.crop(w,E,O,U),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const w=this.canvas.ownerDocument.createElement("canvas");w.width=this.canvas.width,w.height=this.canvas.height,this.tempCanvasElement=w}return this.tempCanvasElement}rotate(w){const E=this.getTempCanvasElement(),O=E.getContext("2d"),U=w*ne.DEGREE_TO_RADIANS,H=this.canvas.width,Z=this.canvas.height,ue=Math.ceil(Math.abs(Math.cos(U))*H+Math.abs(Math.sin(U))*Z),Ee=Math.ceil(Math.abs(Math.sin(U))*H+Math.abs(Math.cos(U))*Z);return E.width=ue,E.height=Ee,O.translate(ue/2,Ee/2),O.rotate(U),O.drawImage(this.canvas,H/-2,Z/-2),this.buffer=ne.makeBufferFromCanvasImageData(E),this}invert(){return new W(this)}}ne.DEGREE_TO_RADIANS=Math.PI/180;class oe{constructor(w,E,O){this.deviceId=w,this.label=E,this.kind="videoinput",this.groupId=O||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var he=(globalThis||Ru||self||window||void 0)&&(globalThis||Ru||self||window||void 0).__awaiter||function(wt,w,E,O){function U(H){return H instanceof E?H:new E(function(Z){Z(H)})}return new(E||(E=Promise))(function(H,Z){function ue(ot){try{Re(O.next(ot))}catch(Ct){Z(Ct)}}function Ee(ot){try{Re(O.throw(ot))}catch(Ct){Z(Ct)}}function Re(ot){ot.done?H(ot.value):U(ot.value).then(ue,Ee)}Re((O=O.apply(wt,w||[])).next())})};class _e{constructor(w,E=500,O){this.reader=w,this.timeBetweenScansMillis=E,this._hints=O,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(w){this._timeBetweenDecodingAttempts=w<0?0:w}set hints(w){this._hints=w||null}get hints(){return this._hints}listVideoInputDevices(){return he(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const w=yield navigator.mediaDevices.enumerateDevices(),E=[];for(const O of w){const U=O.kind==="video"?"videoinput":O.kind;if(U!=="videoinput")continue;const H=O.deviceId||O.id,Z=O.label||`Video device ${E.length+1}`,ue=O.groupId,Ee={deviceId:H,label:Z,kind:U,groupId:ue};E.push(Ee)}return E})}getVideoInputDevices(){return he(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(E=>new oe(E.deviceId,E.label))})}findDeviceById(w){return he(this,void 0,void 0,function*(){const E=yield this.listVideoInputDevices();return E?E.find(O=>O.deviceId===w):null})}decodeFromInputVideoDevice(w,E){return he(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(w,E)})}decodeOnceFromVideoDevice(w,E){return he(this,void 0,void 0,function*(){this.reset();let O;w?O={deviceId:{exact:w}}:O={facingMode:"environment"};const U={video:O};return yield this.decodeOnceFromConstraints(U,E)})}decodeOnceFromConstraints(w,E){return he(this,void 0,void 0,function*(){const O=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeOnceFromStream(O,E)})}decodeOnceFromStream(w,E){return he(this,void 0,void 0,function*(){this.reset();const O=yield this.attachStreamToVideo(w,E);return yield this.decodeOnce(O)})}decodeFromInputVideoDeviceContinuously(w,E,O){return he(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(w,E,O)})}decodeFromVideoDevice(w,E,O){return he(this,void 0,void 0,function*(){let U;w?U={deviceId:{exact:w}}:U={facingMode:"environment"};const H={video:U};return yield this.decodeFromConstraints(H,E,O)})}decodeFromConstraints(w,E,O){return he(this,void 0,void 0,function*(){const U=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeFromStream(U,E,O)})}decodeFromStream(w,E,O){return he(this,void 0,void 0,function*(){this.reset();const U=yield this.attachStreamToVideo(w,E);return yield this.decodeContinuously(U,O)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(w,E){return he(this,void 0,void 0,function*(){const O=this.prepareVideoElement(E);return this.addVideoSource(O,w),this.videoElement=O,this.stream=w,yield this.playVideoOnLoadAsync(O),O})}playVideoOnLoadAsync(w){return new Promise((E,O)=>this.playVideoOnLoad(w,()=>E()))}playVideoOnLoad(w,E){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(w),w.addEventListener("ended",this.videoEndedListener),w.addEventListener("canplay",this.videoCanPlayListener),w.addEventListener("playing",E),this.tryPlayVideo(w)}isVideoPlaying(w){return w.currentTime>0&&!w.paused&&!w.ended&&w.readyState>2}tryPlayVideo(w){return he(this,void 0,void 0,function*(){if(this.isVideoPlaying(w)){console.warn("Trying to play video that is already playing.");return}try{yield w.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(w,E){const O=document.getElementById(w);if(!O)throw new d(`element with id '${w}' not found`);if(O.nodeName.toLowerCase()!==E.toLowerCase())throw new d(`element with id '${w}' must be an ${E} element`);return O}decodeFromImage(w,E){if(!w&&!E)throw new d("either imageElement with a src set or an url must be provided");return E&&!w?this.decodeFromImageUrl(E):this.decodeFromImageElement(w)}decodeFromVideo(w,E){if(!w&&!E)throw new d("Either an element with a src set or an URL must be provided");return E&&!w?this.decodeFromVideoUrl(E):this.decodeFromVideoElement(w)}decodeFromVideoContinuously(w,E,O){if(w===void 0&&E===void 0)throw new d("Either an element with a src set or an URL must be provided");return E&&!w?this.decodeFromVideoUrlContinuously(E,O):this.decodeFromVideoElementContinuously(w,O)}decodeFromImageElement(w){if(!w)throw new d("An image element must be provided.");this.reset();const E=this.prepareImageElement(w);this.imageElement=E;let O;return this.isImageLoaded(E)?O=this.decodeOnce(E,!1,!0):O=this._decodeOnLoadImage(E),O}decodeFromVideoElement(w){const E=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideo(E)}decodeFromVideoElementContinuously(w,E){const O=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideoContinuously(O,E)}_decodeFromVideoElementSetup(w){if(!w)throw new d("A video element must be provided.");this.reset();const E=this.prepareVideoElement(w);return this.videoElement=E,E}decodeFromImageUrl(w){if(!w)throw new d("An URL must be provided.");this.reset();const E=this.prepareImageElement();this.imageElement=E;const O=this._decodeOnLoadImage(E);return E.src=w,O}decodeFromVideoUrl(w){if(!w)throw new d("An URL must be provided.");this.reset();const E=this.prepareVideoElement(),O=this.decodeFromVideoElement(E);return E.src=w,O}decodeFromVideoUrlContinuously(w,E){if(!w)throw new d("An URL must be provided.");this.reset();const O=this.prepareVideoElement(),U=this.decodeFromVideoElementContinuously(O,E);return O.src=w,U}_decodeOnLoadImage(w){return new Promise((E,O)=>{this.imageLoadedListener=()=>this.decodeOnce(w,!1,!0).then(E,O),w.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(w){return he(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(w),yield this.decodeOnce(w)})}_decodeOnLoadVideoContinuously(w,E){return he(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(w),this.decodeContinuously(w,E)})}isImageLoaded(w){return!(!w.complete||w.naturalWidth===0)}prepareImageElement(w){let E;return typeof w>"u"&&(E=document.createElement("img"),E.width=200,E.height=200),typeof w=="string"&&(E=this.getMediaElement(w,"img")),w instanceof HTMLImageElement&&(E=w),E}prepareVideoElement(w){let E;return!w&&typeof document<"u"&&(E=document.createElement("video"),E.width=200,E.height=200),typeof w=="string"&&(E=this.getMediaElement(w,"video")),w instanceof HTMLVideoElement&&(E=w),E.setAttribute("autoplay","true"),E.setAttribute("muted","true"),E.setAttribute("playsinline","true"),E}decodeOnce(w,E=!0,O=!0){this._stopAsyncDecode=!1;const U=(H,Z)=>{if(this._stopAsyncDecode){Z(new G("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const ue=this.decode(w);H(ue)}catch(ue){const Ee=E&&ue instanceof G,ot=(ue instanceof g||ue instanceof L)&&O;if(Ee||ot)return setTimeout(U,this._timeBetweenDecodingAttempts,H,Z);Z(ue)}};return new Promise((H,Z)=>U(H,Z))}decodeContinuously(w,E){this._stopContinuousDecode=!1;const O=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const U=this.decode(w);E(U,null),setTimeout(O,this.timeBetweenScansMillis)}catch(U){E(null,U);const H=U instanceof g||U instanceof L,Z=U instanceof G;(H||Z)&&setTimeout(O,this._timeBetweenDecodingAttempts)}};O()}decode(w){const E=this.createBinaryBitmap(w);return this.decodeBitmap(E)}_isHTMLVideoElement(w){return w.videoWidth!==0}drawFrameOnCanvas(w,E,O){E||(E={sx:0,sy:0,sWidth:w.videoWidth,sHeight:w.videoHeight,dx:0,dy:0,dWidth:w.videoWidth,dHeight:w.videoHeight}),O||(O=this.captureCanvasContext),O.drawImage(w,E.sx,E.sy,E.sWidth,E.sHeight,E.dx,E.dy,E.dWidth,E.dHeight)}drawImageOnCanvas(w,E,O=this.captureCanvasContext){E||(E={sx:0,sy:0,sWidth:w.naturalWidth,sHeight:w.naturalHeight,dx:0,dy:0,dWidth:w.naturalWidth,dHeight:w.naturalHeight}),O||(O=this.captureCanvasContext),O.drawImage(w,E.sx,E.sy,E.sWidth,E.sHeight,E.dx,E.dy,E.dWidth,E.dHeight)}createBinaryBitmap(w){this.getCaptureCanvasContext(w),this._isHTMLVideoElement(w)?this.drawFrameOnCanvas(w):this.drawImageOnCanvas(w);const E=this.getCaptureCanvas(w),O=new ne(E),U=new ae(O);return new x(U)}getCaptureCanvasContext(w){if(!this.captureCanvasContext){const O=this.getCaptureCanvas(w).getContext("2d");this.captureCanvasContext=O}return this.captureCanvasContext}getCaptureCanvas(w){if(!this.captureCanvas){const E=this.createCaptureCanvas(w);this.captureCanvas=E}return this.captureCanvas}decodeBitmap(w){return this.reader.decode(w,this._hints)}createCaptureCanvas(w){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const E=document.createElement("canvas");let O,U;return typeof w<"u"&&(w instanceof HTMLVideoElement?(O=w.videoWidth,U=w.videoHeight):w instanceof HTMLImageElement&&(O=w.naturalWidth||w.width,U=w.naturalHeight||w.height)),E.style.width=O+"px",E.style.height=U+"px",E.width=O,E.height=U,E}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(w=>w.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(w,E){try{w.srcObject=E}catch{w.src=URL.createObjectURL(E)}}cleanVideoSource(w){try{w.srcObject=null}catch{w.src=""}this.videoElement.removeAttribute("src")}}class xe{constructor(w,E,O=E==null?0:8*E.length,U,H,Z=v.currentTimeMillis()){this.text=w,this.rawBytes=E,this.numBits=O,this.resultPoints=U,this.format=H,this.timestamp=Z,this.text=w,this.rawBytes=E,O==null?this.numBits=E==null?0:8*E.length:this.numBits=O,this.resultPoints=U,this.format=H,this.resultMetadata=null,Z==null?this.timestamp=v.currentTimeMillis():this.timestamp=Z}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(w,E){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(w,E)}putAllMetadata(w){w!==null&&(this.resultMetadata===null?this.resultMetadata=w:this.resultMetadata=new Map(w))}addResultPoints(w){const E=this.resultPoints;if(E===null)this.resultPoints=w;else if(w!==null&&w.length>0){const O=new Array(E.length+w.length);v.arraycopy(E,0,O,0,E.length),v.arraycopy(w,0,O,E.length,w.length),this.resultPoints=O}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Se;(function(wt){wt[wt.AZTEC=0]="AZTEC",wt[wt.CODABAR=1]="CODABAR",wt[wt.CODE_39=2]="CODE_39",wt[wt.CODE_93=3]="CODE_93",wt[wt.CODE_128=4]="CODE_128",wt[wt.DATA_MATRIX=5]="DATA_MATRIX",wt[wt.EAN_8=6]="EAN_8",wt[wt.EAN_13=7]="EAN_13",wt[wt.ITF=8]="ITF",wt[wt.MAXICODE=9]="MAXICODE",wt[wt.PDF_417=10]="PDF_417",wt[wt.QR_CODE=11]="QR_CODE",wt[wt.RSS_14=12]="RSS_14",wt[wt.RSS_EXPANDED=13]="RSS_EXPANDED",wt[wt.UPC_A=14]="UPC_A",wt[wt.UPC_E=15]="UPC_E",wt[wt.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Se||(Se={}));var ge=Se,Ce;(function(wt){wt[wt.OTHER=0]="OTHER",wt[wt.ORIENTATION=1]="ORIENTATION",wt[wt.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",wt[wt.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",wt[wt.ISSUE_NUMBER=4]="ISSUE_NUMBER",wt[wt.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",wt[wt.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",wt[wt.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",wt[wt.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",wt[wt.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",wt[wt.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Ce||(Ce={}));var je=Ce;class Oe{constructor(w,E,O,U,H=-1,Z=-1){this.rawBytes=w,this.text=E,this.byteSegments=O,this.ecLevel=U,this.structuredAppendSequenceNumber=H,this.structuredAppendParity=Z,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 $e{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 Ye{constructor(w,E){if(E.length===0)throw new f;this.field=w;const O=E.length;if(O>1&&E[0]===0){let U=1;for(;U<O&&E[U]===0;)U++;U===O?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(O-U),v.arraycopy(E,U,this.coefficients,0,this.coefficients.length))}else this.coefficients=E}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(w){return this.coefficients[this.coefficients.length-1-w]}evaluateAt(w){if(w===0)return this.getCoefficient(0);const E=this.coefficients;let O;if(w===1){O=0;for(let Z=0,ue=E.length;Z!==ue;Z++){const Ee=E[Z];O=$e.addOrSubtract(O,Ee)}return O}O=E[0];const U=E.length,H=this.field;for(let Z=1;Z<U;Z++)O=$e.addOrSubtract(H.multiply(w,O),E[Z]);return O}addOrSubtract(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero())return w;if(w.isZero())return this;let E=this.coefficients,O=w.coefficients;if(E.length>O.length){const Z=E;E=O,O=Z}let U=new Int32Array(O.length);const H=O.length-E.length;v.arraycopy(O,0,U,0,H);for(let Z=H;Z<O.length;Z++)U[Z]=$e.addOrSubtract(E[Z-H],O[Z]);return new Ye(this.field,U)}multiply(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero()||w.isZero())return this.field.getZero();const E=this.coefficients,O=E.length,U=w.coefficients,H=U.length,Z=new Int32Array(O+H-1),ue=this.field;for(let Ee=0;Ee<O;Ee++){const Re=E[Ee];for(let ot=0;ot<H;ot++)Z[Ee+ot]=$e.addOrSubtract(Z[Ee+ot],ue.multiply(Re,U[ot]))}return new Ye(ue,Z)}multiplyScalar(w){if(w===0)return this.field.getZero();if(w===1)return this;const E=this.coefficients.length,O=this.field,U=new Int32Array(E),H=this.coefficients;for(let Z=0;Z<E;Z++)U[Z]=O.multiply(H[Z],w);return new Ye(O,U)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return this.field.getZero();const O=this.coefficients,U=O.length,H=new Int32Array(U+w),Z=this.field;for(let ue=0;ue<U;ue++)H[ue]=Z.multiply(O[ue],E);return new Ye(Z,H)}divide(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(w.isZero())throw new f("Divide by 0");const E=this.field;let O=E.getZero(),U=this;const H=w.getCoefficient(w.getDegree()),Z=E.inverse(H);for(;U.getDegree()>=w.getDegree()&&!U.isZero();){const ue=U.getDegree()-w.getDegree(),Ee=E.multiply(U.getCoefficient(U.getDegree()),Z),Re=w.multiplyByMonomial(ue,Ee),ot=E.buildMonomial(ue,Ee);O=O.addOrSubtract(ot),U=U.addOrSubtract(Re)}return[O,U]}toString(){let w="";for(let E=this.getDegree();E>=0;E--){let O=this.getCoefficient(E);if(O!==0){if(O<0?(w+=" - ",O=-O):w.length>0&&(w+=" + "),E===0||O!==1){const U=this.field.log(O);U===0?w+="1":U===1?w+="a":(w+="a^",w+=U)}E!==0&&(E===1?w+="x":(w+="x^",w+=E))}}return w}}class Je extends u{}Je.kind="ArithmeticException";class ht extends $e{constructor(w,E,O){super(),this.primitive=w,this.size=E,this.generatorBase=O;const U=new Int32Array(E);let H=1;for(let ue=0;ue<E;ue++)U[ue]=H,H*=2,H>=E&&(H^=w,H&=E-1);this.expTable=U;const Z=new Int32Array(E);for(let ue=0;ue<E-1;ue++)Z[U[ue]]=ue;this.logTable=Z,this.zero=new Ye(this,Int32Array.from([0])),this.one=new Ye(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(w,E){if(w<0)throw new f;if(E===0)return this.zero;const O=new Int32Array(w+1);return O[0]=E,new Ye(this,O)}inverse(w){if(w===0)throw new Je;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"+P.toHexString(this.primitive)+","+this.size+")"}equals(w){return w===this}}ht.AZTEC_DATA_12=new ht(4201,4096,1),ht.AZTEC_DATA_10=new ht(1033,1024,1),ht.AZTEC_DATA_6=new ht(67,64,1),ht.AZTEC_PARAM=new ht(19,16,1),ht.QR_CODE_FIELD_256=new ht(285,256,0),ht.DATA_MATRIX_FIELD_256=new ht(301,256,1),ht.AZTEC_DATA_8=ht.DATA_MATRIX_FIELD_256,ht.MAXICODE_FIELD_64=ht.AZTEC_DATA_6;class rt extends u{}rt.kind="ReedSolomonException";class st extends u{}st.kind="IllegalStateException";class He{constructor(w){this.field=w}decode(w,E){const O=this.field,U=new Ye(O,w),H=new Int32Array(E);let Z=!0;for(let sn=0;sn<E;sn++){const Et=U.evaluateAt(O.exp(sn+O.getGeneratorBase()));H[H.length-1-sn]=Et,Et!==0&&(Z=!1)}if(Z)return;const ue=new Ye(O,H),Ee=this.runEuclideanAlgorithm(O.buildMonomial(E,1),ue,E),Re=Ee[0],ot=Ee[1],Ct=this.findErrorLocations(Re),Dt=this.findErrorMagnitudes(ot,Ct);for(let sn=0;sn<Ct.length;sn++){const Et=w.length-1-O.log(Ct[sn]);if(Et<0)throw new rt("Bad error location");w[Et]=ht.addOrSubtract(w[Et],Dt[sn])}}runEuclideanAlgorithm(w,E,O){if(w.getDegree()<E.getDegree()){const sn=w;w=E,E=sn}const U=this.field;let H=w,Z=E,ue=U.getZero(),Ee=U.getOne();for(;Z.getDegree()>=(O/2|0);){let sn=H,Et=ue;if(H=Z,ue=Ee,H.isZero())throw new rt("r_{i-1} was zero");Z=sn;let Yt=U.getZero();const Jt=H.getCoefficient(H.getDegree()),Pn=U.inverse(Jt);for(;Z.getDegree()>=H.getDegree()&&!Z.isZero();){const xr=Z.getDegree()-H.getDegree(),Nr=U.multiply(Z.getCoefficient(Z.getDegree()),Pn);Yt=Yt.addOrSubtract(U.buildMonomial(xr,Nr)),Z=Z.addOrSubtract(H.multiplyByMonomial(xr,Nr))}if(Ee=Yt.multiply(ue).addOrSubtract(Et),Z.getDegree()>=H.getDegree())throw new st("Division algorithm failed to reduce polynomial?")}const Re=Ee.getCoefficient(0);if(Re===0)throw new rt("sigmaTilde(0) was zero");const ot=U.inverse(Re),Ct=Ee.multiplyScalar(ot),Dt=Z.multiplyScalar(ot);return[Ct,Dt]}findErrorLocations(w){const E=w.getDegree();if(E===1)return Int32Array.from([w.getCoefficient(1)]);const O=new Int32Array(E);let U=0;const H=this.field;for(let Z=1;Z<H.getSize()&&U<E;Z++)w.evaluateAt(Z)===0&&(O[U]=H.inverse(Z),U++);if(U!==E)throw new rt("Error locator degree does not match number of roots");return O}findErrorMagnitudes(w,E){const O=E.length,U=new Int32Array(O),H=this.field;for(let Z=0;Z<O;Z++){const ue=H.inverse(E[Z]);let Ee=1;for(let Re=0;Re<O;Re++)if(Z!==Re){const ot=H.multiply(E[Re],ue),Ct=ot&1?ot&-2:ot|1;Ee=H.multiply(Ee,Ct)}U[Z]=H.multiply(w.evaluateAt(ue),H.inverse(Ee)),H.getGeneratorBase()!==0&&(U[Z]=H.multiply(U[Z],ue))}return U}}var Ve;(function(wt){wt[wt.UPPER=0]="UPPER",wt[wt.LOWER=1]="LOWER",wt[wt.MIXED=2]="MIXED",wt[wt.DIGIT=3]="DIGIT",wt[wt.PUNCT=4]="PUNCT",wt[wt.BINARY=5]="BINARY"})(Ve||(Ve={}));class bt{decode(w){this.ddata=w;let E=w.getBits(),O=this.extractBits(E),U=this.correctBits(O),H=bt.convertBoolArrayToByteArray(U),Z=bt.getEncodedData(U),ue=new Oe(H,Z,null,null);return ue.setNumBits(U.length),ue}static highLevelDecode(w){return this.getEncodedData(w)}static getEncodedData(w){let E=w.length,O=Ve.UPPER,U=Ve.UPPER,H="",Z=0;for(;Z<E;)if(U===Ve.BINARY){if(E-Z<5)break;let ue=bt.readCode(w,Z,5);if(Z+=5,ue===0){if(E-Z<11)break;ue=bt.readCode(w,Z,11)+31,Z+=11}for(let Ee=0;Ee<ue;Ee++){if(E-Z<8){Z=E;break}const Re=bt.readCode(w,Z,8);H+=K.castAsNonUtf8Char(Re),Z+=8}U=O}else{let ue=U===Ve.DIGIT?4:5;if(E-Z<ue)break;let Ee=bt.readCode(w,Z,ue);Z+=ue;let Re=bt.getCharacter(U,Ee);Re.startsWith("CTRL_")?(O=U,U=bt.getTable(Re.charAt(5)),Re.charAt(6)==="L"&&(O=U)):(H+=Re,U=O)}return H}static getTable(w){switch(w){case"L":return Ve.LOWER;case"P":return Ve.PUNCT;case"M":return Ve.MIXED;case"D":return Ve.DIGIT;case"B":return Ve.BINARY;case"U":default:return Ve.UPPER}}static getCharacter(w,E){switch(w){case Ve.UPPER:return bt.UPPER_TABLE[E];case Ve.LOWER:return bt.LOWER_TABLE[E];case Ve.MIXED:return bt.MIXED_TABLE[E];case Ve.PUNCT:return bt.PUNCT_TABLE[E];case Ve.DIGIT:return bt.DIGIT_TABLE[E];default:throw new st("Bad table")}}correctBits(w){let E,O;this.ddata.getNbLayers()<=2?(O=6,E=ht.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(O=8,E=ht.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(O=10,E=ht.AZTEC_DATA_10):(O=12,E=ht.AZTEC_DATA_12);let U=this.ddata.getNbDatablocks(),H=w.length/O;if(H<U)throw new L;let Z=w.length%O,ue=new Int32Array(H);for(let Dt=0;Dt<H;Dt++,Z+=O)ue[Dt]=bt.readCode(w,Z,O);try{new He(E).decode(ue,H-U)}catch(Dt){throw new L(Dt)}let Ee=(1<<O)-1,Re=0;for(let Dt=0;Dt<U;Dt++){let sn=ue[Dt];if(sn===0||sn===Ee)throw new L;(sn===1||sn===Ee-1)&&Re++}let ot=new Array(U*O-Re),Ct=0;for(let Dt=0;Dt<U;Dt++){let sn=ue[Dt];if(sn===1||sn===Ee-1)ot.fill(sn>1,Ct,Ct+O-1),Ct+=O-1;else for(let Et=O-1;Et>=0;--Et)ot[Ct++]=(sn&1<<Et)!==0}return ot}extractBits(w){let E=this.ddata.isCompact(),O=this.ddata.getNbLayers(),U=(E?11:14)+O*4,H=new Int32Array(U),Z=new Array(this.totalBitsInLayer(O,E));if(E)for(let ue=0;ue<H.length;ue++)H[ue]=ue;else{let ue=U+1+2*P.truncDivision(P.truncDivision(U,2)-1,15),Ee=U/2,Re=P.truncDivision(ue,2);for(let ot=0;ot<Ee;ot++){let Ct=ot+P.truncDivision(ot,15);H[Ee-ot-1]=Re-Ct-1,H[Ee+ot]=Re+Ct+1}}for(let ue=0,Ee=0;ue<O;ue++){let Re=(O-ue)*4+(E?9:12),ot=ue*2,Ct=U-1-ot;for(let Dt=0;Dt<Re;Dt++){let sn=Dt*2;for(let Et=0;Et<2;Et++)Z[Ee+sn+Et]=w.get(H[ot+Et],H[ot+Dt]),Z[Ee+2*Re+sn+Et]=w.get(H[ot+Dt],H[Ct-Et]),Z[Ee+4*Re+sn+Et]=w.get(H[Ct-Et],H[Ct-Dt]),Z[Ee+6*Re+sn+Et]=w.get(H[Ct-Dt],H[ot+Et])}Ee+=Re*8}return Z}static readCode(w,E,O){let U=0;for(let H=E;H<E+O;H++)U<<=1,w[H]&&(U|=1);return U}static readByte(w,E){let O=w.length-E;return O>=8?bt.readCode(w,E,8):bt.readCode(w,E,O)<<8-O}static convertBoolArrayToByteArray(w){let E=new Uint8Array((w.length+7)/8);for(let O=0;O<E.length;O++)E[O]=bt.readByte(w,8*O);return E}totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}bt.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"],bt.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"],bt.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"],bt.PUNCT_TABLE=["","\r",`\r
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],bt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class xt{constructor(){}static round(w){return w===NaN?0:w<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:w>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:w+(w<0?-.5:.5)|0}static distance(w,E,O,U){const H=w-O,Z=E-U;return Math.sqrt(H*H+Z*Z)}static sum(w){let E=0;for(let O=0,U=w.length;O!==U;O++){const H=w[O];E+=H}return E}}class Qt{static floatToIntBits(w){return w}}Qt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class St{constructor(w,E){this.x=w,this.y=E}getX(){return this.x}getY(){return this.y}equals(w){if(w instanceof St){const E=w;return this.x===E.x&&this.y===E.y}return!1}hashCode(){return 31*Qt.floatToIntBits(this.x)+Qt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(w){const E=this.distance(w[0],w[1]),O=this.distance(w[1],w[2]),U=this.distance(w[0],w[2]);let H,Z,ue;if(O>=E&&O>=U?(Z=w[0],H=w[1],ue=w[2]):U>=O&&U>=E?(Z=w[1],H=w[0],ue=w[2]):(Z=w[2],H=w[0],ue=w[1]),this.crossProductZ(H,Z,ue)<0){const Ee=H;H=ue,ue=Ee}w[0]=H,w[1]=Z,w[2]=ue}static distance(w,E){return xt.distance(w.x,w.y,E.x,E.y)}static crossProductZ(w,E,O){const U=E.x,H=E.y;return(O.x-U)*(w.y-H)-(O.y-H)*(w.x-U)}}class on{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class cn extends on{constructor(w,E,O,U,H){super(w,E),this.compact=O,this.nbDatablocks=U,this.nbLayers=H}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Vn{constructor(w,E,O,U){this.image=w,this.height=w.getHeight(),this.width=w.getWidth(),E==null&&(E=Vn.INIT_SIZE),O==null&&(O=w.getWidth()/2|0),U==null&&(U=w.getHeight()/2|0);const H=E/2|0;if(this.leftInit=O-H,this.rightInit=O+H,this.upInit=U-H,this.downInit=U+H,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new G}detect(){let w=this.leftInit,E=this.rightInit,O=this.upInit,U=this.downInit,H=!1,Z=!0,ue=!1,Ee=!1,Re=!1,ot=!1,Ct=!1;const Dt=this.width,sn=this.height;for(;Z;){Z=!1;let Et=!0;for(;(Et||!Ee)&&E<Dt;)Et=this.containsBlackPoint(O,U,E,!1),Et?(E++,Z=!0,Ee=!0):Ee||E++;if(E>=Dt){H=!0;break}let Yt=!0;for(;(Yt||!Re)&&U<sn;)Yt=this.containsBlackPoint(w,E,U,!0),Yt?(U++,Z=!0,Re=!0):Re||U++;if(U>=sn){H=!0;break}let Jt=!0;for(;(Jt||!ot)&&w>=0;)Jt=this.containsBlackPoint(O,U,w,!1),Jt?(w--,Z=!0,ot=!0):ot||w--;if(w<0){H=!0;break}let Pn=!0;for(;(Pn||!Ct)&&O>=0;)Pn=this.containsBlackPoint(w,E,O,!0),Pn?(O--,Z=!0,Ct=!0):Ct||O--;if(O<0){H=!0;break}Z&&(ue=!0)}if(!H&&ue){const Et=E-w;let Yt=null;for(let Nr=1;Yt===null&&Nr<Et;Nr++)Yt=this.getBlackPointOnSegment(w,U-Nr,w+Nr,U);if(Yt==null)throw new G;let Jt=null;for(let Nr=1;Jt===null&&Nr<Et;Nr++)Jt=this.getBlackPointOnSegment(w,O+Nr,w+Nr,O);if(Jt==null)throw new G;let Pn=null;for(let Nr=1;Pn===null&&Nr<Et;Nr++)Pn=this.getBlackPointOnSegment(E,O+Nr,E-Nr,O);if(Pn==null)throw new G;let xr=null;for(let Nr=1;xr===null&&Nr<Et;Nr++)xr=this.getBlackPointOnSegment(E,U-Nr,E-Nr,U);if(xr==null)throw new G;return this.centerEdges(xr,Yt,Pn,Jt)}else throw new G}getBlackPointOnSegment(w,E,O,U){const H=xt.round(xt.distance(w,E,O,U)),Z=(O-w)/H,ue=(U-E)/H,Ee=this.image;for(let Re=0;Re<H;Re++){const ot=xt.round(w+Re*Z),Ct=xt.round(E+Re*ue);if(Ee.get(ot,Ct))return new St(ot,Ct)}return null}centerEdges(w,E,O,U){const H=w.getX(),Z=w.getY(),ue=E.getX(),Ee=E.getY(),Re=O.getX(),ot=O.getY(),Ct=U.getX(),Dt=U.getY(),sn=Vn.CORR;return H<this.width/2?[new St(Ct-sn,Dt+sn),new St(ue+sn,Ee+sn),new St(Re-sn,ot-sn),new St(H+sn,Z-sn)]:[new St(Ct+sn,Dt+sn),new St(ue+sn,Ee-sn),new St(Re-sn,ot+sn),new St(H-sn,Z-sn)]}containsBlackPoint(w,E,O,U){const H=this.image;if(U){for(let Z=w;Z<=E;Z++)if(H.get(Z,O))return!0}else for(let Z=w;Z<=E;Z++)if(H.get(O,Z))return!0;return!1}}Vn.INIT_SIZE=10,Vn.CORR=1;class tn{static checkAndNudgePoints(w,E){const O=w.getWidth(),U=w.getHeight();let H=!0;for(let Z=0;Z<E.length&&H;Z+=2){const ue=Math.floor(E[Z]),Ee=Math.floor(E[Z+1]);if(ue<-1||ue>O||Ee<-1||Ee>U)throw new G;H=!1,ue===-1?(E[Z]=0,H=!0):ue===O&&(E[Z]=O-1,H=!0),Ee===-1?(E[Z+1]=0,H=!0):Ee===U&&(E[Z+1]=U-1,H=!0)}H=!0;for(let Z=E.length-2;Z>=0&&H;Z-=2){const ue=Math.floor(E[Z]),Ee=Math.floor(E[Z+1]);if(ue<-1||ue>O||Ee<-1||Ee>U)throw new G;H=!1,ue===-1?(E[Z]=0,H=!0):ue===O&&(E[Z]=O-1,H=!0),Ee===-1?(E[Z+1]=0,H=!0):Ee===U&&(E[Z+1]=U-1,H=!0)}}}class fn{constructor(w,E,O,U,H,Z,ue,Ee,Re){this.a11=w,this.a21=E,this.a31=O,this.a12=U,this.a22=H,this.a32=Z,this.a13=ue,this.a23=Ee,this.a33=Re}static quadrilateralToQuadrilateral(w,E,O,U,H,Z,ue,Ee,Re,ot,Ct,Dt,sn,Et,Yt,Jt){const Pn=fn.quadrilateralToSquare(w,E,O,U,H,Z,ue,Ee);return fn.squareToQuadrilateral(Re,ot,Ct,Dt,sn,Et,Yt,Jt).times(Pn)}transformPoints(w){const E=w.length,O=this.a11,U=this.a12,H=this.a13,Z=this.a21,ue=this.a22,Ee=this.a23,Re=this.a31,ot=this.a32,Ct=this.a33;for(let Dt=0;Dt<E;Dt+=2){const sn=w[Dt],Et=w[Dt+1],Yt=H*sn+Ee*Et+Ct;w[Dt]=(O*sn+Z*Et+Re)/Yt,w[Dt+1]=(U*sn+ue*Et+ot)/Yt}}transformPointsWithValues(w,E){const O=this.a11,U=this.a12,H=this.a13,Z=this.a21,ue=this.a22,Ee=this.a23,Re=this.a31,ot=this.a32,Ct=this.a33,Dt=w.length;for(let sn=0;sn<Dt;sn++){const Et=w[sn],Yt=E[sn],Jt=H*Et+Ee*Yt+Ct;w[sn]=(O*Et+Z*Yt+Re)/Jt,E[sn]=(U*Et+ue*Yt+ot)/Jt}}static squareToQuadrilateral(w,E,O,U,H,Z,ue,Ee){const Re=w-O+H-ue,ot=E-U+Z-Ee;if(Re===0&&ot===0)return new fn(O-w,H-O,w,U-E,Z-U,E,0,0,1);{const Ct=O-H,Dt=ue-H,sn=U-Z,Et=Ee-Z,Yt=Ct*Et-Dt*sn,Jt=(Re*Et-Dt*ot)/Yt,Pn=(Ct*ot-Re*sn)/Yt;return new fn(O-w+Jt*O,ue-w+Pn*ue,w,U-E+Jt*U,Ee-E+Pn*Ee,E,Jt,Pn,1)}}static quadrilateralToSquare(w,E,O,U,H,Z,ue,Ee){return fn.squareToQuadrilateral(w,E,O,U,H,Z,ue,Ee).buildAdjoint()}buildAdjoint(){return new fn(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 fn(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 rn extends tn{sampleGrid(w,E,O,U,H,Z,ue,Ee,Re,ot,Ct,Dt,sn,Et,Yt,Jt,Pn,xr,Nr){const Ar=fn.quadrilateralToQuadrilateral(U,H,Z,ue,Ee,Re,ot,Ct,Dt,sn,Et,Yt,Jt,Pn,xr,Nr);return this.sampleGridWithTransform(w,E,O,Ar)}sampleGridWithTransform(w,E,O,U){if(E<=0||O<=0)throw new G;const H=new de(E,O),Z=new Float32Array(2*E);for(let ue=0;ue<O;ue++){const Ee=Z.length,Re=ue+.5;for(let ot=0;ot<Ee;ot+=2)Z[ot]=ot/2+.5,Z[ot+1]=Re;U.transformPoints(Z),tn.checkAndNudgePoints(w,Z);try{for(let ot=0;ot<Ee;ot+=2)w.get(Math.floor(Z[ot]),Math.floor(Z[ot+1]))&&H.set(ot/2,ue)}catch{throw new G}}return H}}class nt{static setGridSampler(w){nt.gridSampler=w}static getInstance(){return nt.gridSampler}}nt.gridSampler=new rn;class it{constructor(w,E){this.x=w,this.y=E}toResultPoint(){return new St(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(),O=this.getBullsEyeCorners(E);if(w){let Z=O[0];O[0]=O[2],O[2]=Z}this.extractParameters(O);let U=this.sampleGrid(this.image,O[this.shift%4],O[(this.shift+1)%4],O[(this.shift+2)%4],O[(this.shift+3)%4]),H=this.getMatrixCornerPoints(O);return new cn(U,H,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(w){if(!this.isValidPoint(w[0])||!this.isValidPoint(w[1])||!this.isValidPoint(w[2])||!this.isValidPoint(w[3]))throw new G;let E=2*this.nbCenterLayers,O=new Int32Array([this.sampleLine(w[0],w[1],E),this.sampleLine(w[1],w[2],E),this.sampleLine(w[2],w[3],E),this.sampleLine(w[3],w[0],E)]);this.shift=this.getRotation(O,E);let U=0;for(let Z=0;Z<4;Z++){let ue=O[(this.shift+Z)%4];this.compact?(U<<=7,U+=ue>>1&127):(U<<=10,U+=(ue>>2&992)+(ue>>1&31))}let H=this.getCorrectedParameterData(U,this.compact);this.compact?(this.nbLayers=(H>>6)+1,this.nbDataBlocks=(H&63)+1):(this.nbLayers=(H>>11)+1,this.nbDataBlocks=(H&2047)+1)}getRotation(w,E){let O=0;w.forEach((U,H,Z)=>{let ue=(U>>E-2<<1)+(U&1);O=(O<<3)+ue}),O=((O&1)<<11)+(O>>1);for(let U=0;U<4;U++)if(P.bitCount(O^this.EXPECTED_CORNER_BITS[U])<=2)return U;throw new G}getCorrectedParameterData(w,E){let O,U;E?(O=7,U=2):(O=10,U=4);let H=O-U,Z=new Int32Array(O);for(let Ee=O-1;Ee>=0;--Ee)Z[Ee]=w&15,w>>=4;try{new He(ht.AZTEC_PARAM).decode(Z,H)}catch{throw new G}let ue=0;for(let Ee=0;Ee<U;Ee++)ue=(ue<<4)+Z[Ee];return ue}getBullsEyeCorners(w){let E=w,O=w,U=w,H=w,Z=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let Ct=this.getFirstDifferent(E,Z,1,-1),Dt=this.getFirstDifferent(O,Z,1,1),sn=this.getFirstDifferent(U,Z,-1,1),Et=this.getFirstDifferent(H,Z,-1,-1);if(this.nbCenterLayers>2){let Yt=this.distancePoint(Et,Ct)*this.nbCenterLayers/(this.distancePoint(H,E)*(this.nbCenterLayers+2));if(Yt<.75||Yt>1.25||!this.isWhiteOrBlackRectangle(Ct,Dt,sn,Et))break}E=Ct,O=Dt,U=sn,H=Et,Z=!Z}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new G;this.compact=this.nbCenterLayers===5;let ue=new St(E.getX()+.5,E.getY()-.5),Ee=new St(O.getX()+.5,O.getY()+.5),Re=new St(U.getX()-.5,U.getY()+.5),ot=new St(H.getX()-.5,H.getY()-.5);return this.expandSquare([ue,Ee,Re,ot],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let w,E,O,U;try{let ue=new Vn(this.image).detect();w=ue[0],E=ue[1],O=ue[2],U=ue[3]}catch{let Ee=this.image.getWidth()/2,Re=this.image.getHeight()/2;w=this.getFirstDifferent(new it(Ee+7,Re-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new it(Ee+7,Re+7),!1,1,1).toResultPoint(),O=this.getFirstDifferent(new it(Ee-7,Re+7),!1,-1,1).toResultPoint(),U=this.getFirstDifferent(new it(Ee-7,Re-7),!1,-1,-1).toResultPoint()}let H=xt.round((w.getX()+U.getX()+E.getX()+O.getX())/4),Z=xt.round((w.getY()+U.getY()+E.getY()+O.getY())/4);try{let ue=new Vn(this.image,15,H,Z).detect();w=ue[0],E=ue[1],O=ue[2],U=ue[3]}catch{w=this.getFirstDifferent(new it(H+7,Z-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new it(H+7,Z+7),!1,1,1).toResultPoint(),O=this.getFirstDifferent(new it(H-7,Z+7),!1,-1,1).toResultPoint(),U=this.getFirstDifferent(new it(H-7,Z-7),!1,-1,-1).toResultPoint()}return H=xt.round((w.getX()+U.getX()+E.getX()+O.getX())/4),Z=xt.round((w.getY()+U.getY()+E.getY()+O.getY())/4),new it(H,Z)}getMatrixCornerPoints(w){return this.expandSquare(w,2*this.nbCenterLayers,this.getDimension())}sampleGrid(w,E,O,U,H){let Z=nt.getInstance(),ue=this.getDimension(),Ee=ue/2-this.nbCenterLayers,Re=ue/2+this.nbCenterLayers;return Z.sampleGrid(w,ue,ue,Ee,Ee,Re,Ee,Re,Re,Ee,Re,E.getX(),E.getY(),O.getX(),O.getY(),U.getX(),U.getY(),H.getX(),H.getY())}sampleLine(w,E,O){let U=0,H=this.distanceResultPoint(w,E),Z=H/O,ue=w.getX(),Ee=w.getY(),Re=Z*(E.getX()-w.getX())/H,ot=Z*(E.getY()-w.getY())/H;for(let Ct=0;Ct<O;Ct++)this.image.get(xt.round(ue+Ct*Re),xt.round(Ee+Ct*ot))&&(U|=1<<O-Ct-1);return U}isWhiteOrBlackRectangle(w,E,O,U){let H=3;w=new it(w.getX()-H,w.getY()+H),E=new it(E.getX()-H,E.getY()-H),O=new it(O.getX()+H,O.getY()-H),U=new it(U.getX()+H,U.getY()+H);let Z=this.getColor(U,w);if(Z===0)return!1;let ue=this.getColor(w,E);return ue!==Z||(ue=this.getColor(E,O),ue!==Z)?!1:(ue=this.getColor(O,U),ue===Z)}getColor(w,E){let O=this.distancePoint(w,E),U=(E.getX()-w.getX())/O,H=(E.getY()-w.getY())/O,Z=0,ue=w.getX(),Ee=w.getY(),Re=this.image.get(w.getX(),w.getY()),ot=Math.ceil(O);for(let Dt=0;Dt<ot;Dt++)ue+=U,Ee+=H,this.image.get(xt.round(ue),xt.round(Ee))!==Re&&Z++;let Ct=Z/O;return Ct>.1&&Ct<.9?0:Ct<=.1===Re?1:-1}getFirstDifferent(w,E,O,U){let H=w.getX()+O,Z=w.getY()+U;for(;this.isValid(H,Z)&&this.image.get(H,Z)===E;)H+=O,Z+=U;for(H-=O,Z-=U;this.isValid(H,Z)&&this.image.get(H,Z)===E;)H+=O;for(H-=O;this.isValid(H,Z)&&this.image.get(H,Z)===E;)Z+=U;return Z-=U,new it(H,Z)}expandSquare(w,E,O){let U=O/(2*E),H=w[0].getX()-w[2].getX(),Z=w[0].getY()-w[2].getY(),ue=(w[0].getX()+w[2].getX())/2,Ee=(w[0].getY()+w[2].getY())/2,Re=new St(ue+U*H,Ee+U*Z),ot=new St(ue-U*H,Ee-U*Z);H=w[1].getX()-w[3].getX(),Z=w[1].getY()-w[3].getY(),ue=(w[1].getX()+w[3].getX())/2,Ee=(w[1].getY()+w[3].getY())/2;let Ct=new St(ue+U*H,Ee+U*Z),Dt=new St(ue-U*H,Ee-U*Z);return[Re,Ct,ot,Dt]}isValid(w,E){return w>=0&&w<this.image.getWidth()&&E>0&&E<this.image.getHeight()}isValidPoint(w){let E=xt.round(w.getX()),O=xt.round(w.getY());return this.isValid(E,O)}distancePoint(w,E){return xt.distance(w.getX(),w.getY(),E.getX(),E.getY())}distanceResultPoint(w,E){return xt.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*(P.truncDivision(this.nbLayers-4,8)+1)+15}}class hn{decode(w,E=null){let O=null,U=new Ut(w.getBlackMatrix()),H=null,Z=null;try{let ot=U.detectMirror(!1);H=ot.getPoints(),this.reportFoundResultPoints(E,H),Z=new bt().decode(ot)}catch(ot){O=ot}if(Z==null)try{let ot=U.detectMirror(!0);H=ot.getPoints(),this.reportFoundResultPoints(E,H),Z=new bt().decode(ot)}catch(ot){throw O??ot}let ue=new xe(Z.getText(),Z.getRawBytes(),Z.getNumBits(),H,ge.AZTEC,v.currentTimeMillis()),Ee=Z.getByteSegments();Ee!=null&&ue.putMetadata(je.BYTE_SEGMENTS,Ee);let Re=Z.getECLevel();return Re!=null&&ue.putMetadata(je.ERROR_CORRECTION_LEVEL,Re),ue}reportFoundResultPoints(w,E){if(w!=null){let O=w.get($.NEED_RESULT_POINT_CALLBACK);O!=null&&E.forEach((U,H,Z)=>{O.foundPossibleResultPoint(U)})}}reset(){}}class nn extends _e{constructor(w=500){super(new hn,w)}}class Vt{decode(w,E){try{return this.doDecode(w,E)}catch{if(E&&E.get($.TRY_HARDER)===!0&&w.isRotateSupported()){const H=w.rotateCounterClockwise(),Z=this.doDecode(H,E),ue=Z.getResultMetadata();let Ee=270;ue!==null&&ue.get(je.ORIENTATION)===!0&&(Ee=Ee+ue.get(je.ORIENTATION)%360),Z.putMetadata(je.ORIENTATION,Ee);const Re=Z.getResultPoints();if(Re!==null){const ot=H.getHeight();for(let Ct=0;Ct<Re.length;Ct++)Re[Ct]=new St(ot-Re[Ct].getY()-1,Re[Ct].getX())}return Z}else throw new G}}reset(){}doDecode(w,E){const O=w.getWidth(),U=w.getHeight();let H=new M(O);const Z=E&&E.get($.TRY_HARDER)===!0,ue=Math.max(1,U>>(Z?8:5));let Ee;Z?Ee=U:Ee=15;const Re=Math.trunc(U/2);for(let ot=0;ot<Ee;ot++){const Ct=Math.trunc((ot+1)/2),Dt=(ot&1)===0,sn=Re+ue*(Dt?Ct:-Ct);if(sn<0||sn>=U)break;try{H=w.getBlackRow(sn,H)}catch{continue}for(let Et=0;Et<2;Et++){if(Et===1&&(H.reverse(),E&&E.get($.NEED_RESULT_POINT_CALLBACK)===!0)){const Yt=new Map;E.forEach((Jt,Pn)=>Yt.set(Pn,Jt)),Yt.delete($.NEED_RESULT_POINT_CALLBACK),E=Yt}try{const Yt=this.decodeRow(sn,H,E);if(Et===1){Yt.putMetadata(je.ORIENTATION,180);const Jt=Yt.getResultPoints();Jt!==null&&(Jt[0]=new St(O-Jt[0].getX()-1,Jt[0].getY()),Jt[1]=new St(O-Jt[1].getX()-1,Jt[1].getY()))}return Yt}catch{}}}throw new G}static recordPattern(w,E,O){const U=O.length;for(let Re=0;Re<U;Re++)O[Re]=0;const H=w.getSize();if(E>=H)throw new G;let Z=!w.get(E),ue=0,Ee=E;for(;Ee<H;){if(w.get(Ee)!==Z)O[ue]++;else{if(++ue===U)break;O[ue]=1,Z=!Z}Ee++}if(!(ue===U||ue===U-1&&Ee===H))throw new G}static recordPatternInReverse(w,E,O){let U=O.length,H=w.get(E);for(;E>0&&U>=0;)w.get(--E)!==H&&(U--,H=!H);if(U>=0)throw new G;Vt.recordPattern(w,E+1,O)}static patternMatchVariance(w,E,O){const U=w.length;let H=0,Z=0;for(let Re=0;Re<U;Re++)H+=w[Re],Z+=E[Re];if(H<Z)return Number.POSITIVE_INFINITY;const ue=H/Z;O*=ue;let Ee=0;for(let Re=0;Re<U;Re++){const ot=w[Re],Ct=E[Re]*ue,Dt=ot>Ct?ot-Ct:Ct-ot;if(Dt>O)return Number.POSITIVE_INFINITY;Ee+=Dt}return Ee/H}}class pt extends Vt{static findStartPattern(w){const E=w.getSize(),O=w.getNextSet(0);let U=0,H=Int32Array.from([0,0,0,0,0,0]),Z=O,ue=!1;const Ee=6;for(let Re=O;Re<E;Re++)if(w.get(Re)!==ue)H[U]++;else{if(U===Ee-1){let ot=pt.MAX_AVG_VARIANCE,Ct=-1;for(let Dt=pt.CODE_START_A;Dt<=pt.CODE_START_C;Dt++){const sn=Vt.patternMatchVariance(H,pt.CODE_PATTERNS[Dt],pt.MAX_INDIVIDUAL_VARIANCE);sn<ot&&(ot=sn,Ct=Dt)}if(Ct>=0&&w.isRange(Math.max(0,Z-(Re-Z)/2),Z,!1))return Int32Array.from([Z,Re,Ct]);Z+=H[0]+H[1],H=H.slice(2,H.length-1),H[U-1]=0,H[U]=0,U--}else U++;H[U]=1,ue=!ue}throw new G}static decodeCode(w,E,O){Vt.recordPattern(w,O,E);let U=pt.MAX_AVG_VARIANCE,H=-1;for(let Z=0;Z<pt.CODE_PATTERNS.length;Z++){const ue=pt.CODE_PATTERNS[Z],Ee=this.patternMatchVariance(E,ue,pt.MAX_INDIVIDUAL_VARIANCE);Ee<U&&(U=Ee,H=Z)}if(H>=0)return H;throw new G}decodeRow(w,E,O){const U=O&&O.get($.ASSUME_GS1)===!0,H=pt.findStartPattern(E),Z=H[2];let ue=0;const Ee=new Uint8Array(20);Ee[ue++]=Z;let Re;switch(Z){case pt.CODE_START_A:Re=pt.CODE_CODE_A;break;case pt.CODE_START_B:Re=pt.CODE_CODE_B;break;case pt.CODE_START_C:Re=pt.CODE_CODE_C;break;default:throw new L}let ot=!1,Ct=!1,Dt="",sn=H[0],Et=H[1];const Yt=Int32Array.from([0,0,0,0,0,0]);let Jt=0,Pn=0,xr=Z,Nr=0,Ar=!0,Ns=!1,ti=!1;for(;!ot;){const Oi=Ct;switch(Ct=!1,Jt=Pn,Pn=pt.decodeCode(E,Yt,Et),Ee[ue++]=Pn,Pn!==pt.CODE_STOP&&(Ar=!0),Pn!==pt.CODE_STOP&&(Nr++,xr+=Nr*Pn),sn=Et,Et+=Yt.reduce((Lm,W1)=>Lm+W1,0),Pn){case pt.CODE_START_A:case pt.CODE_START_B:case pt.CODE_START_C:throw new L}switch(Re){case pt.CODE_CODE_A:if(Pn<64)ti===Ns?Dt+=String.fromCharCode(32+Pn):Dt+=String.fromCharCode(32+Pn+128),ti=!1;else if(Pn<96)ti===Ns?Dt+=String.fromCharCode(Pn-64):Dt+=String.fromCharCode(Pn+64),ti=!1;else switch(Pn!==pt.CODE_STOP&&(Ar=!1),Pn){case pt.CODE_FNC_1:U&&(Dt.length===0?Dt+="]C1":Dt+="");break;case pt.CODE_FNC_2:case pt.CODE_FNC_3:break;case pt.CODE_FNC_4_A:!Ns&&ti?(Ns=!0,ti=!1):Ns&&ti?(Ns=!1,ti=!1):ti=!0;break;case pt.CODE_SHIFT:Ct=!0,Re=pt.CODE_CODE_B;break;case pt.CODE_CODE_B:Re=pt.CODE_CODE_B;break;case pt.CODE_CODE_C:Re=pt.CODE_CODE_C;break;case pt.CODE_STOP:ot=!0;break}break;case pt.CODE_CODE_B:if(Pn<96)ti===Ns?Dt+=String.fromCharCode(32+Pn):Dt+=String.fromCharCode(32+Pn+128),ti=!1;else switch(Pn!==pt.CODE_STOP&&(Ar=!1),Pn){case pt.CODE_FNC_1:U&&(Dt.length===0?Dt+="]C1":Dt+="");break;case pt.CODE_FNC_2:case pt.CODE_FNC_3:break;case pt.CODE_FNC_4_B:!Ns&&ti?(Ns=!0,ti=!1):Ns&&ti?(Ns=!1,ti=!1):ti=!0;break;case pt.CODE_SHIFT:Ct=!0,Re=pt.CODE_CODE_A;break;case pt.CODE_CODE_A:Re=pt.CODE_CODE_A;break;case pt.CODE_CODE_C:Re=pt.CODE_CODE_C;break;case pt.CODE_STOP:ot=!0;break}break;case pt.CODE_CODE_C:if(Pn<100)Pn<10&&(Dt+="0"),Dt+=Pn;else switch(Pn!==pt.CODE_STOP&&(Ar=!1),Pn){case pt.CODE_FNC_1:U&&(Dt.length===0?Dt+="]C1":Dt+="");break;case pt.CODE_CODE_A:Re=pt.CODE_CODE_A;break;case pt.CODE_CODE_B:Re=pt.CODE_CODE_B;break;case pt.CODE_STOP:ot=!0;break}break}Oi&&(Re=Re===pt.CODE_CODE_A?pt.CODE_CODE_B:pt.CODE_CODE_A)}const mc=Et-sn;if(Et=E.getNextUnset(Et),!E.isRange(Et,Math.min(E.getSize(),Et+(Et-sn)/2),!1))throw new G;if(xr-=Nr*Jt,xr%103!==Jt)throw new g;const ro=Dt.length;if(ro===0)throw new G;ro>0&&Ar&&(Re===pt.CODE_CODE_C?Dt=Dt.substring(0,ro-2):Dt=Dt.substring(0,ro-1));const so=(H[1]+H[0])/2,pa=sn+mc/2,Ta=Ee.length,Xo=new Uint8Array(Ta);for(let Oi=0;Oi<Ta;Oi++)Xo[Oi]=Ee[Oi];const kd=[new St(so,w),new St(pa,w)];return new xe(Dt,Xo,0,kd,ge.CODE_128,new Date().getTime())}}pt.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])],pt.MAX_AVG_VARIANCE=.25,pt.MAX_INDIVIDUAL_VARIANCE=.7,pt.CODE_SHIFT=98,pt.CODE_CODE_C=99,pt.CODE_CODE_B=100,pt.CODE_CODE_A=101,pt.CODE_FNC_1=102,pt.CODE_FNC_2=97,pt.CODE_FNC_3=96,pt.CODE_FNC_4_A=101,pt.CODE_FNC_4_B=100,pt.CODE_START_A=103,pt.CODE_START_B=104,pt.CODE_START_C=105,pt.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,O){let U=this.counters;U.fill(0),this.decodeRowResult="";let H=We.findAsteriskPattern(E,U),Z=E.getNextSet(H[1]),ue=E.getSize(),Ee,Re;do{We.recordPattern(E,Z,U);let Yt=We.toNarrowWidePattern(U);if(Yt<0)throw new G;Ee=We.patternToChar(Yt),this.decodeRowResult+=Ee,Re=Z;for(let Jt of U)Z+=Jt;Z=E.getNextSet(Z)}while(Ee!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let ot=0;for(let Yt of U)ot+=Yt;let Ct=Z-Re-ot;if(Z!==ue&&Ct*2<ot)throw new G;if(this.usingCheckDigit){let Yt=this.decodeRowResult.length-1,Jt=0;for(let Pn=0;Pn<Yt;Pn++)Jt+=We.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(Pn));if(this.decodeRowResult.charAt(Yt)!==We.ALPHABET_STRING.charAt(Jt%43))throw new g;this.decodeRowResult=this.decodeRowResult.substring(0,Yt)}if(this.decodeRowResult.length===0)throw new G;let Dt;this.extendedMode?Dt=We.decodeExtended(this.decodeRowResult):Dt=this.decodeRowResult;let sn=(H[1]+H[0])/2,Et=Re+ot/2;return new xe(Dt,null,0,[new St(sn,w),new St(Et,w)],ge.CODE_39,new Date().getTime())}static findAsteriskPattern(w,E){let O=w.getSize(),U=w.getNextSet(0),H=0,Z=U,ue=!1,Ee=E.length;for(let Re=U;Re<O;Re++)if(w.get(Re)!==ue)E[H]++;else{if(H===Ee-1){if(this.toNarrowWidePattern(E)===We.ASTERISK_ENCODING&&w.isRange(Math.max(0,Z-Math.floor((Re-Z)/2)),Z,!1))return[Z,Re];Z+=E[0]+E[1],E.copyWithin(0,2,2+H-1),E[H-1]=0,E[H]=0,H--}else H++;E[H]=1,ue=!ue}throw new G}static toNarrowWidePattern(w){let E=w.length,O=0,U;do{let H=2147483647;for(let Ee of w)Ee<H&&Ee>O&&(H=Ee);O=H,U=0;let Z=0,ue=0;for(let Ee=0;Ee<E;Ee++){let Re=w[Ee];Re>O&&(ue|=1<<E-1-Ee,U++,Z+=Re)}if(U===3){for(let Ee=0;Ee<E&&U>0;Ee++){let Re=w[Ee];if(Re>O&&(U--,Re*2>=Z))return-1}return ue}}while(U>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,O="";for(let U=0;U<E;U++){let H=w.charAt(U);if(H==="+"||H==="$"||H==="%"||H==="/"){let Z=w.charAt(U+1),ue="\0";switch(H){case"+":if(Z>="A"&&Z<="Z")ue=String.fromCharCode(Z.charCodeAt(0)+32);else throw new L;break;case"$":if(Z>="A"&&Z<="Z")ue=String.fromCharCode(Z.charCodeAt(0)-64);else throw new L;break;case"%":if(Z>="A"&&Z<="E")ue=String.fromCharCode(Z.charCodeAt(0)-38);else if(Z>="F"&&Z<="J")ue=String.fromCharCode(Z.charCodeAt(0)-11);else if(Z>="K"&&Z<="O")ue=String.fromCharCode(Z.charCodeAt(0)+16);else if(Z>="P"&&Z<="T")ue=String.fromCharCode(Z.charCodeAt(0)+43);else if(Z==="U")ue="\0";else if(Z==="V")ue="@";else if(Z==="W")ue="`";else if(Z==="X"||Z==="Y"||Z==="Z")ue="";else throw new L;break;case"/":if(Z>="A"&&Z<="O")ue=String.fromCharCode(Z.charCodeAt(0)-32);else if(Z==="Z")ue=":";else throw new L;break}O+=ue,U++}else O+=H}return O}}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 It extends Vt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(w,E,O){let U=this.decodeStart(E),H=this.decodeEnd(E),Z=new re;It.decodeMiddle(E,U[1],H[0],Z);let ue=Z.toString(),Ee=null;O!=null&&(Ee=O.get($.ALLOWED_LENGTHS)),Ee==null&&(Ee=It.DEFAULT_ALLOWED_LENGTHS);let Re=ue.length,ot=!1,Ct=0;for(let Et of Ee){if(Re===Et){ot=!0;break}Et>Ct&&(Ct=Et)}if(!ot&&Re>Ct&&(ot=!0),!ot)throw new L;const Dt=[new St(U[1],w),new St(H[0],w)];return new xe(ue,null,0,Dt,ge.ITF,new Date().getTime())}static decodeMiddle(w,E,O,U){let H=new Int32Array(10),Z=new Int32Array(5),ue=new Int32Array(5);for(H.fill(0),Z.fill(0),ue.fill(0);E<O;){Vt.recordPattern(w,E,H);for(let Re=0;Re<5;Re++){let ot=2*Re;Z[Re]=H[ot],ue[Re]=H[ot+1]}let Ee=It.decodeDigit(Z);U.append(Ee.toString()),Ee=this.decodeDigit(ue),U.append(Ee.toString()),H.forEach(function(Re){E+=Re})}}decodeStart(w){let E=It.skipWhiteSpace(w),O=It.findGuardPattern(w,E,It.START_PATTERN);return this.narrowLineWidth=(O[1]-O[0])/4,this.validateQuietZone(w,O[0]),O}validateQuietZone(w,E){let O=this.narrowLineWidth*10;O=O<E?O:E;for(let U=E-1;O>0&&U>=0&&!w.get(U);U--)O--;if(O!==0)throw new G}static skipWhiteSpace(w){const E=w.getSize(),O=w.getNextSet(0);if(O===E)throw new G;return O}decodeEnd(w){w.reverse();try{let E=It.skipWhiteSpace(w),O;try{O=It.findGuardPattern(w,E,It.END_PATTERN_REVERSED[0])}catch(H){H instanceof G&&(O=It.findGuardPattern(w,E,It.END_PATTERN_REVERSED[1]))}this.validateQuietZone(w,O[0]);let U=O[0];return O[0]=w.getSize()-O[1],O[1]=w.getSize()-U,O}finally{w.reverse()}}static findGuardPattern(w,E,O){let U=O.length,H=new Int32Array(U),Z=w.getSize(),ue=!1,Ee=0,Re=E;H.fill(0);for(let ot=E;ot<Z;ot++)if(w.get(ot)!==ue)H[Ee]++;else{if(Ee===U-1){if(Vt.patternMatchVariance(H,O,It.MAX_INDIVIDUAL_VARIANCE)<It.MAX_AVG_VARIANCE)return[Re,ot];Re+=H[0]+H[1],v.arraycopy(H,2,H,0,Ee-1),H[Ee-1]=0,H[Ee]=0,Ee--}else Ee++;H[Ee]=1,ue=!ue}throw new G}static decodeDigit(w){let E=It.MAX_AVG_VARIANCE,O=-1,U=It.PATTERNS.length;for(let H=0;H<U;H++){let Z=It.PATTERNS[H],ue=Vt.patternMatchVariance(w,Z,It.MAX_INDIVIDUAL_VARIANCE);ue<E?(E=ue,O=H):ue===E&&(O=-1)}if(O>=0)return O%10;throw new G}}It.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])],It.MAX_AVG_VARIANCE=.38,It.MAX_INDIVIDUAL_VARIANCE=.5,It.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],It.START_PATTERN=Int32Array.from([1,1,1,1]),It.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Ge extends Vt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(w){let E=!1,O,U=0,H=Int32Array.from([0,0,0]);for(;!E;){H=Int32Array.from([0,0,0]),O=Ge.findGuardPattern(w,U,!1,this.START_END_PATTERN,H);let Z=O[0];U=O[1];let ue=Z-(U-Z);ue>=0&&(E=w.isRange(ue,Z,!1))}return O}static checkChecksum(w){return Ge.checkStandardUPCEANChecksum(w)}static checkStandardUPCEANChecksum(w){let E=w.length;if(E===0)return!1;let O=parseInt(w.charAt(E-1),10);return Ge.getStandardUPCEANChecksum(w.substring(0,E-1))===O}static getStandardUPCEANChecksum(w){let E=w.length,O=0;for(let U=E-1;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}O*=3;for(let U=E-2;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}return(1e3-O)%10}static decodeEnd(w,E){return Ge.findGuardPattern(w,E,!1,Ge.START_END_PATTERN,new Int32Array(Ge.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(w,E,O,U){return this.findGuardPattern(w,E,O,U,new Int32Array(U.length))}static findGuardPattern(w,E,O,U,H){let Z=w.getSize();E=O?w.getNextUnset(E):w.getNextSet(E);let ue=0,Ee=E,Re=U.length,ot=O;for(let Ct=E;Ct<Z;Ct++)if(w.get(Ct)!==ot)H[ue]++;else{if(ue===Re-1){if(Vt.patternMatchVariance(H,U,Ge.MAX_INDIVIDUAL_VARIANCE)<Ge.MAX_AVG_VARIANCE)return Int32Array.from([Ee,Ct]);Ee+=H[0]+H[1];let Dt=H.slice(2,H.length-1);for(let sn=0;sn<ue-1;sn++)H[sn]=Dt[sn];H[ue-1]=0,H[ue]=0,ue--}else ue++;H[ue]=1,ot=!ot}throw new G}static decodeDigit(w,E,O,U){this.recordPattern(w,O,E);let H=this.MAX_AVG_VARIANCE,Z=-1,ue=U.length;for(let Ee=0;Ee<ue;Ee++){let Re=U[Ee],ot=Vt.patternMatchVariance(E,Re,Ge.MAX_INDIVIDUAL_VARIANCE);ot<H&&(H=ot,Z=Ee)}if(Z>=0)return Z;throw new G}}Ge.MAX_AVG_VARIANCE=.48,Ge.MAX_INDIVIDUAL_VARIANCE=.7,Ge.START_END_PATTERN=Int32Array.from([1,1,1]),Ge.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ge.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ge.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,O){let U=this.decodeRowStringBuffer,H=this.decodeMiddle(E,O,U),Z=U.toString(),ue=ct.parseExtensionString(Z),Ee=[new St((O[0]+O[1])/2,w),new St(H,w)],Re=new xe(Z,null,0,Ee,ge.UPC_EAN_EXTENSION,new Date().getTime());return ue!=null&&Re.putAllMetadata(ue),Re}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Z=E[1],ue=0;for(let Re=0;Re<5&&Z<H;Re++){let ot=Ge.decodeDigit(w,U,Z,Ge.L_AND_G_PATTERNS);O+=String.fromCharCode(48+ot%10);for(let Ct of U)Z+=Ct;ot>=10&&(ue|=1<<4-Re),Re!==4&&(Z=w.getNextSet(Z),Z=w.getNextUnset(Z))}if(O.length!==5)throw new G;let Ee=this.determineCheckDigit(ue);if(ct.extensionChecksum(O.toString())!==Ee)throw new G;return Z}static extensionChecksum(w){let E=w.length,O=0;for(let U=E-2;U>=0;U-=2)O+=w.charAt(U).charCodeAt(0)-48;O*=3;for(let U=E-1;U>=0;U-=2)O+=w.charAt(U).charCodeAt(0)-48;return O*=3,O%10}determineCheckDigit(w){for(let E=0;E<10;E++)if(w===this.CHECK_DIGIT_ENCODINGS[E])return E;throw new 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 O=parseInt(w.substring(1)),U=(O/100).toString(),H=O%100,Z=H<10?"0"+H:H.toString();return E+U+"."+Z}}class vt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(w,E,O){let U=this.decodeRowStringBuffer,H=this.decodeMiddle(E,O,U),Z=U.toString(),ue=vt.parseExtensionString(Z),Ee=[new St((O[0]+O[1])/2,w),new St(H,w)],Re=new xe(Z,null,0,Ee,ge.UPC_EAN_EXTENSION,new Date().getTime());return ue!=null&&Re.putAllMetadata(ue),Re}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Z=E[1],ue=0;for(let Ee=0;Ee<2&&Z<H;Ee++){let Re=Ge.decodeDigit(w,U,Z,Ge.L_AND_G_PATTERNS);O+=String.fromCharCode(48+Re%10);for(let ot of U)Z+=ot;Re>=10&&(ue|=1<<1-Ee),Ee!==1&&(Z=w.getNextSet(Z),Z=w.getNextUnset(Z))}if(O.length!==2)throw new G;if(parseInt(O.toString())%4!==ue)throw new G;return Z}static parseExtensionString(w){return w.length!==2?null:new Map([[je.ISSUE_NUMBER,parseInt(w)]])}}class Ht{static decodeRow(w,E,O){let U=Ge.findGuardPattern(E,O,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ct().decodeRow(w,E,U)}catch{return new vt().decodeRow(w,E,U)}}}Ht.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Rt extends Ge{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],O=new Int32Array(E.length);for(let U=0;U<E.length;U++)O[U]=E[E.length-U-1];Rt.L_AND_G_PATTERNS[w]=O}}decodeRow(w,E,O){let U=Rt.findStartGuardPattern(E),H=O==null?null:O.get($.NEED_RESULT_POINT_CALLBACK);if(H!=null){const Ar=new St((U[0]+U[1])/2,w);H.foundPossibleResultPoint(Ar)}let Z=this.decodeMiddle(E,U,this.decodeRowStringBuffer),ue=Z.rowOffset,Ee=Z.resultString;if(H!=null){const Ar=new St(ue,w);H.foundPossibleResultPoint(Ar)}let Re=this.decodeEnd(E,ue);if(H!=null){const Ar=new St((Re[0]+Re[1])/2,w);H.foundPossibleResultPoint(Ar)}let ot=Re[1],Ct=ot+(ot-Re[0]);if(Ct>=E.getSize()||!E.isRange(ot,Ct,!1))throw new G;let Dt=Ee.toString();if(Dt.length<8)throw new L;if(!Rt.checkChecksum(Dt))throw new g;let sn=(U[1]+U[0])/2,Et=(Re[1]+Re[0])/2,Yt=this.getBarcodeFormat(),Jt=[new St(sn,w),new St(Et,w)],Pn=new xe(Dt,null,0,Jt,Yt,new Date().getTime()),xr=0;try{let Ar=Ht.decodeRow(w,E,Re[1]);Pn.putMetadata(je.UPC_EAN_EXTENSION,Ar.getText()),Pn.putAllMetadata(Ar.getResultMetadata()),Pn.addResultPoints(Ar.getResultPoints()),xr=Ar.getText().length}catch{}let Nr=O==null?null:O.get($.ALLOWED_EAN_EXTENSIONS);if(Nr!=null){let Ar=!1;for(let Ns in Nr)if(xr.toString()===Ns){Ar=!0;break}if(!Ar)throw new G}return Pn}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 O=parseInt(w.charAt(E-1),10);return Rt.getStandardUPCEANChecksum(w.substring(0,E-1))===O}static getStandardUPCEANChecksum(w){let E=w.length,O=0;for(let U=E-1;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}O*=3;for(let U=E-2;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}return(1e3-O)%10}}class mn extends Rt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Z=E[1],ue=0;for(let Re=0;Re<6&&Z<H;Re++){let ot=Rt.decodeDigit(w,U,Z,Rt.L_AND_G_PATTERNS);O+=String.fromCharCode(48+ot%10);for(let Ct of U)Z+=Ct;ot>=10&&(ue|=1<<5-Re)}O=mn.determineFirstDigit(O,ue),Z=Rt.findGuardPattern(w,Z,!0,Rt.MIDDLE_PATTERN,new Int32Array(Rt.MIDDLE_PATTERN.length).fill(0))[1];for(let Re=0;Re<6&&Z<H;Re++){let ot=Rt.decodeDigit(w,U,Z,Rt.L_PATTERNS);O+=String.fromCharCode(48+ot);for(let Ct of U)Z+=Ct}return{rowOffset:Z,resultString:O}}getBarcodeFormat(){return ge.EAN_13}static determineFirstDigit(w,E){for(let O=0;O<10;O++)if(E===this.FIRST_DIGIT_ENCODINGS[O])return w=String.fromCharCode(48+O)+w,w;throw new G}}mn.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class un extends Rt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,O){const U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Z=E[1];for(let Ee=0;Ee<4&&Z<H;Ee++){let Re=Rt.decodeDigit(w,U,Z,Rt.L_PATTERNS);O+=String.fromCharCode(48+Re);for(let ot of U)Z+=ot}Z=Rt.findGuardPattern(w,Z,!0,Rt.MIDDLE_PATTERN,new Int32Array(Rt.MIDDLE_PATTERN.length).fill(0))[1];for(let Ee=0;Ee<4&&Z<H;Ee++){let Re=Rt.decodeDigit(w,U,Z,Rt.L_PATTERNS);O+=String.fromCharCode(48+Re);for(let ot of U)Z+=ot}return{rowOffset:Z,resultString:O}}getBarcodeFormat(){return ge.EAN_8}}class yn extends Rt{constructor(){super(...arguments),this.ean13Reader=new mn}getBarcodeFormat(){return ge.UPC_A}decode(w,E){return this.maybeReturnResult(this.ean13Reader.decode(w))}decodeRow(w,E,O){return this.maybeReturnResult(this.ean13Reader.decodeRow(w,E,O))}decodeMiddle(w,E,O){return this.ean13Reader.decodeMiddle(w,E,O)}maybeReturnResult(w){let E=w.getText();if(E.charAt(0)==="0"){let O=new xe(E.substring(1),null,null,w.getResultPoints(),ge.UPC_A);return w.getResultMetadata()!=null&&O.putAllMetadata(w.getResultMetadata()),O}else throw new G}reset(){this.ean13Reader.reset()}}class _n extends Rt{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(w,E,O){const U=this.decodeMiddleCounters.map(Re=>Re);U[0]=0,U[1]=0,U[2]=0,U[3]=0;const H=w.getSize();let Z=E[1],ue=0;for(let Re=0;Re<6&&Z<H;Re++){const ot=_n.decodeDigit(w,U,Z,_n.L_AND_G_PATTERNS);O+=String.fromCharCode(48+ot%10);for(let Ct of U)Z+=Ct;ot>=10&&(ue|=1<<5-Re)}let Ee=_n.determineNumSysAndCheckDigit(O,ue);return{rowOffset:Z,resultString:Ee}}decodeEnd(w,E){return _n.findGuardPatternWithoutCounters(w,E,!0,_n.MIDDLE_END_PATTERN)}checkChecksum(w){return Rt.checkChecksum(_n.convertUPCEtoUPCA(w))}static determineNumSysAndCheckDigit(w,E){for(let O=0;O<=1;O++)for(let U=0;U<10;U++)if(E===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[O][U]){let H=String.fromCharCode(48+O),Z=String.fromCharCode(48+U);return H+w+Z}throw G.getNotFoundInstance()}getBarcodeFormat(){return ge.UPC_E}static convertUPCEtoUPCA(w){const E=w.slice(1,7).split("").map(H=>H.charCodeAt(0)),O=new re;O.append(w.charAt(0));let U=E[5];switch(U){case 0:case 1:case 2:O.appendChars(E,0,2),O.append(U),O.append("0000"),O.appendChars(E,2,3);break;case 3:O.appendChars(E,0,3),O.append("00000"),O.appendChars(E,3,2);break;case 4:O.appendChars(E,0,4),O.append("00000"),O.append(E[4]);break;default:O.appendChars(E,0,5),O.append("0000"),O.append(U);break}return w.length>=8&&O.append(w.charAt(7)),O.toString()}}_n.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_n.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 In extends Vt{constructor(w){super();let E=w==null?null:w.get($.POSSIBLE_FORMATS),O=[];r(E)?(O.push(new mn),O.push(new yn),O.push(new un),O.push(new _n)):(E.indexOf(ge.EAN_13)>-1&&O.push(new mn),E.indexOf(ge.UPC_A)>-1&&O.push(new yn),E.indexOf(ge.EAN_8)>-1&&O.push(new un),E.indexOf(ge.UPC_E)>-1&&O.push(new _n)),this.readers=O}decodeRow(w,E,O){for(let U of this.readers)try{const H=U.decodeRow(w,E,O),Z=H.getBarcodeFormat()===ge.EAN_13&&H.getText().charAt(0)==="0",ue=O==null?null:O.get($.POSSIBLE_FORMATS),Ee=ue==null||ue.includes(ge.UPC_A);if(Z&&Ee){const Re=H.getRawBytes(),ot=new xe(H.getText().substring(1),Re,Re?Re.length:null,H.getResultPoints(),ge.UPC_A);return ot.putAllMetadata(H.getResultMetadata()),ot}return H}catch{}throw new G}reset(){for(let w of this.readers)w.reset()}}class Sn 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 O=0;O<E.length;O++)if(Vt.patternMatchVariance(w,E[O],Sn.MAX_INDIVIDUAL_VARIANCE)<Sn.MAX_AVG_VARIANCE)return O;throw new G}static count(w){return xt.sum(new Int32Array(w))}static increment(w,E){let O=0,U=E[0];for(let H=1;H<w.length;H++)E[H]>U&&(U=E[H],O=H);w[O]++}static decrement(w,E){let O=0,U=E[0];for(let H=1;H<w.length;H++)E[H]<U&&(U=E[H],O=H);w[O]--}static isFinderPattern(w){let E=w[0]+w[1],O=E+w[2]+w[3],U=E/O;if(U>=Sn.MIN_FINDER_PATTERN_RATIO&&U<=Sn.MAX_FINDER_PATTERN_RATIO){let H=Number.MAX_SAFE_INTEGER,Z=Number.MIN_SAFE_INTEGER;for(let ue of w)ue>Z&&(Z=ue),ue<H&&(H=ue);return Z<10*H}return!1}}Sn.MAX_AVG_VARIANCE=.2,Sn.MAX_INDIVIDUAL_VARIANCE=.45,Sn.MIN_FINDER_PATTERN_RATIO=9.5/12,Sn.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 Xn{constructor(w,E,O,U,H){this.value=w,this.startEnd=E,this.value=w,this.startEnd=E,this.resultPoints=new Array,this.resultPoints.push(new St(O,H)),this.resultPoints.push(new St(U,H))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(w){if(!(w instanceof Xn))return!1;const E=w;return this.value===E.value}hashCode(){return this.value}}class zn{constructor(){}static getRSSvalue(w,E,O){let U=0;for(let Ee of w)U+=Ee;let H=0,Z=0,ue=w.length;for(let Ee=0;Ee<ue-1;Ee++){let Re;for(Re=1,Z|=1<<Ee;Re<w[Ee];Re++,Z&=~(1<<Ee)){let ot=zn.combins(U-Re-1,ue-Ee-2);if(O&&Z===0&&U-Re-(ue-Ee-1)>=ue-Ee-1&&(ot-=zn.combins(U-Re-(ue-Ee),ue-Ee-2)),ue-Ee-1>1){let Ct=0;for(let Dt=U-Re-(ue-Ee-2);Dt>E;Dt--)Ct+=zn.combins(U-Re-Dt-1,ue-Ee-3);ot-=Ct*(ue-1-Ee)}else U-Re>E&&ot--;H+=ot}U-=Re}return H}static combins(w,E){let O,U;w-E>E?(U=E,O=w-E):(U=w-E,O=E);let H=1,Z=1;for(let ue=w;ue>O;ue--)H*=ue,Z<=U&&(H/=Z,Z++);for(;Z<=U;)H/=Z,Z++;return H}}class Kn{static buildBitArray(w){let E=w.length*2-1;w[w.length-1].getRightChar()==null&&(E-=1);let O=12*E,U=new M(O),H=0,ue=w[0].getRightChar().getValue();for(let Ee=11;Ee>=0;--Ee)ue&1<<Ee&&U.set(H),H++;for(let Ee=1;Ee<w.length;++Ee){let Re=w[Ee],ot=Re.getLeftChar().getValue();for(let Ct=11;Ct>=0;--Ct)ot&1<<Ct&&U.set(H),H++;if(Re.getRightChar()!=null){let Ct=Re.getRightChar().getValue();for(let Dt=11;Dt>=0;--Dt)Ct&1<<Dt&&U.set(H),H++}}return U}}class jn{constructor(w,E){E?this.decodedInformation=null:(this.finished=w,this.decodedInformation=E)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class De{constructor(w){this.newPosition=w}getNewPosition(){return this.newPosition}}class pe extends De{constructor(w,E){super(w),this.value=E}getValue(){return this.value}isFNC1(){return this.value===pe.FNC1}}pe.FNC1="$";class qe extends De{constructor(w,E,O){super(w),O?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=E}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Ae extends De{constructor(w,E,O){if(super(w),E<0||E>10||O<0||O>10)throw new L;this.firstDigit=E,this.secondDigit=O}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Ae.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ae.FNC1}isAnyFNC1(){return this.firstDigit===Ae.FNC1||this.secondDigit===Ae.FNC1}}Ae.FNC1=10;class ze{constructor(){}static parseFieldsInGeneralPurpose(w){if(!w)return null;if(w.length<2)throw new G;let E=w.substring(0,2);for(let H of ze.TWO_DIGIT_DATA_LENGTH)if(H[0]===E)return H[1]===ze.VARIABLE_LENGTH?ze.processVariableAI(2,H[2],w):ze.processFixedAI(2,H[1],w);if(w.length<3)throw new G;let O=w.substring(0,3);for(let H of ze.THREE_DIGIT_DATA_LENGTH)if(H[0]===O)return H[1]===ze.VARIABLE_LENGTH?ze.processVariableAI(3,H[2],w):ze.processFixedAI(3,H[1],w);for(let H of ze.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(H[0]===O)return H[1]===ze.VARIABLE_LENGTH?ze.processVariableAI(4,H[2],w):ze.processFixedAI(4,H[1],w);if(w.length<4)throw new G;let U=w.substring(0,4);for(let H of ze.FOUR_DIGIT_DATA_LENGTH)if(H[0]===U)return H[1]===ze.VARIABLE_LENGTH?ze.processVariableAI(4,H[2],w):ze.processFixedAI(4,H[1],w);throw new G}static processFixedAI(w,E,O){if(O.length<w)throw new G;let U=O.substring(0,w);if(O.length<w+E)throw new G;let H=O.substring(w,w+E),Z=O.substring(w+E),ue="("+U+")"+H,Ee=ze.parseFieldsInGeneralPurpose(Z);return Ee==null?ue:ue+Ee}static processVariableAI(w,E,O){let U=O.substring(0,w),H;O.length<w+E?H=O.length:H=w+E;let Z=O.substring(w,H),ue=O.substring(H),Ee="("+U+")"+Z,Re=ze.parseFieldsInGeneralPurpose(ue);return Re==null?Ee:Ee+Re}}ze.VARIABLE_LENGTH=[],ze.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ze.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ze.VARIABLE_LENGTH,20],["22",ze.VARIABLE_LENGTH,29],["30",ze.VARIABLE_LENGTH,8],["37",ze.VARIABLE_LENGTH,8],["90",ze.VARIABLE_LENGTH,30],["91",ze.VARIABLE_LENGTH,30],["92",ze.VARIABLE_LENGTH,30],["93",ze.VARIABLE_LENGTH,30],["94",ze.VARIABLE_LENGTH,30],["95",ze.VARIABLE_LENGTH,30],["96",ze.VARIABLE_LENGTH,30],["97",ze.VARIABLE_LENGTH,3],["98",ze.VARIABLE_LENGTH,30],["99",ze.VARIABLE_LENGTH,30]],ze.THREE_DIGIT_DATA_LENGTH=[["240",ze.VARIABLE_LENGTH,30],["241",ze.VARIABLE_LENGTH,30],["242",ze.VARIABLE_LENGTH,6],["250",ze.VARIABLE_LENGTH,30],["251",ze.VARIABLE_LENGTH,30],["253",ze.VARIABLE_LENGTH,17],["254",ze.VARIABLE_LENGTH,20],["400",ze.VARIABLE_LENGTH,30],["401",ze.VARIABLE_LENGTH,30],["402",17],["403",ze.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ze.VARIABLE_LENGTH,20],["421",ze.VARIABLE_LENGTH,15],["422",3],["423",ze.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ze.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",ze.VARIABLE_LENGTH,15],["391",ze.VARIABLE_LENGTH,18],["392",ze.VARIABLE_LENGTH,15],["393",ze.VARIABLE_LENGTH,18],["703",ze.VARIABLE_LENGTH,30]],ze.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ze.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ze.VARIABLE_LENGTH,20],["8003",ze.VARIABLE_LENGTH,30],["8004",ze.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ze.VARIABLE_LENGTH,30],["8008",ze.VARIABLE_LENGTH,12],["8018",18],["8020",ze.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ze.VARIABLE_LENGTH,70],["8200",ze.VARIABLE_LENGTH,70]];class zt{constructor(w){this.buffer=new re,this.information=w}decodeAllCodes(w,E){let O=E,U=null;do{let H=this.decodeGeneralPurposeField(O,U),Z=ze.parseFieldsInGeneralPurpose(H.getNewString());if(Z!=null&&w.append(Z),H.isRemaining()?U=""+H.getRemainingValue():U=null,O===H.getNewPosition())break;O=H.getNewPosition()}while(!0);return w.toString()}isStillNumeric(w){if(w+7>this.information.getSize())return w+4<=this.information.getSize();for(let E=w;E<w+3;++E)if(this.information.get(E))return!0;return this.information.get(w+3)}decodeNumeric(w){if(w+7>this.information.getSize()){let H=this.extractNumericValueFromBitArray(w,4);return H===0?new Ae(this.information.getSize(),Ae.FNC1,Ae.FNC1):new Ae(this.information.getSize(),H-1,Ae.FNC1)}let E=this.extractNumericValueFromBitArray(w,7),O=(E-8)/11,U=(E-8)%11;return new Ae(w+7,O,U)}extractNumericValueFromBitArray(w,E){return zt.extractNumericValueFromBitArray(this.information,w,E)}static extractNumericValueFromBitArray(w,E,O){let U=0;for(let H=0;H<O;++H)w.get(E+H)&&(U|=1<<O-H-1);return U}decodeGeneralPurposeField(w,E){this.buffer.setLengthToZero(),E!=null&&this.buffer.append(E),this.current.setPosition(w);let O=this.parseBlocks();return O!=null&&O.isRemaining()?new qe(this.current.getPosition(),this.buffer.toString(),O.getRemainingValue()):new qe(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let w,E;do{let O=this.current.getPosition();if(this.current.isAlpha()?(E=this.parseAlphaBlock(),w=E.isFinished()):this.current.isIsoIec646()?(E=this.parseIsoIec646Block(),w=E.isFinished()):(E=this.parseNumericBlock(),w=E.isFinished()),!(O!==this.current.getPosition())&&!w)break}while(!w);return E.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let w=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(w.getNewPosition()),w.isFirstDigitFNC1()){let E;return w.isSecondDigitFNC1()?E=new qe(this.current.getPosition(),this.buffer.toString()):E=new qe(this.current.getPosition(),this.buffer.toString(),w.getSecondDigit()),new jn(!0,E)}if(this.buffer.append(w.getFirstDigit()),w.isSecondDigitFNC1()){let E=new qe(this.current.getPosition(),this.buffer.toString());return new jn(!0,E)}this.buffer.append(w.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new jn(!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 qe(this.current.getPosition(),this.buffer.toString());return new jn(!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 jn(!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 qe(this.current.getPosition(),this.buffer.toString());return new jn(!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 jn(!1)}isStillIsoIec646(w){if(w+5>this.information.getSize())return!1;let E=this.extractNumericValueFromBitArray(w,5);if(E>=5&&E<16)return!0;if(w+7>this.information.getSize())return!1;let O=this.extractNumericValueFromBitArray(w,7);if(O>=64&&O<116)return!0;if(w+8>this.information.getSize())return!1;let U=this.extractNumericValueFromBitArray(w,8);return U>=232&&U<253}decodeIsoIec646(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new pe(w+5,pe.FNC1);if(E>=5&&E<15)return new pe(w+5,"0"+(E-5));let O=this.extractNumericValueFromBitArray(w,7);if(O>=64&&O<90)return new pe(w+7,""+(O+1));if(O>=90&&O<116)return new pe(w+7,""+(O+7));let U=this.extractNumericValueFromBitArray(w,8),H;switch(U){case 232:H="!";break;case 233:H='"';break;case 234:H="%";break;case 235:H="&";break;case 236:H="'";break;case 237:H="(";break;case 238:H=")";break;case 239:H="*";break;case 240:H="+";break;case 241:H=",";break;case 242:H="-";break;case 243:H=".";break;case 244:H="/";break;case 245:H=":";break;case 246:H=";";break;case 247:H="<";break;case 248:H="=";break;case 249:H=">";break;case 250:H="?";break;case 251:H="_";break;case 252:H=" ";break;default:throw new L}return new pe(w+8,H)}isStillAlpha(w){if(w+5>this.information.getSize())return!1;let E=this.extractNumericValueFromBitArray(w,5);if(E>=5&&E<16)return!0;if(w+6>this.information.getSize())return!1;let O=this.extractNumericValueFromBitArray(w,6);return O>=16&&O<63}decodeAlphanumeric(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new pe(w+5,pe.FNC1);if(E>=5&&E<15)return new pe(w+5,"0"+(E-5));let O=this.extractNumericValueFromBitArray(w,6);if(O>=32&&O<58)return new pe(w+6,""+(O+33));let U;switch(O){case 58:U="*";break;case 59:U=",";break;case 60:U="-";break;case 61:U=".";break;case 62:U="/";break;default:throw new st("Decoding invalid alphanumeric value: "+O)}return new pe(w+6,U)}isAlphaTo646ToAlphaLatch(w){if(w+1>this.information.getSize())return!1;for(let E=0;E<5&&E+w<this.information.getSize();++E)if(E===2){if(!this.information.get(w+2))return!1}else if(this.information.get(w+E))return!1;return!0}isAlphaOr646ToNumericLatch(w){if(w+3>this.information.getSize())return!1;for(let E=w;E<w+3;++E)if(this.information.get(E))return!1;return!0}isNumericToAlphaNumericLatch(w){if(w+1>this.information.getSize())return!1;for(let E=0;E<4&&E+w<this.information.getSize();++E)if(this.information.get(w+E))return!1;return!0}}class kt{constructor(w){this.information=w,this.generalDecoder=new zt(w)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class gt extends kt{constructor(w){super(w)}encodeCompressedGtin(w,E){w.append("(01)");let O=w.length();w.append("9"),this.encodeCompressedGtinWithoutAI(w,E,O)}encodeCompressedGtinWithoutAI(w,E,O){for(let U=0;U<4;++U){let H=this.getGeneralDecoder().extractNumericValueFromBitArray(E+10*U,10);H/100===0&&w.append("0"),H/10===0&&w.append("0"),w.append(H)}gt.appendCheckDigit(w,O)}static appendCheckDigit(w,E){let O=0;for(let U=0;U<13;U++){let H=w.charAt(U+E).charCodeAt(0)-48;O+=U&1?H:3*H}O=10-O%10,O===10&&(O=0),w.append(O)}}gt.GTIN_SIZE=40;class Mt extends gt{constructor(w){super(w)}parseInformation(){let w=new re;w.append("(01)");let E=w.length(),O=this.getGeneralDecoder().extractNumericValueFromBitArray(Mt.HEADER_SIZE,4);return w.append(O),this.encodeCompressedGtinWithoutAI(w,Mt.HEADER_SIZE+4,E),this.getGeneralDecoder().decodeAllCodes(w,Mt.HEADER_SIZE+44)}}Mt.HEADER_SIZE=4;class ln extends kt{constructor(w){super(w)}parseInformation(){let w=new re;return this.getGeneralDecoder().decodeAllCodes(w,ln.HEADER_SIZE)}}ln.HEADER_SIZE=5;class vn extends gt{constructor(w){super(w)}encodeCompressedWeight(w,E,O){let U=this.getGeneralDecoder().extractNumericValueFromBitArray(E,O);this.addWeightCode(w,U);let H=this.checkWeight(U),Z=1e5;for(let ue=0;ue<5;++ue)H/Z===0&&w.append("0"),Z/=10;w.append(H)}}class Wn extends vn{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()!=Wn.HEADER_SIZE+vn.GTIN_SIZE+Wn.WEIGHT_SIZE)throw new G;let w=new re;return this.encodeCompressedGtin(w,Wn.HEADER_SIZE),this.encodeCompressedWeight(w,Wn.HEADER_SIZE+vn.GTIN_SIZE,Wn.WEIGHT_SIZE),w.toString()}}Wn.HEADER_SIZE=5,Wn.WEIGHT_SIZE=15;class On extends Wn{constructor(w){super(w)}addWeightCode(w,E){w.append("(3103)")}checkWeight(w){return w}}class $t extends Wn{constructor(w){super(w)}addWeightCode(w,E){E<1e4?w.append("(3202)"):w.append("(3203)")}checkWeight(w){return w<1e4?w:w-1e4}}class Nn extends gt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<Nn.HEADER_SIZE+gt.GTIN_SIZE)throw new G;let w=new re;this.encodeCompressedGtin(w,Nn.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(Nn.HEADER_SIZE+gt.GTIN_SIZE,Nn.LAST_DIGIT_SIZE);w.append("(392"),w.append(E),w.append(")");let O=this.getGeneralDecoder().decodeGeneralPurposeField(Nn.HEADER_SIZE+gt.GTIN_SIZE+Nn.LAST_DIGIT_SIZE,null);return w.append(O.getNewString()),w.toString()}}Nn.HEADER_SIZE=8,Nn.LAST_DIGIT_SIZE=2;class Fn extends gt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<Fn.HEADER_SIZE+gt.GTIN_SIZE)throw new G;let w=new re;this.encodeCompressedGtin(w,Fn.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(Fn.HEADER_SIZE+gt.GTIN_SIZE,Fn.LAST_DIGIT_SIZE);w.append("(393"),w.append(E),w.append(")");let O=this.getGeneralDecoder().extractNumericValueFromBitArray(Fn.HEADER_SIZE+gt.GTIN_SIZE+Fn.LAST_DIGIT_SIZE,Fn.FIRST_THREE_DIGITS_SIZE);O/100==0&&w.append("0"),O/10==0&&w.append("0"),w.append(O);let U=this.getGeneralDecoder().decodeGeneralPurposeField(Fn.HEADER_SIZE+gt.GTIN_SIZE+Fn.LAST_DIGIT_SIZE+Fn.FIRST_THREE_DIGITS_SIZE,null);return w.append(U.getNewString()),w.toString()}}Fn.HEADER_SIZE=8,Fn.LAST_DIGIT_SIZE=2,Fn.FIRST_THREE_DIGITS_SIZE=10;class Tt extends vn{constructor(w,E,O){super(w),this.dateCode=O,this.firstAIdigits=E}parseInformation(){if(this.getInformation().getSize()!=Tt.HEADER_SIZE+Tt.GTIN_SIZE+Tt.WEIGHT_SIZE+Tt.DATE_SIZE)throw new G;let w=new re;return this.encodeCompressedGtin(w,Tt.HEADER_SIZE),this.encodeCompressedWeight(w,Tt.HEADER_SIZE+Tt.GTIN_SIZE,Tt.WEIGHT_SIZE),this.encodeCompressedDate(w,Tt.HEADER_SIZE+Tt.GTIN_SIZE+Tt.WEIGHT_SIZE),w.toString()}encodeCompressedDate(w,E){let O=this.getGeneralDecoder().extractNumericValueFromBitArray(E,Tt.DATE_SIZE);if(O==38400)return;w.append("("),w.append(this.dateCode),w.append(")");let U=O%32;O/=32;let H=O%12+1;O/=12;let Z=O;Z/10==0&&w.append("0"),w.append(Z),H/10==0&&w.append("0"),w.append(H),U/10==0&&w.append("0"),w.append(U)}addWeightCode(w,E){w.append("("),w.append(this.firstAIdigits),w.append(E/1e5),w.append(")")}checkWeight(w){return w%1e5}}Tt.HEADER_SIZE=8,Tt.WEIGHT_SIZE=20,Tt.DATE_SIZE=16;function pn(wt){try{if(wt.get(1))return new Mt(wt);if(!wt.get(2))return new ln(wt);switch(zt.extractNumericValueFromBitArray(wt,1,4)){case 4:return new On(wt);case 5:return new $t(wt)}switch(zt.extractNumericValueFromBitArray(wt,1,5)){case 12:return new Nn(wt);case 13:return new Fn(wt)}switch(zt.extractNumericValueFromBitArray(wt,1,7)){case 56:return new Tt(wt,"310","11");case 57:return new Tt(wt,"320","11");case 58:return new Tt(wt,"310","13");case 59:return new Tt(wt,"320","13");case 60:return new Tt(wt,"310","15");case 61:return new Tt(wt,"320","15");case 62:return new Tt(wt,"310","17");case 63:return new Tt(wt,"320","17")}}catch(w){throw console.log(w),new st("unknown decoder: "+wt)}}class ke{constructor(w,E,O,U){this.leftchar=w,this.rightchar=E,this.finderpattern=O,this.maybeLast=U}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(w,E){return w instanceof ke?ke.equalsOrNull(w.leftchar,E.leftchar)&&ke.equalsOrNull(w.rightchar,E.rightchar)&&ke.equalsOrNull(w.finderpattern,E.finderpattern):!1}static equalsOrNull(w,E){return w===null?E===null:ke.equals(w,E)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class m{constructor(w,E,O){this.pairs=w,this.rowNumber=E,this.wasReversed=O}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(w){return this.checkEqualitity(this,w)}toString(){return"{ "+this.pairs+" }"}equals(w,E){return w instanceof m?this.checkEqualitity(w,E)&&w.wasReversed===E.wasReversed:!1}checkEqualitity(w,E){if(!w||!E)return;let O;return w.forEach((U,H)=>{E.forEach(Z=>{U.getLeftChar().getValue()===Z.getLeftChar().getValue()&&U.getRightChar().getValue()===Z.getRightChar().getValue()&&U.getFinderPatter().getValue()===Z.getFinderPatter().getValue()&&(O=!0)})}),O}}class p extends Sn{constructor(w){super(...arguments),this.pairs=new Array(p.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=w===!0}decodeRow(w,E,O){this.pairs.length=0,this.startFromEven=!1;try{return p.constructResult(this.decodeRow2pairs(w,E))}catch(U){this.verbose&&console.log(U)}return this.pairs.length=0,this.startFromEven=!0,p.constructResult(this.decodeRow2pairs(w,E))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(w,E){let O=!1;for(;!O;)try{this.pairs.push(this.retrieveNextPair(E,this.pairs,w))}catch(H){if(H instanceof G){if(!this.pairs.length)throw new G;O=!0}}if(this.checkChecksum())return this.pairs;let U;if(this.rows.length?U=!0:U=!1,this.storeRow(w,!1),U){let H=this.checkRowsBoolean(!1);if(H!=null||(H=this.checkRowsBoolean(!0),H!=null))return H}throw new 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(O){this.verbose&&console.log(O)}return w&&(this.rows=this.rows.reverse()),E}checkRows(w,E){for(let O=E;O<this.rows.length;O++){let U=this.rows[O];this.pairs.length=0;for(let Z of w)this.pairs.push(Z.getPairs());if(this.pairs.push(U.getPairs()),!p.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let H=new Array(w);H.push(U);try{return this.checkRows(H,O+1)}catch(Z){this.verbose&&console.log(Z)}}throw new G}static isValidSequence(w){for(let E of p.FINDER_PATTERN_SEQUENCES){if(w.length>E.length)continue;let O=!0;for(let U=0;U<w.length;U++)if(w[U].getFinderPattern().getValue()!=E[U]){O=!1;break}if(O)return!0}return!1}storeRow(w,E){let O=0,U=!1,H=!1;for(;O<this.rows.length;){let Z=this.rows[O];if(Z.getRowNumber()>w){H=Z.isEquivalent(this.pairs);break}U=Z.isEquivalent(this.pairs),O++}H||U||p.isPartialRow(this.pairs,this.rows)||(this.rows.push(O,new m(this.pairs,w,E)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(w,E){for(let O of E)if(O.getPairs().length!==w.length){for(let U of O.getPairs())for(let H of w)if(ke.equals(U,H))break}}static isPartialRow(w,E){for(let O of E){let U=!0;for(let H of w){let Z=!1;for(let ue of O.getPairs())if(H.equals(ue)){Z=!0;break}if(!Z){U=!1;break}}if(U)return!0}return!1}getRows(){return this.rows}static constructResult(w){let E=Kn.buildBitArray(w),U=pn(E).parseInformation(),H=w[0].getFinderPattern().getResultPoints(),Z=w[w.length-1].getFinderPattern().getResultPoints(),ue=[H[0],H[1],Z[0],Z[1]];return new xe(U,null,null,ue,ge.RSS_EXPANDED,null)}checkChecksum(){let w=this.pairs.get(0),E=w.getLeftChar(),O=w.getRightChar();if(O==null)return!1;let U=O.getChecksumPortion(),H=2;for(let ue=1;ue<this.pairs.size();++ue){let Ee=this.pairs.get(ue);U+=Ee.getLeftChar().getChecksumPortion(),H++;let Re=Ee.getRightChar();Re!=null&&(U+=Re.getChecksumPortion(),H++)}return U%=211,211*(H-4)+U==E.getValue()}static getNextSecondBar(w,E){let O;return w.get(E)?(O=w.getNextUnset(E),O=w.getNextSet(O)):(O=w.getNextSet(E),O=w.getNextUnset(O)),O}retrieveNextPair(w,E,O){let U=E.length%2==0;this.startFromEven&&(U=!U);let H,Z=!0,ue=-1;do this.findNextPair(w,E,ue),H=this.parseFoundFinderPattern(w,O,U),H==null?ue=p.getNextSecondBar(w,this.startEnd[0]):Z=!1;while(Z);let Ee=this.decodeDataCharacter(w,H,U,!0);if(!this.isEmptyPair(E)&&E[E.length-1].mustBeLast())throw new G;let Re;try{Re=this.decodeDataCharacter(w,H,U,!1)}catch(ot){Re=null,this.verbose&&console.log(ot)}return new ke(Ee,Re,H,!0)}isEmptyPair(w){return w.length===0}findNextPair(w,E,O){let U=this.getDecodeFinderCounters();U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Z;O>=0?Z=O:this.isEmptyPair(E)?Z=0:Z=E[E.length-1].getFinderPattern().getStartEnd()[1];let ue=E.length%2!=0;this.startFromEven&&(ue=!ue);let Ee=!1;for(;Z<H&&(Ee=!w.get(Z),!!Ee);)Z++;let Re=0,ot=Z;for(let Ct=Z;Ct<H;Ct++)if(w.get(Ct)!=Ee)U[Re]++;else{if(Re==3){if(ue&&p.reverseCounters(U),p.isFinderPattern(U)){this.startEnd[0]=ot,this.startEnd[1]=Ct;return}ue&&p.reverseCounters(U),ot+=U[0]+U[1],U[0]=U[2],U[1]=U[3],U[2]=0,U[3]=0,Re--}else Re++;U[Re]=1,Ee=!Ee}throw new G}static reverseCounters(w){let E=w.length;for(let O=0;O<E/2;++O){let U=w[O];w[O]=w[E-O-1],w[E-O-1]=U}}parseFoundFinderPattern(w,E,O){let U,H,Z;if(O){let Re=this.startEnd[0]-1;for(;Re>=0&&!w.get(Re);)Re--;Re++,U=this.startEnd[0]-Re,H=Re,Z=this.startEnd[1]}else H=this.startEnd[0],Z=w.getNextUnset(this.startEnd[1]+1),U=Z-this.startEnd[1];let ue=this.getDecodeFinderCounters();v.arraycopy(ue,0,ue,1,ue.length-1),ue[0]=U;let Ee;try{Ee=this.parseFinderValue(ue,p.FINDER_PATTERNS)}catch{return null}return new Xn(Ee,[H,Z],H,Z,E)}decodeDataCharacter(w,E,O,U){let H=this.getDataCharacterCounters();for(let pa=0;pa<H.length;pa++)H[pa]=0;if(U)p.recordPatternInReverse(w,E.getStartEnd()[0],H);else{p.recordPattern(w,E.getStartEnd()[1],H);for(let pa=0,Ta=H.length-1;pa<Ta;pa++,Ta--){let Xo=H[pa];H[pa]=H[Ta],H[Ta]=Xo}}let Z=17,ue=xt.sum(new Int32Array(H))/Z,Ee=(E.getStartEnd()[1]-E.getStartEnd()[0])/15;if(Math.abs(ue-Ee)/Ee>.3)throw new G;let Re=this.getOddCounts(),ot=this.getEvenCounts(),Ct=this.getOddRoundingErrors(),Dt=this.getEvenRoundingErrors();for(let pa=0;pa<H.length;pa++){let Ta=1*H[pa]/ue,Xo=Ta+.5;if(Xo<1){if(Ta<.3)throw new G;Xo=1}else if(Xo>8){if(Ta>8.7)throw new G;Xo=8}let kd=pa/2;pa&1?(ot[kd]=Xo,Dt[kd]=Ta-Xo):(Re[kd]=Xo,Ct[kd]=Ta-Xo)}this.adjustOddEvenCounts(Z);let sn=4*E.getValue()+(O?0:2)+(U?0:1)-1,Et=0,Yt=0;for(let pa=Re.length-1;pa>=0;pa--){if(p.isNotA1left(E,O,U)){let Ta=p.WEIGHTS[sn][2*pa];Yt+=Re[pa]*Ta}Et+=Re[pa]}let Jt=0;for(let pa=ot.length-1;pa>=0;pa--)if(p.isNotA1left(E,O,U)){let Ta=p.WEIGHTS[sn][2*pa+1];Jt+=ot[pa]*Ta}let Pn=Yt+Jt;if(Et&1||Et>13||Et<4)throw new G;let xr=(13-Et)/2,Nr=p.SYMBOL_WIDEST[xr],Ar=9-Nr,Ns=zn.getRSSvalue(Re,Nr,!0),ti=zn.getRSSvalue(ot,Ar,!1),mc=p.EVEN_TOTAL_SUBSET[xr],ro=p.GSUM[xr],so=Ns*mc+ti+ro;return new Yn(so,Pn)}static isNotA1left(w,E,O){return!(w.getValue()==0&&E&&O)}adjustOddEvenCounts(w){let E=xt.sum(new Int32Array(this.getOddCounts())),O=xt.sum(new Int32Array(this.getEvenCounts())),U=!1,H=!1;E>13?H=!0:E<4&&(U=!0);let Z=!1,ue=!1;O>13?ue=!0:O<4&&(Z=!0);let Ee=E+O-w,Re=(E&1)==1,ot=(O&1)==0;if(Ee==1)if(Re){if(ot)throw new G;H=!0}else{if(!ot)throw new G;ue=!0}else if(Ee==-1)if(Re){if(ot)throw new G;U=!0}else{if(!ot)throw new G;Z=!0}else if(Ee==0){if(Re){if(!ot)throw new G;E<O?(U=!0,ue=!0):(H=!0,Z=!0)}else if(ot)throw new G}else throw new G;if(U){if(H)throw new G;p.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(H&&p.decrement(this.getOddCounts(),this.getOddRoundingErrors()),Z){if(ue)throw new G;p.increment(this.getEvenCounts(),this.getOddRoundingErrors())}ue&&p.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}p.SYMBOL_WIDEST=[7,5,4,3,1],p.EVEN_TOTAL_SUBSET=[4,20,52,104,204],p.GSUM=[0,348,1388,2948,3988],p.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],p.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],p.FINDER_PAT_A=0,p.FINDER_PAT_B=1,p.FINDER_PAT_C=2,p.FINDER_PAT_D=3,p.FINDER_PAT_E=4,p.FINDER_PAT_F=5,p.FINDER_PATTERN_SEQUENCES=[[p.FINDER_PAT_A,p.FINDER_PAT_A],[p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B],[p.FINDER_PAT_A,p.FINDER_PAT_C,p.FINDER_PAT_B,p.FINDER_PAT_D],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_C],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_D,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_D],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_E],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F]],p.MAX_PAIRS=11;class S extends Yn{constructor(w,E,O){super(w,E),this.count=0,this.finderPattern=O}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class A extends Sn{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(w,E,O){const U=this.decodePair(E,!1,w,O);A.addOrTally(this.possibleLeftPairs,U),E.reverse();let H=this.decodePair(E,!0,w,O);A.addOrTally(this.possibleRightPairs,H),E.reverse();for(let Z of this.possibleLeftPairs)if(Z.getCount()>1){for(let ue of this.possibleRightPairs)if(ue.getCount()>1&&A.checkChecksum(Z,ue))return A.constructResult(Z,ue)}throw new G}static addOrTally(w,E){if(E==null)return;let O=!1;for(let U of w)if(U.getValue()===E.getValue()){U.incrementCount(),O=!0;break}O||w.push(E)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(w,E){let O=4537077*w.getValue()+E.getValue(),U=new String(O).toString(),H=new re;for(let Re=13-U.length;Re>0;Re--)H.append("0");H.append(U);let Z=0;for(let Re=0;Re<13;Re++){let ot=H.charAt(Re).charCodeAt(0)-48;Z+=Re&1?ot:3*ot}Z=10-Z%10,Z===10&&(Z=0),H.append(Z.toString());let ue=w.getFinderPattern().getResultPoints(),Ee=E.getFinderPattern().getResultPoints();return new xe(H.toString(),null,0,[ue[0],ue[1],Ee[0],Ee[1]],ge.RSS_14,new Date().getTime())}static checkChecksum(w,E){let O=(w.getChecksumPortion()+16*E.getChecksumPortion())%79,U=9*w.getFinderPattern().getValue()+E.getFinderPattern().getValue();return U>72&&U--,U>8&&U--,O===U}decodePair(w,E,O,U){try{let H=this.findFinderPattern(w,E),Z=this.parseFoundFinderPattern(w,O,E,H),ue=U==null?null:U.get($.NEED_RESULT_POINT_CALLBACK);if(ue!=null){let ot=(H[0]+H[1])/2;E&&(ot=w.getSize()-1-ot),ue.foundPossibleResultPoint(new St(ot,O))}let Ee=this.decodeDataCharacter(w,Z,!0),Re=this.decodeDataCharacter(w,Z,!1);return new S(1597*Ee.getValue()+Re.getValue(),Ee.getChecksumPortion()+4*Re.getChecksumPortion(),Z)}catch{return null}}decodeDataCharacter(w,E,O){let U=this.getDataCharacterCounters();for(let Jt=0;Jt<U.length;Jt++)U[Jt]=0;if(O)Vt.recordPatternInReverse(w,E.getStartEnd()[0],U);else{Vt.recordPattern(w,E.getStartEnd()[1]+1,U);for(let Jt=0,Pn=U.length-1;Jt<Pn;Jt++,Pn--){let xr=U[Jt];U[Jt]=U[Pn],U[Pn]=xr}}let H=O?16:15,Z=xt.sum(new Int32Array(U))/H,ue=this.getOddCounts(),Ee=this.getEvenCounts(),Re=this.getOddRoundingErrors(),ot=this.getEvenRoundingErrors();for(let Jt=0;Jt<U.length;Jt++){let Pn=U[Jt]/Z,xr=Math.floor(Pn+.5);xr<1?xr=1:xr>8&&(xr=8);let Nr=Math.floor(Jt/2);Jt&1?(Ee[Nr]=xr,ot[Nr]=Pn-xr):(ue[Nr]=xr,Re[Nr]=Pn-xr)}this.adjustOddEvenCounts(O,H);let Ct=0,Dt=0;for(let Jt=ue.length-1;Jt>=0;Jt--)Dt*=9,Dt+=ue[Jt],Ct+=ue[Jt];let sn=0,Et=0;for(let Jt=Ee.length-1;Jt>=0;Jt--)sn*=9,sn+=Ee[Jt],Et+=Ee[Jt];let Yt=Dt+3*sn;if(O){if(Ct&1||Ct>12||Ct<4)throw new G;let Jt=(12-Ct)/2,Pn=A.OUTSIDE_ODD_WIDEST[Jt],xr=9-Pn,Nr=zn.getRSSvalue(ue,Pn,!1),Ar=zn.getRSSvalue(Ee,xr,!0),Ns=A.OUTSIDE_EVEN_TOTAL_SUBSET[Jt],ti=A.OUTSIDE_GSUM[Jt];return new Yn(Nr*Ns+Ar+ti,Yt)}else{if(Et&1||Et>10||Et<4)throw new G;let Jt=(10-Et)/2,Pn=A.INSIDE_ODD_WIDEST[Jt],xr=9-Pn,Nr=zn.getRSSvalue(ue,Pn,!0),Ar=zn.getRSSvalue(Ee,xr,!1),Ns=A.INSIDE_ODD_TOTAL_SUBSET[Jt],ti=A.INSIDE_GSUM[Jt];return new Yn(Ar*Ns+Nr+ti,Yt)}}findFinderPattern(w,E){let O=this.getDecodeFinderCounters();O[0]=0,O[1]=0,O[2]=0,O[3]=0;let U=w.getSize(),H=!1,Z=0;for(;Z<U&&(H=!w.get(Z),E!==H);)Z++;let ue=0,Ee=Z;for(let Re=Z;Re<U;Re++)if(w.get(Re)!==H)O[ue]++;else{if(ue===3){if(Sn.isFinderPattern(O))return[Ee,Re];Ee+=O[0]+O[1],O[0]=O[2],O[1]=O[3],O[2]=0,O[3]=0,ue--}else ue++;O[ue]=1,H=!H}throw new G}parseFoundFinderPattern(w,E,O,U){let H=w.get(U[0]),Z=U[0]-1;for(;Z>=0&&H!==w.get(Z);)Z--;Z++;const ue=U[0]-Z,Ee=this.getDecodeFinderCounters(),Re=new Int32Array(Ee.length);v.arraycopy(Ee,0,Re,1,Ee.length-1),Re[0]=ue;const ot=this.parseFinderValue(Re,A.FINDER_PATTERNS);let Ct=Z,Dt=U[1];return O&&(Ct=w.getSize()-1-Ct,Dt=w.getSize()-1-Dt),new Xn(ot,[Z,U[1]],Ct,Dt,E)}adjustOddEvenCounts(w,E){let O=xt.sum(new Int32Array(this.getOddCounts())),U=xt.sum(new Int32Array(this.getEvenCounts())),H=!1,Z=!1,ue=!1,Ee=!1;w?(O>12?Z=!0:O<4&&(H=!0),U>12?Ee=!0:U<4&&(ue=!0)):(O>11?Z=!0:O<5&&(H=!0),U>10?Ee=!0:U<4&&(ue=!0));let Re=O+U-E,ot=(O&1)===(w?1:0),Ct=(U&1)===1;if(Re===1)if(ot){if(Ct)throw new G;Z=!0}else{if(!Ct)throw new G;Ee=!0}else if(Re===-1)if(ot){if(Ct)throw new G;H=!0}else{if(!Ct)throw new G;ue=!0}else if(Re===0){if(ot){if(!Ct)throw new G;O<U?(H=!0,Ee=!0):(Z=!0,ue=!0)}else if(Ct)throw new G}else throw new G;if(H){if(Z)throw new G;Sn.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(Z&&Sn.decrement(this.getOddCounts(),this.getOddRoundingErrors()),ue){if(Ee)throw new G;Sn.increment(this.getEvenCounts(),this.getOddRoundingErrors())}Ee&&Sn.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 O=w?w.get($.POSSIBLE_FORMATS):null,U=w&&w.get($.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;O?((O.includes(ge.EAN_13)||O.includes(ge.UPC_A)||O.includes(ge.EAN_8)||O.includes(ge.UPC_E))&&this.readers.push(new In(w)),O.includes(ge.CODE_39)&&this.readers.push(new We(U)),O.includes(ge.CODE_128)&&this.readers.push(new pt),O.includes(ge.ITF)&&this.readers.push(new It),O.includes(ge.RSS_14)&&this.readers.push(new A),O.includes(ge.RSS_EXPANDED)&&this.readers.push(new p(this.verbose))):(this.readers.push(new In(w)),this.readers.push(new We),this.readers.push(new In(w)),this.readers.push(new pt),this.readers.push(new It),this.readers.push(new A),this.readers.push(new p(this.verbose)))}decodeRow(w,E,O){for(let U=0;U<this.readers.length;U++)try{return this.readers[U].decodeRow(w,E,O)}catch{}throw new G}reset(){this.readers.forEach(w=>w.reset())}}class T extends _e{constructor(w=500,E){super(new k(E),w,E)}}class D{constructor(w,E,O){this.ecCodewords=w,this.ecBlocks=[E],O&&this.ecBlocks.push(O)}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 X{constructor(w,E,O,U,H,Z){this.versionNumber=w,this.symbolSizeRows=E,this.symbolSizeColumns=O,this.dataRegionSizeRows=U,this.dataRegionSizeColumns=H,this.ecBlocks=Z;let ue=0;const Ee=Z.getECCodewords(),Re=Z.getECBlocks();for(let ot of Re)ue+=ot.getCount()*(ot.getDataCodewords()+Ee);this.totalCodewords=ue}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(w,E){if(w&1||E&1)throw new L;for(let O of X.VERSIONS)if(O.symbolSizeRows===w&&O.symbolSizeColumns===E)return O;throw new L}toString(){return""+this.versionNumber}static buildVersions(){return[new X(1,10,10,8,8,new D(5,new V(1,3))),new X(2,12,12,10,10,new D(7,new V(1,5))),new X(3,14,14,12,12,new D(10,new V(1,8))),new X(4,16,16,14,14,new D(12,new V(1,12))),new X(5,18,18,16,16,new D(14,new V(1,18))),new X(6,20,20,18,18,new D(18,new V(1,22))),new X(7,22,22,20,20,new D(20,new V(1,30))),new X(8,24,24,22,22,new D(24,new V(1,36))),new X(9,26,26,24,24,new D(28,new V(1,44))),new X(10,32,32,14,14,new D(36,new V(1,62))),new X(11,36,36,16,16,new D(42,new V(1,86))),new X(12,40,40,18,18,new D(48,new V(1,114))),new X(13,44,44,20,20,new D(56,new V(1,144))),new X(14,48,48,22,22,new D(68,new V(1,174))),new X(15,52,52,24,24,new D(42,new V(2,102))),new X(16,64,64,14,14,new D(56,new V(2,140))),new X(17,72,72,16,16,new D(36,new V(4,92))),new X(18,80,80,18,18,new D(48,new V(4,114))),new X(19,88,88,20,20,new D(56,new V(4,144))),new X(20,96,96,22,22,new D(68,new V(4,174))),new X(21,104,104,24,24,new D(56,new V(6,136))),new X(22,120,120,18,18,new D(68,new V(6,175))),new X(23,132,132,20,20,new D(62,new V(8,163))),new X(24,144,144,22,22,new D(62,new V(8,156),new V(2,155))),new X(25,8,18,6,16,new D(7,new V(1,5))),new X(26,8,32,6,14,new D(11,new V(1,10))),new X(27,12,26,10,24,new D(14,new V(1,16))),new X(28,12,36,10,16,new D(18,new V(1,22))),new X(29,16,36,14,16,new D(24,new V(1,32))),new X(30,16,48,14,22,new D(28,new V(1,49)))]}}X.VERSIONS=X.buildVersions();class le{constructor(w){const E=w.getHeight();if(E<8||E>144||E&1)throw new L;this.version=le.readVersion(w),this.mappingBitMatrix=this.extractDataRegion(w),this.readMappingMatrix=new de(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(w){const E=w.getHeight(),O=w.getWidth();return X.getVersionForDimensions(E,O)}readCodewords(){const w=new Int8Array(this.version.getTotalCodewords());let E=0,O=4,U=0;const H=this.mappingBitMatrix.getHeight(),Z=this.mappingBitMatrix.getWidth();let ue=!1,Ee=!1,Re=!1,ot=!1;do if(O===H&&U===0&&!ue)w[E++]=this.readCorner1(H,Z)&255,O-=2,U+=2,ue=!0;else if(O===H-2&&U===0&&Z&3&&!Ee)w[E++]=this.readCorner2(H,Z)&255,O-=2,U+=2,Ee=!0;else if(O===H+4&&U===2&&!(Z&7)&&!Re)w[E++]=this.readCorner3(H,Z)&255,O-=2,U+=2,Re=!0;else if(O===H-2&&U===0&&(Z&7)===4&&!ot)w[E++]=this.readCorner4(H,Z)&255,O-=2,U+=2,ot=!0;else{do O<H&&U>=0&&!this.readMappingMatrix.get(U,O)&&(w[E++]=this.readUtah(O,U,H,Z)&255),O-=2,U+=2;while(O>=0&&U<Z);O+=1,U+=3;do O>=0&&U<Z&&!this.readMappingMatrix.get(U,O)&&(w[E++]=this.readUtah(O,U,H,Z)&255),O+=2,U-=2;while(O<H&&U>=0);O+=3,U+=1}while(O<H||U<Z);if(E!==this.version.getTotalCodewords())throw new L;return w}readModule(w,E,O,U){return w<0&&(w+=O,E+=4-(O+4&7)),E<0&&(E+=U,w+=4-(U+4&7)),this.readMappingMatrix.set(E,w),this.mappingBitMatrix.get(E,w)}readUtah(w,E,O,U){let H=0;return this.readModule(w-2,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w-2,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E,O,U)&&(H|=1),H<<=1,this.readModule(w,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w,E,O,U)&&(H|=1),H}readCorner1(w,E){let O=0;return this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,1,w,E)&&(O|=1),O<<=1,this.readModule(w-1,2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(2,E-1,w,E)&&(O|=1),O<<=1,this.readModule(3,E-1,w,E)&&(O|=1),O}readCorner2(w,E){let O=0;return this.readModule(w-3,0,w,E)&&(O|=1),O<<=1,this.readModule(w-2,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(0,E-4,w,E)&&(O|=1),O<<=1,this.readModule(0,E-3,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O}readCorner3(w,E){let O=0;return this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(0,E-3,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-3,w,E)&&(O|=1),O<<=1,this.readModule(1,E-2,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O}readCorner4(w,E){let O=0;return this.readModule(w-3,0,w,E)&&(O|=1),O<<=1,this.readModule(w-2,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(2,E-1,w,E)&&(O|=1),O<<=1,this.readModule(3,E-1,w,E)&&(O|=1),O}extractDataRegion(w){const E=this.version.getSymbolSizeRows(),O=this.version.getSymbolSizeColumns();if(w.getHeight()!==E)throw new f("Dimension of bitMatrix must match the version size");const U=this.version.getDataRegionSizeRows(),H=this.version.getDataRegionSizeColumns(),Z=E/U|0,ue=O/H|0,Ee=Z*U,Re=ue*H,ot=new de(Re,Ee);for(let Ct=0;Ct<Z;++Ct){const Dt=Ct*U;for(let sn=0;sn<ue;++sn){const Et=sn*H;for(let Yt=0;Yt<U;++Yt){const Jt=Ct*(U+2)+1+Yt,Pn=Dt+Yt;for(let xr=0;xr<H;++xr){const Nr=sn*(H+2)+1+xr;if(w.get(Nr,Jt)){const Ar=Et+xr;ot.set(Ar,Pn)}}}}}return ot}}class ce{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E){const O=E.getECBlocks();let U=0;const H=O.getECBlocks();for(let Yt of H)U+=Yt.getCount();const Z=new Array(U);let ue=0;for(let Yt of H)for(let Jt=0;Jt<Yt.getCount();Jt++){const Pn=Yt.getDataCodewords(),xr=O.getECCodewords()+Pn;Z[ue++]=new ce(Pn,new Uint8Array(xr))}const Re=Z[0].codewords.length-O.getECCodewords(),ot=Re-1;let Ct=0;for(let Yt=0;Yt<ot;Yt++)for(let Jt=0;Jt<ue;Jt++)Z[Jt].codewords[Yt]=w[Ct++];const Dt=E.getVersionNumber()===24,sn=Dt?8:ue;for(let Yt=0;Yt<sn;Yt++)Z[Yt].codewords[Re-1]=w[Ct++];const Et=Z[0].codewords.length;for(let Yt=Re;Yt<Et;Yt++)for(let Jt=0;Jt<ue;Jt++){const Pn=Dt?(Jt+8)%ue:Jt,xr=Dt&&Pn>7?Yt-1:Yt;Z[Pn].codewords[xr]=w[Ct++]}if(Ct!==w.length)throw new f;return Z}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class fe{constructor(w){this.bytes=w,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(w){if(w<1||w>32||w>this.available())throw new f(""+w);let E=0,O=this.bitOffset,U=this.byteOffset;const H=this.bytes;if(O>0){const Z=8-O,ue=w<Z?w:Z,Ee=Z-ue,Re=255>>8-ue<<Ee;E=(H[U]&Re)>>Ee,w-=ue,O+=ue,O===8&&(O=0,U++)}if(w>0){for(;w>=8;)E=E<<8|H[U]&255,U++,w-=8;if(w>0){const Z=8-w,ue=255>>Z<<Z;E=E<<w|(H[U]&ue)>>Z,O+=w}}return this.bitOffset=O,this.byteOffset=U,E}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var ye;(function(wt){wt[wt.PAD_ENCODE=0]="PAD_ENCODE",wt[wt.ASCII_ENCODE=1]="ASCII_ENCODE",wt[wt.C40_ENCODE=2]="C40_ENCODE",wt[wt.TEXT_ENCODE=3]="TEXT_ENCODE",wt[wt.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",wt[wt.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",wt[wt.BASE256_ENCODE=6]="BASE256_ENCODE"})(ye||(ye={}));class Pe{static decode(w){const E=new fe(w),O=new re,U=new re,H=new Array;let Z=ye.ASCII_ENCODE;do if(Z===ye.ASCII_ENCODE)Z=this.decodeAsciiSegment(E,O,U);else{switch(Z){case ye.C40_ENCODE:this.decodeC40Segment(E,O);break;case ye.TEXT_ENCODE:this.decodeTextSegment(E,O);break;case ye.ANSIX12_ENCODE:this.decodeAnsiX12Segment(E,O);break;case ye.EDIFACT_ENCODE:this.decodeEdifactSegment(E,O);break;case ye.BASE256_ENCODE:this.decodeBase256Segment(E,O,H);break;default:throw new L}Z=ye.ASCII_ENCODE}while(Z!==ye.PAD_ENCODE&&E.available()>0);return U.length()>0&&O.append(U.toString()),new Oe(w,O.toString(),H.length===0?null:H,null)}static decodeAsciiSegment(w,E,O){let U=!1;do{let H=w.readBits(8);if(H===0)throw new L;if(H<=128)return U&&(H+=128),E.append(String.fromCharCode(H-1)),ye.ASCII_ENCODE;if(H===129)return ye.PAD_ENCODE;if(H<=229){const Z=H-130;Z<10&&E.append("0"),E.append(""+Z)}else switch(H){case 230:return ye.C40_ENCODE;case 231:return ye.BASE256_ENCODE;case 232:E.append("");break;case 233:case 234:break;case 235:U=!0;break;case 236:E.append("[)>05"),O.insert(0,"");break;case 237:E.append("[)>06"),O.insert(0,"");break;case 238:return ye.ANSIX12_ENCODE;case 239:return ye.TEXT_ENCODE;case 240:return ye.EDIFACT_ENCODE;case 241:break;default:if(H!==254||w.available()!==0)throw new L;break}}while(w.available()>0);return ye.ASCII_ENCODE}static decodeC40Segment(w,E){let O=!1;const U=[];let H=0;do{if(w.available()===8)return;const Z=w.readBits(8);if(Z===254)return;this.parseTwoBytes(Z,w.readBits(8),U);for(let ue=0;ue<3;ue++){const Ee=U[ue];switch(H){case 0:if(Ee<3)H=Ee+1;else if(Ee<this.C40_BASIC_SET_CHARS.length){const Re=this.C40_BASIC_SET_CHARS[Ee];O?(E.append(String.fromCharCode(Re.charCodeAt(0)+128)),O=!1):E.append(Re)}else throw new L;break;case 1:O?(E.append(String.fromCharCode(Ee+128)),O=!1):E.append(String.fromCharCode(Ee)),H=0;break;case 2:if(Ee<this.C40_SHIFT2_SET_CHARS.length){const Re=this.C40_SHIFT2_SET_CHARS[Ee];O?(E.append(String.fromCharCode(Re.charCodeAt(0)+128)),O=!1):E.append(Re)}else switch(Ee){case 27:E.append("");break;case 30:O=!0;break;default:throw new L}H=0;break;case 3:O?(E.append(String.fromCharCode(Ee+224)),O=!1):E.append(String.fromCharCode(Ee+96)),H=0;break;default:throw new L}}}while(w.available()>0)}static decodeTextSegment(w,E){let O=!1,U=[],H=0;do{if(w.available()===8)return;const Z=w.readBits(8);if(Z===254)return;this.parseTwoBytes(Z,w.readBits(8),U);for(let ue=0;ue<3;ue++){const Ee=U[ue];switch(H){case 0:if(Ee<3)H=Ee+1;else if(Ee<this.TEXT_BASIC_SET_CHARS.length){const Re=this.TEXT_BASIC_SET_CHARS[Ee];O?(E.append(String.fromCharCode(Re.charCodeAt(0)+128)),O=!1):E.append(Re)}else throw new L;break;case 1:O?(E.append(String.fromCharCode(Ee+128)),O=!1):E.append(String.fromCharCode(Ee)),H=0;break;case 2:if(Ee<this.TEXT_SHIFT2_SET_CHARS.length){const Re=this.TEXT_SHIFT2_SET_CHARS[Ee];O?(E.append(String.fromCharCode(Re.charCodeAt(0)+128)),O=!1):E.append(Re)}else switch(Ee){case 27:E.append("");break;case 30:O=!0;break;default:throw new L}H=0;break;case 3:if(Ee<this.TEXT_SHIFT3_SET_CHARS.length){const Re=this.TEXT_SHIFT3_SET_CHARS[Ee];O?(E.append(String.fromCharCode(Re.charCodeAt(0)+128)),O=!1):E.append(Re),H=0}else throw new L;break;default:throw new L}}}while(w.available()>0)}static decodeAnsiX12Segment(w,E){const O=[];do{if(w.available()===8)return;const U=w.readBits(8);if(U===254)return;this.parseTwoBytes(U,w.readBits(8),O);for(let H=0;H<3;H++){const Z=O[H];switch(Z){case 0:E.append("\r");break;case 1:E.append("*");break;case 2:E.append(">");break;case 3:E.append(" ");break;default:if(Z<14)E.append(String.fromCharCode(Z+44));else if(Z<40)E.append(String.fromCharCode(Z+51));else throw new L;break}}}while(w.available()>0)}static parseTwoBytes(w,E,O){let U=(w<<8)+E-1,H=Math.floor(U/1600);O[0]=H,U-=H*1600,H=Math.floor(U/40),O[1]=H,O[2]=U-H*40}static decodeEdifactSegment(w,E){do{if(w.available()<=16)return;for(let O=0;O<4;O++){let U=w.readBits(6);if(U===31){const H=8-w.getBitOffset();H!==8&&w.readBits(H);return}U&32||(U|=64),E.append(String.fromCharCode(U))}}while(w.available()>0)}static decodeBase256Segment(w,E,O){let U=1+w.getByteOffset();const H=this.unrandomize255State(w.readBits(8),U++);let Z;if(H===0?Z=w.available()/8|0:H<250?Z=H:Z=250*(H-249)+this.unrandomize255State(w.readBits(8),U++),Z<0)throw new L;const ue=new Uint8Array(Z);for(let Ee=0;Ee<Z;Ee++){if(w.available()<8)throw new L;ue[Ee]=this.unrandomize255State(w.readBits(8),U++)}O.push(ue);try{E.append(ee.decode(ue,K.ISO88591))}catch(Ee){throw new st("Platform does not support required encoding: "+Ee.message)}}static unrandomize255State(w,E){const O=149*E%255+1,U=w-O;return U>=0?U:U+256}}Pe.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"],Pe.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Pe.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"],Pe.TEXT_SHIFT2_SET_CHARS=Pe.C40_SHIFT2_SET_CHARS,Pe.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class Me{constructor(){this.rsDecoder=new He(ht.DATA_MATRIX_FIELD_256)}decode(w){const E=new le(w),O=E.getVersion(),U=E.readCodewords(),H=ce.getDataBlocks(U,O);let Z=0;for(let Re of H)Z+=Re.getNumDataCodewords();const ue=new Uint8Array(Z),Ee=H.length;for(let Re=0;Re<Ee;Re++){const ot=H[Re],Ct=ot.getCodewords(),Dt=ot.getNumDataCodewords();this.correctErrors(Ct,Dt);for(let sn=0;sn<Dt;sn++)ue[sn*Ee+Re]=Ct[sn]}return Pe.decode(ue)}correctErrors(w,E){const O=new Int32Array(w);try{this.rsDecoder.decode(O,w.length-E)}catch{throw new g}for(let U=0;U<E;U++)w[U]=O[U]}}class Ke{constructor(w){this.image=w,this.rectangleDetector=new Vn(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 O=E[0],U=E[1],H=E[2],Z=E[3];let ue=this.transitionsBetween(O,Z)+1,Ee=this.transitionsBetween(H,Z)+1;(ue&1)===1&&(ue+=1),(Ee&1)===1&&(Ee+=1),4*ue<7*Ee&&4*Ee<7*ue&&(ue=Ee=Math.max(ue,Ee));let Re=Ke.sampleGrid(this.image,O,U,H,Z,ue,Ee);return new on(Re,[O,U,H,Z])}static shiftPoint(w,E,O){let U=(E.getX()-w.getX())/(O+1),H=(E.getY()-w.getY())/(O+1);return new St(w.getX()+U,w.getY()+H)}static moveAway(w,E,O){let U=w.getX(),H=w.getY();return U<E?U-=1:U+=1,H<O?H-=1:H+=1,new St(U,H)}detectSolid1(w){let E=w[0],O=w[1],U=w[3],H=w[2],Z=this.transitionsBetween(E,O),ue=this.transitionsBetween(O,U),Ee=this.transitionsBetween(U,H),Re=this.transitionsBetween(H,E),ot=Z,Ct=[H,E,O,U];return ot>ue&&(ot=ue,Ct[0]=E,Ct[1]=O,Ct[2]=U,Ct[3]=H),ot>Ee&&(ot=Ee,Ct[0]=O,Ct[1]=U,Ct[2]=H,Ct[3]=E),ot>Re&&(Ct[0]=U,Ct[1]=H,Ct[2]=E,Ct[3]=O),Ct}detectSolid2(w){let E=w[0],O=w[1],U=w[2],H=w[3],Z=this.transitionsBetween(E,H),ue=Ke.shiftPoint(O,U,(Z+1)*4),Ee=Ke.shiftPoint(U,O,(Z+1)*4),Re=this.transitionsBetween(ue,E),ot=this.transitionsBetween(Ee,H);return Re<ot?(w[0]=E,w[1]=O,w[2]=U,w[3]=H):(w[0]=O,w[1]=U,w[2]=H,w[3]=E),w}correctTopRight(w){let E=w[0],O=w[1],U=w[2],H=w[3],Z=this.transitionsBetween(E,H),ue=this.transitionsBetween(O,H),Ee=Ke.shiftPoint(E,O,(ue+1)*4),Re=Ke.shiftPoint(U,O,(Z+1)*4);Z=this.transitionsBetween(Ee,H),ue=this.transitionsBetween(Re,H);let ot=new St(H.getX()+(U.getX()-O.getX())/(Z+1),H.getY()+(U.getY()-O.getY())/(Z+1)),Ct=new St(H.getX()+(E.getX()-O.getX())/(ue+1),H.getY()+(E.getY()-O.getY())/(ue+1));if(!this.isValid(ot))return this.isValid(Ct)?Ct:null;if(!this.isValid(Ct))return ot;let Dt=this.transitionsBetween(Ee,ot)+this.transitionsBetween(Re,ot),sn=this.transitionsBetween(Ee,Ct)+this.transitionsBetween(Re,Ct);return Dt>sn?ot:Ct}shiftToModuleCenter(w){let E=w[0],O=w[1],U=w[2],H=w[3],Z=this.transitionsBetween(E,H)+1,ue=this.transitionsBetween(U,H)+1,Ee=Ke.shiftPoint(E,O,ue*4),Re=Ke.shiftPoint(U,O,Z*4);Z=this.transitionsBetween(Ee,H)+1,ue=this.transitionsBetween(Re,H)+1,(Z&1)===1&&(Z+=1),(ue&1)===1&&(ue+=1);let ot=(E.getX()+O.getX()+U.getX()+H.getX())/4,Ct=(E.getY()+O.getY()+U.getY()+H.getY())/4;E=Ke.moveAway(E,ot,Ct),O=Ke.moveAway(O,ot,Ct),U=Ke.moveAway(U,ot,Ct),H=Ke.moveAway(H,ot,Ct);let Dt,sn;return Ee=Ke.shiftPoint(E,O,ue*4),Ee=Ke.shiftPoint(Ee,H,Z*4),Dt=Ke.shiftPoint(O,E,ue*4),Dt=Ke.shiftPoint(Dt,U,Z*4),Re=Ke.shiftPoint(U,H,ue*4),Re=Ke.shiftPoint(Re,O,Z*4),sn=Ke.shiftPoint(H,U,ue*4),sn=Ke.shiftPoint(sn,E,Z*4),[Ee,Dt,Re,sn]}isValid(w){return w.getX()>=0&&w.getX()<this.image.getWidth()&&w.getY()>0&&w.getY()<this.image.getHeight()}static sampleGrid(w,E,O,U,H,Z,ue){return nt.getInstance().sampleGrid(w,Z,ue,.5,.5,Z-.5,.5,Z-.5,ue-.5,.5,ue-.5,E.getX(),E.getY(),H.getX(),H.getY(),U.getX(),U.getY(),O.getX(),O.getY())}transitionsBetween(w,E){let O=Math.trunc(w.getX()),U=Math.trunc(w.getY()),H=Math.trunc(E.getX()),Z=Math.trunc(E.getY()),ue=Math.abs(Z-U)>Math.abs(H-O);if(ue){let Yt=O;O=U,U=Yt,Yt=H,H=Z,Z=Yt}let Ee=Math.abs(H-O),Re=Math.abs(Z-U),ot=-Ee/2,Ct=U<Z?1:-1,Dt=O<H?1:-1,sn=0,Et=this.image.get(ue?U:O,ue?O:U);for(let Yt=O,Jt=U;Yt!==H;Yt+=Dt){let Pn=this.image.get(ue?Jt:Yt,ue?Yt:Jt);if(Pn!==Et&&(sn++,Et=Pn),ot+=Re,ot>0){if(Jt===Z)break;Jt+=Ct,ot-=Ee}}return sn}}class we{constructor(){this.decoder=new Me}decode(w,E=null){let O,U;if(E!=null&&E.has($.PURE_BARCODE)){const Re=we.extractPureBits(w.getBlackMatrix());O=this.decoder.decode(Re),U=we.NO_POINTS}else{const Re=new Ke(w.getBlackMatrix()).detect();O=this.decoder.decode(Re.getBits()),U=Re.getPoints()}const H=O.getRawBytes(),Z=new xe(O.getText(),H,8*H.length,U,ge.DATA_MATRIX,v.currentTimeMillis()),ue=O.getByteSegments();ue!=null&&Z.putMetadata(je.BYTE_SEGMENTS,ue);const Ee=O.getECLevel();return Ee!=null&&Z.putMetadata(je.ERROR_CORRECTION_LEVEL,Ee),Z}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),O=w.getBottomRightOnBit();if(E==null||O==null)throw new G;const U=this.moduleSize(E,w);let H=E[1];const Z=O[1];let ue=E[0];const Re=(O[0]-ue+1)/U,ot=(Z-H+1)/U;if(Re<=0||ot<=0)throw new G;const Ct=U/2;H+=Ct,ue+=Ct;const Dt=new de(Re,ot);for(let sn=0;sn<ot;sn++){const Et=H+sn*U;for(let Yt=0;Yt<Re;Yt++)w.get(ue+Yt*U,Et)&&Dt.set(Yt,sn)}return Dt}static moduleSize(w,E){const O=E.getWidth();let U=w[0];const H=w[1];for(;U<O&&E.get(U,H);)U++;if(U===O)throw new G;const Z=U-w[0];if(Z===0)throw new G;return Z}}we.NO_POINTS=[];class Te extends _e{constructor(w=500){super(new we,w)}}var te;(function(wt){wt[wt.L=0]="L",wt[wt.M=1]="M",wt[wt.Q=2]="Q",wt[wt.H=3]="H"})(te||(te={}));class ve{constructor(w,E,O){this.value=w,this.stringValue=E,this.bits=O,ve.FOR_BITS.set(O,this),ve.FOR_VALUE.set(w,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(w){switch(w){case"L":return ve.L;case"M":return ve.M;case"Q":return ve.Q;case"H":return ve.H;default:throw new d(w+"not available")}}toString(){return this.stringValue}equals(w){if(!(w instanceof ve))return!1;const E=w;return this.value===E.value}static forBits(w){if(w<0||w>=ve.FOR_BITS.size)throw new f;return ve.FOR_BITS.get(w)}}ve.FOR_BITS=new Map,ve.FOR_VALUE=new Map,ve.L=new ve(te.L,"L",1),ve.M=new ve(te.M,"M",0),ve.Q=new ve(te.Q,"Q",3),ve.H=new ve(te.H,"H",2);class Be{constructor(w){this.errorCorrectionLevel=ve.forBits(w>>3&3),this.dataMask=w&7}static numBitsDiffering(w,E){return P.bitCount(w^E)}static decodeFormatInformation(w,E){const O=Be.doDecodeFormatInformation(w,E);return O!==null?O:Be.doDecodeFormatInformation(w^Be.FORMAT_INFO_MASK_QR,E^Be.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(w,E){let O=Number.MAX_SAFE_INTEGER,U=0;for(const H of Be.FORMAT_INFO_DECODE_LOOKUP){const Z=H[0];if(Z===w||Z===E)return new Be(H[1]);let ue=Be.numBitsDiffering(w,Z);ue<O&&(U=H[1],O=ue),w!==E&&(ue=Be.numBitsDiffering(E,Z),ue<O&&(U=H[1],O=ue))}return O<=3?new Be(U):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(w){if(!(w instanceof Be))return!1;const E=w;return this.errorCorrectionLevel===E.errorCorrectionLevel&&this.dataMask===E.dataMask}}Be.FORMAT_INFO_MASK_QR=21522,Be.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class Ue{constructor(w,...E){this.ecCodewordsPerBlock=w,this.ecBlocks=E}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let w=0;const E=this.ecBlocks;for(const O of E)w+=O.getCount();return w}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Fe{constructor(w,E){this.count=w,this.dataCodewords=E}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class at{constructor(w,E,...O){this.versionNumber=w,this.alignmentPatternCenters=E,this.ecBlocks=O;let U=0;const H=O[0].getECCodewordsPerBlock(),Z=O[0].getECBlocks();for(const ue of Z)U+=ue.getCount()*(ue.getDataCodewords()+H);this.totalCodewords=U}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(w){return this.ecBlocks[w.getValue()]}static getProvisionalVersionForDimension(w){if(w%4!==1)throw new L;try{return this.getVersionForNumber((w-17)/4)}catch{throw new L}}static getVersionForNumber(w){if(w<1||w>40)throw new f;return at.VERSIONS[w-1]}static decodeVersionInformation(w){let E=Number.MAX_SAFE_INTEGER,O=0;for(let U=0;U<at.VERSION_DECODE_INFO.length;U++){const H=at.VERSION_DECODE_INFO[U];if(H===w)return at.getVersionForNumber(U+7);const Z=Be.numBitsDiffering(w,H);Z<E&&(O=U+7,E=Z)}return E<=3?at.getVersionForNumber(O):null}buildFunctionPattern(){const w=this.getDimensionForVersion(),E=new de(w);E.setRegion(0,0,9,9),E.setRegion(w-8,0,8,9),E.setRegion(0,w-8,9,8);const O=this.alignmentPatternCenters.length;for(let U=0;U<O;U++){const H=this.alignmentPatternCenters[U]-2;for(let Z=0;Z<O;Z++)U===0&&(Z===0||Z===O-1)||U===O-1&&Z===0||E.setRegion(this.alignmentPatternCenters[Z]-2,H,5,5)}return E.setRegion(6,9,1,w-17),E.setRegion(9,6,w-17,1),this.versionNumber>6&&(E.setRegion(w-11,0,3,6),E.setRegion(0,w-11,6,3)),E}toString(){return""+this.versionNumber}}at.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]),at.VERSIONS=[new at(1,new Int32Array(0),new Ue(7,new Fe(1,19)),new Ue(10,new Fe(1,16)),new Ue(13,new Fe(1,13)),new Ue(17,new Fe(1,9))),new at(2,Int32Array.from([6,18]),new Ue(10,new Fe(1,34)),new Ue(16,new Fe(1,28)),new Ue(22,new Fe(1,22)),new Ue(28,new Fe(1,16))),new at(3,Int32Array.from([6,22]),new Ue(15,new Fe(1,55)),new Ue(26,new Fe(1,44)),new Ue(18,new Fe(2,17)),new Ue(22,new Fe(2,13))),new at(4,Int32Array.from([6,26]),new Ue(20,new Fe(1,80)),new Ue(18,new Fe(2,32)),new Ue(26,new Fe(2,24)),new Ue(16,new Fe(4,9))),new at(5,Int32Array.from([6,30]),new Ue(26,new Fe(1,108)),new Ue(24,new Fe(2,43)),new Ue(18,new Fe(2,15),new Fe(2,16)),new Ue(22,new Fe(2,11),new Fe(2,12))),new at(6,Int32Array.from([6,34]),new Ue(18,new Fe(2,68)),new Ue(16,new Fe(4,27)),new Ue(24,new Fe(4,19)),new Ue(28,new Fe(4,15))),new at(7,Int32Array.from([6,22,38]),new Ue(20,new Fe(2,78)),new Ue(18,new Fe(4,31)),new Ue(18,new Fe(2,14),new Fe(4,15)),new Ue(26,new Fe(4,13),new Fe(1,14))),new at(8,Int32Array.from([6,24,42]),new Ue(24,new Fe(2,97)),new Ue(22,new Fe(2,38),new Fe(2,39)),new Ue(22,new Fe(4,18),new Fe(2,19)),new Ue(26,new Fe(4,14),new Fe(2,15))),new at(9,Int32Array.from([6,26,46]),new Ue(30,new Fe(2,116)),new Ue(22,new Fe(3,36),new Fe(2,37)),new Ue(20,new Fe(4,16),new Fe(4,17)),new Ue(24,new Fe(4,12),new Fe(4,13))),new at(10,Int32Array.from([6,28,50]),new Ue(18,new Fe(2,68),new Fe(2,69)),new Ue(26,new Fe(4,43),new Fe(1,44)),new Ue(24,new Fe(6,19),new Fe(2,20)),new Ue(28,new Fe(6,15),new Fe(2,16))),new at(11,Int32Array.from([6,30,54]),new Ue(20,new Fe(4,81)),new Ue(30,new Fe(1,50),new Fe(4,51)),new Ue(28,new Fe(4,22),new Fe(4,23)),new Ue(24,new Fe(3,12),new Fe(8,13))),new at(12,Int32Array.from([6,32,58]),new Ue(24,new Fe(2,92),new Fe(2,93)),new Ue(22,new Fe(6,36),new Fe(2,37)),new Ue(26,new Fe(4,20),new Fe(6,21)),new Ue(28,new Fe(7,14),new Fe(4,15))),new at(13,Int32Array.from([6,34,62]),new Ue(26,new Fe(4,107)),new Ue(22,new Fe(8,37),new Fe(1,38)),new Ue(24,new Fe(8,20),new Fe(4,21)),new Ue(22,new Fe(12,11),new Fe(4,12))),new at(14,Int32Array.from([6,26,46,66]),new Ue(30,new Fe(3,115),new Fe(1,116)),new Ue(24,new Fe(4,40),new Fe(5,41)),new Ue(20,new Fe(11,16),new Fe(5,17)),new Ue(24,new Fe(11,12),new Fe(5,13))),new at(15,Int32Array.from([6,26,48,70]),new Ue(22,new Fe(5,87),new Fe(1,88)),new Ue(24,new Fe(5,41),new Fe(5,42)),new Ue(30,new Fe(5,24),new Fe(7,25)),new Ue(24,new Fe(11,12),new Fe(7,13))),new at(16,Int32Array.from([6,26,50,74]),new Ue(24,new Fe(5,98),new Fe(1,99)),new Ue(28,new Fe(7,45),new Fe(3,46)),new Ue(24,new Fe(15,19),new Fe(2,20)),new Ue(30,new Fe(3,15),new Fe(13,16))),new at(17,Int32Array.from([6,30,54,78]),new Ue(28,new Fe(1,107),new Fe(5,108)),new Ue(28,new Fe(10,46),new Fe(1,47)),new Ue(28,new Fe(1,22),new Fe(15,23)),new Ue(28,new Fe(2,14),new Fe(17,15))),new at(18,Int32Array.from([6,30,56,82]),new Ue(30,new Fe(5,120),new Fe(1,121)),new Ue(26,new Fe(9,43),new Fe(4,44)),new Ue(28,new Fe(17,22),new Fe(1,23)),new Ue(28,new Fe(2,14),new Fe(19,15))),new at(19,Int32Array.from([6,30,58,86]),new Ue(28,new Fe(3,113),new Fe(4,114)),new Ue(26,new Fe(3,44),new Fe(11,45)),new Ue(26,new Fe(17,21),new Fe(4,22)),new Ue(26,new Fe(9,13),new Fe(16,14))),new at(20,Int32Array.from([6,34,62,90]),new Ue(28,new Fe(3,107),new Fe(5,108)),new Ue(26,new Fe(3,41),new Fe(13,42)),new Ue(30,new Fe(15,24),new Fe(5,25)),new Ue(28,new Fe(15,15),new Fe(10,16))),new at(21,Int32Array.from([6,28,50,72,94]),new Ue(28,new Fe(4,116),new Fe(4,117)),new Ue(26,new Fe(17,42)),new Ue(28,new Fe(17,22),new Fe(6,23)),new Ue(30,new Fe(19,16),new Fe(6,17))),new at(22,Int32Array.from([6,26,50,74,98]),new Ue(28,new Fe(2,111),new Fe(7,112)),new Ue(28,new Fe(17,46)),new Ue(30,new Fe(7,24),new Fe(16,25)),new Ue(24,new Fe(34,13))),new at(23,Int32Array.from([6,30,54,78,102]),new Ue(30,new Fe(4,121),new Fe(5,122)),new Ue(28,new Fe(4,47),new Fe(14,48)),new Ue(30,new Fe(11,24),new Fe(14,25)),new Ue(30,new Fe(16,15),new Fe(14,16))),new at(24,Int32Array.from([6,28,54,80,106]),new Ue(30,new Fe(6,117),new Fe(4,118)),new Ue(28,new Fe(6,45),new Fe(14,46)),new Ue(30,new Fe(11,24),new Fe(16,25)),new Ue(30,new Fe(30,16),new Fe(2,17))),new at(25,Int32Array.from([6,32,58,84,110]),new Ue(26,new Fe(8,106),new Fe(4,107)),new Ue(28,new Fe(8,47),new Fe(13,48)),new Ue(30,new Fe(7,24),new Fe(22,25)),new Ue(30,new Fe(22,15),new Fe(13,16))),new at(26,Int32Array.from([6,30,58,86,114]),new Ue(28,new Fe(10,114),new Fe(2,115)),new Ue(28,new Fe(19,46),new Fe(4,47)),new Ue(28,new Fe(28,22),new Fe(6,23)),new Ue(30,new Fe(33,16),new Fe(4,17))),new at(27,Int32Array.from([6,34,62,90,118]),new Ue(30,new Fe(8,122),new Fe(4,123)),new Ue(28,new Fe(22,45),new Fe(3,46)),new Ue(30,new Fe(8,23),new Fe(26,24)),new Ue(30,new Fe(12,15),new Fe(28,16))),new at(28,Int32Array.from([6,26,50,74,98,122]),new Ue(30,new Fe(3,117),new Fe(10,118)),new Ue(28,new Fe(3,45),new Fe(23,46)),new Ue(30,new Fe(4,24),new Fe(31,25)),new Ue(30,new Fe(11,15),new Fe(31,16))),new at(29,Int32Array.from([6,30,54,78,102,126]),new Ue(30,new Fe(7,116),new Fe(7,117)),new Ue(28,new Fe(21,45),new Fe(7,46)),new Ue(30,new Fe(1,23),new Fe(37,24)),new Ue(30,new Fe(19,15),new Fe(26,16))),new at(30,Int32Array.from([6,26,52,78,104,130]),new Ue(30,new Fe(5,115),new Fe(10,116)),new Ue(28,new Fe(19,47),new Fe(10,48)),new Ue(30,new Fe(15,24),new Fe(25,25)),new Ue(30,new Fe(23,15),new Fe(25,16))),new at(31,Int32Array.from([6,30,56,82,108,134]),new Ue(30,new Fe(13,115),new Fe(3,116)),new Ue(28,new Fe(2,46),new Fe(29,47)),new Ue(30,new Fe(42,24),new Fe(1,25)),new Ue(30,new Fe(23,15),new Fe(28,16))),new at(32,Int32Array.from([6,34,60,86,112,138]),new Ue(30,new Fe(17,115)),new Ue(28,new Fe(10,46),new Fe(23,47)),new Ue(30,new Fe(10,24),new Fe(35,25)),new Ue(30,new Fe(19,15),new Fe(35,16))),new at(33,Int32Array.from([6,30,58,86,114,142]),new Ue(30,new Fe(17,115),new Fe(1,116)),new Ue(28,new Fe(14,46),new Fe(21,47)),new Ue(30,new Fe(29,24),new Fe(19,25)),new Ue(30,new Fe(11,15),new Fe(46,16))),new at(34,Int32Array.from([6,34,62,90,118,146]),new Ue(30,new Fe(13,115),new Fe(6,116)),new Ue(28,new Fe(14,46),new Fe(23,47)),new Ue(30,new Fe(44,24),new Fe(7,25)),new Ue(30,new Fe(59,16),new Fe(1,17))),new at(35,Int32Array.from([6,30,54,78,102,126,150]),new Ue(30,new Fe(12,121),new Fe(7,122)),new Ue(28,new Fe(12,47),new Fe(26,48)),new Ue(30,new Fe(39,24),new Fe(14,25)),new Ue(30,new Fe(22,15),new Fe(41,16))),new at(36,Int32Array.from([6,24,50,76,102,128,154]),new Ue(30,new Fe(6,121),new Fe(14,122)),new Ue(28,new Fe(6,47),new Fe(34,48)),new Ue(30,new Fe(46,24),new Fe(10,25)),new Ue(30,new Fe(2,15),new Fe(64,16))),new at(37,Int32Array.from([6,28,54,80,106,132,158]),new Ue(30,new Fe(17,122),new Fe(4,123)),new Ue(28,new Fe(29,46),new Fe(14,47)),new Ue(30,new Fe(49,24),new Fe(10,25)),new Ue(30,new Fe(24,15),new Fe(46,16))),new at(38,Int32Array.from([6,32,58,84,110,136,162]),new Ue(30,new Fe(4,122),new Fe(18,123)),new Ue(28,new Fe(13,46),new Fe(32,47)),new Ue(30,new Fe(48,24),new Fe(14,25)),new Ue(30,new Fe(42,15),new Fe(32,16))),new at(39,Int32Array.from([6,26,54,82,110,138,166]),new Ue(30,new Fe(20,117),new Fe(4,118)),new Ue(28,new Fe(40,47),new Fe(7,48)),new Ue(30,new Fe(43,24),new Fe(22,25)),new Ue(30,new Fe(10,15),new Fe(67,16))),new at(40,Int32Array.from([6,30,58,86,114,142,170]),new Ue(30,new Fe(19,118),new Fe(6,119)),new Ue(28,new Fe(18,47),new Fe(31,48)),new Ue(30,new Fe(34,24),new Fe(34,25)),new Ue(30,new Fe(20,15),new Fe(61,16)))];var ut;(function(wt){wt[wt.DATA_MASK_000=0]="DATA_MASK_000",wt[wt.DATA_MASK_001=1]="DATA_MASK_001",wt[wt.DATA_MASK_010=2]="DATA_MASK_010",wt[wt.DATA_MASK_011=3]="DATA_MASK_011",wt[wt.DATA_MASK_100=4]="DATA_MASK_100",wt[wt.DATA_MASK_101=5]="DATA_MASK_101",wt[wt.DATA_MASK_110=6]="DATA_MASK_110",wt[wt.DATA_MASK_111=7]="DATA_MASK_111"})(ut||(ut={}));class yt{constructor(w,E){this.value=w,this.isMasked=E}unmaskBitMatrix(w,E){for(let O=0;O<E;O++)for(let U=0;U<E;U++)this.isMasked(O,U)&&w.flip(U,O)}}yt.values=new Map([[ut.DATA_MASK_000,new yt(ut.DATA_MASK_000,(wt,w)=>(wt+w&1)===0)],[ut.DATA_MASK_001,new yt(ut.DATA_MASK_001,(wt,w)=>(wt&1)===0)],[ut.DATA_MASK_010,new yt(ut.DATA_MASK_010,(wt,w)=>w%3===0)],[ut.DATA_MASK_011,new yt(ut.DATA_MASK_011,(wt,w)=>(wt+w)%3===0)],[ut.DATA_MASK_100,new yt(ut.DATA_MASK_100,(wt,w)=>(Math.floor(wt/2)+Math.floor(w/3)&1)===0)],[ut.DATA_MASK_101,new yt(ut.DATA_MASK_101,(wt,w)=>wt*w%6===0)],[ut.DATA_MASK_110,new yt(ut.DATA_MASK_110,(wt,w)=>wt*w%6<3)],[ut.DATA_MASK_111,new yt(ut.DATA_MASK_111,(wt,w)=>(wt+w+wt*w%3&1)===0)]]);class Lt{constructor(w){const E=w.getHeight();if(E<21||(E&3)!==1)throw new L;this.bitMatrix=w}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let w=0;for(let H=0;H<6;H++)w=this.copyBit(H,8,w);w=this.copyBit(7,8,w),w=this.copyBit(8,8,w),w=this.copyBit(8,7,w);for(let H=5;H>=0;H--)w=this.copyBit(8,H,w);const E=this.bitMatrix.getHeight();let O=0;const U=E-7;for(let H=E-1;H>=U;H--)O=this.copyBit(8,H,O);for(let H=E-8;H<E;H++)O=this.copyBit(H,8,O);if(this.parsedFormatInfo=Be.decodeFormatInformation(w,O),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new L}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const w=this.bitMatrix.getHeight(),E=Math.floor((w-17)/4);if(E<=6)return at.getVersionForNumber(E);let O=0;const U=w-11;for(let Z=5;Z>=0;Z--)for(let ue=w-9;ue>=U;ue--)O=this.copyBit(ue,Z,O);let H=at.decodeVersionInformation(O);if(H!==null&&H.getDimensionForVersion()===w)return this.parsedVersion=H,H;O=0;for(let Z=5;Z>=0;Z--)for(let ue=w-9;ue>=U;ue--)O=this.copyBit(Z,ue,O);if(H=at.decodeVersionInformation(O),H!==null&&H.getDimensionForVersion()===w)return this.parsedVersion=H,H;throw new L}copyBit(w,E,O){return(this.isMirror?this.bitMatrix.get(E,w):this.bitMatrix.get(w,E))?O<<1|1:O<<1}readCodewords(){const w=this.readFormatInformation(),E=this.readVersion(),O=yt.values.get(w.getDataMask()),U=this.bitMatrix.getHeight();O.unmaskBitMatrix(this.bitMatrix,U);const H=E.buildFunctionPattern();let Z=!0;const ue=new Uint8Array(E.getTotalCodewords());let Ee=0,Re=0,ot=0;for(let Ct=U-1;Ct>0;Ct-=2){Ct===6&&Ct--;for(let Dt=0;Dt<U;Dt++){const sn=Z?U-1-Dt:Dt;for(let Et=0;Et<2;Et++)H.get(Ct-Et,sn)||(ot++,Re<<=1,this.bitMatrix.get(Ct-Et,sn)&&(Re|=1),ot===8&&(ue[Ee++]=Re,ot=0,Re=0))}Z=!Z}if(Ee!==E.getTotalCodewords())throw new L;return ue}remask(){if(this.parsedFormatInfo===null)return;const w=yt.values[this.parsedFormatInfo.getDataMask()],E=this.bitMatrix.getHeight();w.unmaskBitMatrix(this.bitMatrix,E)}setMirror(w){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=w}mirror(){const w=this.bitMatrix;for(let E=0,O=w.getWidth();E<O;E++)for(let U=E+1,H=w.getHeight();U<H;U++)w.get(E,U)!==w.get(U,E)&&(w.flip(U,E),w.flip(E,U))}}class Gt{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E,O){if(w.length!==E.getTotalCodewords())throw new f;const U=E.getECBlocksForLevel(O);let H=0;const Z=U.getECBlocks();for(const Et of Z)H+=Et.getCount();const ue=new Array(H);let Ee=0;for(const Et of Z)for(let Yt=0;Yt<Et.getCount();Yt++){const Jt=Et.getDataCodewords(),Pn=U.getECCodewordsPerBlock()+Jt;ue[Ee++]=new Gt(Jt,new Uint8Array(Pn))}const Re=ue[0].codewords.length;let ot=ue.length-1;for(;ot>=0&&ue[ot].codewords.length!==Re;)ot--;ot++;const Ct=Re-U.getECCodewordsPerBlock();let Dt=0;for(let Et=0;Et<Ct;Et++)for(let Yt=0;Yt<Ee;Yt++)ue[Yt].codewords[Et]=w[Dt++];for(let Et=ot;Et<Ee;Et++)ue[Et].codewords[Ct]=w[Dt++];const sn=ue[0].codewords.length;for(let Et=Ct;Et<sn;Et++)for(let Yt=0;Yt<Ee;Yt++){const Jt=Yt<ot?Et:Et+1;ue[Yt].codewords[Jt]=w[Dt++]}return ue}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var an;(function(wt){wt[wt.TERMINATOR=0]="TERMINATOR",wt[wt.NUMERIC=1]="NUMERIC",wt[wt.ALPHANUMERIC=2]="ALPHANUMERIC",wt[wt.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",wt[wt.BYTE=4]="BYTE",wt[wt.ECI=5]="ECI",wt[wt.KANJI=6]="KANJI",wt[wt.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",wt[wt.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",wt[wt.HANZI=9]="HANZI"})(an||(an={}));class et{constructor(w,E,O,U){this.value=w,this.stringValue=E,this.characterCountBitsForVersions=O,this.bits=U,et.FOR_BITS.set(U,this),et.FOR_VALUE.set(w,this)}static forBits(w){const E=et.FOR_BITS.get(w);if(E===void 0)throw new f;return E}getCharacterCountBits(w){const E=w.getVersionNumber();let O;return E<=9?O=0:E<=26?O=1:O=2,this.characterCountBitsForVersions[O]}getValue(){return this.value}getBits(){return this.bits}equals(w){if(!(w instanceof et))return!1;const E=w;return this.value===E.value}toString(){return this.stringValue}}et.FOR_BITS=new Map,et.FOR_VALUE=new Map,et.TERMINATOR=new et(an.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),et.NUMERIC=new et(an.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),et.ALPHANUMERIC=new et(an.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),et.STRUCTURED_APPEND=new et(an.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),et.BYTE=new et(an.BYTE,"BYTE",Int32Array.from([8,16,16]),4),et.ECI=new et(an.ECI,"ECI",Int32Array.from([0,0,0]),7),et.KANJI=new et(an.KANJI,"KANJI",Int32Array.from([8,10,12]),8),et.FNC1_FIRST_POSITION=new et(an.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),et.FNC1_SECOND_POSITION=new et(an.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),et.HANZI=new et(an.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Pt{static decode(w,E,O,U){const H=new fe(w);let Z=new re;const ue=new Array;let Ee=-1,Re=-1;try{let ot=null,Ct=!1,Dt;do{if(H.available()<4)Dt=et.TERMINATOR;else{const sn=H.readBits(4);Dt=et.forBits(sn)}switch(Dt){case et.TERMINATOR:break;case et.FNC1_FIRST_POSITION:case et.FNC1_SECOND_POSITION:Ct=!0;break;case et.STRUCTURED_APPEND:if(H.available()<16)throw new L;Ee=H.readBits(8),Re=H.readBits(8);break;case et.ECI:const sn=Pt.parseECIValue(H);if(ot=Q.getCharacterSetECIByValue(sn),ot===null)throw new L;break;case et.HANZI:const Et=H.readBits(4),Yt=H.readBits(Dt.getCharacterCountBits(E));Et===Pt.GB2312_SUBSET&&Pt.decodeHanziSegment(H,Z,Yt);break;default:const Jt=H.readBits(Dt.getCharacterCountBits(E));switch(Dt){case et.NUMERIC:Pt.decodeNumericSegment(H,Z,Jt);break;case et.ALPHANUMERIC:Pt.decodeAlphanumericSegment(H,Z,Jt,Ct);break;case et.BYTE:Pt.decodeByteSegment(H,Z,Jt,ot,ue,U);break;case et.KANJI:Pt.decodeKanjiSegment(H,Z,Jt);break;default:throw new L}break}}while(Dt!==et.TERMINATOR)}catch{throw new L}return new Oe(w,Z.toString(),ue.length===0?null:ue,O===null?null:O.toString(),Ee,Re)}static decodeHanziSegment(w,E,O){if(O*13>w.available())throw new L;const U=new Uint8Array(2*O);let H=0;for(;O>0;){const Z=w.readBits(13);let ue=Z/96<<8&4294967295|Z%96;ue<959?ue+=41377:ue+=42657,U[H]=ue>>8&255,U[H+1]=ue&255,H+=2,O--}try{E.append(ee.decode(U,K.GB2312))}catch(Z){throw new L(Z)}}static decodeKanjiSegment(w,E,O){if(O*13>w.available())throw new L;const U=new Uint8Array(2*O);let H=0;for(;O>0;){const Z=w.readBits(13);let ue=Z/192<<8&4294967295|Z%192;ue<7936?ue+=33088:ue+=49472,U[H]=ue>>8,U[H+1]=ue,H+=2,O--}try{E.append(ee.decode(U,K.SHIFT_JIS))}catch(Z){throw new L(Z)}}static decodeByteSegment(w,E,O,U,H,Z){if(8*O>w.available())throw new L;const ue=new Uint8Array(O);for(let Re=0;Re<O;Re++)ue[Re]=w.readBits(8);let Ee;U===null?Ee=K.guessEncoding(ue,Z):Ee=U.getName();try{E.append(ee.decode(ue,Ee))}catch(Re){throw new L(Re)}H.push(ue)}static toAlphaNumericChar(w){if(w>=Pt.ALPHANUMERIC_CHARS.length)throw new L;return Pt.ALPHANUMERIC_CHARS[w]}static decodeAlphanumericSegment(w,E,O,U){const H=E.length();for(;O>1;){if(w.available()<11)throw new L;const Z=w.readBits(11);E.append(Pt.toAlphaNumericChar(Math.floor(Z/45))),E.append(Pt.toAlphaNumericChar(Z%45)),O-=2}if(O===1){if(w.available()<6)throw new L;E.append(Pt.toAlphaNumericChar(w.readBits(6)))}if(U)for(let Z=H;Z<E.length();Z++)E.charAt(Z)==="%"&&(Z<E.length()-1&&E.charAt(Z+1)==="%"?E.deleteCharAt(Z+1):E.setCharAt(Z,""))}static decodeNumericSegment(w,E,O){for(;O>=3;){if(w.available()<10)throw new L;const U=w.readBits(10);if(U>=1e3)throw new L;E.append(Pt.toAlphaNumericChar(Math.floor(U/100))),E.append(Pt.toAlphaNumericChar(Math.floor(U/10)%10)),E.append(Pt.toAlphaNumericChar(U%10)),O-=3}if(O===2){if(w.available()<7)throw new L;const U=w.readBits(7);if(U>=100)throw new L;E.append(Pt.toAlphaNumericChar(Math.floor(U/10))),E.append(Pt.toAlphaNumericChar(U%10))}else if(O===1){if(w.available()<4)throw new L;const U=w.readBits(4);if(U>=10)throw new L;E.append(Pt.toAlphaNumericChar(U))}}static parseECIValue(w){const E=w.readBits(8);if(!(E&128))return E&127;if((E&192)===128){const O=w.readBits(8);return(E&63)<<8&4294967295|O}if((E&224)===192){const O=w.readBits(16);return(E&31)<<16&4294967295|O}throw new L}}Pt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Pt.GB2312_SUBSET=1;class qt{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 ft{constructor(){this.rsDecoder=new He(ht.QR_CODE_FIELD_256)}decodeBooleanArray(w,E){return this.decodeBitMatrix(de.parseFromBooleanArray(w),E)}decodeBitMatrix(w,E){const O=new Lt(w);let U=null;try{return this.decodeBitMatrixParser(O,E)}catch(H){U=H}try{O.remask(),O.setMirror(!0),O.readVersion(),O.readFormatInformation(),O.mirror();const H=this.decodeBitMatrixParser(O,E);return H.setOther(new qt(!0)),H}catch(H){throw U!==null?U:H}}decodeBitMatrixParser(w,E){const O=w.readVersion(),U=w.readFormatInformation().getErrorCorrectionLevel(),H=w.readCodewords(),Z=Gt.getDataBlocks(H,O,U);let ue=0;for(const ot of Z)ue+=ot.getNumDataCodewords();const Ee=new Uint8Array(ue);let Re=0;for(const ot of Z){const Ct=ot.getCodewords(),Dt=ot.getNumDataCodewords();this.correctErrors(Ct,Dt);for(let sn=0;sn<Dt;sn++)Ee[Re++]=Ct[sn]}return Pt.decode(Ee,O,U,E)}correctErrors(w,E){const O=new Int32Array(w);try{this.rsDecoder.decode(O,w.length-E)}catch{throw new g}for(let U=0;U<E;U++)w[U]=O[U]}}class tt extends St{constructor(w,E,O){super(w,E),this.estimatedModuleSize=O}aboutEquals(w,E,O){if(Math.abs(E-this.getY())<=w&&Math.abs(O-this.getX())<=w){const U=Math.abs(w-this.estimatedModuleSize);return U<=1||U<=this.estimatedModuleSize}return!1}combineEstimate(w,E,O){const U=(this.getX()+E)/2,H=(this.getY()+w)/2,Z=(this.estimatedModuleSize+O)/2;return new tt(U,H,Z)}}class Bt{constructor(w,E,O,U,H,Z,ue){this.image=w,this.startX=E,this.startY=O,this.width=U,this.height=H,this.moduleSize=Z,this.resultPointCallback=ue,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const w=this.startX,E=this.height,O=this.width,U=w+O,H=this.startY+E/2,Z=new Int32Array(3),ue=this.image;for(let Ee=0;Ee<E;Ee++){const Re=H+(Ee&1?-Math.floor((Ee+1)/2):Math.floor((Ee+1)/2));Z[0]=0,Z[1]=0,Z[2]=0;let ot=w;for(;ot<U&&!ue.get(ot,Re);)ot++;let Ct=0;for(;ot<U;){if(ue.get(ot,Re))if(Ct===1)Z[1]++;else if(Ct===2){if(this.foundPatternCross(Z)){const Dt=this.handlePossibleCenter(Z,Re,ot);if(Dt!==null)return Dt}Z[0]=Z[2],Z[1]=1,Z[2]=0,Ct=1}else Z[++Ct]++;else Ct===1&&Ct++,Z[Ct]++;ot++}if(this.foundPatternCross(Z)){const Dt=this.handlePossibleCenter(Z,Re,U);if(Dt!==null)return Dt}}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,O=E/2;for(let U=0;U<3;U++)if(Math.abs(E-w[U])>=O)return!1;return!0}crossCheckVertical(w,E,O,U){const H=this.image,Z=H.getHeight(),ue=this.crossCheckStateCount;ue[0]=0,ue[1]=0,ue[2]=0;let Ee=w;for(;Ee>=0&&H.get(E,Ee)&&ue[1]<=O;)ue[1]++,Ee--;if(Ee<0||ue[1]>O)return NaN;for(;Ee>=0&&!H.get(E,Ee)&&ue[0]<=O;)ue[0]++,Ee--;if(ue[0]>O)return NaN;for(Ee=w+1;Ee<Z&&H.get(E,Ee)&&ue[1]<=O;)ue[1]++,Ee++;if(Ee===Z||ue[1]>O)return NaN;for(;Ee<Z&&!H.get(E,Ee)&&ue[2]<=O;)ue[2]++,Ee++;if(ue[2]>O)return NaN;const Re=ue[0]+ue[1]+ue[2];return 5*Math.abs(Re-U)>=2*U?NaN:this.foundPatternCross(ue)?Bt.centerFromEnd(ue,Ee):NaN}handlePossibleCenter(w,E,O){const U=w[0]+w[1]+w[2],H=Bt.centerFromEnd(w,O),Z=this.crossCheckVertical(E,H,2*w[1],U);if(!isNaN(Z)){const ue=(w[0]+w[1]+w[2])/3;for(const Re of this.possibleCenters)if(Re.aboutEquals(ue,Z,H))return Re.combineEstimate(Z,H,ue);const Ee=new tt(H,Z,ue);this.possibleCenters.push(Ee),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(Ee)}return null}}class gn extends St{constructor(w,E,O,U){super(w,E),this.estimatedModuleSize=O,this.count=U,U===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(w,E,O){if(Math.abs(E-this.getY())<=w&&Math.abs(O-this.getX())<=w){const U=Math.abs(w-this.estimatedModuleSize);return U<=1||U<=this.estimatedModuleSize}return!1}combineEstimate(w,E,O){const U=this.count+1,H=(this.count*this.getX()+E)/U,Z=(this.count*this.getY()+w)/U,ue=(this.count*this.estimatedModuleSize+O)/U;return new gn(H,Z,ue,U)}}class tr{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 Dn{constructor(w,E){this.image=w,this.resultPointCallback=E,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=E}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(w){const E=w!=null&&w.get($.TRY_HARDER)!==void 0,O=w!=null&&w.get($.PURE_BARCODE)!==void 0,U=this.image,H=U.getHeight(),Z=U.getWidth();let ue=Math.floor(3*H/(4*Dn.MAX_MODULES));(ue<Dn.MIN_SKIP||E)&&(ue=Dn.MIN_SKIP);let Ee=!1;const Re=new Int32Array(5);for(let Ct=ue-1;Ct<H&&!Ee;Ct+=ue){Re[0]=0,Re[1]=0,Re[2]=0,Re[3]=0,Re[4]=0;let Dt=0;for(let sn=0;sn<Z;sn++)if(U.get(sn,Ct))(Dt&1)===1&&Dt++,Re[Dt]++;else if(Dt&1)Re[Dt]++;else if(Dt===4)if(Dn.foundPatternCross(Re)){if(this.handlePossibleCenter(Re,Ct,sn,O)===!0)if(ue=2,this.hasSkipped===!0)Ee=this.haveMultiplyConfirmedCenters();else{const Yt=this.findRowSkip();Yt>Re[2]&&(Ct+=Yt-Re[2]-ue,sn=Z-1)}else{Re[0]=Re[2],Re[1]=Re[3],Re[2]=Re[4],Re[3]=1,Re[4]=0,Dt=3;continue}Dt=0,Re[0]=0,Re[1]=0,Re[2]=0,Re[3]=0,Re[4]=0}else Re[0]=Re[2],Re[1]=Re[3],Re[2]=Re[4],Re[3]=1,Re[4]=0,Dt=3;else Re[++Dt]++;Dn.foundPatternCross(Re)&&this.handlePossibleCenter(Re,Ct,Z,O)===!0&&(ue=Re[0],this.hasSkipped&&(Ee=this.haveMultiplyConfirmedCenters()))}const ot=this.selectBestPatterns();return St.orderBestPatterns(ot),new tr(ot)}static centerFromEnd(w,E){return E-w[4]-w[3]-w[2]/2}static foundPatternCross(w){let E=0;for(let H=0;H<5;H++){const Z=w[H];if(Z===0)return!1;E+=Z}if(E<7)return!1;const O=E/7,U=O/2;return Math.abs(O-w[0])<U&&Math.abs(O-w[1])<U&&Math.abs(3*O-w[2])<3*U&&Math.abs(O-w[3])<U&&Math.abs(O-w[4])<U}getCrossCheckStateCount(){const w=this.crossCheckStateCount;return w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0,w}crossCheckDiagonal(w,E,O,U){const H=this.getCrossCheckStateCount();let Z=0;const ue=this.image;for(;w>=Z&&E>=Z&&ue.get(E-Z,w-Z);)H[2]++,Z++;if(w<Z||E<Z)return!1;for(;w>=Z&&E>=Z&&!ue.get(E-Z,w-Z)&&H[1]<=O;)H[1]++,Z++;if(w<Z||E<Z||H[1]>O)return!1;for(;w>=Z&&E>=Z&&ue.get(E-Z,w-Z)&&H[0]<=O;)H[0]++,Z++;if(H[0]>O)return!1;const Ee=ue.getHeight(),Re=ue.getWidth();for(Z=1;w+Z<Ee&&E+Z<Re&&ue.get(E+Z,w+Z);)H[2]++,Z++;if(w+Z>=Ee||E+Z>=Re)return!1;for(;w+Z<Ee&&E+Z<Re&&!ue.get(E+Z,w+Z)&&H[3]<O;)H[3]++,Z++;if(w+Z>=Ee||E+Z>=Re||H[3]>=O)return!1;for(;w+Z<Ee&&E+Z<Re&&ue.get(E+Z,w+Z)&&H[4]<O;)H[4]++,Z++;if(H[4]>=O)return!1;const ot=H[0]+H[1]+H[2]+H[3]+H[4];return Math.abs(ot-U)<2*U&&Dn.foundPatternCross(H)}crossCheckVertical(w,E,O,U){const H=this.image,Z=H.getHeight(),ue=this.getCrossCheckStateCount();let Ee=w;for(;Ee>=0&&H.get(E,Ee);)ue[2]++,Ee--;if(Ee<0)return NaN;for(;Ee>=0&&!H.get(E,Ee)&&ue[1]<=O;)ue[1]++,Ee--;if(Ee<0||ue[1]>O)return NaN;for(;Ee>=0&&H.get(E,Ee)&&ue[0]<=O;)ue[0]++,Ee--;if(ue[0]>O)return NaN;for(Ee=w+1;Ee<Z&&H.get(E,Ee);)ue[2]++,Ee++;if(Ee===Z)return NaN;for(;Ee<Z&&!H.get(E,Ee)&&ue[3]<O;)ue[3]++,Ee++;if(Ee===Z||ue[3]>=O)return NaN;for(;Ee<Z&&H.get(E,Ee)&&ue[4]<O;)ue[4]++,Ee++;if(ue[4]>=O)return NaN;const Re=ue[0]+ue[1]+ue[2]+ue[3]+ue[4];return 5*Math.abs(Re-U)>=2*U?NaN:Dn.foundPatternCross(ue)?Dn.centerFromEnd(ue,Ee):NaN}crossCheckHorizontal(w,E,O,U){const H=this.image,Z=H.getWidth(),ue=this.getCrossCheckStateCount();let Ee=w;for(;Ee>=0&&H.get(Ee,E);)ue[2]++,Ee--;if(Ee<0)return NaN;for(;Ee>=0&&!H.get(Ee,E)&&ue[1]<=O;)ue[1]++,Ee--;if(Ee<0||ue[1]>O)return NaN;for(;Ee>=0&&H.get(Ee,E)&&ue[0]<=O;)ue[0]++,Ee--;if(ue[0]>O)return NaN;for(Ee=w+1;Ee<Z&&H.get(Ee,E);)ue[2]++,Ee++;if(Ee===Z)return NaN;for(;Ee<Z&&!H.get(Ee,E)&&ue[3]<O;)ue[3]++,Ee++;if(Ee===Z||ue[3]>=O)return NaN;for(;Ee<Z&&H.get(Ee,E)&&ue[4]<O;)ue[4]++,Ee++;if(ue[4]>=O)return NaN;const Re=ue[0]+ue[1]+ue[2]+ue[3]+ue[4];return 5*Math.abs(Re-U)>=U?NaN:Dn.foundPatternCross(ue)?Dn.centerFromEnd(ue,Ee):NaN}handlePossibleCenter(w,E,O,U){const H=w[0]+w[1]+w[2]+w[3]+w[4];let Z=Dn.centerFromEnd(w,O),ue=this.crossCheckVertical(E,Math.floor(Z),w[2],H);if(!isNaN(ue)&&(Z=this.crossCheckHorizontal(Math.floor(Z),Math.floor(ue),w[2],H),!isNaN(Z)&&(!U||this.crossCheckDiagonal(Math.floor(ue),Math.floor(Z),w[2],H)))){const Ee=H/7;let Re=!1;const ot=this.possibleCenters;for(let Ct=0,Dt=ot.length;Ct<Dt;Ct++){const sn=ot[Ct];if(sn.aboutEquals(Ee,ue,Z)){ot[Ct]=sn.combineEstimate(ue,Z,Ee),Re=!0;break}}if(!Re){const Ct=new gn(Z,ue,Ee);ot.push(Ct),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(Ct)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let E=null;for(const O of this.possibleCenters)if(O.getCount()>=Dn.CENTER_QUORUM)if(E==null)E=O;else return this.hasSkipped=!0,Math.floor((Math.abs(E.getX()-O.getX())-Math.abs(E.getY()-O.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let w=0,E=0;const O=this.possibleCenters.length;for(const Z of this.possibleCenters)Z.getCount()>=Dn.CENTER_QUORUM&&(w++,E+=Z.getEstimatedModuleSize());if(w<3)return!1;const U=E/O;let H=0;for(const Z of this.possibleCenters)H+=Math.abs(Z.getEstimatedModuleSize()-U);return H<=.05*E}selectBestPatterns(){const w=this.possibleCenters.length;if(w<3)throw new G;const E=this.possibleCenters;let O;if(w>3){let U=0,H=0;for(const Ee of this.possibleCenters){const Re=Ee.getEstimatedModuleSize();U+=Re,H+=Re*Re}O=U/w;let Z=Math.sqrt(H/w-O*O);E.sort((Ee,Re)=>{const ot=Math.abs(Re.getEstimatedModuleSize()-O),Ct=Math.abs(Ee.getEstimatedModuleSize()-O);return ot<Ct?-1:ot>Ct?1:0});const ue=Math.max(.2*O,Z);for(let Ee=0;Ee<E.length&&E.length>3;Ee++){const Re=E[Ee];Math.abs(Re.getEstimatedModuleSize()-O)>ue&&(E.splice(Ee,1),Ee--)}}if(E.length>3){let U=0;for(const H of E)U+=H.getEstimatedModuleSize();O=U/E.length,E.sort((H,Z)=>{if(Z.getCount()===H.getCount()){const ue=Math.abs(Z.getEstimatedModuleSize()-O),Ee=Math.abs(H.getEstimatedModuleSize()-O);return ue<Ee?1:ue>Ee?-1:0}else return Z.getCount()-H.getCount()}),E.splice(3)}return[E[0],E[1],E[2]]}}Dn.CENTER_QUORUM=2,Dn.MIN_SKIP=3,Dn.MAX_MODULES=57;class er{constructor(w){this.image=w}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(w){this.resultPointCallback=w==null?null:w.get($.NEED_RESULT_POINT_CALLBACK);const O=new Dn(this.image,this.resultPointCallback).find(w);return this.processFinderPatternInfo(O)}processFinderPatternInfo(w){const E=w.getTopLeft(),O=w.getTopRight(),U=w.getBottomLeft(),H=this.calculateModuleSize(E,O,U);if(H<1)throw new G("No pattern found in proccess finder.");const Z=er.computeDimension(E,O,U,H),ue=at.getProvisionalVersionForDimension(Z),Ee=ue.getDimensionForVersion()-7;let Re=null;if(ue.getAlignmentPatternCenters().length>0){const sn=O.getX()-E.getX()+U.getX(),Et=O.getY()-E.getY()+U.getY(),Yt=1-3/Ee,Jt=Math.floor(E.getX()+Yt*(sn-E.getX())),Pn=Math.floor(E.getY()+Yt*(Et-E.getY()));for(let xr=4;xr<=16;xr<<=1)try{Re=this.findAlignmentInRegion(H,Jt,Pn,xr);break}catch(Nr){if(!(Nr instanceof G))throw Nr}}const ot=er.createTransform(E,O,U,Re,Z),Ct=er.sampleGrid(this.image,ot,Z);let Dt;return Re===null?Dt=[U,E,O]:Dt=[U,E,O,Re],new on(Ct,Dt)}static createTransform(w,E,O,U,H){const Z=H-3.5;let ue,Ee,Re,ot;return U!==null?(ue=U.getX(),Ee=U.getY(),Re=Z-3,ot=Re):(ue=E.getX()-w.getX()+O.getX(),Ee=E.getY()-w.getY()+O.getY(),Re=Z,ot=Z),fn.quadrilateralToQuadrilateral(3.5,3.5,Z,3.5,Re,ot,3.5,Z,w.getX(),w.getY(),E.getX(),E.getY(),ue,Ee,O.getX(),O.getY())}static sampleGrid(w,E,O){return nt.getInstance().sampleGridWithTransform(w,O,O,E)}static computeDimension(w,E,O,U){const H=xt.round(St.distance(w,E)/U),Z=xt.round(St.distance(w,O)/U);let ue=Math.floor((H+Z)/2)+7;switch(ue&3){case 0:ue++;break;case 2:ue--;break;case 3:throw new G("Dimensions could be not found.")}return ue}calculateModuleSize(w,E,O){return(this.calculateModuleSizeOneWay(w,E)+this.calculateModuleSizeOneWay(w,O))/2}calculateModuleSizeOneWay(w,E){const O=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(w.getX()),Math.floor(w.getY()),Math.floor(E.getX()),Math.floor(E.getY())),U=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(E.getX()),Math.floor(E.getY()),Math.floor(w.getX()),Math.floor(w.getY()));return isNaN(O)?U/7:isNaN(U)?O/7:(O+U)/14}sizeOfBlackWhiteBlackRunBothWays(w,E,O,U){let H=this.sizeOfBlackWhiteBlackRun(w,E,O,U),Z=1,ue=w-(O-w);ue<0?(Z=w/(w-ue),ue=0):ue>=this.image.getWidth()&&(Z=(this.image.getWidth()-1-w)/(ue-w),ue=this.image.getWidth()-1);let Ee=Math.floor(E-(U-E)*Z);return Z=1,Ee<0?(Z=E/(E-Ee),Ee=0):Ee>=this.image.getHeight()&&(Z=(this.image.getHeight()-1-E)/(Ee-E),Ee=this.image.getHeight()-1),ue=Math.floor(w+(ue-w)*Z),H+=this.sizeOfBlackWhiteBlackRun(w,E,ue,Ee),H-1}sizeOfBlackWhiteBlackRun(w,E,O,U){const H=Math.abs(U-E)>Math.abs(O-w);if(H){let sn=w;w=E,E=sn,sn=O,O=U,U=sn}const Z=Math.abs(O-w),ue=Math.abs(U-E);let Ee=-Z/2;const Re=w<O?1:-1,ot=E<U?1:-1;let Ct=0;const Dt=O+Re;for(let sn=w,Et=E;sn!==Dt;sn+=Re){const Yt=H?Et:sn,Jt=H?sn:Et;if(Ct===1===this.image.get(Yt,Jt)){if(Ct===2)return xt.distance(sn,Et,w,E);Ct++}if(Ee+=ue,Ee>0){if(Et===U)break;Et+=ot,Ee-=Z}}return Ct===2?xt.distance(O+Re,U,w,E):NaN}findAlignmentInRegion(w,E,O,U){const H=Math.floor(U*w),Z=Math.max(0,E-H),ue=Math.min(this.image.getWidth()-1,E+H);if(ue-Z<w*3)throw new G("Alignment top exceeds estimated module size.");const Ee=Math.max(0,O-H),Re=Math.min(this.image.getHeight()-1,O+H);if(Re-Ee<w*3)throw new G("Alignment bottom exceeds estimated module size.");return new Bt(this.image,Z,Ee,ue-Z,Re-Ee,w,this.resultPointCallback).find()}}class Sr{constructor(){this.decoder=new ft}getDecoder(){return this.decoder}decode(w,E){let O,U;if(E!=null&&E.get($.PURE_BARCODE)!==void 0){const Ee=Sr.extractPureBits(w.getBlackMatrix());O=this.decoder.decodeBitMatrix(Ee,E),U=Sr.NO_POINTS}else{const Ee=new er(w.getBlackMatrix()).detect(E);O=this.decoder.decodeBitMatrix(Ee.getBits(),E),U=Ee.getPoints()}O.getOther()instanceof qt&&O.getOther().applyMirroredCorrection(U);const H=new xe(O.getText(),O.getRawBytes(),void 0,U,ge.QR_CODE,void 0),Z=O.getByteSegments();Z!==null&&H.putMetadata(je.BYTE_SEGMENTS,Z);const ue=O.getECLevel();return ue!==null&&H.putMetadata(je.ERROR_CORRECTION_LEVEL,ue),O.hasStructuredAppend()&&(H.putMetadata(je.STRUCTURED_APPEND_SEQUENCE,O.getStructuredAppendSequenceNumber()),H.putMetadata(je.STRUCTURED_APPEND_PARITY,O.getStructuredAppendParity())),H}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),O=w.getBottomRightOnBit();if(E===null||O===null)throw new G;const U=this.moduleSize(E,w);let H=E[1],Z=O[1],ue=E[0],Ee=O[0];if(ue>=Ee||H>=Z)throw new G;if(Z-H!==Ee-ue&&(Ee=ue+(Z-H),Ee>=w.getWidth()))throw new G;const Re=Math.round((Ee-ue+1)/U),ot=Math.round((Z-H+1)/U);if(Re<=0||ot<=0)throw new G;if(ot!==Re)throw new G;const Ct=Math.floor(U/2);H+=Ct,ue+=Ct;const Dt=ue+Math.floor((Re-1)*U)-Ee;if(Dt>0){if(Dt>Ct)throw new G;ue-=Dt}const sn=H+Math.floor((ot-1)*U)-Z;if(sn>0){if(sn>Ct)throw new G;H-=sn}const Et=new de(Re,ot);for(let Yt=0;Yt<ot;Yt++){const Jt=H+Math.floor(Yt*U);for(let Pn=0;Pn<Re;Pn++)w.get(ue+Math.floor(Pn*U),Jt)&&Et.set(Pn,Yt)}return Et}static moduleSize(w,E){const O=E.getHeight(),U=E.getWidth();let H=w[0],Z=w[1],ue=!0,Ee=0;for(;H<U&&Z<O;){if(ue!==E.get(H,Z)){if(++Ee===5)break;ue=!ue}H++,Z++}if(H===U||Z===O)throw new G;return(H-w[0])/7}}Sr.NO_POINTS=new Array;class dr{PDF417Common(){}static getBitCountSum(w){return xt.sum(w)}static toIntArray(w){if(w==null||!w.length)return dr.EMPTY_INT_ARRAY;const E=new Int32Array(w.length);let O=0;for(const U of w)E[O++]=U;return E}static getCodeword(w){const E=I.binarySearch(dr.SYMBOL_TABLE,w&262143);return E<0?-1:(dr.CODEWORD_TABLE[E]-1)%dr.NUMBER_OF_CODEWORDS}}dr.NUMBER_OF_CODEWORDS=929,dr.MAX_CODEWORDS_IN_BARCODE=dr.NUMBER_OF_CODEWORDS-1,dr.MIN_ROWS_IN_BARCODE=3,dr.MAX_ROWS_IN_BARCODE=90,dr.MODULES_IN_CODEWORD=17,dr.MODULES_IN_STOP_PATTERN=18,dr.BARS_IN_MODULE=8,dr.EMPTY_INT_ARRAY=new Int32Array([]),dr.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]),dr.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class kr{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class qn{static detectMultiple(w,E,O){let U=w.getBlackMatrix(),H=qn.detect(O,U);return H.length||(U=U.clone(),U.rotate180(),H=qn.detect(O,U)),new kr(U,H)}static detect(w,E){const O=new Array;let U=0,H=0,Z=!1;for(;U<E.getHeight();){const ue=qn.findVertices(E,U,H);if(ue[0]==null&&ue[3]==null){if(!Z)break;Z=!1,H=0;for(const Ee of O)Ee[1]!=null&&(U=Math.trunc(Math.max(U,Ee[1].getY()))),Ee[3]!=null&&(U=Math.max(U,Math.trunc(Ee[3].getY())));U+=qn.ROW_STEP;continue}if(Z=!0,O.push(ue),!w)break;ue[2]!=null?(H=Math.trunc(ue[2].getX()),U=Math.trunc(ue[2].getY())):(H=Math.trunc(ue[4].getX()),U=Math.trunc(ue[4].getY()))}return O}static findVertices(w,E,O){const U=w.getHeight(),H=w.getWidth(),Z=new Array(8);return qn.copyToResult(Z,qn.findRowsWithPattern(w,U,H,E,O,qn.START_PATTERN),qn.INDEXES_START_PATTERN),Z[4]!=null&&(O=Math.trunc(Z[4].getX()),E=Math.trunc(Z[4].getY())),qn.copyToResult(Z,qn.findRowsWithPattern(w,U,H,E,O,qn.STOP_PATTERN),qn.INDEXES_STOP_PATTERN),Z}static copyToResult(w,E,O){for(let U=0;U<O.length;U++)w[O[U]]=E[U]}static findRowsWithPattern(w,E,O,U,H,Z){const ue=new Array(4);let Ee=!1;const Re=new Int32Array(Z.length);for(;U<E;U+=qn.ROW_STEP){let Ct=qn.findGuardPattern(w,H,U,O,!1,Z,Re);if(Ct!=null){for(;U>0;){const Dt=qn.findGuardPattern(w,H,--U,O,!1,Z,Re);if(Dt!=null)Ct=Dt;else{U++;break}}ue[0]=new St(Ct[0],U),ue[1]=new St(Ct[1],U),Ee=!0;break}}let ot=U+1;if(Ee){let Ct=0,Dt=Int32Array.from([Math.trunc(ue[0].getX()),Math.trunc(ue[1].getX())]);for(;ot<E;ot++){const sn=qn.findGuardPattern(w,Dt[0],ot,O,!1,Z,Re);if(sn!=null&&Math.abs(Dt[0]-sn[0])<qn.MAX_PATTERN_DRIFT&&Math.abs(Dt[1]-sn[1])<qn.MAX_PATTERN_DRIFT)Dt=sn,Ct=0;else{if(Ct>qn.SKIPPED_ROW_COUNT_MAX)break;Ct++}}ot-=Ct+1,ue[2]=new St(Dt[0],ot),ue[3]=new St(Dt[1],ot)}return ot-U<qn.BARCODE_MIN_HEIGHT&&I.fill(ue,null),ue}static findGuardPattern(w,E,O,U,H,Z,ue){I.fillWithin(ue,0,ue.length,0);let Ee=E,Re=0;for(;w.get(Ee,O)&&Ee>0&&Re++<qn.MAX_PIXEL_DRIFT;)Ee--;let ot=Ee,Ct=0,Dt=Z.length;for(let sn=H;ot<U;ot++)if(w.get(ot,O)!==sn)ue[Ct]++;else{if(Ct===Dt-1){if(qn.patternMatchVariance(ue,Z,qn.MAX_INDIVIDUAL_VARIANCE)<qn.MAX_AVG_VARIANCE)return new Int32Array([Ee,ot]);Ee+=ue[0]+ue[1],v.arraycopy(ue,2,ue,0,Ct-1),ue[Ct-1]=0,ue[Ct]=0,Ct--}else Ct++;ue[Ct]=1,sn=!sn}return Ct===Dt-1&&qn.patternMatchVariance(ue,Z,qn.MAX_INDIVIDUAL_VARIANCE)<qn.MAX_AVG_VARIANCE?new Int32Array([Ee,ot-1]):null}static patternMatchVariance(w,E,O){let U=w.length,H=0,Z=0;for(let Re=0;Re<U;Re++)H+=w[Re],Z+=E[Re];if(H<Z)return 1/0;let ue=H/Z;O*=ue;let Ee=0;for(let Re=0;Re<U;Re++){let ot=w[Re],Ct=E[Re]*ue,Dt=ot>Ct?ot-Ct:Ct-ot;if(Dt>O)return 1/0;Ee+=Dt}return Ee/H}}qn.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),qn.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),qn.MAX_AVG_VARIANCE=.42,qn.MAX_INDIVIDUAL_VARIANCE=.8,qn.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),qn.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),qn.MAX_PIXEL_DRIFT=3,qn.MAX_PATTERN_DRIFT=5,qn.SKIPPED_ROW_COUNT_MAX=25,qn.ROW_STEP=5,qn.BARCODE_MIN_HEIGHT=10;class Tn{constructor(w,E){if(E.length===0)throw new f;this.field=w;let O=E.length;if(O>1&&E[0]===0){let U=1;for(;U<O&&E[U]===0;)U++;U===O?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(O-U),v.arraycopy(E,U,this.coefficients,0,this.coefficients.length))}else this.coefficients=E}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(w){return this.coefficients[this.coefficients.length-1-w]}evaluateAt(w){if(w===0)return this.getCoefficient(0);if(w===1){let U=0;for(let H of this.coefficients)U=this.field.add(U,H);return U}let E=this.coefficients[0],O=this.coefficients.length;for(let U=1;U<O;U++)E=this.field.add(this.field.multiply(w,E),this.coefficients[U]);return E}add(w){if(!this.field.equals(w.field))throw new f("ModulusPolys do not have same ModulusGF field");if(this.isZero())return w;if(w.isZero())return this;let E=this.coefficients,O=w.coefficients;if(E.length>O.length){let Z=E;E=O,O=Z}let U=new Int32Array(O.length),H=O.length-E.length;v.arraycopy(O,0,U,0,H);for(let Z=H;Z<O.length;Z++)U[Z]=this.field.add(E[Z-H],O[Z]);return new Tn(this.field,U)}subtract(w){if(!this.field.equals(w.field))throw new f("ModulusPolys do not have same ModulusGF field");return w.isZero()?this:this.add(w.negative())}multiply(w){return w instanceof Tn?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 Tn(this.field,new Int32Array([0]));let E=this.coefficients,O=E.length,U=w.coefficients,H=U.length,Z=new Int32Array(O+H-1);for(let ue=0;ue<O;ue++){let Ee=E[ue];for(let Re=0;Re<H;Re++)Z[ue+Re]=this.field.add(Z[ue+Re],this.field.multiply(Ee,U[Re]))}return new Tn(this.field,Z)}negative(){let w=this.coefficients.length,E=new Int32Array(w);for(let O=0;O<w;O++)E[O]=this.field.subtract(0,this.coefficients[O]);return new Tn(this.field,E)}multiplyScalar(w){if(w===0)return new Tn(this.field,new Int32Array([0]));if(w===1)return this;let E=this.coefficients.length,O=new Int32Array(E);for(let U=0;U<E;U++)O[U]=this.field.multiply(this.coefficients[U],w);return new Tn(this.field,O)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return new Tn(this.field,new Int32Array([0]));let O=this.coefficients.length,U=new Int32Array(O+w);for(let H=0;H<O;H++)U[H]=this.field.multiply(this.coefficients[H],E);return new Tn(this.field,U)}toString(){let w=new re;for(let E=this.getDegree();E>=0;E--){let O=this.getCoefficient(E);O!==0&&(O<0?(w.append(" - "),O=-O):w.length()>0&&w.append(" + "),(E===0||O!==1)&&w.append(O),E!==0&&(E===1?w.append("x"):(w.append("x^"),w.append(E))))}return w.toString()}}class $n{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 Je;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 ir extends $n{constructor(w,E){super(),this.modulus=w,this.expTable=new Int32Array(w),this.logTable=new Int32Array(w);let O=1;for(let U=0;U<w;U++)this.expTable[U]=O,O=O*E%w;for(let U=0;U<w-1;U++)this.logTable[this.expTable[U]]=U;this.zero=new Tn(this,new Int32Array([0])),this.one=new Tn(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(w,E){if(w<0)throw new f;if(E===0)return this.zero;let O=new Int32Array(w+1);return O[0]=E,new Tn(this,O)}}ir.PDF417_GF=new ir(dr.NUMBER_OF_CODEWORDS,3);class ls{constructor(){this.field=ir.PDF417_GF}decode(w,E,O){let U=new Tn(this.field,w),H=new Int32Array(E),Z=!1;for(let Et=E;Et>0;Et--){let Yt=U.evaluateAt(this.field.exp(Et));H[E-Et]=Yt,Yt!==0&&(Z=!0)}if(!Z)return 0;let ue=this.field.getOne();if(O!=null)for(const Et of O){let Yt=this.field.exp(w.length-1-Et),Jt=new Tn(this.field,new Int32Array([this.field.subtract(0,Yt),1]));ue=ue.multiply(Jt)}let Ee=new Tn(this.field,H),Re=this.runEuclideanAlgorithm(this.field.buildMonomial(E,1),Ee,E),ot=Re[0],Ct=Re[1],Dt=this.findErrorLocations(ot),sn=this.findErrorMagnitudes(Ct,ot,Dt);for(let Et=0;Et<Dt.length;Et++){let Yt=w.length-1-this.field.log(Dt[Et]);if(Yt<0)throw g.getChecksumInstance();w[Yt]=this.field.subtract(w[Yt],sn[Et])}return Dt.length}runEuclideanAlgorithm(w,E,O){if(w.getDegree()<E.getDegree()){let Dt=w;w=E,E=Dt}let U=w,H=E,Z=this.field.getZero(),ue=this.field.getOne();for(;H.getDegree()>=Math.round(O/2);){let Dt=U,sn=Z;if(U=H,Z=ue,U.isZero())throw g.getChecksumInstance();H=Dt;let Et=this.field.getZero(),Yt=U.getCoefficient(U.getDegree()),Jt=this.field.inverse(Yt);for(;H.getDegree()>=U.getDegree()&&!H.isZero();){let Pn=H.getDegree()-U.getDegree(),xr=this.field.multiply(H.getCoefficient(H.getDegree()),Jt);Et=Et.add(this.field.buildMonomial(Pn,xr)),H=H.subtract(U.multiplyByMonomial(Pn,xr))}ue=Et.multiply(Z).subtract(sn).negative()}let Ee=ue.getCoefficient(0);if(Ee===0)throw g.getChecksumInstance();let Re=this.field.inverse(Ee),ot=ue.multiply(Re),Ct=H.multiply(Re);return[ot,Ct]}findErrorLocations(w){let E=w.getDegree(),O=new Int32Array(E),U=0;for(let H=1;H<this.field.getSize()&&U<E;H++)w.evaluateAt(H)===0&&(O[U]=this.field.inverse(H),U++);if(U!==E)throw g.getChecksumInstance();return O}findErrorMagnitudes(w,E,O){let U=E.getDegree(),H=new Int32Array(U);for(let Re=1;Re<=U;Re++)H[U-Re]=this.field.multiply(Re,E.getCoefficient(Re));let Z=new Tn(this.field,H),ue=O.length,Ee=new Int32Array(ue);for(let Re=0;Re<ue;Re++){let ot=this.field.inverse(O[Re]),Ct=this.field.subtract(0,w.evaluateAt(ot)),Dt=this.field.inverse(Z.evaluateAt(ot));Ee[Re]=this.field.multiply(Ct,Dt)}return Ee}}class cs{constructor(w,E,O,U,H){w instanceof cs?this.constructor_2(w):this.constructor_1(w,E,O,U,H)}constructor_1(w,E,O,U,H){const Z=E==null||O==null,ue=U==null||H==null;if(Z&&ue)throw new G;Z?(E=new St(0,U.getY()),O=new St(0,H.getY())):ue&&(U=new St(w.getWidth()-1,E.getY()),H=new St(w.getWidth()-1,O.getY())),this.image=w,this.topLeft=E,this.bottomLeft=O,this.topRight=U,this.bottomRight=H,this.minX=Math.trunc(Math.min(E.getX(),O.getX())),this.maxX=Math.trunc(Math.max(U.getX(),H.getX())),this.minY=Math.trunc(Math.min(E.getY(),U.getY())),this.maxY=Math.trunc(Math.max(O.getY(),H.getY()))}constructor_2(w){this.image=w.image,this.topLeft=w.getTopLeft(),this.bottomLeft=w.getBottomLeft(),this.topRight=w.getTopRight(),this.bottomRight=w.getBottomRight(),this.minX=w.getMinX(),this.maxX=w.getMaxX(),this.minY=w.getMinY(),this.maxY=w.getMaxY()}static merge(w,E){return w==null?E:E==null?w:new cs(w.image,w.topLeft,w.bottomLeft,E.topRight,E.bottomRight)}addMissingRows(w,E,O){let U=this.topLeft,H=this.bottomLeft,Z=this.topRight,ue=this.bottomRight;if(w>0){let Ee=O?this.topLeft:this.topRight,Re=Math.trunc(Ee.getY()-w);Re<0&&(Re=0);let ot=new St(Ee.getX(),Re);O?U=ot:Z=ot}if(E>0){let Ee=O?this.bottomLeft:this.bottomRight,Re=Math.trunc(Ee.getY()+E);Re>=this.image.getHeight()&&(Re=this.image.getHeight()-1);let ot=new St(Ee.getX(),Re);O?H=ot:ue=ot}return new cs(this.image,U,H,Z,ue)}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,O,U){this.columnCount=w,this.errorCorrectionLevel=U,this.rowCountUpperPart=E,this.rowCountLowerPart=O,this.rowCount=E+O}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Nt{constructor(){this.buffer=""}static form(w,E){let O=-1;function U(Z,ue,Ee,Re,ot,Ct){if(Z==="%%")return"%";if(E[++O]===void 0)return;Z=Re?parseInt(Re.substr(1)):void 0;let Dt=ot?parseInt(ot.substr(1)):void 0,sn;switch(Ct){case"s":sn=E[O];break;case"c":sn=E[O][0];break;case"f":sn=parseFloat(E[O]).toFixed(Z);break;case"p":sn=parseFloat(E[O]).toPrecision(Z);break;case"e":sn=parseFloat(E[O]).toExponential(Z);break;case"x":sn=parseInt(E[O]).toString(Dt||16);break;case"d":sn=parseFloat(parseInt(E[O],Dt||10).toPrecision(Z)).toFixed(0);break}sn=typeof sn=="object"?JSON.stringify(sn):(+sn).toString(Dt);let Et=parseInt(Ee),Yt=Ee&&Ee[0]+""=="0"?"0":" ";for(;sn.length<Et;)sn=ue!==void 0?sn+Yt:Yt+sn;return sn}let H=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(H,U)}format(w,...E){this.buffer+=Nt.form(w,E)}toString(){return this.buffer}}class Rn{constructor(w){this.boundingBox=new cs(w),this.codewords=new Array(w.getMaxY()-w.getMinY()+1)}getCodewordNearby(w){let E=this.getCodeword(w);if(E!=null)return E;for(let O=1;O<Rn.MAX_NEARBY_DISTANCE;O++){let U=this.imageRowToCodewordIndex(w)-O;if(U>=0&&(E=this.codewords[U],E!=null)||(U=this.imageRowToCodewordIndex(w)+O,U<this.codewords.length&&(E=this.codewords[U],E!=null)))return E}return null}imageRowToCodewordIndex(w){return w-this.boundingBox.getMinY()}setCodeword(w,E){this.codewords[this.imageRowToCodewordIndex(w)]=E}getCodeword(w){return this.codewords[this.imageRowToCodewordIndex(w)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const w=new Nt;let E=0;for(const O of this.codewords){if(O==null){w.format("%3d: | %n",E++);continue}w.format("%3d: %3d|%3d%n",E++,O.getRowNumber(),O.getValue())}return w.toString()}}Rn.MAX_NEARBY_DISTANCE=5;class ar{constructor(){this.values=new Map}setValue(w){w=Math.trunc(w);let E=this.values.get(w);E==null&&(E=0),E++,this.values.set(w,E)}getValue(){let w=-1,E=new Array;for(const[O,U]of this.values.entries()){const H={getKey:()=>O,getValue:()=>U};H.getValue()>w?(w=H.getValue(),E=[],E.push(H.getKey())):H.getValue()===w&&E.push(H.getKey())}return dr.toIntArray(E)}getConfidence(w){return this.values.get(w)}}class Tr extends Rn{constructor(w,E){super(w),this._isLeft=E}setRowNumbers(){for(let w of this.getCodewords())w!=null&&w.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(w){let E=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(E,w);let O=this.getBoundingBox(),U=this._isLeft?O.getTopLeft():O.getTopRight(),H=this._isLeft?O.getBottomLeft():O.getBottomRight(),Z=this.imageRowToCodewordIndex(Math.trunc(U.getY())),ue=this.imageRowToCodewordIndex(Math.trunc(H.getY())),Ee=-1,Re=1,ot=0;for(let Ct=Z;Ct<ue;Ct++){if(E[Ct]==null)continue;let Dt=E[Ct],sn=Dt.getRowNumber()-Ee;if(sn===0)ot++;else if(sn===1)Re=Math.max(Re,ot),ot=1,Ee=Dt.getRowNumber();else if(sn<0||Dt.getRowNumber()>=w.getRowCount()||sn>Ct)E[Ct]=null;else{let Et;Re>2?Et=(Re-2)*sn:Et=sn;let Yt=Et>=Ct;for(let Jt=1;Jt<=Et&&!Yt;Jt++)Yt=E[Ct-Jt]!=null;Yt?E[Ct]=null:(Ee=Dt.getRowNumber(),ot=1)}}}getRowHeights(){let w=this.getBarcodeMetadata();if(w==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(w);let E=new Int32Array(w.getRowCount());for(let O of this.getCodewords())if(O!=null){let U=O.getRowNumber();if(U>=E.length)continue;E[U]++}return E}adjustIncompleteIndicatorColumnRowNumbers(w){let E=this.getBoundingBox(),O=this._isLeft?E.getTopLeft():E.getTopRight(),U=this._isLeft?E.getBottomLeft():E.getBottomRight(),H=this.imageRowToCodewordIndex(Math.trunc(O.getY())),Z=this.imageRowToCodewordIndex(Math.trunc(U.getY())),ue=this.getCodewords(),Ee=-1;for(let Re=H;Re<Z;Re++){if(ue[Re]==null)continue;let ot=ue[Re];ot.setRowNumberAsRowIndicatorColumn();let Ct=ot.getRowNumber()-Ee;Ct===0||(Ct===1?Ee=ot.getRowNumber():ot.getRowNumber()>=w.getRowCount()?ue[Re]=null:Ee=ot.getRowNumber())}}getBarcodeMetadata(){let w=this.getCodewords(),E=new ar,O=new ar,U=new ar,H=new ar;for(let ue of w){if(ue==null)continue;ue.setRowNumberAsRowIndicatorColumn();let Ee=ue.getValue()%30,Re=ue.getRowNumber();switch(this._isLeft||(Re+=2),Re%3){case 0:O.setValue(Ee*3+1);break;case 1:H.setValue(Ee/3),U.setValue(Ee%3);break;case 2:E.setValue(Ee+1);break}}if(E.getValue().length===0||O.getValue().length===0||U.getValue().length===0||H.getValue().length===0||E.getValue()[0]<1||O.getValue()[0]+U.getValue()[0]<dr.MIN_ROWS_IN_BARCODE||O.getValue()[0]+U.getValue()[0]>dr.MAX_ROWS_IN_BARCODE)return null;let Z=new lt(E.getValue()[0],O.getValue()[0],U.getValue()[0],H.getValue()[0]);return this.removeIncorrectCodewords(w,Z),Z}removeIncorrectCodewords(w,E){for(let O=0;O<w.length;O++){let U=w[O];if(w[O]==null)continue;let H=U.getValue()%30,Z=U.getRowNumber();if(Z>E.getRowCount()){w[O]=null;continue}switch(this._isLeft||(Z+=2),Z%3){case 0:H*3+1!==E.getRowCountUpperPart()&&(w[O]=null);break;case 1:(Math.trunc(H/3)!==E.getErrorCorrectionLevel()||H%3!==E.getRowCountLowerPart())&&(w[O]=null);break;case 2:H+1!==E.getColumnCount()&&(w[O]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
`+super.toString()}}class Lr{constructor(w,E){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=w,this.barcodeColumnCount=w.getColumnCount(),this.boundingBox=E,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let w=dr.MAX_CODEWORDS_IN_BARCODE,E;do E=w,w=this.adjustRowNumbersAndGetCount();while(w>0&&w<E);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(w){w!=null&&w.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let w=this.adjustRowNumbersByRow();if(w===0)return 0;for(let E=1;E<this.barcodeColumnCount+1;E++){let O=this.detectionResultColumns[E].getCodewords();for(let U=0;U<O.length;U++)O[U]!=null&&(O[U].hasValidRowNumber()||this.adjustRowNumbers(E,U,O))}return w}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let w=this.detectionResultColumns[0].getCodewords(),E=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let O=0;O<w.length;O++)if(w[O]!=null&&E[O]!=null&&w[O].getRowNumber()===E[O].getRowNumber())for(let U=1;U<=this.barcodeColumnCount;U++){let H=this.detectionResultColumns[U].getCodewords()[O];H!=null&&(H.setRowNumber(w[O].getRowNumber()),H.hasValidRowNumber()||(this.detectionResultColumns[U].getCodewords()[O]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let w=0,E=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let O=0;O<E.length;O++){if(E[O]==null)continue;let U=E[O].getRowNumber(),H=0;for(let Z=this.barcodeColumnCount+1;Z>0&&H<this.ADJUST_ROW_NUMBER_SKIP;Z--){let ue=this.detectionResultColumns[Z].getCodewords()[O];ue!=null&&(H=Lr.adjustRowNumberIfValid(U,H,ue),ue.hasValidRowNumber()||w++)}}return w}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let w=0,E=this.detectionResultColumns[0].getCodewords();for(let O=0;O<E.length;O++){if(E[O]==null)continue;let U=E[O].getRowNumber(),H=0;for(let Z=1;Z<this.barcodeColumnCount+1&&H<this.ADJUST_ROW_NUMBER_SKIP;Z++){let ue=this.detectionResultColumns[Z].getCodewords()[O];ue!=null&&(H=Lr.adjustRowNumberIfValid(U,H,ue),ue.hasValidRowNumber()||w++)}}return w}static adjustRowNumberIfValid(w,E,O){return O==null||O.hasValidRowNumber()||(O.isValidRowNumber(w)?(O.setRowNumber(w),E=0):++E),E}adjustRowNumbers(w,E,O){if(!this.detectionResultColumns[w-1])return;let U=O[E],H=this.detectionResultColumns[w-1].getCodewords(),Z=H;this.detectionResultColumns[w+1]!=null&&(Z=this.detectionResultColumns[w+1].getCodewords());let ue=new Array(14);ue[2]=H[E],ue[3]=Z[E],E>0&&(ue[0]=O[E-1],ue[4]=H[E-1],ue[5]=Z[E-1]),E>1&&(ue[8]=O[E-2],ue[10]=H[E-2],ue[11]=Z[E-2]),E<O.length-1&&(ue[1]=O[E+1],ue[6]=H[E+1],ue[7]=Z[E+1]),E<O.length-2&&(ue[9]=O[E+2],ue[12]=H[E+2],ue[13]=Z[E+2]);for(let Ee of ue)if(Lr.adjustRowNumber(U,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 Nt;for(let O=0;O<w.getCodewords().length;O++){E.format("CW %3d:",O);for(let U=0;U<this.barcodeColumnCount+2;U++){if(this.detectionResultColumns[U]==null){E.format(" | ");continue}let H=this.detectionResultColumns[U].getCodewords()[O];if(H==null){E.format(" | ");continue}E.format(" %3d|%3d",H.getRowNumber(),H.getValue())}E.format("%n")}return E.toString()}}class $r{constructor(w,E,O,U){this.rowNumber=$r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(w),this.endX=Math.trunc(E),this.bucket=Math.trunc(O),this.value=Math.trunc(U)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(w){return w!==$r.BARCODE_ROW_UNKNOWN&&this.bucket===w%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(w){this.rowNumber=w}toString(){return this.rowNumber+"|"+this.value}}$r.BARCODE_ROW_UNKNOWN=-1;class cr{static initialize(){for(let w=0;w<dr.SYMBOL_TABLE.length;w++){let E=dr.SYMBOL_TABLE[w],O=E&1;for(let U=0;U<dr.BARS_IN_MODULE;U++){let H=0;for(;(E&1)===O;)H+=1,E>>=1;O=E&1,cr.RATIOS_TABLE[w]||(cr.RATIOS_TABLE[w]=new Array(dr.BARS_IN_MODULE)),cr.RATIOS_TABLE[w][dr.BARS_IN_MODULE-U-1]=Math.fround(H/dr.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(w){let E=cr.getDecodedCodewordValue(cr.sampleBitCounts(w));return E!==-1?E:cr.getClosestDecodedValue(w)}static sampleBitCounts(w){let E=xt.sum(w),O=new Int32Array(dr.BARS_IN_MODULE),U=0,H=0;for(let Z=0;Z<dr.MODULES_IN_CODEWORD;Z++){let ue=E/(2*dr.MODULES_IN_CODEWORD)+Z*E/dr.MODULES_IN_CODEWORD;H+w[U]<=ue&&(H+=w[U],U++),O[U]++}return O}static getDecodedCodewordValue(w){let E=cr.getBitValue(w);return dr.getCodeword(E)===-1?-1:E}static getBitValue(w){let E=0;for(let O=0;O<w.length;O++)for(let U=0;U<w[O];U++)E=E<<1|(O%2===0?1:0);return Math.trunc(E)}static getClosestDecodedValue(w){let E=xt.sum(w),O=new Array(dr.BARS_IN_MODULE);if(E>1)for(let Z=0;Z<O.length;Z++)O[Z]=Math.fround(w[Z]/E);let U=Qt.MAX_VALUE,H=-1;this.bSymbolTableReady||cr.initialize();for(let Z=0;Z<cr.RATIOS_TABLE.length;Z++){let ue=0,Ee=cr.RATIOS_TABLE[Z];for(let Re=0;Re<dr.BARS_IN_MODULE;Re++){let ot=Math.fround(Ee[Re]-O[Re]);if(ue+=Math.fround(ot*ot),ue>=U)break}ue<U&&(U=ue,H=dr.SYMBOL_TABLE[Z])}return H}}cr.bSymbolTableReady=!1,cr.RATIOS_TABLE=new Array(dr.SYMBOL_TABLE.length).map(wt=>new Array(dr.BARS_IN_MODULE));class wr{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(w){this.segmentIndex=w}getFileId(){return this.fileId}setFileId(w){this.fileId=w}getOptionalData(){return this.optionalData}setOptionalData(w){this.optionalData=w}isLastSegment(){return this.lastSegment}setLastSegment(w){this.lastSegment=w}getSegmentCount(){return this.segmentCount}setSegmentCount(w){this.segmentCount=w}getSender(){return this.sender||null}setSender(w){this.sender=w}getAddressee(){return this.addressee||null}setAddressee(w){this.addressee=w}getFileName(){return this.fileName}setFileName(w){this.fileName=w}getFileSize(){return this.fileSize}setFileSize(w){this.fileSize=w}getChecksum(){return this.checksum}setChecksum(w){this.checksum=w}getTimestamp(){return this.timestamp}setTimestamp(w){this.timestamp=w}}class ss{static parseLong(w,E=void 0){return parseInt(w,E)}}class mr extends u{}mr.kind="NullPointerException";class ts{writeBytes(w){this.writeBytesOffset(w,0,w.length)}writeBytesOffset(w,E,O){if(w==null)throw new mr;if(E<0||E>w.length||O<0||E+O>w.length||E+O<0)throw new C;if(O===0)return;for(let U=0;U<O;U++)this.write(w[E+U])}flush(){}close(){}}class Qs extends u{}class Es extends ts{constructor(w=32){if(super(),this.count=0,w<0)throw new f("Negative initial size: "+w);this.buf=new Uint8Array(w)}ensureCapacity(w){w-this.buf.length>0&&this.grow(w)}grow(w){let O=this.buf.length<<1;if(O-w<0&&(O=w),O<0){if(w<0)throw new Qs;O=P.MAX_VALUE}this.buf=I.copyOfUint8Array(this.buf,O)}write(w){this.ensureCapacity(this.count+1),this.buf[this.count]=w,this.count+=1}writeBytesOffset(w,E,O){if(E<0||E>w.length||O<0||E+O-w.length>0)throw new C;this.ensureCapacity(this.count+O),v.arraycopy(w,E,this.buf,this.count,O),this.count+=O}writeTo(w){w.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return I.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(w){return w?typeof w=="string"?this.toString_string(w):this.toString_number(w):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(w){return new String(this.buf).toString()}toString_number(w){return new String(this.buf).toString()}close(){}}var br;(function(wt){wt[wt.ALPHA=0]="ALPHA",wt[wt.LOWER=1]="LOWER",wt[wt.MIXED=2]="MIXED",wt[wt.PUNCT=3]="PUNCT",wt[wt.ALPHA_SHIFT=4]="ALPHA_SHIFT",wt[wt.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(br||(br={}));function Zt(){if(typeof window<"u")return window.BigInt||null;if(typeof Ru<"u")return Ru.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let me;function dt(wt){if(typeof me>"u"&&(me=Zt()),me===null)throw new Error("BigInt is not supported!");return me(wt)}function _t(){let wt=[];wt[0]=dt(1);let w=dt(900);wt[1]=w;for(let E=2;E<16;E++)wt[E]=wt[E-1]*w;return wt}class At{static decode(w,E){let O=new re(""),U=Q.ISO8859_1;O.enableDecoding(U);let H=1,Z=w[H++],ue=new wr;for(;H<w[0];){switch(Z){case At.TEXT_COMPACTION_MODE_LATCH:H=At.textCompaction(w,H,O);break;case At.BYTE_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH_6:H=At.byteCompaction(Z,w,U,H,O);break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:O.append(w[H++]);break;case At.NUMERIC_COMPACTION_MODE_LATCH:H=At.numericCompaction(w,H,O);break;case At.ECI_CHARSET:Q.getCharacterSetECIByValue(w[H++]);break;case At.ECI_GENERAL_PURPOSE:H+=2;break;case At.ECI_USER_DEFINED:H++;break;case At.BEGIN_MACRO_PDF417_CONTROL_BLOCK:H=At.decodeMacroBlock(w,H,ue);break;case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case At.MACRO_PDF417_TERMINATOR:throw new L;default:H--,H=At.textCompaction(w,H,O);break}if(H<w.length)Z=w[H++];else throw L.getFormatInstance()}if(O.length()===0)throw L.getFormatInstance();let Ee=new Oe(null,O.toString(),null,E);return Ee.setOther(ue),Ee}static decodeMacroBlock(w,E,O){if(E+At.NUMBER_OF_SEQUENCE_CODEWORDS>w[0])throw L.getFormatInstance();let U=new Int32Array(At.NUMBER_OF_SEQUENCE_CODEWORDS);for(let ue=0;ue<At.NUMBER_OF_SEQUENCE_CODEWORDS;ue++,E++)U[ue]=w[E];O.setSegmentIndex(P.parseInt(At.decodeBase900toBase10(U,At.NUMBER_OF_SEQUENCE_CODEWORDS)));let H=new re;E=At.textCompaction(w,E,H),O.setFileId(H.toString());let Z=-1;for(w[E]===At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(Z=E+1);E<w[0];)switch(w[E]){case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(E++,w[E]){case At.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let ue=new re;E=At.textCompaction(w,E+1,ue),O.setFileName(ue.toString());break;case At.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let Ee=new re;E=At.textCompaction(w,E+1,Ee),O.setSender(Ee.toString());break;case At.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let Re=new re;E=At.textCompaction(w,E+1,Re),O.setAddressee(Re.toString());break;case At.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let ot=new re;E=At.numericCompaction(w,E+1,ot),O.setSegmentCount(P.parseInt(ot.toString()));break;case At.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let Ct=new re;E=At.numericCompaction(w,E+1,Ct),O.setTimestamp(ss.parseLong(Ct.toString()));break;case At.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let Dt=new re;E=At.numericCompaction(w,E+1,Dt),O.setChecksum(P.parseInt(Dt.toString()));break;case At.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let sn=new re;E=At.numericCompaction(w,E+1,sn),O.setFileSize(ss.parseLong(sn.toString()));break;default:throw L.getFormatInstance()}break;case At.MACRO_PDF417_TERMINATOR:E++,O.setLastSegment(!0);break;default:throw L.getFormatInstance()}if(Z!==-1){let ue=E-Z;O.isLastSegment()&&ue--,O.setOptionalData(I.copyOfRange(w,Z,Z+ue))}return E}static textCompaction(w,E,O){let U=new Int32Array((w[0]-E)*2),H=new Int32Array((w[0]-E)*2),Z=0,ue=!1;for(;E<w[0]&&!ue;){let Ee=w[E++];if(Ee<At.TEXT_COMPACTION_MODE_LATCH)U[Z]=Ee/30,U[Z+1]=Ee%30,Z+=2;else switch(Ee){case At.TEXT_COMPACTION_MODE_LATCH:U[Z++]=At.TEXT_COMPACTION_MODE_LATCH;break;case At.BYTE_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH_6:case At.NUMERIC_COMPACTION_MODE_LATCH:case At.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case At.MACRO_PDF417_TERMINATOR:E--,ue=!0;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U[Z]=At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,Ee=w[E++],H[Z]=Ee,Z++;break}}return At.decodeTextCompaction(U,H,Z,O),E}static decodeTextCompaction(w,E,O,U){let H=br.ALPHA,Z=br.ALPHA,ue=0;for(;ue<O;){let Ee=w[ue],Re="";switch(H){case br.ALPHA:if(Ee<26)Re=String.fromCharCode(65+Ee);else switch(Ee){case 26:Re=" ";break;case At.LL:H=br.LOWER;break;case At.ML:H=br.MIXED;break;case At.PS:Z=H,H=br.PUNCT_SHIFT;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[ue]);break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.LOWER:if(Ee<26)Re=String.fromCharCode(97+Ee);else switch(Ee){case 26:Re=" ";break;case At.AS:Z=H,H=br.ALPHA_SHIFT;break;case At.ML:H=br.MIXED;break;case At.PS:Z=H,H=br.PUNCT_SHIFT;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[ue]);break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.MIXED:if(Ee<At.PL)Re=At.MIXED_CHARS[Ee];else switch(Ee){case At.PL:H=br.PUNCT;break;case 26:Re=" ";break;case At.LL:H=br.LOWER;break;case At.AL:H=br.ALPHA;break;case At.PS:Z=H,H=br.PUNCT_SHIFT;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[ue]);break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.PUNCT:if(Ee<At.PAL)Re=At.PUNCT_CHARS[Ee];else switch(Ee){case At.PAL:H=br.ALPHA;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[ue]);break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.ALPHA_SHIFT:if(H=Z,Ee<26)Re=String.fromCharCode(65+Ee);else switch(Ee){case 26:Re=" ";break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.PUNCT_SHIFT:if(H=Z,Ee<At.PAL)Re=At.PUNCT_CHARS[Ee];else switch(Ee){case At.PAL:H=br.ALPHA;break;case At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[ue]);break;case At.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break}Re!==""&&U.append(Re),ue++}}static byteCompaction(w,E,O,U,H){let Z=new Es,ue=0,Ee=0,Re=!1;switch(w){case At.BYTE_COMPACTION_MODE_LATCH:let ot=new Int32Array(6),Ct=E[U++];for(;U<E[0]&&!Re;)switch(ot[ue++]=Ct,Ee=900*Ee+Ct,Ct=E[U++],Ct){case At.TEXT_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH:case At.NUMERIC_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH_6:case At.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case At.MACRO_PDF417_TERMINATOR:U--,Re=!0;break;default:if(ue%5===0&&ue>0){for(let Dt=0;Dt<6;++Dt)Z.write(Number(dt(Ee)>>dt(8*(5-Dt))));Ee=0,ue=0}break}U===E[0]&&Ct<At.TEXT_COMPACTION_MODE_LATCH&&(ot[ue++]=Ct);for(let Dt=0;Dt<ue;Dt++)Z.write(ot[Dt]);break;case At.BYTE_COMPACTION_MODE_LATCH_6:for(;U<E[0]&&!Re;){let Dt=E[U++];if(Dt<At.TEXT_COMPACTION_MODE_LATCH)ue++,Ee=900*Ee+Dt;else switch(Dt){case At.TEXT_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH:case At.NUMERIC_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH_6:case At.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case At.MACRO_PDF417_TERMINATOR:U--,Re=!0;break}if(ue%5===0&&ue>0){for(let sn=0;sn<6;++sn)Z.write(Number(dt(Ee)>>dt(8*(5-sn))));Ee=0,ue=0}}break}return H.append(ee.decode(Z.toByteArray(),O)),U}static numericCompaction(w,E,O){let U=0,H=!1,Z=new Int32Array(At.MAX_NUMERIC_CODEWORDS);for(;E<w[0]&&!H;){let ue=w[E++];if(E===w[0]&&(H=!0),ue<At.TEXT_COMPACTION_MODE_LATCH)Z[U]=ue,U++;else switch(ue){case At.TEXT_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH:case At.BYTE_COMPACTION_MODE_LATCH_6:case At.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case At.MACRO_PDF417_TERMINATOR:E--,H=!0;break}(U%At.MAX_NUMERIC_CODEWORDS===0||ue===At.NUMERIC_COMPACTION_MODE_LATCH||H)&&U>0&&(O.append(At.decodeBase900toBase10(Z,U)),U=0)}return E}static decodeBase900toBase10(w,E){let O=dt(0);for(let H=0;H<E;H++)O+=At.EXP900[E-H-1]*dt(w[H]);let U=O.toString();if(U.charAt(0)!=="1")throw new L;return U.substring(1)}}At.TEXT_COMPACTION_MODE_LATCH=900,At.BYTE_COMPACTION_MODE_LATCH=901,At.NUMERIC_COMPACTION_MODE_LATCH=902,At.BYTE_COMPACTION_MODE_LATCH_6=924,At.ECI_USER_DEFINED=925,At.ECI_GENERAL_PURPOSE=926,At.ECI_CHARSET=927,At.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,At.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,At.MACRO_PDF417_TERMINATOR=922,At.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,At.MAX_NUMERIC_CODEWORDS=15,At.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,At.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,At.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,At.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,At.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,At.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,At.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,At.PL=25,At.LL=27,At.AS=27,At.ML=28,At.AL=28,At.PS=29,At.PAL=29,At.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
-.$/"|*()?{}'`,At.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",At.EXP900=Zt()?_t():[],At.NUMBER_OF_SEQUENCE_CODEWORDS=2;class xn{constructor(){}static decode(w,E,O,U,H,Z,ue){let Ee=new cs(w,E,O,U,H),Re=null,ot=null,Ct;for(let Et=!0;;Et=!1){if(E!=null&&(Re=xn.getRowIndicatorColumn(w,Ee,E,!0,Z,ue)),U!=null&&(ot=xn.getRowIndicatorColumn(w,Ee,U,!1,Z,ue)),Ct=xn.merge(Re,ot),Ct==null)throw G.getNotFoundInstance();let Yt=Ct.getBoundingBox();if(Et&&Yt!=null&&(Yt.getMinY()<Ee.getMinY()||Yt.getMaxY()>Ee.getMaxY()))Ee=Yt;else break}Ct.setBoundingBox(Ee);let Dt=Ct.getBarcodeColumnCount()+1;Ct.setDetectionResultColumn(0,Re),Ct.setDetectionResultColumn(Dt,ot);let sn=Re!=null;for(let Et=1;Et<=Dt;Et++){let Yt=sn?Et:Dt-Et;if(Ct.getDetectionResultColumn(Yt)!==void 0)continue;let Jt;Yt===0||Yt===Dt?Jt=new Tr(Ee,Yt===0):Jt=new Rn(Ee),Ct.setDetectionResultColumn(Yt,Jt);let Pn=-1,xr=Pn;for(let Nr=Ee.getMinY();Nr<=Ee.getMaxY();Nr++){if(Pn=xn.getStartColumn(Ct,Yt,Nr,sn),Pn<0||Pn>Ee.getMaxX()){if(xr===-1)continue;Pn=xr}let Ar=xn.detectCodeword(w,Ee.getMinX(),Ee.getMaxX(),sn,Pn,Nr,Z,ue);Ar!=null&&(Jt.setCodeword(Nr,Ar),xr=Pn,Z=Math.min(Z,Ar.getWidth()),ue=Math.max(ue,Ar.getWidth()))}}return xn.createDecoderResult(Ct)}static merge(w,E){if(w==null&&E==null)return null;let O=xn.getBarcodeMetadata(w,E);if(O==null)return null;let U=cs.merge(xn.adjustBoundingBox(w),xn.adjustBoundingBox(E));return new Lr(O,U)}static adjustBoundingBox(w){if(w==null)return null;let E=w.getRowHeights();if(E==null)return null;let O=xn.getMax(E),U=0;for(let ue of E)if(U+=O-ue,ue>0)break;let H=w.getCodewords();for(let ue=0;U>0&&H[ue]==null;ue++)U--;let Z=0;for(let ue=E.length-1;ue>=0&&(Z+=O-E[ue],!(E[ue]>0));ue--);for(let ue=H.length-1;Z>0&&H[ue]==null;ue--)Z--;return w.getBoundingBox().addMissingRows(U,Z,w.isLeft())}static getMax(w){let E=-1;for(let O of w)E=Math.max(E,O);return E}static getBarcodeMetadata(w,E){let O;if(w==null||(O=w.getBarcodeMetadata())==null)return E==null?null:E.getBarcodeMetadata();let U;return E==null||(U=E.getBarcodeMetadata())==null?O:O.getColumnCount()!==U.getColumnCount()&&O.getErrorCorrectionLevel()!==U.getErrorCorrectionLevel()&&O.getRowCount()!==U.getRowCount()?null:O}static getRowIndicatorColumn(w,E,O,U,H,Z){let ue=new Tr(E,U);for(let Ee=0;Ee<2;Ee++){let Re=Ee===0?1:-1,ot=Math.trunc(Math.trunc(O.getX()));for(let Ct=Math.trunc(Math.trunc(O.getY()));Ct<=E.getMaxY()&&Ct>=E.getMinY();Ct+=Re){let Dt=xn.detectCodeword(w,0,w.getWidth(),U,ot,Ct,H,Z);Dt!=null&&(ue.setCodeword(Ct,Dt),U?ot=Dt.getStartX():ot=Dt.getEndX())}}return ue}static adjustCodewordCount(w,E){let O=E[0][1],U=O.getValue(),H=w.getBarcodeColumnCount()*w.getBarcodeRowCount()-xn.getNumberOfECCodeWords(w.getBarcodeECLevel());if(U.length===0){if(H<1||H>dr.MAX_CODEWORDS_IN_BARCODE)throw G.getNotFoundInstance();O.setValue(H)}else U[0]!==H&&O.setValue(H)}static createDecoderResult(w){let E=xn.createBarcodeMatrix(w);xn.adjustCodewordCount(w,E);let O=new Array,U=new Int32Array(w.getBarcodeRowCount()*w.getBarcodeColumnCount()),H=[],Z=new Array;for(let Ee=0;Ee<w.getBarcodeRowCount();Ee++)for(let Re=0;Re<w.getBarcodeColumnCount();Re++){let ot=E[Ee][Re+1].getValue(),Ct=Ee*w.getBarcodeColumnCount()+Re;ot.length===0?O.push(Ct):ot.length===1?U[Ct]=ot[0]:(Z.push(Ct),H.push(ot))}let ue=new Array(H.length);for(let Ee=0;Ee<ue.length;Ee++)ue[Ee]=H[Ee];return xn.createDecoderResultFromAmbiguousValues(w.getBarcodeECLevel(),U,dr.toIntArray(O),dr.toIntArray(Z),ue)}static createDecoderResultFromAmbiguousValues(w,E,O,U,H){let Z=new Int32Array(U.length),ue=100;for(;ue-- >0;){for(let Ee=0;Ee<Z.length;Ee++)E[U[Ee]]=H[Ee][Z[Ee]];try{return xn.decodeCodewords(E,w,O)}catch(Ee){if(!(Ee instanceof g))throw Ee}if(Z.length===0)throw g.getChecksumInstance();for(let Ee=0;Ee<Z.length;Ee++)if(Z[Ee]<H[Ee].length-1){Z[Ee]++;break}else if(Z[Ee]=0,Ee===Z.length-1)throw g.getChecksumInstance()}throw g.getChecksumInstance()}static createBarcodeMatrix(w){let E=Array.from({length:w.getBarcodeRowCount()},()=>new Array(w.getBarcodeColumnCount()+2));for(let U=0;U<E.length;U++)for(let H=0;H<E[U].length;H++)E[U][H]=new ar;let O=0;for(let U of w.getDetectionResultColumns()){if(U!=null){for(let H of U.getCodewords())if(H!=null){let Z=H.getRowNumber();if(Z>=0){if(Z>=E.length)continue;E[Z][O].setValue(H.getValue())}}}O++}return E}static isValidBarcodeColumn(w,E){return E>=0&&E<=w.getBarcodeColumnCount()+1}static getStartColumn(w,E,O,U){let H=U?1:-1,Z=null;if(xn.isValidBarcodeColumn(w,E-H)&&(Z=w.getDetectionResultColumn(E-H).getCodeword(O)),Z!=null)return U?Z.getEndX():Z.getStartX();if(Z=w.getDetectionResultColumn(E).getCodewordNearby(O),Z!=null)return U?Z.getStartX():Z.getEndX();if(xn.isValidBarcodeColumn(w,E-H)&&(Z=w.getDetectionResultColumn(E-H).getCodewordNearby(O)),Z!=null)return U?Z.getEndX():Z.getStartX();let ue=0;for(;xn.isValidBarcodeColumn(w,E-H);){E-=H;for(let Ee of w.getDetectionResultColumn(E).getCodewords())if(Ee!=null)return(U?Ee.getEndX():Ee.getStartX())+H*ue*(Ee.getEndX()-Ee.getStartX());ue++}return U?w.getBoundingBox().getMinX():w.getBoundingBox().getMaxX()}static detectCodeword(w,E,O,U,H,Z,ue,Ee){H=xn.adjustCodewordStartColumn(w,E,O,U,H,Z);let Re=xn.getModuleBitCount(w,E,O,U,H,Z);if(Re==null)return null;let ot,Ct=xt.sum(Re);if(U)ot=H+Ct;else{for(let Et=0;Et<Re.length/2;Et++){let Yt=Re[Et];Re[Et]=Re[Re.length-1-Et],Re[Re.length-1-Et]=Yt}ot=H,H=ot-Ct}if(!xn.checkCodewordSkew(Ct,ue,Ee))return null;let Dt=cr.getDecodedValue(Re),sn=dr.getCodeword(Dt);return sn===-1?null:new $r(H,ot,xn.getCodewordBucketNumber(Dt),sn)}static getModuleBitCount(w,E,O,U,H,Z){let ue=H,Ee=new Int32Array(8),Re=0,ot=U?1:-1,Ct=U;for(;(U?ue<O:ue>=E)&&Re<Ee.length;)w.get(ue,Z)===Ct?(Ee[Re]++,ue+=ot):(Re++,Ct=!Ct);return Re===Ee.length||ue===(U?O:E)&&Re===Ee.length-1?Ee:null}static getNumberOfECCodeWords(w){return 2<<w}static adjustCodewordStartColumn(w,E,O,U,H,Z){let ue=H,Ee=U?-1:1;for(let Re=0;Re<2;Re++){for(;(U?ue>=E:ue<O)&&U===w.get(ue,Z);){if(Math.abs(H-ue)>xn.CODEWORD_SKEW_SIZE)return H;ue+=Ee}Ee=-Ee,U=!U}return ue}static checkCodewordSkew(w,E,O){return E-xn.CODEWORD_SKEW_SIZE<=w&&w<=O+xn.CODEWORD_SKEW_SIZE}static decodeCodewords(w,E,O){if(w.length===0)throw L.getFormatInstance();let U=1<<E+1,H=xn.correctErrors(w,O,U);xn.verifyCodewordCount(w,U);let Z=At.decode(w,""+E);return Z.setErrorsCorrected(H),Z.setErasures(O.length),Z}static correctErrors(w,E,O){if(E!=null&&E.length>O/2+xn.MAX_ERRORS||O<0||O>xn.MAX_EC_CODEWORDS)throw g.getChecksumInstance();return xn.errorCorrection.decode(w,O,E)}static verifyCodewordCount(w,E){if(w.length<4)throw L.getFormatInstance();let O=w[0];if(O>w.length)throw L.getFormatInstance();if(O===0)if(E<w.length)w[0]=w.length-E;else throw L.getFormatInstance()}static getBitCountForCodeword(w){let E=new Int32Array(8),O=0,U=E.length-1;for(;!((w&1)!==O&&(O=w&1,U--,U<0));)E[U]++,w>>=1;return E}static getCodewordBucketNumber(w){return w instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(w):this.getCodewordBucketNumber_number(w)}static getCodewordBucketNumber_number(w){return xn.getCodewordBucketNumber(xn.getBitCountForCodeword(w))}static getCodewordBucketNumber_Int32Array(w){return(w[0]-w[2]+w[4]-w[6]+9)%9}static toString(w){let E=new Nt;for(let O=0;O<w.length;O++){E.format("Row %2d: ",O);for(let U=0;U<w[O].length;U++){let H=w[O][U];H.getValue().length===0?E.format(" ",null):E.format("%4d(%2d)",H.getValue()[0],H.getConfidence(H.getValue()[0]))}E.format("%n")}return E.toString()}}xn.CODEWORD_SKEW_SIZE=2,xn.MAX_ERRORS=3,xn.MAX_EC_CODEWORDS=512,xn.errorCorrection=new ls;class Cn{decode(w,E=null){let O=Cn.decode(w,E,!1);if(O==null||O.length===0||O[0]==null)throw G.getNotFoundInstance();return O[0]}decodeMultiple(w,E=null){try{return Cn.decode(w,E,!0)}catch(O){throw O instanceof L||O instanceof g?G.getNotFoundInstance():O}}static decode(w,E,O){const U=new Array,H=qn.detectMultiple(w,E,O);for(const Z of H.getPoints()){const ue=xn.decode(H.getBits(),Z[4],Z[5],Z[6],Z[7],Cn.getMinCodewordWidth(Z),Cn.getMaxCodewordWidth(Z)),Ee=new xe(ue.getText(),ue.getRawBytes(),void 0,Z,ge.PDF_417);Ee.putMetadata(je.ERROR_CORRECTION_LEVEL,ue.getECLevel());const Re=ue.getOther();Re!=null&&Ee.putMetadata(je.PDF417_EXTRA_METADATA,Re),U.push(Ee)}return U.map(Z=>Z)}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?P.MAX_VALUE:Math.trunc(Math.abs(w.getX()-E.getX()))}static getMaxCodewordWidth(w){return Math.floor(Math.max(Math.max(Cn.getMaxWidth(w[0],w[4]),Cn.getMaxWidth(w[6],w[2])*dr.MODULES_IN_CODEWORD/dr.MODULES_IN_STOP_PATTERN),Math.max(Cn.getMaxWidth(w[1],w[5]),Cn.getMaxWidth(w[7],w[3])*dr.MODULES_IN_CODEWORD/dr.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(w){return Math.floor(Math.min(Math.min(Cn.getMinWidth(w[0],w[4]),Cn.getMinWidth(w[6],w[2])*dr.MODULES_IN_CODEWORD/dr.MODULES_IN_STOP_PATTERN),Math.min(Cn.getMinWidth(w[1],w[5]),Cn.getMinWidth(w[7],w[3])*dr.MODULES_IN_CODEWORD/dr.MODULES_IN_STOP_PATTERN)))}reset(){}}class fr extends u{}fr.kind="ReaderException";class _r{constructor(w,E){this.verbose=w===!0,E&&this.setHints(E)}decode(w,E){return E&&this.setHints(E),this.decodeInternal(w)}decodeWithState(w){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(w)}setHints(w){this.hints=w;const E=!r(w)&&w.get($.TRY_HARDER)===!0,O=r(w)?null:w.get($.POSSIBLE_FORMATS),U=new Array;if(!r(O)){const H=O.some(Z=>Z===ge.UPC_A||Z===ge.UPC_E||Z===ge.EAN_13||Z===ge.EAN_8||Z===ge.CODABAR||Z===ge.CODE_39||Z===ge.CODE_93||Z===ge.CODE_128||Z===ge.ITF||Z===ge.RSS_14||Z===ge.RSS_EXPANDED);H&&!E&&U.push(new k(w,this.verbose)),O.includes(ge.QR_CODE)&&U.push(new Sr),O.includes(ge.DATA_MATRIX)&&U.push(new we),O.includes(ge.AZTEC)&&U.push(new hn),O.includes(ge.PDF_417)&&U.push(new Cn),H&&E&&U.push(new k(w,this.verbose))}U.length===0&&(E||U.push(new k(w,this.verbose)),U.push(new Sr),U.push(new we),U.push(new hn),U.push(new Cn),E&&U.push(new k(w,this.verbose))),this.readers=U}reset(){if(this.readers!==null)for(const w of this.readers)w.reset()}decodeInternal(w){if(this.readers===null)throw new fr("No readers where selected, nothing can be read.");for(const E of this.readers)try{return E.decode(w,this.hints)}catch(O){if(O instanceof fr)continue}throw new G("No MultiFormat Readers were able to detect the code.")}}class pr extends _e{constructor(w=null,E=500){const O=new _r;O.setHints(w),super(O,E)}decodeBitmap(w){return this.reader.decodeWithState(w)}}class hr extends _e{constructor(w=500){super(new Cn,w)}}class Xr extends _e{constructor(w=500){super(new Sr,w)}}var is;(function(wt){wt[wt.ERROR_CORRECTION=0]="ERROR_CORRECTION",wt[wt.CHARACTER_SET=1]="CHARACTER_SET",wt[wt.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",wt[wt.MIN_SIZE=3]="MIN_SIZE",wt[wt.MAX_SIZE=4]="MAX_SIZE",wt[wt.MARGIN=5]="MARGIN",wt[wt.PDF417_COMPACT=6]="PDF417_COMPACT",wt[wt.PDF417_COMPACTION=7]="PDF417_COMPACTION",wt[wt.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",wt[wt.AZTEC_LAYERS=9]="AZTEC_LAYERS",wt[wt.QR_VERSION=10]="QR_VERSION"})(is||(is={}));var Pr=is;class yr{constructor(w){this.field=w,this.cachedGenerators=[],this.cachedGenerators.push(new Ye(w,Int32Array.from([1])))}buildGenerator(w){const E=this.cachedGenerators;if(w>=E.length){let O=E[E.length-1];const U=this.field;for(let H=E.length;H<=w;H++){const Z=O.multiply(new Ye(U,Int32Array.from([1,U.exp(H-1+U.getGeneratorBase())])));E.push(Z),O=Z}}return E[w]}encode(w,E){if(E===0)throw new f("No error correction bytes");const O=w.length-E;if(O<=0)throw new f("No data bytes provided");const U=this.buildGenerator(E),H=new Int32Array(O);v.arraycopy(w,0,H,0,O);let Z=new Ye(this.field,H);Z=Z.multiplyByMonomial(E,1);const Ee=Z.divide(U)[1].getCoefficients(),Re=E-Ee.length;for(let ot=0;ot<Re;ot++)w[O+ot]=0;v.arraycopy(Ee,0,w,O+Re,Ee.length)}}class nr{constructor(){}static applyMaskPenaltyRule1(w){return nr.applyMaskPenaltyRule1Internal(w,!0)+nr.applyMaskPenaltyRule1Internal(w,!1)}static applyMaskPenaltyRule2(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let Z=0;Z<H-1;Z++){const ue=O[Z];for(let Ee=0;Ee<U-1;Ee++){const Re=ue[Ee];Re===ue[Ee+1]&&Re===O[Z+1][Ee]&&Re===O[Z+1][Ee+1]&&E++}}return nr.N2*E}static applyMaskPenaltyRule3(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let Z=0;Z<H;Z++)for(let ue=0;ue<U;ue++){const Ee=O[Z];ue+6<U&&Ee[ue]===1&&Ee[ue+1]===0&&Ee[ue+2]===1&&Ee[ue+3]===1&&Ee[ue+4]===1&&Ee[ue+5]===0&&Ee[ue+6]===1&&(nr.isWhiteHorizontal(Ee,ue-4,ue)||nr.isWhiteHorizontal(Ee,ue+7,ue+11))&&E++,Z+6<H&&O[Z][ue]===1&&O[Z+1][ue]===0&&O[Z+2][ue]===1&&O[Z+3][ue]===1&&O[Z+4][ue]===1&&O[Z+5][ue]===0&&O[Z+6][ue]===1&&(nr.isWhiteVertical(O,ue,Z-4,Z)||nr.isWhiteVertical(O,ue,Z+7,Z+11))&&E++}return E*nr.N3}static isWhiteHorizontal(w,E,O){E=Math.max(E,0),O=Math.min(O,w.length);for(let U=E;U<O;U++)if(w[U]===1)return!1;return!0}static isWhiteVertical(w,E,O,U){O=Math.max(O,0),U=Math.min(U,w.length);for(let H=O;H<U;H++)if(w[H][E]===1)return!1;return!0}static applyMaskPenaltyRule4(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let Ee=0;Ee<H;Ee++){const Re=O[Ee];for(let ot=0;ot<U;ot++)Re[ot]===1&&E++}const Z=w.getHeight()*w.getWidth();return Math.floor(Math.abs(E*2-Z)*10/Z)*nr.N4}static getDataMaskBit(w,E,O){let U,H;switch(w){case 0:U=O+E&1;break;case 1:U=O&1;break;case 2:U=E%3;break;case 3:U=(O+E)%3;break;case 4:U=Math.floor(O/2)+Math.floor(E/3)&1;break;case 5:H=O*E,U=(H&1)+H%3;break;case 6:H=O*E,U=(H&1)+H%3&1;break;case 7:H=O*E,U=H%3+(O+E&1)&1;break;default:throw new f("Invalid mask pattern: "+w)}return U===0}static applyMaskPenaltyRule1Internal(w,E){let O=0;const U=E?w.getHeight():w.getWidth(),H=E?w.getWidth():w.getHeight(),Z=w.getArray();for(let ue=0;ue<U;ue++){let Ee=0,Re=-1;for(let ot=0;ot<H;ot++){const Ct=E?Z[ue][ot]:Z[ot][ue];Ct===Re?Ee++:(Ee>=5&&(O+=nr.N1+(Ee-5)),Ee=1,Re=Ct)}Ee>=5&&(O+=nr.N1+(Ee-5))}return O}}nr.N1=3,nr.N2=3,nr.N3=40,nr.N4=10;class gs{constructor(w,E){this.width=w,this.height=E;const O=new Array(E);for(let U=0;U!==E;U++)O[U]=new Uint8Array(w);this.bytes=O}getHeight(){return this.height}getWidth(){return this.width}get(w,E){return this.bytes[E][w]}getArray(){return this.bytes}setNumber(w,E,O){this.bytes[E][w]=O}setBoolean(w,E,O){this.bytes[E][w]=O?1:0}clear(w){for(const E of this.bytes)I.fill(E,w)}equals(w){if(!(w instanceof gs))return!1;const E=w;if(this.width!==E.width||this.height!==E.height)return!1;for(let O=0,U=this.height;O<U;++O){const H=this.bytes[O],Z=E.bytes[O];for(let ue=0,Ee=this.width;ue<Ee;++ue)if(H[ue]!==Z[ue])return!1}return!0}toString(){const w=new re;for(let E=0,O=this.height;E<O;++E){const U=this.bytes[E];for(let H=0,Z=this.width;H<Z;++H)switch(U[H]){case 0:w.append(" 0");break;case 1:w.append(" 1");break;default:w.append(" ");break}w.append(`
`)}return w.toString()}}class ei{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 re;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<ei.NUM_MASK_PATTERNS}}ei.NUM_MASK_PATTERNS=8;class ci extends u{}ci.kind="WriterException";class Fr{constructor(){}static clearMatrix(w){w.clear(255)}static buildMatrix(w,E,O,U,H){Fr.clearMatrix(H),Fr.embedBasicPatterns(O,H),Fr.embedTypeInfo(E,U,H),Fr.maybeEmbedVersionInfo(O,H),Fr.embedDataBits(w,U,H)}static embedBasicPatterns(w,E){Fr.embedPositionDetectionPatternsAndSeparators(E),Fr.embedDarkDotAtLeftBottomCorner(E),Fr.maybeEmbedPositionAdjustmentPatterns(w,E),Fr.embedTimingPatterns(E)}static embedTypeInfo(w,E,O){const U=new M;Fr.makeTypeInfoBits(w,E,U);for(let H=0,Z=U.getSize();H<Z;++H){const ue=U.get(U.getSize()-1-H),Ee=Fr.TYPE_INFO_COORDINATES[H],Re=Ee[0],ot=Ee[1];if(O.setBoolean(Re,ot,ue),H<8){const Ct=O.getWidth()-H-1;O.setBoolean(Ct,8,ue)}else{const Dt=O.getHeight()-7+(H-8);O.setBoolean(8,Dt,ue)}}}static maybeEmbedVersionInfo(w,E){if(w.getVersionNumber()<7)return;const O=new M;Fr.makeVersionInfoBits(w,O);let U=6*3-1;for(let H=0;H<6;++H)for(let Z=0;Z<3;++Z){const ue=O.get(U);U--,E.setBoolean(H,E.getHeight()-11+Z,ue),E.setBoolean(E.getHeight()-11+Z,H,ue)}}static embedDataBits(w,E,O){let U=0,H=-1,Z=O.getWidth()-1,ue=O.getHeight()-1;for(;Z>0;){for(Z===6&&(Z-=1);ue>=0&&ue<O.getHeight();){for(let Ee=0;Ee<2;++Ee){const Re=Z-Ee;if(!Fr.isEmpty(O.get(Re,ue)))continue;let ot;U<w.getSize()?(ot=w.get(U),++U):ot=!1,E!==255&&nr.getDataMaskBit(E,Re,ue)&&(ot=!ot),O.setBoolean(Re,ue,ot)}ue+=H}H=-H,ue+=H,Z-=2}if(U!==w.getSize())throw new ci("Not all bits consumed: "+U+"/"+w.getSize())}static findMSBSet(w){return 32-P.numberOfLeadingZeros(w)}static calculateBCHCode(w,E){if(E===0)throw new f("0 polynomial");const O=Fr.findMSBSet(E);for(w<<=O-1;Fr.findMSBSet(w)>=O;)w^=E<<Fr.findMSBSet(w)-O;return w}static makeTypeInfoBits(w,E,O){if(!ei.isValidMaskPattern(E))throw new ci("Invalid mask pattern");const U=w.getBits()<<3|E;O.appendBits(U,5);const H=Fr.calculateBCHCode(U,Fr.TYPE_INFO_POLY);O.appendBits(H,10);const Z=new M;if(Z.appendBits(Fr.TYPE_INFO_MASK_PATTERN,15),O.xor(Z),O.getSize()!==15)throw new ci("should not happen but we got: "+O.getSize())}static makeVersionInfoBits(w,E){E.appendBits(w.getVersionNumber(),6);const O=Fr.calculateBCHCode(w.getVersionNumber(),Fr.VERSION_INFO_POLY);if(E.appendBits(O,12),E.getSize()!==18)throw new ci("should not happen but we got: "+E.getSize())}static isEmpty(w){return w===255}static embedTimingPatterns(w){for(let E=8;E<w.getWidth()-8;++E){const O=(E+1)%2;Fr.isEmpty(w.get(E,6))&&w.setNumber(E,6,O),Fr.isEmpty(w.get(6,E))&&w.setNumber(6,E,O)}}static embedDarkDotAtLeftBottomCorner(w){if(w.get(8,w.getHeight()-8)===0)throw new ci;w.setNumber(8,w.getHeight()-8,1)}static embedHorizontalSeparationPattern(w,E,O){for(let U=0;U<8;++U){if(!Fr.isEmpty(O.get(w+U,E)))throw new ci;O.setNumber(w+U,E,0)}}static embedVerticalSeparationPattern(w,E,O){for(let U=0;U<7;++U){if(!Fr.isEmpty(O.get(w,E+U)))throw new ci;O.setNumber(w,E+U,0)}}static embedPositionAdjustmentPattern(w,E,O){for(let U=0;U<5;++U){const H=Fr.POSITION_ADJUSTMENT_PATTERN[U];for(let Z=0;Z<5;++Z)O.setNumber(w+Z,E+U,H[Z])}}static embedPositionDetectionPattern(w,E,O){for(let U=0;U<7;++U){const H=Fr.POSITION_DETECTION_PATTERN[U];for(let Z=0;Z<7;++Z)O.setNumber(w+Z,E+U,H[Z])}}static embedPositionDetectionPatternsAndSeparators(w){const E=Fr.POSITION_DETECTION_PATTERN[0].length;Fr.embedPositionDetectionPattern(0,0,w),Fr.embedPositionDetectionPattern(w.getWidth()-E,0,w),Fr.embedPositionDetectionPattern(0,w.getWidth()-E,w);const O=8;Fr.embedHorizontalSeparationPattern(0,O-1,w),Fr.embedHorizontalSeparationPattern(w.getWidth()-O,O-1,w),Fr.embedHorizontalSeparationPattern(0,w.getWidth()-O,w);const U=7;Fr.embedVerticalSeparationPattern(U,0,w),Fr.embedVerticalSeparationPattern(w.getHeight()-U-1,0,w),Fr.embedVerticalSeparationPattern(U,w.getHeight()-U,w)}static maybeEmbedPositionAdjustmentPatterns(w,E){if(w.getVersionNumber()<2)return;const O=w.getVersionNumber()-1,U=Fr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[O];for(let H=0,Z=U.length;H!==Z;H++){const ue=U[H];if(ue>=0)for(let Ee=0;Ee!==Z;Ee++){const Re=U[Ee];Re>=0&&Fr.isEmpty(E.get(Re,ue))&&Fr.embedPositionAdjustmentPattern(Re-2,ue-2,E)}}}}Fr.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Fr.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Fr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Fr.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Fr.VERSION_INFO_POLY=7973,Fr.TYPE_INFO_POLY=1335,Fr.TYPE_INFO_MASK_PATTERN=21522;class En{constructor(w,E){this.dataBytes=w,this.errorCorrectionBytes=E}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Bn{constructor(){}static calculateMaskPenalty(w){return nr.applyMaskPenaltyRule1(w)+nr.applyMaskPenaltyRule2(w)+nr.applyMaskPenaltyRule3(w)+nr.applyMaskPenaltyRule4(w)}static encode(w,E,O=null){let U=Bn.DEFAULT_BYTE_MODE_ENCODING;const H=O!==null&&O.get(Pr.CHARACTER_SET)!==void 0;H&&(U=O.get(Pr.CHARACTER_SET).toString());const Z=this.chooseMode(w,U),ue=new M;if(Z===et.BYTE&&(H||Bn.DEFAULT_BYTE_MODE_ENCODING!==U)){const Nr=Q.getCharacterSetECIByName(U);Nr!==void 0&&this.appendECI(Nr,ue)}this.appendModeInfo(Z,ue);const Ee=new M;this.appendBytes(w,Z,Ee,U);let Re;if(O!==null&&O.get(Pr.QR_VERSION)!==void 0){const Nr=Number.parseInt(O.get(Pr.QR_VERSION).toString(),10);Re=at.getVersionForNumber(Nr);const Ar=this.calculateBitsNeeded(Z,ue,Ee,Re);if(!this.willFit(Ar,Re,E))throw new ci("Data too big for requested version")}else Re=this.recommendVersion(E,Z,ue,Ee);const ot=new M;ot.appendBitArray(ue);const Ct=Z===et.BYTE?Ee.getSizeInBytes():w.length;this.appendLengthInfo(Ct,Re,Z,ot),ot.appendBitArray(Ee);const Dt=Re.getECBlocksForLevel(E),sn=Re.getTotalCodewords()-Dt.getTotalECCodewords();this.terminateBits(sn,ot);const Et=this.interleaveWithECBytes(ot,Re.getTotalCodewords(),sn,Dt.getNumBlocks()),Yt=new ei;Yt.setECLevel(E),Yt.setMode(Z),Yt.setVersion(Re);const Jt=Re.getDimensionForVersion(),Pn=new gs(Jt,Jt),xr=this.chooseMaskPattern(Et,E,Re,Pn);return Yt.setMaskPattern(xr),Fr.buildMatrix(Et,E,Re,xr,Pn),Yt.setMatrix(Pn),Yt}static recommendVersion(w,E,O,U){const H=this.calculateBitsNeeded(E,O,U,at.getVersionForNumber(1)),Z=this.chooseVersion(H,w),ue=this.calculateBitsNeeded(E,O,U,Z);return this.chooseVersion(ue,w)}static calculateBitsNeeded(w,E,O,U){return E.getSize()+w.getCharacterCountBits(U)+O.getSize()}static getAlphanumericCode(w){return w<Bn.ALPHANUMERIC_TABLE.length?Bn.ALPHANUMERIC_TABLE[w]:-1}static chooseMode(w,E=null){if(Q.SJIS.getName()===E&&this.isOnlyDoubleByteKanji(w))return et.KANJI;let O=!1,U=!1;for(let H=0,Z=w.length;H<Z;++H){const ue=w.charAt(H);if(Bn.isDigit(ue))O=!0;else if(this.getAlphanumericCode(ue.charCodeAt(0))!==-1)U=!0;else return et.BYTE}return U?et.ALPHANUMERIC:O?et.NUMERIC:et.BYTE}static isOnlyDoubleByteKanji(w){let E;try{E=ee.encode(w,Q.SJIS)}catch{return!1}const O=E.length;if(O%2!==0)return!1;for(let U=0;U<O;U+=2){const H=E[U]&255;if((H<129||H>159)&&(H<224||H>235))return!1}return!0}static chooseMaskPattern(w,E,O,U){let H=Number.MAX_SAFE_INTEGER,Z=-1;for(let ue=0;ue<ei.NUM_MASK_PATTERNS;ue++){Fr.buildMatrix(w,E,O,ue,U);let Ee=this.calculateMaskPenalty(U);Ee<H&&(H=Ee,Z=ue)}return Z}static chooseVersion(w,E){for(let O=1;O<=40;O++){const U=at.getVersionForNumber(O);if(Bn.willFit(w,U,E))return U}throw new ci("Data too big")}static willFit(w,E,O){const U=E.getTotalCodewords(),Z=E.getECBlocksForLevel(O).getTotalECCodewords(),ue=U-Z,Ee=(w+7)/8;return ue>=Ee}static terminateBits(w,E){const O=w*8;if(E.getSize()>O)throw new ci("data bits cannot fit in the QR Code"+E.getSize()+" > "+O);for(let Z=0;Z<4&&E.getSize()<O;++Z)E.appendBit(!1);const U=E.getSize()&7;if(U>0)for(let Z=U;Z<8;Z++)E.appendBit(!1);const H=w-E.getSizeInBytes();for(let Z=0;Z<H;++Z)E.appendBits(Z&1?17:236,8);if(E.getSize()!==O)throw new ci("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(w,E,O,U,H,Z){if(U>=O)throw new ci("Block ID too large");const ue=w%O,Ee=O-ue,Re=Math.floor(w/O),ot=Re+1,Ct=Math.floor(E/O),Dt=Ct+1,sn=Re-Ct,Et=ot-Dt;if(sn!==Et)throw new ci("EC bytes mismatch");if(O!==Ee+ue)throw new ci("RS blocks mismatch");if(w!==(Ct+sn)*Ee+(Dt+Et)*ue)throw new ci("Total bytes mismatch");U<Ee?(H[0]=Ct,Z[0]=sn):(H[0]=Dt,Z[0]=Et)}static interleaveWithECBytes(w,E,O,U){if(w.getSizeInBytes()!==O)throw new ci("Number of bits and data bytes does not match");let H=0,Z=0,ue=0;const Ee=new Array;for(let ot=0;ot<U;++ot){const Ct=new Int32Array(1),Dt=new Int32Array(1);Bn.getNumDataBytesAndNumECBytesForBlockID(E,O,U,ot,Ct,Dt);const sn=Ct[0],Et=new Uint8Array(sn);w.toBytes(8*H,Et,0,sn);const Yt=Bn.generateECBytes(Et,Dt[0]);Ee.push(new En(Et,Yt)),Z=Math.max(Z,sn),ue=Math.max(ue,Yt.length),H+=Ct[0]}if(O!==H)throw new ci("Data bytes does not match offset");const Re=new M;for(let ot=0;ot<Z;++ot)for(const Ct of Ee){const Dt=Ct.getDataBytes();ot<Dt.length&&Re.appendBits(Dt[ot],8)}for(let ot=0;ot<ue;++ot)for(const Ct of Ee){const Dt=Ct.getErrorCorrectionBytes();ot<Dt.length&&Re.appendBits(Dt[ot],8)}if(E!==Re.getSizeInBytes())throw new ci("Interleaving error: "+E+" and "+Re.getSizeInBytes()+" differ.");return Re}static generateECBytes(w,E){const O=w.length,U=new Int32Array(O+E);for(let Z=0;Z<O;Z++)U[Z]=w[Z]&255;new yr(ht.QR_CODE_FIELD_256).encode(U,E);const H=new Uint8Array(E);for(let Z=0;Z<E;Z++)H[Z]=U[O+Z];return H}static appendModeInfo(w,E){E.appendBits(w.getBits(),4)}static appendLengthInfo(w,E,O,U){const H=O.getCharacterCountBits(E);if(w>=1<<H)throw new ci(w+" is bigger than "+((1<<H)-1));U.appendBits(w,H)}static appendBytes(w,E,O,U){switch(E){case et.NUMERIC:Bn.appendNumericBytes(w,O);break;case et.ALPHANUMERIC:Bn.appendAlphanumericBytes(w,O);break;case et.BYTE:Bn.append8BitBytes(w,O,U);break;case et.KANJI:Bn.appendKanjiBytes(w,O);break;default:throw new ci("Invalid mode: "+E)}}static getDigit(w){return w.charCodeAt(0)-48}static isDigit(w){const E=Bn.getDigit(w);return E>=0&&E<=9}static appendNumericBytes(w,E){const O=w.length;let U=0;for(;U<O;){const H=Bn.getDigit(w.charAt(U));if(U+2<O){const Z=Bn.getDigit(w.charAt(U+1)),ue=Bn.getDigit(w.charAt(U+2));E.appendBits(H*100+Z*10+ue,10),U+=3}else if(U+1<O){const Z=Bn.getDigit(w.charAt(U+1));E.appendBits(H*10+Z,7),U+=2}else E.appendBits(H,4),U++}}static appendAlphanumericBytes(w,E){const O=w.length;let U=0;for(;U<O;){const H=Bn.getAlphanumericCode(w.charCodeAt(U));if(H===-1)throw new ci;if(U+1<O){const Z=Bn.getAlphanumericCode(w.charCodeAt(U+1));if(Z===-1)throw new ci;E.appendBits(H*45+Z,11),U+=2}else E.appendBits(H,6),U++}}static append8BitBytes(w,E,O){let U;try{U=ee.encode(w,O)}catch(H){throw new ci(H)}for(let H=0,Z=U.length;H!==Z;H++){const ue=U[H];E.appendBits(ue,8)}}static appendKanjiBytes(w,E){let O;try{O=ee.encode(w,Q.SJIS)}catch(H){throw new ci(H)}const U=O.length;for(let H=0;H<U;H+=2){const Z=O[H]&255,ue=O[H+1]&255,Ee=Z<<8&4294967295|ue;let Re=-1;if(Ee>=33088&&Ee<=40956?Re=Ee-33088:Ee>=57408&&Ee<=60351&&(Re=Ee-49472),Re===-1)throw new ci("Invalid byte sequence");const ot=(Re>>8)*192+(Re&255);E.appendBits(ot,13)}}static appendECI(w,E){E.appendBits(et.ECI.getBits(),4),E.appendBits(w.getValue(),8)}}Bn.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]),Bn.DEFAULT_BYTE_MODE_ENCODING=Q.UTF8.getName();class mt{write(w,E,O,U=null){if(w.length===0)throw new f("Found empty contents");if(E<0||O<0)throw new f("Requested dimensions are too small: "+E+"x"+O);let H=ve.L,Z=mt.QUIET_ZONE_SIZE;U!==null&&(U.get(Pr.ERROR_CORRECTION)!==void 0&&(H=ve.fromString(U.get(Pr.ERROR_CORRECTION).toString())),U.get(Pr.MARGIN)!==void 0&&(Z=Number.parseInt(U.get(Pr.MARGIN).toString(),10)));const ue=Bn.encode(w,H,U);return this.renderResult(ue,E,O,Z)}writeToDom(w,E,O,U,H=null){typeof w=="string"&&(w=document.querySelector(w));const Z=this.write(E,O,U,H);w&&w.appendChild(Z)}renderResult(w,E,O,U){const H=w.getMatrix();if(H===null)throw new st;const Z=H.getWidth(),ue=H.getHeight(),Ee=Z+U*2,Re=ue+U*2,ot=Math.max(E,Ee),Ct=Math.max(O,Re),Dt=Math.min(Math.floor(ot/Ee),Math.floor(Ct/Re)),sn=Math.floor((ot-Z*Dt)/2),Et=Math.floor((Ct-ue*Dt)/2),Yt=this.createSVGElement(ot,Ct);for(let Jt=0,Pn=Et;Jt<ue;Jt++,Pn+=Dt)for(let xr=0,Nr=sn;xr<Z;xr++,Nr+=Dt)if(H.get(xr,Jt)===1){const Ar=this.createSvgRectElement(Nr,Pn,Dt,Dt);Yt.appendChild(Ar)}return Yt}createSVGElement(w,E){const O=document.createElementNS(mt.SVG_NS,"svg");return O.setAttributeNS(null,"height",w.toString()),O.setAttributeNS(null,"width",E.toString()),O}createSvgRectElement(w,E,O,U){const H=document.createElementNS(mt.SVG_NS,"rect");return H.setAttributeNS(null,"x",w.toString()),H.setAttributeNS(null,"y",E.toString()),H.setAttributeNS(null,"height",O.toString()),H.setAttributeNS(null,"width",U.toString()),H.setAttributeNS(null,"fill","#000000"),H}}mt.QUIET_ZONE_SIZE=4,mt.SVG_NS="http://www.w3.org/2000/svg";class Kt{encode(w,E,O,U,H){if(w.length===0)throw new f("Found empty contents");if(E!==ge.QR_CODE)throw new f("Can only encode QR_CODE, but got "+E);if(O<0||U<0)throw new f(`Requested dimensions are too small: ${O}x${U}`);let Z=ve.L,ue=Kt.QUIET_ZONE_SIZE;H!==null&&(H.get(Pr.ERROR_CORRECTION)!==void 0&&(Z=ve.fromString(H.get(Pr.ERROR_CORRECTION).toString())),H.get(Pr.MARGIN)!==void 0&&(ue=Number.parseInt(H.get(Pr.MARGIN).toString(),10)));const Ee=Bn.encode(w,Z,H);return Kt.renderResult(Ee,O,U,ue)}static renderResult(w,E,O,U){const H=w.getMatrix();if(H===null)throw new st;const Z=H.getWidth(),ue=H.getHeight(),Ee=Z+U*2,Re=ue+U*2,ot=Math.max(E,Ee),Ct=Math.max(O,Re),Dt=Math.min(Math.floor(ot/Ee),Math.floor(Ct/Re)),sn=Math.floor((ot-Z*Dt)/2),Et=Math.floor((Ct-ue*Dt)/2),Yt=new de(ot,Ct);for(let Jt=0,Pn=Et;Jt<ue;Jt++,Pn+=Dt)for(let xr=0,Nr=sn;xr<Z;xr++,Nr+=Dt)H.get(xr,Jt)===1&&Yt.setRegion(Nr,Pn,Dt,Dt);return Yt}}Kt.QUIET_ZONE_SIZE=4;class sr{encode(w,E,O,U,H){let Z;switch(E){case ge.QR_CODE:Z=new Kt;break;default:throw new f("No encoder available for format "+E)}return Z.encode(w,E,O,U,H)}}class Zn extends q{constructor(w,E,O,U,H,Z,ue,Ee){if(super(Z,ue),this.yuvData=w,this.dataWidth=E,this.dataHeight=O,this.left=U,this.top=H,U+Z>E||H+ue>O)throw new f("Crop rectangle does not fit within image data.");Ee&&this.reverseHorizontal(Z,ue)}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth();(E==null||E.length<O)&&(E=new Uint8ClampedArray(O));const U=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.yuvData,U,E,0,O),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.yuvData;const O=w*E,U=new Uint8ClampedArray(O);let H=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.yuvData,H,U,0,O),U;for(let Z=0;Z<E;Z++){const ue=Z*w;v.arraycopy(this.yuvData,H,U,ue,w),H+=this.dataWidth}return U}isCropSupported(){return!0}crop(w,E,O,U){return new Zn(this.yuvData,this.dataWidth,this.dataHeight,this.left+w,this.top+E,O,U,!1)}renderThumbnail(){const w=this.getWidth()/Zn.THUMBNAIL_SCALE_FACTOR,E=this.getHeight()/Zn.THUMBNAIL_SCALE_FACTOR,O=new Int32Array(w*E),U=this.yuvData;let H=this.top*this.dataWidth+this.left;for(let Z=0;Z<E;Z++){const ue=Z*w;for(let Ee=0;Ee<w;Ee++){const Re=U[H+Ee*Zn.THUMBNAIL_SCALE_FACTOR]&255;O[ue+Ee]=4278190080|Re*65793}H+=this.dataWidth*Zn.THUMBNAIL_SCALE_FACTOR}return O}getThumbnailWidth(){return this.getWidth()/Zn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Zn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(w,E){const O=this.yuvData;for(let U=0,H=this.top*this.dataWidth+this.left;U<E;U++,H+=this.dataWidth){const Z=H+w/2;for(let ue=H,Ee=H+w-1;ue<Z;ue++,Ee--){const Re=O[ue];O[ue]=O[Ee],O[Ee]=Re}}}invert(){return new W(this)}}Zn.THUMBNAIL_SCALE_FACTOR=2;class Or extends q{constructor(w,E,O,U,H,Z,ue){if(super(E,O),this.dataWidth=U,this.dataHeight=H,this.left=Z,this.top=ue,w.BYTES_PER_ELEMENT===4){const Ee=E*O,Re=new Uint8ClampedArray(Ee);for(let ot=0;ot<Ee;ot++){const Ct=w[ot],Dt=Ct>>16&255,sn=Ct>>7&510,Et=Ct&255;Re[ot]=(Dt+sn+Et)/4&255}this.luminances=Re}else this.luminances=w;if(U===void 0&&(this.dataWidth=E),H===void 0&&(this.dataHeight=O),Z===void 0&&(this.left=0),ue===void 0&&(this.top=0),this.left+E>this.dataWidth||this.top+O>this.dataHeight)throw new f("Crop rectangle does not fit within image data.")}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth();(E==null||E.length<O)&&(E=new Uint8ClampedArray(O));const U=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.luminances,U,E,0,O),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.luminances;const O=w*E,U=new Uint8ClampedArray(O);let H=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.luminances,H,U,0,O),U;for(let Z=0;Z<E;Z++){const ue=Z*w;v.arraycopy(this.luminances,H,U,ue,w),H+=this.dataWidth}return U}isCropSupported(){return!0}crop(w,E,O,U){return new Or(this.luminances,O,U,this.dataWidth,this.dataHeight,this.left+w,this.top+E)}invert(){return new W(this)}}class Ir extends Q{static forName(w){return this.getCharacterSetECIByName(w)}}class ns{}ns.ISO_8859_1=Q.ISO8859_1;class Ls{isCompact(){return this.compact}setCompact(w){this.compact=w}getSize(){return this.size}setSize(w){this.size=w}getLayers(){return this.layers}setLayers(w){this.layers=w}getCodeWords(){return this.codeWords}setCodeWords(w){this.codeWords=w}getMatrix(){return this.matrix}setMatrix(w){this.matrix=w}}class Ot{static singletonList(w){return[w]}static min(w,E){return w.sort(E)[0]}}class lr{constructor(w){this.previous=w}getPrevious(){return this.previous}}class Qn extends lr{constructor(w,E,O){super(w),this.value=E,this.bitCount=O}appendTo(w,E){w.appendBits(this.value,this.bitCount)}add(w,E){return new Qn(this,w,E)}addBinaryShift(w,E){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Qn(this,w,E)}toString(){let w=this.value&(1<<this.bitCount)-1;return w|=1<<this.bitCount,"<"+P.toBinaryString(w|1<<this.bitCount).substring(1)+">"}}class Vr extends Qn{constructor(w,E,O){super(w,0,0),this.binaryShiftStart=E,this.binaryShiftByteCount=O}appendTo(w,E){for(let O=0;O<this.binaryShiftByteCount;O++)(O===0||O===31&&this.binaryShiftByteCount<=62)&&(w.appendBits(31,5),this.binaryShiftByteCount>62?w.appendBits(this.binaryShiftByteCount-31,16):O===0?w.appendBits(Math.min(this.binaryShiftByteCount,31),5):w.appendBits(this.binaryShiftByteCount-31,5)),w.appendBits(E[this.binaryShiftStart+O],8)}addBinaryShift(w,E){return new Vr(this,w,E)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function us(wt,w,E){return new Vr(wt,w,E)}function as(wt,w,E){return new Qn(wt,w,E)}const xs=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],bs=0,zi=1,zs=2,ys=3,Ss=4,pc=new Qn(null,0,0),ks=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function ka(wt){for(let w of wt)I.fill(w,-1);return wt[bs][Ss]=0,wt[zi][Ss]=0,wt[zi][bs]=28,wt[ys][Ss]=0,wt[zs][Ss]=0,wt[zs][bs]=15,wt}const Wu=ka(I.createInt32Array(6,6));class Sa{constructor(w,E,O,U){this.token=w,this.mode=E,this.binaryShiftByteCount=O,this.bitCount=U}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(w,E){let O=this.bitCount,U=this.token;if(w!==this.mode){let Z=ks[this.mode][w];U=as(U,Z&65535,Z>>16),O+=Z>>16}let H=w===zs?4:5;return U=as(U,E,H),new Sa(U,w,0,O+H)}shiftAndAppend(w,E){let O=this.token,U=this.mode===zs?4:5;return O=as(O,Wu[this.mode][w],U),O=as(O,E,5),new Sa(O,this.mode,0,this.bitCount+U+5)}addBinaryShiftChar(w){let E=this.token,O=this.mode,U=this.bitCount;if(this.mode===Ss||this.mode===zs){let ue=ks[O][bs];E=as(E,ue&65535,ue>>16),U+=ue>>16,O=bs}let H=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,Z=new Sa(E,O,this.binaryShiftByteCount+1,U+H);return Z.binaryShiftByteCount===2078&&(Z=Z.endBinaryShift(w+1)),Z}endBinaryShift(w){if(this.binaryShiftByteCount===0)return this;let E=this.token;return E=us(E,w-this.binaryShiftByteCount,this.binaryShiftByteCount),new Sa(E,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(w){let E=this.bitCount+(ks[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 U=this.endBinaryShift(w.length).token;U!==null;U=U.getPrevious())E.unshift(U);let O=new M;for(const U of E)U.appendTo(O,w);return O}toString(){return K.format("%s bits=%d bytes=%d",xs[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(w){return w.binaryShiftByteCount>62?21:w.binaryShiftByteCount>31?20:w.binaryShiftByteCount>0?10:0}}Sa.INITIAL_STATE=new Sa(pc,bs,0,0);function Yo(wt){const w=K.getCharCode(" "),E=K.getCharCode("."),O=K.getCharCode(",");wt[bs][w]=1;const U=K.getCharCode("Z"),H=K.getCharCode("A");for(let Dt=H;Dt<=U;Dt++)wt[bs][Dt]=Dt-H+2;wt[zi][w]=1;const Z=K.getCharCode("z"),ue=K.getCharCode("a");for(let Dt=ue;Dt<=Z;Dt++)wt[zi][Dt]=Dt-ue+2;wt[zs][w]=1;const Ee=K.getCharCode("9"),Re=K.getCharCode("0");for(let Dt=Re;Dt<=Ee;Dt++)wt[zs][Dt]=Dt-Re+2;wt[zs][O]=12,wt[zs][E]=13;const ot=["\0"," ","","","","","","","\x07","\b"," ",`
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let Dt=0;Dt<ot.length;Dt++)wt[ys][K.getCharCode(ot[Dt])]=Dt;const Ct=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let Dt=0;Dt<Ct.length;Dt++)K.getCharCode(Ct[Dt])>0&&(wt[Ss][K.getCharCode(Ct[Dt])]=Dt);return wt}const qu=Yo(I.createInt32Array(5,256));class Ql{constructor(w){this.text=w}encode(){const w=K.getCharCode(" "),E=K.getCharCode(`
`);let O=Ot.singletonList(Sa.INITIAL_STATE);for(let H=0;H<this.text.length;H++){let Z,ue=H+1<this.text.length?this.text[H+1]:0;switch(this.text[H]){case K.getCharCode("\r"):Z=ue===E?2:0;break;case K.getCharCode("."):Z=ue===w?3:0;break;case K.getCharCode(","):Z=ue===w?4:0;break;case K.getCharCode(":"):Z=ue===w?5:0;break;default:Z=0}Z>0?(O=Ql.updateStateListForPair(O,H,Z),H++):O=this.updateStateListForChar(O,H)}return Ot.min(O,(H,Z)=>H.getBitCount()-Z.getBitCount()).toBitArray(this.text)}updateStateListForChar(w,E){const O=[];for(let U of w)this.updateStateForChar(U,E,O);return Ql.simplifyStates(O)}updateStateForChar(w,E,O){let U=this.text[E]&255,H=qu[w.getMode()][U]>0,Z=null;for(let ue=0;ue<=Ss;ue++){let Ee=qu[ue][U];if(Ee>0){if(Z==null&&(Z=w.endBinaryShift(E)),!H||ue===w.getMode()||ue===zs){const Re=Z.latchAndAppend(ue,Ee);O.push(Re)}if(!H&&Wu[w.getMode()][ue]>=0){const Re=Z.shiftAndAppend(ue,Ee);O.push(Re)}}}if(w.getBinaryShiftByteCount()>0||qu[w.getMode()][U]===0){let ue=w.addBinaryShiftChar(E);O.push(ue)}}static updateStateListForPair(w,E,O){const U=[];for(let H of w)this.updateStateForPair(H,E,O,U);return this.simplifyStates(U)}static updateStateForPair(w,E,O,U){let H=w.endBinaryShift(E);if(U.push(H.latchAndAppend(Ss,O)),w.getMode()!==Ss&&U.push(H.shiftAndAppend(Ss,O)),O===3||O===4){let Z=H.latchAndAppend(zs,16-O).latchAndAppend(zs,1);U.push(Z)}if(w.getBinaryShiftByteCount()>0){let Z=w.addBinaryShiftChar(E).addBinaryShiftChar(E+1);U.push(Z)}}static simplifyStates(w){let E=[];for(const O of w){let U=!0;for(const H of E){if(H.isBetterThanOrEqualTo(O)){U=!1;break}O.isBetterThanOrEqualTo(H)&&(E=E.filter(Z=>Z!==H))}U&&E.push(O)}return E}}class wi{constructor(){}static encodeBytes(w){return wi.encode(w,wi.DEFAULT_EC_PERCENT,wi.DEFAULT_AZTEC_LAYERS)}static encode(w,E,O){let U=new Ql(w).encode(),H=P.truncDivision(U.getSize()*E,100)+11,Z=U.getSize()+H,ue,Ee,Re,ot,Ct;if(O!==wi.DEFAULT_AZTEC_LAYERS){if(ue=O<0,Ee=Math.abs(O),Ee>(ue?wi.MAX_NB_BITS_COMPACT:wi.MAX_NB_BITS))throw new f(K.format("Illegal value %s for layers",O));Re=wi.totalBitsInLayer(Ee,ue),ot=wi.WORD_SIZE[Ee];let Ar=Re-Re%ot;if(Ct=wi.stuffBits(U,ot),Ct.getSize()+H>Ar)throw new f("Data to large for user specified layer");if(ue&&Ct.getSize()>ot*64)throw new f("Data to large for user specified layer")}else{ot=0,Ct=null;for(let Ar=0;;Ar++){if(Ar>wi.MAX_NB_BITS)throw new f("Data too large for an Aztec code");if(ue=Ar<=3,Ee=ue?Ar+1:Ar,Re=wi.totalBitsInLayer(Ee,ue),Z>Re)continue;(Ct==null||ot!==wi.WORD_SIZE[Ee])&&(ot=wi.WORD_SIZE[Ee],Ct=wi.stuffBits(U,ot));let Ns=Re-Re%ot;if(!(ue&&Ct.getSize()>ot*64)&&Ct.getSize()+H<=Ns)break}}let Dt=wi.generateCheckWords(Ct,Re,ot),sn=Ct.getSize()/ot,Et=wi.generateModeMessage(ue,Ee,sn),Yt=(ue?11:14)+Ee*4,Jt=new Int32Array(Yt),Pn;if(ue){Pn=Yt;for(let Ar=0;Ar<Jt.length;Ar++)Jt[Ar]=Ar}else{Pn=Yt+1+2*P.truncDivision(P.truncDivision(Yt,2)-1,15);let Ar=P.truncDivision(Yt,2),Ns=P.truncDivision(Pn,2);for(let ti=0;ti<Ar;ti++){let mc=ti+P.truncDivision(ti,15);Jt[Ar-ti-1]=Ns-mc-1,Jt[Ar+ti]=Ns+mc+1}}let xr=new de(Pn);for(let Ar=0,Ns=0;Ar<Ee;Ar++){let ti=(Ee-Ar)*4+(ue?9:12);for(let mc=0;mc<ti;mc++){let ro=mc*2;for(let so=0;so<2;so++)Dt.get(Ns+ro+so)&&xr.set(Jt[Ar*2+so],Jt[Ar*2+mc]),Dt.get(Ns+ti*2+ro+so)&&xr.set(Jt[Ar*2+mc],Jt[Yt-1-Ar*2-so]),Dt.get(Ns+ti*4+ro+so)&&xr.set(Jt[Yt-1-Ar*2-so],Jt[Yt-1-Ar*2-mc]),Dt.get(Ns+ti*6+ro+so)&&xr.set(Jt[Yt-1-Ar*2-mc],Jt[Ar*2+so])}Ns+=ti*8}if(wi.drawModeMessage(xr,ue,Pn,Et),ue)wi.drawBullsEye(xr,P.truncDivision(Pn,2),5);else{wi.drawBullsEye(xr,P.truncDivision(Pn,2),7);for(let Ar=0,Ns=0;Ar<P.truncDivision(Yt,2)-1;Ar+=15,Ns+=16)for(let ti=P.truncDivision(Pn,2)&1;ti<Pn;ti+=2)xr.set(P.truncDivision(Pn,2)-Ns,ti),xr.set(P.truncDivision(Pn,2)+Ns,ti),xr.set(ti,P.truncDivision(Pn,2)-Ns),xr.set(ti,P.truncDivision(Pn,2)+Ns)}let Nr=new Ls;return Nr.setCompact(ue),Nr.setSize(Pn),Nr.setLayers(Ee),Nr.setCodeWords(sn),Nr.setMatrix(xr),Nr}static drawBullsEye(w,E,O){for(let U=0;U<O;U+=2)for(let H=E-U;H<=E+U;H++)w.set(H,E-U),w.set(H,E+U),w.set(E-U,H),w.set(E+U,H);w.set(E-O,E-O),w.set(E-O+1,E-O),w.set(E-O,E-O+1),w.set(E+O,E-O),w.set(E+O,E-O+1),w.set(E+O,E+O-1)}static generateModeMessage(w,E,O){let U=new M;return w?(U.appendBits(E-1,2),U.appendBits(O-1,6),U=wi.generateCheckWords(U,28,4)):(U.appendBits(E-1,5),U.appendBits(O-1,11),U=wi.generateCheckWords(U,40,4)),U}static drawModeMessage(w,E,O,U){let H=P.truncDivision(O,2);if(E)for(let Z=0;Z<7;Z++){let ue=H-3+Z;U.get(Z)&&w.set(ue,H-5),U.get(Z+7)&&w.set(H+5,ue),U.get(20-Z)&&w.set(ue,H+5),U.get(27-Z)&&w.set(H-5,ue)}else for(let Z=0;Z<10;Z++){let ue=H-5+Z+P.truncDivision(Z,5);U.get(Z)&&w.set(ue,H-7),U.get(Z+10)&&w.set(H+7,ue),U.get(29-Z)&&w.set(ue,H+7),U.get(39-Z)&&w.set(H-7,ue)}}static generateCheckWords(w,E,O){let U=w.getSize()/O,H=new yr(wi.getGF(O)),Z=P.truncDivision(E,O),ue=wi.bitsToWords(w,O,Z);H.encode(ue,Z-U);let Ee=E%O,Re=new M;Re.appendBits(0,Ee);for(const ot of Array.from(ue))Re.appendBits(ot,O);return Re}static bitsToWords(w,E,O){let U=new Int32Array(O),H,Z;for(H=0,Z=w.getSize()/E;H<Z;H++){let ue=0;for(let Ee=0;Ee<E;Ee++)ue|=w.get(H*E+Ee)?1<<E-Ee-1:0;U[H]=ue}return U}static getGF(w){switch(w){case 4:return ht.AZTEC_PARAM;case 6:return ht.AZTEC_DATA_6;case 8:return ht.AZTEC_DATA_8;case 10:return ht.AZTEC_DATA_10;case 12:return ht.AZTEC_DATA_12;default:throw new f("Unsupported word size "+w)}}static stuffBits(w,E){let O=new M,U=w.getSize(),H=(1<<E)-2;for(let Z=0;Z<U;Z+=E){let ue=0;for(let Ee=0;Ee<E;Ee++)(Z+Ee>=U||w.get(Z+Ee))&&(ue|=1<<E-1-Ee);(ue&H)===H?(O.appendBits(ue&H,E),Z--):ue&H?O.appendBits(ue,E):(O.appendBits(ue|1,E),Z--)}return O}static totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}wi.DEFAULT_EC_PERCENT=33,wi.DEFAULT_AZTEC_LAYERS=0,wi.MAX_NB_BITS=32,wi.MAX_NB_BITS_COMPACT=4,wi.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Ed{encode(w,E,O,U){return this.encodeWithHints(w,E,O,U,null)}encodeWithHints(w,E,O,U,H){let Z=ns.ISO_8859_1,ue=wi.DEFAULT_EC_PERCENT,Ee=wi.DEFAULT_AZTEC_LAYERS;return H!=null&&(H.has(Pr.CHARACTER_SET)&&(Z=Ir.forName(H.get(Pr.CHARACTER_SET).toString())),H.has(Pr.ERROR_CORRECTION)&&(ue=P.parseInt(H.get(Pr.ERROR_CORRECTION).toString())),H.has(Pr.AZTEC_LAYERS)&&(Ee=P.parseInt(H.get(Pr.AZTEC_LAYERS).toString()))),Ed.encodeLayers(w,E,O,U,Z,ue,Ee)}static encodeLayers(w,E,O,U,H,Z,ue){if(E!==ge.AZTEC)throw new f("Can only encode AZTEC, but got "+E);let Ee=wi.encode(K.getBytes(w,H),Z,ue);return Ed.renderResult(Ee,O,U)}static renderResult(w,E,O){let U=w.getMatrix();if(U==null)throw new st;let H=U.getWidth(),Z=U.getHeight(),ue=Math.max(E,H),Ee=Math.max(O,Z),Re=Math.min(ue/H,Ee/Z),ot=(ue-H*Re)/2,Ct=(Ee-Z*Re)/2,Dt=new de(ue,Ee);for(let sn=0,Et=Ct;sn<Z;sn++,Et+=Re)for(let Yt=0,Jt=ot;Yt<H;Yt++,Jt+=Re)U.get(Yt,sn)&&Dt.setRegion(Jt,Et,Re,Re);return Dt}}n.AbstractExpandedDecoder=kt,n.ArgumentException=d,n.ArithmeticException=Je,n.AztecCode=Ls,n.AztecCodeReader=hn,n.AztecCodeWriter=Ed,n.AztecDecoder=bt,n.AztecDetector=Ut,n.AztecDetectorResult=cn,n.AztecEncoder=wi,n.AztecHighLevelEncoder=Ql,n.AztecPoint=it,n.BarcodeFormat=ge,n.Binarizer=y,n.BinaryBitmap=x,n.BitArray=M,n.BitMatrix=de,n.BitSource=fe,n.BrowserAztecCodeReader=nn,n.BrowserBarcodeReader=T,n.BrowserCodeReader=_e,n.BrowserDatamatrixCodeReader=Te,n.BrowserMultiFormatReader=pr,n.BrowserPDF417Reader=hr,n.BrowserQRCodeReader=Xr,n.BrowserQRCodeSvgWriter=mt,n.CharacterSetECI=Q,n.ChecksumException=g,n.Code128Reader=pt,n.Code39Reader=We,n.DataMatrixDecodedBitStreamParser=Pe,n.DataMatrixReader=we,n.DecodeHintType=$,n.DecoderResult=Oe,n.DefaultGridSampler=rn,n.DetectorResult=on,n.EAN13Reader=mn,n.EncodeHintType=Pr,n.Exception=u,n.FormatException=L,n.GenericGF=ht,n.GenericGFPoly=Ye,n.GlobalHistogramBinarizer=ie,n.GridSampler=tn,n.GridSamplerInstance=nt,n.HTMLCanvasElementLuminanceSource=ne,n.HybridBinarizer=ae,n.ITFReader=It,n.IllegalArgumentException=f,n.IllegalStateException=st,n.InvertedLuminanceSource=W,n.LuminanceSource=q,n.MathUtils=xt,n.MultiFormatOneDReader=k,n.MultiFormatReader=_r,n.MultiFormatWriter=sr,n.NotFoundException=G,n.OneDReader=Vt,n.PDF417DecodedBitStreamParser=At,n.PDF417DecoderErrorCorrection=ls,n.PDF417Reader=Cn,n.PDF417ResultMetadata=wr,n.PerspectiveTransform=fn,n.PlanarYUVLuminanceSource=Zn,n.QRCodeByteMatrix=gs,n.QRCodeDataMask=yt,n.QRCodeDecodedBitStreamParser=Pt,n.QRCodeDecoderErrorCorrectionLevel=ve,n.QRCodeDecoderFormatInformation=Be,n.QRCodeEncoder=Bn,n.QRCodeEncoderQRCode=ei,n.QRCodeMaskUtil=nr,n.QRCodeMatrixUtil=Fr,n.QRCodeMode=et,n.QRCodeReader=Sr,n.QRCodeVersion=at,n.QRCodeWriter=Kt,n.RGBLuminanceSource=Or,n.RSS14Reader=A,n.RSSExpandedReader=p,n.ReaderException=fr,n.ReedSolomonDecoder=He,n.ReedSolomonEncoder=yr,n.ReedSolomonException=rt,n.Result=xe,n.ResultMetadataType=je,n.ResultPoint=St,n.StringUtils=K,n.UnsupportedOperationException=se,n.VideoInputDevice=oe,n.WhiteRectangleDetector=Vn,n.WriterException=ci,n.ZXingArrays=I,n.ZXingCharset=Ir,n.ZXingInteger=P,n.ZXingStandardCharsets=ns,n.ZXingStringBuilder=re,n.ZXingStringEncoding=ee,n.ZXingSystem=v,n.createAbstractExpandedDecoder=pn,Object.defineProperty(n,"__esModule",{value:!0})})}(i9,i9.exports)),i9.exports}var vo=m$t();const x$t=Ti(vo),g$t=CAe({__proto__:null,default:x$t},[vo]);var j2e=function(){function t(e,n,r){if(this.formatMap=new Map([[As.QR_CODE,vo.BarcodeFormat.QR_CODE],[As.AZTEC,vo.BarcodeFormat.AZTEC],[As.CODABAR,vo.BarcodeFormat.CODABAR],[As.CODE_39,vo.BarcodeFormat.CODE_39],[As.CODE_93,vo.BarcodeFormat.CODE_93],[As.CODE_128,vo.BarcodeFormat.CODE_128],[As.DATA_MATRIX,vo.BarcodeFormat.DATA_MATRIX],[As.MAXICODE,vo.BarcodeFormat.MAXICODE],[As.ITF,vo.BarcodeFormat.ITF],[As.EAN_13,vo.BarcodeFormat.EAN_13],[As.EAN_8,vo.BarcodeFormat.EAN_8],[As.PDF_417,vo.BarcodeFormat.PDF_417],[As.RSS_14,vo.BarcodeFormat.RSS_14],[As.RSS_EXPANDED,vo.BarcodeFormat.RSS_EXPANDED],[As.UPC_A,vo.BarcodeFormat.UPC_A],[As.UPC_E,vo.BarcodeFormat.UPC_E],[As.UPC_EAN_EXTENSION,vo.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!g$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(vo.DecodeHintType.POSSIBLE_FORMATS,s),a.set(vo.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 vo.MultiFormatReader(this.verbose,this.hints),r=new vo.HTMLCanvasElementLuminanceSource(e),s=new vo.BinaryBitmap(new vo.HybridBinarizer(r)),a=n.decode(s);return{text:a.text,format:d$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}(),b$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}}},A2e=function(){function t(e,n,r){if(this.formatMap=new Map([[As.QR_CODE,"qr_code"],[As.AZTEC,"aztec"],[As.CODABAR,"codabar"],[As.CODE_39,"code_39"],[As.CODE_93,"code_93"],[As.CODE_128,"code_128"],[As.DATA_MATRIX,"data_matrix"],[As.ITF,"itf"],[As.EAN_13,"ean_13"],[As.EAN_8,"ean_8"],[As.PDF_417,"pdf417"],[As.UPC_A,"upc_a"],[As.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 b$t(this,void 0,void 0,function(){var n,r;return y$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:d$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}(),_2e=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())})},E2e=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}}},v$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&&A2e.isSupported()?(this.primaryDecoder=new A2e(e,r,s),this.secondaryDecoder=new j2e(e,r,s)):this.primaryDecoder=new j2e(e,r,s)}return t.prototype.decodeAsync=function(e){return _2e(this,void 0,void 0,function(){var n;return E2e(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 _2e(this,void 0,void 0,function(){var n,r;return E2e(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}(),Xce=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)}}(),LL=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())})},DL=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}}},h$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}(),w$t=function(t){Xce(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}(h$e),C$t=function(t){Xce(e,t);function e(n){return t.call(this,"zoom",n)||this}return e}(w$t),S$t=function(t){Xce(e,t);function e(n){return t.call(this,"torch",n)||this}return e}(h$e),N$t=function(){function t(e){this.track=e}return t.prototype.zoomFeature=function(){return new C$t(this.track)},t.prototype.torchFeature=function(){return new S$t(this.track)},t}(),j$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 LL(this,void 0,void 0,function(){var a,o;return DL(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 LL(this,void 0,void 0,function(){return DL(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 N$t(this.getFirstTrackOrFail())},t}(),A$t=function(){function t(e){this.mediaStream=e}return t.prototype.render=function(e,n,r){return LL(this,void 0,void 0,function(){return DL(this,function(s){return[2,j$t.create(e,this.mediaStream,n,r)]})})},t.create=function(e){return LL(this,void 0,void 0,function(){var n,r;return DL(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}(),k2e=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())})},T2e=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(){}return t.failIfNotSupported=function(){return k2e(this,void 0,void 0,function(){return T2e(this,function(e){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new t]})})},t.prototype.create=function(e){return k2e(this,void 0,void 0,function(){return T2e(this,function(n){return[2,A$t.create(e)]})})},t}(),E$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())})},k$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}}},T$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=o4.unableToQuerySupportedDevices();return t.isHttpsOrLocalhost()||(e=o4.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 E$t(this,void 0,void 0,function(){var e,n,r,s,a,o,l;return k$t(this,function(c){switch(c.label){case 0:return e=function(u){for(var d=u.getVideoTracks(),f=0,x=d;f<x.length;f++){var g=x[f];g.enabled=!1,g.stop(),u.removeTrack(g)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=c.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(r=c.sent(),s=[],a=0,o=r;a<o.length;a++)l=o[a],l.kind==="videoinput"&&s.push({id:l.deviceId,label:l.label});return e(n),[2,s]}})})},t.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,n){var r=function(a){for(var o=[],l=0,c=a;l<c.length;l++){var u=c[l];u.kind==="video"&&o.push({id:u.id,label:u.label})}e(o)},s=MediaStreamTrack;s.getSources(r)})},t}(),rl;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.NOT_STARTED=1]="NOT_STARTED",t[t.SCANNING=2]="SCANNING",t[t.PAUSED=3]="PAUSED"})(rl||(rl={}));var I$t=function(){function t(){this.state=rl.NOT_STARTED,this.onGoingTransactionNewState=rl.UNKNOWN}return t.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},t.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},t.prototype.execute=function(){if(this.onGoingTransactionNewState===rl.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=rl.UNKNOWN,this.directTransition(e)},t.prototype.cancel=function(){if(this.onGoingTransactionNewState===rl.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=rl.UNKNOWN},t.prototype.getState=function(){return this.state},t.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==rl.UNKNOWN)throw"Cannot transition to a new state, already under transition"},t.prototype.validateTransition=function(e){switch(this.state){case rl.UNKNOWN:throw"Transition from unknown is not allowed";case rl.NOT_STARTED:this.failIfNewStateIs(e,[rl.PAUSED]);break;case rl.SCANNING:break;case rl.PAUSED:break}},t.prototype.failIfNewStateIs=function(e,n){for(var r=0,s=n;r<s.length;r++){var a=s[r];if(e===a)throw"Cannot transition from ".concat(this.state," to ").concat(e)}},t}(),P$t=function(){function t(e){this.stateManager=e}return t.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},t.prototype.directTransition=function(e){this.stateManager.directTransition(e)},t.prototype.getState=function(){return this.stateManager.getState()},t.prototype.canScanFile=function(){return this.stateManager.getState()===rl.NOT_STARTED},t.prototype.isScanning=function(){return this.stateManager.getState()!==rl.NOT_STARTED},t.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===rl.SCANNING},t.prototype.isPaused=function(){return this.stateManager.getState()===rl.PAUSED},t}(),F$t=function(){function t(){}return t.create=function(){return new P$t(new I$t)},t}(),O$t=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bf=function(t){O$t(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.DEFAULT_WIDTH=300,e.DEFAULT_WIDTH_OFFSET=2,e.FILE_SCAN_MIN_HEIGHT=300,e.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,e.MIN_QR_BOX_SIZE=50,e.SHADED_LEFT=1,e.SHADED_RIGHT=2,e.SHADED_TOP=3,e.SHADED_BOTTOM=4,e.SHADED_REGION_ELEMENT_ID="qr-shaded-region",e.VERBOSE=!1,e.BORDER_SHADER_DEFAULT_COLOR="#ffffff",e.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",e}(d$t),M$t=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?f$e.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},t.prototype.isShadedBoxEnabled=function(){return!mg(this.qrbox)},t.create=function(e,n){return new t(e,n)},t}(),I2e=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 h$t(this.verbose),this.qrcode=new v$t(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=F$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=M$t.create(n,this.logger);this.clearElement();var c=!1;l.videoConstraints&&(l.isMediaStreamConstraintsValid()?c=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var u=c,d=document.getElementById(this.elementId);d.clientWidth?d.clientWidth:Bf.DEFAULT_WIDTH,d.style.position="relative",this.shouldScan=!0,this.element=d;var f=this,x=this.stateManagerProxy.startTransition(rl.SCANNING);return new Promise(function(g,y){var v=u?l.videoConstraints:f.createVideoConstraints(e);if(!v){x.cancel(),y("videoConstraints should be defined");return}var C={};(!u||l.aspectRatio)&&(C.aspectRatio=l.aspectRatio);var N={onRenderSurfaceReady:function(I,P){f.setupUi(I,P,l),f.isScanning=!0,f.foreverScan(l,r,o)}};_$t.failIfNotSupported().then(function(I){I.create(v).then(function(P){return P.render(a.element,C,N).then(function(M){f.renderedCamera=M,x.execute(),g(null)}).catch(function(M){x.cancel(),y(M)})}).catch(function(P){x.cancel(),y(o4.errorGettingUserMedia(P))})}).catch(function(I){x.cancel(),y(o4.cameraStreamingNotSupported())})})},t.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(rl.PAUSED),this.showPausedState(),(mg(e)||e!==!0)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},t.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,n=function(){e.stateManagerProxy.directTransition(rl.SCANNING),e.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},t.prototype.getState=function(){return this.stateManagerProxy.getState()},t.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(rl.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var a=document.getElementById(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(mg(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(s,a){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var l=o.width,c=o.height,u=document.getElementById(r.elementId),d=u.clientWidth?u.clientWidth: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),N=Math.max(o.height,x.height),I=C+2*v,P=N+2*v,M=r.createCanvasElement(I,P);u.appendChild(M);var F=M.getContext("2d");if(!F)throw"Unable to get 2d context from canvas";F.canvas.width=I,F.canvas.height=P,F.drawImage(o,0,0,l,c,v,v,C,N);try{r.qrcode.decodeRobustlyAsync(M).then(function($){s(S2e.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 T$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(!f$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=[As.QR_CODE,As.AZTEC,As.CODABAR,As.CODE_39,As.CODE_93,As.CODE_128,As.DATA_MATRIX,As.MAXICODE,As.ITF,As.EAN_13,As.EAN_8,As.PDF_417,As.RSS_14,As.RSS_EXPANDED,As.UPC_A,As.UPC_E,As.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];u$t(o)?r.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(r.length===0)throw"None of formatsToSupport match supported values.";return r},t.prototype.getUseBarCodeDetectorIfSupported=function(e){if(mg(e))return!0;if(!mg(e.useBarCodeDetectorIfSupported))return e.useBarCodeDetectorIfSupported!==!1;if(mg(e.experimentalFeatures))return!0;var n=e.experimentalFeatures;return mg(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},t.prototype.validateQrboxSize=function(e,n,r){var s=this,a=r.qrbox;this.validateQrboxConfig(a);var o=this.toQrdimensions(e,n,a),l=function(u){if(u<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=mg(r.qrbox)?{width:e,height:n}:r.qrbox;this.validateQrboxConfig(s);var a=this.toQrdimensions(e,n,s);a.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=r.isShadedBoxEnabled()&&a.height<=n,l={x:0,y:0,width:e,height:n},c=o?this.getShadedRegionBounds(e,n,a):l,u=this.createCanvasElement(c.width,c.height),d={willReadFrequently:!0},f=u.getContext("2d",d);f.canvas.width=c.width,f.canvas.height=c.height,this.element.append(u),o&&this.possiblyInsertShadingElement(this.element,e,n,a),this.createScannerPausedUiElement(this.element),this.qrRegion=c,this.context=f,this.canvasElement=u},t.prototype.createScannerPausedUiElement=function(e){var n=document.createElement("div");n.innerText=o4.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,S2e.createFromQrcodeResult(s)),r.possiblyUpdateShaders(!0),!0}).catch(function(s){r.possiblyUpdateShaders(!1);var a=o4.codeParseError(s);return n(a,f$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=mg(r)?"qr-canvas":r,o},t.prototype.getShadedRegionBounds=function(e,n,r){if(r.width>e||r.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(n-r.height)/2,width:r.width,height:r.height}},t.prototype.possiblyInsertShadingElement=function(e,n,r,s){if(!(n-s.width<1||r-s.height<1)){var a=document.createElement("div");a.style.position="absolute";var o=(n-s.width)/2,l=(r-s.height)/2;if(a.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderTop="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderBottom="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.boxSizing="border-box",a.style.top="0px",a.style.bottom="0px",a.style.left="0px",a.style.right="0px",a.id="".concat(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}(),P2e;(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"})(P2e||(P2e={}));function $E(){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&&I2e.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 I2e("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 R$t=()=>{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,N]=h.useState(!1),I=()=>{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(Po,{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:Ki,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:P1,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:I,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:I,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($E,{}),i.jsx(Po,{to:"/terminal/BTC",onClick:()=>e(!1),children:"Terminal"}),i.jsx(Po,{to:"/discover-wallets",onClick:()=>e(!1),children:"Discover Wallets"}),i.jsx(Po,{to:"/hyperliquid-vaults",onClick:()=>e(!1),children:"Discover Vaults"}),i.jsx(Po,{to:"/copy-trade",onClick:()=>e(!1),children:"My Copy Trading"}),i.jsx(Po,{to:"/wallet-management",onClick:()=>e(!1),children:"Wallet Management"}),i.jsx(Po,{to:"/ticker",onClick:()=>e(!1),children:"Ticker"}),i.jsx(Po,{to:"/leaderboard",onClick:()=>e(!1),children:"Leaderboard"}),i.jsx(Po,{to:"/referral",onClick:()=>e(!1),children:"Referral"}),i.jsx(Po,{to:"/tracked-wallets",onClick:()=>e(!1),children:"Tracked Wallets"}),i.jsx(Po,{to:"/tracker",onClick:()=>e(!1),children:"My Activities"}),i.jsx(Po,{to:"/hyperliquid-whale-trades",onClick:()=>e(!1),children:"Whale trades"}),i.jsx(Po,{to:"/back-testing",onClick:()=>e(!1),children:"Backtest"}),i.jsx(Po,{to:"/hyperliquid-fee-calculator ",onClick:()=>e(!1),children:"HL Fee Calculator"}),i.jsx(Po,{to:"/terminal/extended/BTC#gridbot",onClick:()=>e(!1),children:"Extended Grid Bot"}),i.jsx(Po,{to:"/dca-bot",onClick:()=>e(!1),children:"Extended DCA Bot"}),i.jsxs("div",{onClick:()=>g(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:["Extended Farming ",i.jsx(u3,{tone:"emerald",label:"SMART"})]}),i.jsx(Po,{to:"/terminal/lighter/BTC#gridbot",onClick:()=>e(!1),children:"Lighter Grid Bot"}),i.jsx(Po,{to:"/terminal/hyperliquid/BTC#gridbot",onClick:()=>e(!1),children:"HL Grid Bot"}),i.jsx(Po,{to:"/market-maker",onClick:()=>e(!1),children:"HL Market Maker"}),i.jsxs(Po,{to:"/standx-mm",onClick:()=>e(!1),children:["StandX Market Maker",i.jsx(u3,{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:()=>N(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Pacifica Farming"})]})})]}),i.jsx(wce,{open:n,setOpen:r}),i.jsx(Cce,{open:s,setOpen:a}),i.jsx(Sce,{open:o,setOpen:l}),i.jsx(Nce,{open:c,setOpen:u}),i.jsx(jce,{open:d,setOpen:f}),i.jsx(SU,{open:x,setOpen:g}),i.jsx(Ace,{open:y,setOpen:v}),i.jsx(_ce,{open:C,setOpen:N})]})},p$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"})]}),L$t=()=>{var de,G,ie,ae,q,W;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 ne=localStorage.getItem("isToasterMinimized");return ne===null?!1:ne==="true"});h.useEffect(()=>{localStorage.setItem("isToasterMinimized",f)},[f]);const[g,y]=h.useState([]),C=localStorage.getItem("isDateToasterFormat")||"date",[N,I]=h.useState(C);h.useEffect(()=>{localStorage.setItem("isDateToasterFormat",N)},[N]);const[P,M]=h.useState(0),F=h.useRef(null),[$,L]=h.useState(null),[z,Q]=h.useState(0),se=1e4;h.useEffect(()=>{if(l||r.length===0||e){clearInterval(F.current);return}const ne=Date.now();return L(ne),F.current=setTimeout(()=>{M(oe=>(oe+1)%r.length),Q(0)},se-z),()=>clearTimeout(F.current)},[l,r.length,e,P,z]),h.useEffect(()=>{P>=(r==null?void 0:r.length)&&M(0)},[r]);async function ee(){try{d(!0);const ne=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/analysis/getallmetrics/");if(!ne.ok)throw new Error(`Server responded with status ${ne.status}`);const oe=await ne.json();oe&&s(oe.refcodes)}catch(ne){return console.error("Error fetching metrics:",ne.message),null}finally{d(!1)}}h.useEffect(()=>{let ne;return f||(ee(),ne=setInterval(()=>{ee()},6e4)),()=>{ne&&clearInterval(ne)}},[f]),h.useEffect(()=>{var ne;if((r==null?void 0:r.length)>0)if((a==null?void 0:a.length)<(r==null?void 0:r.length)){const oe=[...a??[]],he=Array.from({length:(r==null?void 0:r.length)-((a==null?void 0:a.length)??0)},(ge,Ce)=>Ce+((a==null?void 0:a.length)??0)),_e=he==null?void 0:he.sort(()=>Math.random()-.5),xe=[...oe,..._e??[]];o(xe);const Se=xe==null?void 0:xe.map(ge=>r==null?void 0:r[ge]);y(Se)}else{const oe=(ne=a==null?void 0:a.map(he=>r==null?void 0:r[he]))==null?void 0:ne.filter(Boolean);y(oe)}},[r]);const[K,re]=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(ne=>{const oe=!ne;return localStorage.setItem("isToasterMinimized",oe?"true":"false"),oe})},className:"fixed bottom-10 right-4 z-50 cursor-pointer bg-[#2a2a2a]/60 hover:bg-[#2a2a2a] rounded-full w-12 h-12 flex items-center justify-center shadow-md group",children:i.jsx("img",{src:E_e,alt:"Toggle",className:"w-8 h-8 opacity-90 group-hover:opacity-100"})}),(!f||K)&&i.jsxs("div",{style:{background:"rgba(32, 32, 32, 0.86)",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"},className:`${K?"bounceShrink-Close-Toaster-Close":""} w-full h-full min-h-full relative rounded-[20px]`,children:[i.jsxs("div",{onClick:()=>{c(!l)},style:{backgroundColor:"rgba(40, 40, 42, 0.75)",backdropFilter:"blur(10px)"},className:`${(r==null?void 0:r.length)>0?"":"hidden"} cursor-pointer w-full h-[20px] rounded-t-full flex justify-center items-center relative`,children:[i.jsx("div",{className:"w-[36px] h-[4px] bg-[rgba(255,255,255,0.3)] rounded-[2px]"}),i.jsx("div",{onClick:ne=>{ne.stopPropagation(),re(!0),setTimeout(()=>{x(oe=>{const he=!oe;return localStorage.setItem("isToasterMinimized",he?"true":"false"),he}),re(!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(p$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),$&&Q(ne=>ne+(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(F2e,{content:(de=g[P])==null?void 0:de.result,createdAt:(G=g[P])==null?void 0:G.created_at,category:(ie=g[P])==null?void 0:ie.category,metric:(ae=g[P])==null?void 0:ae.metric,metricId:(q=g[P])==null?void 0:q.metric_definition_id,isDeleted:(W=g[P])==null?void 0:W.is_deleted,isDateToasterFormat:N,setIsDateToasterFormat:I,isDropdownOpen:l,activeIndex:P,progressRef:t})},`toast-${P}`)}):g==null?void 0:g.map((ne,oe)=>i.jsx(F2e,{content:ne==null?void 0:ne.result,createdAt:ne==null?void 0:ne.created_at,category:ne==null?void 0:ne.category,metric:ne==null?void 0:ne.metric,metricId:ne==null?void 0:ne.metric_definition_id,isDeleted:ne==null?void 0:ne.is_deleted,isDateToasterFormat:N,setIsDateToasterFormat:I,isDropdownOpen:l,progressRef:t},oe))})]})]})},F2e=({content:t,createdAt:e,category:n,metric:r,metricId:s,isDeleted:a,isDateToasterFormat:o,setIsDateToasterFormat:l,isDropdownOpen:c,activeIndex:u,progressRef:d})=>{var I,P;function f({date:M}){const[F,$]=h.useState(Uo(M));return h.useEffect(()=>{const L=setInterval(()=>{$(Uo(M))},1e3);return()=>clearInterval(L)},[M]),i.jsxs("span",{className:"text-[#989898] text-[11px] font-normal font-inter leading-[13px] tracking-tight italic",children:["updated ",F==null?void 0:F.dateTime]})}const x=s===1||s===2||s===3,g=s===4||s===5||s===6,y=s===7||s===8||s===9,v=s===1||s===4||s===7,C=s===2||s===5||s===8,N=s===3||s===6||s===9;return i.jsxs("div",{onClick:M=>{M.preventDefault(),window.open(`/wallet-details/${(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress)}`,"_blank")},style:x?{background:"rgba(32, 32, 32, 0.86)",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:g?{background:"#FF42170A",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:y?{background:"#00FF910A",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:{},className:`${c?"rounded-[20px]":"rounded-b-[20px]"} ${x||y?"min-h-[107px]":g?"min-h-[123px]":""}
w-full flex gap-2 items-start justify-start px-3 pt-3 pb-2 bg-[#2b2b2b] hover:bg-[#404040] relative overflow-hidden cursor-pointer`,children:[i.jsx("div",{className:"w-10 h-10 rounded-[256px] blur-xl absolute -z-10 top-2 left-2"}),i.jsx("div",{style:x?{backgroundColor:"#FFC526"}:g?{background:"linear-gradient(180deg, #FF7300 0%, #FF2525 100%)",backgroundBlendMode:"lighten, normal, normal",boxShadow:"0px 4px 24px 0px rgba(255, 96, 10, 0.32), 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"}:y?{background:"linear-gradient(180deg, #00FF90 0%, #00FF4D 100%)",boxShadow:"0px 4px 24px 0px rgba(44, 255, 163, 0.32), 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"}:{},className:`${c?"":"toaster-animation-shake-animate"} flex justify-center items-center overflow-hidden w-10 h-10 min-w-10 min-h-10 rounded-full`,children:i.jsx("img",{src:`${x?E_e:g?A_e:y?tct:""}`,alt:"",className:`${x?"w-[40px] h-[40px] min-w-[40px] min-h-[40px]":"w-[24px] h-[24px] min-w-[24px] min-h-[24px]"}`,loading:"lazy",onError:M=>wm(M)})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[3px] w-full",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsxs("p",{className:"text-white text-[13px] font-semibold font-['Manrope'] leading-[16px]",children:[i.jsxs("span",{className:"inline-flex justify-start items-center gap-1 cursor-pointer min-w-max max-w-max h-[18px] p-1 mr-1 bg-white/[0.06] rounded-md",children:[i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope leading-none ",children:t!=null&&t.dextraaddress||t!=null&&t.sourceaddress?((I=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:I.slice(0,5))+".."+((P=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:P.slice(-4)):"--"}),i.jsx("img",{onClick:M=>{M.stopPropagation(),navigator.clipboard.writeText((t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress)),dn.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:_o,alt:"",className:"cursor-pointer"})]}),x?`is one of ${v?"today's":C?"week's":N?"month's":""} most profitable Top Follower Wallets!`:g?`has generated $${t!=null&&t.earned_rpnl?Er(t==null?void 0:t.earned_rpnl):"-"} in profits for its followers ${v?"today":C?"this week":N?"this month":""} - a wallet you’ll want to watch!`:y?`is one of ${v?"today's":C?"this week's":N?"this month's":""} most copied wallets!`:""]}),i.jsx("div",{className:`${x?"-mt-[18px]":g?"-mt-[30px]":y?"-mt-[16px]":""} w-[18px] h-[18px] min-w-[18px] min-h-[18px] flex justify-center items-start rounded `,children:i.jsx("img",{src:gae,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:nct,alt:"",className:"w-[14px] h-[14px]"}),g&&i.jsx("img",{src:rct,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?Er(t==null?void 0:t.rpnl):"-"}`:g?`+$${t!=null&&t.earned_rpnl?Er(t==null?void 0:t.earned_rpnl):"-"}`:y?Er(t==null?void 0:t.copier_count):""})]}),i.jsx("div",{className:`${x?"bg-white/20":g?"bg-[#FF670029]":y?"bg-[#67FFBD29]":""} p-1.5 rounded-md inline-flex justify-center items-center gap-1`,children:i.jsx("div",{className:`${x?"text-white":g?"text-[#FF6700]":y?"text-[#67FFBD]":""} justify-start text-[11px] font-semibold font-['Manrope'] leading-[8px]`,children:x?"Top Follower Wallets":g?"Top Source Wallets":y?"Most Copied Wallets":""})}),i.jsx("div",{className:`${x?"bg-white/20":g?"bg-[#FF670029]":y?"bg-[#67FFBD29]":""} w-max p-1.5 rounded-md inline-flex justify-center items-center gap-1"
`,children:i.jsx("div",{className:`${x?"text-white":g?"text-[#FF6700]":y?"text-[#67FFBD]":""} justify-start text-[11px] font-semibold font-['Manrope'] leading-[8px]`,children:v?"1D":C?"7D":N?"30D":""})})]}),i.jsxs("div",{className:`${c?"justify-start":"justify-between"} flex items-center w-full mt-1.5`,children:[i.jsx("div",{onClick:M=>{M.stopPropagation(),l(o=="date"?"time":"date")},className:"flex justify-end items-center text-[#989898] text-[11px] font-medium font-['Inter'] leading-[13px] tracking-tight cursor-pointer min-w-max w-max italic",children:o=="date"?i.jsx(f,{date:e}):$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}`)})]})]})]})},D$t=()=>i.jsx("div",{onClick:()=>{window.open("https://x.com/dextrabot","_blank")},className:"flex justify-center items-center bg-transparent rounded-full cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:Jlt,alt:"",className:"w-[14px] h-[14px]"})}),B$t=()=>i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank")},className:"flex justify-center items-center gap-2.5 bg-transparent rounded-2xl cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:__e,alt:"",className:"w-[14px] h-[14px]"})}),$$t=()=>i.jsx("div",{onClick:()=>{window.open("https://t.me/Dextrabot_Official","_blank")},className:"flex justify-center items-center gap-2.5 bg-transparent rounded-2xl cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:ect,alt:"",className:"w-[14px] h-[14px]"})}),U$t=()=>i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/","_blank"),className:"h-6 w-max min-h-6 py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]}),z$t=({open:t,setOpen:e,favoriteName:n,setFavoriteName:r,likeError:s,like:a,setLikeError:o})=>i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-[34px]",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(""),o("")},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:_lt,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 $5({walletAddress:t,children:e}){const{isConnected:n,address:r}=es(),{trackedWatchList:s,getTrackedWatchList:a,setSignModalOpen:o}=h.useContext(Yr),[l,c]=h.useState(""),[u,d]=h.useState(!1),[f,x]=h.useState(""),g=async C=>{try{const N=window.localStorage.getItem("hyperToken"),I="https://dextrabothypev2.nftinit.io/api/hyper/tracker/save/",P=window.localStorage.getItem("hyperAddress");if(N||o(!0),!C){x("Please enter a wallet label.");return}const M=await fetch(I,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():P,token:N,track_address:t,tag:C})});M.ok;const F=await M.json();F.success?(a(),c(""),d(!1),x(""),dn.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),dn.error(F.error_message),x(F.error_message))}catch(N){console.error("Error in like function:",N),dn.error(N.message||"Something went wrong!"),x(N.message)}},y=async()=>{try{const C=window.localStorage.getItem("hyperToken"),N=window.localStorage.getItem("hyperAddress"),I="https://dextrabothypev2.nftinit.io/api/hyper/tracker/unfollow/";C||o(!0);const P=await fetch(I,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():N,token:C,track_address:t})});if(!P.ok)throw new Error(`Failed to unlike: ${P.status} ${P.statusText}`);const M=await P.json();M.success?(a(),dn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:t.slice(0,5)+"..."+t.slice(-3)}),i.jsxs("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:[" ","removed from tracked wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.error(M.error_message),dn.error(M.error_message))}catch(C){console.error("Error in unlike function:",C),dn.error(C.message||"Something went wrong!")}},v=()=>{window.localStorage.getItem("hyperToken")?d(!0):o(!0)};return i.jsxs(i.Fragment,{children:[i.jsx(z$t,{open:u,setOpen:d,like:g,favoriteName:l,setFavoriteName:c,likeError:f,setLikeError:x}),i.jsx("div",{className:"",onClick:()=>{s!=null&&s.some(C=>C.wallet_address===t)?y():v()},children:e})]})}function H$t({open:t,setOpen:e,copyTradeSave:n}){return i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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 Qi=(t,e=null)=>{e&&t.target.src===e?t.target.src=za:e&&t.target.src!==e?t.target.src=e:t.target.src!==za&&(t.target.src=za)};function V$t({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(Ba,{})}):!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:Kl,alt:""}),i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No open positions are currently available"})})]})}):i.jsx("div",{className:"relative w-full",children:i.jsx("div",{className:"w-full overflow-y-auto max-h-[156px] h-full flex-grow mt-[1px] mb-3 pb-24",children:i.jsxs("table",{className:"w-full relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 z-[3] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] bg-[#242424] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky left-0 h-10 pl-2 sm:pl-6 min-w-[80px] z-[8] cursor-pointer",onClick:()=>c("coin"),children:i.jsxs("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max",children:["Coin",s==="coin"?o==="asc"?i.jsx(i2,{}):i.jsx(s2,{}):i.jsx(a2,{})]})}),i.jsx("th",{scope:"col",className:"px-1",children:i.jsx("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max",children:"Type"})}),i.jsx("th",{scope:"col",className:"px-4 text-right cursor-pointer",onClick:()=>c("upnl"),children:i.jsxs("div",{className:"inline-flex items-center justify-end w-full gap-1",children:[i.jsx("span",{children:"uPnL"}),s==="upnl"?o==="asc"?i.jsx(i2,{}):i.jsx(s2,{}):i.jsx(a2,{})]})})]})}),i.jsx("tbody",{children:u.map((d,f)=>{const x=parseFloat(d.unrealizedPnl)>=0,g=d.type==="Long"?"text-[#67FFBD] rotate-180":"text-[#FF797C]";return i.jsxs("tr",{className:`relative group hover:bg-[#222222] text-white h-[32px] max-h-[32px] rounded-2xl ${f%2===0?"bg-[#202020]":"bg-[#2D2D2D]"}`,children:[i.jsx("td",{scope:"row",className:"sticky left-0 z-[2] rounded-l-xl",children:i.jsx("div",{onClick:()=>{window.open(`/terminal/${d==null?void 0:d.asset}`,"_blank")},className:"flex justify-start items-center gap-2 pl-2 sm:pl-6 h-8 max-h-14 cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${d==null?void 0:d.asset}.svg`,alt:d==null?void 0:d.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:y=>Qi(y)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:d.asset})]})})}),i.jsx("td",{children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${d.type==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:i.jsx(Os,{className:`${g} w-3 h-3`})})}),i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:d.type})]})})}),i.jsx("td",{className:"rounded-r-xl text-right pr-2",children:i.jsx("div",{className:`${x?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-tight`,children:`$${Er(d.unrealizedPnl||0)}`})})]},f)})})]})})})}const{min:W$t,max:q$t}=Math,N3=(t,e=0,n=1)=>W$t(q$t(e,t),n),Qce=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]=N3(t[e],0,255)):e===3&&(t[e]=N3(t[e],0,1));return t},m$e={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])m$e[`[object ${t}]`]=t.toLowerCase();function qi(t){return m$e[Object.prototype.toString.call(t)]||"object"}const Fi=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):qi(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),y8=t=>{if(t.length<2)return null;const e=t.length-1;return qi(t[e])=="string"?t[e].toLowerCase():null},{PI:IU,min:x$e,max:g$e}=Math,up=t=>Math.round(t*100)/100,Ane=t=>Math.round(t*100)/100,Sg=IU*2,Oq=IU/3,G$t=IU/180,K$t=180/IU;function b$e(t){return[...t.slice(0,3).reverse(),...t.slice(3)]}const ki={format:{},autodetect:[]};let Zr=class{constructor(...e){const n=this;if(qi(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=y8(e),s=!1;if(!r){s=!0,ki.sorted||(ki.autodetect=ki.autodetect.sort((a,o)=>o.p-a.p),ki.sorted=!0);for(let a of ki.autodetect)if(r=a.test(...e),r)break}if(ki.format[r]){const a=ki.format[r].apply(null,s?e:e.slice(0,-1));n._rgb=Qce(a)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return qi(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const Y$t="3.1.2",yi=(...t)=>new Zr(...t);yi.version=Y$t;const VN={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"},X$t=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Q$t=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,y$e=t=>{if(t.match(X$t)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16),n=e>>16,r=e>>8&255,s=e&255;return[n,r,s,1]}if(t.match(Q$t)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16),n=e>>24&255,r=e>>16&255,s=e>>8&255,a=Math.round((e&255)/255*100)/100;return[n,r,s,a]}throw new Error(`unknown hex color: ${t}`)},{round:cF}=Math,v$e=(...t)=>{let[e,n,r,s]=Fi(t,"rgba"),a=y8(t)||"auto";s===void 0&&(s=1),a==="auto"&&(a=s<1?"rgba":"rgb"),e=cF(e),n=cF(n),r=cF(r);let l="000000"+(e<<16|n<<8|r).toString(16);l=l.substr(l.length-6);let c="0"+cF(s*255).toString(16);switch(c=c.substr(c.length-2),a.toLowerCase()){case"rgba":return`#${l}${c}`;case"argb":return`#${c}${l}`;default:return`#${l}`}};Zr.prototype.name=function(){const t=v$e(this._rgb,"rgb");for(let e of Object.keys(VN))if(VN[e]===t)return e.toLowerCase();return t};ki.format.named=t=>{if(t=t.toLowerCase(),VN[t])return y$e(VN[t]);throw new Error("unknown color name: "+t)};ki.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&VN[t.toLowerCase()])return"named"}});Zr.prototype.alpha=function(t,e=!1){return t!==void 0&&qi(t)==="number"?e?(this._rgb[3]=t,this):new Zr([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]};Zr.prototype.clipped=function(){return this._rgb._clipped||!1};const X0={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},Z$t=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function Wg(t){const e=Z$t.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);X0.labWhitePoint=t,X0.Xn=e[0],X0.Zn=e[1]}function UE(){return X0.labWhitePoint}const Zce=(...t)=>{t=Fi(t,"lab");const[e,n,r]=t,[s,a,o]=J$t(e,n,r),[l,c,u]=w$e(s,a,o);return[l,c,u,t.length>3?t[3]:1]},J$t=(t,e,n)=>{const{kE:r,kK:s,kKE:a,Xn:o,Yn:l,Zn:c}=X0,u=(t+16)/116,d=.002*e+u,f=u-.005*n,x=d*d*d,g=f*f*f,y=x>r?x:(116*d-16)/s,v=t>a?Math.pow((t+16)/116,3):t/s,C=g>r?g:(116*f-16)/s,N=y*o,I=v*l,P=C*c;return[N,I,P]},Mq=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},w$e=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:s,MtxXYZ2RGB:a,RefWhiteRGB:o,Xn:l,Yn:c,Zn:u}=X0,d=l*r.m00+c*r.m10+u*r.m20,f=l*r.m01+c*r.m11+u*r.m21,x=l*r.m02+c*r.m12+u*r.m22,g=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,y=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,v=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,C=(t*r.m00+e*r.m10+n*r.m20)*(g/d),N=(t*r.m01+e*r.m11+n*r.m21)*(y/f),I=(t*r.m02+e*r.m12+n*r.m22)*(v/x),P=C*s.m00+N*s.m10+I*s.m20,M=C*s.m01+N*s.m11+I*s.m21,F=C*s.m02+N*s.m12+I*s.m22,$=Mq(P*a.m00+M*a.m10+F*a.m20),L=Mq(P*a.m01+M*a.m11+F*a.m21),z=Mq(P*a.m02+M*a.m12+F*a.m22);return[$*255,L*255,z*255]},Jce=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=C$e(e,n,r),[c,u,d]=eUt(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function eUt(t,e,n){const{Xn:r,Yn:s,Zn:a,kE:o,kK:l}=X0,c=t/r,u=e/s,d=n/a,f=c>o?Math.pow(c,1/3):(l*c+16)/116,x=u>o?Math.pow(u,1/3):(l*u+16)/116,g=d>o?Math.pow(d,1/3):(l*d+16)/116;return[116*x-16,500*(f-x),200*(x-g)]}function Rq(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 C$e=(t,e,n)=>{t=Rq(t/255),e=Rq(e/255),n=Rq(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:s,MtxAdaptMaI:a,Xn:o,Yn:l,Zn:c,As:u,Bs:d,Cs:f}=X0;let x=t*r.m00+e*r.m10+n*r.m20,g=t*r.m01+e*r.m11+n*r.m21,y=t*r.m02+e*r.m12+n*r.m22;const v=o*s.m00+l*s.m10+c*s.m20,C=o*s.m01+l*s.m11+c*s.m21,N=o*s.m02+l*s.m12+c*s.m22;let I=x*s.m00+g*s.m10+y*s.m20,P=x*s.m01+g*s.m11+y*s.m21,M=x*s.m02+g*s.m12+y*s.m22;return I*=v/u,P*=C/d,M*=N/f,x=I*a.m00+P*a.m10+M*a.m20,g=I*a.m01+P*a.m11+M*a.m21,y=I*a.m02+P*a.m12+M*a.m22,[x,g,y]};Zr.prototype.lab=function(){return Jce(this._rgb)};const tUt=(...t)=>new Zr(...t,"lab");Object.assign(yi,{lab:tUt,getLabWhitePoint:UE,setLabWhitePoint:Wg});ki.format.lab=Zce;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"lab"),qi(t)==="array"&&t.length===3)return"lab"}});Zr.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=X0.Kn*t,new Zr(n,"lab").alpha(e.alpha(),!0)};Zr.prototype.brighten=function(t=1){return this.darken(-t)};Zr.prototype.darker=Zr.prototype.darken;Zr.prototype.brighter=Zr.prototype.brighten;Zr.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const s=e.indexOf(n)-(e.substr(0,2)==="ok"?2:0);if(s>-1)return r[s];throw new Error(`unknown channel ${n} in mode ${e}`)}else return r};const{pow:nUt}=Math,rUt=1e-7,sUt=20;Zr.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&qi(t)==="number"){if(t===0)return new Zr([0,0,0,this._rgb[3]],"rgb");if(t===1)return new Zr([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=sUt;const s=(o,l)=>{const c=o.interpolate(l,.5,e),u=c.luminance();return Math.abs(t-u)<rUt||!r--?c:u>t?s(o,c):s(c,l)},a=(n>t?s(new Zr([0,0,0]),this):s(this,new Zr([255,255,255]))).rgb();return new Zr([...a,this._rgb[3]])}return iUt(...this._rgb.slice(0,3))};const iUt=(t,e,n)=>(t=Lq(t),e=Lq(e),n=Lq(n),.2126*t+.7152*e+.0722*n),Lq=t=>(t/=255,t<=.03928?t/12.92:nUt((t+.055)/1.055,2.4)),Bu={},WN=(t,e,n=.5,...r)=>{let s=r[0]||"lrgb";if(!Bu[s]&&!r.length&&(s=Object.keys(Bu)[0]),!Bu[s])throw new Error(`interpolation mode ${s} is not defined`);return qi(t)!=="object"&&(t=new Zr(t)),qi(e)!=="object"&&(e=new Zr(e)),Bu[s](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};Zr.prototype.mix=Zr.prototype.interpolate=function(t,e=.5,...n){return WN(this,t,e,...n)};Zr.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new Zr([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:aUt,cos:oUt}=Math,S$e=(...t)=>{let[e,n,r]=Fi(t,"lch");return isNaN(r)&&(r=0),r=r*G$t,[e,oUt(r)*n,aUt(r)*n]},eue=(...t)=>{t=Fi(t,"lch");const[e,n,r]=t,[s,a,o]=S$e(e,n,r),[l,c,u]=Zce(s,a,o);return[l,c,u,t.length>3?t[3]:1]},lUt=(...t)=>{const e=b$e(Fi(t,"hcl"));return eue(...e)},{sqrt:cUt,atan2:uUt,round:dUt}=Math,N$e=(...t)=>{const[e,n,r]=Fi(t,"lab"),s=cUt(n*n+r*r);let a=(uUt(r,n)*K$t+360)%360;return dUt(s*1e4)===0&&(a=Number.NaN),[e,s,a]},tue=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=Jce(e,n,r),[c,u,d]=N$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};Zr.prototype.lch=function(){return tue(this._rgb)};Zr.prototype.hcl=function(){return b$e(tue(this._rgb))};const fUt=(...t)=>new Zr(...t,"lch"),hUt=(...t)=>new Zr(...t,"hcl");Object.assign(yi,{lch:fUt,hcl:hUt});ki.format.lch=eue;ki.format.hcl=lUt;["lch","hcl"].forEach(t=>ki.autodetect.push({p:2,test:(...e)=>{if(e=Fi(e,t),qi(e)==="array"&&e.length===3)return t}}));Zr.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=X0.Kn*t,n[1]<0&&(n[1]=0),new Zr(n,"lch").alpha(e.alpha(),!0)};Zr.prototype.desaturate=function(t=1){return this.saturate(-t)};Zr.prototype.set=function(t,e,n=!1){const[r,s]=t.split("."),a=this[r]();if(s){const o=r.indexOf(s)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(qi(e)=="string")switch(e.charAt(0)){case"+":a[o]+=+e;break;case"-":a[o]+=+e;break;case"*":a[o]*=+e.substr(1);break;case"/":a[o]/=+e.substr(1);break;default:a[o]=+e}else if(qi(e)==="number")a[o]=e;else throw new Error("unsupported value for Color.set");const l=new Zr(a,r);return n?(this._rgb=l._rgb,this):l}throw new Error(`unknown channel ${s} in mode ${r}`)}else return a};Zr.prototype.tint=function(t=.5,...e){return WN(this,"white",t,...e)};Zr.prototype.shade=function(t=.5,...e){return WN(this,"black",t,...e)};const pUt=(t,e,n)=>{const r=t._rgb,s=e._rgb;return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};Bu.rgb=pUt;const{sqrt:Dq,pow:bC}=Math,mUt=(t,e,n)=>{const[r,s,a]=t._rgb,[o,l,c]=e._rgb;return new Zr(Dq(bC(r,2)*(1-n)+bC(o,2)*n),Dq(bC(s,2)*(1-n)+bC(l,2)*n),Dq(bC(a,2)*(1-n)+bC(c,2)*n),"rgb")};Bu.lrgb=mUt;const xUt=(t,e,n)=>{const r=t.lab(),s=e.lab();return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};Bu.lab=xUt;const v8=(t,e,n,r)=>{let s,a;r==="hsl"?(s=t.hsl(),a=e.hsl()):r==="hsv"?(s=t.hsv(),a=e.hsv()):r==="hcg"?(s=t.hcg(),a=e.hcg()):r==="hsi"?(s=t.hsi(),a=e.hsi()):r==="lch"||r==="hcl"?(r="hcl",s=t.hcl(),a=e.hcl()):r==="oklch"&&(s=t.oklch().reverse(),a=e.oklch().reverse());let o,l,c,u,d,f;(r.substr(0,1)==="h"||r==="oklch")&&([o,c,d]=s,[l,u,f]=a);let x,g,y,v;return!isNaN(o)&&!isNaN(l)?(l>o&&l-o>180?v=l-(o+360):l<o&&o-l>180?v=l+360-o:v=l-o,g=o+n*v):isNaN(o)?isNaN(l)?g=Number.NaN:(g=l,(d==1||d==0)&&r!="hsv"&&(x=u)):(g=o,(f==1||f==0)&&r!="hsv"&&(x=c)),x===void 0&&(x=c+n*(u-c)),y=d+n*(f-d),r==="oklch"?new Zr([y,x,g],r):new Zr([g,x,y],r)},j$e=(t,e,n)=>v8(t,e,n,"lch");Bu.lch=j$e;Bu.hcl=j$e;const gUt=t=>{if(qi(t)=="number"&&t>=0&&t<=16777215){const e=t>>16,n=t>>8&255,r=t&255;return[e,n,r,1]}throw new Error("unknown num color: "+t)},bUt=(...t)=>{const[e,n,r]=Fi(t,"rgb");return(e<<16)+(n<<8)+r};Zr.prototype.num=function(){return bUt(this._rgb)};const yUt=(...t)=>new Zr(...t,"num");Object.assign(yi,{num:yUt});ki.format.num=gUt;ki.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&qi(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const vUt=(t,e,n)=>{const r=t.num(),s=e.num();return new Zr(r+n*(s-r),"num")};Bu.num=vUt;const{floor:wUt}=Math,CUt=(...t)=>{t=Fi(t,"hcg");let[e,n,r]=t,s,a,o;r=r*255;const l=n*255;if(n===0)s=a=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const c=wUt(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]},SUt=(...t)=>{const[e,n,r]=Fi(t,"rgb"),s=x$e(e,n,r),a=g$e(e,n,r),o=a-s,l=o*100/255,c=s/(255-o)*100;let u;return o===0?u=Number.NaN:(e===a&&(u=(n-r)/o),n===a&&(u=2+(r-e)/o),r===a&&(u=4+(e-n)/o),u*=60,u<0&&(u+=360)),[u,l,c]};Zr.prototype.hcg=function(){return SUt(this._rgb)};const NUt=(...t)=>new Zr(...t,"hcg");yi.hcg=NUt;ki.format.hcg=CUt;ki.autodetect.push({p:1,test:(...t)=>{if(t=Fi(t,"hcg"),qi(t)==="array"&&t.length===3)return"hcg"}});const jUt=(t,e,n)=>v8(t,e,n,"hcg");Bu.hcg=jUt;const{cos:yC}=Math,AUt=(...t)=>{t=Fi(t,"hsi");let[e,n,r]=t,s,a,o;return isNaN(e)&&(e=0),isNaN(n)&&(n=0),e>360&&(e-=360),e<0&&(e+=360),e/=360,e<1/3?(o=(1-n)/3,s=(1+n*yC(Sg*e)/yC(Oq-Sg*e))/3,a=1-(o+s)):e<2/3?(e-=1/3,s=(1-n)/3,a=(1+n*yC(Sg*e)/yC(Oq-Sg*e))/3,o=1-(s+a)):(e-=2/3,a=(1-n)/3,o=(1+n*yC(Sg*e)/yC(Oq-Sg*e))/3,s=1-(a+o)),s=N3(r*s*3),a=N3(r*a*3),o=N3(r*o*3),[s*255,a*255,o*255,t.length>3?t[3]:1]},{min:_Ut,sqrt:EUt,acos:kUt}=Math,TUt=(...t)=>{let[e,n,r]=Fi(t,"rgb");e/=255,n/=255,r/=255;let s;const a=_Ut(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/=EUt((e-n)*(e-n)+(e-r)*(n-r)),s=kUt(s),r>n&&(s=Sg-s),s/=Sg),[s*360,l,o]};Zr.prototype.hsi=function(){return TUt(this._rgb)};const IUt=(...t)=>new Zr(...t,"hsi");yi.hsi=IUt;ki.format.hsi=AUt;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsi"),qi(t)==="array"&&t.length===3)return"hsi"}});const PUt=(t,e,n)=>v8(t,e,n,"hsi");Bu.hsi=PUt;const _ne=(...t)=>{t=Fi(t,"hsl");const[e,n,r]=t;let s,a,o;if(n===0)s=a=o=r*255;else{const l=[0,0,0],c=[0,0,0],u=r<.5?r*(1+n):r+n-r*n,d=2*r-u,f=e/360;l[0]=f+1/3,l[1]=f,l[2]=f-1/3;for(let x=0;x<3;x++)l[x]<0&&(l[x]+=1),l[x]>1&&(l[x]-=1),6*l[x]<1?c[x]=d+(u-d)*6*l[x]:2*l[x]<1?c[x]=u:3*l[x]<2?c[x]=d+(u-d)*(2/3-l[x])*6:c[x]=d;[s,a,o]=[c[0]*255,c[1]*255,c[2]*255]}return t.length>3?[s,a,o,t[3]]:[s,a,o,1]},A$e=(...t)=>{t=Fi(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const s=x$e(e,n,r),a=g$e(e,n,r),o=(a+s)/2;let l,c;return a===s?(l=0,c=Number.NaN):l=o<.5?(a-s)/(a+s):(a-s)/(2-a-s),e==a?c=(n-r)/(a-s):n==a?c=2+(r-e)/(a-s):r==a&&(c=4+(e-n)/(a-s)),c*=60,c<0&&(c+=360),t.length>3&&t[3]!==void 0?[c,l,o,t[3]]:[c,l,o]};Zr.prototype.hsl=function(){return A$e(this._rgb)};const FUt=(...t)=>new Zr(...t,"hsl");yi.hsl=FUt;ki.format.hsl=_ne;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsl"),qi(t)==="array"&&t.length===3)return"hsl"}});const OUt=(t,e,n)=>v8(t,e,n,"hsl");Bu.hsl=OUt;const{floor:MUt}=Math,RUt=(...t)=>{t=Fi(t,"hsv");let[e,n,r]=t,s,a,o;if(r*=255,n===0)s=a=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const l=MUt(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:LUt,max:DUt}=Math,BUt=(...t)=>{t=Fi(t,"rgb");let[e,n,r]=t;const s=LUt(e,n,r),a=DUt(e,n,r),o=a-s;let l,c,u;return u=a/255,a===0?(l=Number.NaN,c=0):(c=o/a,e===a&&(l=(n-r)/o),n===a&&(l=2+(r-e)/o),r===a&&(l=4+(e-n)/o),l*=60,l<0&&(l+=360)),[l,c,u]};Zr.prototype.hsv=function(){return BUt(this._rgb)};const $Ut=(...t)=>new Zr(...t,"hsv");yi.hsv=$Ut;ki.format.hsv=RUt;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsv"),qi(t)==="array"&&t.length===3)return"hsv"}});const UUt=(t,e,n)=>v8(t,e,n,"hsv");Bu.hsv=UUt;function BL(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 nue=(...t)=>{t=Fi(t,"lab");const[e,n,r,...s]=t,[a,o,l]=zUt([e,n,r]),[c,u,d]=w$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function zUt(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=BL(n,t);return BL(e,r.map(s=>s**3))}const rue=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),a=C$e(e,n,r);return[...HUt(a),...s.length>0&&s[0]<1?[s[0]]:[]]};function HUt(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=BL(e,t);return BL(n,r.map(s=>Math.cbrt(s)))}Zr.prototype.oklab=function(){return rue(this._rgb)};const VUt=(...t)=>new Zr(...t,"oklab");Object.assign(yi,{oklab:VUt});ki.format.oklab=nue;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"oklab"),qi(t)==="array"&&t.length===3)return"oklab"}});const WUt=(t,e,n)=>{const r=t.oklab(),s=e.oklab();return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};Bu.oklab=WUt;const qUt=(t,e,n)=>v8(t,e,n,"oklch");Bu.oklch=qUt;const{pow:Bq,sqrt:$q,PI:Uq,cos:O2e,sin:M2e,atan2:GUt}=Math,KUt=(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map(()=>1));const s=r/n.reduce(function(f,x){return f+x});if(n.forEach((f,x)=>{n[x]*=s}),t=t.map(f=>new Zr(f)),e==="lrgb")return YUt(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*Uq;c+=O2e(x)*n[0],u+=M2e(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*Uq;c+=O2e(v)*n[x+1],u+=M2e(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=GUt(u/l[f],c/l[f])/Uq*180;for(;x<0;)x+=360;for(;x>=360;)x-=360;o[f]=x}else o[f]=o[f]/l[f];return d/=r,new Zr(o,e).alpha(d>.99999?1:d,!0)},YUt=(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]+=Bq(l[0],2)*o,r[1]+=Bq(l[1],2)*o,r[2]+=Bq(l[2],2)*o,r[3]+=l[3]*o}return r[0]=$q(r[0]),r[1]=$q(r[1]),r[2]=$q(r[2]),r[3]>.9999999&&(r[3]=1),new Zr(Qce(r))},{pow:XUt}=Math;function $L(t){let e="rgb",n=yi("#ccc"),r=0,s=[0,1],a=[],o=[0,0],l=!1,c=[],u=!1,d=0,f=1,x=!1,g={},y=!0,v=1;const C=function(L){if(L=L||["#fff","#000"],L&&qi(L)==="string"&&yi.brewer&&yi.brewer[L.toLowerCase()]&&(L=yi.brewer[L.toLowerCase()]),qi(L)==="array"){L.length===1&&(L=[L[0],L[0]]),L=L.slice(0);for(let z=0;z<L.length;z++)L[z]=yi(L[z]);a.length=0;for(let z=0;z<L.length;z++)a.push(z/(L.length-1))}return F(),c=L},N=function(L){if(l!=null){const z=l.length-1;let Q=0;for(;Q<z&&L>=l[Q];)Q++;return Q-1}return 0};let I=L=>L,P=L=>L;const M=function(L,z){let Q,se;if(z==null&&(z=!1),isNaN(L)||L===null)return n;z?se=L:l&&l.length>2?se=N(L)/(l.length-2):f!==d?se=(L-d)/(f-d):se=1,se=P(se),z||(se=I(se)),v!==1&&(se=XUt(se,v)),se=o[0]+se*(1-o[0]-o[1]),se=N3(se,0,1);const ee=Math.floor(se*1e4);if(y&&g[ee])Q=g[ee];else{if(qi(c)==="array")for(let K=0;K<a.length;K++){const re=a[K];if(se<=re){Q=c[K];break}if(se>=re&&K===a.length-1){Q=c[K];break}if(se>re&&se<a[K+1]){se=(se-re)/(a[K+1]-re),Q=yi.interpolate(c[K],c[K+1],se,e);break}}else qi(c)==="function"&&(Q=c(se));y&&(g[ee]=Q)}return Q};var F=()=>g={};C(t);const $=function(L){const z=yi(M(L));return u&&z[u]?z[u]():z};return $.classes=function(L){if(L!=null){if(qi(L)==="array")l=L,s=[L[0],L[L.length-1]];else{const z=yi.analyze(s);L===0?l=[z.min,z.max]:l=yi.limits(z,"e",L)}return $}return l},$.domain=function(L){if(!arguments.length)return s;d=L[0],f=L[L.length-1],a=[];const z=c.length;if(L.length===z&&d!==f)for(let Q of Array.from(L))a.push((Q-d)/(f-d));else{for(let Q=0;Q<z;Q++)a.push(Q/(z-1));if(L.length>2){const Q=L.map((ee,K)=>K/(L.length-1)),se=L.map(ee=>(ee-d)/(f-d));se.every((ee,K)=>Q[K]===ee)||(P=ee=>{if(ee<=0||ee>=1)return ee;let K=0;for(;ee>=se[K+1];)K++;const re=(ee-se[K])/(se[K+1]-se[K]);return Q[K]+re*(Q[K+1]-Q[K])})}}return s=[d,f],$},$.mode=function(L){return arguments.length?(e=L,F(),$):e},$.range=function(L,z){return C(L),$},$.out=function(L){return u=L,$},$.spread=function(L){return arguments.length?(r=L,$):r},$.correctLightness=function(L){return L==null&&(L=!0),x=L,F(),x?I=function(z){const Q=M(0,!0).lab()[0],se=M(1,!0).lab()[0],ee=Q>se;let K=M(z,!0).lab()[0];const re=Q+(se-Q)*z;let de=K-re,G=0,ie=1,ae=20;for(;Math.abs(de)>.01&&ae-- >0;)(function(){return ee&&(de*=-1),de<0?(G=z,z+=(ie-z)*.5):(ie=z,z+=(G-z)*.5),K=M(z,!0).lab()[0],de=K-re})();return z}:I=z=>z,$},$.padding=function(L){return L!=null?(qi(L)==="number"&&(L=[L,L]),o=L,$):o},$.colors=function(L,z){arguments.length<2&&(z="hex");let Q=[];if(arguments.length===0)Q=c.slice(0);else if(L===1)Q=[$(.5)];else if(L>1){const se=s[0],ee=s[1]-se;Q=QUt(0,L).map(K=>$(se+K/(L-1)*ee))}else{t=[];let se=[];if(l&&l.length>2)for(let ee=1,K=l.length,re=1<=K;re?ee<K:ee>K;re?ee++:ee--)se.push((l[ee-1]+l[ee])*.5);else se=s;Q=se.map(ee=>$(ee))}return yi[z]&&(Q=Q.map(se=>se[z]())),Q},$.cache=function(L){return L!=null?(y=L,$):y},$.gamma=function(L){return L!=null?(v=L,$):v},$.nodata=function(L){return L!=null?(n=yi(L),$):n},$}function QUt(t,e,n){let r=[],s=t<e,a=e;for(let o=t;s?o<a:o>a;s?o++:o--)r.push(o);return r}const ZUt=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},JUt=function(t){let e,n,r,s;if(t=t.map(a=>new Zr(a)),t.length===2)[n,r]=t.map(a=>a.lab()),e=function(a){const o=[0,1,2].map(l=>n[l]+a*(r[l]-n[l]));return new Zr(o,"lab")};else if(t.length===3)[n,r,s]=t.map(a=>a.lab()),e=function(a){const o=[0,1,2].map(l=>(1-a)*(1-a)*n[l]+2*(1-a)*a*r[l]+a*a*s[l]);return new Zr(o,"lab")};else if(t.length===4){let a;[n,r,s,a]=t.map(o=>o.lab()),e=function(o){const l=[0,1,2].map(c=>(1-o)*(1-o)*(1-o)*n[c]+3*(1-o)*(1-o)*o*r[c]+3*(1-o)*o*o*s[c]+o*o*o*a[c]);return new Zr(l,"lab")}}else if(t.length>=5){let a,o,l;a=t.map(c=>c.lab()),l=t.length-1,o=ZUt(l),e=function(c){const u=1-c,d=[0,1,2].map(f=>a.reduce((x,g,y)=>x+o[y]*u**(l-y)*c**y*g[f],0));return new Zr(d,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},ezt=t=>{const e=JUt(t);return e.scale=()=>$L(e),e},{round:_$e}=Math;Zr.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(_$e)};Zr.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:_$e(e):e)};const tzt=(...t)=>new Zr(...t,"rgb");Object.assign(yi,{rgb:tzt});ki.format.rgb=(...t)=>{const e=Fi(t,"rgba");return e[3]===void 0&&(e[3]=1),e};ki.autodetect.push({p:3,test:(...t)=>{if(t=Fi(t,"rgba"),qi(t)==="array"&&(t.length===3||t.length===4&&qi(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const Tm=(t,e,n)=>{if(!Tm[n])throw new Error("unknown blend mode "+n);return Tm[n](t,e)},I2=t=>(e,n)=>{const r=yi(n).rgb(),s=yi(e).rgb();return yi.rgb(t(r,s))},P2=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},nzt=t=>t,rzt=(t,e)=>t*e/255,szt=(t,e)=>t>e?e:t,izt=(t,e)=>t>e?t:e,azt=(t,e)=>255*(1-(1-t/255)*(1-e/255)),ozt=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),lzt=(t,e)=>255*(1-(1-e/255)/(t/255)),czt=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);Tm.normal=I2(P2(nzt));Tm.multiply=I2(P2(rzt));Tm.screen=I2(P2(azt));Tm.overlay=I2(P2(ozt));Tm.darken=I2(P2(szt));Tm.lighten=I2(P2(izt));Tm.dodge=I2(P2(czt));Tm.burn=I2(P2(lzt));const{pow:uzt,sin:dzt,cos:fzt}=Math;function hzt(t=300,e=-1.5,n=1,r=1,s=[0,1]){let a=0,o;qi(s)==="array"?o=s[1]-s[0]:(o=0,s=[s,s]);const l=function(c){const u=Sg*((t+120)/360+e*c),d=uzt(s[0]+o*c,r),x=(a!==0?n[0]+c*a:n)*d*(1-d)/2,g=fzt(u),y=dzt(u),v=d+x*(-.14861*g+1.78277*y),C=d+x*(-.29227*g-.90649*y),N=d+x*(1.97294*g);return yi(Qce([v*255,C*255,N*255,1]))};return l.start=function(c){return c==null?t:(t=c,l)},l.rotations=function(c){return c==null?e:(e=c,l)},l.gamma=function(c){return c==null?r:(r=c,l)},l.hue=function(c){return c==null?n:(n=c,qi(n)==="array"?(a=n[1]-n[0],a===0&&(n=n[1])):a=0,l)},l.lightness=function(c){return c==null?s:(qi(c)==="array"?(s=c,o=c[1]-c[0]):(s=[c,c],o=0),l)},l.scale=()=>yi.scale(l),l.hue(n),l}const pzt="0123456789abcdef",{floor:mzt,random:xzt}=Math,gzt=()=>{let t="#";for(let e=0;e<6;e++)t+=pzt.charAt(mzt(xzt()*16));return new Zr(t,"hex")},{log:R2e,pow:bzt,floor:yzt,abs:vzt}=Math;function E$e(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return qi(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&qi(r)==="object"&&(r=r[e]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,s)=>k$e(n,r,s),n}function k$e(t,e="equal",n=7){qi(t)=="array"&&(t=E$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*R2e(r),c=Math.LOG10E*R2e(s);o.push(r);for(let u=1;u<n;u++)o.push(bzt(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=yzt(c);if(u===c)o.push(a[u]);else{const d=c-u;o.push(a[u]*(1-d)+a[u+1]*d)}}o.push(s)}else if(e.substr(0,1)==="k"){let l;const c=a.length,u=new Array(c),d=new Array(n);let f=!0,x=0,g=null;g=[],g.push(r);for(let C=1;C<n;C++)g.push(r+C/n*(s-r));for(g.push(s);f;){for(let N=0;N<n;N++)d[N]=0;for(let N=0;N<c;N++){const I=a[N];let P=Number.MAX_VALUE,M;for(let F=0;F<n;F++){const $=vzt(g[F]-I);$<P&&(P=$,M=F),d[M]++,u[N]=M}}const C=new Array(n);for(let N=0;N<n;N++)C[N]=null;for(let N=0;N<c;N++)l=u[N],C[l]===null?C[l]=a[N]:C[l]+=a[N];for(let N=0;N<n;N++)C[N]*=1/d[N];f=!1;for(let N=0;N<n;N++)if(C[N]!==g[N]){f=!0;break}g=C,x++,x>200&&(f=!1)}const y={};for(let C=0;C<n;C++)y[C]=[];for(let C=0;C<c;C++)l=u[C],y[l].push(a[C]);let v=[];for(let C=0;C<n;C++)v.push(y[C][0]),v.push(y[C][y[C].length-1]);v=v.sort((C,N)=>C-N),o.push(v[0]);for(let C=1;C<v.length;C+=2){const N=v[C];!isNaN(N)&&o.indexOf(N)===-1&&o.push(N)}}return o}const wzt=(t,e)=>{t=new Zr(t),e=new Zr(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)};/**
* @license
*
* The APCA contrast prediction algorithm is based of the formulas published
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
*
* Note that the APCA implementation is still beta, so please update to
* future versions of chroma.js when they become available.
*
* You can read more about the APCA Readability Criterion at
* https://readtech.org/ARC/
*/const L2e=.027,Czt=5e-4,Szt=.1,D2e=1.14,uF=.022,B2e=1.414,Nzt=(t,e)=>{t=new Zr(t),e=new Zr(e),t.alpha()<1&&(t=WN(e,t,t.alpha(),"rgb"));const n=$2e(...t.rgb()),r=$2e(...e.rgb()),s=n>=uF?n:n+Math.pow(uF-n,B2e),a=r>=uF?r:r+Math.pow(uF-r,B2e),o=Math.pow(a,.56)-Math.pow(s,.57),l=Math.pow(a,.65)-Math.pow(s,.62),c=Math.abs(a-s)<Czt?0:s<a?o*D2e:l*D2e;return(Math.abs(c)<Szt?0:c>0?c-L2e:c+L2e)*100};function $2e(t,e,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:eg,pow:Ml,min:jzt,max:Azt,atan2:U2e,abs:z2e,cos:dF,sin:H2e,exp:_zt,PI:V2e}=Math;function Ezt(t,e,n=1,r=1,s=1){var a=function(_e){return 360*_e/(2*V2e)},o=function(_e){return 2*V2e*_e/360};t=new Zr(t),e=new Zr(e);const[l,c,u]=Array.from(t.lab()),[d,f,x]=Array.from(e.lab()),g=(l+d)/2,y=eg(Ml(c,2)+Ml(u,2)),v=eg(Ml(f,2)+Ml(x,2)),C=(y+v)/2,N=.5*(1-eg(Ml(C,7)/(Ml(C,7)+Ml(25,7)))),I=c*(1+N),P=f*(1+N),M=eg(Ml(I,2)+Ml(u,2)),F=eg(Ml(P,2)+Ml(x,2)),$=(M+F)/2,L=a(U2e(u,I)),z=a(U2e(x,P)),Q=L>=0?L:L+360,se=z>=0?z:z+360,ee=z2e(Q-se)>180?(Q+se+360)/2:(Q+se)/2,K=1-.17*dF(o(ee-30))+.24*dF(o(2*ee))+.32*dF(o(3*ee+6))-.2*dF(o(4*ee-63));let re=se-Q;re=z2e(re)<=180?re:se<=Q?re+360:re-360,re=2*eg(M*F)*H2e(o(re)/2);const de=d-l,G=F-M,ie=1+.015*Ml(g-50,2)/eg(20+Ml(g-50,2)),ae=1+.045*$,q=1+.015*$*K,W=30*_zt(-Ml((ee-275)/25,2)),oe=-(2*eg(Ml($,7)/(Ml($,7)+Ml(25,7))))*H2e(2*o(W)),he=eg(Ml(de/(n*ie),2)+Ml(G/(r*ae),2)+Ml(re/(s*q),2)+oe*(G/(r*ae))*(re/(s*q)));return Azt(0,jzt(100,he))}function kzt(t,e,n="lab"){t=new Zr(t),e=new Zr(e);const r=t.get(n),s=e.get(n);let a=0;for(let o in r){const l=(r[o]||0)-(s[o]||0);a+=l*l}return Math.sqrt(a)}const Tzt=(...t)=>{try{return new Zr(...t),!0}catch{return!1}},Izt={cool(){return $L([yi.hsl(180,1,.9),yi.hsl(250,.7,.4)])},hot(){return $L(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Ene={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"]},T$e=Object.keys(Ene),W2e=new Map(T$e.map(t=>[t.toLowerCase(),t])),Pzt=typeof Proxy=="function"?new Proxy(Ene,{get(t,e){const n=e.toLowerCase();if(W2e.has(n))return t[W2e.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(T$e)}}):Ene,Fzt=(...t)=>{t=Fi(t,"cmyk");const[e,n,r,s]=t,a=t.length>4?t[4]:1;return s===1?[0,0,0,a]:[e>=1?0:255*(1-e)*(1-s),n>=1?0:255*(1-n)*(1-s),r>=1?0:255*(1-r)*(1-s),a]},{max:q2e}=Math,Ozt=(...t)=>{let[e,n,r]=Fi(t,"rgb");e=e/255,n=n/255,r=r/255;const s=1-q2e(e,q2e(n,r)),a=s<1?1/(1-s):0,o=(1-e-s)*a,l=(1-n-s)*a,c=(1-r-s)*a;return[o,l,c,s]};Zr.prototype.cmyk=function(){return Ozt(this._rgb)};const Mzt=(...t)=>new Zr(...t,"cmyk");Object.assign(yi,{cmyk:Mzt});ki.format.cmyk=Fzt;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"cmyk"),qi(t)==="array"&&t.length===4)return"cmyk"}});const Rzt=(...t)=>{const e=Fi(t,"hsla");let n=y8(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(" ")})`},Lzt=(...t)=>{const e=Fi(t,"lab");let n=y8(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(" ")})`},Dzt=(...t)=>{const e=Fi(t,"lch");let n=y8(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(" ")})`},Bzt=(...t)=>{const e=Fi(t,"lab");return e[0]=up(e[0]*100)+"%",e[1]=Ane(e[1]),e[2]=Ane(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},I$e=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=rue(e,n,r),[c,u,d]=N$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},$zt=(...t)=>{const e=Fi(t,"lch");return e[0]=up(e[0]*100)+"%",e[1]=Ane(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:zq}=Math,Uzt=(...t)=>{const e=Fi(t,"rgba");let n=y8(t)||"rgb";if(n.substr(0,3)==="hsl")return Rzt(A$e(e),n);if(n.substr(0,3)==="lab"){const r=UE();Wg("d50");const s=Lzt(Jce(e),n);return Wg(r),s}if(n.substr(0,3)==="lch"){const r=UE();Wg("d50");const s=Dzt(tue(e),n);return Wg(r),s}return n.substr(0,5)==="oklab"?Bzt(rue(e)):n.substr(0,5)==="oklch"?$zt(I$e(e)):(e[0]=zq(e[0]),e[1]=zq(e[1]),e[2]=zq(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(" ")})`)},P$e=(...t)=>{t=Fi(t,"lch");const[e,n,r,...s]=t,[a,o,l]=S$e(e,n,r),[c,u,d]=nue(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},a1=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,Cm=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,UL=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,vp=/\s*/.source,w8=/\s+/.source,sue=/\s*,\s*/.source,PU=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,C8=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,F$e=new RegExp("^rgba?\\("+vp+[a1,a1,a1].join(w8)+C8+"\\)$"),O$e=new RegExp("^rgb\\("+vp+[a1,a1,a1].join(sue)+vp+"\\)$"),M$e=new RegExp("^rgba\\("+vp+[a1,a1,a1,Cm].join(sue)+vp+"\\)$"),R$e=new RegExp("^hsla?\\("+vp+[PU,UL,UL].join(w8)+C8+"\\)$"),L$e=new RegExp("^hsl?\\("+vp+[PU,UL,UL].join(sue)+vp+"\\)$"),D$e=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,B$e=new RegExp("^lab\\("+vp+[Cm,Cm,Cm].join(w8)+C8+"\\)$"),$$e=new RegExp("^lch\\("+vp+[Cm,Cm,PU].join(w8)+C8+"\\)$"),U$e=new RegExp("^oklab\\("+vp+[Cm,Cm,Cm].join(w8)+C8+"\\)$"),z$e=new RegExp("^oklch\\("+vp+[Cm,Cm,PU].join(w8)+C8+"\\)$"),{round:H$e}=Math,vC=t=>t.map((e,n)=>n<=2?N3(H$e(e),0,255):e),Rl=(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,iue=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e;if(ki.format.named)try{return ki.format.named(t)}catch{}if((e=t.match(F$e))||(e=t.match(O$e))){let n=e.slice(1,4);for(let s=0;s<3;s++)n[s]=+Rl(Ju(n[s],0),0,255);n=vC(n);const r=e[4]!==void 0?+Rl(e[4],0,1):1;return n[3]=r,n}if(e=t.match(M$e)){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+Rl(n[r],0,255);return n}if((e=t.match(R$e))||(e=t.match(L$e))){const n=e.slice(1,4);n[0]=+Ju(n[0].replace("deg",""),0),n[1]=+Rl(Ju(n[1],0),0,100)*.01,n[2]=+Rl(Ju(n[2],0),0,100)*.01;const r=vC(_ne(n)),s=e[4]!==void 0?+Rl(e[4],0,1):1;return r[3]=s,r}if(e=t.match(D$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]=H$e(r[s]);return r[3]=+e[4],r}if(e=t.match(B$e)){const n=e.slice(1,4);n[0]=Rl(Ju(n[0],0),0,100),n[1]=Rl(Ju(n[1],0),-125,125,!0),n[2]=Rl(Ju(n[2],0),-125,125,!0);const r=UE();Wg("d50");const s=vC(Zce(n));Wg(r);const a=e[4]!==void 0?+Rl(e[4],0,1):1;return s[3]=a,s}if(e=t.match($$e)){const n=e.slice(1,4);n[0]=Rl(n[0],0,100),n[1]=Rl(Ju(n[1],0),0,150,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=UE();Wg("d50");const s=vC(eue(n));Wg(r);const a=e[4]!==void 0?+Rl(e[4],0,1):1;return s[3]=a,s}if(e=t.match(U$e)){const n=e.slice(1,4);n[0]=Rl(Ju(n[0],0),0,1),n[1]=Rl(Ju(n[1],0),-.4,.4,!0),n[2]=Rl(Ju(n[2],0),-.4,.4,!0);const r=vC(nue(n)),s=e[4]!==void 0?+Rl(e[4],0,1):1;return r[3]=s,r}if(e=t.match(z$e)){const n=e.slice(1,4);n[0]=Rl(Ju(n[0],0),0,1),n[1]=Rl(Ju(n[1],0),0,.4,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=vC(P$e(n)),s=e[4]!==void 0?+Rl(e[4],0,1):1;return r[3]=s,r}};iue.test=t=>F$e.test(t)||R$e.test(t)||B$e.test(t)||$$e.test(t)||U$e.test(t)||z$e.test(t)||O$e.test(t)||M$e.test(t)||L$e.test(t)||D$e.test(t)||t==="transparent";Zr.prototype.css=function(t){return Uzt(this._rgb,t)};const zzt=(...t)=>new Zr(...t,"css");yi.css=zzt;ki.format.css=iue;ki.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&iue.test(t))return"css"}});ki.format.gl=(...t)=>{const e=Fi(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const Hzt=(...t)=>new Zr(...t,"gl");yi.gl=Hzt;Zr.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};Zr.prototype.hex=function(t){return v$e(this._rgb,t)};const Vzt=(...t)=>new Zr(...t,"hex");yi.hex=Vzt;ki.format.hex=y$e;ki.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:fF}=Math,V$e=t=>{const e=t/100;let n,r,s;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*fF(r),s=e<20?0:-254.76935184120902+.8274096064007395*(s=e-10)+115.67994401066147*fF(s)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*fF(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*fF(r),s=255),[n,r,s,1]},{round:Wzt}=Math,qzt=(...t)=>{const e=Fi(t,"rgb"),n=e[0],r=e[2];let s=1e3,a=4e4;const o=.4;let l;for(;a-s>o;){l=(a+s)*.5;const c=V$e(l);c[2]/c[0]>=r/n?a=l:s=l}return Wzt(l)};Zr.prototype.temp=Zr.prototype.kelvin=Zr.prototype.temperature=function(){return qzt(this._rgb)};const Hq=(...t)=>new Zr(...t,"temp");Object.assign(yi,{temp:Hq,kelvin:Hq,temperature:Hq});ki.format.temp=ki.format.kelvin=ki.format.temperature=V$e;Zr.prototype.oklch=function(){return I$e(this._rgb)};const Gzt=(...t)=>new Zr(...t,"oklch");Object.assign(yi,{oklch:Gzt});ki.format.oklch=P$e;ki.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"oklch"),qi(t)==="array"&&t.length===3)return"oklch"}});Object.assign(yi,{analyze:E$e,average:KUt,bezier:ezt,blend:Tm,brewer:Pzt,Color:Zr,colors:VN,contrast:wzt,contrastAPCA:Nzt,cubehelix:hzt,deltaE:Ezt,distance:kzt,input:ki,interpolate:WN,limits:k$e,mix:WN,random:gzt,scale:$L,scales:Izt,valid:Tzt});const Kzt=({className:t})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",className:t,children:i.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.875 3.67C7.875 3.025 7.315 2.5 6.625 2.5C5.935 2.5 5.375 3.025 5.375 3.67C5.375 4.316 5.935 4.84 6.625 4.84C7.315 4.84 7.875 4.316 7.875 3.67ZM7.875 12.33C7.875 11.684 7.315 11.16 6.625 11.16C5.935 11.16 5.375 11.684 5.375 12.33C5.375 12.975 5.935 13.5 6.625 13.5C7.315 13.5 7.875 12.975 7.875 12.33ZM6.625 6.83C7.315 6.83 7.875 7.355 7.875 8C7.875 8.645 7.315 9.17 6.625 9.17C5.935 9.17 5.375 8.645 5.375 8C5.375 7.355 5.935 6.83 6.625 6.83ZM11.625 3.67C11.625 3.025 11.065 2.5 10.375 2.5C9.685 2.5 9.125 3.025 9.125 3.67C9.125 4.316 9.685 4.84 10.375 4.84C11.065 4.84 11.625 4.316 11.625 3.67ZM10.375 11.16C11.065 11.16 11.625 11.684 11.625 12.33C11.625 12.975 11.065 13.5 10.375 13.5C9.685 13.5 9.125 12.975 9.125 12.33C9.125 11.684 9.685 11.16 10.375 11.16ZM11.625 8C11.625 7.355 11.065 6.83 10.375 6.83C9.685 6.83 9.125 7.355 9.125 8C9.125 8.645 9.685 9.17 10.375 9.17C11.065 9.17 11.625 8.645 11.625 8Z",fill:"currentColor"})}),ww=({className:t})=>i.jsxs("svg",{width:"7",height:"8",viewBox:"0 0 7 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M0.660034 6.83L6.32003 1.17",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M6.32003 6.83L0.660034 1.17",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),Vq=({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(N=>!(n!=null&&n.includes(N.value))).map(N=>N.value);r(C)},[t,n]);const f=C=>{e!=null&&e.includes(C)?(r(e.filter(N=>N!==C)),s([...n,C])):(s(n.filter(N=>N!==C)),r([...e,C]))},x=()=>{const C=t.map(N=>N.value);r(C),s([])},g=()=>{const C=t.map(N=>N.value);s(C),r([])},y=t==null?void 0:t.filter(C=>{var N;return(N=C.label.toLowerCase())==null?void 0:N.includes(c.toLowerCase())}),v=()=>{u("")};return i.jsxs("div",{className:"col-span-1 flex flex-col gap-[4px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Asset Management"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{content:"Choose which assets to include or exclude from copy trading. You can customize which coins you want to trade.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] mt-6"})})]})]}),i.jsxs("div",{className:"relative w-full max-w-full",children:[i.jsxs("div",{className:" flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8",onClick:d,children:[i.jsx("div",{className:"flex justify-start items-center text-[#7c7c7c] text-sm font-semibold font-manrope leading-[8px]",children:i.jsxs("div",{className:"flex justify-start items-center gap-[3px]",children:[i.jsx("div",{className:"w-1.5 h-1.5 bg-[#67ffbd] rounded-full"}),i.jsxs("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px]",children:["Include"," ",i.jsx("span",{className:`${(e==null?void 0:e.length)>0?"text-[#67ffbd]":"text-white"} text-[11px] font-semibold font-manrope leading-[8px]`,children:`(${e==null?void 0:e.length})`})]}),i.jsx("div",{className:"w-1.5 h-1.5 bg-[#ff787b] rounded-full ml-[6px]"}),i.jsxs("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px]",children:["Exclude"," ",i.jsx("span",{className:`${(n==null?void 0:n.length)>0?"text-[#ff787b]":"text-white"} text-[11px] font-semibold font-manrope leading-[8px]`,children:`(${n==null?void 0:n.length})`})]})]})}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${o?"rotate-180":""}`})]}),o&&i.jsxs("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:[i.jsxs("div",{className:"flex justify-between items-center space-x-4 mb-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{onClick:x,className:"h-4 p-1.5 rounded-md outline outline-1 outline-[#67ffbd] inline-flex justify-start items-center gap-2 cursor-pointer",children:i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-manrope leading-[8px]",children:"Select All Include"})}),i.jsx("div",{onClick:g,className:"h-4 p-1.5 rounded-md outline outline-1 outline-[#ff787b] inline-flex justify-start items-center gap-2 cursor-pointer",children:i.jsx("div",{className:"justify-start text-[#ff787b] text-[11px] font-semibold font-manrope leading-[8px]",children:"Select All Exclude"})})]}),i.jsxs("div",{className:"flex items-center relative",children:[i.jsx("input",{type:"text",placeholder:"Search Coin",value:c,onChange:C=>u(C.target.value),className:`${c?"border border-[#7F7F7F]":""} py-[4px] bg-[#1B1B1B] border border-[#303030] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-full sm:w-[153px] lg:w-full pl-[30px] pr-6 focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[32px]`}),i.jsx(zy,{className:"text-[#646464] absolute left-1.5"}),c&&i.jsx("span",{onClick:v,className:"flex justify-center items-center cursor-pointer absolute right-2 w-[10px] h-[10px]",children:i.jsx(ww,{className:"hover:text-[#cdcdcd] text-[#7C7C7C] w-[10px] h-[10px]"})})]})]}),i.jsx("div",{className:"max-h-[230px] overflow-y-auto scrollbar-custom-scrollbar-dark",children:a?i.jsx("span",{className:"flex justify-center items-center w-full text-[#7e7e7e] text-sm font-medium font-inter leading-[8px] my-2",children:"Loading..."}):!y||y.length===0?i.jsx("span",{className:"flex justify-center items-center w-full text-[#7e7e7e] text-sm font-medium font-inter leading-[8px] my-4",children:c?"No coins match your search":"No data available at the moment. Please try again later."}):y==null?void 0:y.map((C,N)=>i.jsxs("div",{className:`${e!=null&&e.includes(C.value)?"bg-[#67ffbd]/20 hover:bg-[#67ffbd]/30":"bg-[#ff797c]/20 hover:bg-[#ff797c]/30"} flex justify-between items-center h-8 p-2 text-xs text-white rounded-md mb-[2px]`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-[26px]",children:[i.jsx(Kzt,{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:I=>wm(I)}),i.jsx("span",{className:`${e!=null&&e.includes(C.value)?"text-[#67FFBD]":"text-[#FF797C]"} justify-start text-[11px] font-semibold font-manrope leading-[13px] tracking-tight`,children:C.label})]})]}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("div",{onClick:()=>f(C.value),className:`${e!=null&&e.includes(C.value)?"bg-green-500 border-[#67ffbd]":"border-[#cdcdcd]"} h-4 p-1.5 rounded-md border inline-flex justify-start items-center gap-2 text-white cursor-pointer`,children:i.jsx("div",{className:"justify-start text-[11px] font-semibold font-manrope leading-[8px]",children:"Include"})}),i.jsx("div",{onClick:()=>f(C.value),className:`${e!=null&&e.includes(C.value)?"border-[#cdcdcd]":"bg-[#ff787b] border-[#ff787b]"} h-4 p-1.5 rounded-md border inline-flex justify-start items-center gap-2 text-white cursor-pointer`,children:i.jsx("div",{className:"justify-start text-[11px] font-semibold font-manrope leading-[8px]",children:"Exclude"})})]})]},N))})]})]})]})},Wq=new Map,Yzt=t=>{if(!t)return Math.floor(Math.random()*1240);const e=t.toLowerCase().replace(/^0x/,"");return parseInt(e.slice(0,8),16)%1240};function W$e({wallet:t,className:e=""}){const[n,r]=h.useState(()=>Wq.get(t)||null),[s,a]=h.useState(!1);return h.useEffect(()=>{if(Wq.has(t))return;const o=Yzt(t);ps.get(`https://apiv7.nftinit.io/api/f5WNdSBmQ/${o}`).then(({data:l})=>{let c=l==null?void 0:l.image;c!=null&&c.startsWith("ipfs://")&&(c=`https://ipfs.io/ipfs/${c.slice(7)}`),Wq.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 Xzt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsUnderstand:s})=>i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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:Ki,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-4",children:[i.jsx("div",{className:"w-80 sm:w-96 text-center text-white font-manrope text-[16px] sm:text-[20px] font-semibold leading-[8px]",children:"Potential Bot Wallet Detected"}),i.jsx("div",{className:"w-[270px] sm:w-[398px] text-center text-white/60 text-[13px] sm:text-[16px] font-medium font-manrope leading-5",children:"The wallet you're trying to copy trade appears to be likely operated by a bot. Following bot wallets may result in significant financial losses as they often use automated strategies that may not be profitable."})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1),r()},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:()=>{e(!1),s(!0)},className:"h-8 px-2.5 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"I Understand, Continue"})})]})]})})})})})]}),Qzt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsLighterUnderstand:s})=>i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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:Ki,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"})})]})]})})})})})]}),Zzt=({checkAccountCopy:t,setIsLighterSub:e,setLighterSubError:n,setSlotCount:r,setSlotSubsCount:s,setSlotUsingCount:a,setSlotTotalCount:o,setSlotCountWallets:l})=>{const{setSignModalOpen:c,setTelegramChatId:u,setSubscriberRole:d,setSubsExpireDay:f,setMushboomerETH:x,setMushboomerSOL:g,setIsReferralCode:y,setIsReferralCodeName:v,setIsWhitelist:C,setHyperToken:N,setHyperAddress:I}=h.useContext(Yr),{address:P}=es(),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState(""),[se,ee]=h.useState(""),[K,re]=h.useState(""),[de,G]=h.useState(!1),ie=async()=>{var he,_e,xe,Se,ge,Ce;const ne=window.localStorage.getItem("hyperToken"),oe=window.localStorage.getItem("hyperAddress");if(!(!ne||!oe))try{G(!0);const je=await vi(oe.toLowerCase(),ne);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((he=je==null?void 0:je.mushboomer_counts)==null?void 0:he.eth),g((_e=je==null?void 0:je.mushboomer_counts)==null?void 0:_e.sol),y(je==null?void 0:je.referral_code),v(je==null?void 0:je.refcode),C(je==null?void 0:je.whitelist),N(ne),I(oe),re(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((xe=je==null?void 0:je.copy_trade_slots_info)==null?void 0:xe.extra_slot_count),s((Se=je==null?void 0:je.copy_trade_slots_info)==null?void 0:Se.subs_slot_count),a((ge=je==null?void 0:je.copy_trade_slots_info)==null?void 0:ge.using_slot_count),o((Ce=je==null?void 0:je.copy_trade_slots_info)==null?void 0:Ce.total_slot_count),l(je==null?void 0:je.copy_trade_slots_wallets)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),N(""),I(""),G(!1))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred."),G(!1)}},ae=async()=>new kl(window.ethereum).eth.getAccounts(oe=>oe),q=async(ne="farming",oe=24,he=5e3)=>{oe<=0||(await new Promise(_e=>setTimeout(_e,he)),await ie(),ne==="farming"&&!K?q(ne,oe-1,he):t())},W=async()=>{ee("");const ne=window.localStorage.getItem("hyperToken"),oe=window.localStorage.getItem("hyperAddress");if(!ne||!P){c(!0);return}L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(xe){console.error("Failed to switch network",xe),F(!1);return}const he=new kl(window.ethereum);var _e=await ae();if(_e.length>0?_e=_e[0]:_e=void 0,_e){const Se={from:_e,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await he.eth.sendTransaction(Se).then(ge=>{console.log("txHash :>> ",ge),F(!1),Q(ge.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:P?P.toLowerCase():oe,token:ne,payment_tx:ge.transactionHash,payment_role:"farming_tools"})}),ie(),q("farming")}).catch(ge=>{console.log(ge),ge.code===-32003||ge.message.includes("insufficient funds")?ee("Insufficient funds."):ge.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await he.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:K,errorFunds:se,activeMethod:2}),i.jsx("div",{children:i.jsx("div",{onClick:()=>{W()},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"})})]})},aue=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountTrade:r,tradeMarket:s})=>{const{address:a}=es(),{setSignModalOpen:o,setTelegramChatId:l,setSubscriberRole:c,setSubsExpireDay:u,setMushboomerETH:d,setMushboomerSOL:f,setIsReferralCode:x,setIsReferralCodeName:g,setIsWhitelist:y,setHyperToken:v,setHyperAddress:C}=h.useContext(Yr),[N,I]=h.useState(1),[P,M]=h.useState(!1),[F,$]=h.useState(!1),[L,z]=h.useState(""),[Q,se]=h.useState(""),[ee,K]=h.useState(""),re=oe=>/^\d*$/.test(oe),de=oe=>{["e","E","+","-"].includes(oe.key)&&oe.preventDefault()};h.useEffect(()=>{t||I(1)},[t]);const G=h.useRef(ee);h.useEffect(()=>{G.current=ee},[ee]);const ie=h.useMemo(()=>{if(N==="")return!1;const oe=Number(N);return Number.isInteger(oe)&&oe>=1},[N]),ae=async()=>{var _e,xe,Se;const oe=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!(!oe||!he))try{const ge=await vi(he.toLowerCase(),oe);ge!=null&&ge.success?(l(ge==null?void 0:ge.telegram_chat_id),c(ge==null?void 0:ge.subscriber_role),u(ge==null?void 0:ge.subs_expire_day),d((_e=ge==null?void 0:ge.mushboomer_counts)==null?void 0:_e.eth),f((xe=ge==null?void 0:ge.mushboomer_counts)==null?void 0:xe.sol),x(ge==null?void 0:ge.referral_code),g(ge==null?void 0:ge.refcode),y(ge==null?void 0:ge.whitelist),v(oe),C(he),K((Se=ge==null?void 0:ge.copy_trade_slots_info)==null?void 0:Se.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(ge){console.error("Token verification error:",ge),console.error(ge.message||"An unknown error occurred.")}},q=async()=>new kl(window.ethereum).eth.getAccounts(he=>he),W=async(oe="slot",he=24,_e=5e3)=>{he<=0||(await new Promise(xe=>setTimeout(xe,_e)),await ae(),oe==="slot"&&G.current<=n?W(oe,he-1,_e):r())},ne=async oe=>{se("");const he=window.localStorage.getItem("hyperToken"),_e=window.localStorage.getItem("hyperAddress");if(!he||!a){o(!0);return}$(!0),M(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(ge){console.error("Failed to switch network",ge),M(!1);return}const xe=new kl(window.ethereum);var Se=await q();if(Se.length>0?Se=Se[0]:Se=void 0,Se){const Ce=oe*.012,je=xe.utils.toWei(Ce.toString(),"ether"),Oe={from:Se,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:je};await xe.eth.sendTransaction(Oe).then($e=>{console.log("txHash :>> ",$e),M(!1),z($e.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():_e,token:he,payment_tx:$e.transactionHash,slot_role:"lighter_copy_trade",slot_qty:Number(N)})}),ae(),W("slot")}).catch($e=>{console.log($e),$e.code===-32003||$e.message.includes("insufficient funds")?se("Insufficient funds."):$e.message==="MetaMask Tx Signature: User denied transaction signature."&&$(!1)})}else await xe.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:F,setOpen:$,transactionHash:L,transactionLoading:P,paymentPresaleRole:!(ee<=n),errorFunds:Q,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:()=>I(oe=>{const he=Number(oe||0);return he>1?String(he-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:N,onChange:oe=>{const he=oe.target.value.trim();if(he==="")return I("");re(he)&&I(he)},onKeyDown:de,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(oe=>{const he=Number(oe||0);return String(he+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),N!==""&&!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:[(N*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:oe=>{oe.preventDefault(),ie&&ne(N)},className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] min-w-max font-semibold ${ie?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},Jzt=({normalizedCopyTradeList:t,selectedWmIndex:e,setSelectedWmIndex:n,getSettingList:r,setIsNewSetting:s})=>i.jsxs("div",{children:[i.jsx("span",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px]",children:"ACTIVE BOTS"}),(t==null?void 0:t.length)>0?i.jsxs("div",{className:"flex flex-col gap-2.5 p-2.5 mt-1.5 border border-white/5 rounded-xl bg-gradient-to-b from-[#1a1a1a] to-[#141414] shadow-lg",children:[i.jsxs("button",{onClick:r,className:`${e===null?"bg-[#2d4a3e] border border-[#3a6b5a] text-white shadow-[0_0_0_1px_rgba(116,70,255,0.3)]":"bg-[#181818] border border-[#7446FF40] text-white hover:bg-[#5834C320] hover:border-[#5834C370]"} px-3 py-2 rounded-lg text-left text-[12px] font-semibold transition-all duration-200 flex items-center justify-start gap-2 relative group`,children:[i.jsx("div",{className:`${e===null?"bg-[#3a6b5a] group-hover:bg-[#2d4a3e]":"bg-[#7446FF30] group-hover:bg-[#5834C350]"} flex items-center justify-center w-4 h-4 rounded transition-colors`,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`${e===null?"text-[#fff]":"text-[#7446FF]"} w-3 h-3 `,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})}),i.jsx("span",{children:"Copy with Another Wallet"}),i.jsx("span",{className:`${e===null?"text-white bg-[#3a6b5a]":"text-white bg-[#7446FF]"} ml-auto px-1.5 py-0.5 rounded text-[9px] font-bold `,children:"NEW"})]}),i.jsx("div",{className:"w-full h-px bg-white/5"}),i.jsx("div",{className:"flex flex-col gap-2 max-h-[21vh] overflow-y-scroll scrollbar-custom-scrollbar-dark",children:t==null?void 0:t.map((a,o)=>{var l,c,u,d;return i.jsxs("button",{onClick:()=>{n(o),s(!1)},className:`px-3 py-2 rounded-lg text-left text-[12px] font-medium transition-all duration-200
${e===o?"bg-[#2d4a3e] border border-[#3a6b5a] text-white shadow-[0_0_0_1px_rgba(58,107,90,0.3)]":"bg-[#181818] border border-[#2a2a2a] text-white hover:bg-[#1f1f1f] hover:border-[#353535]"} flex justify-between items-center gap-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:(a==null?void 0:a.target_platform)==="hyper"?i.jsx(i.Fragment,{children:i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"})}):i.jsx(i.Fragment,{children:i.jsx(M0,{className:"w-4 h-4 text-white"})})}),i.jsx("span",{className:`min-w-max ${e===o?"text-white":"text-[#d3d3d3]"}`,children:((l=a==null?void 0:a.wm_name)==null?void 0:l.length)>15?`${(c=a==null?void 0:a.wm_name)==null?void 0:c.slice(0,15)}...`:a==null?void 0:a.wm_name}),i.jsx("span",{className:"text-[#9b9b9b]",children:"-"}),i.jsx("span",{className:e===o?"text-white":"text-[#d3d3d3]",children:((u=a==null?void 0:a.tag)==null?void 0:u.length)>18?`${(d=a==null?void 0:a.tag)==null?void 0:d.slice(0,18)}...`:a==null?void 0:a.tag})]}),i.jsx(Us,{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:Kl,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 U5({open:t,setOpen:e,copyTradeData:n,copyTradeWallet:r,setCopyTradeWallet:s,isScalper:a,setCopyTradeData:o,sourcePage:l="default"}){var Zn,Or,Ir,ns,Ls;const{getCopyTradeWatchList:c,copyTradeWatchList:u,mushboomerETH:d,mushboomerSOL:f,trackedWatchList:x,isWhitelist:g,setTelegramChatId:y,setSubscriberRole:v,setSubsExpireDay:C,setMushboomerETH:N,setMushboomerSOL:I,setIsReferralCode:P,setIsReferralCodeName:M,setIsWhitelist:F,setHyperToken:$,setHyperAddress:L}=h.useContext(Yr),{address:z}=es(),[Q,se]=h.useState(!1),[ee,K]=h.useState(!1),[re,de]=h.useState("method_two"),[G,ie]=h.useState("All"),[ae,q]=h.useState([]),[W,ne]=h.useState(!1),[oe,he]=h.useState(null),[_e,xe]=h.useState(!1),[Se,ge]=h.useState(!1),[Ce,je]=h.useState(!1),[Oe,$e]=h.useState(!1),[Ye,Je]=h.useState(!1),[ht,rt]=h.useState(!1),[st,He]=h.useState(!1),[Ve,bt]=h.useState(!1),[xt,Qt]=h.useState(""),[St,on]=h.useState(""),[cn,Vn]=h.useState(""),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState(""),[hn,nn]=h.useState(""),[Vt,pt]=h.useState(""),[We,It]=h.useState(100),[Ge,ct]=h.useState(!0),[vt,Ht]=h.useState(!0),[Rt,mn]=h.useState(!1),[un,yn]=h.useState(!0),[_n,In]=h.useState(!0),[Sn,Yn]=h.useState(null),[Xn,zn]=h.useState(null),[Kn,jn]=h.useState(""),[De,pe]=h.useState(""),[qe,Ae]=h.useState({inputValue:"",selectValue:"%"}),[ze,zt]=h.useState({inputValue:"",selectValue:"%"}),[kt,gt]=h.useState([]),[Mt,ln]=h.useState(!0),[vn,Wn]=h.useState([]),[On,$t]=h.useState([]);h.useState(!1),h.useState(!1);const[Nn,Fn]=h.useState(!1),[Tt,pn]=h.useState(null),[ke,m]=h.useState(null),[p,S]=h.useState(null),[A,k]=h.useState(null),[T,D]=h.useState(!1),[V,X]=h.useState(!1),[le,ce]=h.useState(!1),[fe,ye]=h.useState(!1),[Pe,Me]=h.useState(!1),Ke=h.useRef(null),[we,Te]=h.useState(null),[te,ve]=h.useState(!1),Be=h.useRef(null),[Ue,Fe]=h.useState(!1),[at,ut]=h.useState(!1),[yt,Lt]=h.useState(!1),[Gt,an]=h.useState([]),[et,Pt]=h.useState([]),[qt,ft]=h.useState(!1),[tt,Bt]=h.useState(!1),[gn,tr]=h.useState(!1),[Dn,er]=h.useState(0),[Sr,dr]=h.useState(0),[kr,qn]=h.useState(0),[Tn,$n]=h.useState(0),[ir,ls]=h.useState(null),[cs,lt]=h.useState(!1),[Nt,Rn]=h.useState(!1),[ar,Tr]=h.useState([]),[Lr,$r]=h.useState(null),[cr,wr]=h.useState(!1),ss=async Ot=>{var us,as,xs,bs,zi,zs;if(!t)return;const lr=Ot||we,Qn=window.localStorage.getItem("hyperToken"),Vr=window.localStorage.getItem("hyperAddress");if(!(!Qn||!Vr))try{tr(!0);const ys=await vi(Vr.toLowerCase(),Qn);ys!=null&&ys.success?(y(ys==null?void 0:ys.telegram_chat_id),v(ys==null?void 0:ys.subscriber_role),C(ys==null?void 0:ys.subs_expire_day),N((us=ys==null?void 0:ys.mushboomer_counts)==null?void 0:us.eth),I((as=ys==null?void 0:ys.mushboomer_counts)==null?void 0:as.sol),P(ys==null?void 0:ys.referral_code),M(ys==null?void 0:ys.refcode),F(ys==null?void 0:ys.whitelist),$(Qn),L(Vr),er((xs=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:xs.extra_slot_count),dr((bs=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:bs.subs_slot_count),qn((zi=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:zi.using_slot_count),$n((zs=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:zs.total_slot_count),Tr(ys==null?void 0:ys.copy_trade_slots_wallets),ft(ys==null?void 0:ys.farming_tools),lr==="lighter"?ys!=null&&ys.farming_tools?Bt(!1):Bt(!0):Bt(!1),tr(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),$(""),L(""),tr(!1))}catch(ys){console.error("Token verification error:",ys),console.error(ys.message||"An unknown error occurred."),tr(!1)}};h.useEffect(()=>{if(t)if(qt&&Tn==0&&we==="lighter"&&Sn){const Ot=ar==null?void 0:ar.includes(Sn);Rn(!Ot)}else Rn(!1)},[Sn,we,Tn,qt,t]);const mr=h.useMemo(()=>n?Array.isArray(n)?n:[]:[],[n]);h.useEffect(()=>{if(l==="default"||!l||!mr.length)return;const Ot=mr.findIndex(lr=>(lr==null?void 0:lr.wallet_id)===l);Ot!==-1&&$r(Ot)},[l,mr]),h.useEffect(()=>{l!=="default"||!mr.length||Lr===null&&$r(0)},[mr,l]);const ts=mr[Lr]||null,Qs=h.useMemo(()=>!cr||!Sn?!1:mr.some(Ot=>(Ot==null?void 0:Ot.wallet_id)===Sn),[cr,Sn,mr,we]);function Es(Ot){return String(Ot).trim().toUpperCase()}const br=Ot=>{Ot&&(Qt(Ot==null?void 0:Ot.margin_used_rate),on(Ot==null?void 0:Ot.min_usd_per_order),Vn(Ot==null?void 0:Ot.max_usd_per_order),fn(Ot==null?void 0:Ot.max_usd_per_positions),nt(Ot==null?void 0:Ot.initial_order_max_usd),Ut(Ot==null?void 0:Ot.margin_used_amount),nn(Ot==null?void 0:Ot.increase_limit),pt(Ot==null?void 0:Ot.copy_current_percentage),It((Ot==null?void 0:Ot.scaling)==null?100:Ot==null?void 0:Ot.scaling),ie((Ot==null?void 0:Ot.position_type)===0?"All":(Ot==null?void 0:Ot.position_type)===1?"LONG":(Ot==null?void 0:Ot.position_type)===2?"SHORT":"All"),Te(Ot!=null&&Ot.target_platform?(Ot==null?void 0:Ot.target_platform)==="hyper"?"hyper":Ot==null?void 0:Ot.target_platform:"hyper"),de((Ot==null?void 0:Ot.method_type)===1?"method_one":(Ot==null?void 0:Ot.method_type)===2?"method_two":(Ot==null?void 0:Ot.method_type)===2e3?"method_twothousand":"method_two"),ct((Ot==null?void 0:Ot.copy_trait_mode)==null?!0:Ot==null?void 0:Ot.copy_trait_mode),Ht((Ot==null?void 0:Ot.open_with_increase)!==null?Ot==null?void 0:Ot.open_with_increase:!0),mn((Ot==null?void 0:Ot.included_twaps)!==null?Ot==null?void 0:Ot.included_twaps:!1),yn((Ot==null?void 0:Ot.future_listed_tokens)!==null?Ot==null?void 0:Ot.future_listed_tokens:!0),In((Ot==null?void 0:Ot.copy_current)!==null?Ot==null?void 0:Ot.copy_current:!0),Yn(Ot==null?void 0:Ot.wallet_id),zn(Ot==null?void 0:Ot.wallet_id),jn(Ot==null?void 0:Ot.tag),pe(Ot==null?void 0:Ot.comments),Ae({inputValue:Ot==null?void 0:Ot.stop_loss_amount,selectValue:(Ot==null?void 0:Ot.stop_loss_type)??"%"}),zt({inputValue:Ot==null?void 0:Ot.target_price_amount,selectValue:Ot==null?void 0:Ot.target_price_type}),Wn((Ot==null?void 0:Ot.include_coins)||[]),$t((Ot==null?void 0:Ot.exclude_coins)||[]),gs(Ot!=null&&Ot.target_platform?(Ot==null?void 0:Ot.target_platform)==="hyper"?"hyper":Ot==null?void 0:Ot.target_platform:"hyper"))};h.useEffect(()=>{ts===null&&n!==null?cr||br(Array.isArray(n)?n[0]:n):br(ts)},[ts,n]),h.useEffect(()=>{t&&n===null&&(async()=>{try{const Ot=window.localStorage.getItem("hyperToken"),lr=window.localStorage.getItem("hyperAddress");if(!Ot)return;const[Qn,Vr]=await Promise.all([fetch("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():lr,token:Ot})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():lr,token:Ot})})]),[us,as]=await Promise.all([Qn.json(),Vr.json()]),xs=us!=null&&us.success?us.data:[],bs=as!=null&&as.success?as.data:[];xs.length>0?Te("hyper"):bs.length>0?Te("lighter"):Te("hyper")}catch(Ot){console.error("Wallet auto-select error:",Ot)}})()},[t,n]);const Zt=u==null?void 0:u.some(Ot=>(Ot==null?void 0:Ot.wallet_address)===r),me=async()=>{try{const Ot=window.localStorage.getItem("hyperToken"),lr=window.localStorage.getItem("hyperAddress");if(!Ot){setSignModalOpen(!0);return}const Qn="https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",Vr={address:z?z.toLowerCase():lr,token:Ot},us=await fetch(Qn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Vr)});if(!us.ok)throw new Error(`Server responded with status ${us.status}`);const as=await us.json();if(as.success){wr(!0);const xs=as==null?void 0:as.data;br(xs),$r(null)}else console.log(as.error_message),dn.error(as.error_message)}catch(Ot){console.error("Error in like function:",Ot),dn.error(Ot.message||"Something went wrong!")}},dt=Ot=>{let lr=Ot.target.value;if(lr===""){Ae(Qn=>({...Qn,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(lr)&&Ae(Qn=>({...Qn,inputValue:lr}))},_t=Ot=>{let lr=Ot.target.value;if(lr===""){zt(Qn=>({...Qn,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(lr)&&zt(Qn=>({...Qn,inputValue:lr}))},At=Ot=>{let lr=Ot.target.value.trim();if(lr===""){Qt(null);return}/^\d*\.?\d{0,2}$/.test(lr)&&Qt(lr)},xn=Ot=>{let lr=Ot.target.value.trim();if(lr===""){on(null);return}if(/^\d*\.?\d{0,2}$/.test(lr)){on(lr);const Qn=parseFloat(lr),Vr=re==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&Qn>Number(cn)||tn!=null&&!isNaN(tn)&&tn&&Qn>Number(tn));rt(Vr);const us=re==="method_twothousand"&&cn!=null&&!isNaN(cn)&&cn&&Qn!=null&&!isNaN(Qn)&&Qn&&Qn>Number(cn);Je(us);const as=re==="method_twothousand"&&tn!=null&&!isNaN(tn)&&tn&&Qn>Number(tn);bt(as)}},Cn=Ot=>{let lr=Ot.target.value.trim();if(lr===""){Vn(null);return}if(/^\d*\.?\d{0,2}$/.test(lr)){Vn(lr);const Qn=parseFloat(lr),Vr=re==="method_twothousand"&&(Qn==null||isNaN(Qn)||!Qn||St!=null&&!isNaN(St)&&St&&Qn<Number(St)||Qn!=null&&!isNaN(Qn)&&Qn&&tn!=null&&!isNaN(tn)&&tn&&Qn>Number(tn));Je(Vr);const us=re==="method_twothousand"&&St!=null&&!isNaN(St)&&St&&Qn<Number(St);rt(us);const as=re==="method_twothousand"&&Qn!=null&&!isNaN(Qn)&&Qn&&tn!=null&&!isNaN(tn)&&tn&&Qn>Number(tn);bt(as)}},fr=Ot=>{let lr=Ot.target.value.trim();if(lr===""){nt(null);return}if(/^\d*\.?\d{0,2}$/.test(lr)){nt(lr);const Qn=parseFloat(lr),Vr=re==="method_twothousand"&&tn!=null&&!isNaN(tn)&&tn&&Qn&&Qn>Number(tn);He(Vr),bt(Vr)}},_r=Ot=>{let lr=Ot.target.value.trim();if(lr===""){fn(null);return}if(/^\d*\.?\d{0,2}$/.test(lr)){fn(lr);const Qn=parseFloat(lr),Vr=re==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&Qn<Number(cn)||St!=null&&!isNaN(St)&&St&&Qn<Number(St)||rn!=null&&!isNaN(rn)&&rn&&Qn<Number(rn));bt(Vr);const us=re==="method_twothousand"&&cn!=null&&!isNaN(cn)&&cn&&Qn!=null&&!isNaN(Qn)&&Qn&&Qn<Number(cn);Je(us);const as=re==="method_twothousand"&&St!=null&&!isNaN(St)&&St&&Qn<Number(St);rt(as);const xs=re==="method_twothousand"&&rn!=null&&!isNaN(rn)&&rn&&Qn<Number(rn);He(xs)}},pr=Ot=>{jn(Ot.target.value),je(!1)},hr=Ot=>{let lr=Ot.target.value;if(lr===""){Ut("");return}/^\d*\.?\d{0,2}$/.test(lr)&&Ut(lr),ge(!1)},Xr=Ot=>{let lr=Ot.target.value;if(lr===""){nn("");return}/^\d*\.?\d{0,2}$/.test(lr)&&nn(lr)},is=Ot=>{let lr=Ot.target.value;if(lr===""){It("");return}/^\d*\.?\d{0,2}$/.test(lr)&&It(lr)},Pr=Ot=>{["-","+","e"].includes(Ot.key)&&Ot.preventDefault()};async function yr(){try{K(!0);const Ot=Sn,lr=window.localStorage.getItem("hyperToken"),Qn="https://dextrabothypev2.nftinit.io/",Vr=window.localStorage.getItem("hyperAddress");if(!lr||!r)throw new Error("Authentication token is missing. Please log in again.");const as=await(await fetch(Qn+"api/test_app/following/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Vr,token:lr,follow_address:r.toLowerCase(),copy_trait_mode:Ge??!1,open_with_increase:vt??!1,included_twaps:Rt??!1,future_listed_tokens:un??!1,copy_current:_n??!1,margin_used_rate:xt??null,min_usd_per_order:St??null,max_usd_per_order:cn??null,max_usd_per_positions:tn??null,initial_order_max_usd:rn||null,margin_used_amount:it||null,increase_limit:hn||null,copy_current_percentage:Vt||null,scaling:We||null,method_type:re=="method_two"?2:re=="method_twothousand"?2e3:re=="method_one"?1:null,position_type:G=="All"?0:G=="LONG"?1:G=="SHORT"?2:null,tag:Kn??null,comments:De??null,stop_loss_amount:qe.inputValue?qe.inputValue:null,stop_loss_type:qe.selectValue??"%",target_price_amount:ze.inputValue?ze.inputValue:null,target_price_type:ze.selectValue??"%",wallet_id:Sn??null,include_coins:Array.isArray(vn)&&(vn==null?void 0:vn.length)>0?vn:null,exclude_coins:Array.isArray(On)&&(On==null?void 0:On.length)>0?On:null,target_platform:we??"hyper"})})).json();if(as.success){K(!1),c();const xs=Array.isArray(as.data)?as.data.filter(zs=>{var ys;return((ys=zs==null?void 0:zs.wallet_address)==null?void 0:ys.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],bs=xs==null?void 0:xs.sort((zs,ys)=>new Date(ys.created_at)-new Date(zs.created_at));o(bs);const zi=bs==null?void 0:bs.findIndex(zs=>(zs==null?void 0:zs.wallet_id)===Ot);$r(zi!==-1?zi:0),ss(we),Fn(!1),dn.success(`${(r==null?void 0:r.slice(0,5))+"..."+(r==null?void 0:r.slice(-3))} ${Zt?"Copy Trade settings saved":"Successfully added to Copy Trade"}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"440px",minWidth:"440px",whiteSpace:"nowrap"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),wr(!1)}else K(!1),dn.error(as.error_message||"Registration failed.")}catch(Ot){console.error("Error in copyTradeSave:",Ot),dn.error(Ot.message||"An unexpected error occurred."),K(!1)}}const nr=async()=>{try{se(!0);const Ot=window.localStorage.getItem("hyperToken"),lr="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/",Qn=window.localStorage.getItem("hyperAddress");if(!Ot||!r)throw new Error("Required information is missing. Please log in or connect your wallet.");const Vr=await fetch(lr,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Qn,token:Ot,follow_address:r,target_platform:we??"hyper",wallet_id:Sn??null})});if(!Vr.ok)throw new Error(`Failed to unlike: ${Vr.status} ${Vr.statusText}`);const us=await Vr.json();if(us.success){se(!1),c();const as=Array.isArray(us.data)?us.data.filter(bs=>{var zi;return((zi=bs==null?void 0:bs.wallet_address)==null?void 0:zi.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],xs=Array.isArray(as)?[...as].sort((bs,zi)=>new Date(zi.created_at)-new Date(bs.created_at)):[];o(xs),xs.length>0?$r(0):$r(null),ss(we),as&&as.length===0&&me(),dn.success(`${r.slice(0,5)+"..."+r.slice(-3)} Successfully removed from Copy Trade`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"480px",minWidth:"480px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})}else console.error(us.error_message),dn.error(us.error_message),se(!1)}catch(Ot){console.error("Error in unlike function:",Ot),dn.error(Ot.message||"Something went wrong!"),se(!1)}},gs=async Ot=>{if(!t)return;const lr=Ot||we;try{ne(!0);const Qn=window.localStorage.getItem("hyperToken"),Vr=window.localStorage.getItem("hyperAddress"),us=lr==="hyper"?"https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list":"https://dextrabothypev2.nftinit.io/api/wallet/list-lighter";if(!Qn)return;const xs=await(await fetch(us,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Vr,token:Qn})})).json();xs.success?(q(xs==null?void 0:xs.data),ne(!1)):(console.log(xs.error_message),ne(!1),he(xs.error_message))}catch(Qn){console.error("Error generate wallet list:",Qn),ne(!1),he(Qn.message)}},ei=async()=>{try{const Ot=window.localStorage.getItem("hyperToken"),lr=window.localStorage.getItem("hyperAddress");if(!Ot)return;const[Qn,Vr]=await Promise.all([fetch("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():lr,token:Ot})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():lr,token:Ot})})]),[us,as]=await Promise.all([Qn.json(),Vr.json()]);us.success&&an(us.data),as!=null&&as.success&&Pt(as.data)}catch(Ot){console.error("Error fetching wallet lists:",Ot)}},ci=Ot=>Ot!=null&&Ot.assetPositions?Ot.assetPositions.filter(lr=>{if(!lr.position||!lr.position.szi)return!1;const Qn=parseFloat(lr.position.szi);return!isNaN(Qn)&&Qn!==0}).map(lr=>{const Qn=lr.position,Vr=parseFloat(Qn.szi),us=parseFloat(Qn.entryPx),as=parseFloat(Qn.positionValue),xs=parseFloat(Qn.unrealizedPnl),bs=parseFloat(Qn.returnOnEquity)*100,zi=parseFloat(Qn.marginUsed),zs=Qn.leverage.value,ys=parseFloat(Qn.cumFunding.sinceOpen),Ss=Vr>0?"Long":"Short";return{asset:Qn.coin,type:Ss,size:Math.abs(Vr),entryPrice:us.toFixed(2),currentPrice:(as/Math.abs(Vr)).toFixed(2),leverage:zs,positionValue:as.toFixed(2),marginUsed:zi.toFixed(2),unrealizedPnl:xs.toFixed(2),roe:bs.toFixed(2),funding:ys.toFixed(4),liquidationPrice:Qn.liquidationPx?parseFloat(Qn.liquidationPx).toFixed(2):"N/A"}}):[];h.useEffect(()=>{const Ot=async()=>{const Vr=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:r});if(Vr.data){pn(Vr.data);const us=ci(Vr.data);m(us)}},lr=async()=>{var us,as,xs;const Vr=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:r});if(Vr.data){const bs=((as=(us=Vr.data.find(zs=>zs[0]==="perpMonth"))==null?void 0:us[1])==null?void 0:as.pnlHistory)||[],zi=((xs=bs[bs.length-1])==null?void 0:xs[1])??0;S(zi)}},Qn=async()=>{var as;const us=await(await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=30&order=-perp_pnl&offset=0&limit=50&user_token=${r}`)).json();k(((as=us==null?void 0:us.results[0])==null?void 0:as.win_complated_rate)||"-")};r&&(Ot(),lr(),Qn())},[r]),h.useEffect(()=>{if(!t)return;let Ot=!1;async function lr(){var Qn,Vr;try{ln(!0);const as=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),xs=()=>yi.random().hex(),bs={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},zi=(Vr=(Qn=as.coins)==null?void 0:Qn.filter(zs=>!zs.startsWith("@")&&!zs.endsWith("/USDC")))==null?void 0:Vr.map(zs=>({value:zs,label:zs.endsWith("/USDC")?zs+" (Spot)":zs,color:xs(),icon:`https://app.hyperliquid.xyz/coins/${bs[zs]||zs.split("/")[0]}.svg`}));Ot||(gt(zi),ln(!1))}catch(us){Ot||(console.error("Data retrieval error:",us),ln(!1))}}return lr(),()=>{Ot=!0}},[t]),h.useEffect(()=>{t&&(gs(we),ss(we))},[we,t]),h.useEffect(()=>{t&&ei()},[t]),h.useEffect(()=>{if(!t||!Zt||!ts||!Array.isArray(kt)||kt.length===0)return;const Ot=kt.map(xs=>typeof xs=="string"?xs:xs.value).filter(Boolean),lr=new Map(Ot.map(xs=>[Es(xs),xs])),Qn=Ot.map(Es),Vr=new Set([...(ts.include_coins||[]).map(Es),...(ts.exclude_coins||[]).map(Es)]),us=Qn.filter(xs=>!Vr.has(xs));if(us.length===0)return;const as=us.map(xs=>lr.get(xs)||xs);ts.future_listed_tokens?Wn(xs=>Array.from(new Set([...xs||[],...as]))):$t(xs=>Array.from(new Set([...xs||[],...as])))},[t,Zt,kt,ts]),h.useEffect(()=>{t||(e(!1),Qt(null),on(null),Vn(null),fn(null),nt(null),Ut(null),nn(null),pt(null),It(100),de("method_two"),Te(null),ie("All"),ct(!0),Ht(!0),mn(!1),yn(!0),In(!0),Yn(null),zn(null),jn(null),pe(null),Ae({inputValue:null,selectValue:"%"}),zt({inputValue:null,selectValue:"%"}),Wn(null),$t(null),xe(!1),ge(!1),Je(!1),rt(!1),He(!1),bt(!1),je(!1),$e(!1),ce(!1),Lt(!1),Me(!1),ve(!1),ft(!1),Bt(!1),Rn(!1),wr(!1),q([]),o(null),$r(null))},[t]),h.useEffect(()=>{const Ot=ae.find(lr=>(lr==null?void 0:lr.wallet_id)===(n==null?void 0:n.wallet_id));Ot&&Yn(Ot==null?void 0:Ot.wallet_id)},[ae,n]),h.useEffect(()=>{we==="lighter"?(We!==""&&Number(We)>100?$e(!0):$e(!1),Bt(!qt)):($e(!1),Bt(!1))},[We,we]);const Fr=Ot=>{Yn(Ot??null),xe(!1),Me(!1)},En=Ot=>{Te(Ot),ve(!1),In(!1),Ot==="lighter"&&(re=="method_twothousand"||re=="method_one")&&de("method_two"),Yn(null)},Bn=()=>{gs(we)};h.useEffect(()=>{const Ot=lr=>{Ke.current&&!Ke.current.contains(lr.target)&&Me(!1),Be.current&&!Be.current.contains(lr.target)&&ve(!1)};return document.addEventListener("mousedown",Ot),()=>{document.removeEventListener("mousedown",Ot)}},[]);const mt=[_e,Se,Ye,ht,st,Ve,Ce,tt,Nt].filter(Boolean).length;h.useEffect(()=>{t&&a&&!V&&(u!=null&&u.some(Ot=>(Ot==null?void 0:Ot.wallet_address)===r)||D(!0),X(!0)),t||X(!1)},[t,a]),h.useEffect(()=>{t&&a&&!at&&we!==null&&!T&&(u!=null&&u.some(Ot=>(Ot==null?void 0:Ot.wallet_address)===r)||we==="lighter"&&Fe(!0),ut(!0)),t||ut(!1)},[t,a,we,T]);const Kt=()=>{Fe(!1),D(!1),e(!1)},sr=[{id:1,label:"Hyperliquid",value:"hyper"},{id:2,label:"Lighter",value:"lighter"}];return i.jsxs(i.Fragment,{children:[i.jsx(H$t,{open:Nn,setOpen:Fn,copyTradeSave:yr}),i.jsx(Xzt,{open:T,setOpen:D,setCopyTradeModal:e,onClose:Kt,setIsUnderstand:ce}),i.jsx(P5,{open:fe,setOpen:ye,handleListRequest:gs,handlePageChange:()=>{}}),i.jsx(Qzt,{open:Ue,setOpen:Fe,setCopyTradeModal:e,onClose:Kt,setIsLighterUnderstand:Lt}),cs&&_a.createPortal(i.jsx(aue,{open:cs,setOpen:lt,oldSlotCount:ir,checkAccountTrade:ss,tradeMarket:"copyTrade"}),document.body),i.jsxs(Ca,{open:t,onClose:Kt,className:"relative z-50",children:[i.jsx(wa,{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(xa,{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&&!le&&T&&!(u!=null&&u.some(Ot=>(Ot==null?void 0:Ot.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:W?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx(Ba,{})}):g||d>0||f>0?(ae==null?void 0:ae.length)>0||(Gt==null?void 0:Gt.length)>0||(et==null?void 0:et.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(EOe,{})}),i.jsx("div",{style:{backgroundImage:`url(${Plt})`,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(W$e,{wallet:r,className:"w-full h-full rounded-full object-cover"})})}),i.jsxs("div",{className:"p-4 mt-6 ml-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("a",{className:"text-white font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px] cursor-pointer hover:text-white",href:`/wallet-details/${r}`,target:"_blank",rel:"noreferrer",children:r?r.slice(0,6)+"..."+r.slice(-4):"-"}),i.jsx("span",{children:i.jsx("img",{onClick:Ot=>{Ot.stopPropagation(),navigator.clipboard.writeText(r),dn.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:_o,alt:"",className:"cursor-pointer"})}),i.jsx("span",{className:"ml-auto cursor-pointer",children:i.jsx($5,{walletAddress:r,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:x.some(Ot=>Ot.wallet_address===r)?i.jsx("img",{src:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,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:["$",Tt?Er(Tt==null?void 0:Tt.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:`${Tt&&ke&&ke.reduce((Ot,lr)=>Ot+parseFloat(lr.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]`,children:["$",Tt&&ke?Er(Math.abs(ke.reduce((Ot,lr)=>Ot+parseFloat(lr.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?Er(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(V$t,{positions:ke})]}),i.jsx("div",{className:"w-full h-px bg-[#353535] mb-1"}),i.jsx("div",{className:"mt-2",children:i.jsx(Jzt,{normalizedCopyTradeList:mr,selectedWmIndex:Lr,setSelectedWmIndex:$r,getSettingList:me,setIsNewSetting:wr})})]})]})]}),i.jsxs("div",{className:"flex w-full lg:w-3/5 flex-col justify-start items-center gap-2 p-4 rounded-2xl bg-[#242424] ml-0 lg:ml-4 mt-4 lg:mt-0 relative",children:[i.jsx("div",{role:"status",className:`${ee||Q?"block":"hidden"} flex justify-center items-center w-full h-full absolute bg-[#101010]/80 z-50 -mt-[64px] rounded-3xl`,children:i.jsx(Ba,{})}),i.jsxs("div",{className:"flex-col justify-between items-center gap-4 w-full border-b border-[#353535] pb-3",children:[mt>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:Hl,alt:"Dextrabot"}),mt]}),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(Vs,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5"}),i.jsx("span",{children:i.jsx(lo,{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(u3,{})]}),i.jsxs("div",{ref:Be,className:"relative w-full max-w-[250px]",children:[i.jsxs("div",{className:`${Zt&&!cr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-8 flex items-center justify-between`,onClick:Ot=>{Ot.preventDefault(),(!Zt&&cr||Zt&&cr||!Zt&&!cr)&&ve(!te)},children:[i.jsxs("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] flex items-center gap-2",children:[we==="hyper"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(M0,{className:"w-4 h-4 text-white"}),we==="hyper"?"Hyperliquid":"Lighter"]}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${te?"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"})})]}),te&&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:sr==null?void 0:sr.map(Ot=>i.jsxs("div",{onClick:lr=>{lr.preventDefault(),(!Zt&&cr||Zt&&cr||!Zt&&!cr)&&(En(Ot.value),Ot.value==="lighter"&&!yt&&a&&Fe(!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] ${Ot.value===we?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${Zt&&!cr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsxs("span",{className:"text-white flex items-center gap-2",children:[Ot.label==="Hyperliquid"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(M0,{className:"w-4 h-4 text-white"}),Ot.label]}),Ot.value===we&&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"})})]},Ot.id))})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{onClick:()=>{Bn()},className:"hidden sm:flex lg:hidden xl:flex justify-center items-center cursor-pointer",children:i.jsx(a2e,{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:Ke,className:"relative w-full min-w-[240px] max-w-[260px]",children:[i.jsxs("div",{className:"rounded-md bg-[#353535] text-white px-2 h-8 flex items-center justify-between cursor-pointer min-w-max sm:min-w-[260px]",onClick:()=>Me(!Pe),children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:Sn?((Zn=ae==null?void 0:ae.find(Ot=>(Ot==null?void 0:Ot.wallet_id)===Sn))==null?void 0:Zn.wallet_name)==="Dextrabot"&&((Or=ae==null?void 0:ae.find(Ot=>(Ot==null?void 0:Ot.wallet_id)===Sn))==null?void 0:Or.version)===3?((Ir=ae==null?void 0:ae.find(Ot=>(Ot==null?void 0:Ot.wallet_id)===Sn))==null?void 0:Ir.wallet_name)+" (API-AGENT) Wallet":(ns=ae==null?void 0:ae.find(Ot=>(Ot==null?void 0:Ot.wallet_id)===Sn))==null?void 0:ns.wallet_name:"Select"}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${Pe?"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"})})]}),Pe&&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 Ot=we==="hyper"?"hyperliquid":"lighter";window.open(`/wallet-management#${Ot}#add-account#${Ot}`,"_blank"),Me(!1)},className:"px-3 py-2 text-[#1de674] font-semibold text-sm cursor-pointer flex justify-start items-center gap-1.5 border border-[#8860ff] rounded-md my-1 bg-[#7445ff]",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Add Account"})]}),i.jsx("div",{className:"flex flex-col gap-[2px] max-h-[170px] overflow-y-auto",children:ae&&((Ls=[...ae].sort((Ot,lr)=>{var us,as;const Qn=(us=Ot==null?void 0:Ot.wallet_name)==null?void 0:us.includes("Dextrabot"),Vr=(as=lr==null?void 0:lr.wallet_name)==null?void 0:as.includes("Dextrabot");return Qn&&!Vr?-1:!Qn&&Vr?1:0}))==null?void 0:Ls.map((Ot,lr)=>i.jsxs("div",{onClick:Qn=>{Qn.preventDefault(),(!Zt&&cr||Zt&&cr||!Zt&&!cr)&&Fr(Ot==null?void 0:Ot.wallet_id)},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] ${Zt&&!cr?"cursor-not-allowed":"cursor-pointer"} ${(Ot==null?void 0:Ot.wallet_id)===Sn?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white`,children:[i.jsx("span",{className:"text-white",children:(Ot==null?void 0:Ot.wallet_name)==="Dextrabot"&&(Ot==null?void 0:Ot.version)===3?(Ot==null?void 0:Ot.wallet_name)+" (API-AGENT) Wallet":Ot==null?void 0:Ot.wallet_name}),(Ot==null?void 0:Ot.wallet_id)===Sn&&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"})})]},(Ot==null?void 0:Ot.wallet_id)??lr)))})]}),_e&&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:()=>{Bn()},className:"flex sm:hidden lg:flex xl:hidden justify-center items-center cursor-pointer",children:i.jsx(a2e,{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:Flt,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:`${tt||we==="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:lme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})})]}),tt||we==="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:lme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})}):we==="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(N5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[kr||0,"/",Tn+kr||0]})]})]}),i.jsx("div",{onClick:()=>{ls(Dn),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:`${tt?"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:()=>{(re!=="method_two"&&re!=="method_twothousand"&&we==="hyper"||(re=="method_two"||re=="method_twothousand")&&(!Zt||Zt&&cr)&&we==="hyper")&&de("method_one")},className:`relative ${re==="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 ${(re==="method_two"||re==="method_twothousand")&&Zt&&!cr||we!=="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"}),re==="method_one"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]}),i.jsxs("div",{onClick:()=>{(re!=="method_one"&&re!=="method_two"&&we==="hyper"||(re=="method_one"||re=="method_two")&&(!Zt||Zt&&cr)&&we==="hyper")&&de("method_twothousand")},className:`relative ${re==="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] ${(re==="method_one"||re==="method_two")&&Zt&&!cr||we!=="hyper"?"cursor-not-allowed":"cursor-pointer"} rounded-tl-lg rounded-tr-lg min-w-max`,children:["Method II",re==="method_twothousand"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]}),i.jsxs("div",{onClick:()=>{(re!=="method_one"&&re!=="method_twothousand"||(re=="method_one"||re=="method_twothousand")&&(!Zt||Zt&&cr))&&de("method_two")},className:`relative ${re==="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 ${(re==="method_one"||re==="method_twothousand")&&Zt&&!cr?"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"}),re==="method_two"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]})]})}),re==="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:xt||"",onChange:At,type:"text",name:"marginUsedRate",onKeyDown:Pr,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
${xt?"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:it||"",onChange:hr,type:"text",name:"marginUsedAmount",onKeyDown:Pr,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
${Se?"border border-[#FF797C]":it?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Margin Increase Limit"}),i.jsxs("div",{className:"flex mt-2 relative w-full",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:hn||"",onChange:Xr,type:"text",name:"marginIncreaseLimit",onKeyDown:Pr,autoComplete:"off",min:"0",placeholder:"Increase Limit",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-7
${hn?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] hidden lg:block",children:"Copy Increase as Open Position"}),i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] block lg:hidden",children:"Copy Inc. as Open Pos."}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:vt?"On":"Off"}),i.jsx(Fo,{checked:vt,onChange:Ht,className:`${vt?"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:qe.inputValue||"",onChange:dt,onKeyDown:Pr,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
${qe.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:ze.inputValue||"",onChange:_t,onKeyDown:Pr,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
${ze.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(Fo,{checked:Rt,onChange:mn,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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(tg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(tg,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{content:Zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:_n?"On":"Off"}),i.jsx(Fo,{checked:_n,onChange:Ot=>{(!Zt||Zt&&cr)&&Ge&&In(Ot)},className:`${_n?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${Zt&&!cr||!Ge?"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
${_n?"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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:un?"On":"Off"}),i.jsx(Fo,{checked:un,onChange:yn,className:`${un?"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(Vq,{dataCoin:kt,coinInclude:vn,coinExclude:On,setCoinInclude:Wn,setCoinExclude:$t,isLoadingCoin:Mt})})})}),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:Kn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${Ce?"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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:Ge?"On":"Off"}),i.jsx(Fo,{checked:Ge,onChange:Ot=>{ct(Ot),Ot||In(!1)},className:`${Ge?"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`})})]})]})]})]}),re==="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:`${Ve?"-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:`${Ve?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Hl,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{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:`${Ve?"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:tn||"",onChange:_r,type:"text",name:"maxUsdPerpPositions",onKeyDown:Pr,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
${Ve?"border border-[#FF797C] focus:outline-none focus:ring-0":tn?"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:`${st?"-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:`${st?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Hl,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{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:`${st?"":"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:rn||"",onChange:fr,type:"text",name:"initialOrderMaxUsd",onKeyDown:Pr,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
${st?"border border-[#FF797C] focus:outline-none focus:ring-0":rn?"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:`${ht?"-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:`${ht?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Hl,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{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:`${ht?"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:St||"",onChange:xn,type:"text",name:"minUsdPerOrder",onKeyDown:Pr,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
${ht?"border border-[#FF797C] focus:outline-none focus:ring-0":St?"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:`${Ye&&(tn||St)?"-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:`${Ye&&(tn||St)?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:Hl,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{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:`${Ye&&(tn||St)?"":"mt-1"} flex w-full relative`,children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:cn||"",onChange:Cn,type:"text",name:"maxUsdPerOrder",onKeyDown:Pr,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
${Ye?"border border-[#FF797C] focus:outline-none focus:ring-0":cn?"border border-[#C5C5C5] focus:outline-none focus:ring-0":"outline-[#404040]"}
placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Copy Current"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{content:Zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:_n?"On":"Off"}),i.jsx(Fo,{checked:_n,onChange:Ot=>{(!Zt||Zt&&cr)&&Ge&&In(Ot)},className:`${_n?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${Zt&&!cr||!Ge?"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
${_n?"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:vt?"On":"Off"}),i.jsx(Fo,{checked:vt,onChange:Ht,className:`${vt?"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:qe.inputValue||"",onChange:dt,onKeyDown:Pr,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
${qe.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:ze.inputValue||"",onChange:_t,onKeyDown:Pr,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
${ze.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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(tg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(tg,{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(Fo,{checked:Rt,onChange:mn,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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:un?"On":"Off"}),i.jsx(Fo,{checked:un,onChange:yn,className:`${un?"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(Vq,{dataCoin:kt,coinInclude:vn,coinExclude:On,setCoinInclude:Wn,setCoinExclude:$t,isLoadingCoin:Mt})})})}),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:Kn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${Ce?"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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:Ge?"On":"Off"}),i.jsx(Fo,{checked:Ge,onChange:Ot=>{ct(Ot),Ot||In(!1)},className:`${Ge?"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`})})]})]})]})]}),re==="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:is,type:"text",name:"scalingPercentage",onKeyDown:Pr,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?Oe?"border border-[#D97706]":"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`}),Oe&&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(gN,{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:vt?"On":"Off"}),i.jsx(Fo,{checked:vt,onChange:Ht,className:`${vt?"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:qe.inputValue||"",onChange:dt,onKeyDown:Pr,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
${qe.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:ze.inputValue||"",onChange:_t,onKeyDown:Pr,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
${ze.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(Fo,{checked:Rt,onChange:mn,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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>ie("All"),isPositionType:G}),i.jsx(tg,{title:"LONG",set_click:()=>ie("LONG"),isPositionType:G}),i.jsx(tg,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(lo,{content:we==="lighter"?"Coming Soon":Zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:`${we==="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:_n?"On":"Off"}),i.jsx(Fo,{checked:_n,onChange:Ot=>{(!Zt||Zt&&cr)&&Ge&&we==="hyper"&&In(Ot)},className:`${_n?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${Zt&&!cr||!Ge||we==="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
${_n?"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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:un?"On":"Off"}),i.jsx(Fo,{checked:un,onChange:yn,className:`${un?"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(Vq,{dataCoin:kt,coinInclude:vn,coinExclude:On,setCoinInclude:Wn,setCoinExclude:$t,isLoadingCoin:Mt})})})}),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:Kn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${Ce?"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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(lo,{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:Ge?"On":"Off"}),i.jsx(Fo,{checked:Ge,onChange:Ot=>{ct(Ot),Ot||In(!1)},className:`${Ge?"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`})})]})]})]}),we==="lighter"?tt?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."}):Nt?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."}):Qs?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."}):Qs&&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:[mt>0&&!tt&&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:Hl,alt:"Dextrabot"}),mt]}),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:Ot=>{Sn!=null&&!isNaN(Sn)&&(re!=="method_one"||it!=null&&!isNaN(it)&&it)&&(re!=="method_twothousand"||cn!=null&&!isNaN(cn)&&cn&&(!(tn!=null&&!isNaN(tn)&&tn)||Number(tn)>=Number(cn)&&(!(St!=null&&!isNaN(St)&&St)||Number(tn)>=Number(St))&&(!(rn!=null&&!isNaN(rn)&&rn)||Number(tn)>=Number(rn)))&&(!(St!=null&&!isNaN(St)&&St)||Number(cn)>=Number(St)))&&Kn&&(we!=="lighter"||qt)&&(we!=="lighter"||!Nt)?!qe.inputValue||!ze.inputValue?Fn(!0):yr():(xe(Sn==null||isNaN(Sn)),ge(re==="method_one"&&(it==null||isNaN(it)||!it)),Je(re==="method_twothousand"&&(cn==null||isNaN(cn)||!cn||cn!=null&&!isNaN(cn)&&cn&&St!=null&&!isNaN(St)&&St&&Number(St)>Number(cn)||cn!=null&&!isNaN(cn)&&cn&&tn!=null&&!isNaN(tn)&&tn&&Number(cn)>Number(tn))),rt(re==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&St!=null&&!isNaN(St)&&St&&Number(St)>Number(cn)||tn!=null&&!isNaN(tn)&&tn&&St!=null&&!isNaN(St)&&St&&Number(St)>Number(tn))),He(re==="method_twothousand"&&tn!=null&&!isNaN(tn)&&tn&&rn!=null&&!isNaN(rn)&&rn&&Number(rn)>Number(tn)),bt(re==="method_twothousand"&&tn!=null&&!isNaN(tn)&&tn&&(cn!=null&&!isNaN(cn)&&cn&&Number(cn)>Number(tn)||St!=null&&!isNaN(St)&&St&&Number(St)>Number(tn)||rn!=null&&!isNaN(rn)&&rn&&Number(rn)>Number(tn))),je(!Kn||Kn===""),$e(we==="lighter"&&We&&We>100),Bt(we==="lighter"&&!qt))},type:"button",className:`${re==="method_one"||we==="lighter"&&tt||we==="lighter"&&Nt||Qs?"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"}),mt>0&&we==="lighter"&&tt&&i.jsx(Zzt,{checkAccountCopy:ss,setIsLighterSub:ft,setLighterSubError:Bt,setSlotCount:er,setSlotSubsCount:dr,setSlotUsingCount:qn,setSlotTotalCount:$n,setSlotCountWallets:Tr}),mt>0&&!tt&&Nt&&we==="lighter"&&i.jsx("div",{onClick:()=>{ls(Dn),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:Ot=>{Ot.preventDefault(),u!=null&&u.some(lr=>lr.wallet_address===r)&&nr()},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(Ot=>Ot.wallet_address===r)&&!cr?"":"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:Ki,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:Ki,alt:"",className:"w-[86px h-[86px]"})}),i.jsx("span",{className:"text-center mb-5 font-bold mt-10 text-[21px]",children:"Closed Beta Has Started! 🚀"}),i.jsx("span",{className:"text-center mb-5 font-medium px-10 -mt-6",children:"Follow our Discord to stay updated and be ready for the full launch!"}),i.jsx("span",{className:"text-center mb-5 font-medium px-10 -mt-6",children:"Early access requirements:"}),i.jsx("div",{onClick:()=>{window.open("https://www.tensor.trade/trade/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Sol"})}),i.jsx("div",{onClick:()=>{window.open("https://blur.io/collection/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Eth"})}),i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Join Our Discord"})})]})})})})})})]})]})}const tg=({title:t,set_click:e,isPositionType:n})=>i.jsx("div",{onClick:e,className:`${n==t?n=="LONG"?"bg-[#67ffbd]/20 text-[#67FFBD]":n=="SHORT"?"bg-[#ff797c]/20 text-[#FF797C]":(n=="All","bg-[#3d3d3d] text-white"):"bg-transparent text-[#9b9b9b]"} text-[13px] font-medium font-manrope leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-[22px]`,children:t});function q$e(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=q$e(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ca(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=q$e(t))&&(r&&(r+=" "),r+=e);return r}var qq,G2e;function Cf(){if(G2e)return qq;G2e=1;var t=Array.isArray;return qq=t,qq}var Gq,K2e;function G$e(){if(K2e)return Gq;K2e=1;var t=typeof Ru=="object"&&Ru&&Ru.Object===Object&&Ru;return Gq=t,Gq}var Kq,Y2e;function Cx(){if(Y2e)return Kq;Y2e=1;var t=G$e(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return Kq=n,Kq}var Yq,X2e;function XT(){if(X2e)return Yq;X2e=1;var t=Cx(),e=t.Symbol;return Yq=e,Yq}var Xq,Q2e;function eHt(){if(Q2e)return Xq;Q2e=1;var t=XT(),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 Xq=a,Xq}var Qq,Z2e;function tHt(){if(Z2e)return Qq;Z2e=1;var t=Object.prototype,e=t.toString;function n(r){return e.call(r)}return Qq=n,Qq}var Zq,J2e;function U1(){if(J2e)return Zq;J2e=1;var t=XT(),e=eHt(),n=tHt(),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 Zq=o,Zq}var Jq,eve;function z1(){if(eve)return Jq;eve=1;function t(e){return e!=null&&typeof e=="object"}return Jq=t,Jq}var eG,tve;function S8(){if(tve)return eG;tve=1;var t=U1(),e=z1(),n="[object Symbol]";function r(s){return typeof s=="symbol"||e(s)&&t(s)==n}return eG=r,eG}var tG,nve;function oue(){if(nve)return tG;nve=1;var t=Cf(),e=S8(),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 tG=s,tG}var nG,rve;function F2(){if(rve)return nG;rve=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return nG=t,nG}var rG,sve;function lue(){if(sve)return rG;sve=1;var t=U1(),e=F2(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",a="[object Proxy]";function o(l){if(!e(l))return!1;var c=t(l);return c==r||c==s||c==n||c==a}return rG=o,rG}var sG,ive;function nHt(){if(ive)return sG;ive=1;var t=Cx(),e=t["__core-js_shared__"];return sG=e,sG}var iG,ave;function rHt(){if(ave)return iG;ave=1;var t=nHt(),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 iG=n,iG}var aG,ove;function K$e(){if(ove)return aG;ove=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 aG=n,aG}var oG,lve;function sHt(){if(lve)return oG;lve=1;var t=lue(),e=rHt(),n=F2(),r=K$e(),s=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,l=Object.prototype,c=o.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(x){if(!n(x)||e(x))return!1;var g=t(x)?d:a;return g.test(r(x))}return oG=f,oG}var lG,cve;function iHt(){if(cve)return lG;cve=1;function t(e,n){return e==null?void 0:e[n]}return lG=t,lG}var cG,uve;function z5(){if(uve)return cG;uve=1;var t=sHt(),e=iHt();function n(r,s){var a=e(r,s);return t(a)?a:void 0}return cG=n,cG}var uG,dve;function FU(){if(dve)return uG;dve=1;var t=z5(),e=t(Object,"create");return uG=e,uG}var dG,fve;function aHt(){if(fve)return dG;fve=1;var t=FU();function e(){this.__data__=t?t(null):{},this.size=0}return dG=e,dG}var fG,hve;function oHt(){if(hve)return fG;hve=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return fG=t,fG}var hG,pve;function lHt(){if(pve)return hG;pve=1;var t=FU(),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 hG=s,hG}var pG,mve;function cHt(){if(mve)return pG;mve=1;var t=FU(),e=Object.prototype,n=e.hasOwnProperty;function r(s){var a=this.__data__;return t?a[s]!==void 0:n.call(a,s)}return pG=r,pG}var mG,xve;function uHt(){if(xve)return mG;xve=1;var t=FU(),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 mG=n,mG}var xG,gve;function dHt(){if(gve)return xG;gve=1;var t=aHt(),e=oHt(),n=lHt(),r=cHt(),s=uHt();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,xG=a,xG}var gG,bve;function fHt(){if(bve)return gG;bve=1;function t(){this.__data__=[],this.size=0}return gG=t,gG}var bG,yve;function cue(){if(yve)return bG;yve=1;function t(e,n){return e===n||e!==e&&n!==n}return bG=t,bG}var yG,vve;function OU(){if(vve)return yG;vve=1;var t=cue();function e(n,r){for(var s=n.length;s--;)if(t(n[s][0],r))return s;return-1}return yG=e,yG}var vG,wve;function hHt(){if(wve)return vG;wve=1;var t=OU(),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 vG=r,vG}var wG,Cve;function pHt(){if(Cve)return wG;Cve=1;var t=OU();function e(n){var r=this.__data__,s=t(r,n);return s<0?void 0:r[s][1]}return wG=e,wG}var CG,Sve;function mHt(){if(Sve)return CG;Sve=1;var t=OU();function e(n){return t(this.__data__,n)>-1}return CG=e,CG}var SG,Nve;function xHt(){if(Nve)return SG;Nve=1;var t=OU();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 SG=e,SG}var NG,jve;function MU(){if(jve)return NG;jve=1;var t=fHt(),e=hHt(),n=pHt(),r=mHt(),s=xHt();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,NG=a,NG}var jG,Ave;function uue(){if(Ave)return jG;Ave=1;var t=z5(),e=Cx(),n=t(e,"Map");return jG=n,jG}var AG,_ve;function gHt(){if(_ve)return AG;_ve=1;var t=dHt(),e=MU(),n=uue();function r(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return AG=r,AG}var _G,Eve;function bHt(){if(Eve)return _G;Eve=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return _G=t,_G}var EG,kve;function RU(){if(kve)return EG;kve=1;var t=bHt();function e(n,r){var s=n.__data__;return t(r)?s[typeof r=="string"?"string":"hash"]:s.map}return EG=e,EG}var kG,Tve;function yHt(){if(Tve)return kG;Tve=1;var t=RU();function e(n){var r=t(this,n).delete(n);return this.size-=r?1:0,r}return kG=e,kG}var TG,Ive;function vHt(){if(Ive)return TG;Ive=1;var t=RU();function e(n){return t(this,n).get(n)}return TG=e,TG}var IG,Pve;function wHt(){if(Pve)return IG;Pve=1;var t=RU();function e(n){return t(this,n).has(n)}return IG=e,IG}var PG,Fve;function CHt(){if(Fve)return PG;Fve=1;var t=RU();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 PG=e,PG}var FG,Ove;function due(){if(Ove)return FG;Ove=1;var t=gHt(),e=yHt(),n=vHt(),r=wHt(),s=CHt();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,FG=a,FG}var OG,Mve;function Y$e(){if(Mve)return OG;Mve=1;var t=due(),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,OG=n,OG}var MG,Rve;function SHt(){if(Rve)return MG;Rve=1;var t=Y$e(),e=500;function n(r){var s=t(r,function(o){return a.size===e&&a.clear(),o}),a=s.cache;return s}return MG=n,MG}var RG,Lve;function NHt(){if(Lve)return RG;Lve=1;var t=SHt(),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 RG=r,RG}var LG,Dve;function fue(){if(Dve)return LG;Dve=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 LG=t,LG}var DG,Bve;function jHt(){if(Bve)return DG;Bve=1;var t=XT(),e=fue(),n=Cf(),r=S8(),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 DG=o,DG}var BG,$ve;function X$e(){if($ve)return BG;$ve=1;var t=jHt();function e(n){return n==null?"":t(n)}return BG=e,BG}var $G,Uve;function Q$e(){if(Uve)return $G;Uve=1;var t=Cf(),e=oue(),n=NHt(),r=X$e();function s(a,o){return t(a)?a:e(a,o)?[a]:n(r(a))}return $G=s,$G}var UG,zve;function LU(){if(zve)return UG;zve=1;var t=S8();function e(n){if(typeof n=="string"||t(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return UG=e,UG}var zG,Hve;function hue(){if(Hve)return zG;Hve=1;var t=Q$e(),e=LU();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 zG=n,zG}var HG,Vve;function Z$e(){if(Vve)return HG;Vve=1;var t=hue();function e(n,r,s){var a=n==null?void 0:t(n,r);return a===void 0?s:a}return HG=e,HG}var AHt=Z$e();const dp=Ti(AHt);var VG,Wve;function _Ht(){if(Wve)return VG;Wve=1;function t(e){return e==null}return VG=t,VG}var EHt=_Ht();const ji=Ti(EHt);var WG,qve;function kHt(){if(qve)return WG;qve=1;var t=U1(),e=Cf(),n=z1(),r="[object String]";function s(a){return typeof a=="string"||!e(a)&&n(a)&&t(a)==r}return WG=s,WG}var THt=kHt();const u5=Ti(THt);var IHt=lue();const Ei=Ti(IHt);var PHt=F2();const N8=Ti(PHt);var qG={exports:{}},Fa={};/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Gve;function FHt(){if(Gve)return Fa;Gve=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function v(C){if(typeof C=="object"&&C!==null){var N=C.$$typeof;switch(N){case t:switch(C=C.type,C){case n:case s:case r:case u:case d:return C;default:switch(C=C&&C.$$typeof,C){case l:case o:case c:case x:case f:case a:return C;default:return N}}case e:return N}}}return Fa.ContextConsumer=o,Fa.ContextProvider=a,Fa.Element=t,Fa.ForwardRef=c,Fa.Fragment=n,Fa.Lazy=x,Fa.Memo=f,Fa.Portal=e,Fa.Profiler=s,Fa.StrictMode=r,Fa.Suspense=u,Fa.SuspenseList=d,Fa.isAsyncMode=function(){return!1},Fa.isConcurrentMode=function(){return!1},Fa.isContextConsumer=function(C){return v(C)===o},Fa.isContextProvider=function(C){return v(C)===a},Fa.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},Fa.isForwardRef=function(C){return v(C)===c},Fa.isFragment=function(C){return v(C)===n},Fa.isLazy=function(C){return v(C)===x},Fa.isMemo=function(C){return v(C)===f},Fa.isPortal=function(C){return v(C)===e},Fa.isProfiler=function(C){return v(C)===s},Fa.isStrictMode=function(C){return v(C)===r},Fa.isSuspense=function(C){return v(C)===u},Fa.isSuspenseList=function(C){return v(C)===d},Fa.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===n||C===s||C===r||C===u||C===d||C===g||typeof C=="object"&&C!==null&&(C.$$typeof===x||C.$$typeof===f||C.$$typeof===a||C.$$typeof===o||C.$$typeof===c||C.$$typeof===y||C.getModuleId!==void 0)},Fa.typeOf=v,Fa}var Kve;function OHt(){return Kve||(Kve=1,qG.exports=FHt()),qG.exports}var MHt=OHt(),GG,Yve;function J$e(){if(Yve)return GG;Yve=1;var t=U1(),e=z1(),n="[object Number]";function r(s){return typeof s=="number"||e(s)&&t(s)==n}return GG=r,GG}var KG,Xve;function RHt(){if(Xve)return KG;Xve=1;var t=J$e();function e(n){return t(n)&&n!=+n}return KG=e,KG}var LHt=RHt();const j8=Ti(LHt);var DHt=J$e();const BHt=Ti(DHt);var gm=function(e){return e===0?0:e>0?1:-1},Cw=function(e){return u5(e)&&e.indexOf("%")===e.length-1},rs=function(e){return BHt(e)&&!j8(e)},lc=function(e){return rs(e)||u5(e)},$Ht=0,H5=function(e){var n=++$Ht;return"".concat(e||"").concat(n)},d5=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!rs(e)&&!u5(e))return r;var a;if(Cw(e)){var o=e.indexOf("%");a=n*parseFloat(e.slice(0,o))/100}else a=+e;return j8(a)&&(a=r),s&&a>n&&(a=n),a},Kb=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},UHt=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},s=0;s<n;s++)if(!r[e[s]])r[e[s]]=!0;else return!0;return!1},Al=function(e,n){return rs(e)&&rs(n)?function(r){return e+r*(n-e)}:function(){return n}};function zL(t,e,n){return!t||!t.length?null:t.find(function(r){return r&&(typeof e=="function"?e(r):dp(r,e))===n})}var zHt=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}},HHt=function(e,n){return rs(e)&&rs(n)?e-n:u5(e)&&u5(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function L4(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 kne(t){"@babel/helpers - typeof";return kne=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},kne(t)}var VHt=["viewBox","children"],WHt=["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"],Qve=["points","pathLength"],YG={svg:VHt,polygon:Qve,polyline:Qve},pue=["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"],HL=function(e,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),!N8(r))return null;var s={};return Object.keys(r).forEach(function(a){pue.includes(a)&&(s[a]=n||function(o){return r[a](r,o)})}),s},qHt=function(e,n,r){return function(s){return e(n,r,s),null}},zE=function(e,n,r){if(!N8(e)||kne(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(a){var o=e[a];pue.includes(a)&&typeof o=="function"&&(s||(s={}),s[a]=qHt(o,n,r))}),s},GHt=["children"],KHt=["children"];function Zve(t,e){if(t==null)return{};var n=YHt(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 YHt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Tne(t){"@babel/helpers - typeof";return Tne=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},Tne(t)}var Jve={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},o1=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},ewe=null,XG=null,mue=function t(e){if(e===ewe&&Array.isArray(XG))return XG;var n=[];return h.Children.forEach(e,function(r){ji(r)||(MHt.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),XG=n,ewe=e,n};function pf(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(s){return o1(s)}):r=[o1(e)],mue(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 twe=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,s=n.height;return!(!rs(r)||r<=0||!rs(s)||s<=0)},XHt=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],QHt=function(e){return e&&e.type&&u5(e.type)&&XHt.indexOf(e.type)>=0},eUe=function(e){return e&&Tne(e)==="object"&&"clipDot"in e},ZHt=function(e,n,r,s){var a,o=(a=YG==null?void 0:YG[s])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Ei(e)&&(s&&o.includes(n)||WHt.includes(n))||r&&pue.includes(n)},Ni=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(h.isValidElement(e)&&(s=e.props),!N8(s))return null;var a={};return Object.keys(s).forEach(function(o){var l;ZHt((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(a[o]=s[o])}),a},Ine=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 nwe(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(!nwe(a,o))return!1}return!0},nwe=function(e,n){if(ji(e)&&ji(n))return!0;if(!ji(e)&&!ji(n)){var r=e.props||{},s=r.children,a=Zve(r,GHt),o=n.props||{},l=o.children,c=Zve(o,KHt);return s&&l?L4(a,c)&&Ine(s,l):!s&&!l?L4(a,c):!1}return!1},rwe=function(e,n){var r=[],s={};return mue(e).forEach(function(a,o){if(QHt(a))r.push(a);else if(a){var l=o1(a.type),c=n[l]||{},u=c.handler,d=c.once;if(u&&(!d||!s[l])){var f=u(a,l,o);r.push(f),s[l]=!0}}}),r},JHt=function(e){var n=e&&e.type;return n&&Jve[n]?Jve[n]:null},eVt=function(e,n){return mue(n).indexOf(e)},tVt=["children","width","height","viewBox","className","style","title","desc"];function Pne(){return Pne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pne.apply(this,arguments)}function nVt(t,e){if(t==null)return{};var n=rVt(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 rVt(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 Fne(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=nVt(t,tVt),d=s||{width:n,height:r,x:0,y:0},f=ca("recharts-surface",a);return Ie.createElement("svg",Pne({},Ni(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),Ie.createElement("title",null,l),Ie.createElement("desc",null,c),e)}var sVt=["children","className"];function One(){return One=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},One.apply(this,arguments)}function iVt(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 Aa=Ie.forwardRef(function(t,e){var n=t.children,r=t.className,s=iVt(t,sVt),a=ca("recharts-layer",r);return Ie.createElement("g",One({className:a},Ni(s,!0),{ref:e}),n)}),l1=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),a=2;a<r;a++)s[a-2]=arguments[a]},QG,swe;function oVt(){if(swe)return QG;swe=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 QG=t,QG}var ZG,iwe;function lVt(){if(iwe)return ZG;iwe=1;var t=oVt();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 ZG=e,ZG}var JG,awe;function tUe(){if(awe)return JG;awe=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 JG=c,JG}var eK,owe;function cVt(){if(owe)return eK;owe=1;function t(e){return e.split("")}return eK=t,eK}var tK,lwe;function uVt(){if(lwe)return tK;lwe=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=e+n+r,a="\\ufe0e\\ufe0f",o="["+t+"]",l="["+s+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",y=u+"?",v="["+a+"]?",C="(?:"+g+"(?:"+[d,f,x].join("|")+")"+v+y+")*",N=v+y+C,I="(?:"+[d+l+"?",l,f,x,o].join("|")+")",P=RegExp(c+"(?="+c+")|"+I+N,"g");function M(F){return F.match(P)||[]}return tK=M,tK}var nK,cwe;function dVt(){if(cwe)return nK;cwe=1;var t=cVt(),e=tUe(),n=uVt();function r(s){return e(s)?n(s):t(s)}return nK=r,nK}var rK,uwe;function fVt(){if(uwe)return rK;uwe=1;var t=lVt(),e=tUe(),n=dVt(),r=X$e();function s(a){return function(o){o=r(o);var l=e(o)?n(o):void 0,c=l?l[0]:o.charAt(0),u=l?t(l,1).join(""):o.slice(1);return c[a]()+u}}return rK=s,rK}var sK,dwe;function hVt(){if(dwe)return sK;dwe=1;var t=fVt(),e=t("toUpperCase");return sK=e,sK}var pVt=hVt();const DU=Ti(pVt);function uo(t){return function(){return t}}const nUe=Math.cos,VL=Math.sin,Rm=Math.sqrt,WL=Math.PI,BU=2*WL,Mne=Math.PI,Rne=2*Mne,Kv=1e-6,mVt=Rne-Kv;function rUe(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function xVt(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return rUe;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 gVt{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?rUe:xVt(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,s){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(e,n,r,s,a,o){this._append`C${+e},${+n},${+r},${+s},${this._x1=+a},${this._y1=+o}`}arcTo(e,n,r,s,a){if(e=+e,n=+n,r=+r,s=+s,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,l=this._y1,c=r-e,u=s-n,d=o-e,f=l-n,x=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(x>Kv)if(!(Math.abs(f*c-u*d)>Kv)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let g=r-o,y=s-l,v=c*c+u*u,C=g*g+y*y,N=Math.sqrt(v),I=Math.sqrt(x),P=a*Math.tan((Mne-Math.acos((v+x-C)/(2*N*I)))/2),M=P/I,F=P/N;Math.abs(M-1)>Kv&&this._append`L${e+M*d},${n+M*f}`,this._append`A${a},${a},0,0,${+(f*g>d*y)},${this._x1=e+F*c},${this._y1=n+F*u}`}}arc(e,n,r,s,a,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=e+l,d=n+c,f=1^o,x=o?s-a:a-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Kv||Math.abs(this._y1-d)>Kv)&&this._append`L${u},${d}`,r&&(x<0&&(x=x%Rne+Rne),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>Kv&&this._append`A${r},${r},0,${+(x>=Mne)},${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 xue(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 gVt(e)}function gue(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function sUe(t){this._context=t}sUe.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 $U(t){return new sUe(t)}function iUe(t){return t[0]}function aUe(t){return t[1]}function oUe(t,e){var n=uo(!0),r=null,s=$U,a=null,o=xue(l);t=typeof t=="function"?t:t===void 0?iUe:uo(t),e=typeof e=="function"?e:e===void 0?aUe:uo(e);function l(c){var u,d=(c=gue(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:uo(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:uo(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:uo(!!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 hF(t,e,n){var r=null,s=uo(!0),a=null,o=$U,l=null,c=xue(u);t=typeof t=="function"?t:t===void 0?iUe:uo(+t),e=typeof e=="function"?e:uo(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?aUe:uo(+n);function u(f){var x,g,y,v=(f=gue(f)).length,C,N=!1,I,P=new Array(v),M=new Array(v);for(a==null&&(l=o(I=c())),x=0;x<=v;++x){if(!(x<v&&s(C=f[x],x,f))===N)if(N=!N)g=x,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=x-1;y>=g;--y)l.point(P[y],M[y]);l.lineEnd(),l.areaEnd()}N&&(P[x]=+t(C,x,f),M[x]=+e(C,x,f),l.point(r?+r(C,x,f):P[x],n?+n(C,x,f):M[x]))}if(I)return l=null,I+""||null}function d(){return oUe().defined(s).curve(o).context(a)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:uo(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:uo(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:uo(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:uo(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:uo(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:uo(+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:uo(!!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 lUe{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 bVt(t){return new lUe(t,!0)}function yVt(t){return new lUe(t,!1)}const bue={draw(t,e){const n=Rm(e/WL);t.moveTo(n,0),t.arc(0,0,n,0,BU)}},vVt={draw(t,e){const n=Rm(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},cUe=Rm(1/3),wVt=cUe*2,CVt={draw(t,e){const n=Rm(e/wVt),r=n*cUe;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},SVt={draw(t,e){const n=Rm(e),r=-n/2;t.rect(r,r,n,n)}},NVt=.8908130915292852,uUe=VL(WL/10)/VL(7*WL/10),jVt=VL(BU/10)*uUe,AVt=-nUe(BU/10)*uUe,_Vt={draw(t,e){const n=Rm(e*NVt),r=jVt*n,s=AVt*n;t.moveTo(0,-n),t.lineTo(r,s);for(let a=1;a<5;++a){const o=BU*a/5,l=nUe(o),c=VL(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*s,c*r+l*s)}t.closePath()}},iK=Rm(3),EVt={draw(t,e){const n=-Rm(e/(iK*3));t.moveTo(0,n*2),t.lineTo(-iK*n,-n),t.lineTo(iK*n,-n),t.closePath()}},Ih=-.5,Ph=Rm(3)/2,Lne=1/Rm(12),kVt=(Lne/2+1)*3,TVt={draw(t,e){const n=Rm(e/kVt),r=n/2,s=n*Lne,a=r,o=n*Lne+n,l=-a,c=o;t.moveTo(r,s),t.lineTo(a,o),t.lineTo(l,c),t.lineTo(Ih*r-Ph*s,Ph*r+Ih*s),t.lineTo(Ih*a-Ph*o,Ph*a+Ih*o),t.lineTo(Ih*l-Ph*c,Ph*l+Ih*c),t.lineTo(Ih*r+Ph*s,Ih*s-Ph*r),t.lineTo(Ih*a+Ph*o,Ih*o-Ph*a),t.lineTo(Ih*l+Ph*c,Ih*c-Ph*l),t.closePath()}};function IVt(t,e){let n=null,r=xue(s);t=typeof t=="function"?t:uo(t||bue),e=typeof e=="function"?e:uo(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:uo(a),s):t},s.size=function(a){return arguments.length?(e=typeof a=="function"?a:uo(+a),s):e},s.context=function(a){return arguments.length?(n=a??null,s):n},s}function qL(){}function GL(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 dUe(t){this._context=t}dUe.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:GL(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:GL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PVt(t){return new dUe(t)}function fUe(t){this._context=t}fUe.prototype={areaStart:qL,areaEnd:qL,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:GL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function FVt(t){return new fUe(t)}function hUe(t){this._context=t}hUe.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:GL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function OVt(t){return new hUe(t)}function pUe(t){this._context=t}pUe.prototype={areaStart:qL,areaEnd:qL,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 MVt(t){return new pUe(t)}function fwe(t){return t<0?-1:1}function hwe(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(fwe(a)+fwe(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function pwe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function aK(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 KL(t){this._context=t}KL.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:aK(this,this._t0,pwe(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,aK(this,pwe(this,n=hwe(this,t,e)),n);break;default:aK(this,this._t0,n=hwe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function mUe(t){this._context=new xUe(t)}(mUe.prototype=Object.create(KL.prototype)).point=function(t,e){KL.prototype.point.call(this,e,t)};function xUe(t){this._context=t}xUe.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 RVt(t){return new KL(t)}function LVt(t){return new mUe(t)}function gUe(t){this._context=t}gUe.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=mwe(t),s=mwe(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 mwe(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 DVt(t){return new gUe(t)}function UU(t,e){this._context=t,this._t=e}UU.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 BVt(t){return new UU(t,.5)}function $Vt(t){return new UU(t,0)}function UVt(t){return new UU(t,1)}function qN(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 Dne(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function zVt(t,e){return t[e]}function HVt(t){const e=[];return e.key=t,e}function VVt(){var t=uo([]),e=Dne,n=qN,r=zVt;function s(a){var o=Array.from(t.apply(this,arguments),HVt),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=gue(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:uo(Array.from(a)),s):t},s.value=function(a){return arguments.length?(r=typeof a=="function"?a:uo(+a),s):r},s.order=function(a){return arguments.length?(e=a==null?Dne:typeof a=="function"?a:uo(Array.from(a)),s):e},s.offset=function(a){return arguments.length?(n=a??qN,s):n},s}function WVt(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}qN(t,e)}}function qVt(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}qN(t,e)}}function GVt(t,e){if(!(!((o=t.length)>0)||!((a=(s=t[e[0]]).length)>0))){for(var n=0,r=1,s,a,o;r<a;++r){for(var l=0,c=0,u=0;l<o;++l){for(var d=t[e[l]],f=d[r][1]||0,x=d[r-1][1]||0,g=(f-x)/2,y=0;y<l;++y){var v=t[e[y]],C=v[r][1]||0,N=v[r-1][1]||0;g+=C-N}c+=f,u+=g*f}s[r-1][1]+=s[r-1][0]=n,c&&(n-=u/c)}s[r-1][1]+=s[r-1][0]=n,qN(t,e)}}function HE(t){"@babel/helpers - typeof";return HE=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},HE(t)}var KVt=["type","size","sizeType"];function Bne(){return Bne=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},Bne.apply(this,arguments)}function xwe(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 gwe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xwe(Object(n),!0).forEach(function(r){YVt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xwe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function YVt(t,e,n){return e=XVt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XVt(t){var e=QVt(t,"string");return HE(e)=="symbol"?e:e+""}function QVt(t,e){if(HE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(HE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ZVt(t,e){if(t==null)return{};var n=JVt(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 JVt(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 bUe={symbolCircle:bue,symbolCross:vVt,symbolDiamond:CVt,symbolSquare:SVt,symbolStar:_Vt,symbolTriangle:EVt,symbolWye:TVt},eWt=Math.PI/180,tWt=function(e){var n="symbol".concat(DU(e));return bUe[n]||bue},nWt=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*eWt;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}},rWt=function(e,n){bUe["symbol".concat(DU(e))]=n},zU=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=ZVt(e,KVt),u=gwe(gwe({},c),{},{type:r,size:a,sizeType:l}),d=function(){var C=tWt(r),N=IVt().type(C).size(nWt(a,l,r));return N()},f=u.className,x=u.cx,g=u.cy,y=Ni(u,!0);return x===+x&&g===+g&&a===+a?Ie.createElement("path",Bne({},y,{className:ca("recharts-symbols",f),transform:"translate(".concat(x,", ").concat(g,")"),d:d()})):null};zU.registerSymbol=rWt;function GN(t){"@babel/helpers - typeof";return GN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},GN(t)}function $ne(){return $ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$ne.apply(this,arguments)}function bwe(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?bwe(Object(n),!0).forEach(function(r){VE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bwe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iWt(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,vUe(r.key),r)}}function oWt(t,e,n){return aWt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lWt(t,e,n){return e=YL(e),cWt(t,yUe()?Reflect.construct(e,n||[],YL(t).constructor):e.apply(t,n))}function cWt(t,e){if(e&&(GN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uWt(t)}function uWt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yUe=function(){return!!t})()}function YL(t){return YL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},YL(t)}function dWt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Une(t,e)}function Une(t,e){return Une=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Une(t,e)}function VE(t,e,n){return e=vUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vUe(t){var e=fWt(t,"string");return GN(e)=="symbol"?e:e+""}function fWt(t,e){if(GN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(GN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $p=32,yue=function(t){function e(){return iWt(this,e),lWt(this,e,arguments)}return dWt(e,t),oWt(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 Ie.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 Ie.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 Ie.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(Ie.isValidElement(r.legendIcon)){var u=sWt({},r);return delete u.legendIcon,Ie.cloneElement(r.legendIcon,u)}return Ie.createElement(zU,{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=ca(VE(VE({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",g.inactive));if(g.type==="none")return null;var N=Ei(g.value)?null:g.value;l1(!Ei(g.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var I=g.inactive?u:g.color;return Ie.createElement("li",$ne({className:C,style:f,key:"legend-item-".concat(y)},zE(r.props,g,y)),Ie.createElement(Fne,{width:o,height:o,viewBox:d,style:x},r.renderIcon(g)),Ie.createElement("span",{className:"recharts-legend-item-text",style:{color:I}},v?v(N,g,y):N))})}},{key:"render",value:function(){var r=this.props,s=r.payload,a=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return Ie.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(h.PureComponent);VE(yue,"displayName","Legend");VE(yue,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var oK,ywe;function hWt(){if(ywe)return oK;ywe=1;var t=MU();function e(){this.__data__=new t,this.size=0}return oK=e,oK}var lK,vwe;function pWt(){if(vwe)return lK;vwe=1;function t(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r}return lK=t,lK}var cK,wwe;function mWt(){if(wwe)return cK;wwe=1;function t(e){return this.__data__.get(e)}return cK=t,cK}var uK,Cwe;function xWt(){if(Cwe)return uK;Cwe=1;function t(e){return this.__data__.has(e)}return uK=t,uK}var dK,Swe;function gWt(){if(Swe)return dK;Swe=1;var t=MU(),e=uue(),n=due(),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 dK=s,dK}var fK,Nwe;function wUe(){if(Nwe)return fK;Nwe=1;var t=MU(),e=hWt(),n=pWt(),r=mWt(),s=xWt(),a=gWt();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,fK=o,fK}var hK,jwe;function bWt(){if(jwe)return hK;jwe=1;var t="__lodash_hash_undefined__";function e(n){return this.__data__.set(n,t),this}return hK=e,hK}var pK,Awe;function yWt(){if(Awe)return pK;Awe=1;function t(e){return this.__data__.has(e)}return pK=t,pK}var mK,_we;function CUe(){if(_we)return mK;_we=1;var t=due(),e=bWt(),n=yWt();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,mK=r,mK}var xK,Ewe;function SUe(){if(Ewe)return xK;Ewe=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 xK=t,xK}var gK,kwe;function NUe(){if(kwe)return gK;kwe=1;function t(e,n){return e.has(n)}return gK=t,gK}var bK,Twe;function jUe(){if(Twe)return bK;Twe=1;var t=CUe(),e=SUe(),n=NUe(),r=1,s=2;function a(o,l,c,u,d,f){var x=c&r,g=o.length,y=l.length;if(g!=y&&!(x&&y>g))return!1;var v=f.get(o),C=f.get(l);if(v&&C)return v==l&&C==o;var N=-1,I=!0,P=c&s?new t:void 0;for(f.set(o,l),f.set(l,o);++N<g;){var M=o[N],F=l[N];if(u)var $=x?u(F,M,N,l,o,f):u(M,F,N,o,l,f);if($!==void 0){if($)continue;I=!1;break}if(P){if(!e(l,function(L,z){if(!n(P,z)&&(M===L||d(M,L,c,u,f)))return P.push(z)})){I=!1;break}}else if(!(M===F||d(M,F,c,u,f))){I=!1;break}}return f.delete(o),f.delete(l),I}return bK=a,bK}var yK,Iwe;function vWt(){if(Iwe)return yK;Iwe=1;var t=Cx(),e=t.Uint8Array;return yK=e,yK}var vK,Pwe;function wWt(){if(Pwe)return vK;Pwe=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s,a){r[++n]=[a,s]}),r}return vK=t,vK}var wK,Fwe;function vue(){if(Fwe)return wK;Fwe=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s){r[++n]=s}),r}return wK=t,wK}var CK,Owe;function CWt(){if(Owe)return CK;Owe=1;var t=XT(),e=vWt(),n=cue(),r=jUe(),s=wWt(),a=vue(),o=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",x="[object Number]",g="[object RegExp]",y="[object Set]",v="[object String]",C="[object Symbol]",N="[object ArrayBuffer]",I="[object DataView]",P=t?t.prototype:void 0,M=P?P.valueOf:void 0;function F($,L,z,Q,se,ee,K){switch(z){case I:if($.byteLength!=L.byteLength||$.byteOffset!=L.byteOffset)return!1;$=$.buffer,L=L.buffer;case N:return!($.byteLength!=L.byteLength||!ee(new e($),new e(L)));case c:case u:case x:return n(+$,+L);case d:return $.name==L.name&&$.message==L.message;case g:case v:return $==L+"";case f:var re=s;case y:var de=Q&o;if(re||(re=a),$.size!=L.size&&!de)return!1;var G=K.get($);if(G)return G==L;Q|=l,K.set($,L);var ie=r(re($),re(L),Q,se,ee,K);return K.delete($),ie;case C:if(M)return M.call($)==M.call(L)}return!1}return CK=F,CK}var SK,Mwe;function AUe(){if(Mwe)return SK;Mwe=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 SK=t,SK}var NK,Rwe;function SWt(){if(Rwe)return NK;Rwe=1;var t=AUe(),e=Cf();function n(r,s,a){var o=s(r);return e(r)?o:t(o,a(r))}return NK=n,NK}var jK,Lwe;function NWt(){if(Lwe)return jK;Lwe=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 jK=t,jK}var AK,Dwe;function jWt(){if(Dwe)return AK;Dwe=1;function t(){return[]}return AK=t,AK}var _K,Bwe;function AWt(){if(Bwe)return _K;Bwe=1;var t=NWt(),e=jWt(),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 _K=a,_K}var EK,$we;function _Wt(){if($we)return EK;$we=1;function t(e,n){for(var r=-1,s=Array(e);++r<e;)s[r]=n(r);return s}return EK=t,EK}var kK,Uwe;function EWt(){if(Uwe)return kK;Uwe=1;var t=U1(),e=z1(),n="[object Arguments]";function r(s){return e(s)&&t(s)==n}return kK=r,kK}var TK,zwe;function wue(){if(zwe)return TK;zwe=1;var t=EWt(),e=z1(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,a=t(function(){return arguments}())?t:function(o){return e(o)&&r.call(o,"callee")&&!s.call(o,"callee")};return TK=a,TK}var a9={exports:{}},IK,Hwe;function kWt(){if(Hwe)return IK;Hwe=1;function t(){return!1}return IK=t,IK}a9.exports;var Vwe;function _Ue(){return Vwe||(Vwe=1,function(t,e){var n=Cx(),r=kWt(),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}(a9,a9.exports)),a9.exports}var PK,Wwe;function Cue(){if(Wwe)return PK;Wwe=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 PK=n,PK}var FK,qwe;function Sue(){if(qwe)return FK;qwe=1;var t=9007199254740991;function e(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=t}return FK=e,FK}var OK,Gwe;function TWt(){if(Gwe)return OK;Gwe=1;var t=U1(),e=Sue(),n=z1(),r="[object Arguments]",s="[object Array]",a="[object Boolean]",o="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",x="[object RegExp]",g="[object Set]",y="[object String]",v="[object WeakMap]",C="[object ArrayBuffer]",N="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",M="[object Int8Array]",F="[object Int16Array]",$="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",Q="[object Uint16Array]",se="[object Uint32Array]",ee={};ee[I]=ee[P]=ee[M]=ee[F]=ee[$]=ee[L]=ee[z]=ee[Q]=ee[se]=!0,ee[r]=ee[s]=ee[C]=ee[a]=ee[N]=ee[o]=ee[l]=ee[c]=ee[u]=ee[d]=ee[f]=ee[x]=ee[g]=ee[y]=ee[v]=!1;function K(re){return n(re)&&e(re.length)&&!!ee[t(re)]}return OK=K,OK}var MK,Kwe;function EUe(){if(Kwe)return MK;Kwe=1;function t(e){return function(n){return e(n)}}return MK=t,MK}var o9={exports:{}};o9.exports;var Ywe;function IWt(){return Ywe||(Ywe=1,function(t,e){var n=G$e(),r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,a=s&&s.exports===r,o=a&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=l}(o9,o9.exports)),o9.exports}var RK,Xwe;function kUe(){if(Xwe)return RK;Xwe=1;var t=TWt(),e=EUe(),n=IWt(),r=n&&n.isTypedArray,s=r?e(r):t;return RK=s,RK}var LK,Qwe;function PWt(){if(Qwe)return LK;Qwe=1;var t=_Wt(),e=wue(),n=Cf(),r=_Ue(),s=Cue(),a=kUe(),o=Object.prototype,l=o.hasOwnProperty;function c(u,d){var f=n(u),x=!f&&e(u),g=!f&&!x&&r(u),y=!f&&!x&&!g&&a(u),v=f||x||g||y,C=v?t(u.length,String):[],N=C.length;for(var I in u)(d||l.call(u,I))&&!(v&&(I=="length"||g&&(I=="offset"||I=="parent")||y&&(I=="buffer"||I=="byteLength"||I=="byteOffset")||s(I,N)))&&C.push(I);return C}return LK=c,LK}var DK,Zwe;function FWt(){if(Zwe)return DK;Zwe=1;var t=Object.prototype;function e(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||t;return n===s}return DK=e,DK}var BK,Jwe;function TUe(){if(Jwe)return BK;Jwe=1;function t(e,n){return function(r){return e(n(r))}}return BK=t,BK}var $K,e3e;function OWt(){if(e3e)return $K;e3e=1;var t=TUe(),e=t(Object.keys,Object);return $K=e,$K}var UK,t3e;function MWt(){if(t3e)return UK;t3e=1;var t=FWt(),e=OWt(),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 UK=s,UK}var zK,n3e;function QT(){if(n3e)return zK;n3e=1;var t=lue(),e=Sue();function n(r){return r!=null&&e(r.length)&&!t(r)}return zK=n,zK}var HK,r3e;function HU(){if(r3e)return HK;r3e=1;var t=PWt(),e=MWt(),n=QT();function r(s){return n(s)?t(s):e(s)}return HK=r,HK}var VK,s3e;function RWt(){if(s3e)return VK;s3e=1;var t=SWt(),e=AWt(),n=HU();function r(s){return t(s,n,e)}return VK=r,VK}var WK,i3e;function LWt(){if(i3e)return WK;i3e=1;var t=RWt(),e=1,n=Object.prototype,r=n.hasOwnProperty;function s(a,o,l,c,u,d){var f=l&e,x=t(a),g=x.length,y=t(o),v=y.length;if(g!=v&&!f)return!1;for(var C=g;C--;){var N=x[C];if(!(f?N in o:r.call(o,N)))return!1}var I=d.get(a),P=d.get(o);if(I&&P)return I==o&&P==a;var M=!0;d.set(a,o),d.set(o,a);for(var F=f;++C<g;){N=x[C];var $=a[N],L=o[N];if(c)var z=f?c(L,$,N,o,a,d):c($,L,N,a,o,d);if(!(z===void 0?$===L||u($,L,l,c,d):z)){M=!1;break}F||(F=N=="constructor")}if(M&&!F){var Q=a.constructor,se=o.constructor;Q!=se&&"constructor"in a&&"constructor"in o&&!(typeof Q=="function"&&Q instanceof Q&&typeof se=="function"&&se instanceof se)&&(M=!1)}return d.delete(a),d.delete(o),M}return WK=s,WK}var qK,a3e;function DWt(){if(a3e)return qK;a3e=1;var t=z5(),e=Cx(),n=t(e,"DataView");return qK=n,qK}var GK,o3e;function BWt(){if(o3e)return GK;o3e=1;var t=z5(),e=Cx(),n=t(e,"Promise");return GK=n,GK}var KK,l3e;function IUe(){if(l3e)return KK;l3e=1;var t=z5(),e=Cx(),n=t(e,"Set");return KK=n,KK}var YK,c3e;function $Wt(){if(c3e)return YK;c3e=1;var t=z5(),e=Cx(),n=t(e,"WeakMap");return YK=n,YK}var XK,u3e;function UWt(){if(u3e)return XK;u3e=1;var t=DWt(),e=uue(),n=BWt(),r=IUe(),s=$Wt(),a=U1(),o=K$e(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",x="[object DataView]",g=o(t),y=o(e),v=o(n),C=o(r),N=o(s),I=a;return(t&&I(new t(new ArrayBuffer(1)))!=x||e&&I(new e)!=l||n&&I(n.resolve())!=u||r&&I(new r)!=d||s&&I(new s)!=f)&&(I=function(P){var M=a(P),F=M==c?P.constructor:void 0,$=F?o(F):"";if($)switch($){case g:return x;case y:return l;case v:return u;case C:return d;case N:return f}return M}),XK=I,XK}var QK,d3e;function zWt(){if(d3e)return QK;d3e=1;var t=wUe(),e=jUe(),n=CWt(),r=LWt(),s=UWt(),a=Cf(),o=_Ue(),l=kUe(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",x=Object.prototype,g=x.hasOwnProperty;function y(v,C,N,I,P,M){var F=a(v),$=a(C),L=F?d:s(v),z=$?d:s(C);L=L==u?f:L,z=z==u?f:z;var Q=L==f,se=z==f,ee=L==z;if(ee&&o(v)){if(!o(C))return!1;F=!0,Q=!1}if(ee&&!Q)return M||(M=new t),F||l(v)?e(v,C,N,I,P,M):n(v,C,L,N,I,P,M);if(!(N&c)){var K=Q&&g.call(v,"__wrapped__"),re=se&&g.call(C,"__wrapped__");if(K||re){var de=K?v.value():v,G=re?C.value():C;return M||(M=new t),P(de,G,N,I,M)}}return ee?(M||(M=new t),r(v,C,N,I,P,M)):!1}return QK=y,QK}var ZK,f3e;function Nue(){if(f3e)return ZK;f3e=1;var t=zWt(),e=z1();function n(r,s,a,o,l){return r===s?!0:r==null||s==null||!e(r)&&!e(s)?r!==r&&s!==s:t(r,s,a,o,n,l)}return ZK=n,ZK}var JK,h3e;function HWt(){if(h3e)return JK;h3e=1;var t=wUe(),e=Nue(),n=1,r=2;function s(a,o,l,c){var u=l.length,d=u,f=!c;if(a==null)return!d;for(a=Object(a);u--;){var x=l[u];if(f&&x[2]?x[1]!==a[x[0]]:!(x[0]in a))return!1}for(;++u<d;){x=l[u];var g=x[0],y=a[g],v=x[1];if(f&&x[2]){if(y===void 0&&!(g in a))return!1}else{var C=new t;if(c)var N=c(y,v,g,a,o,C);if(!(N===void 0?e(v,y,n|r,c,C):N))return!1}}return!0}return JK=s,JK}var eY,p3e;function PUe(){if(p3e)return eY;p3e=1;var t=F2();function e(n){return n===n&&!t(n)}return eY=e,eY}var tY,m3e;function VWt(){if(m3e)return tY;m3e=1;var t=PUe(),e=HU();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 tY=n,tY}var nY,x3e;function FUe(){if(x3e)return nY;x3e=1;function t(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}return nY=t,nY}var rY,g3e;function WWt(){if(g3e)return rY;g3e=1;var t=HWt(),e=VWt(),n=FUe();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 rY=r,rY}var sY,b3e;function qWt(){if(b3e)return sY;b3e=1;function t(e,n){return e!=null&&n in Object(e)}return sY=t,sY}var iY,y3e;function GWt(){if(y3e)return iY;y3e=1;var t=Q$e(),e=wue(),n=Cf(),r=Cue(),s=Sue(),a=LU();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 iY=o,iY}var aY,v3e;function KWt(){if(v3e)return aY;v3e=1;var t=qWt(),e=GWt();function n(r,s){return r!=null&&e(r,s,t)}return aY=n,aY}var oY,w3e;function YWt(){if(w3e)return oY;w3e=1;var t=Nue(),e=Z$e(),n=KWt(),r=oue(),s=PUe(),a=FUe(),o=LU(),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 oY=u,oY}var lY,C3e;function A8(){if(C3e)return lY;C3e=1;function t(e){return e}return lY=t,lY}var cY,S3e;function XWt(){if(S3e)return cY;S3e=1;function t(e){return function(n){return n==null?void 0:n[e]}}return cY=t,cY}var uY,N3e;function QWt(){if(N3e)return uY;N3e=1;var t=hue();function e(n){return function(r){return t(r,n)}}return uY=e,uY}var dY,j3e;function ZWt(){if(j3e)return dY;j3e=1;var t=XWt(),e=QWt(),n=oue(),r=LU();function s(a){return n(a)?t(r(a)):e(a)}return dY=s,dY}var fY,A3e;function O2(){if(A3e)return fY;A3e=1;var t=WWt(),e=YWt(),n=A8(),r=Cf(),s=ZWt();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 fY=a,fY}var hY,_3e;function OUe(){if(_3e)return hY;_3e=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 hY=t,hY}var pY,E3e;function JWt(){if(E3e)return pY;E3e=1;function t(e){return e!==e}return pY=t,pY}var mY,k3e;function eqt(){if(k3e)return mY;k3e=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 mY=t,mY}var xY,T3e;function tqt(){if(T3e)return xY;T3e=1;var t=OUe(),e=JWt(),n=eqt();function r(s,a,o){return a===a?n(s,a,o):t(s,e,o)}return xY=r,xY}var gY,I3e;function nqt(){if(I3e)return gY;I3e=1;var t=tqt();function e(n,r){var s=n==null?0:n.length;return!!s&&t(n,r,0)>-1}return gY=e,gY}var bY,P3e;function rqt(){if(P3e)return bY;P3e=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 bY=t,bY}var yY,F3e;function sqt(){if(F3e)return yY;F3e=1;function t(){}return yY=t,yY}var vY,O3e;function iqt(){if(O3e)return vY;O3e=1;var t=IUe(),e=sqt(),n=vue(),r=1/0,s=t&&1/n(new t([,-0]))[1]==r?function(a){return new t(a)}:e;return vY=s,vY}var wY,M3e;function aqt(){if(M3e)return wY;M3e=1;var t=CUe(),e=nqt(),n=rqt(),r=NUe(),s=iqt(),a=vue(),o=200;function l(c,u,d){var f=-1,x=e,g=c.length,y=!0,v=[],C=v;if(d)y=!1,x=n;else if(g>=o){var N=u?null:s(c);if(N)return a(N);y=!1,x=r,C=new t}else C=u?[]:v;e:for(;++f<g;){var I=c[f],P=u?u(I):I;if(I=d||I!==0?I:0,y&&P===P){for(var M=C.length;M--;)if(C[M]===P)continue e;u&&C.push(P),v.push(I)}else x(C,P,d)||(C!==v&&C.push(P),v.push(I))}return v}return wY=l,wY}var CY,R3e;function oqt(){if(R3e)return CY;R3e=1;var t=O2(),e=aqt();function n(r,s){return r&&r.length?e(r,t(s,2)):[]}return CY=n,CY}var lqt=oqt();const L3e=Ti(lqt);function MUe(t,e,n){return e===!0?L3e(t,n):Ei(e)?L3e(t,e):t}function KN(t){"@babel/helpers - typeof";return KN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},KN(t)}var cqt=["ref"];function D3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ng(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?D3e(Object(n),!0).forEach(function(r){VU(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):D3e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B3e(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,LUe(r.key),r)}}function dqt(t,e,n){return B3e(t.prototype,e),B3e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function fqt(t,e,n){return e=XL(e),hqt(t,RUe()?Reflect.construct(e,n,XL(t).constructor):e.apply(t,n))}function hqt(t,e){if(e&&(KN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pqt(t)}function pqt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RUe=function(){return!!t})()}function XL(t){return XL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},XL(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&&zne(t,e)}function zne(t,e){return zne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},zne(t,e)}function VU(t,e,n){return e=LUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LUe(t){var e=xqt(t,"string");return KN(e)=="symbol"?e:e+""}function xqt(t,e){if(KN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(KN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gqt(t,e){if(t==null)return{};var n=bqt(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 bqt(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 yqt(t){return t.value}function vqt(t,e){if(Ie.isValidElement(t))return Ie.cloneElement(t,e);if(typeof t=="function")return Ie.createElement(t,e);e.ref;var n=gqt(e,cqt);return Ie.createElement(yue,n)}var $3e=1,j3=function(t){function e(){var n;uqt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=fqt(this,e,[].concat(s)),VU(n,"lastBoundingBox",{width:-1,height:-1}),n}return mqt(e,t),dqt(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)>$3e||Math.abs(s.height-this.lastBoundingBox.height)>$3e)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ng({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,a=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,x;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var g=this.getBBoxSnapshot();f={left:((u||0)-g.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var y=this.getBBoxSnapshot();x={top:((d||0)-y.height)/2}}else x=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return ng(ng({},f),x)}},{key:"render",value:function(){var r=this,s=this.props,a=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=ng(ng({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return Ie.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(g){r.wrapperNode=g}},vqt(a,ng(ng({},this.props),{},{payload:MUe(d,u,yqt)})))}}],[{key:"getWithHeight",value:function(r,s){var a=ng(ng({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&rs(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(h.PureComponent);VU(j3,"displayName","Legend");VU(j3,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var SY,U3e;function wqt(){if(U3e)return SY;U3e=1;var t=XT(),e=wue(),n=Cf(),r=t?t.isConcatSpreadable:void 0;function s(a){return n(a)||e(a)||!!(r&&a&&a[r])}return SY=s,SY}var NY,z3e;function DUe(){if(z3e)return NY;z3e=1;var t=AUe(),e=wqt();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 NY=n,NY}var jY,H3e;function Cqt(){if(H3e)return jY;H3e=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 jY=t,jY}var AY,V3e;function Sqt(){if(V3e)return AY;V3e=1;var t=Cqt(),e=t();return AY=e,AY}var _Y,W3e;function BUe(){if(W3e)return _Y;W3e=1;var t=Sqt(),e=HU();function n(r,s){return r&&t(r,s,e)}return _Y=n,_Y}var EY,q3e;function Nqt(){if(q3e)return EY;q3e=1;var t=QT();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 EY=e,EY}var kY,G3e;function jue(){if(G3e)return kY;G3e=1;var t=BUe(),e=Nqt(),n=e(t);return kY=n,kY}var TY,K3e;function $Ue(){if(K3e)return TY;K3e=1;var t=jue(),e=QT();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 TY=n,TY}var IY,Y3e;function jqt(){if(Y3e)return IY;Y3e=1;function t(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}return IY=t,IY}var PY,X3e;function Aqt(){if(X3e)return PY;X3e=1;var t=S8();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 PY=e,PY}var FY,Q3e;function _qt(){if(Q3e)return FY;Q3e=1;var t=Aqt();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 FY=e,FY}var OY,Z3e;function Eqt(){if(Z3e)return OY;Z3e=1;var t=fue(),e=hue(),n=O2(),r=$Ue(),s=jqt(),a=EUe(),o=_qt(),l=A8(),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,N){var I=t(f,function(P){return P(v)});return{criteria:I,index:++g,value:v}});return s(y,function(v,C){return o(v,C,x)})}return OY=u,OY}var MY,J3e;function kqt(){if(J3e)return MY;J3e=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 MY=t,MY}var RY,e5e;function Tqt(){if(e5e)return RY;e5e=1;var t=kqt(),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 RY=n,RY}var LY,t5e;function Iqt(){if(t5e)return LY;t5e=1;function t(e){return function(){return e}}return LY=t,LY}var DY,n5e;function UUe(){if(n5e)return DY;n5e=1;var t=z5(),e=function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}}();return DY=e,DY}var BY,r5e;function Pqt(){if(r5e)return BY;r5e=1;var t=Iqt(),e=UUe(),n=A8(),r=e?function(s,a){return e(s,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:n;return BY=r,BY}var $Y,s5e;function Fqt(){if(s5e)return $Y;s5e=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 $Y=r,$Y}var UY,i5e;function Oqt(){if(i5e)return UY;i5e=1;var t=Pqt(),e=Fqt(),n=e(t);return UY=n,UY}var zY,a5e;function Mqt(){if(a5e)return zY;a5e=1;var t=A8(),e=Tqt(),n=Oqt();function r(s,a){return n(e(s,a,t),s+"")}return zY=r,zY}var HY,o5e;function WU(){if(o5e)return HY;o5e=1;var t=cue(),e=QT(),n=Cue(),r=F2();function s(a,o,l){if(!r(l))return!1;var c=typeof o;return(c=="number"?e(l)&&n(o,l.length):c=="string"&&o in l)?t(l[o],a):!1}return HY=s,HY}var VY,l5e;function Rqt(){if(l5e)return VY;l5e=1;var t=DUe(),e=Eqt(),n=Mqt(),r=WU(),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 VY=s,VY}var Lqt=Rqt();const Aue=Ti(Lqt);function WE(t){"@babel/helpers - typeof";return WE=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},WE(t)}function Hne(){return Hne=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},Hne.apply(this,arguments)}function Dqt(t,e){return zqt(t)||Uqt(t,e)||$qt(t,e)||Bqt()}function Bqt(){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 $qt(t,e){if(t){if(typeof t=="string")return c5e(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 c5e(t,e)}}function c5e(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 Uqt(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 zqt(t){if(Array.isArray(t))return t}function u5e(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 WY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?u5e(Object(n),!0).forEach(function(r){Hqt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hqt(t,e,n){return e=Vqt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vqt(t){var e=Wqt(t,"string");return WE(e)=="symbol"?e:e+""}function Wqt(t,e){if(WE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(WE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qqt(t){return Array.isArray(t)&&lc(t[0])&&lc(t[1])?t.join(" ~ "):t}var Gqt=function(e){var n=e.separator,r=n===void 0?" : ":n,s=e.contentStyle,a=s===void 0?{}:s,o=e.itemStyle,l=o===void 0?{}:o,c=e.labelStyle,u=c===void 0?{}:c,d=e.payload,f=e.formatter,x=e.itemSorter,g=e.wrapperClassName,y=e.labelClassName,v=e.label,C=e.labelFormatter,N=e.accessibilityLayer,I=N===void 0?!1:N,P=function(){if(d&&d.length){var K={padding:0,margin:0},re=(x?Aue(d,x):d).map(function(de,G){if(de.type==="none")return null;var ie=WY({display:"block",paddingTop:4,paddingBottom:4,color:de.color||"#000"},l),ae=de.formatter||f||qqt,q=de.value,W=de.name,ne=q,oe=W;if(ne!=null&&oe!=null){var he=ae(q,W,de,G,d);if(Array.isArray(he)){var _e=Dqt(he,2);ne=_e[0],oe=_e[1]}else ne=he}return Ie.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(G),style:ie},lc(oe)?Ie.createElement("span",{className:"recharts-tooltip-item-name"},oe):null,lc(oe)?Ie.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,Ie.createElement("span",{className:"recharts-tooltip-item-value"},ne),Ie.createElement("span",{className:"recharts-tooltip-item-unit"},de.unit||""))});return Ie.createElement("ul",{className:"recharts-tooltip-item-list",style:K},re)}return null},M=WY({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),F=WY({margin:0},u),$=!ji(v),L=$?v:"",z=ca("recharts-default-tooltip",g),Q=ca("recharts-tooltip-label",y);$&&C&&d!==void 0&&d!==null&&(L=C(v,d));var se=I?{role:"status","aria-live":"assertive"}:{};return Ie.createElement("div",Hne({className:z,style:M},se),Ie.createElement("p",{className:Q,style:F},Ie.isValidElement(L)?L:"".concat(L)),P())};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)}function pF(t,e,n){return e=Kqt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kqt(t){var e=Yqt(t,"string");return qE(e)=="symbol"?e:e+""}function Yqt(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)}var u7="recharts-tooltip-wrapper",Xqt={visibility:"hidden"};function Qqt(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return ca(u7,pF(pF(pF(pF({},"".concat(u7,"-right"),rs(n)&&e&&rs(e.x)&&n>=e.x),"".concat(u7,"-left"),rs(n)&&e&&rs(e.x)&&n<e.x),"".concat(u7,"-bottom"),rs(r)&&e&&rs(e.y)&&r>=e.y),"".concat(u7,"-top"),rs(r)&&e&&rs(e.y)&&r<e.y))}function d5e(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,s=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(a&&rs(a[r]))return a[r];var d=n[r]-l-s,f=n[r]+s;if(e[r])return o[r]?d:f;if(o[r]){var x=d,g=c[r];return x<g?Math.max(f,c[r]):Math.max(d,c[r])}var y=f+l,v=c[r]+u;return y>v?Math.max(d,c[r]):Math.max(f,c[r])}function Zqt(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 Jqt(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=d5e({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=d5e({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Zqt({translateX:d,translateY:f,useTranslate3d:l})):u=Xqt,{cssProperties:u,cssClasses:Qqt({translateX:d,translateY:f,coordinate:n})}}function YN(t){"@babel/helpers - typeof";return YN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YN(t)}function f5e(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 h5e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?f5e(Object(n),!0).forEach(function(r){Wne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function eGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tGt(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,HUe(r.key),r)}}function nGt(t,e,n){return tGt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function rGt(t,e,n){return e=QL(e),sGt(t,zUe()?Reflect.construct(e,n,QL(t).constructor):e.apply(t,n))}function sGt(t,e){if(e&&(YN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iGt(t)}function iGt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zUe=function(){return!!t})()}function QL(t){return QL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},QL(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&&Vne(t,e)}function Vne(t,e){return Vne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Vne(t,e)}function Wne(t,e,n){return e=HUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HUe(t){var e=oGt(t,"string");return YN(e)=="symbol"?e:e+""}function oGt(t,e){if(YN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(YN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var p5e=1,lGt=function(t){function e(){var n;eGt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=rGt(this,e,[].concat(s)),Wne(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Wne(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),nGt(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>p5e||Math.abs(r.height-this.state.lastBoundingBox.height)>p5e)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,a=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,x=s.isAnimationActive,g=s.offset,y=s.position,v=s.reverseDirection,C=s.useTranslate3d,N=s.viewBox,I=s.wrapperStyle,P=Jqt({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:g,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:C,viewBox:N}),M=P.cssClasses,F=P.cssProperties,$=h5e(h5e({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},I);return Ie.createElement("div",{tabIndex:-1,className:M,style:$,ref:function(z){r.wrapperNode=z}},u)}}])}(h.PureComponent),cGt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Sm={isSsr:cGt(),get:function(e){return Sm[e]},set:function(e,n){if(typeof e=="string")Sm[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(s){Sm[s]=e[s]})}}};function XN(t){"@babel/helpers - typeof";return XN=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},XN(t)}function m5e(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 x5e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?m5e(Object(n),!0).forEach(function(r){_ue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dGt(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,WUe(r.key),r)}}function fGt(t,e,n){return dGt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function hGt(t,e,n){return e=ZL(e),pGt(t,VUe()?Reflect.construct(e,n||[],ZL(t).constructor):e.apply(t,n))}function pGt(t,e){if(e&&(XN(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 VUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VUe=function(){return!!t})()}function ZL(t){return ZL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ZL(t)}function xGt(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&&qne(t,e)}function qne(t,e){return qne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},qne(t,e)}function _ue(t,e,n){return e=WUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WUe(t){var e=gGt(t,"string");return XN(e)=="symbol"?e:e+""}function gGt(t,e){if(XN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(XN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bGt(t){return t.dataKey}function yGt(t,e){return Ie.isValidElement(t)?Ie.cloneElement(t,e):typeof t=="function"?Ie.createElement(t,e):Ie.createElement(Gqt,e)}var sm=function(t){function e(){return uGt(this,e),hGt(this,e,arguments)}return xGt(e,t),fGt(e,[{key:"render",value:function(){var r=this,s=this.props,a=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,d=s.coordinate,f=s.filterNull,x=s.isAnimationActive,g=s.offset,y=s.payload,v=s.payloadUniqBy,C=s.position,N=s.reverseDirection,I=s.useTranslate3d,P=s.viewBox,M=s.wrapperStyle,F=y??[];f&&F.length&&(F=MUe(y.filter(function(L){return L.value!=null&&(L.hide!==!0||r.props.includeHidden)}),v,bGt));var $=F.length>0;return Ie.createElement(lGt,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:x,active:a,coordinate:d,hasPayload:$,offset:g,position:C,reverseDirection:N,useTranslate3d:I,viewBox:P,wrapperStyle:M},yGt(u,x5e(x5e({},this.props),{},{payload:F})))}}])}(h.PureComponent);_ue(sm,"displayName","Tooltip");_ue(sm,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Sm.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var qY,g5e;function vGt(){if(g5e)return qY;g5e=1;var t=Cx(),e=function(){return t.Date.now()};return qY=e,qY}var GY,b5e;function wGt(){if(b5e)return GY;b5e=1;var t=/\s/;function e(n){for(var r=n.length;r--&&t.test(n.charAt(r)););return r}return GY=e,GY}var KY,y5e;function CGt(){if(y5e)return KY;y5e=1;var t=wGt(),e=/^\s+/;function n(r){return r&&r.slice(0,t(r)+1).replace(e,"")}return KY=n,KY}var YY,v5e;function qUe(){if(v5e)return YY;v5e=1;var t=CGt(),e=F2(),n=S8(),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 YY=c,YY}var XY,w5e;function GUe(){if(w5e)return XY;w5e=1;var t=F2(),e=vGt(),n=qUe(),r="Expected a function",s=Math.max,a=Math.min;function o(l,c,u){var d,f,x,g,y,v,C=0,N=!1,I=!1,P=!0;if(typeof l!="function")throw new TypeError(r);c=n(c)||0,t(u)&&(N=!!u.leading,I="maxWait"in u,x=I?s(n(u.maxWait)||0,c):x,P="trailing"in u?!!u.trailing:P);function M(re){var de=d,G=f;return d=f=void 0,C=re,g=l.apply(G,de),g}function F(re){return C=re,y=setTimeout(z,c),N?M(re):g}function $(re){var de=re-v,G=re-C,ie=c-de;return I?a(ie,x-G):ie}function L(re){var de=re-v,G=re-C;return v===void 0||de>=c||de<0||I&&G>=x}function z(){var re=e();if(L(re))return Q(re);y=setTimeout(z,$(re))}function Q(re){return y=void 0,P&&d?M(re):(d=f=void 0,g)}function se(){y!==void 0&&clearTimeout(y),C=0,d=v=f=y=void 0}function ee(){return y===void 0?g:Q(e())}function K(){var re=e(),de=L(re);if(d=arguments,f=this,v=re,de){if(y===void 0)return F(v);if(I)return clearTimeout(y),y=setTimeout(z,c),M(v)}return y===void 0&&(y=setTimeout(z,c)),g}return K.cancel=se,K.flush=ee,K}return XY=o,XY}var QY,C5e;function SGt(){if(C5e)return QY;C5e=1;var t=GUe(),e=F2(),n="Expected a function";function r(s,a,o){var l=!0,c=!0;if(typeof s!="function")throw new TypeError(n);return e(o)&&(l="leading"in o?!!o.leading:l,c="trailing"in o?!!o.trailing:c),t(s,a,{leading:l,maxWait:a,trailing:c})}return QY=r,QY}var NGt=SGt();const KUe=Ti(NGt);function GE(t){"@babel/helpers - typeof";return GE=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},GE(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 mF(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){jGt(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 jGt(t,e,n){return e=AGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AGt(t){var e=_Gt(t,"string");return GE(e)=="symbol"?e:e+""}function _Gt(t,e){if(GE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(GE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EGt(t,e){return PGt(t)||IGt(t,e)||TGt(t,e)||kGt()}function kGt(){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 TGt(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 IGt(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 PGt(t){if(Array.isArray(t))return t}var YUe=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,N=t.className,I=t.onResize,P=t.style,M=P===void 0?{}:P,F=h.useRef(null),$=h.useRef();$.current=I,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 L=h.useState({containerWidth:s.width,containerHeight:s.height}),z=EGt(L,2),Q=z[0],se=z[1],ee=h.useCallback(function(re,de){se(function(G){var ie=Math.round(re),ae=Math.round(de);return G.containerWidth===ie&&G.containerHeight===ae?G:{containerWidth:ie,containerHeight:ae}})},[]);h.useEffect(function(){var re=function(W){var ne,oe=W[0].contentRect,he=oe.width,_e=oe.height;ee(he,_e),(ne=$.current)===null||ne===void 0||ne.call($,he,_e)};v>0&&(re=KUe(re,v,{trailing:!0,leading:!1}));var de=new ResizeObserver(re),G=F.current.getBoundingClientRect(),ie=G.width,ae=G.height;return ee(ie,ae),de.observe(F.current),function(){de.disconnect()}},[ee,v]);var K=h.useMemo(function(){var re=Q.containerWidth,de=Q.containerHeight;if(re<0||de<0)return null;l1(Cw(o)||Cw(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),l1(!n||n>0,"The aspect(%s) must be greater than zero.",n);var G=Cw(o)?re:o,ie=Cw(c)?de:c;n&&n>0&&(G?ie=G/n:ie&&(G=ie*n),x&&ie>x&&(ie=x)),l1(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 ae=!Array.isArray(g)&&o1(g.type).endsWith("Chart");return Ie.Children.map(g,function(q){return Ie.isValidElement(q)?h.cloneElement(q,mF({width:G,height:ie},ae?{style:mF({height:"100%",width:"100%",maxHeight:ie,maxWidth:G},q.props.style)}:{})):q})},[n,g,c,x,f,d,Q,o]);return Ie.createElement("div",{id:C?"".concat(C):void 0,className:ca("recharts-responsive-container",N),style:mF(mF({},M),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:x}),ref:F},K)}),Eue=function(e){return null};Eue.displayName="Cell";function KE(t){"@babel/helpers - typeof";return KE=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},KE(t)}function j5e(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 Gne(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?j5e(Object(n),!0).forEach(function(r){FGt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function FGt(t,e,n){return e=OGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OGt(t){var e=MGt(t,"string");return KE(e)=="symbol"?e:e+""}function MGt(t,e){if(KE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(KE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wC={widthCache:{},cacheCount:0},RGt=2e3,LGt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},A5e="recharts_measurement_span";function DGt(t){var e=Gne({},t);return Object.keys(e).forEach(function(n){e[n]||delete e[n]}),e}var D9=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Sm.isSsr)return{width:0,height:0};var r=DGt(n),s=JSON.stringify({text:e,copyStyle:r});if(wC.widthCache[s])return wC.widthCache[s];try{var a=document.getElementById(A5e);a||(a=document.createElement("span"),a.setAttribute("id",A5e),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=Gne(Gne({},LGt),r);Object.assign(a.style,o),a.textContent="".concat(e);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return wC.widthCache[s]=c,++wC.cacheCount>RGt&&(wC.cacheCount=0,wC.widthCache={}),c}catch{return{width:0,height:0}}},BGt=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function YE(t){"@babel/helpers - typeof";return YE=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},YE(t)}function JL(t,e){return HGt(t)||zGt(t,e)||UGt(t,e)||$Gt()}function $Gt(){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 UGt(t,e){if(t){if(typeof t=="string")return _5e(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 _5e(t,e)}}function _5e(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 zGt(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 HGt(t){if(Array.isArray(t))return t}function VGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E5e(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,qGt(r.key),r)}}function WGt(t,e,n){return E5e(t.prototype,e),E5e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function qGt(t){var e=GGt(t,"string");return YE(e)=="symbol"?e:e+""}function GGt(t,e){if(YE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(YE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var k5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,T5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,KGt=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,YGt=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,XUe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},XGt=Object.keys(XUe),l4="NaN";function QGt(t,e){return t*XUe[e]}var xF=function(){function t(e,n){VGt(this,t),this.num=e,this.unit=n,this.num=e,this.unit=n,Number.isNaN(e)&&(this.unit=""),n!==""&&!KGt.test(n)&&(this.num=NaN,this.unit=""),XGt.includes(n)&&(this.num=QGt(e,n),this.unit="px")}return WGt(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=YGt.exec(n))!==null&&r!==void 0?r:[],a=JL(s,3),o=a[1],l=a[2];return new t(parseFloat(o),l??"")}}])}();function QUe(t){if(t.includes(l4))return l4;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=k5e.exec(e))!==null&&n!==void 0?n:[],s=JL(r,4),a=s[1],o=s[2],l=s[3],c=xF.parse(a??""),u=xF.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return l4;e=e.replace(k5e,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,x=(f=T5e.exec(e))!==null&&f!==void 0?f:[],g=JL(x,4),y=g[1],v=g[2],C=g[3],N=xF.parse(y??""),I=xF.parse(C??""),P=v==="+"?N.add(I):N.subtract(I);if(P.isNaN())return l4;e=e.replace(T5e,P.toString())}return e}var I5e=/\(([^()]*)\)/;function ZGt(t){for(var e=t;e.includes("(");){var n=I5e.exec(e),r=JL(n,2),s=r[1];e=e.replace(I5e,QUe(s))}return e}function JGt(t){var e=t.replace(/\s+/g,"");return e=ZGt(e),e=QUe(e),e}function eKt(t){try{return JGt(t)}catch{return l4}}function ZY(t){var e=eKt(t.slice(5,-1));return e===l4?"":e}var tKt=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],nKt=["dx","dy","angle","className","breakAll"];function Kne(){return Kne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Kne.apply(this,arguments)}function P5e(t,e){if(t==null)return{};var n=rKt(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 rKt(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 F5e(t,e){return oKt(t)||aKt(t,e)||iKt(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 iKt(t,e){if(t){if(typeof t=="string")return O5e(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 O5e(t,e)}}function O5e(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 oKt(t){if(Array.isArray(t))return t}var ZUe=/[ \f\n\r\t\v\u2028\u2029]+/,JUe=function(e){var n=e.children,r=e.breakAll,s=e.style;try{var a=[];ji(n)||(r?a=n.toString().split(""):a=n.toString().split(ZUe));var o=a.map(function(c){return{word:c,width:D9(c,s).width}}),l=r?0:D9(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},lKt=function(e,n,r,s,a){var o=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=rs(o),f=l,x=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return G.reduce(function(ie,ae){var q=ae.word,W=ae.width,ne=ie[ie.length-1];if(ne&&(s==null||a||ne.width+W+r<Number(s)))ne.words.push(q),ne.width+=W+r;else{var oe={words:[q],width:W};ie.push(oe)}return ie},[])},g=x(n),y=function(G){return G.reduce(function(ie,ae){return ie.width>ae.width?ie:ae})};if(!d)return g;for(var v="…",C=function(G){var ie=f.slice(0,G),ae=JUe({breakAll:u,style:c,children:ie+v}).wordsWithComputedWidth,q=x(ae),W=q.length>o||y(q).width>Number(s);return[W,q]},N=0,I=f.length-1,P=0,M;N<=I&&P<=f.length-1;){var F=Math.floor((N+I)/2),$=F-1,L=C($),z=F5e(L,2),Q=z[0],se=z[1],ee=C(F),K=F5e(ee,1),re=K[0];if(!Q&&!re&&(N=F+1),Q&&re&&(I=F-1),!Q&&re){M=se;break}P++}return M||g},M5e=function(e){var n=ji(e)?[]:e.toString().split(ZUe);return[{words:n}]},cKt=function(e){var n=e.width,r=e.scaleToFit,s=e.children,a=e.style,o=e.breakAll,l=e.maxLines;if((n||r)&&!Sm.isSsr){var c,u,d=JUe({breakAll:o,children:s,style:a});if(d){var f=d.wordsWithComputedWidth,x=d.spaceWidth;c=f,u=x}else return M5e(s);return lKt({breakAll:o,children:s,maxLines:l,style:a},c,u,n,r)}return M5e(s)},R5e="#808080",eD=function(e){var n=e.x,r=n===void 0?0:n,s=e.y,a=s===void 0?0:s,o=e.lineHeight,l=o===void 0?"1em":o,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,f=d===void 0?!1:d,x=e.textAnchor,g=x===void 0?"start":x,y=e.verticalAnchor,v=y===void 0?"end":y,C=e.fill,N=C===void 0?R5e:C,I=P5e(e,tKt),P=h.useMemo(function(){return cKt({breakAll:I.breakAll,children:I.children,maxLines:I.maxLines,scaleToFit:f,style:I.style,width:I.width})},[I.breakAll,I.children,I.maxLines,f,I.style,I.width]),M=I.dx,F=I.dy,$=I.angle,L=I.className,z=I.breakAll,Q=P5e(I,nKt);if(!lc(r)||!lc(a))return null;var se=r+(rs(M)?M:0),ee=a+(rs(F)?F:0),K;switch(v){case"start":K=ZY("calc(".concat(u,")"));break;case"middle":K=ZY("calc(".concat((P.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:K=ZY("calc(".concat(P.length-1," * -").concat(l,")"));break}var re=[];if(f){var de=P[0].width,G=I.width;re.push("scale(".concat((rs(G)?G/de:1)/de,")"))}return $&&re.push("rotate(".concat($,", ").concat(se,", ").concat(ee,")")),re.length&&(Q.transform=re.join(" ")),Ie.createElement("text",Kne({},Ni(Q,!0),{x:se,y:ee,className:ca("recharts-text",L),textAnchor:g,fill:N.includes("url")?R5e:N}),P.map(function(ie,ae){var q=ie.words.join(z?"":" ");return Ie.createElement("tspan",{x:se,dy:ae===0?K:l,key:"".concat(q,"-").concat(ae)},q)}))};function Hy(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function uKt(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function kue(t){let e,n,r;t.length!==2?(e=Hy,n=(l,c)=>Hy(t(l),c),r=(l,c)=>t(l)-c):(e=t===Hy||t===uKt?t:dKt,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 dKt(){return 0}function eze(t){return t===null?NaN:+t}function*fKt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const hKt=kue(Hy),ZT=hKt.right;kue(eze).center;class L5e extends Map{constructor(e,n=xKt){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(D5e(this,e))}has(e){return super.has(D5e(this,e))}set(e,n){return super.set(pKt(this,e),n)}delete(e){return super.delete(mKt(this,e))}}function D5e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function pKt({_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 xKt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function gKt(t=Hy){if(t===Hy)return tze;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 tze(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const bKt=Math.sqrt(50),yKt=Math.sqrt(10),vKt=Math.sqrt(2);function tD(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>=bKt?10:a>=yKt?5:a>=vKt?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?tD(t,e,n*2):[l,c,u]}function Yne(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?tD(e,t,n):tD(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 Xne(t,e,n){return e=+e,t=+t,n=+n,tD(t,e,n)[2]}function Qne(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?Xne(e,t,n):Xne(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function B5e(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function $5e(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function nze(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?tze:gKt(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));nze(t,e,g,y,s)}const a=t[e];let o=n,l=r;for(d7(t,n,e),s(t[r],a)>0&&d7(t,n,r);o<l;){for(d7(t,o,l),++o,--l;s(t[o],a)<0;)++o;for(;s(t[l],a)>0;)--l}s(t[n],a)===0?d7(t,n,l):(++l,d7(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function d7(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function wKt(t,e,n){if(t=Float64Array.from(fKt(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return $5e(t);if(e>=1)return B5e(t);var r,s=(r-1)*e,a=Math.floor(s),o=B5e(nze(t,a).subarray(0,a+1)),l=$5e(t.subarray(a+1));return o+(l-o)*(s-a)}}function CKt(t,e,n=eze){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 SKt(t,e,n){t=+t,e=+e,n=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((e-t)/n))|0,a=new Array(s);++r<s;)a[r]=t+r*n;return a}function Sp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function H1(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Zne=Symbol("implicit");function Tue(){var t=new L5e,e=[],n=[],r=Zne;function s(a){let o=t.get(a);if(o===void 0){if(r!==Zne)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 L5e;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 Tue(e,n).unknown(r)},Sp.apply(s,arguments),s}function XE(){var t=Tue().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=SKt(x).map(function(N){return y+a*N});return n(g?C.reverse():C)}return t.domain=function(x){return arguments.length?(e(x),f()):e()},t.range=function(x){return arguments.length?([r,s]=x,r=+r,s=+s,f()):[r,s]},t.rangeRound=function(x){return[r,s]=x,r=+r,s=+s,l=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(x){return arguments.length?(l=!!x,f()):l},t.padding=function(x){return arguments.length?(c=Math.min(1,u=+x),f()):c},t.paddingInner=function(x){return arguments.length?(c=Math.min(1,x),f()):c},t.paddingOuter=function(x){return arguments.length?(u=+x,f()):u},t.align=function(x){return arguments.length?(d=Math.max(0,Math.min(1,x)),f()):d},t.copy=function(){return XE(e(),[r,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Sp.apply(f(),arguments)}function rze(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return rze(e())},t}function B9(){return rze(XE.apply(null,arguments).paddingInner(1))}function Iue(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function sze(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function JT(){}var QE=.7,nD=1/QE,D4="\\s*([+-]?\\d+)\\s*",ZE="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Q0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NKt=/^#([0-9a-f]{3,8})$/,jKt=new RegExp(`^rgb\\(${D4},${D4},${D4}\\)$`),AKt=new RegExp(`^rgb\\(${Q0},${Q0},${Q0}\\)$`),_Kt=new RegExp(`^rgba\\(${D4},${D4},${D4},${ZE}\\)$`),EKt=new RegExp(`^rgba\\(${Q0},${Q0},${Q0},${ZE}\\)$`),kKt=new RegExp(`^hsl\\(${ZE},${Q0},${Q0}\\)$`),TKt=new RegExp(`^hsla\\(${ZE},${Q0},${Q0},${ZE}\\)$`),U5e={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};Iue(JT,JE,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:z5e,formatHex:z5e,formatHex8:IKt,formatHsl:PKt,formatRgb:H5e,toString:H5e});function z5e(){return this.rgb().formatHex()}function IKt(){return this.rgb().formatHex8()}function PKt(){return ize(this).formatHsl()}function H5e(){return this.rgb().formatRgb()}function JE(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=NKt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?V5e(e):n===3?new lf(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?gF(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?gF(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=jKt.exec(t))?new lf(e[1],e[2],e[3],1):(e=AKt.exec(t))?new lf(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=_Kt.exec(t))?gF(e[1],e[2],e[3],e[4]):(e=EKt.exec(t))?gF(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=kKt.exec(t))?G5e(e[1],e[2]/100,e[3]/100,1):(e=TKt.exec(t))?G5e(e[1],e[2]/100,e[3]/100,e[4]):U5e.hasOwnProperty(t)?V5e(U5e[t]):t==="transparent"?new lf(NaN,NaN,NaN,0):null}function V5e(t){return new lf(t>>16&255,t>>8&255,t&255,1)}function gF(t,e,n,r){return r<=0&&(t=e=n=NaN),new lf(t,e,n,r)}function FKt(t){return t instanceof JT||(t=JE(t)),t?(t=t.rgb(),new lf(t.r,t.g,t.b,t.opacity)):new lf}function Jne(t,e,n,r){return arguments.length===1?FKt(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}Iue(lf,Jne,sze(JT,{brighter(t){return t=t==null?nD:Math.pow(nD,t),new lf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?QE:Math.pow(QE,t),new lf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lf(A3(this.r),A3(this.g),A3(this.b),rD(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:W5e,formatHex:W5e,formatHex8:OKt,formatRgb:q5e,toString:q5e}));function W5e(){return`#${Sw(this.r)}${Sw(this.g)}${Sw(this.b)}`}function OKt(){return`#${Sw(this.r)}${Sw(this.g)}${Sw(this.b)}${Sw((isNaN(this.opacity)?1:this.opacity)*255)}`}function q5e(){const t=rD(this.opacity);return`${t===1?"rgb(":"rgba("}${A3(this.r)}, ${A3(this.g)}, ${A3(this.b)}${t===1?")":`, ${t})`}`}function rD(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function A3(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Sw(t){return t=A3(t),(t<16?"0":"")+t.toString(16)}function G5e(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 ize(t){if(t instanceof hm)return new hm(t.h,t.s,t.l,t.opacity);if(t instanceof JT||(t=JE(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 MKt(t,e,n,r){return arguments.length===1?ize(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}Iue(hm,MKt,sze(JT,{brighter(t){return t=t==null?nD:Math.pow(nD,t),new hm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?QE:Math.pow(QE,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(JY(t>=240?t-240:t+120,s,r),JY(t,s,r),JY(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new hm(K5e(this.h),bF(this.s),bF(this.l),rD(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=rD(this.opacity);return`${t===1?"hsl(":"hsla("}${K5e(this.h)}, ${bF(this.s)*100}%, ${bF(this.l)*100}%${t===1?")":`, ${t})`}`}}));function K5e(t){return t=(t||0)%360,t<0?t+360:t}function bF(t){return Math.max(0,Math.min(1,t||0))}function JY(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 Pue=t=>()=>t;function RKt(t,e){return function(n){return t+n*e}}function LKt(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 DKt(t){return(t=+t)==1?aze:function(e,n){return n-e?LKt(e,n,t):Pue(isNaN(e)?n:e)}}function aze(t,e){var n=e-t;return n?RKt(t,n):Pue(isNaN(t)?e:t)}const Y5e=function t(e){var n=DKt(e);function r(s,a){var o=n((s=Jne(s)).r,(a=Jne(a)).r),l=n(s.g,a.g),c=n(s.b,a.b),u=aze(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 BKt(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 $Kt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function UKt(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]=_8(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 zKt(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function sD(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function HKt(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]=_8(t[s],e[s]):r[s]=e[s];return function(a){for(s in n)r[s]=n[s](a);return r}}var ere=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eX=new RegExp(ere.source,"g");function VKt(t){return function(){return t}}function WKt(t){return function(e){return t(e)+""}}function qKt(t,e){var n=ere.lastIndex=eX.lastIndex=0,r,s,a,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=ere.exec(t))&&(s=eX.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:sD(r,s)})),n=eX.lastIndex;return n<e.length&&(a=e.slice(n),l[o]?l[o]+=a:l[++o]=a),l.length<2?c[0]?WKt(c[0].x):VKt(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 _8(t,e){var n=typeof e,r;return e==null||n==="boolean"?Pue(e):(n==="number"?sD:n==="string"?(r=JE(e))?(e=r,Y5e):qKt:e instanceof JE?Y5e:e instanceof Date?zKt:$Kt(e)?BKt:Array.isArray(e)?UKt:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?HKt:sD)(t,e)}function Fue(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function GKt(t,e){e===void 0&&(e=t,t=_8);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 KKt(t){return function(){return t}}function iD(t){return+t}var X5e=[0,1];function md(t){return t}function tre(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:KKt(isNaN(e)?NaN:.5)}function YKt(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function XKt(t,e,n){var r=t[0],s=t[1],a=e[0],o=e[1];return s<r?(r=tre(s,r),a=n(o,a)):(r=tre(r,s),a=n(a,o)),function(l){return a(r(l))}}function QKt(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)s[o]=tre(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(l){var c=ZT(t,l,1,r)-1;return a[c](s[c](l))}}function eI(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function qU(){var t=X5e,e=X5e,n=_8,r,s,a,o=md,l,c,u;function d(){var x=Math.min(t.length,e.length);return o!==md&&(o=YKt(t[0],t[x-1])),l=x>2?QKt:XKt,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),sD)))(x)))},f.domain=function(x){return arguments.length?(t=Array.from(x,iD),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=Fue,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 Oue(){return qU()(md,md)}function ZKt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function aD(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 QN(t){return t=aD(Math.abs(t)),t?t[1]:NaN}function JKt(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 eYt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var tYt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ek(t){if(!(e=tYt.exec(t)))throw new Error("invalid format: "+t);var e;return new Mue({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]})}ek.prototype=Mue.prototype;function Mue(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+""}Mue.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 nYt(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 oze;function rYt(t,e){var n=aD(t,e);if(!n)return t+"";var r=n[0],s=n[1],a=s-(oze=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")+aD(t,Math.max(0,e+a-1))[0]}function Q5e(t,e){var n=aD(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 Z5e={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ZKt,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)=>Q5e(t*100,e),r:Q5e,s:rYt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function J5e(t){return t}var e6e=Array.prototype.map,t6e=["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?J5e:JKt(e6e.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?J5e:eYt(e6e.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=ek(f);var x=f.fill,g=f.align,y=f.sign,v=f.symbol,C=f.zero,N=f.width,I=f.comma,P=f.precision,M=f.trim,F=f.type;F==="n"?(I=!0,F="g"):Z5e[F]||(P===void 0&&(P=12),M=!0,F="g"),(C||x==="0"&&g==="=")&&(C=!0,x="0",g="=");var $=v==="$"?n:v==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",L=v==="$"?r:/[%p]/.test(F)?o:"",z=Z5e[F],Q=/[defgprs%]/.test(F);P=P===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function se(ee){var K=$,re=L,de,G,ie;if(F==="c")re=z(ee)+re,ee="";else{ee=+ee;var ae=ee<0||1/ee<0;if(ee=isNaN(ee)?c:z(Math.abs(ee),P),M&&(ee=nYt(ee)),ae&&+ee==0&&y!=="+"&&(ae=!1),K=(ae?y==="("?y:l:y==="-"||y==="("?"":y)+K,re=(F==="s"?t6e[8+oze/3]:"")+re+(ae&&y==="("?")":""),Q){for(de=-1,G=ee.length;++de<G;)if(ie=ee.charCodeAt(de),48>ie||ie>57){re=(ie===46?s+ee.slice(de+1):ee.slice(de))+re,ee=ee.slice(0,de);break}}}I&&!C&&(ee=e(ee,1/0));var q=K.length+ee.length+re.length,W=q<N?new Array(N-q+1).join(x):"";switch(I&&C&&(ee=e(W+ee,W.length?N-re.length:1/0),W=""),g){case"<":ee=K+ee+re+W;break;case"=":ee=K+W+ee+re;break;case"^":ee=W.slice(0,q=W.length>>1)+K+ee+re+W.slice(q);break;default:ee=W+K+ee+re;break}return a(ee)}return se.toString=function(){return f+""},se}function d(f,x){var g=u((f=ek(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(QN(x)/3)))*3,v=Math.pow(10,-y),C=t6e[8+y/3];return function(N){return g(v*N)+C}}return{format:u,formatPrefix:d}}var yF,Rue,lze;iYt({thousands:",",grouping:[3],currency:["$",""]});function iYt(t){return yF=sYt(t),Rue=yF.format,lze=yF.formatPrefix,yF}function aYt(t){return Math.max(0,-QN(Math.abs(t)))}function oYt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(QN(e)/3)))*3-QN(Math.abs(t)))}function lYt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,QN(e)-QN(t))+1}function cze(t,e,n,r){var s=Qne(t,e,n),a;switch(r=ek(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=oYt(s,o))&&(r.precision=a),lze(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=lYt(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 Rue(r)}function M2(t){var e=t.domain;return t.ticks=function(n){var r=e();return Yne(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return cze(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=Xne(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 oD(){var t=Oue();return t.copy=function(){return eI(t,oD())},Sp.apply(t,arguments),M2(t)}function uze(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,iD),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return uze(t).unknown(e)},t=arguments.length?Array.from(t,iD):[0,1],M2(n)}function dze(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 n6e(t){return Math.log(t)}function r6e(t){return Math.exp(t)}function cYt(t){return-Math.log(-t)}function uYt(t){return-Math.exp(-t)}function dYt(t){return isFinite(t)?+("1e"+t):t<0?0:t}function fYt(t){return t===10?dYt:t===Math.E?Math.exp:e=>Math.pow(t,e)}function hYt(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 s6e(t){return(e,n)=>-t(-e,n)}function Lue(t){const e=t(n6e,r6e),n=e.domain;let r=10,s,a;function o(){return s=hYt(r),a=fYt(r),n()[0]<0?(s=s6e(s),a=s6e(a),t(cYt,uYt)):t(n6e,r6e),e}return e.base=function(l){return arguments.length?(r=+l,o()):r},e.domain=function(l){return arguments.length?(n(l),o()):n()},e.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let x=s(u),g=s(d),y,v;const C=l==null?10:+l;let N=[];if(!(r%1)&&g-x<C){if(x=Math.floor(x),g=Math.ceil(g),u>0){for(;x<=g;++x)for(y=1;y<r;++y)if(v=x<0?y/a(-x):y*a(x),!(v<u)){if(v>d)break;N.push(v)}}else for(;x<=g;++x)for(y=r-1;y>=1;--y)if(v=x>0?y/a(-x):y*a(x),!(v<u)){if(v>d)break;N.push(v)}N.length*2<C&&(N=Yne(u,d,C))}else N=Yne(x,g,Math.min(g-x,C)).map(a);return f?N.reverse():N},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=ek(c)).precision==null&&(c.trim=!0),c=Rue(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(dze(n(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),e}function fze(){const t=Lue(qU()).domain([1,10]);return t.copy=()=>eI(t,fze()).base(t.base()),Sp.apply(t,arguments),t}function i6e(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function a6e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Due(t){var e=1,n=t(i6e(e),a6e(e));return n.constant=function(r){return arguments.length?t(i6e(e=+r),a6e(e)):e},M2(n)}function hze(){var t=Due(qU());return t.copy=function(){return eI(t,hze()).constant(t.constant())},Sp.apply(t,arguments)}function o6e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function pYt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function mYt(t){return t<0?-t*t:t*t}function Bue(t){var e=t(md,md),n=1;function r(){return n===1?t(md,md):n===.5?t(pYt,mYt):t(o6e(n),o6e(1/n))}return e.exponent=function(s){return arguments.length?(n=+s,r()):n},M2(e)}function $ue(){var t=Bue(qU());return t.copy=function(){return eI(t,$ue()).exponent(t.exponent())},Sp.apply(t,arguments),t}function xYt(){return $ue.apply(null,arguments).exponent(.5)}function l6e(t){return Math.sign(t)*t*t}function gYt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function pze(){var t=Oue(),e=[0,1],n=!1,r;function s(a){var o=gYt(t(a));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(a){return t.invert(l6e(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,iD)).map(l6e)),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 pze(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Sp.apply(s,arguments),M2(s)}function mze(){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]=CKt(t,o/l);return a}function a(o){return o==null||isNaN(o=+o)?r:e[ZT(n,o)]}return a.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(Hy),s()},a.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},a.unknown=function(o){return arguments.length?(r=o,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return mze().domain(t).range(e).unknown(r)},Sp.apply(a,arguments)}function xze(){var t=0,e=1,n=1,r=[.5],s=[0,1],a;function o(c){return c!=null&&c<=c?s[ZT(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 xze().domain([t,e]).range(s).unknown(a)},Sp.apply(M2(o),arguments)}function gze(){var t=[.5],e=[0,1],n,r=1;function s(a){return a!=null&&a<=a?e[ZT(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 gze().domain(t).range(e).unknown(n)},Sp.apply(s,arguments)}const tX=new Date,nX=new Date;function hc(t,e,n,r){function s(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(t(a=new Date(+a)),a),s.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),s.round=a=>{const o=s(a),l=s.ceil(a);return a-o<l-a?o:l},s.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),s.range=(a,o,l)=>{const c=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a<o)||!(l>0))return c;let u;do c.push(u=new Date(+a)),e(a,l),t(a);while(u<a&&a<o);return c},s.filter=a=>hc(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!a(o););else for(;--l>=0;)for(;e(o,1),!a(o););}),n&&(s.count=(a,o)=>(tX.setTime(+a),nX.setTime(+o),t(tX),t(nX),Math.floor(n(tX,nX))),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 lD=hc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);lD.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?hc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):lD);lD.range;const qg=1e3,op=qg*60,Gg=op*60,_1=Gg*24,Uue=_1*7,c6e=_1*30,rX=_1*365,Nw=hc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*qg)},(t,e)=>(e-t)/qg,t=>t.getUTCSeconds());Nw.range;const zue=hc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*qg)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getMinutes());zue.range;const Hue=hc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getUTCMinutes());Hue.range;const Vue=hc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*qg-t.getMinutes()*op)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getHours());Vue.range;const Wue=hc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getUTCHours());Wue.range;const tI=hc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*op)/_1,t=>t.getDate()-1);tI.range;const GU=hc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/_1,t=>t.getUTCDate()-1);GU.range;const bze=hc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/_1,t=>Math.floor(t/_1));bze.range;function V5(t){return hc(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*op)/Uue)}const KU=V5(0),cD=V5(1),bYt=V5(2),yYt=V5(3),ZN=V5(4),vYt=V5(5),wYt=V5(6);KU.range;cD.range;bYt.range;yYt.range;ZN.range;vYt.range;wYt.range;function W5(t){return hc(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Uue)}const YU=W5(0),uD=W5(1),CYt=W5(2),SYt=W5(3),JN=W5(4),NYt=W5(5),jYt=W5(6);YU.range;uD.range;CYt.range;SYt.range;JN.range;NYt.range;jYt.range;const que=hc(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());que.range;const Gue=hc(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Gue.range;const E1=hc(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());E1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:hc(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});E1.range;const k1=hc(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());k1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:hc(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});k1.range;function yze(t,e,n,r,s,a){const o=[[Nw,1,qg],[Nw,5,5*qg],[Nw,15,15*qg],[Nw,30,30*qg],[a,1,op],[a,5,5*op],[a,15,15*op],[a,30,30*op],[s,1,Gg],[s,3,3*Gg],[s,6,6*Gg],[s,12,12*Gg],[r,1,_1],[r,2,2*_1],[n,1,Uue],[e,1,c6e],[e,3,3*c6e],[t,1,rX]];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=kue(([,,C])=>C).right(o,x);if(g===o.length)return t.every(Qne(u/rX,d/rX,f));if(g===0)return lD.every(Math.max(Qne(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[AYt,_Yt]=yze(k1,Gue,YU,bze,Wue,Hue),[EYt,kYt]=yze(E1,que,KU,tI,Vue,zue);function sX(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 iX(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 f7(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function TYt(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=h7(s),d=p7(s),f=h7(a),x=p7(a),g=h7(o),y=p7(o),v=h7(l),C=p7(l),N=h7(c),I=p7(c),P={a:ae,A:q,b:W,B:ne,c:null,d:m6e,e:m6e,f:JYt,g:cXt,G:dXt,H:XYt,I:QYt,j:ZYt,L:vze,m:eXt,M:tXt,p:oe,q:he,Q:b6e,s:y6e,S:nXt,u:rXt,U:sXt,V:iXt,w:aXt,W:oXt,x:null,X:null,y:lXt,Y:uXt,Z:fXt,"%":g6e},M={a:_e,A:xe,b:Se,B:ge,c:null,d:x6e,e:x6e,f:xXt,g:AXt,G:EXt,H:hXt,I:pXt,j:mXt,L:Cze,m:gXt,M:bXt,p:Ce,q:je,Q:b6e,s:y6e,S:yXt,u:vXt,U:wXt,V:CXt,w:SXt,W:NXt,x:null,X:null,y:jXt,Y:_Xt,Z:kXt,"%":g6e},F={a:se,A:ee,b:K,B:re,c:de,d:h6e,e:h6e,f:qYt,g:f6e,G:d6e,H:p6e,I:p6e,j:zYt,L:WYt,m:UYt,M:HYt,p:Q,q:$Yt,Q:KYt,s:YYt,S:VYt,u:MYt,U:RYt,V:LYt,w:OYt,W:DYt,x:G,X:ie,y:f6e,Y:d6e,Z:BYt,"%":GYt};P.x=$(n,P),P.X=$(r,P),P.c=$(e,P),M.x=$(n,M),M.X=$(r,M),M.c=$(e,M);function $(Oe,$e){return function(Ye){var Je=[],ht=-1,rt=0,st=Oe.length,He,Ve,bt;for(Ye instanceof Date||(Ye=new Date(+Ye));++ht<st;)Oe.charCodeAt(ht)===37&&(Je.push(Oe.slice(rt,ht)),(Ve=u6e[He=Oe.charAt(++ht)])!=null?He=Oe.charAt(++ht):Ve=He==="e"?" ":"0",(bt=$e[He])&&(He=bt(Ye,Ve)),Je.push(He),rt=ht+1);return Je.push(Oe.slice(rt,ht)),Je.join("")}}function L(Oe,$e){return function(Ye){var Je=f7(1900,void 0,1),ht=z(Je,Oe,Ye+="",0),rt,st;if(ht!=Ye.length)return null;if("Q"in Je)return new Date(Je.Q);if("s"in Je)return new Date(Je.s*1e3+("L"in Je?Je.L:0));if($e&&!("Z"in Je)&&(Je.Z=0),"p"in Je&&(Je.H=Je.H%12+Je.p*12),Je.m===void 0&&(Je.m="q"in Je?Je.q:0),"V"in Je){if(Je.V<1||Je.V>53)return null;"w"in Je||(Je.w=1),"Z"in Je?(rt=iX(f7(Je.y,0,1)),st=rt.getUTCDay(),rt=st>4||st===0?uD.ceil(rt):uD(rt),rt=GU.offset(rt,(Je.V-1)*7),Je.y=rt.getUTCFullYear(),Je.m=rt.getUTCMonth(),Je.d=rt.getUTCDate()+(Je.w+6)%7):(rt=sX(f7(Je.y,0,1)),st=rt.getDay(),rt=st>4||st===0?cD.ceil(rt):cD(rt),rt=tI.offset(rt,(Je.V-1)*7),Je.y=rt.getFullYear(),Je.m=rt.getMonth(),Je.d=rt.getDate()+(Je.w+6)%7)}else("W"in Je||"U"in Je)&&("w"in Je||(Je.w="u"in Je?Je.u%7:"W"in Je?1:0),st="Z"in Je?iX(f7(Je.y,0,1)).getUTCDay():sX(f7(Je.y,0,1)).getDay(),Je.m=0,Je.d="W"in Je?(Je.w+6)%7+Je.W*7-(st+5)%7:Je.w+Je.U*7-(st+6)%7);return"Z"in Je?(Je.H+=Je.Z/100|0,Je.M+=Je.Z%100,iX(Je)):sX(Je)}}function z(Oe,$e,Ye,Je){for(var ht=0,rt=$e.length,st=Ye.length,He,Ve;ht<rt;){if(Je>=st)return-1;if(He=$e.charCodeAt(ht++),He===37){if(He=$e.charAt(ht++),Ve=F[He in u6e?$e.charAt(ht++):He],!Ve||(Je=Ve(Oe,Ye,Je))<0)return-1}else if(He!=Ye.charCodeAt(Je++))return-1}return Je}function Q(Oe,$e,Ye){var Je=u.exec($e.slice(Ye));return Je?(Oe.p=d.get(Je[0].toLowerCase()),Ye+Je[0].length):-1}function se(Oe,$e,Ye){var Je=g.exec($e.slice(Ye));return Je?(Oe.w=y.get(Je[0].toLowerCase()),Ye+Je[0].length):-1}function ee(Oe,$e,Ye){var Je=f.exec($e.slice(Ye));return Je?(Oe.w=x.get(Je[0].toLowerCase()),Ye+Je[0].length):-1}function K(Oe,$e,Ye){var Je=N.exec($e.slice(Ye));return Je?(Oe.m=I.get(Je[0].toLowerCase()),Ye+Je[0].length):-1}function re(Oe,$e,Ye){var Je=v.exec($e.slice(Ye));return Je?(Oe.m=C.get(Je[0].toLowerCase()),Ye+Je[0].length):-1}function de(Oe,$e,Ye){return z(Oe,e,$e,Ye)}function G(Oe,$e,Ye){return z(Oe,n,$e,Ye)}function ie(Oe,$e,Ye){return z(Oe,r,$e,Ye)}function ae(Oe){return o[Oe.getDay()]}function q(Oe){return a[Oe.getDay()]}function W(Oe){return c[Oe.getMonth()]}function ne(Oe){return l[Oe.getMonth()]}function oe(Oe){return s[+(Oe.getHours()>=12)]}function he(Oe){return 1+~~(Oe.getMonth()/3)}function _e(Oe){return o[Oe.getUTCDay()]}function xe(Oe){return a[Oe.getUTCDay()]}function Se(Oe){return c[Oe.getUTCMonth()]}function ge(Oe){return l[Oe.getUTCMonth()]}function Ce(Oe){return s[+(Oe.getUTCHours()>=12)]}function je(Oe){return 1+~~(Oe.getUTCMonth()/3)}return{format:function(Oe){var $e=$(Oe+="",P);return $e.toString=function(){return Oe},$e},parse:function(Oe){var $e=L(Oe+="",!1);return $e.toString=function(){return Oe},$e},utcFormat:function(Oe){var $e=$(Oe+="",M);return $e.toString=function(){return Oe},$e},utcParse:function(Oe){var $e=L(Oe+="",!0);return $e.toString=function(){return Oe},$e}}}var u6e={"-":"",_:" ",0:"0"},zc=/^\s*\d+/,IYt=/^%/,PYt=/[\\^$*+?|[\]().{}]/g;function va(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 FYt(t){return t.replace(PYt,"\\$&")}function h7(t){return new RegExp("^(?:"+t.map(FYt).join("|")+")","i")}function p7(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function OYt(t,e,n){var r=zc.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function MYt(t,e,n){var r=zc.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function RYt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function LYt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function DYt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function d6e(t,e,n){var r=zc.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function f6e(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 BYt(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 $Yt(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 UYt(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 h6e(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zYt(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 p6e(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function HYt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function VYt(t,e,n){var r=zc.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function WYt(t,e,n){var r=zc.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function qYt(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 GYt(t,e,n){var r=IYt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function KYt(t,e,n){var r=zc.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function YYt(t,e,n){var r=zc.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function m6e(t,e){return va(t.getDate(),e,2)}function XYt(t,e){return va(t.getHours(),e,2)}function QYt(t,e){return va(t.getHours()%12||12,e,2)}function ZYt(t,e){return va(1+tI.count(E1(t),t),e,3)}function vze(t,e){return va(t.getMilliseconds(),e,3)}function JYt(t,e){return vze(t,e)+"000"}function eXt(t,e){return va(t.getMonth()+1,e,2)}function tXt(t,e){return va(t.getMinutes(),e,2)}function nXt(t,e){return va(t.getSeconds(),e,2)}function rXt(t){var e=t.getDay();return e===0?7:e}function sXt(t,e){return va(KU.count(E1(t)-1,t),e,2)}function wze(t){var e=t.getDay();return e>=4||e===0?ZN(t):ZN.ceil(t)}function iXt(t,e){return t=wze(t),va(ZN.count(E1(t),t)+(E1(t).getDay()===4),e,2)}function aXt(t){return t.getDay()}function oXt(t,e){return va(cD.count(E1(t)-1,t),e,2)}function lXt(t,e){return va(t.getFullYear()%100,e,2)}function cXt(t,e){return t=wze(t),va(t.getFullYear()%100,e,2)}function uXt(t,e){return va(t.getFullYear()%1e4,e,4)}function dXt(t,e){var n=t.getDay();return t=n>=4||n===0?ZN(t):ZN.ceil(t),va(t.getFullYear()%1e4,e,4)}function fXt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+va(e/60|0,"0",2)+va(e%60,"0",2)}function x6e(t,e){return va(t.getUTCDate(),e,2)}function hXt(t,e){return va(t.getUTCHours(),e,2)}function pXt(t,e){return va(t.getUTCHours()%12||12,e,2)}function mXt(t,e){return va(1+GU.count(k1(t),t),e,3)}function Cze(t,e){return va(t.getUTCMilliseconds(),e,3)}function xXt(t,e){return Cze(t,e)+"000"}function gXt(t,e){return va(t.getUTCMonth()+1,e,2)}function bXt(t,e){return va(t.getUTCMinutes(),e,2)}function yXt(t,e){return va(t.getUTCSeconds(),e,2)}function vXt(t){var e=t.getUTCDay();return e===0?7:e}function wXt(t,e){return va(YU.count(k1(t)-1,t),e,2)}function Sze(t){var e=t.getUTCDay();return e>=4||e===0?JN(t):JN.ceil(t)}function CXt(t,e){return t=Sze(t),va(JN.count(k1(t),t)+(k1(t).getUTCDay()===4),e,2)}function SXt(t){return t.getUTCDay()}function NXt(t,e){return va(uD.count(k1(t)-1,t),e,2)}function jXt(t,e){return va(t.getUTCFullYear()%100,e,2)}function AXt(t,e){return t=Sze(t),va(t.getUTCFullYear()%100,e,2)}function _Xt(t,e){return va(t.getUTCFullYear()%1e4,e,4)}function EXt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?JN(t):JN.ceil(t),va(t.getUTCFullYear()%1e4,e,4)}function kXt(){return"+0000"}function g6e(){return"%"}function b6e(t){return+t}function y6e(t){return Math.floor(+t/1e3)}var CC,Nze,jze;TXt({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 TXt(t){return CC=TYt(t),Nze=CC.format,CC.parse,jze=CC.utcFormat,CC.utcParse,CC}function IXt(t){return new Date(t)}function PXt(t){return t instanceof Date?+t:+new Date(+t)}function Kue(t,e,n,r,s,a,o,l,c,u){var d=Oue(),f=d.invert,x=d.domain,g=u(".%L"),y=u(":%S"),v=u("%I:%M"),C=u("%I %p"),N=u("%a %d"),I=u("%b %d"),P=u("%B"),M=u("%Y");function F($){return(c($)<$?g:l($)<$?y:o($)<$?v:a($)<$?C:r($)<$?s($)<$?N:I:n($)<$?P:M)($)}return d.invert=function($){return new Date(f($))},d.domain=function($){return arguments.length?x(Array.from($,PXt)):x().map(IXt)},d.ticks=function($){var L=x();return t(L[0],L[L.length-1],$??10)},d.tickFormat=function($,L){return L==null?F:u(L)},d.nice=function($){var L=x();return(!$||typeof $.range!="function")&&($=e(L[0],L[L.length-1],$??10)),$?x(dze(L,$)):d},d.copy=function(){return eI(d,Kue(t,e,n,r,s,a,o,l,c,u))},d}function FXt(){return Sp.apply(Kue(EYt,kYt,E1,que,KU,tI,Vue,zue,Nw,Nze).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function OXt(){return Sp.apply(Kue(AYt,_Yt,k1,Gue,YU,GU,Wue,Hue,Nw,jze).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function XU(){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(_8),u.rangeRound=d(Fue),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,n=f(t),r=f(e),s=n===r?0:1/(r-n),u}}function R2(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Aze(){var t=M2(XU()(md));return t.copy=function(){return R2(t,Aze())},H1.apply(t,arguments)}function _ze(){var t=Lue(XU()).domain([1,10]);return t.copy=function(){return R2(t,_ze()).base(t.base())},H1.apply(t,arguments)}function Eze(){var t=Due(XU());return t.copy=function(){return R2(t,Eze()).constant(t.constant())},H1.apply(t,arguments)}function Yue(){var t=Bue(XU());return t.copy=function(){return R2(t,Yue()).exponent(t.exponent())},H1.apply(t,arguments)}function MXt(){return Yue.apply(null,arguments).exponent(.5)}function kze(){var t=[],e=md;function n(r){if(r!=null&&!isNaN(r=+r))return e((ZT(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let s of r)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Hy),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,s)=>e(s/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,a)=>wKt(t,a/r))},n.copy=function(){return kze(e).domain(t)},H1.apply(n,arguments)}function QU(){var t=0,e=.5,n=1,r=1,s,a,o,l,c,u=md,d,f=!1,x;function g(v){return isNaN(v=+v)?x:(v=.5+((v=+d(v))-a)*(r*v<r*a?l:c),u(f?Math.max(0,Math.min(1,v)):v))}g.domain=function(v){return arguments.length?([t,e,n]=v,s=d(t=+t),a=d(e=+e),o=d(n=+n),l=s===a?0:.5/(a-s),c=a===o?0:.5/(o-a),r=a<s?-1:1,g):[t,e,n]},g.clamp=function(v){return arguments.length?(f=!!v,g):f},g.interpolator=function(v){return arguments.length?(u=v,g):u};function y(v){return function(C){var N,I,P;return arguments.length?([N,I,P]=C,u=GKt(v,[N,I,P]),g):[u(0),u(.5),u(1)]}}return g.range=y(_8),g.rangeRound=y(Fue),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 Tze(){var t=M2(QU()(md));return t.copy=function(){return R2(t,Tze())},H1.apply(t,arguments)}function Ize(){var t=Lue(QU()).domain([.1,1,10]);return t.copy=function(){return R2(t,Ize()).base(t.base())},H1.apply(t,arguments)}function Pze(){var t=Due(QU());return t.copy=function(){return R2(t,Pze()).constant(t.constant())},H1.apply(t,arguments)}function Xue(){var t=Bue(QU());return t.copy=function(){return R2(t,Xue()).exponent(t.exponent())},H1.apply(t,arguments)}function RXt(){return Xue.apply(null,arguments).exponent(.5)}const v6e=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:XE,scaleDiverging:Tze,scaleDivergingLog:Ize,scaleDivergingPow:Xue,scaleDivergingSqrt:RXt,scaleDivergingSymlog:Pze,scaleIdentity:uze,scaleImplicit:Zne,scaleLinear:oD,scaleLog:fze,scaleOrdinal:Tue,scalePoint:B9,scalePow:$ue,scaleQuantile:mze,scaleQuantize:xze,scaleRadial:pze,scaleSequential:Aze,scaleSequentialLog:_ze,scaleSequentialPow:Yue,scaleSequentialQuantile:kze,scaleSequentialSqrt:MXt,scaleSequentialSymlog:Eze,scaleSqrt:xYt,scaleSymlog:hze,scaleThreshold:gze,scaleTime:FXt,scaleUtc:OXt,tickFormat:cze},Symbol.toStringTag,{value:"Module"}));var aX,w6e;function Fze(){if(w6e)return aX;w6e=1;var t=S8();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 aX=e,aX}var oX,C6e;function LXt(){if(C6e)return oX;C6e=1;function t(e,n){return e>n}return oX=t,oX}var lX,S6e;function DXt(){if(S6e)return lX;S6e=1;var t=Fze(),e=LXt(),n=A8();function r(s){return s&&s.length?t(s,n,e):void 0}return lX=r,lX}var BXt=DXt();const Ty=Ti(BXt);var cX,N6e;function $Xt(){if(N6e)return cX;N6e=1;function t(e,n){return e<n}return cX=t,cX}var uX,j6e;function UXt(){if(j6e)return uX;j6e=1;var t=Fze(),e=$Xt(),n=A8();function r(s){return s&&s.length?t(s,n,e):void 0}return uX=r,uX}var zXt=UXt();const ZU=Ti(zXt);var dX,A6e;function HXt(){if(A6e)return dX;A6e=1;var t=fue(),e=O2(),n=$Ue(),r=Cf();function s(a,o){var l=r(a)?t:n;return l(a,e(o,3))}return dX=s,dX}var fX,_6e;function VXt(){if(_6e)return fX;_6e=1;var t=DUe(),e=HXt();function n(r,s){return t(e(r,s),1)}return fX=n,fX}var WXt=VXt();const qXt=Ti(WXt);var hX,E6e;function GXt(){if(E6e)return hX;E6e=1;var t=Nue();function e(n,r){return t(n,r)}return hX=e,hX}var KXt=GXt();const f5=Ti(KXt);var E8=1e9,YXt={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Zue,Bo=!0,wp="[DecimalError] ",_3=wp+"Invalid argument: ",Que=wp+"Exponent out of range: ",k8=Math.floor,Yv=Math.pow,XXt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Yf,kc=1e7,jo=7,Oze=9007199254740991,dD=k8(Oze/jo),Is={};Is.absoluteValue=Is.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Is.comparedTo=Is.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};Is.decimalPlaces=Is.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*jo;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Is.dividedBy=Is.div=function(t){return c1(this,new this.constructor(t))};Is.dividedToIntegerBy=Is.idiv=function(t){var e=this,n=e.constructor;return Ja(c1(e,new n(t),0,1),n.precision)};Is.equals=Is.eq=function(t){return!this.cmp(t)};Is.exponent=function(){return Gl(this)};Is.greaterThan=Is.gt=function(t){return this.cmp(t)>0};Is.greaterThanOrEqualTo=Is.gte=function(t){return this.cmp(t)>=0};Is.isInteger=Is.isint=function(){return this.e>this.d.length-2};Is.isNegative=Is.isneg=function(){return this.s<0};Is.isPositive=Is.ispos=function(){return this.s>0};Is.isZero=function(){return this.s===0};Is.lessThan=Is.lt=function(t){return this.cmp(t)<0};Is.lessThanOrEqualTo=Is.lte=function(t){return this.cmp(t)<1};Is.logarithm=Is.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):(Bo=!1,e=c1(tk(n,a),tk(t,a),a),Bo=!0,Ja(e,s))};Is.minus=Is.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Lze(e,t):Mze(e,(t.s=-t.s,t))};Is.modulo=Is.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?(Bo=!1,e=c1(n,t,0,1).times(t),Bo=!0,n.minus(e)):Ja(new r(n),s)};Is.naturalExponential=Is.exp=function(){return Rze(this)};Is.naturalLogarithm=Is.ln=function(){return tk(this)};Is.negated=Is.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Is.plus=Is.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Mze(e,t):Lze(e,(t.s=-t.s,t))};Is.precision=Is.sd=function(t){var e,n,r,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(_3+t);if(e=Gl(s)+1,r=s.d.length-1,n=r*jo+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};Is.squareRoot=Is.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=Gl(l),Bo=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=B0(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=k8((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(a=r,r=a.plus(c1(l,a,o+2)).times(.5),B0(a.d).slice(0,o)===(e=B0(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(Ja(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(e!="9999")break;o+=4}return Bo=!0,Ja(r,n)};Is.times=Is.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,Bo?Ja(t,f.precision):t};Is.toDecimalPlaces=Is.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(mx(t,0,E8),e===void 0?e=r.rounding:mx(e,0,8),Ja(n,t+Gl(n)+1,e))};Is.toExponential=function(t,e){var n,r=this,s=r.constructor;return t===void 0?n=h5(r,!0):(mx(t,0,E8),e===void 0?e=s.rounding:mx(e,0,8),r=Ja(new s(r),t+1,e),n=h5(r,!0,t+1)),n};Is.toFixed=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?h5(s):(mx(t,0,E8),e===void 0?e=a.rounding:mx(e,0,8),r=Ja(new a(s),t+Gl(s)+1,e),n=h5(r.abs(),!1,t+Gl(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Is.toInteger=Is.toint=function(){var t=this,e=t.constructor;return Ja(new e(t),Gl(t)+1,e.rounding)};Is.toNumber=function(){return+this};Is.toPower=Is.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 Ja(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,a=l.s,o){if((n=d<0?-d:d)<=Oze){for(s=new c(Yf),e=Math.ceil(r/jo+4),Bo=!1;n%2&&(s=s.times(l),T6e(s.d,e)),n=k8(n/2),n!==0;)l=l.times(l),T6e(l.d,e);return Bo=!0,t.s<0?new c(Yf).div(s):Ja(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,Bo=!1,s=t.times(tk(l,r+u)),Bo=!0,s=Rze(s),s.s=a,s};Is.toPrecision=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?(n=Gl(s),r=h5(s,n<=a.toExpNeg||n>=a.toExpPos)):(mx(t,1,E8),e===void 0?e=a.rounding:mx(e,0,8),s=Ja(new a(s),t,e),n=Gl(s),r=h5(s,t<=n||n<=a.toExpNeg,t)),r};Is.toSignificantDigits=Is.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(mx(t,1,E8),e===void 0?e=r.rounding:mx(e,0,8)),Ja(new r(n),t,e)};Is.toString=Is.valueOf=Is.val=Is.toJSON=Is[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Gl(t),n=t.constructor;return h5(t,e<=n.toExpNeg||e>=n.toExpPos)};function Mze(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)),Bo?Ja(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/jo),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,Bo?Ja(e,f):e}function mx(t,e,n){if(t!==~~t||t<e||t>n)throw Error(_3+t)}function B0(t){var e,n,r,s=t.length-1,a="",o=t[0];if(s>0){for(a+=o,e=1;e<s;e++)r=t[e]+"",n=jo-r.length,n&&(a+=Vb(n)),a+=r;o=t[e],r=o+"",n=jo-r.length,n&&(a+=Vb(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var c1=function(){function t(r,s){var a,o=0,l=r.length;for(r=r.slice();l--;)a=r[l]*s+o,r[l]=a%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,N,I,P,M,F,$,L,z,Q=r.constructor,se=r.s==s.s?1:-1,ee=r.d,K=s.d;if(!r.s)return new Q(r);if(!s.s)throw Error(wp+"Division by zero");for(c=r.e-s.e,L=K.length,F=ee.length,g=new Q(se),y=g.d=[],u=0;K[u]==(ee[u]||0);)++u;if(K[u]>(ee[u]||0)&&--c,a==null?I=a=Q.precision:o?I=a+(Gl(r)-Gl(s))+1:I=a,I<0)return new Q(0);if(I=I/jo+2|0,u=0,L==1)for(d=0,K=K[0],I++;(u<F||d)&&I--;u++)P=d*kc+(ee[u]||0),y[u]=P/K|0,d=P%K|0;else{for(d=kc/(K[0]+1)|0,d>1&&(K=t(K,d),ee=t(ee,d),L=K.length,F=ee.length),M=L,v=ee.slice(0,L),C=v.length;C<L;)v[C++]=0;z=K.slice(),z.unshift(0),$=K[0],K[1]>=kc/2&&++$;do d=0,l=e(K,v,L,C),l<0?(N=v[0],L!=C&&(N=N*kc+(v[1]||0)),d=N/$|0,d>1?(d>=kc&&(d=kc-1),f=t(K,d),x=f.length,C=v.length,l=e(f,v,x,C),l==1&&(d--,n(f,L<x?z:K,x))):(d==0&&(l=d=1),f=K.slice()),x=f.length,x<C&&f.unshift(0),n(v,f,C),l==-1&&(C=v.length,l=e(K,v,L,C),l<1&&(d++,n(v,L<C?z:K,C))),C=v.length):l===0&&(d++,v=[0]),y[u++]=d,l&&v[0]?v[C++]=ee[M]||0:(v=[ee[M]],C=1);while((M++<F||v[0]!==void 0)&&I--)}return y[0]||y.shift(),g.e=c,Ja(g,o?a+Gl(g)+1:a)}}();function Rze(t,e){var n,r,s,a,o,l,c=0,u=0,d=t.constructor,f=d.precision;if(Gl(t)>16)throw Error(Que+Gl(t));if(!t.s)return new d(Yf);for(e==null?(Bo=!1,l=f):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(r=Math.log(Yv(2,u))/Math.LN10*2+5|0,l+=r,n=s=a=new d(Yf),d.precision=l;;){if(s=Ja(s.times(t),l),n=n.times(++c),o=a.plus(c1(s,n,l)),B0(o.d).slice(0,l)===B0(a.d).slice(0,l)){for(;u--;)a=Ja(a.times(a),l);return d.precision=f,e==null?(Bo=!0,Ja(a,f)):a}a=o}}function Gl(t){for(var e=t.e*jo,n=t.d[0];n>=10;n/=10)e++;return e}function pX(t,e,n){if(e>t.LN10.sd())throw Bo=!0,n&&(t.precision=n),Error(wp+"LN10 precision limit exceeded");return Ja(new t(t.LN10),e)}function Vb(t){for(var e="";t--;)e+="0";return e}function tk(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?(Bo=!1,u=C):u=e,g.eq(10))return e==null&&(Bo=!0),pX(v,u);if(u+=x,v.precision=u,n=B0(y),r=n.charAt(0),a=Gl(g),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(t),n=B0(g.d),r=n.charAt(0),f++;a=Gl(g),r>1?(g=new v("0."+n),a++):g=new v(r+"."+n.slice(1))}else return c=pX(v,u+2,C).times(a+""),g=tk(new v(r+"."+n.slice(1)),u-x).plus(c),v.precision=C,e==null?(Bo=!0,Ja(g,C)):g;for(l=o=g=c1(g.minus(Yf),g.plus(Yf),u),d=Ja(g.times(g),u),s=3;;){if(o=Ja(o.times(d),u),c=l.plus(c1(o,new v(s),u)),B0(c.d).slice(0,u)===B0(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(pX(v,u+2,C).times(a+""))),l=c1(l,new v(f),u),v.precision=C,e==null?(Bo=!0,Ja(l,C)):l;l=c,s+=2}}function k6e(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=k8(n/jo),t.d=[],r=(n+1)%jo,n<0&&(r+=jo),r<s){for(r&&t.d.push(+e.slice(0,r)),s-=jo;r<s;)t.d.push(+e.slice(r,r+=jo));e=e.slice(r),r=jo-e.length}else r-=s;for(;r--;)e+="0";if(t.d.push(+e),Bo&&(t.e>dD||t.e<-dD))throw Error(Que+n)}else t.s=0,t.e=0,t.d=[0];return t}function Ja(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+=jo,s=e,u=f[d=0];else{if(d=Math.ceil((r+1)/jo),a=f.length,d>=a)return t;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=jo,s=r-jo+o}if(n!==void 0&&(a=Yv(10,o-s-1),l=u/a%10|0,c=e<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Yv(10,o-s):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(a=Gl(t),f.length=1,e=e-a-1,f[0]=Yv(10,(jo-e%jo)%jo),t.e=k8(-e/jo)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Yv(10,jo-r),f[d]=s>0?(u/Yv(10,o-s)%Yv(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(Bo&&(t.e>dD||t.e<-dD))throw Error(Que+Gl(t));return t}function Lze(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),Bo?Ja(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/jo),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,Bo?Ja(e,g):e):new x(0)}function h5(t,e,n){var r,s=Gl(t),a=B0(t.d),o=a.length;return e?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+Vb(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+Vb(-s-1)+a,n&&(r=n-o)>0&&(a+=Vb(r))):s>=o?(a+=Vb(s+1-o),n&&(r=n-s-1)>0&&(a=a+"."+Vb(r))):((r=s+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(a+="."),a+=Vb(r))),t.s<0?"-"+a:a}function T6e(t,e){if(t.length>e)return t.length=e,!0}function Dze(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(_3+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 k6e(o,a.toString())}else if(typeof a!="string")throw Error(_3+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,XXt.test(a))k6e(o,a);else throw Error(_3+a)}if(s.prototype=Is,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=Dze,s.config=s.set=QXt,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return s.config(t),s}function QXt(t){if(!t||typeof t!="object")throw Error(wp+"Object expected");var e,n,r,s=["precision",1,E8,"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(k8(r)===r&&r>=s[e+1]&&r<=s[e+2])this[n]=r;else throw Error(_3+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(_3+n+": "+r);return this}var Zue=Dze(YXt);Yf=new Zue(1);const Wa=Zue;function ZXt(t){return nQt(t)||tQt(t)||eQt(t)||JXt()}function JXt(){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 eQt(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 tQt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function nQt(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}var rQt=function(e){return e},Bze={"@@functional/placeholder":!0},$ze=function(e){return e===Bze},I6e=function(e){return function n(){return arguments.length===0||arguments.length===1&&$ze(arguments.length<=0?void 0:arguments[0])?n:e.apply(void 0,arguments)}},sQt=function t(e,n){return e===1?n:I6e(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!==Bze}).length;return o>=e?n.apply(void 0,s):t(e-o,I6e(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 $ze(f)?c.shift():f});return n.apply(void 0,ZXt(d).concat(c))}))})},JU=function(e){return sQt(e.length,e)},rre=function(e,n){for(var r=[],s=e;s<n;++s)r[s-e]=s;return r},iQt=JU(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 rQt;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))}},sre=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},Uze=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 oQt(t){var e;return t===0?e=1:e=Math.floor(new Wa(t).abs().log(10).toNumber())+1,e}function lQt(t,e,n){for(var r=new Wa(t),s=0,a=[];r.lt(e)&&s<1e5;)a.push(r.toNumber()),r=r.add(n),s++;return a}var cQt=JU(function(t,e,n){var r=+t,s=+e;return r+n*(s-r)}),uQt=JU(function(t,e,n){var r=e-+t;return r=r||1/0,(n-t)/r}),dQt=JU(function(t,e,n){var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});const ez={rangeStep:lQt,getDigitCount:oQt,interpolateNumber:cQt,uninterpolateNumber:uQt,uninterpolateTruncation:dQt};function ire(t){return pQt(t)||hQt(t)||zze(t)||fQt()}function fQt(){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 hQt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function pQt(t){if(Array.isArray(t))return are(t)}function nk(t,e){return gQt(t)||xQt(t,e)||zze(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 zze(t,e){if(t){if(typeof t=="string")return are(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 are(t,e)}}function are(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 xQt(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 gQt(t){if(Array.isArray(t))return t}function Hze(t){var e=nk(t,2),n=e[0],r=e[1],s=n,a=r;return n>r&&(s=r,a=n),[s,a]}function Vze(t,e,n){if(t.lte(0))return new Wa(0);var r=ez.getDigitCount(t.toNumber()),s=new Wa(10).pow(r),a=t.div(s),o=r!==1?.05:.1,l=new Wa(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return e?c:new Wa(Math.ceil(c))}function bQt(t,e,n){var r=1,s=new Wa(t);if(!s.isint()&&n){var a=Math.abs(t);a<1?(r=new Wa(10).pow(ez.getDigitCount(t)-1),s=new Wa(Math.floor(s.div(r).toNumber())).mul(r)):a>1&&(s=new Wa(Math.floor(t)))}else t===0?s=new Wa(Math.floor((e-1)/2)):n||(s=new Wa(Math.floor(t)));var o=Math.floor((e-1)/2),l=aQt(iQt(function(c){return s.add(new Wa(c-o).mul(r)).toNumber()}),rre);return l(0,e)}function Wze(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 Wa(0),tickMin:new Wa(0),tickMax:new Wa(0)};var a=Vze(new Wa(e).sub(t).div(n-1),r,s),o;t<=0&&e>=0?o=new Wa(0):(o=new Wa(t).add(e).div(2),o=o.sub(new Wa(o).mod(a)));var l=Math.ceil(o.sub(t).div(a).toNumber()),c=Math.ceil(new Wa(e).sub(o).div(a).toNumber()),u=l+c+1;return u>n?Wze(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 Wa(l).mul(a)),tickMax:o.add(new Wa(c).mul(a))})}function yQt(t){var e=nk(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=Hze([n,r]),c=nk(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(ire(rre(0,s-1).map(function(){return 1/0}))):[].concat(ire(rre(0,s-1).map(function(){return-1/0})),[d]);return n>r?sre(f):f}if(u===d)return bQt(u,s,a);var x=Wze(u,d,o,a),g=x.step,y=x.tickMin,v=x.tickMax,C=ez.rangeStep(y,v.add(new Wa(.1).mul(g)),g);return n>r?sre(C):C}function vQt(t,e){var n=nk(t,2),r=n[0],s=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Hze([r,s]),l=nk(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=Vze(new Wa(u).sub(c).div(d-1),a,0),x=[].concat(ire(ez.rangeStep(new Wa(c),new Wa(u).sub(new Wa(.99).mul(f)),f)),[u]);return r>s?sre(x):x}var wQt=Uze(yQt),CQt=Uze(vQt),SQt="Invariant failed";function p5(t,e){throw new Error(SQt)}var NQt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];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 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 jQt(t,e){return kQt(t)||EQt(t,e)||_Qt(t,e)||AQt()}function AQt(){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 _Qt(t,e){if(t){if(typeof t=="string")return P6e(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 P6e(t,e)}}function P6e(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 EQt(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 kQt(t){if(Array.isArray(t))return t}function TQt(t,e){if(t==null)return{};var n=IQt(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 IQt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function PQt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function FQt(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,Kze(r.key),r)}}function OQt(t,e,n){return FQt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function MQt(t,e,n){return e=hD(e),RQt(t,qze()?Reflect.construct(e,n||[],hD(t).constructor):e.apply(t,n))}function RQt(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 LQt(t)}function LQt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qze=function(){return!!t})()}function hD(t){return hD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},hD(t)}function DQt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ore(t,e)}function ore(t,e){return ore=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ore(t,e)}function Gze(t,e,n){return e=Kze(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kze(t){var e=BQt(t,"string");return ej(e)=="symbol"?e:e+""}function BQt(t,e){if(ej(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ej(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var T8=function(t){function e(){return PQt(this,e),MQt(this,e,arguments)}return DQt(e,t),OQt(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=TQt(r,NQt),g=Ni(x,!1);this.props.direction==="x"&&d.type!=="number"&&p5();var y=c.map(function(v){var C=u(v,l),N=C.x,I=C.y,P=C.value,M=C.errorVal;if(!M)return null;var F=[],$,L;if(Array.isArray(M)){var z=jQt(M,2);$=z[0],L=z[1]}else $=L=M;if(a==="vertical"){var Q=d.scale,se=I+s,ee=se+o,K=se-o,re=Q(P-$),de=Q(P+L);F.push({x1:de,y1:ee,x2:de,y2:K}),F.push({x1:re,y1:se,x2:de,y2:se}),F.push({x1:re,y1:ee,x2:re,y2:K})}else if(a==="horizontal"){var G=f.scale,ie=N+s,ae=ie-o,q=ie+o,W=G(P-$),ne=G(P+L);F.push({x1:ae,y1:ne,x2:q,y2:ne}),F.push({x1:ie,y1:W,x2:ie,y2:ne}),F.push({x1:ae,y1:W,x2:q,y2:W})}return Ie.createElement(Aa,fD({className:"recharts-errorBar",key:"bar-".concat(F.map(function(oe){return"".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))},g),F.map(function(oe){return Ie.createElement("line",fD({},oe,{key:"line-".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))}))});return Ie.createElement(Aa,{className:"recharts-errorBars"},y)}}])}(Ie.Component);Gze(T8,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Gze(T8,"displayName","ErrorBar");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 F6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function kv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?F6e(Object(n),!0).forEach(function(r){$Qt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $Qt(t,e,n){return e=UQt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UQt(t){var e=zQt(t,"string");return rk(e)=="symbol"?e:e+""}function zQt(t,e){if(rk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yze=function(e){var n=e.children,r=e.formattedGraphicalItems,s=e.legendWidth,a=e.legendContent,o=qf(n,j3);if(!o)return null;var l=j3.defaultProps,c=l!==void 0?kv(kv({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:a==="children"?u=(r||[]).reduce(function(d,f){var x=f.item,g=f.props,y=g.sectors||g.data||[];return d.concat(y.map(function(v){return{type:o.props.iconType||x.props.legendType,value:v.name,color:v.fill,payload:v}}))},[]):u=(r||[]).map(function(d){var f=d.item,x=f.type.defaultProps,g=x!==void 0?kv(kv({},x),f.props):{},y=g.dataKey,v=g.name,C=g.legendType,N=g.hide;return{inactive:N,dataKey:y,type:c.iconType||C||"square",color:Jue(f),value:v||y,payload:g}}),kv(kv(kv({},c),j3.getWithHeight(o,s)),{},{payload:u,item:o})};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 O6e(t){return qQt(t)||WQt(t)||VQt(t)||HQt()}function HQt(){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 lre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lre(t,e)}}function WQt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qQt(t){if(Array.isArray(t))return lre(t)}function lre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function al(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?M6e(Object(n),!0).forEach(function(r){B4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):M6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function B4(t,e,n){return e=GQt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GQt(t){var e=KQt(t,"string");return sk(e)=="symbol"?e:e+""}function KQt(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 cc(t,e,n){return ji(t)||ji(e)?n:lc(e)?dp(t,e,n):Ei(e)?e(t):n}function $9(t,e,n,r){var s=qXt(t,function(l){return cc(l,e)});if(n==="number"){var a=s.filter(function(l){return rs(l)||parseFloat(l)});return a.length?[ZU(a),Ty(a)]:[1/0,-1/0]}var o=r?s.filter(function(l){return!ji(l)}):s;return o.map(function(l){return lc(l)||l instanceof Date?l:""})}var YQt=function(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u<l;u++){var d=u>0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,x=u>=l-1?s[0].coordinate:s[u+1].coordinate,g=void 0;if(gm(f-d)!==gm(x-f)){var y=[];if(gm(x-f)===gm(c[1]-c[0])){g=x;var v=f+c[1]-c[0];y[0]=Math.min(v,(v+d)/2),y[1]=Math.max(v,(v+d)/2)}else{g=d;var C=x+c[1]-c[0];y[0]=Math.min(f,(C+f)/2),y[1]=Math.max(f,(C+f)/2)}var N=[Math.min(f,(g+f)/2),Math.max(f,(g+f)/2)];if(e>N[0]&&e<=N[1]||e>=y[0]&&e<=y[1]){o=s[u].index;break}}else{var I=Math.min(d,x),P=Math.max(d,x);if(e>(I+f)/2&&e<=(P+f)/2){o=s[u].index;break}}}else for(var M=0;M<l;M++)if(M===0&&e<=(r[M].coordinate+r[M+1].coordinate)/2||M>0&&M<l-1&&e>(r[M].coordinate+r[M-1].coordinate)/2&&e<=(r[M].coordinate+r[M+1].coordinate)/2||M===l-1&&e>(r[M].coordinate+r[M-1].coordinate)/2){o=r[M].index;break}return o},Jue=function(e){var n,r=e,s=r.type.displayName,a=(n=e.type)!==null&&n!==void 0&&n.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,o=a.stroke,l=a.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},XQt=function(e){var n=e.barSize,r=e.totalSize,s=e.stackGroups,a=s===void 0?{}:s;if(!a)return{};for(var o={},l=Object.keys(a),c=0,u=l.length;c<u;c++)for(var d=a[l[c]].stackGroups,f=Object.keys(d),x=0,g=f.length;x<g;x++){var y=d[f[x]],v=y.items,C=y.cateAxisId,N=v.filter(function(L){return o1(L.type).indexOf("Bar")>=0});if(N&&N.length){var I=N[0].type.defaultProps,P=I!==void 0?al(al({},I),N[0].props):N[0].props,M=P.barSize,F=P[C];o[F]||(o[F]=[]);var $=ji(M)?n:M;o[F].push({item:N[0],stackList:N.slice(1),barSize:ji($)?void 0:d5($,r,0)})}}return o},QQt=function(e){var n=e.barGap,r=e.barCategoryGap,s=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,l=e.maxBarSize,c=o.length;if(c<1)return null;var u=d5(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var x=!1,g=s/c,y=o.reduce(function(M,F){return M+F.barSize||0},0);y+=(c-1)*u,y>=s&&(y-=(c-1)*u,u=0),y>=s&&g>0&&(x=!0,g*=.9,y=c*g);var v=(s-y)/2>>0,C={offset:v-u,size:0};d=o.reduce(function(M,F){var $={item:F.item,position:{offset:C.offset+C.size+u,size:x?g:F.barSize}},L=[].concat(O6e(M),[$]);return C=L[L.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(z){L.push({item:z,position:C})}),L},f)}else{var N=d5(r,s,0,!0);s-2*N-(c-1)*u<=0&&(u=0);var I=(s-2*N-(c-1)*u)/c;I>1&&(I>>=0);var P=l===+l?Math.min(I,l):I;d=o.reduce(function(M,F,$){var L=[].concat(O6e(M),[{item:F.item,position:{offset:N+(I+u)*$+(I-P)/2,size:P}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(z){L.push({item:z,position:L[L.length-1].position})}),L},f)}return d},ZQt=function(e,n,r,s){var a=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=Yze({children:a,legendWidth:c});if(u){var d=s||{},f=d.width,x=d.height,g=u.align,y=u.verticalAlign,v=u.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&g!=="center"&&rs(e[g]))return al(al({},e),{},B4({},g,e[g]+(f||0)));if((v==="horizontal"||v==="vertical"&&g==="center")&&y!=="middle"&&rs(e[y]))return al(al({},e),{},B4({},y,e[y]+(x||0)))}return e},JQt=function(e,n,r){return ji(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},Xze=function(e,n,r,s,a){var o=n.props.children,l=pf(o,T8).filter(function(u){return JQt(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=cc(d,r);if(ji(f))return u;var x=Array.isArray(f)?[ZU(f),Ty(f)]:[f,f],g=c.reduce(function(y,v){var C=cc(d,v,0),N=x[0]-Math.abs(Array.isArray(C)?C[0]:C),I=x[1]+Math.abs(Array.isArray(C)?C[1]:C);return[Math.min(N,y[0]),Math.max(I,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},eZt=function(e,n,r,s,a){var o=n.map(function(l){return Xze(e,l,r,a,s)}).filter(function(l){return!ji(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},Qze=function(e,n,r,s,a){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&Xze(e,c,u,s)||$9(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},[])},Zze=function(e,n){return e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis"},Jze=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},Kg=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!j8(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}})},mX=new WeakMap,vF=function(e,n){if(typeof n!="function")return e;mX.has(e)||mX.set(e,new WeakMap);var r=mX.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},tZt=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:XE(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:oD(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:B9(),realScaleType:"point"}:a==="category"?{scale:XE(),realScaleType:"band"}:{scale:oD(),realScaleType:"linear"};if(u5(s)){var c="scale".concat(DU(s));return{scale:(v6e[c]||B9)(),realScaleType:v6e[c]?c:"point"}}return Ei(s)?{scale:s}:{scale:B9(),realScaleType:"point"}},R6e=1e-4,nZt=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])-R6e,o=Math.max(s[0],s[1])+R6e,l=e(n[0]),c=e(n[r-1]);(l<a||l>o||c<a||c>o)&&e.domain([n[0],n[r-1]])}},rZt=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||!rs(n[0])||!rs(n[1]))return e;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),a=[e[0],e[1]];return(!rs(e[0])||e[0]<r)&&(a[0]=r),(!rs(e[1])||e[1]>s)&&(a[1]=s),a[0]>s&&(a[0]=s),a[1]<r&&(a[1]=r),a},iZt=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=j8(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=j8(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)}},oZt={sign:iZt,expand:WVt,none:qN,silhouette:qVt,wiggle:GVt,positive:aZt},lZt=function(e,n,r){var s=n.map(function(l){return l.props.dataKey}),a=oZt[r],o=VVt().keys(s).value(function(l,c){return+cc(l,c,0)}).order(Dne).offset(a);return o(e)},cZt=function(e,n,r,s,a,o){if(!e)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,x){var g,y=(g=x.type)!==null&&g!==void 0&&g.defaultProps?al(al({},x.type.defaultProps),x.props):x.props,v=y.stackId,C=y.hide;if(C)return f;var N=y[r],I=f[N]||{hasStack:!1,stackGroups:{}};if(lc(v)){var P=I.stackGroups[v]||{numericAxisId:r,cateAxisId:s,items:[]};P.items.push(x),I.hasStack=!0,I.stackGroups[v]=P}else I.stackGroups[H5("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[x]};return al(al({},f),{},B4({},N,I))},c),d={};return Object.keys(u).reduce(function(f,x){var g=u[x];if(g.hasStack){var y={};g.stackGroups=Object.keys(g.stackGroups).reduce(function(v,C){var N=g.stackGroups[C];return al(al({},v),{},B4({},C,{numericAxisId:r,cateAxisId:s,items:N.items,stackedData:lZt(e,N.items,a)}))},y)}return al(al({},f),{},B4({},x,g))},d)},uZt=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=wQt(u,a,l);return e.domain([ZU(d),Ty(d)]),{niceTicks:d}}if(a&&s==="number"){var f=e.domain(),x=CQt(f,a,l);return{niceTicks:x}}return null};function tj(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&&!ji(s[e.dataKey])){var l=zL(n,"value",s[e.dataKey]);if(l)return l.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=cc(s,ji(o)?e.dataKey:o);return ji(c)?null:e.scale(c)}var L6e=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=cc(o,n.dataKey,n.domain[l]);return ji(c)?null:n.scale(c)-a/2+s},dZt=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]},fZt=function(e,n){var r,s=(r=e.type)!==null&&r!==void 0&&r.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,a=s.stackId;if(lc(a)){var o=n[a];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},hZt=function(e){return e.reduce(function(n,r){return[ZU(r.concat([n[0]]).filter(rs)),Ty(r.concat([n[1]]).filter(rs))]},[1/0,-1/0])},eHe=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=hZt(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})},D6e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,B6e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,cre=function(e,n,r){if(Ei(e))return e(n,r);if(!Array.isArray(e))return n;var s=[];if(rs(e[0]))s[0]=r?e[0]:Math.min(e[0],n[0]);else if(D6e.test(e[0])){var a=+D6e.exec(e[0])[1];s[0]=n[0]-a}else Ei(e[0])?s[0]=e[0](n[0]):s[0]=n[0];if(rs(e[1]))s[1]=r?e[1]:Math.max(e[1],n[1]);else if(B6e.test(e[1])){var o=+B6e.exec(e[1])[1];s[1]=n[1]+o}else Ei(e[1])?s[1]=e[1](n[1]):s[1]=n[1];return s},pD=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=Aue(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},$6e=function(e,n,r){return!e||!e.length||f5(e,dp(r,"type.defaultProps.domain"))?n:e},tHe=function(e,n){var r=e.type.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,s=r.dataKey,a=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,u=r.chartType,d=r.hide;return al(al({},Ni(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:a||s,color:Jue(e),value:cc(n,s),type:c,payload:n,chartType:u,hide:d})};function ik(t){"@babel/helpers - typeof";return ik=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},ik(t)}function U6e(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 z6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U6e(Object(n),!0).forEach(function(r){pZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pZt(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=xZt(t,"string");return ik(e)=="symbol"?e:e+""}function xZt(t,e){if(ik(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ik(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mD=Math.PI/180,gZt=function(e){return e*180/Math.PI},ou=function(e,n,r,s){return{x:e+Math.cos(-mD*s)*r,y:n+Math.sin(-mD*s)*r}},bZt=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))},yZt=function(e,n){var r=e.x,s=e.y,a=n.cx,o=n.cy,l=bZt({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:gZt(u),angleInRadian:u}},vZt=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}},wZt=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},H6e=function(e,n){var r=e.x,s=e.y,a=yZt({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=vZt(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?z6e(z6e({},n),{},{radius:o,angle:wZt(g,n)}):null};function ak(t){"@babel/helpers - typeof";return ak=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ak(t)}var CZt=["offset"];function SZt(t){return _Zt(t)||AZt(t)||jZt(t)||NZt()}function NZt(){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 jZt(t,e){if(t){if(typeof t=="string")return ure(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 ure(t,e)}}function AZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _Zt(t){if(Array.isArray(t))return ure(t)}function ure(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 EZt(t,e){if(t==null)return{};var n=kZt(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 kZt(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 V6e(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?V6e(Object(n),!0).forEach(function(r){TZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):V6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TZt(t,e,n){return e=IZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IZt(t){var e=PZt(t,"string");return ak(e)=="symbol"?e:e+""}function PZt(t,e){if(ak(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ak(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ok(){return ok=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},ok.apply(this,arguments)}var FZt=function(e){var n=e.value,r=e.formatter,s=ji(e.children)?n:e.children;return Ei(r)?r(s):s},OZt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),360);return r*s},MZt=function(e,n,r){var s=e.position,a=e.viewBox,o=e.offset,l=e.className,c=a,u=c.cx,d=c.cy,f=c.innerRadius,x=c.outerRadius,g=c.startAngle,y=c.endAngle,v=c.clockWise,C=(f+x)/2,N=OZt(g,y),I=N>=0?1:-1,P,M;s==="insideStart"?(P=g+I*o,M=v):s==="insideEnd"?(P=y-I*o,M=!v):s==="end"&&(P=y+I*o,M=v),M=N<=0?M:!M;var F=ou(u,d,C,P),$=ou(u,d,C,P+(M?1:-1)*359),L="M".concat(F.x,",").concat(F.y,`
A`).concat(C,",").concat(C,",0,1,").concat(M?0:1,`,
`).concat($.x,",").concat($.y),z=ji(e.id)?H5("recharts-radial-line-"):e.id;return Ie.createElement("text",ok({},r,{dominantBaseline:"central",className:ca("recharts-radial-bar-label",l)}),Ie.createElement("defs",null,Ie.createElement("path",{id:z,d:L})),Ie.createElement("textPath",{xlinkHref:"#".concat(z)},n))},RZt=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,N=ou(o,l,C,x),I=N.x,P=N.y;return{x:I,y:P,textAnchor:"middle",verticalAnchor:"middle"}},LZt=function(e){var n=e.viewBox,r=e.parentViewBox,s=e.offset,a=e.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,x=f*s,g=f>0?"end":"start",y=f>0?"start":"end",v=u>=0?1:-1,C=v*s,N=v>0?"end":"start",I=v>0?"start":"end";if(a==="top"){var P={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:g};return rc(rc({},P),r?{height:Math.max(c-r.y,0),width:u}:{})}if(a==="bottom"){var M={x:l+u/2,y:c+d+x,textAnchor:"middle",verticalAnchor:y};return rc(rc({},M),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(a==="left"){var F={x:l-C,y:c+d/2,textAnchor:N,verticalAnchor:"middle"};return 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:I,verticalAnchor:"middle"};return rc(rc({},$),r?{width:Math.max(r.x+r.width-$.x,0),height:d}:{})}var L=r?{width:u,height:d}:{};return a==="insideLeft"?rc({x:l+C,y:c+d/2,textAnchor:I,verticalAnchor:"middle"},L):a==="insideRight"?rc({x:l+u-C,y:c+d/2,textAnchor:N,verticalAnchor:"middle"},L):a==="insideTop"?rc({x:l+u/2,y:c+x,textAnchor:"middle",verticalAnchor:y},L):a==="insideBottom"?rc({x:l+u/2,y:c+d-x,textAnchor:"middle",verticalAnchor:g},L):a==="insideTopLeft"?rc({x:l+C,y:c+x,textAnchor:I,verticalAnchor:y},L):a==="insideTopRight"?rc({x:l+u-C,y:c+x,textAnchor:N,verticalAnchor:y},L):a==="insideBottomLeft"?rc({x:l+C,y:c+d-x,textAnchor:I,verticalAnchor:g},L):a==="insideBottomRight"?rc({x:l+u-C,y:c+d-x,textAnchor:N,verticalAnchor:g},L):N8(a)&&(rs(a.x)||Cw(a.x))&&(rs(a.y)||Cw(a.y))?rc({x:l+d5(a.x,u),y:c+d5(a.y,d),textAnchor:"end",verticalAnchor:"end"},L):rc({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},L)},DZt=function(e){return"cx"in e&&rs(e.cx)};function Iu(t){var e=t.offset,n=e===void 0?5:e,r=EZt(t,CZt),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||ji(l)&&ji(c)&&!h.isValidElement(u)&&!Ei(u))return null;if(h.isValidElement(u))return h.cloneElement(u,s);var g;if(Ei(u)){if(g=h.createElement(u,s),h.isValidElement(g))return g}else g=FZt(s);var y=DZt(a),v=Ni(s,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return MZt(s,g,v);var C=y?RZt(s):LZt(s);return Ie.createElement(eD,ok({className:ca("recharts-label",f)},v,C,{breakAll:x}),g)}Iu.displayName="Label";var nHe=function(e){var n=e.cx,r=e.cy,s=e.angle,a=e.startAngle,o=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,x=e.y,g=e.top,y=e.left,v=e.width,C=e.height,N=e.clockWise,I=e.labelViewBox;if(I)return I;if(rs(v)&&rs(C)){if(rs(f)&&rs(x))return{x:f,y:x,width:v,height:C};if(rs(g)&&rs(y))return{x:g,y,width:v,height:C}}return rs(f)&&rs(x)?{x:f,y:x,width:0,height:0}:rs(n)&&rs(r)?{cx:n,cy:r,startAngle:a||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:N}:e.viewBox?e.viewBox:{}},BZt=function(e,n){return e?e===!0?Ie.createElement(Iu,{key:"label-implicit",viewBox:n}):lc(e)?Ie.createElement(Iu,{key:"label-implicit",viewBox:n,value:e}):h.isValidElement(e)?e.type===Iu?h.cloneElement(e,{key:"label-implicit",viewBox:n}):Ie.createElement(Iu,{key:"label-implicit",content:e,viewBox:n}):Ei(e)?Ie.createElement(Iu,{key:"label-implicit",content:e,viewBox:n}):N8(e)?Ie.createElement(Iu,ok({viewBox:n},e,{key:"label-implicit"})):null:null},$Zt=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=nHe(e),o=pf(s,Iu).map(function(c,u){return h.cloneElement(c,{viewBox:n||a,key:"label-".concat(u)})});if(!r)return o;var l=BZt(e.label,n||a);return[l].concat(SZt(o))};Iu.parseViewBox=nHe;Iu.renderCallByParent=$Zt;var xX,W6e;function UZt(){if(W6e)return xX;W6e=1;function t(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}return xX=t,xX}var zZt=UZt();const HZt=Ti(zZt);function lk(t){"@babel/helpers - typeof";return lk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lk(t)}var VZt=["valueAccessor"],WZt=["data","dataKey","clockWise","id","textBreakAll"];function qZt(t){return XZt(t)||YZt(t)||KZt(t)||GZt()}function GZt(){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 KZt(t,e){if(t){if(typeof t=="string")return dre(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 dre(t,e)}}function YZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function XZt(t){if(Array.isArray(t))return dre(t)}function dre(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 xD(){return xD=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},xD.apply(this,arguments)}function q6e(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 G6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?q6e(Object(n),!0).forEach(function(r){QZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):q6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function QZt(t,e,n){return e=ZZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZZt(t){var e=JZt(t,"string");return lk(e)=="symbol"?e:e+""}function JZt(t,e){if(lk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(lk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K6e(t,e){if(t==null)return{};var n=eJt(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 eJt(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 tJt=function(e){return Array.isArray(e.value)?HZt(e.value):e.value};function Z0(t){var e=t.valueAccessor,n=e===void 0?tJt:e,r=K6e(t,VZt),s=r.data,a=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=K6e(r,WZt);return!s||!s.length?null:Ie.createElement(Aa,{className:"recharts-label-list"},s.map(function(d,f){var x=ji(a)?n(d,f):cc(d&&d.payload,a),g=ji(l)?{}:{id:"".concat(l,"-").concat(f)};return Ie.createElement(Iu,xD({},Ni(d,!0),u,g,{parentViewBox:d.parentViewBox,value:x,textBreakAll:c,viewBox:Iu.parseViewBox(ji(o)?d:G6e(G6e({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Z0.displayName="LabelList";function nJt(t,e){return t?t===!0?Ie.createElement(Z0,{key:"labelList-implicit",data:e}):Ie.isValidElement(t)||Ei(t)?Ie.createElement(Z0,{key:"labelList-implicit",data:e,content:t}):N8(t)?Ie.createElement(Z0,xD({data:e},t,{key:"labelList-implicit"})):null:null}function rJt(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,Z0).map(function(o,l){return h.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!n)return s;var a=nJt(t.label,e);return[a].concat(qZt(s))}Z0.renderCallByParent=rJt;function ck(t){"@babel/helpers - typeof";return ck=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ck(t)}function fre(){return fre=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},fre.apply(this,arguments)}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 X6e(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){sJt(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 sJt(t,e,n){return e=iJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iJt(t){var e=aJt(t,"string");return ck(e)=="symbol"?e:e+""}function aJt(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)}var oJt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),359.999);return r*s},wF=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)/mD,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*mD),v);return{center:g,circleTangency:y,lineTangency:C,theta:f}},rHe=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.startAngle,l=e.endAngle,c=oJt(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},lJt=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=wF({cx:n,cy:r,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),g=x.circleTangency,y=x.lineTangency,v=x.theta,C=wF({cx:n,cy:r,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),N=C.circleTangency,I=C.lineTangency,P=C.theta,M=c?Math.abs(u-d):Math.abs(u-d)-v-P;if(M<0)return l?"M ".concat(y.x,",").concat(y.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):rHe({cx:n,cy:r,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d});var F="M ".concat(y.x,",").concat(y.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(g.x,",").concat(g.y,`
A`).concat(a,",").concat(a,",0,").concat(+(M>180),",").concat(+(f<0),",").concat(N.x,",").concat(N.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(I.x,",").concat(I.y,`
`);if(s>0){var $=wF({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),L=$.circleTangency,z=$.lineTangency,Q=$.theta,se=wF({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),ee=se.circleTangency,K=se.lineTangency,re=se.theta,de=c?Math.abs(u-d):Math.abs(u-d)-Q-re;if(de<0&&o===0)return"".concat(F,"L").concat(n,",").concat(r,"Z");F+="L".concat(K.x,",").concat(K.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(ee.x,",").concat(ee.y,`
A`).concat(s,",").concat(s,",0,").concat(+(de>180),",").concat(+(f>0),",").concat(L.x,",").concat(L.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(z.x,",").concat(z.y,"Z")}else F+="L".concat(n,",").concat(r,"Z");return F},cJt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},sHe=function(e){var n=X6e(X6e({},cJt),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=ca("recharts-sector",x),y=o-a,v=d5(l,y,0,!0),C;return v>0&&Math.abs(d-f)<360?C=lJt({cx:r,cy:s,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):C=rHe({cx:r,cy:s,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),Ie.createElement("path",fre({},Ni(n,!0),{className:g,d:C,role:"img"}))};function uk(t){"@babel/helpers - typeof";return uk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uk(t)}function 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)}function Q6e(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 Z6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Q6e(Object(n),!0).forEach(function(r){uJt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uJt(t,e,n){return e=dJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dJt(t){var e=fJt(t,"string");return uk(e)=="symbol"?e:e+""}function fJt(t,e){if(uk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(uk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var J6e={curveBasisClosed:FVt,curveBasisOpen:OVt,curveBasis:PVt,curveBumpX:bVt,curveBumpY:yVt,curveLinearClosed:MVt,curveLinear:$U,curveMonotoneX:RVt,curveMonotoneY:LVt,curveNatural:DVt,curveStep:BVt,curveStepAfter:UVt,curveStepBefore:$Vt},CF=function(e){return e.x===+e.x&&e.y===+e.y},m7=function(e){return e.x},x7=function(e){return e.y},hJt=function(e,n){if(Ei(e))return e;var r="curve".concat(DU(e));return(r==="curveMonotone"||r==="curveBump")&&n?J6e["".concat(r).concat(n==="vertical"?"Y":"X")]:J6e[r]||$U},pJt=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=hJt(r,l),f=u?a.filter(function(v){return CF(v)}):a,x;if(Array.isArray(o)){var g=u?o.filter(function(v){return CF(v)}):o,y=f.map(function(v,C){return Z6e(Z6e({},v),{},{base:g[C]})});return l==="vertical"?x=hF().y(x7).x1(m7).x0(function(v){return v.base.x}):x=hF().x(m7).y1(x7).y0(function(v){return v.base.y}),x.defined(CF).curve(d),x(y)}return l==="vertical"&&rs(o)?x=hF().y(x7).x1(m7).x0(o):rs(o)?x=hF().x(m7).y1(x7).y0(o):x=oUe().x(m7).y(x7),x.defined(CF).curve(d),x(f)},E3=function(e){var n=e.className,r=e.points,s=e.path,a=e.pathRef;if((!r||!r.length)&&!s)return null;var o=r&&r.length?pJt(e):s;return Ie.createElement("path",hre({},Ni(e,!1),HL(e),{className:ca("recharts-curve",n),d:o,ref:a}))},mJt=TU();const Oa=Ti(mJt);var xJt=Object.getOwnPropertyNames,gJt=Object.getOwnPropertySymbols,bJt=Object.prototype.hasOwnProperty;function eCe(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function SF(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 tCe(t){return xJt(t).concat(gJt(t))}var yJt=Object.hasOwn||function(t,e){return bJt.call(t,e)};function q5(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var vJt="__v",wJt="__o",CJt="_owner",nCe=Object.getOwnPropertyDescriptor,rCe=Object.keys;function SJt(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 NJt(t,e){return q5(t.getTime(),e.getTime())}function jJt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function AJt(t,e){return t===e}function sCe(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 _Jt=q5;function EJt(t,e,n){var r=rCe(t),s=r.length;if(rCe(e).length!==s)return!1;for(;s-- >0;)if(!iHe(t,e,n,r[s]))return!1;return!0}function g7(t,e,n){var r=tCe(t),s=r.length;if(tCe(e).length!==s)return!1;for(var a,o,l;s-- >0;)if(a=r[s],!iHe(t,e,n,a)||(o=nCe(t,a),l=nCe(e,a),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function kJt(t,e){return q5(t.valueOf(),e.valueOf())}function TJt(t,e){return t.source===e.source&&t.flags===e.flags}function iCe(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 IJt(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 PJt(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 iHe(t,e,n,r){return(r===CJt||r===wJt||r===vJt)&&(t.$$typeof||e.$$typeof)?!0:yJt(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var FJt="[object Arguments]",OJt="[object Boolean]",MJt="[object Date]",RJt="[object Error]",LJt="[object Map]",DJt="[object Number]",BJt="[object Object]",$Jt="[object RegExp]",UJt="[object Set]",zJt="[object String]",HJt="[object URL]",VJt=Array.isArray,aCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,oCe=Object.assign,WJt=Object.prototype.toString.call.bind(Object.prototype.toString);function qJt(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,s=t.areFunctionsEqual,a=t.areMapsEqual,o=t.areNumbersEqual,l=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,d=t.areSetsEqual,f=t.areTypedArraysEqual,x=t.areUrlsEqual;return function(y,v,C){if(y===v)return!0;if(y==null||v==null)return!1;var N=typeof y;if(N!==typeof v)return!1;if(N!=="object")return N==="number"?o(y,v,C):N==="function"?s(y,v,C):!1;var I=y.constructor;if(I!==v.constructor)return!1;if(I===Object)return l(y,v,C);if(VJt(y))return e(y,v,C);if(aCe!=null&&aCe(y))return f(y,v,C);if(I===Date)return n(y,v,C);if(I===RegExp)return u(y,v,C);if(I===Map)return a(y,v,C);if(I===Set)return d(y,v,C);var P=WJt(y);return P===MJt?n(y,v,C):P===$Jt?u(y,v,C):P===LJt?a(y,v,C):P===UJt?d(y,v,C):P===BJt?typeof y.then!="function"&&typeof v.then!="function"&&l(y,v,C):P===HJt?x(y,v,C):P===RJt?r(y,v,C):P===FJt?l(y,v,C):P===OJt||P===DJt||P===zJt?c(y,v,C):!1}}function GJt(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,s={areArraysEqual:r?g7:SJt,areDatesEqual:NJt,areErrorsEqual:jJt,areFunctionsEqual:AJt,areMapsEqual:r?eCe(sCe,g7):sCe,areNumbersEqual:_Jt,areObjectsEqual:r?g7:EJt,arePrimitiveWrappersEqual:kJt,areRegExpsEqual:TJt,areSetsEqual:r?eCe(iCe,g7):iCe,areTypedArraysEqual:r?g7:IJt,areUrlsEqual:PJt};if(n&&(s=oCe({},s,n(s))),e){var a=SF(s.areArraysEqual),o=SF(s.areMapsEqual),l=SF(s.areObjectsEqual),c=SF(s.areSetsEqual);s=oCe({},s,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function KJt(t){return function(e,n,r,s,a,o,l){return t(e,n,l)}}function YJt(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 XJt=L2();L2({strict:!0});L2({circular:!0});L2({circular:!0,strict:!0});L2({createInternalComparator:function(){return q5}});L2({strict:!0,createInternalComparator:function(){return q5}});L2({circular:!0,createInternalComparator:function(){return q5}});L2({circular:!0,createInternalComparator:function(){return q5},strict:!0});function L2(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,s=t.createState,a=t.strict,o=a===void 0?!1:a,l=GJt(t),c=qJt(l),u=r?r(c):KJt(c);return YJt({circular:n,comparator:c,createState:s,equals:u,strict:o})}function QJt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function lCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(a){n<0&&(n=a),a-n>e?(t(a),n=-1):QJt(s)};requestAnimationFrame(r)}function pre(t){"@babel/helpers - typeof";return pre=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},pre(t)}function ZJt(t){return nen(t)||ten(t)||een(t)||JJt()}function JJt(){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 een(t,e){if(t){if(typeof t=="string")return cCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cCe(t,e)}}function cCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ten(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nen(t){if(Array.isArray(t))return t}function ren(){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=ZJt(o),c=l[0],u=l.slice(1);if(typeof c=="number"){lCe(s.bind(null,u),c);return}s(c),lCe(s.bind(null,u));return}pre(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 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 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 dCe(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){aHe(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 aHe(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=ien(t,"string");return dk(e)==="symbol"?e:String(e)}function ien(t,e){if(dk(t)!=="object"||t===null)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 aen=function(e,n){return[Object.keys(e),Object.keys(n)].reduce(function(r,s){return r.filter(function(a){return s.includes(a)})})},oen=function(e){return e},len=function(e){return e.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},U9=function(e,n){return Object.keys(n).reduce(function(r,s){return dCe(dCe({},r),{},aHe({},s,e(s,n[s])))},{})},fCe=function(e,n,r){return e.map(function(s){return"".concat(len(s)," ").concat(n,"ms ").concat(r)}).join(",")};function cen(t,e){return fen(t)||den(t,e)||oHe(t,e)||uen()}function uen(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function den(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 fen(t){if(Array.isArray(t))return t}function hen(t){return xen(t)||men(t)||oHe(t)||pen()}function pen(){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 oHe(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 men(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xen(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 gD=1e-4,lHe=function(e,n){return[0,3*e,3*n-6*e,3*e-3*n+1]},cHe=function(e,n){return e.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},hCe=function(e,n){return function(r){var s=lHe(e,n);return cHe(s,r)}},gen=function(e,n){return function(r){var s=lHe(e,n),a=[].concat(hen(s.map(function(o,l){return o*l}).slice(1)),[0]);return cHe(a,r)}},pCe=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=cen(u,4);s=d[0],a=d[1],o=d[2],l=d[3]}}}var f=hCe(s,o),x=hCe(a,l),g=gen(s,o),y=function(N){return N>1?1:N<0?0:N},v=function(N){for(var I=N>1?1:N,P=I,M=0;M<8;++M){var F=f(P)-I,$=g(P);if(Math.abs(F-I)<gD||$<gD)return x(P);P=y(P-F/$)}return x(P)};return v.isStepper=!1,v},ben=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)<gD&&Math.abs(v)<gD?[f,0]:[C,v]};return c.isStepper=!0,c.dt=l,c},yen=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 pCe(s);case"spring":return ben();default:if(s.split("(")[0]==="cubic-bezier")return pCe(s)}return typeof s=="function"?s:null};function fk(t){"@babel/helpers - typeof";return fk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fk(t)}function mCe(t){return Cen(t)||wen(t)||uHe(t)||ven()}function ven(){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 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 gre(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 Zc(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){xre(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 xre(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=Nen(t,"string");return fk(e)==="symbol"?e:String(e)}function Nen(t,e){if(fk(t)!=="object"||t===null)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 jen(t,e){return Een(t)||_en(t,e)||uHe(t,e)||Aen()}function Aen(){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 uHe(t,e){if(t){if(typeof t=="string")return gre(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 gre(t,e)}}function gre(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 _en(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 Een(t){if(Array.isArray(t))return t}var bD=function(e,n,r){return e+(n-e)*r},bre=function(e){var n=e.from,r=e.to;return n!==r},ken=function t(e,n,r){var s=U9(function(a,o){if(bre(o)){var l=e(o.from,o.to,o.velocity),c=jen(l,2),u=c[0],d=c[1];return Zc(Zc({},o),{},{from:u,velocity:d})}return o},n);return r<1?U9(function(a,o){return bre(o)?Zc(Zc({},o),{},{velocity:bD(o.velocity,s[a].velocity,r),from:bD(o.from,s[a].from,r)}):o},n):t(e,s,r-1)};const Ten=function(t,e,n,r,s){var a=aen(t,e),o=a.reduce(function(C,N){return Zc(Zc({},C),{},xre({},N,[t[N],e[N]]))},{}),l=a.reduce(function(C,N){return Zc(Zc({},C),{},xre({},N,{from:t[N],velocity:0,to:e[N]}))},{}),c=-1,u,d,f=function(){return null},x=function(){return U9(function(N,I){return I.from},l)},g=function(){return!Object.values(l).filter(bre).length},y=function(N){u||(u=N);var I=N-u,P=I/n.dt;l=ken(n,l,P),s(Zc(Zc(Zc({},t),e),x())),u=N,g()||(c=requestAnimationFrame(f))},v=function(N){d||(d=N);var I=(N-d)/r,P=U9(function(F,$){return bD.apply(void 0,mCe($).concat([n(I)]))},o);if(s(Zc(Zc(Zc({},t),e),P)),I<1)c=requestAnimationFrame(f);else{var M=U9(function(F,$){return bD.apply(void 0,mCe($).concat([n(1)]))},o);s(Zc(Zc(Zc({},t),e),M))}};return f=n.isStepper?y:v,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function nj(t){"@babel/helpers - typeof";return nj=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},nj(t)}var Ien=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Pen(t,e){if(t==null)return{};var n=Fen(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 Fen(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 gX(t){return Len(t)||Ren(t)||Men(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 Men(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 Ren(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Len(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 gCe(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?gCe(Object(n),!0).forEach(function(r){l9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l9(t,e,n){return e=dHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Den(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ben(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dHe(r.key),r)}}function $en(t,e,n){return Ben(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function dHe(t){var e=Uen(t,"string");return nj(e)==="symbol"?e:String(e)}function Uen(t,e){if(nj(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(nj(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zen(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 Hen(t){var e=Ven();return function(){var r=yD(t),s;if(e){var a=yD(this).constructor;s=Reflect.construct(r,arguments,a)}else s=r.apply(this,arguments);return wre(this,s)}}function wre(t,e){if(e&&(nj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cre(t)}function Cre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ven(){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 yD(t){return yD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},yD(t)}var Im=function(t){zen(n,t);var e=Hen(n);function n(r,s){var a;Den(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(Cre(a)),a.changeStyle=a.changeStyle.bind(Cre(a)),!l||g<=0)return a.state={style:{}},typeof x=="function"&&(a.state={style:d}),wre(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof x=="function")return a.state={style:u},wre(a);a.state={style:c?l9({},c,u):u}}else a.state={style:{}};return a}return $en(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?l9({},c,d):d};this.state&&x&&(c&&x[c]!==d||!c&&x!==d)&&this.setState(g);return}if(!(XJt(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?l9({},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=Ten(o,l,yen(u),c,this.changeStyle),y=function(){a.stopJSAnimation=g()};this.manager.start([x,d,y,c,f])}},{key:"runStepAnimation",value:function(s){var a=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,x=f===void 0?0:f,g=function(v,C,N){if(N===0)return v;var I=C.duration,P=C.easing,M=P===void 0?"ease":P,F=C.style,$=C.properties,L=C.onAnimationEnd,z=N>0?o[N-1]:C,Q=$||Object.keys(F);if(typeof M=="function"||M==="spring")return[].concat(gX(v),[a.runJSAnimation.bind(a,{from:z.style,to:F,duration:I,easing:M}),I]);var se=fCe(Q,I,M),ee=Up(Up(Up({},z.style),F),{},{transition:se});return[].concat(gX(v),[ee,I,L]).filter(oen)};return this.manager.start([c].concat(gX(o.reduce(g,[d,Math.max(x,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=ren());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?l9({},l,c):c,C=fCe(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=Pen(s,Ien),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,N=y.className,I=h.cloneElement(g,Up(Up({},c),{},{style:Up(Up({},C),d),className:N}));return I};return u===1?f(h.Children.only(a)):Ie.createElement("div",null,h.Children.map(a,function(x){return f(x)}))}}]),n}(h.PureComponent);Im.displayName="Animate";Im.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Im.propTypes={from:Oa.oneOfType([Oa.object,Oa.string]),to:Oa.oneOfType([Oa.object,Oa.string]),attributeName:Oa.string,duration:Oa.number,begin:Oa.number,easing:Oa.oneOfType([Oa.string,Oa.func]),steps:Oa.arrayOf(Oa.shape({duration:Oa.number.isRequired,style:Oa.object.isRequired,easing:Oa.oneOfType([Oa.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Oa.func]),properties:Oa.arrayOf("string"),onAnimationEnd:Oa.func})),children:Oa.oneOfType([Oa.node,Oa.func]),isActive:Oa.bool,canBegin:Oa.bool,onAnimationEnd:Oa.func,shouldReAnimate:Oa.bool,onAnimationStart:Oa.func,onAnimationReStart:Oa.func};function 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 vD(){return vD=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},vD.apply(this,arguments)}function Wen(t,e){return Yen(t)||Ken(t,e)||Gen(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 Gen(t,e){if(t){if(typeof t=="string")return bCe(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 bCe(t,e)}}function bCe(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 Ken(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 Yen(t){if(Array.isArray(t))return t}function yCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yCe(Object(n),!0).forEach(function(r){Xen(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Xen(t,e,n){return e=Qen(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qen(t){var e=Zen(t,"string");return hk(e)=="symbol"?e:e+""}function Zen(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 wCe=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},Jen=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},etn={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ede=function(e){var n=vCe(vCe({},etn),e),r=h.useRef(),s=h.useState(-1),a=Wen(s,2),o=a[0],l=a[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var M=r.current.getTotalLength();M&&l(M)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,x=n.radius,g=n.className,y=n.animationEasing,v=n.animationDuration,C=n.animationBegin,N=n.isAnimationActive,I=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var P=ca("recharts-rectangle",g);return I?Ie.createElement(Im,{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:I},function(M){var F=M.width,$=M.height,L=M.x,z=M.y;return Ie.createElement(Im,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:C,duration:v,isActive:N,easing:y},Ie.createElement("path",vD({},Ni(n,!0),{className:P,d:wCe(L,z,F,$,x),ref:r})))}):Ie.createElement("path",vD({},Ni(n,!0),{className:P,d:wCe(c,u,d,f,x)}))};function Sre(){return Sre=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},Sre.apply(this,arguments)}var tz=function(e){var n=e.cx,r=e.cy,s=e.r,a=e.className,o=ca("recharts-dot",a);return n===+n&&r===+r&&s===+s?Ie.createElement("circle",Sre({},Ni(e,!1),HL(e),{className:o,cx:n,cy:r,r:s})):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 ttn=["x","y","top","left","width","height","className"];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 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 ntn(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){rtn(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 rtn(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=itn(t,"string");return pk(e)=="symbol"?e:e+""}function itn(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 atn(t,e){if(t==null)return{};var n=otn(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 otn(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 ltn=function(e,n,r,s,a,o){return"M".concat(e,",").concat(a,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},ctn=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,ttn),C=ntn({x:r,y:a,top:l,left:u,width:f,height:g},v);return!rs(r)||!rs(a)||!rs(f)||!rs(g)||!rs(l)||!rs(u)?null:Ie.createElement("path",Nre({},Ni(C,!0),{className:ca("recharts-cross",y),d:ltn(r,a,f,g,l,u)}))},bX,SCe;function utn(){if(SCe)return bX;SCe=1;var t=TUe(),e=t(Object.getPrototypeOf,Object);return bX=e,bX}var yX,NCe;function dtn(){if(NCe)return yX;NCe=1;var t=U1(),e=utn(),n=z1(),r="[object Object]",s=Function.prototype,a=Object.prototype,o=s.toString,l=a.hasOwnProperty,c=o.call(Object);function u(d){if(!n(d)||t(d)!=r)return!1;var f=e(d);if(f===null)return!0;var x=l.call(f,"constructor")&&f.constructor;return typeof x=="function"&&x instanceof x&&o.call(x)==c}return yX=u,yX}var ftn=dtn();const htn=Ti(ftn);var vX,jCe;function ptn(){if(jCe)return vX;jCe=1;var t=U1(),e=z1(),n="[object Boolean]";function r(s){return s===!0||s===!1||e(s)&&t(s)==n}return vX=r,vX}var mtn=ptn();const xtn=Ti(mtn);function mk(t){"@babel/helpers - typeof";return mk=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},mk(t)}function wD(){return wD=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},wD.apply(this,arguments)}function gtn(t,e){return wtn(t)||vtn(t,e)||ytn(t,e)||btn()}function btn(){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 ytn(t,e){if(t){if(typeof t=="string")return ACe(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 ACe(t,e)}}function ACe(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 vtn(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 wtn(t){if(Array.isArray(t))return t}function _Ce(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 ECe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_Ce(Object(n),!0).forEach(function(r){Ctn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_Ce(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ctn(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=Ntn(t,"string");return mk(e)=="symbol"?e:e+""}function Ntn(t,e){if(mk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(mk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kCe=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},jtn={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Atn=function(e){var n=ECe(ECe({},jtn),e),r=h.useRef(),s=h.useState(-1),a=gtn(s,2),o=a[0],l=a[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var P=r.current.getTotalLength();P&&l(P)}catch{}},[]);var c=n.x,u=n.y,d=n.upperWidth,f=n.lowerWidth,x=n.height,g=n.className,y=n.animationEasing,v=n.animationDuration,C=n.animationBegin,N=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||x!==+x||d===0&&f===0||x===0)return null;var I=ca("recharts-trapezoid",g);return N?Ie.createElement(Im,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:x,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:x,x:c,y:u},duration:v,animationEasing:y,isActive:N},function(P){var M=P.upperWidth,F=P.lowerWidth,$=P.height,L=P.x,z=P.y;return Ie.createElement(Im,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:C,duration:v,easing:y},Ie.createElement("path",wD({},Ni(n,!0),{className:I,d:kCe(L,z,M,F,$),ref:r})))}):Ie.createElement("g",null,Ie.createElement("path",wD({},Ni(n,!0),{className:I,d:kCe(c,u,d,f,x)})))},_tn=["option","shapeType","propTransformer","activeClassName","isActive"];function xk(t){"@babel/helpers - typeof";return xk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xk(t)}function Etn(t,e){if(t==null)return{};var n=ktn(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 ktn(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 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 CD(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){Ttn(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 Ttn(t,e,n){return e=Itn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Itn(t){var e=Ptn(t,"string");return xk(e)=="symbol"?e:e+""}function Ptn(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 Ftn(t,e){return CD(CD({},e),t)}function Otn(t,e){return t==="symbols"}function ICe(t){var e=t.shapeType,n=t.elementProps;switch(e){case"rectangle":return Ie.createElement(ede,n);case"trapezoid":return Ie.createElement(Atn,n);case"sector":return Ie.createElement(sHe,n);case"symbols":if(Otn(e))return Ie.createElement(zU,n);break;default:return null}}function Mtn(t){return h.isValidElement(t)?t.props:t}function jre(t){var e=t.option,n=t.shapeType,r=t.propTransformer,s=r===void 0?Ftn:r,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,l=t.isActive,c=Etn(t,_tn),u;if(h.isValidElement(e))u=h.cloneElement(e,CD(CD({},c),Mtn(e)));else if(Ei(e))u=e(c);else if(htn(e)&&!xtn(e)){var d=s(e,c);u=Ie.createElement(ICe,{shapeType:n,elementProps:d})}else{var f=c;u=Ie.createElement(ICe,{shapeType:n,elementProps:f})}return l?Ie.createElement(Aa,{className:o},u):u}function nz(t,e){return e!=null&&"trapezoids"in t.props}function rz(t,e){return e!=null&&"sectors"in t.props}function gk(t,e){return e!=null&&"points"in t.props}function Rtn(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 Ltn(t,e){var n=t.endAngle===e.endAngle,r=t.startAngle===e.startAngle;return n&&r}function Dtn(t,e){var n=t.x===e.x,r=t.y===e.y,s=t.z===e.z;return n&&r&&s}function Btn(t,e){var n;return nz(t,e)?n=Rtn:rz(t,e)?n=Ltn:gk(t,e)&&(n=Dtn),n}function $tn(t,e){var n;return nz(t,e)?n="trapezoids":rz(t,e)?n="sectors":gk(t,e)&&(n="points"),n}function Utn(t,e){if(nz(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(rz(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 gk(t,e)?e.payload:{}}function ztn(t){var e=t.activeTooltipItem,n=t.graphicalItem,r=t.itemData,s=$tn(n,e),a=Utn(n,e),o=r.filter(function(c,u){var d=f5(a,c),f=n.props[s].filter(function(y){var v=Btn(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 wX,PCe;function Htn(){if(PCe)return wX;PCe=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 wX=n,wX}var CX,FCe;function fHe(){if(FCe)return CX;FCe=1;var t=qUe(),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 CX=r,CX}var SX,OCe;function Vtn(){if(OCe)return SX;OCe=1;var t=Htn(),e=WU(),n=fHe();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 SX=r,SX}var NX,MCe;function Wtn(){if(MCe)return NX;MCe=1;var t=Vtn(),e=t();return NX=e,NX}var qtn=Wtn();const SD=Ti(qtn);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 RCe(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 LCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RCe(Object(n),!0).forEach(function(r){hHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hHe(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=Ktn(t,"string");return bk(e)=="symbol"?e:e+""}function Ktn(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 Ytn=["Webkit","Moz","O","ms"],Xtn=function(e,n){var r=e.replace(/(\w)/,function(a){return a.toUpperCase()}),s=Ytn.reduce(function(a,o){return LCe(LCe({},a),{},hHe({},o+r,n))},{});return s[e]=n,s};function rj(t){"@babel/helpers - typeof";return rj=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},rj(t)}function ND(){return ND=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ND.apply(this,arguments)}function 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 jX(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){Uf(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 Qtn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BCe(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 Ztn(t,e,n){return BCe(t.prototype,e),BCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jtn(t,e,n){return e=jD(e),enn(t,pHe()?Reflect.construct(e,n,jD(t).constructor):e.apply(t,n))}function enn(t,e){if(e&&(rj(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tnn(t)}function tnn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pHe=function(){return!!t})()}function jD(t){return jD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jD(t)}function nnn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Are(t,e)}function Are(t,e){return Are=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Are(t,e)}function Uf(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=rnn(t,"string");return rj(e)=="symbol"?e:e+""}function rnn(t,e){if(rj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rj(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=B9().domain(SD(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}},$Ce=function(e){return e.changedTouches&&!!e.changedTouches.length},sj=function(t){function e(n){var r;return Qtn(this,e),r=Jtn(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=$Ce(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 nnn(e,t),Ztn(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=cc(a[r],l,r);return Ei(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,a=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,x=c.startIndex,g=c.endIndex,y=c.onChange,v=r.pageX-a;v>0?v=Math.min(v,u+d-f-l,u+d-f-o):v<0&&(v=Math.max(v,u-o,u-l));var C=this.getIndex({startX:o+v,endX:l+v});(C.startIndex!==x||C.endIndex!==g)&&y&&y(C),this.setState({startX:o+v,endX:l+v,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var a=$Ce(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,a=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,x=d.width,g=d.travellerWidth,y=d.onChange,v=d.gap,C=d.data,N={startX:this.state.startX,endX:this.state.endX},I=r.pageX-a;I>0?I=Math.min(I,f+x-g-u):I<0&&(I=Math.max(I,f-u)),N[o]=u+I;var P=this.getIndex(N),M=P.startIndex,F=P.endIndex,$=function(){var z=C.length-1;return o==="startX"&&(l>c?M%v===0:F%v===0)||l<c&&F===z||o==="endX"&&(l>c?F%v===0:M%v===0)||l>c&&F===z};this.setState(Uf(Uf({},o,u+I),"brushMoveStartX",r.pageX),function(){y&&$()&&y(P)})}},{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 Ie.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?Ie.cloneElement(f,{x:s,y:a,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var a,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,x=c.traveller,g=c.ariaLabel,y=c.data,v=c.startIndex,C=c.endIndex,N=Math.max(r,this.props.x),I=jX(jX({},Ni(this.props,!1)),{},{x:N,y:u,width:d,height:f}),P=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 Ie.createElement(Aa,{tabIndex:0,role:"slider","aria-label":P,"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,I))}},{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 Ie.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 Ie.createElement(Aa,{className:"recharts-brush-texts"},Ie.createElement(eD,ND({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,x)-g,y:o+l/2},y),this.getTextOfTick(s)),Ie.createElement(eD,ND({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,x)+c+g,y:o+l/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,s=r.data,a=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,x=this.state,g=x.startX,y=x.endX,v=x.isTextActive,C=x.isSlideMoving,N=x.isTravellerMoving,I=x.isTravellerFocused;if(!s||!s.length||!rs(l)||!rs(c)||!rs(u)||!rs(d)||u<=0||d<=0)return null;var P=ca("recharts-brush",a),M=Ie.Children.count(o)===1,F=Xtn("userSelect","none");return Ie.createElement(Aa,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),M&&this.renderPanorama(),this.renderSlide(g,y),this.renderTravellerLayer(g,"startX"),this.renderTravellerLayer(y,"endX"),(v||C||N||I||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 Ie.createElement(Ie.Fragment,null,Ie.createElement("rect",{x:s,y:a,width:o,height:l,fill:c,stroke:"none"}),Ie.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),Ie.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 Ie.isValidElement(r)?a=Ie.cloneElement(r,s):Ei(r)?a=r(s):a=e.renderDefaultTraveller(s),a}},{key:"getDerivedStateFromProps",value:function(r,s){var a=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(a!==s.prevData||u!==s.prevUpdateId)return jX({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(sj,"displayName","Brush");Uf(sj,"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 AX,UCe;function inn(){if(UCe)return AX;UCe=1;var t=jue();function e(n,r){var s;return t(n,function(a,o,l){return s=r(a,o,l),!s}),!!s}return AX=e,AX}var _X,zCe;function ann(){if(zCe)return _X;zCe=1;var t=SUe(),e=O2(),n=inn(),r=Cf(),s=WU();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 _X=a,_X}var onn=ann();const lnn=Ti(onn);var J0=function(e,n){var r=e.alwaysShow,s=e.ifOverflow;return r&&(s="extendDomain"),s===n},EX,HCe;function cnn(){if(HCe)return EX;HCe=1;var t=UUe();function e(n,r,s){r=="__proto__"&&t?t(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return EX=e,EX}var kX,VCe;function unn(){if(VCe)return kX;VCe=1;var t=cnn(),e=BUe(),n=O2();function r(s,a){var o={};return a=n(a,3),e(s,function(l,c,u){t(o,c,a(l,c,u))}),o}return kX=r,kX}var dnn=unn();const fnn=Ti(dnn);var TX,WCe;function hnn(){if(WCe)return TX;WCe=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 TX=t,TX}var IX,qCe;function pnn(){if(qCe)return IX;qCe=1;var t=jue();function e(n,r){var s=!0;return t(n,function(a,o,l){return s=!!r(a,o,l),s}),s}return IX=e,IX}var PX,GCe;function mnn(){if(GCe)return PX;GCe=1;var t=hnn(),e=pnn(),n=O2(),r=Cf(),s=WU();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 PX=a,PX}var xnn=mnn();const xHe=Ti(xnn);var gnn=["x","y"];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 _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 KCe(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 b7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?KCe(Object(n),!0).forEach(function(r){bnn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):KCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bnn(t,e,n){return e=ynn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ynn(t){var e=vnn(t,"string");return yk(e)=="symbol"?e:e+""}function vnn(t,e){if(yk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(yk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wnn(t,e){if(t==null)return{};var n=Cnn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Cnn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Snn(t,e){var n=t.x,r=t.y,s=wnn(t,gnn),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 b7(b7(b7(b7(b7({},e),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:x,name:e.name,radius:e.radius})}function YCe(t){return Ie.createElement(jre,_re({shapeType:"rectangle",propTransformer:Snn,activeClassName:"recharts-active-bar"},t))}var Nnn=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||p5(),n)}},jnn=["value","background"],gHe;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 Ann(t,e){if(t==null)return{};var n=_nn(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 _nn(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 AD(){return AD=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},AD.apply(this,arguments)}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 Dl(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){Iy(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 Enn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function QCe(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 knn(t,e,n){return QCe(t.prototype,e),QCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tnn(t,e,n){return e=_D(e),Inn(t,bHe()?Reflect.construct(e,n,_D(t).constructor):e.apply(t,n))}function Inn(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 Pnn(t)}function Pnn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bHe=function(){return!!t})()}function _D(t){return _D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_D(t)}function Fnn(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 Iy(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=Onn(t,"string");return ij(e)=="symbol"?e:e+""}function Onn(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 I8=function(t){function e(){var n;Enn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Tnn(this,e,[].concat(s)),Iy(n,"state",{isAnimationFinished:!1}),Iy(n,"id",H5("recharts-bar-")),Iy(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),Iy(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return Fnn(e,t),knn(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=Ni(this.props,!1);return r&&r.map(function(f,x){var g=x===c,y=g?u:o,v=Dl(Dl(Dl({},d),f),{},{isActive:g,option:y,index:x,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return Ie.createElement(Aa,AD({className:"recharts-bar-rectangle"},zE(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)}),Ie.createElement(YCe,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 Ie.createElement(Im,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(g){var y=g.t,v=a.map(function(C,N){var I=x&&x[N];if(I){var P=Al(I.x,C.x),M=Al(I.y,C.y),F=Al(I.width,C.width),$=Al(I.height,C.height);return Dl(Dl({},C),{},{x:P(y),y:M(y),width:F(y),height:$(y)})}if(o==="horizontal"){var L=Al(0,C.height),z=L(y);return Dl(Dl({},C),{},{y:C.y+C.height-z,height:z})}var Q=Al(0,C.width),se=Q(y);return Dl(Dl({},C),{},{width:se})});return Ie.createElement(Aa,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||!f5(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=Ni(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,x=Ann(u,jnn);if(!f)return null;var g=Dl(Dl(Dl(Dl(Dl({},x),{},{fill:"#eee"},f),c),zE(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return Ie.createElement(YCe,AD({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,T8);if(!f)return null;var x=u==="vertical"?o[0].height/2:o[0].width/2,g=function(C,N){var I=Array.isArray(C.value)?C.value[1]:C.value;return{x:C.x,y:C.y,value:I,errorVal:cc(C,N)}},y={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Ie.createElement(Aa,y,f.map(function(v){return Ie.cloneElement(v,{key:"error-bar-".concat(s,"-").concat(v.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:x,dataPointFormatter:g})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,a=r.data,o=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,x=r.height,g=r.isAnimationActive,y=r.background,v=r.id;if(s||!a||!a.length)return null;var C=this.state.isAnimationFinished,N=ca("recharts-bar",o),I=l&&l.allowDataOverflow,P=c&&c.allowDataOverflow,M=I||P,F=ji(v)?this.id:v;return Ie.createElement(Aa,{className:N},I||P?Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clipPath-".concat(F)},Ie.createElement("rect",{x:I?u:u-f/2,y:P?d:d-x/2,width:I?f:f*2,height:P?x:x*2}))):null,Ie.createElement(Aa,{className:"recharts-bar-rectangles",clipPath:M?"url(#clipPath-".concat(F,")"):null},y?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(M,F),(!g||C)&&Z0.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])}(h.PureComponent);gHe=I8;Iy(I8,"displayName","Bar");Iy(I8,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Iy(I8,"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=rZt(r,n);if(!g)return null;var y=e.layout,v=n.type.defaultProps,C=v!==void 0?Dl(Dl({},v),n.props):n.props,N=C.dataKey,I=C.children,P=C.minPointSize,M=y==="horizontal"?o:a,F=u?M.scale.domain():null,$=dZt({numericAxis:M}),L=pf(I,Eue),z=f.map(function(Q,se){var ee,K,re,de,G,ie;u?ee=sZt(u[d+se],F):(ee=cc(Q,N),Array.isArray(ee)||(ee=[$,ee]));var ae=Nnn(P,gHe.defaultProps.minPointSize)(ee[1],se);if(y==="horizontal"){var q,W=[o.scale(ee[0]),o.scale(ee[1])],ne=W[0],oe=W[1];K=L6e({axis:a,ticks:l,bandSize:s,offset:g.offset,entry:Q,index:se}),re=(q=oe??ne)!==null&&q!==void 0?q:void 0,de=g.size;var he=ne-oe;if(G=Number.isNaN(he)?0:he,ie={x:K,y:o.y,width:de,height:o.height},Math.abs(ae)>0&&Math.abs(G)<Math.abs(ae)){var _e=gm(G||ae)*(Math.abs(ae)-Math.abs(G));re-=_e,G+=_e}}else{var xe=[a.scale(ee[0]),a.scale(ee[1])],Se=xe[0],ge=xe[1];if(K=Se,re=L6e({axis:o,ticks:c,bandSize:s,offset:g.offset,entry:Q,index:se}),de=ge-Se,G=g.size,ie={x:a.x,y:re,width:a.width,height:G},Math.abs(ae)>0&&Math.abs(de)<Math.abs(ae)){var Ce=gm(de||ae)*(Math.abs(ae)-Math.abs(de));de+=Ce}}return Dl(Dl(Dl({},Q),{},{x:K,y:re,width:de,height:G,value:u?ee:ee[1],payload:Q,background:ie},L[se]&&L[se].props),{},{tooltipPayload:[tHe(n,Q)],tooltipPosition:{x:K+de/2,y:re+G/2}})});return Dl({data:z,layout:y},x)});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 Mnn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ZCe(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,vHe(r.key),r)}}function Rnn(t,e,n){return ZCe(t.prototype,e),ZCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function JCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function im(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JCe(Object(n),!0).forEach(function(r){sz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sz(t,e,n){return e=vHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vHe(t){var e=Lnn(t,"string");return vk(e)=="symbol"?e:e+""}function Lnn(t,e){if(vk(t)!="object"||!t)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)}var wHe=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,I8);return d.reduce(function(g,y){var v=n[y],C=v.orientation,N=v.domain,I=v.padding,P=I===void 0?{}:I,M=v.mirror,F=v.reversed,$="".concat(C).concat(M?"Mirror":""),L,z,Q,se,ee;if(v.type==="number"&&(v.padding==="gap"||v.padding==="no-gap")){var K=N[1]-N[0],re=1/0,de=v.categoricalDomain.sort(HHt);if(de.forEach(function(xe,Se){Se>0&&(re=Math.min((xe||0)-(de[Se-1]||0),re))}),Number.isFinite(re)){var G=re/K,ie=v.layout==="vertical"?r.height:r.width;if(v.padding==="gap"&&(L=G*ie/2),v.padding==="no-gap"){var ae=d5(e.barCategoryGap,G*ie),q=G*ie/2;L=q-ae-(q-ae)/ie*ae}}}s==="xAxis"?z=[r.left+(P.left||0)+(L||0),r.left+r.width-(P.right||0)-(L||0)]:s==="yAxis"?z=c==="horizontal"?[r.top+r.height-(P.bottom||0),r.top+(P.top||0)]:[r.top+(P.top||0)+(L||0),r.top+r.height-(P.bottom||0)-(L||0)]:z=v.range,F&&(z=[z[1],z[0]]);var W=tZt(v,a,x),ne=W.scale,oe=W.realScaleType;ne.domain(N).range(z),nZt(ne);var he=uZt(ne,im(im({},v),{},{realScaleType:oe}));s==="xAxis"?(ee=C==="top"&&!M||C==="bottom"&&M,Q=r.left,se=f[$]-ee*v.height):s==="yAxis"&&(ee=C==="left"&&!M||C==="right"&&M,Q=f[$]-ee*v.width,se=r.top);var _e=im(im(im({},v),he),{},{realScaleType:oe,x:Q,y:se,scale:ne,width:s==="xAxis"?r.width:v.width,height:s==="yAxis"?r.height:v.height});return _e.bandSize=pD(_e,he),!v.hide&&s==="xAxis"?f[$]+=(ee?-1:1)*_e.height:v.hide||(f[$]+=(ee?-1:1)*_e.width),im(im({},g),{},sz({},y,_e))},{})},CHe=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)}},Dnn=function(e){var n=e.x1,r=e.y1,s=e.x2,a=e.y2;return CHe({x:n,y:r},{x:s,y:a})},SHe=function(){function t(e){Mnn(this,t),this.scale=e}return Rnn(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)}}])}();sz(SHe,"EPS",1e-4);var tde=function(e){var n=Object.keys(e).reduce(function(r,s){return im(im({},r),{},sz({},s,SHe.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 fnn(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return xHe(s,function(a,o){return n[o].isInRange(a)})}})};function Bnn(t){return(t%180+180)%180}var $nn=function(e){var n=e.width,r=e.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Bnn(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)},FX,e4e;function Unn(){if(e4e)return FX;e4e=1;var t=O2(),e=QT(),n=HU();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 FX=r,FX}var OX,t4e;function znn(){if(t4e)return OX;t4e=1;var t=fHe();function e(n){var r=t(n),s=r%1;return r===r?s?r-s:r:0}return OX=e,OX}var MX,n4e;function Hnn(){if(n4e)return MX;n4e=1;var t=OUe(),e=O2(),n=znn(),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 MX=s,MX}var RX,r4e;function Vnn(){if(r4e)return RX;r4e=1;var t=Unn(),e=Hnn(),n=t(e);return RX=n,RX}var Wnn=Vnn();const qnn=Ti(Wnn);var Gnn=Y$e();const Knn=Ti(Gnn);var Ynn=Knn(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("")}),nde=h.createContext(void 0),rde=h.createContext(void 0),NHe=h.createContext(void 0),jHe=h.createContext({}),AHe=h.createContext(void 0),_He=h.createContext(0),EHe=h.createContext(0),s4e=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=Ynn(a);return Ie.createElement(nde.Provider,{value:r},Ie.createElement(rde.Provider,{value:s},Ie.createElement(jHe.Provider,{value:a},Ie.createElement(NHe.Provider,{value:d},Ie.createElement(AHe.Provider,{value:o},Ie.createElement(_He.Provider,{value:u},Ie.createElement(EHe.Provider,{value:c},l)))))))},Xnn=function(){return h.useContext(AHe)},kHe=function(e){var n=h.useContext(nde);n==null&&p5();var r=n[e];return r==null&&p5(),r},Qnn=function(){var e=h.useContext(nde);return Kb(e)},Znn=function(){var e=h.useContext(rde),n=qnn(e,function(r){return xHe(r.domain,Number.isFinite)});return n||Kb(e)},THe=function(e){var n=h.useContext(rde);n==null&&p5();var r=n[e];return r==null&&p5(),r},Jnn=function(){var e=h.useContext(NHe);return e},ern=function(){return h.useContext(jHe)},sde=function(){return h.useContext(EHe)},ide=function(){return h.useContext(_He)};function aj(t){"@babel/helpers - typeof";return aj=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},aj(t)}function trn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nrn(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,PHe(r.key),r)}}function rrn(t,e,n){return nrn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function srn(t,e,n){return e=ED(e),irn(t,IHe()?Reflect.construct(e,n||[],ED(t).constructor):e.apply(t,n))}function irn(t,e){if(e&&(aj(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 IHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IHe=function(){return!!t})()}function ED(t){return ED=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ED(t)}function orn(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 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 a4e(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){ade(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 ade(t,e,n){return e=PHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PHe(t){var e=lrn(t,"string");return aj(e)=="symbol"?e:e+""}function lrn(t,e){if(aj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(aj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function crn(t,e){return hrn(t)||frn(t,e)||drn(t,e)||urn()}function urn(){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 drn(t,e){if(t){if(typeof t=="string")return o4e(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 o4e(t,e)}}function o4e(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 frn(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 hrn(t){if(Array.isArray(t))return t}function Tre(){return Tre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tre.apply(this,arguments)}var prn=function(e,n){var r;return Ie.isValidElement(e)?r=Ie.cloneElement(e,n):Ei(e)?r=e(n):r=Ie.createElement("line",Tre({},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(J0(u,"discard")&&!e.y.isInRange(v))return null;var C=[{x:d+x,y:v},{x:d,y:v}];return c==="left"?C.reverse():C}if(n){var N=u.x,I=e.x.apply(N,{position:o});if(J0(u,"discard")&&!e.x.isInRange(I))return null;var P=[{x:I,y:f+g},{x:I,y:f}];return l==="top"?P.reverse():P}if(s){var M=u.segment,F=M.map(function($){return e.apply($,{position:o})});return J0(u,"discard")&&lnn(F,function($){return!e.isInRange($)})?null:F}return null};function xrn(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=Xnn(),d=kHe(s),f=THe(a),x=Jnn();if(!u||!x)return null;l1(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var g=tde({x:d.scale,y:f.scale}),y=lc(e),v=lc(n),C=r&&r.length===2,N=mrn(g,y,v,C,x,t.position,d.orientation,f.orientation,t);if(!N)return null;var I=crn(N,2),P=I[0],M=P.x,F=P.y,$=I[1],L=$.x,z=$.y,Q=J0(t,"hidden")?"url(#".concat(u,")"):void 0,se=a4e(a4e({clipPath:Q},Ni(t,!0)),{},{x1:M,y1:F,x2:L,y2:z});return Ie.createElement(Aa,{className:ca("recharts-reference-line",l)},prn(o,se),Iu.renderCallByParent(t,Dnn({x1:M,y1:F,x2:L,y2:z})))}var ode=function(t){function e(){return trn(this,e),srn(this,e,arguments)}return orn(e,t),rrn(e,[{key:"render",value:function(){return Ie.createElement(xrn,this.props)}}])}(Ie.Component);ade(ode,"displayName","ReferenceLine");ade(ode,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function Ire(){return Ire=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},Ire.apply(this,arguments)}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)}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 c4e(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){iz(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 grn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function brn(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 yrn(t,e,n){return brn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function vrn(t,e,n){return e=kD(e),wrn(t,FHe()?Reflect.construct(e,n||[],kD(t).constructor):e.apply(t,n))}function wrn(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 Crn(t)}function Crn(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 kD(t){return kD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},kD(t)}function Srn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pre(t,e)}function Pre(t,e){return Pre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Pre(t,e)}function iz(t,e,n){return e=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=Nrn(t,"string");return oj(e)=="symbol"?e:e+""}function Nrn(t,e){if(oj(t)!="object"||!t)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)}var jrn=function(e){var n=e.x,r=e.y,s=e.xAxis,a=e.yAxis,o=tde({x:s.scale,y:a.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return J0(e,"discard")&&!o.isInRange(l)?null:l},az=function(t){function e(){return grn(this,e),vrn(this,e,arguments)}return Srn(e,t),yrn(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=lc(s),d=lc(a);if(l1(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=jrn(this.props);if(!f)return null;var x=f.x,g=f.y,y=this.props,v=y.shape,C=y.className,N=J0(this.props,"hidden")?"url(#".concat(c,")"):void 0,I=c4e(c4e({clipPath:N},Ni(this.props,!0)),{},{cx:x,cy:g});return Ie.createElement(Aa,{className:ca("recharts-reference-dot",C)},e.renderDot(v,I),Iu.renderCallByParent(this.props,{x:x-o,y:g-o,width:2*o,height:2*o}))}}])}(Ie.Component);iz(az,"displayName","ReferenceDot");iz(az,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});iz(az,"renderDot",function(t,e){var n;return Ie.isValidElement(t)?n=Ie.cloneElement(t,e):Ei(t)?n=t(e):n=Ie.createElement(tz,Ire({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function Fre(){return Fre=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},Fre.apply(this,arguments)}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 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 d4e(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){oz(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 Arn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _rn(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,RHe(r.key),r)}}function Ern(t,e,n){return _rn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function krn(t,e,n){return e=TD(e),Trn(t,MHe()?Reflect.construct(e,n||[],TD(t).constructor):e.apply(t,n))}function Trn(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 Irn(t)}function Irn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function MHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MHe=function(){return!!t})()}function TD(t){return TD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},TD(t)}function Prn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ore(t,e)}function Ore(t,e){return Ore=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ore(t,e)}function oz(t,e,n){return e=RHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RHe(t){var e=Frn(t,"string");return lj(e)=="symbol"?e:e+""}function Frn(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 Orn=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=tde({x:d.scale,y:f.scale}),g={x:e?x.x.apply(o,{position:"start"}):x.x.rangeMin,y:r?x.y.apply(c,{position:"start"}):x.y.rangeMin},y={x:n?x.x.apply(l,{position:"end"}):x.x.rangeMax,y:s?x.y.apply(u,{position:"end"}):x.y.rangeMax};return J0(a,"discard")&&(!x.isInRange(g)||!x.isInRange(y))?null:CHe(g,y)},lz=function(t){function e(){return Arn(this,e),krn(this,e,arguments)}return Prn(e,t),Ern(e,[{key:"render",value:function(){var r=this.props,s=r.x1,a=r.x2,o=r.y1,l=r.y2,c=r.className,u=r.alwaysShow,d=r.clipPathId;l1(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=lc(s),x=lc(a),g=lc(o),y=lc(l),v=this.props.shape;if(!f&&!x&&!g&&!y&&!v)return null;var C=Orn(f,x,g,y,this.props);if(!C&&!v)return null;var N=J0(this.props,"hidden")?"url(#".concat(d,")"):void 0;return Ie.createElement(Aa,{className:ca("recharts-reference-area",c)},e.renderRect(v,d4e(d4e({clipPath:N},Ni(this.props,!0)),C)),Iu.renderCallByParent(this.props,C))}}])}(Ie.Component);oz(lz,"displayName","ReferenceArea");oz(lz,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});oz(lz,"renderRect",function(t,e){var n;return Ie.isValidElement(t)?n=Ie.cloneElement(t,e):Ei(t)?n=t(e):n=Ie.createElement(ede,Fre({},e,{className:"recharts-reference-area-rect"})),n});function LHe(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 Mrn(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return $nn(r,n)}function Rrn(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 ID(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 Lrn(t,e){return LHe(t,e+1)}function Drn(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:LHe(r,u)};var v=c,C,N=function(){return C===void 0&&(C=n(y,v)),C},I=y.coordinate,P=c===0||ID(t,I,N,d,l);P||(c=0,d=o,u+=1),P&&(d=I+t*(N()/2+s),c+=u)},x;u<=a.length;)if(x=f(),x)return x.v;return[]}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 f4e(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?f4e(Object(n),!0).forEach(function(r){Brn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Brn(t,e,n){return e=$rn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $rn(t){var e=Urn(t,"string");return wk(e)=="symbol"?e:e+""}function Urn(t,e){if(wk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(wk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zrn(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 N=ID(t,g.tickCoord,v,l,c);N&&(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 Hrn(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=ID(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(I){var P=o[I],M,F=function(){return M===void 0&&(M=n(P,I)),M};if(I===0){var $=t*(P.coordinate-t*F()/2-c);o[I]=P=_u(_u({},P),{},{tickCoord:$<0?P.coordinate-$*t:P.coordinate})}else o[I]=P=_u(_u({},P),{},{tickCoord:P.coordinate});var L=ID(t,P.tickCoord,F,c,u);L&&(c=P.tickCoord+t*(F()/2+s),o[I]=_u(_u({},P),{},{isShow:!0}))},C=0;C<y;C++)v(C);return o}function lde(t,e,n){var r=t.tick,s=t.ticks,a=t.viewBox,o=t.minTickGap,l=t.orientation,c=t.interval,u=t.tickFormatter,d=t.unit,f=t.angle;if(!s||!s.length||!r)return[];if(rs(c)||Sm.isSsr)return Lrn(s,typeof c=="number"&&rs(c)?c:0);var x=[],g=l==="top"||l==="bottom"?"width":"height",y=d&&g==="width"?D9(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},v=function(P,M){var F=Ei(u)?u(P.value,M):P.value;return g==="width"?Mrn(D9(F,{fontSize:e,letterSpacing:n}),y,f):D9(F,{fontSize:e,letterSpacing:n})[g]},C=s.length>=2?gm(s[1].coordinate-s[0].coordinate):1,N=Rrn(a,C,g);return c==="equidistantPreserveStart"?Drn(C,N,v,s,o):(c==="preserveStart"||c==="preserveStartEnd"?x=Hrn(C,N,v,s,o,c==="preserveStartEnd"):x=zrn(C,N,v,s,o),x.filter(function(I){return I.isShow}))}var Vrn=["viewBox"],Wrn=["viewBox"],qrn=["ticks"];function cj(t){"@babel/helpers - typeof";return cj=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},cj(t)}function c4(){return c4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c4.apply(this,arguments)}function 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 ed(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){cde(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 LX(t,e){if(t==null)return{};var n=Grn(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 Grn(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 Krn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,BHe(r.key),r)}}function Yrn(t,e,n){return p4e(t.prototype,e),p4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xrn(t,e,n){return e=PD(e),Qrn(t,DHe()?Reflect.construct(e,n,PD(t).constructor):e.apply(t,n))}function Qrn(t,e){if(e&&(cj(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 DHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DHe=function(){return!!t})()}function PD(t){return PD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},PD(t)}function Jrn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mre(t,e)}function Mre(t,e){return Mre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Mre(t,e)}function cde(t,e,n){return e=BHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BHe(t){var e=esn(t,"string");return cj(e)=="symbol"?e:e+""}function esn(t,e){if(cj(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(cj(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var P8=function(t){function e(n){var r;return Krn(this,e),r=Xrn(this,e,[n]),r.state={fontSize:"",letterSpacing:""},r}return Jrn(e,t),Yrn(e,[{key:"shouldComponentUpdate",value:function(r,s){var a=r.viewBox,o=LX(r,Vrn),l=this.props,c=l.viewBox,u=LX(l,Wrn);return!L4(a,c)||!L4(o,u)||!L4(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,a=s.x,o=s.y,l=s.width,c=s.height,u=s.orientation,d=s.tickSize,f=s.mirror,x=s.tickMargin,g,y,v,C,N,I,P=f?-1:1,M=r.tickSize||d,F=rs(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":g=y=r.coordinate,C=o+ +!f*c,v=C-P*M,I=v-P*x,N=F;break;case"left":v=C=r.coordinate,y=a+ +!f*l,g=y-P*M,N=g-P*x,I=F;break;case"right":v=C=r.coordinate,y=a+ +f*l,g=y+P*M,N=g+P*x,I=F;break;default:g=y=r.coordinate,C=o+ +f*c,v=C+P*M,I=v+P*x,N=F;break}return{line:{x1:g,y1:v,x2:y,y2:C},tick:{x:N,y:I}}}},{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({},Ni(this.props,!1)),Ni(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 Ie.createElement("line",c4({},f,{className:ca("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=lde(ed(ed({},this.props),{},{ticks:r}),s,a),y=this.getTickTextAnchor(),v=this.getTickVerticalAnchor(),C=Ni(this.props,!1),N=Ni(d,!1),I=ed(ed({},C),{},{fill:"none"},Ni(c,!1)),P=g.map(function(M,F){var $=o.getTickLineCoord(M),L=$.line,z=$.tick,Q=ed(ed(ed(ed({textAnchor:y,verticalAnchor:v},C),{},{stroke:"none",fill:u},N),z),{},{index:F,payload:M,visibleTicksCount:g.length,tickFormatter:f});return Ie.createElement(Aa,c4({className:"recharts-cartesian-axis-tick",key:"tick-".concat(M.value,"-").concat(M.coordinate,"-").concat(M.tickCoord)},zE(o.props,M,F)),c&&Ie.createElement("line",c4({},I,L,{className:ca("recharts-cartesian-axis-tick-line",dp(c,"className"))})),d&&e.renderTickItem(d,Q,"".concat(Ei(f)?f(M.value,F):M.value).concat(x||"")))});return Ie.createElement("g",{className:"recharts-cartesian-axis-ticks"},P)}},{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=LX(f,qrn),y=x;return Ei(c)&&(y=x&&x.length>0?c(this.props):c(g)),o<=0||l<=0||!y||!y.length?null:Ie.createElement(Aa,{className:ca("recharts-cartesian-axis",u),ref:function(C){r.layerReference=C}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Iu.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,a){var o;return Ie.isValidElement(r)?o=Ie.cloneElement(r,s):Ei(r)?o=r(s):o=Ie.createElement(eD,c4({},s,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(h.Component);cde(P8,"displayName","CartesianAxis");cde(P8,"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 tsn=["x1","y1","x2","y2","key"],nsn=["offset"];function m5(t){"@babel/helpers - typeof";return m5=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},m5(t)}function m4e(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 Pu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?m4e(Object(n),!0).forEach(function(r){rsn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rsn(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=isn(t,"string");return m5(e)=="symbol"?e:e+""}function isn(t,e){if(m5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(m5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jw(){return jw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jw.apply(this,arguments)}function x4e(t,e){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 osn=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 Ie.createElement("rect",{x:s,y:a,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function $He(t,e){var n;if(Ie.isValidElement(t))n=Ie.cloneElement(t,e);else if(Ei(t))n=t(e);else{var r=e.x1,s=e.y1,a=e.x2,o=e.y2,l=e.key,c=x4e(e,tsn),u=Ni(c,!1);u.offset;var d=x4e(u,nsn);n=Ie.createElement("line",jw({},d,{x1:r,y1:s,x2:a,y2:o,fill:"none",key:l}))}return n}function lsn(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=Pu(Pu({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return $He(s,u)});return Ie.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function csn(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=Pu(Pu({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return $He(s,u)});return Ie.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function usn(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 Ie.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 Ie.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function dsn(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 Ie.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 Ie.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var fsn=function(e,n){var r=e.xAxis,s=e.width,a=e.height,o=e.offset;return Jze(lde(Pu(Pu(Pu({},P8.defaultProps),r),{},{ticks:Kg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.left,o.left+o.width,n)},hsn=function(e,n){var r=e.yAxis,s=e.width,a=e.height,o=e.offset;return Jze(lde(Pu(Pu(Pu({},P8.defaultProps),r),{},{ticks:Kg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.top,o.top+o.height,n)},SC={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function UHe(t){var e,n,r,s,a,o,l=sde(),c=ide(),u=ern(),d=Pu(Pu({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:SC.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:SC.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:SC.horizontal,horizontalFill:(s=t.horizontalFill)!==null&&s!==void 0?s:SC.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:SC.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:SC.verticalFill,x:rs(t.x)?t.x:u.left,y:rs(t.y)?t.y:u.top,width:rs(t.width)?t.width:u.width,height:rs(t.height)?t.height:u.height}),f=d.x,x=d.y,g=d.width,y=d.height,v=d.syncWithTicks,C=d.horizontalValues,N=d.verticalValues,I=Qnn(),P=Znn();if(!rs(g)||g<=0||!rs(y)||y<=0||!rs(f)||f!==+f||!rs(x)||x!==+x)return null;var M=d.verticalCoordinatesGenerator||fsn,F=d.horizontalCoordinatesGenerator||hsn,$=d.horizontalPoints,L=d.verticalPoints;if((!$||!$.length)&&Ei(F)){var z=C&&C.length,Q=F({yAxis:P?Pu(Pu({},P),{},{ticks:z?C:P.ticks}):void 0,width:l,height:c,offset:u},z?!0:v);l1(Array.isArray(Q),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(m5(Q),"]")),Array.isArray(Q)&&($=Q)}if((!L||!L.length)&&Ei(M)){var se=N&&N.length,ee=M({xAxis:I?Pu(Pu({},I),{},{ticks:se?N:I.ticks}):void 0,width:l,height:c,offset:u},se?!0:v);l1(Array.isArray(ee),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(m5(ee),"]")),Array.isArray(ee)&&(L=ee)}return Ie.createElement("g",{className:"recharts-cartesian-grid"},Ie.createElement(osn,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),Ie.createElement(lsn,jw({},d,{offset:u,horizontalPoints:$,xAxis:I,yAxis:P})),Ie.createElement(csn,jw({},d,{offset:u,verticalPoints:L,xAxis:I,yAxis:P})),Ie.createElement(usn,jw({},d,{horizontalPoints:$})),Ie.createElement(dsn,jw({},d,{verticalPoints:L})))}UHe.displayName="CartesianGrid";var psn=["type","layout","connectNulls","ref"],msn=["key"];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 g4e(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 z9(){return z9=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},z9.apply(this,arguments)}function b4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Df(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?b4e(Object(n),!0).forEach(function(r){am(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function NC(t){return vsn(t)||ysn(t)||bsn(t)||gsn()}function gsn(){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 bsn(t,e){if(t){if(typeof t=="string")return Rre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rre(t,e)}}function ysn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vsn(t){if(Array.isArray(t))return Rre(t)}function Rre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function wsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,HHe(r.key),r)}}function Csn(t,e,n){return y4e(t.prototype,e),y4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ssn(t,e,n){return e=FD(e),Nsn(t,zHe()?Reflect.construct(e,n,FD(t).constructor):e.apply(t,n))}function Nsn(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 jsn(t)}function jsn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zHe=function(){return!!t})()}function FD(t){return FD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},FD(t)}function Asn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lre(t,e)}function Lre(t,e){return Lre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Lre(t,e)}function am(t,e,n){return e=HHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HHe(t){var e=_sn(t,"string");return uj(e)=="symbol"?e:e+""}function _sn(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 $0=function(t){function e(){var n;wsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Ssn(this,e,[].concat(s)),am(n,"state",{isAnimationFinished:!0,totalLength:0}),am(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),am(n,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(N,I){return N+I});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(NC(c.slice(0,y)),[f-v]);break}var C=g.length%2===0?[0,x]:[x];return[].concat(NC(e.repeat(c,d)),NC(g),C).map(function(N){return"".concat(N,"px")}).join(", ")}),am(n,"id",H5("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 Asn(e,t),Csn(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,T8);if(!f)return null;var x=function(v,C){return{x:v.x,y:v.y,value:v.value,errorVal:cc(v.payload,C)}},g={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Ie.createElement(Aa,g,f.map(function(y){return Ie.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=Ni(this.props,!1),x=Ni(c,!0),g=u.map(function(v,C){var N=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,N)}),y={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return Ie.createElement(Aa,z9({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=g4e(l,psn),x=Df(Df(Df({},Ni(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 Ie.createElement(E3,z9({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var a=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,x=o.animationEasing,g=o.animationId,y=o.animateNewValues,v=o.width,C=o.height,N=this.state,I=N.prevPoints,P=N.totalLength;return Ie.createElement(Im,{begin:d,duration:f,isActive:u,easing:x,from:{t:0},to:{t:1},key:"line-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(M){var F=M.t;if(I){var $=I.length/l.length,L=l.map(function(K,re){var de=Math.floor(re*$);if(I[de]){var G=I[de],ie=Al(G.x,K.x),ae=Al(G.y,K.y);return Df(Df({},K),{},{x:ie(F),y:ae(F)})}if(y){var q=Al(v*2,K.x),W=Al(C/2,K.y);return Df(Df({},K),{},{x:q(F),y:W(F)})}return Df(Df({},K),{},{x:K.x,y:K.y})});return a.renderCurveStatically(L,r,s)}var z=Al(0,P),Q=z(F),se;if(c){var ee="".concat(c).split(/[,\s]+/gim).map(function(K){return parseFloat(K)});se=a.getStrokeDasharray(Q,P,ee)}else se=a.generateSimpleStrokeDasharray(P,Q);return a.renderCurveStatically(l,r,s,{strokeDasharray:se})})}},{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||!f5(u,o))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(o,r,s)}},{key:"render",value:function(){var r,s=this.props,a=s.hide,o=s.dot,l=s.points,c=s.className,u=s.xAxis,d=s.yAxis,f=s.top,x=s.left,g=s.width,y=s.height,v=s.isAnimationActive,C=s.id;if(a||!l||!l.length)return null;var N=this.state.isAnimationFinished,I=l.length===1,P=ca("recharts-line",c),M=u&&u.allowDataOverflow,F=d&&d.allowDataOverflow,$=M||F,L=ji(C)?this.id:C,z=(r=Ni(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},Q=z.r,se=Q===void 0?3:Q,ee=z.strokeWidth,K=ee===void 0?2:ee,re=eUe(o)?o:{},de=re.clipDot,G=de===void 0?!0:de,ie=se*2+K;return Ie.createElement(Aa,{className:P},M||F?Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clipPath-".concat(L)},Ie.createElement("rect",{x:M?x:x-g/2,y:F?f:f-y/2,width:M?g:g*2,height:F?y:y*2})),!G&&Ie.createElement("clipPath",{id:"clipPath-dots-".concat(L)},Ie.createElement("rect",{x:x-ie/2,y:f-ie/2,width:g+ie,height:y+ie}))):null,!I&&this.renderCurve($,L),this.renderErrorBar($,L),(I||o)&&this.renderDots($,G,L),(!v||N)&&Z0.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var a=r.length%2!==0?[].concat(NC(r),[0]):r,o=[],l=0;l<s;++l)o=[].concat(NC(o),NC(a));return o}},{key:"renderDotItem",value:function(r,s){var a;if(Ie.isValidElement(r))a=Ie.cloneElement(r,s);else if(Ei(r))a=r(s);else{var o=s.key,l=g4e(s,msn),c=ca("recharts-line-dot",typeof r!="boolean"?r.className:"");a=Ie.createElement(tz,z9({key:o},l,{className:c}))}return a}}])}(h.PureComponent);am($0,"displayName","Line");am($0,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Sm.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});am($0,"getComposedData",function(t){var e=t.props,n=t.xAxis,r=t.yAxis,s=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,l=t.bandSize,c=t.displayedData,u=t.offset,d=e.layout,f=c.map(function(x,g){var y=cc(x,o);return d==="horizontal"?{x:tj({axis:n,ticks:s,bandSize:l,entry:x,index:g}),y:ji(y)?null:r.scale(y),value:y,payload:x}:{x:ji(y)?null:n.scale(y),y:tj({axis:r,ticks:a,bandSize:l,entry:x,index:g}),value:y,payload:x}});return Df({points:f,layout:d},u)});var Esn=["layout","type","stroke","connectNulls","isRange","ref"],ksn=["key"],VHe;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 WHe(t,e){if(t==null)return{};var n=Tsn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Tsn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Aw(){return Aw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Aw.apply(this,arguments)}function v4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Bb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?v4e(Object(n),!0).forEach(function(r){U0(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Isn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w4e(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 Psn(t,e,n){return w4e(t.prototype,e),w4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fsn(t,e,n){return e=OD(e),Osn(t,qHe()?Reflect.construct(e,n,OD(t).constructor):e.apply(t,n))}function Osn(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 Msn(t)}function Msn(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 OD(t){return OD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},OD(t)}function Rsn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dre(t,e)}function Dre(t,e){return Dre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Dre(t,e)}function U0(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=Lsn(t,"string");return dj(e)=="symbol"?e:e+""}function Lsn(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)}var G5=function(t){function e(){var n;Isn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Fsn(this,e,[].concat(s)),U0(n,"state",{isAnimationFinished:!0}),U0(n,"id",H5("recharts-area-")),U0(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ei(o)&&o()}),U0(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ei(o)&&o()}),n}return Rsn(e,t),Psn(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=Ni(this.props,!1),g=Ni(u,!0),y=d.map(function(C,N){var I=Bb(Bb(Bb({key:"dot-".concat(N),r:3},x),g),{},{index:N,cx:C.x,cy:C.y,dataKey:f,value:C.value,payload:C.payload,points:d});return e.renderDotItem(u,I)}),v={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return Ie.createElement(Aa,Aw({className:"recharts-area-dots"},v),y)}},{key:"renderHorizontalRect",value:function(r){var s=this.props,a=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].x,u=o[o.length-1].x,d=r*Math.abs(c-u),f=Ty(o.map(function(x){return x.y||0}));return rs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Ty(a.map(function(x){return x.y||0})),f)),rs(f)?Ie.createElement("rect",{x:c<u?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var s=this.props,a=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].y,u=o[o.length-1].y,d=r*Math.abs(c-u),f=Ty(o.map(function(x){return x.x||0}));return rs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Ty(a.map(function(x){return x.x||0})),f)),rs(f)?Ie.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=WHe(l,Esn);return Ie.createElement(Aa,{clipPath:a?"url(#clipPath-".concat(o,")"):null},Ie.createElement(E3,Aw({},Ni(g,!0),{points:r,connectNulls:f,type:u,baseLine:s,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&Ie.createElement(E3,Aw({},Ni(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&x&&Ie.createElement(E3,Aw({},Ni(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 Ie.createElement(Im,{begin:d,duration:f,isActive:u,easing:x,from:{t:0},to:{t:1},key:"area-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var I=N.t;if(v){var P=v.length/l.length,M=l.map(function(z,Q){var se=Math.floor(Q*P);if(v[se]){var ee=v[se],K=Al(ee.x,z.x),re=Al(ee.y,z.y);return Bb(Bb({},z),{},{x:K(I),y:re(I)})}return z}),F;if(rs(c)&&typeof c=="number"){var $=Al(C,c);F=$(I)}else if(ji(c)||j8(c)){var L=Al(C,0);F=L(I)}else F=c.map(function(z,Q){var se=Math.floor(Q*P);if(C[se]){var ee=C[se],K=Al(ee.x,z.x),re=Al(ee.y,z.y);return Bb(Bb({},z),{},{x:K(I),y:re(I)})}return z});return a.renderAreaStatically(M,F,r,s)}return Ie.createElement(Aa,null,Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"animationClipPath-".concat(s)},a.renderClipRect(I))),Ie.createElement(Aa,{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||!f5(d,o)||!f5(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,a=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,x=s.yAxis,g=s.width,y=s.height,v=s.isAnimationActive,C=s.id;if(a||!l||!l.length)return null;var N=this.state.isAnimationFinished,I=l.length===1,P=ca("recharts-area",c),M=f&&f.allowDataOverflow,F=x&&x.allowDataOverflow,$=M||F,L=ji(C)?this.id:C,z=(r=Ni(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},Q=z.r,se=Q===void 0?3:Q,ee=z.strokeWidth,K=ee===void 0?2:ee,re=eUe(o)?o:{},de=re.clipDot,G=de===void 0?!0:de,ie=se*2+K;return Ie.createElement(Aa,{className:P},M||F?Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clipPath-".concat(L)},Ie.createElement("rect",{x:M?d:d-g/2,y:F?u:u-y/2,width:M?g:g*2,height:F?y:y*2})),!G&&Ie.createElement("clipPath",{id:"clipPath-dots-".concat(L)},Ie.createElement("rect",{x:d-ie/2,y:u-ie/2,width:g+ie,height:y+ie}))):null,I?null:this.renderArea($,L),(o||I)&&this.renderDots($,G,L),(!v||N)&&Z0.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(h.PureComponent);VHe=G5;U0(G5,"displayName","Area");U0(G5,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});U0(G5,"getBaseValue",function(t,e,n,r){var s=t.layout,a=t.baseValue,o=e.props.baseValue,l=o??a;if(rs(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});U0(G5,"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=VHe.getBaseValue(e,n,r,s),C=g==="horizontal",N=!1,I=f.map(function(M,F){var $;y?$=u[d+F]:($=cc(M,c),Array.isArray($)?N=!0:$=[v,$]);var L=$[1]==null||y&&cc(M,c)==null;return C?{x:tj({axis:r,ticks:a,bandSize:l,entry:M,index:F}),y:L?null:s.scale($[1]),value:$,payload:M}:{x:L?null:r.scale($[1]),y:tj({axis:s,ticks:o,bandSize:l,entry:M,index:F}),value:$,payload:M}}),P;return y||N?P=I.map(function(M){var F=Array.isArray(M.value)?M.value[0]:null;return C?{x:M.x,y:F!=null&&M.y!=null?s.scale(F):null}:{x:F!=null?r.scale(F):null,y:M.y}}):P=C?s.scale(v):r.scale(v),Bb({points:I,baseLine:P,layout:g,isRange:N},x)});U0(G5,"renderDotItem",function(t,e){var n;if(Ie.isValidElement(t))n=Ie.cloneElement(t,e);else if(Ei(t))n=t(e);else{var r=ca("recharts-area-dot",typeof t!="boolean"?t.className:""),s=e.key,a=WHe(e,ksn);n=Ie.createElement(tz,Aw({},a,{key:s,className:r}))}return n});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 Dsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bsn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,XHe(r.key),r)}}function $sn(t,e,n){return Bsn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Usn(t,e,n){return e=MD(e),zsn(t,KHe()?Reflect.construct(e,n||[],MD(t).constructor):e.apply(t,n))}function zsn(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 Hsn(t)}function Hsn(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 MD(t){return MD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},MD(t)}function Vsn(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 YHe(t,e,n){return e=XHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XHe(t){var e=Wsn(t,"string");return fj(e)=="symbol"?e:e+""}function Wsn(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 cz=function(t){function e(){return Dsn(this,e),Usn(this,e,arguments)}return Vsn(e,t),$sn(e,[{key:"render",value:function(){return null}}])}(Ie.Component);YHe(cz,"displayName","ZAxis");YHe(cz,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var qsn=["option","isActive"];function H9(){return H9=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},H9.apply(this,arguments)}function Gsn(t,e){if(t==null)return{};var n=Ksn(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 Ksn(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 Ysn(t){var e=t.option,n=t.isActive,r=Gsn(t,qsn);return typeof e=="string"?Ie.createElement(jre,H9({option:Ie.createElement(zU,H9({type:e},r)),isActive:n,shapeType:"symbols"},r)):Ie.createElement(jre,H9({option:e,isActive:n,shapeType:"symbols"},r))}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 V9(){return V9=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},V9.apply(this,arguments)}function C4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vh(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){Py(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 Xsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S4e(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,ZHe(r.key),r)}}function Qsn(t,e,n){return S4e(t.prototype,e),S4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Zsn(t,e,n){return e=RD(e),Jsn(t,QHe()?Reflect.construct(e,n,RD(t).constructor):e.apply(t,n))}function Jsn(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 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 QHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QHe=function(){return!!t})()}function RD(t){return RD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},RD(t)}function tin(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$re(t,e)}function $re(t,e){return $re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},$re(t,e)}function Py(t,e,n){return e=ZHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZHe(t){var e=nin(t,"string");return hj(e)=="symbol"?e:e+""}function nin(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 uz=function(t){function e(){var n;Xsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Zsn(this,e,[].concat(s)),Py(n,"state",{isAnimationFinished:!1}),Py(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0})}),Py(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1})}),Py(n,"id",H5("recharts-scatter-")),n}return tin(e,t),Qsn(e,[{key:"renderSymbolsStatically",value:function(r){var s=this,a=this.props,o=a.shape,l=a.activeShape,c=a.activeIndex,u=Ni(this.props,!1);return r.map(function(d,f){var x=c===f,g=x?l:o,y=Vh(Vh({},u),d);return Ie.createElement(Aa,V9({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)},zE(s.props,d,f),{role:"img"}),Ie.createElement(Ysn,V9({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 Ie.createElement(Im,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var g=x.t,y=a.map(function(v,C){var N=f&&f[C];if(N){var I=Al(N.cx,v.cx),P=Al(N.cy,v.cy),M=Al(N.size,v.size);return Vh(Vh({},v),{},{cx:I(g),cy:P(g),size:M(g)})}var F=Al(0,v.size);return Vh(Vh({},v),{},{size:F(g)})});return Ie.createElement(Aa,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||!f5(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,T8);return u?u.map(function(d,f){var x=d.props,g=x.direction,y=x.dataKey;return Ie.cloneElement(d,{key:"".concat(g,"-").concat(y,"-").concat(a[f]),data:a,xAxis:o,yAxis:l,layout:g==="x"?"vertical":"horizontal",dataPointFormatter:function(C,N){return{x:C.cx,y:C.cy,value:g==="x"?+C.node.x:+C.node.y,errorVal:cc(C,N)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,s=r.points,a=r.line,o=r.lineType,l=r.lineJointType,c=Ni(this.props,!1),u=Ni(a,!1),d,f;if(o==="joint")d=s.map(function(P){return{x:P.cx,y:P.cy}});else if(o==="fitting"){var x=zHt(s),g=x.xmin,y=x.xmax,v=x.a,C=x.b,N=function(M){return v*M+C};d=[{x:g,y:N(g)},{x:y,y:N(y)}]}var I=Vh(Vh(Vh({},c),{},{fill:"none",stroke:c&&c.fill},u),{},{points:d});return Ie.isValidElement(a)?f=Ie.cloneElement(a,I):Ei(a)?f=a(I):f=Ie.createElement(E3,V9({},I,{type:l})),Ie.createElement(Aa,{className:"recharts-scatter-line",key:"recharts-scatter-line"},f)}},{key:"render",value:function(){var r=this.props,s=r.hide,a=r.points,o=r.line,l=r.className,c=r.xAxis,u=r.yAxis,d=r.left,f=r.top,x=r.width,g=r.height,y=r.id,v=r.isAnimationActive;if(s||!a||!a.length)return null;var C=this.state.isAnimationFinished,N=ca("recharts-scatter",l),I=c&&c.allowDataOverflow,P=u&&u.allowDataOverflow,M=I||P,F=ji(y)?this.id:y;return Ie.createElement(Aa,{className:N,clipPath:M?"url(#clipPath-".concat(F,")"):null},I||P?Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clipPath-".concat(F)},Ie.createElement("rect",{x:I?d:d-x/2,y:P?f:f-g/2,width:I?x:x*2,height:P?g:g*2}))):null,o&&this.renderLine(),this.renderErrorBar(),Ie.createElement(Aa,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!v||C)&&Z0.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}}])}(h.PureComponent);Py(uz,"displayName","Scatter");Py(uz,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});Py(uz,"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,Eue),f=ji(e.dataKey)?s.props.dataKey:e.dataKey,x=ji(n.dataKey)?s.props.dataKey:n.dataKey,g=r&&r.dataKey,y=r?r.range:cz.defaultProps.range,v=y&&y[0],C=e.scale.bandwidth?e.scale.bandwidth():0,N=n.scale.bandwidth?n.scale.bandwidth():0,I=a.map(function(P,M){var F=cc(P,f),$=cc(P,x),L=!ji(g)&&cc(P,g)||"-",z=[{name:ji(e.dataKey)?s.props.name:e.name||e.dataKey,unit:e.unit||"",value:F,payload:P,dataKey:f,type:u},{name:ji(n.dataKey)?s.props.name:n.name||n.dataKey,unit:n.unit||"",value:$,payload:P,dataKey:x,type:u}];L!=="-"&&z.push({name:r.name||r.dataKey,unit:r.unit||"",value:L,payload:P,dataKey:g,type:u});var Q=tj({axis:e,ticks:o,bandSize:C,entry:P,index:M,dataKey:f}),se=tj({axis:n,ticks:l,bandSize:N,entry:P,index:M,dataKey:x}),ee=L!=="-"?r.scale(L):v,K=Math.sqrt(Math.max(ee,0)/Math.PI);return Vh(Vh({},P),{},{cx:Q,cy:se,x:Q-K,y:se-K,xAxis:e,yAxis:n,zAxis:r,width:2*K,height:2*K,size:ee,node:{x:F,y:$,z:L},tooltipPayload:z,tooltipPosition:{x:Q,y:se},payload:P},d[M]&&d[M].props)});return Vh({points:I},c)});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 rin(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,tVe(r.key),r)}}function iin(t,e,n){return sin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ain(t,e,n){return e=LD(e),oin(t,JHe()?Reflect.construct(e,n||[],LD(t).constructor):e.apply(t,n))}function oin(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 lin(t)}function lin(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 LD(t){return LD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},LD(t)}function cin(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 eVe(t,e,n){return e=tVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tVe(t){var e=uin(t,"string");return pj(e)=="symbol"?e:e+""}function uin(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)}function zre(){return zre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zre.apply(this,arguments)}function din(t){var e=t.xAxisId,n=sde(),r=ide(),s=kHe(e);return s==null?null:Ie.createElement(P8,zre({},s,{className:ca("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return Kg(o,!0)}}))}var F8=function(t){function e(){return rin(this,e),ain(this,e,arguments)}return cin(e,t),iin(e,[{key:"render",value:function(){return Ie.createElement(din,this.props)}}])}(Ie.Component);eVe(F8,"displayName","XAxis");eVe(F8,"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 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 fin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hin(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 pin(t,e,n){return hin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function min(t,e,n){return e=DD(e),xin(t,nVe()?Reflect.construct(e,n||[],DD(t).constructor):e.apply(t,n))}function xin(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 gin(t)}function gin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nVe=function(){return!!t})()}function DD(t){return DD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},DD(t)}function bin(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&&Hre(t,e)}function Hre(t,e){return Hre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Hre(t,e)}function rVe(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=yin(t,"string");return mj(e)=="symbol"?e:e+""}function yin(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)}function Vre(){return Vre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vre.apply(this,arguments)}var vin=function(e){var n=e.yAxisId,r=sde(),s=ide(),a=THe(n);return a==null?null:Ie.createElement(P8,Vre({},a,{className:ca("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(l){return Kg(l,!0)}}))},O8=function(t){function e(){return fin(this,e),min(this,e,arguments)}return bin(e,t),pin(e,[{key:"render",value:function(){return Ie.createElement(vin,this.props)}}])}(Ie.Component);rVe(O8,"displayName","YAxis");rVe(O8,"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 N4e(t){return Nin(t)||Sin(t)||Cin(t)||win()}function win(){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 Cin(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 Sin(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Nin(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}var qre=function(e,n,r,s,a){var o=pf(e,ode),l=pf(e,az),c=[].concat(N4e(o),N4e(l)),u=pf(e,lz),d="".concat(s,"Id"),f=s[0],x=n;if(c.length&&(x=c.reduce(function(v,C){if(C.props[d]===r&&J0(C.props,"extendDomain")&&rs(C.props[f])){var N=C.props[f];return[Math.min(v[0],N),Math.max(v[1],N)]}return v},x)),u.length){var g="".concat(f,"1"),y="".concat(f,"2");x=u.reduce(function(v,C){if(C.props[d]===r&&J0(C.props,"extendDomain")&&rs(C.props[g])&&rs(C.props[y])){var N=C.props[g],I=C.props[y];return[Math.min(v[0],N,I),Math.max(v[1],N,I)]}return v},x)}return a&&a.length&&(x=a.reduce(function(v,C){return rs(C)?[Math.min(v[0],C),Math.max(v[1],C)]:v},x)),x},DX={exports:{}},j4e;function jin(){return j4e||(j4e=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,x){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new s(d,f||c,x),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],g]:c._events[y].push(g):(c._events[y]=g,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var x=0,g=f.length,y=new Array(g);x<g;x++)y[x]=f[x].fn;return y},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,x,g,y){var v=n?n+u:u;if(!this._events[v])return!1;var C=this._events[v],N=arguments.length,I,P;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),N){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,f),!0;case 4:return C.fn.call(C.context,d,f,x),!0;case 5:return C.fn.call(C.context,d,f,x,g),!0;case 6:return C.fn.call(C.context,d,f,x,g,y),!0}for(P=1,I=new Array(N-1);P<N;P++)I[P-1]=arguments[P];C.fn.apply(C.context,I)}else{var M=C.length,F;for(P=0;P<M;P++)switch(C[P].once&&this.removeListener(u,C[P].fn,void 0,!0),N){case 1:C[P].fn.call(C[P].context);break;case 2:C[P].fn.call(C[P].context,d);break;case 3:C[P].fn.call(C[P].context,d,f);break;case 4:C[P].fn.call(C[P].context,d,f,x);break;default:if(!I)for(F=1,I=new Array(N-1);F<N;F++)I[F-1]=arguments[F];C[P].fn.apply(C[P].context,I)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,x){var g=n?n+u:u;if(!this._events[g])return this;if(!d)return o(this,g),this;var y=this._events[g];if(y.fn)y.fn===d&&(!x||y.once)&&(!f||y.context===f)&&o(this,g);else{for(var v=0,C=[],N=y.length;v<N;v++)(y[v].fn!==d||x&&!y[v].once||f&&y[v].context!==f)&&C.push(y[v]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(DX)),DX.exports}var Ain=jin();const _in=Ti(Ain);var BX=new _in,$X="recharts.syncMouseEvents";function Ck(t){"@babel/helpers - typeof";return Ck=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ck(t)}function Ein(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kin(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iVe(r.key),r)}}function Tin(t,e,n){return kin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function UX(t,e,n){return e=iVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iVe(t){var e=Iin(t,"string");return Ck(e)=="symbol"?e:e+""}function Iin(t,e){if(Ck(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ck(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Pin=function(){function t(){Ein(this,t),UX(this,"activeIndex",0),UX(this,"coordinateList",[]),UX(this,"layout","horizontal")}return Tin(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 Fin(t,e,n){if(n==="number"&&e===!0&&Array.isArray(t)){var r=t==null?void 0:t[0],s=t==null?void 0:t[1];if(r&&s&&rs(r)&&rs(s))return!0}return!1}function Oin(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 aVe(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 Min(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 aVe(e);return[{x:r,y:s},{x:a,y:o}]}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 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 NF(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){Rin(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 Rin(t,e,n){return e=Lin(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lin(t){var e=Din(t,"string");return Sk(e)=="symbol"?e:e+""}function Din(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 Bin(t){var e,n,r=t.element,s=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,l=t.activePayload,c=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,f=t.layout,x=t.chartName,g=(e=r.props.cursor)!==null&&e!==void 0?e:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!g||!a||!o||x!=="ScatterChart"&&s!=="axis")return null;var y,v=E3;if(x==="ScatterChart")y=o,v=ctn;else if(x==="BarChart")y=Oin(f,o,c,d),v=ede;else if(f==="radial"){var C=aVe(o),N=C.cx,I=C.cy,P=C.radius,M=C.startAngle,F=C.endAngle;y={cx:N,cy:I,startAngle:M,endAngle:F,innerRadius:P,outerRadius:P},v=sHe}else y={points:Min(f,o,c)},v=E3;var $=NF(NF(NF(NF({stroke:"#ccc",pointerEvents:"none"},c),y),Ni(g,!1)),{},{payload:l,payloadIndex:u,className:ca("recharts-tooltip-cursor",g.className)});return h.isValidElement(g)?h.cloneElement(g,$):h.createElement(v,$)}var $in=["item"],Uin=["children","className","width","height","style","compact","title","desc"];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 u4(){return u4=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},u4.apply(this,arguments)}function _4e(t,e){return Vin(t)||Hin(t,e)||lVe(t,e)||zin()}function zin(){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 Hin(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 Vin(t){if(Array.isArray(t))return t}function E4e(t,e){if(t==null)return{};var n=Win(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 Win(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 qin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gin(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,cVe(r.key),r)}}function Kin(t,e,n){return Gin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yin(t,e,n){return e=BD(e),Xin(t,oVe()?Reflect.construct(e,n,BD(t).constructor):e.apply(t,n))}function Xin(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 Qin(t)}function Qin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function oVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oVe=function(){return!!t})()}function BD(t){return BD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},BD(t)}function Zin(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 gj(t){return tan(t)||ean(t)||lVe(t)||Jin()}function Jin(){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 lVe(t,e){if(t){if(typeof t=="string")return Kre(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 Kre(t,e)}}function ean(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tan(t){if(Array.isArray(t))return Kre(t)}function Kre(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 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 jr(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){si(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 si(t,e,n){return e=cVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cVe(t){var e=nan(t,"string");return xj(e)=="symbol"?e:e+""}function nan(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 ran={xAxis:["bottom","top"],yAxis:["left","right"]},san={width:"100%",height:"100%"},uVe={x:0,y:0};function jF(t){return t}var ian=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 jr(jr(jr({},s),ou(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=a.coordinate,u=s.angle;return jr(jr(jr({},s),ou(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return uVe},dz=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(gj(l),gj(u)):l},[]);return o.length>0?o:e&&e.length&&rs(s)&&rs(a)?e.slice(s,a+1):[]};function dVe(t){return t==="number"?[0,"auto"]:void 0}var Yre=function(e,n,r,s){var a=e.graphicalItems,o=e.tooltipAxis,l=dz(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=zL(g,o.dataKey,s)}else x=f&&f[r]||l[r];return x?[].concat(gj(c),[tHe(u,x)]):c},[])},T4e=function(e,n,r,s){var a=s||{x:e.chartX,y:e.chartY},o=ian(a,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=YQt(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,x=Yre(e,n,d,f),g=aan(r,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:x,activeCoordinate:g}}return null},oan=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=Zze(d,a);return r.reduce(function(y,v){var C,N=v.type.defaultProps!==void 0?jr(jr({},v.type.defaultProps),v.props):v.props,I=N.type,P=N.dataKey,M=N.allowDataOverflow,F=N.allowDuplicatedCategory,$=N.scale,L=N.ticks,z=N.includeHidden,Q=N[o];if(y[Q])return y;var se=dz(e.data,{graphicalItems:s.filter(function(he){var _e,xe=o in he.props?he.props[o]:(_e=he.type.defaultProps)===null||_e===void 0?void 0:_e[o];return xe===Q}),dataStartIndex:c,dataEndIndex:u}),ee=se.length,K,re,de;Fin(N.domain,M,I)&&(K=cre(N.domain,null,M),g&&(I==="number"||$!=="auto")&&(de=$9(se,P,"category")));var G=dVe(I);if(!K||K.length===0){var ie,ae=(ie=N.domain)!==null&&ie!==void 0?ie:G;if(P){if(K=$9(se,P,I),I==="category"&&g){var q=UHt(K);F&&q?(re=K,K=SD(0,ee)):F||(K=$6e(ae,K,v).reduce(function(he,_e){return he.indexOf(_e)>=0?he:[].concat(gj(he),[_e])},[]))}else if(I==="category")F?K=K.filter(function(he){return he!==""&&!ji(he)}):K=$6e(ae,K,v).reduce(function(he,_e){return he.indexOf(_e)>=0||_e===""||ji(_e)?he:[].concat(gj(he),[_e])},[]);else if(I==="number"){var W=eZt(se,s.filter(function(he){var _e,xe,Se=o in he.props?he.props[o]:(_e=he.type.defaultProps)===null||_e===void 0?void 0:_e[o],ge="hide"in he.props?he.props.hide:(xe=he.type.defaultProps)===null||xe===void 0?void 0:xe.hide;return Se===Q&&(z||!ge)}),P,a,d);W&&(K=W)}g&&(I==="number"||$!=="auto")&&(de=$9(se,P,"category"))}else g?K=SD(0,ee):l&&l[Q]&&l[Q].hasStack&&I==="number"?K=x==="expand"?[0,1]:eHe(l[Q].stackGroups,c,u):K=Qze(se,s.filter(function(he){var _e=o in he.props?he.props[o]:he.type.defaultProps[o],xe="hide"in he.props?he.props.hide:he.type.defaultProps.hide;return _e===Q&&(z||!xe)}),I,d,!0);if(I==="number")K=qre(f,K,Q,a,L),ae&&(K=cre(ae,K,M));else if(I==="category"&&ae){var ne=ae,oe=K.every(function(he){return ne.indexOf(he)>=0});oe&&(K=ne)}}return jr(jr({},y),{},si({},Q,jr(jr({},N),{},{axisType:a,domain:K,categoricalDomain:de,duplicateDomain:re,originalDomain:(C=N.domain)!==null&&C!==void 0?C:G,isCategorical:g,layout:d})))},{})},lan=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=dz(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),g=x.length,y=Zze(d,a),v=-1;return r.reduce(function(C,N){var I=N.type.defaultProps!==void 0?jr(jr({},N.type.defaultProps),N.props):N.props,P=I[o],M=dVe("number");if(!C[P]){v++;var F;return y?F=SD(0,g):l&&l[P]&&l[P].hasStack?(F=eHe(l[P].stackGroups,c,u),F=qre(f,F,P,a)):(F=cre(M,Qze(x,r.filter(function($){var L,z,Q=o in $.props?$.props[o]:(L=$.type.defaultProps)===null||L===void 0?void 0:L[o],se="hide"in $.props?$.props.hide:(z=$.type.defaultProps)===null||z===void 0?void 0:z.hide;return Q===P&&!se}),"number",d),s.defaultProps.allowDataOverflow),F=qre(f,F,P,a)),jr(jr({},C),{},si({},P,jr(jr({axisType:a},s.defaultProps),{},{hide:!0,orientation:dp(ran,"".concat(a,".").concat(v%2),null),domain:F,originalDomain:M,isCategorical:y,layout:d})))}return C},{})},can=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=oan(e,{axes:x,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(g=lan(e,{Axis:a,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),g},uan=function(e){var n=Kb(e),r=Kg(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Aue(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:pD(n,r)}},I4e=function(e){var n=e.children,r=e.defaultShowTooltip,s=qf(n,sj),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}},dan=function(e){return!e||!e.length?!1:e.some(function(n){var r=o1(n&&n.type);return r&&r.indexOf("Bar")>=0})},P4e=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"}},fan=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,sj),y=qf(f,j3),v=Object.keys(c).reduce(function(F,$){var L=c[$],z=L.orientation;return!L.mirror&&!L.hide?jr(jr({},F),{},si({},z,F[z]+L.width)):F},{left:x.left||0,right:x.right||0}),C=Object.keys(o).reduce(function(F,$){var L=o[$],z=L.orientation;return!L.mirror&&!L.hide?jr(jr({},F),{},si({},z,dp(F,"".concat(z))+L.height)):F},{top:x.top||0,bottom:x.bottom||0}),N=jr(jr({},C),v),I=N.bottom;g&&(N.bottom+=g.props.height||sj.defaultProps.height),y&&n&&(N=ZQt(N,s,r,n));var P=u-N.left-N.right,M=d-N.top-N.bottom;return jr(jr({brushBottom:I},N),{},{width:Math.max(P,0),height:Math.max(M,0)})},han=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},fVe=function(e){var n=e.chartName,r=e.GraphicalChild,s=e.defaultTooltipEventType,a=s===void 0?"axis":s,o=e.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,x=function(N,I){var P=I.graphicalItems,M=I.stackGroups,F=I.offset,$=I.updateId,L=I.dataStartIndex,z=I.dataEndIndex,Q=N.barSize,se=N.layout,ee=N.barGap,K=N.barCategoryGap,re=N.maxBarSize,de=P4e(se),G=de.numericAxisName,ie=de.cateAxisName,ae=dan(P),q=[];return P.forEach(function(W,ne){var oe=dz(N.data,{graphicalItems:[W],dataStartIndex:L,dataEndIndex:z}),he=W.type.defaultProps!==void 0?jr(jr({},W.type.defaultProps),W.props):W.props,_e=he.dataKey,xe=he.maxBarSize,Se=he["".concat(G,"Id")],ge=he["".concat(ie,"Id")],Ce={},je=c.reduce(function(St,on){var cn=I["".concat(on.axisType,"Map")],Vn=he["".concat(on.axisType,"Id")];cn&&cn[Vn]||on.axisType==="zAxis"||p5();var tn=cn[Vn];return jr(jr({},St),{},si(si({},on.axisType,tn),"".concat(on.axisType,"Ticks"),Kg(tn)))},Ce),Oe=je[ie],$e=je["".concat(ie,"Ticks")],Ye=M&&M[Se]&&M[Se].hasStack&&fZt(W,M[Se].stackGroups),Je=o1(W.type).indexOf("Bar")>=0,ht=pD(Oe,$e),rt=[],st=ae&&XQt({barSize:Q,stackGroups:M,totalSize:han(je,ie)});if(Je){var He,Ve,bt=ji(xe)?re:xe,xt=(He=(Ve=pD(Oe,$e,!0))!==null&&Ve!==void 0?Ve:bt)!==null&&He!==void 0?He:0;rt=QQt({barGap:ee,barCategoryGap:K,bandSize:xt!==ht?xt:ht,sizeList:st[ge],maxBarSize:bt}),xt!==ht&&(rt=rt.map(function(St){return jr(jr({},St),{},{position:jr(jr({},St.position),{},{offset:St.position.offset-xt/2})})}))}var Qt=W&&W.type&&W.type.getComposedData;Qt&&q.push({props:jr(jr({},Qt(jr(jr({},je),{},{displayedData:oe,props:N,dataKey:_e,item:W,bandSize:ht,barPosition:rt,offset:F,stackedData:Ye,layout:se,dataStartIndex:L,dataEndIndex:z}))),{},si(si(si({key:W.key||"item-".concat(ne)},G,je[G]),ie,je[ie]),"animationId",$)),childIndex:eVt(W,N.children),item:W})}),q},g=function(N,I){var P=N.props,M=N.dataStartIndex,F=N.dataEndIndex,$=N.updateId;if(!twe({props:P}))return null;var L=P.children,z=P.layout,Q=P.stackOffset,se=P.data,ee=P.reverseStackOrder,K=P4e(z),re=K.numericAxisName,de=K.cateAxisName,G=pf(L,r),ie=cZt(se,G,"".concat(re,"Id"),"".concat(de,"Id"),Q,ee),ae=c.reduce(function(he,_e){var xe="".concat(_e.axisType,"Map");return jr(jr({},he),{},si({},xe,can(P,jr(jr({},_e),{},{graphicalItems:G,stackGroups:_e.axisType===re&&ie,dataStartIndex:M,dataEndIndex:F}))))},{}),q=fan(jr(jr({},ae),{},{props:P,graphicalItems:G}),I==null?void 0:I.legendBBox);Object.keys(ae).forEach(function(he){ae[he]=d(P,ae[he],q,he.replace("Map",""),n)});var W=ae["".concat(de,"Map")],ne=uan(W),oe=x(P,jr(jr({},ae),{},{dataStartIndex:M,dataEndIndex:F,updateId:$,graphicalItems:G,stackGroups:ie,offset:q}));return jr(jr({formattedGraphicalItems:oe,graphicalItems:G,offset:q,stackGroups:ie},ne),ae)},y=function(C){function N(I){var P,M,F;return qin(this,N),F=Yin(this,N,[I]),si(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),si(F,"accessibilityManager",new Pin),si(F,"handleLegendBBoxUpdate",function($){if($){var L=F.state,z=L.dataStartIndex,Q=L.dataEndIndex,se=L.updateId;F.setState(jr({legendBBox:$},g({props:F.props,dataStartIndex:z,dataEndIndex:Q,updateId:se},jr(jr({},F.state),{},{legendBBox:$}))))}}),si(F,"handleReceiveSyncEvent",function($,L,z){if(F.props.syncId===$){if(z===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(L)}}),si(F,"handleBrushChange",function($){var L=$.startIndex,z=$.endIndex;if(L!==F.state.dataStartIndex||z!==F.state.dataEndIndex){var Q=F.state.updateId;F.setState(function(){return jr({dataStartIndex:L,dataEndIndex:z},g({props:F.props,dataStartIndex:L,dataEndIndex:z,updateId:Q},F.state))}),F.triggerSyncEvent({dataStartIndex:L,dataEndIndex:z})}}),si(F,"handleMouseEnter",function($){var L=F.getMouseInfo($);if(L){var z=jr(jr({},L),{},{isTooltipActive:!0});F.setState(z),F.triggerSyncEvent(z);var Q=F.props.onMouseEnter;Ei(Q)&&Q(z,$)}}),si(F,"triggeredAfterMouseMove",function($){var L=F.getMouseInfo($),z=L?jr(jr({},L),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(z),F.triggerSyncEvent(z);var Q=F.props.onMouseMove;Ei(Q)&&Q(z,$)}),si(F,"handleItemMouseEnter",function($){F.setState(function(){return{isTooltipActive:!0,activeItem:$,activePayload:$.tooltipPayload,activeCoordinate:$.tooltipPosition||{x:$.cx,y:$.cy}}})}),si(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),si(F,"handleMouseMove",function($){$.persist(),F.throttleTriggeredAfterMouseMove($)}),si(F,"handleMouseLeave",function($){F.throttleTriggeredAfterMouseMove.cancel();var L={isTooltipActive:!1};F.setState(L),F.triggerSyncEvent(L);var z=F.props.onMouseLeave;Ei(z)&&z(L,$)}),si(F,"handleOuterEvent",function($){var L=JHt($),z=dp(F.props,"".concat(L));if(L&&Ei(z)){var Q,se;/.*touch.*/i.test(L)?se=F.getMouseInfo($.changedTouches[0]):se=F.getMouseInfo($),z((Q=se)!==null&&Q!==void 0?Q:{},$)}}),si(F,"handleClick",function($){var L=F.getMouseInfo($);if(L){var z=jr(jr({},L),{},{isTooltipActive:!0});F.setState(z),F.triggerSyncEvent(z);var Q=F.props.onClick;Ei(Q)&&Q(z,$)}}),si(F,"handleMouseDown",function($){var L=F.props.onMouseDown;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),si(F,"handleMouseUp",function($){var L=F.props.onMouseUp;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),si(F,"handleTouchMove",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove($.changedTouches[0])}),si(F,"handleTouchStart",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseDown($.changedTouches[0])}),si(F,"handleTouchEnd",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseUp($.changedTouches[0])}),si(F,"handleDoubleClick",function($){var L=F.props.onDoubleClick;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),si(F,"handleContextMenu",function($){var L=F.props.onContextMenu;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),si(F,"triggerSyncEvent",function($){F.props.syncId!==void 0&&BX.emit($X,F.props.syncId,$,F.eventEmitterSymbol)}),si(F,"applySyncEvent",function($){var L=F.props,z=L.layout,Q=L.syncMethod,se=F.state.updateId,ee=$.dataStartIndex,K=$.dataEndIndex;if($.dataStartIndex!==void 0||$.dataEndIndex!==void 0)F.setState(jr({dataStartIndex:ee,dataEndIndex:K},g({props:F.props,dataStartIndex:ee,dataEndIndex:K,updateId:se},F.state)));else if($.activeTooltipIndex!==void 0){var re=$.chartX,de=$.chartY,G=$.activeTooltipIndex,ie=F.state,ae=ie.offset,q=ie.tooltipTicks;if(!ae)return;if(typeof Q=="function")G=Q(q,$);else if(Q==="value"){G=-1;for(var W=0;W<q.length;W++)if(q[W].value===$.activeLabel){G=W;break}}var ne=jr(jr({},ae),{},{x:ae.left,y:ae.top}),oe=Math.min(re,ne.x+ne.width),he=Math.min(de,ne.y+ne.height),_e=q[G]&&q[G].value,xe=Yre(F.state,F.props.data,G),Se=q[G]?{x:z==="horizontal"?q[G].coordinate:oe,y:z==="horizontal"?he:q[G].coordinate}:uVe;F.setState(jr(jr({},$),{},{activeLabel:_e,activeCoordinate:Se,activePayload:xe,activeTooltipIndex:G}))}else F.setState($)}),si(F,"renderCursor",function($){var L,z=F.state,Q=z.isTooltipActive,se=z.activeCoordinate,ee=z.activePayload,K=z.offset,re=z.activeTooltipIndex,de=z.tooltipAxisBandSize,G=F.getTooltipEventType(),ie=(L=$.props.active)!==null&&L!==void 0?L:Q,ae=F.props.layout,q=$.key||"_recharts-cursor";return Ie.createElement(Bin,{key:q,activeCoordinate:se,activePayload:ee,activeTooltipIndex:re,chartName:n,element:$,isActive:ie,layout:ae,offset:K,tooltipAxisBandSize:de,tooltipEventType:G})}),si(F,"renderPolarAxis",function($,L,z){var Q=dp($,"type.axisType"),se=dp(F.state,"".concat(Q,"Map")),ee=$.type.defaultProps,K=ee!==void 0?jr(jr({},ee),$.props):$.props,re=se&&se[K["".concat(Q,"Id")]];return h.cloneElement($,jr(jr({},re),{},{className:ca(Q,re.className),key:$.key||"".concat(L,"-").concat(z),ticks:Kg(re,!0)}))}),si(F,"renderPolarGrid",function($){var L=$.props,z=L.radialLines,Q=L.polarAngles,se=L.polarRadius,ee=F.state,K=ee.radiusAxisMap,re=ee.angleAxisMap,de=Kb(K),G=Kb(re),ie=G.cx,ae=G.cy,q=G.innerRadius,W=G.outerRadius;return h.cloneElement($,{polarAngles:Array.isArray(Q)?Q:Kg(G,!0).map(function(ne){return ne.coordinate}),polarRadius:Array.isArray(se)?se:Kg(de,!0).map(function(ne){return ne.coordinate}),cx:ie,cy:ae,innerRadius:q,outerRadius:W,key:$.key||"polar-grid",radialLines:z})}),si(F,"renderLegend",function(){var $=F.state.formattedGraphicalItems,L=F.props,z=L.children,Q=L.width,se=L.height,ee=F.props.margin||{},K=Q-(ee.left||0)-(ee.right||0),re=Yze({children:z,formattedGraphicalItems:$,legendWidth:K,legendContent:u});if(!re)return null;var de=re.item,G=E4e(re,$in);return h.cloneElement(de,jr(jr({},G),{},{chartWidth:Q,chartHeight:se,margin:ee,onBBoxUpdate:F.handleLegendBBoxUpdate}))}),si(F,"renderTooltip",function(){var $,L=F.props,z=L.children,Q=L.accessibilityLayer,se=qf(z,sm);if(!se)return null;var ee=F.state,K=ee.isTooltipActive,re=ee.activeCoordinate,de=ee.activePayload,G=ee.activeLabel,ie=ee.offset,ae=($=se.props.active)!==null&&$!==void 0?$:K;return h.cloneElement(se,{viewBox:jr(jr({},ie),{},{x:ie.left,y:ie.top}),active:ae,label:G,payload:ae?de:[],coordinate:re,accessibilityLayer:Q})}),si(F,"renderBrush",function($){var L=F.props,z=L.margin,Q=L.data,se=F.state,ee=se.offset,K=se.dataStartIndex,re=se.dataEndIndex,de=se.updateId;return h.cloneElement($,{key:$.key||"_recharts-brush",onChange:vF(F.handleBrushChange,$.props.onChange),data:Q,x:rs($.props.x)?$.props.x:ee.left,y:rs($.props.y)?$.props.y:ee.top+ee.height+ee.brushBottom-(z.bottom||0),width:rs($.props.width)?$.props.width:ee.width,startIndex:K,endIndex:re,updateId:"brush-".concat(de)})}),si(F,"renderReferenceElement",function($,L,z){if(!$)return null;var Q=F,se=Q.clipPathId,ee=F.state,K=ee.xAxisMap,re=ee.yAxisMap,de=ee.offset,G=$.type.defaultProps||{},ie=$.props,ae=ie.xAxisId,q=ae===void 0?G.xAxisId:ae,W=ie.yAxisId,ne=W===void 0?G.yAxisId:W;return h.cloneElement($,{key:$.key||"".concat(L,"-").concat(z),xAxis:K[q],yAxis:re[ne],viewBox:{x:de.left,y:de.top,width:de.width,height:de.height},clipPathId:se})}),si(F,"renderActivePoints",function($){var L=$.item,z=$.activePoint,Q=$.basePoint,se=$.childIndex,ee=$.isRange,K=[],re=L.props.key,de=L.item.type.defaultProps!==void 0?jr(jr({},L.item.type.defaultProps),L.item.props):L.item.props,G=de.activeDot,ie=de.dataKey,ae=jr(jr({index:se,dataKey:ie,cx:z.x,cy:z.y,r:4,fill:Jue(L.item),strokeWidth:2,stroke:"#fff",payload:z.payload,value:z.value},Ni(G,!1)),HL(G));return K.push(N.renderActiveDot(G,ae,"".concat(re,"-activePoint-").concat(se))),Q?K.push(N.renderActiveDot(G,jr(jr({},ae),{},{cx:Q.x,cy:Q.y}),"".concat(re,"-basePoint-").concat(se))):ee&&K.push(null),K}),si(F,"renderGraphicChild",function($,L,z){var Q=F.filterFormatItem($,L,z);if(!Q)return null;var se=F.getTooltipEventType(),ee=F.state,K=ee.isTooltipActive,re=ee.tooltipAxis,de=ee.activeTooltipIndex,G=ee.activeLabel,ie=F.props.children,ae=qf(ie,sm),q=Q.props,W=q.points,ne=q.isRange,oe=q.baseLine,he=Q.item.type.defaultProps!==void 0?jr(jr({},Q.item.type.defaultProps),Q.item.props):Q.item.props,_e=he.activeDot,xe=he.hide,Se=he.activeBar,ge=he.activeShape,Ce=!!(!xe&&K&&ae&&(_e||Se||ge)),je={};se!=="axis"&&ae&&ae.props.trigger==="click"?je={onClick:vF(F.handleItemMouseEnter,$.props.onClick)}:se!=="axis"&&(je={onMouseLeave:vF(F.handleItemMouseLeave,$.props.onMouseLeave),onMouseEnter:vF(F.handleItemMouseEnter,$.props.onMouseEnter)});var Oe=h.cloneElement($,jr(jr({},Q.props),je));function $e(on){return typeof re.dataKey=="function"?re.dataKey(on.payload):null}if(Ce)if(de>=0){var Ye,Je;if(re.dataKey&&!re.allowDuplicatedCategory){var ht=typeof re.dataKey=="function"?$e:"payload.".concat(re.dataKey.toString());Ye=zL(W,ht,G),Je=ne&&oe&&zL(oe,ht,G)}else Ye=W==null?void 0:W[de],Je=ne&&oe&&oe[de];if(ge||Se){var rt=$.props.activeIndex!==void 0?$.props.activeIndex:de;return[h.cloneElement($,jr(jr(jr({},Q.props),je),{},{activeIndex:rt})),null,null]}if(!ji(Ye))return[Oe].concat(gj(F.renderActivePoints({item:Q,activePoint:Ye,basePoint:Je,childIndex:de,isRange:ne})))}else{var st,He=(st=F.getItemByXY(F.state.activeCoordinate))!==null&&st!==void 0?st:{graphicalItem:Oe},Ve=He.graphicalItem,bt=Ve.item,xt=bt===void 0?$:bt,Qt=Ve.childIndex,St=jr(jr(jr({},Q.props),je),{},{activeIndex:Qt});return[h.cloneElement(xt,St),null,null]}return ne?[Oe,null,null]:[Oe,null]}),si(F,"renderCustomized",function($,L,z){return h.cloneElement($,jr(jr({key:"recharts-customized-".concat(z)},F.props),F.state))}),si(F,"renderMap",{CartesianGrid:{handler:jF,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:jF},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:jF},YAxis:{handler:jF},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((P=I.id)!==null&&P!==void 0?P:H5("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=KUe(F.triggeredAfterMouseMove,(M=I.throttleDelay)!==null&&M!==void 0?M:1e3/60),F.state={},F}return Zin(N,C),Kin(N,[{key:"componentDidMount",value:function(){var P,M;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(P=this.props.margin.left)!==null&&P!==void 0?P:0,top:(M=this.props.margin.top)!==null&&M!==void 0?M:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var P=this.props,M=P.children,F=P.data,$=P.height,L=P.layout,z=qf(M,sm);if(z){var Q=z.props.defaultIndex;if(!(typeof Q!="number"||Q<0||Q>this.state.tooltipTicks.length-1)){var se=this.state.tooltipTicks[Q]&&this.state.tooltipTicks[Q].value,ee=Yre(this.state,F,Q,se),K=this.state.tooltipTicks[Q].coordinate,re=(this.state.offset.top+$)/2,de=L==="horizontal",G=de?{x:K,y:re}:{y:K,x:re},ie=this.state.formattedGraphicalItems.find(function(q){var W=q.item;return W.type.name==="Scatter"});ie&&(G=jr(jr({},G),ie.props.points[Q].tooltipPosition),ee=ie.props.points[Q].tooltipPayload);var ae={activeTooltipIndex:Q,isTooltipActive:!0,activeLabel:se,activePayload:ee,activeCoordinate:G};this.setState(ae),this.renderCursor(z),this.accessibilityManager.setIndex(Q)}}}},{key:"getSnapshotBeforeUpdate",value:function(P,M){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==M.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==P.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==P.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(P){Ine([qf(P.children,sm)],[qf(this.props.children,sm)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=qf(this.props.children,sm);if(P&&typeof P.props.shared=="boolean"){var M=P.props.shared?"axis":"item";return l.indexOf(M)>=0?M:a}return a}},{key:"getMouseInfo",value:function(P){if(!this.container)return null;var M=this.container,F=M.getBoundingClientRect(),$=BGt(F),L={chartX:Math.round(P.pageX-$.left),chartY:Math.round(P.pageY-$.top)},z=F.width/M.offsetWidth||1,Q=this.inRange(L.chartX,L.chartY,z);if(!Q)return null;var se=this.state,ee=se.xAxisMap,K=se.yAxisMap,re=this.getTooltipEventType(),de=T4e(this.state,this.props.data,this.props.layout,Q);if(re!=="axis"&&ee&&K){var G=Kb(ee).scale,ie=Kb(K).scale,ae=G&&G.invert?G.invert(L.chartX):null,q=ie&&ie.invert?ie.invert(L.chartY):null;return jr(jr({},L),{},{xValue:ae,yValue:q},de)}return de?jr(jr({},L),de):null}},{key:"inRange",value:function(P,M){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,$=this.props.layout,L=P/F,z=M/F;if($==="horizontal"||$==="vertical"){var Q=this.state.offset,se=L>=Q.left&&L<=Q.left+Q.width&&z>=Q.top&&z<=Q.top+Q.height;return se?{x:L,y:z}:null}var ee=this.state,K=ee.angleAxisMap,re=ee.radiusAxisMap;if(K&&re){var de=Kb(K);return H6e({x:L,y:z},de)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,M=this.getTooltipEventType(),F=qf(P,sm),$={};F&&M==="axis"&&(F.props.trigger==="click"?$={onClick:this.handleClick}:$={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var L=HL(this.props,this.handleOuterEvent);return jr(jr({},L),$)}},{key:"addListener",value:function(){BX.on($X,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){BX.removeListener($X,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,M,F){for(var $=this.state.formattedGraphicalItems,L=0,z=$.length;L<z;L++){var Q=$[L];if(Q.item===P||Q.props.key===P.key||M===o1(Q.item.type)&&F===Q.childIndex)return Q}return null}},{key:"renderClipPath",value:function(){var P=this.clipPathId,M=this.state.offset,F=M.left,$=M.top,L=M.height,z=M.width;return Ie.createElement("defs",null,Ie.createElement("clipPath",{id:P},Ie.createElement("rect",{x:F,y:$,height:L,width:z})))}},{key:"getXScales",value:function(){var P=this.state.xAxisMap;return P?Object.entries(P).reduce(function(M,F){var $=_4e(F,2),L=$[0],z=$[1];return jr(jr({},M),{},si({},L,z.scale))},{}):null}},{key:"getYScales",value:function(){var P=this.state.yAxisMap;return P?Object.entries(P).reduce(function(M,F){var $=_4e(F,2),L=$[0],z=$[1];return jr(jr({},M),{},si({},L,z.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(P){var M;return(M=this.state.xAxisMap)===null||M===void 0||(M=M[P])===null||M===void 0?void 0:M.scale}},{key:"getYScaleByAxisId",value:function(P){var M;return(M=this.state.yAxisMap)===null||M===void 0||(M=M[P])===null||M===void 0?void 0:M.scale}},{key:"getItemByXY",value:function(P){var M=this.state,F=M.formattedGraphicalItems,$=M.activeItem;if(F&&F.length)for(var L=0,z=F.length;L<z;L++){var Q=F[L],se=Q.props,ee=Q.item,K=ee.type.defaultProps!==void 0?jr(jr({},ee.type.defaultProps),ee.props):ee.props,re=o1(ee.type);if(re==="Bar"){var de=(se.data||[]).find(function(q){return Jen(P,q)});if(de)return{graphicalItem:Q,payload:de}}else if(re==="RadialBar"){var G=(se.data||[]).find(function(q){return H6e(P,q)});if(G)return{graphicalItem:Q,payload:G}}else if(nz(Q,$)||rz(Q,$)||gk(Q,$)){var ie=ztn({graphicalItem:Q,activeTooltipItem:$,itemData:K.data}),ae=K.activeIndex===void 0?ie:K.activeIndex;return{graphicalItem:jr(jr({},Q),{},{childIndex:ae}),payload:gk(Q,$)?K.data[ie]:Q.props.data[ie]}}}return null}},{key:"render",value:function(){var P=this;if(!twe(this))return null;var M=this.props,F=M.children,$=M.className,L=M.width,z=M.height,Q=M.style,se=M.compact,ee=M.title,K=M.desc,re=E4e(M,Uin),de=Ni(re,!1);if(se)return Ie.createElement(s4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Ie.createElement(Fne,u4({},de,{width:L,height:z,title:ee,desc:K}),this.renderClipPath(),rwe(F,this.renderMap)));if(this.props.accessibilityLayer){var G,ie;de.tabIndex=(G=this.props.tabIndex)!==null&&G!==void 0?G:0,de.role=(ie=this.props.role)!==null&&ie!==void 0?ie:"application",de.onKeyDown=function(q){P.accessibilityManager.keyboardEvent(q)},de.onFocus=function(){P.accessibilityManager.focus()}}var ae=this.parseEventsOfWrapper();return Ie.createElement(s4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Ie.createElement("div",u4({className:ca("recharts-wrapper",$),style:jr({position:"relative",cursor:"default",width:L,height:z},Q)},ae,{ref:function(W){P.container=W}}),Ie.createElement(Fne,u4({},de,{width:L,height:z,title:ee,desc:K,style:san}),this.renderClipPath(),rwe(F,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(h.Component);si(y,"displayName",n),si(y,"defaultProps",jr({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),si(y,"getDerivedStateFromProps",function(C,N){var I=C.dataKey,P=C.data,M=C.children,F=C.width,$=C.height,L=C.layout,z=C.stackOffset,Q=C.margin,se=N.dataStartIndex,ee=N.dataEndIndex;if(N.updateId===void 0){var K=I4e(C);return jr(jr(jr({},K),{},{updateId:0},g(jr(jr({props:C},K),{},{updateId:0}),N)),{},{prevDataKey:I,prevData:P,prevWidth:F,prevHeight:$,prevLayout:L,prevStackOffset:z,prevMargin:Q,prevChildren:M})}if(I!==N.prevDataKey||P!==N.prevData||F!==N.prevWidth||$!==N.prevHeight||L!==N.prevLayout||z!==N.prevStackOffset||!L4(Q,N.prevMargin)){var re=I4e(C),de={chartX:N.chartX,chartY:N.chartY,isTooltipActive:N.isTooltipActive},G=jr(jr({},T4e(N,P,L)),{},{updateId:N.updateId+1}),ie=jr(jr(jr({},re),de),G);return jr(jr(jr({},ie),g(jr({props:C},ie),N)),{},{prevDataKey:I,prevData:P,prevWidth:F,prevHeight:$,prevLayout:L,prevStackOffset:z,prevMargin:Q,prevChildren:M})}if(!Ine(M,N.prevChildren)){var ae,q,W,ne,oe=qf(M,sj),he=oe&&(ae=(q=oe.props)===null||q===void 0?void 0:q.startIndex)!==null&&ae!==void 0?ae:se,_e=oe&&(W=(ne=oe.props)===null||ne===void 0?void 0:ne.endIndex)!==null&&W!==void 0?W:ee,xe=he!==se||_e!==ee,Se=!ji(P),ge=Se&&!xe?N.updateId:N.updateId+1;return jr(jr({updateId:ge},g(jr(jr({props:C},N),{},{updateId:ge,dataStartIndex:he,dataEndIndex:_e}),N)),{},{prevChildren:M,dataStartIndex:he,dataEndIndex:_e})}return null}),si(y,"renderActiveDot",function(C,N,I){var P;return h.isValidElement(C)?P=h.cloneElement(C,N):Ei(C)?P=C(N):P=Ie.createElement(tz,N),Ie.createElement(Aa,{className:"recharts-active-dot",key:I},P)});var v=h.forwardRef(function(N,I){return Ie.createElement(y,u4({},N,{ref:I}))});return v.displayName=y.displayName,v},pan=fVe({chartName:"LineChart",GraphicalChild:$0,axisComponents:[{axisType:"xAxis",AxisComp:F8},{axisType:"yAxis",AxisComp:O8}],formatAxisMap:wHe}),man=fVe({chartName:"ComposedChart",GraphicalChild:[$0,G5,I8,uz],axisComponents:[{axisType:"xAxis",AxisComp:F8},{axisType:"yAxis",AxisComp:O8},{axisType:"zAxis",AxisComp:cz}],formatAxisMap:wHe});const xan=({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 I=(((g=(x=(await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:c},{headers:{Accept:"*/*","Content-Type":"application/json"},signal:u.signal})).data.find(P=>P[0]===f))==null?void 0:x[1])==null?void 0:g[s])||[]).map(([P,M])=>({time:new Date(P).getTime(),value:parseFloat(M)}));n(I)}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(BAe,{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(YUe,{width:"100%",height:40,children:i.jsxs(pan,{data:e,children:[i.jsx(F8,{dataKey:"time",hide:!0}),i.jsx(O8,{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:["$",Er(f.value)]})]})]})}return null},wrapperStyle:{marginLeft:"-40px",marginTop:"-50px"}}),i.jsx($0,{type:"monotone",dataKey:"value",stroke:"#67FFBD",strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})},gan="https://dextradata.nftinit.io/api/hyper/analytics/wallet_backtest_summary/?format=json&limit=48&offset=0&order_by=three_month_pnl&order_dir=desc",ban=({handleAddedTime:t})=>{const{trackedWatchList:e,copyTradeWatchList:n,setSignModalOpen:r}=h.useContext(Yr),{address:s}=es(),[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,N]=h.useState(null),[I,P]=h.useState(null),[M,F]=h.useState("");h.useEffect(()=>{(async()=>{try{c(!0),d(null);const ee=await fetch(gan);if(!ee.ok)throw new Error(`HTTP error! status: ${ee.status}`);const K=await ee.json();o((K==null?void 0:K.data)||[])}catch{d("Failed to fetch wallets.")}finally{c(!1)}})()},[]);const $=async({walletAddress:se,isFollow:ee,isScalper:K})=>{try{F(se);const re=window.localStorage.getItem("hyperToken"),de=window.localStorage.getItem("hyperAddress");if(!re){r(!0);return}const G=ee?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",ie=ee?{address:s?s.toLowerCase():de,token:re,follow_address:se.toLowerCase()}:{address:s?s.toLowerCase():de,token:re},ae=await fetch(G,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ie)});if(!ae.ok)throw new Error(`Server responded with status ${ae.status}`);const q=await ae.json();q.success?(N(Array.isArray(q==null?void 0:q.data)?[...q.data].sort((W,ne)=>new Date(ne.created_at||0)-new Date(W.created_at||0)):q==null?void 0:q.data),P(K),v(!0)):dn.error(q.error_message)}catch(re){dn.error(re.message||"Something went wrong!")}},L=Math.ceil(a.length/g),z=(f-1)*g,Q=a.slice(z,z+g);return i.jsxs(i.Fragment,{children:[i.jsx(U5,{open:y,setOpen:v,copyTradeData:C,copyTradeWallet:M,setCopyTradeWallet:F,isScalper:I,setCopyTradeData:N}),i.jsx("div",{className:"grid grid-cols-2 gap-4 w-full",children:l?i.jsx("div",{className:"flex justify-center items-center w-full h-[300px] col-span-2",children:i.jsx(Ba,{})}):i.jsxs(i.Fragment,{children:[Q==null?void 0:Q.map((se,ee)=>{var de,G,ie,ae,q,W,ne,oe,he;const K=e==null?void 0:e.some(_e=>_e.wallet_address===(se==null?void 0:se.user_token)),re=n==null?void 0:n.some(_e=>_e.wallet_address===(se==null?void 0:se.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:ee*.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:Ki,alt:"",className:"w-7 h-7 sm:w-8 sm:h-8 rounded-md"}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${se==null?void 0:se.user_token}`,"_blank"),t()},className:"text-white text-[12px] sm:text-base font-semibold font-manrope leading-none tracking-wide cursor-pointer",children:(se==null?void 0:se.user_token)&&(se==null?void 0:se.user_token.slice(0,6))+"..."+(se==null?void 0:se.user_token.slice(-4))}),i.jsx($5,{walletAddress:se==null?void 0:se.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:K?i.jsx("img",{src:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})}),i.jsx(xan,{wallet:se==null?void 0:se.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(zX,{title:"PNL",data:[{label:"7D:",value:(de=se==null?void 0:se.source_data)==null?void 0:de.portfolio_perp_week_pnl,format:Ms},{label:"30D:",value:(G=se==null?void 0:se.source_data)==null?void 0:G.portfolio_perp_month_pnl,format:Ms},{label:"90D:",value:(ie=se==null?void 0:se.source_data)==null?void 0:ie.portfolio_perp_3month_pnl,format:Ms}]}),i.jsx(zX,{title:"Growth Rate",data:[{label:"7D:",value:(ae=se==null?void 0:se.source_data)==null?void 0:ae.portfolio_perp_week_growth_rate},{label:"30D:",value:(q=se==null?void 0:se.source_data)==null?void 0:q.portfolio_perp_month_growth_rate},{label:"90D:",value:(W=se==null?void 0:se.source_data)==null?void 0:W.portfolio_perp_3month_growth_rate}]}),i.jsx(zX,{title:"Drawdown",data:[{label:"7D:",value:(ne=se==null?void 0:se.source_data)==null?void 0:ne.portfolio_perp_week_dd,format:Ms},{label:"30D:",value:(oe=se==null?void 0:se.source_data)==null?void 0:oe.portfolio_perp_month_dd,format:Ms},{label:"90D:",value:(he=se==null?void 0:se.source_data)==null?void 0:he.portfolio_perp_3month_dd,format:Ms}]})]}),i.jsxs(pm.button,{onClick:_e=>{_e.preventDefault(),$({walletAddress:se==null?void 0:se.user_token,isFollow:re,isScalper:se==null?void 0:se.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 ${re?"bg-[#67ffbd] text-[#161616]":"text-[#161616]"}`,children:[i.jsx("span",{className:"relative z-10",children:re?"Adjust Copy":"Copy Trade"}),!re&&i.jsxs(i.Fragment,{children:[i.jsx(pm.span,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-xl",style:{background:"linear-gradient(90deg, #67FFCD 0%, #67FFBD 50%, #67FFFD 100%)",backgroundSize:"300% 100%"},initial:{backgroundPosition:"0% 50%",opacity:1},animate:{backgroundPosition:["0% 50%","100% 50%","0% 50%"]},transition:{duration:3.2,repeat:1/0,ease:"linear"}}),i.jsx(pm.span,{"aria-hidden":!0,className:"pointer-events-none absolute -inset-1 rounded-xl blur-lg",style:{background:"radial-gradient(60% 60% at 50% 50%, rgba(117,53,254,0.55), transparent 60%)"},initial:{opacity:.6},animate:{opacity:[.55,.95,.55],scale:[1,1.03,1]},transition:{duration:1.6,repeat:1/0,ease:"easeInOut"}})]})]})]})]})},`${z+ee}-${se==null?void 0:se.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(se=>se-1),disabled:f===1,children:"Prev"}),i.jsxs("span",{className:"text-white text-sm",children:["Page ",f," of ",L]}),i.jsx("button",{className:"px-3 py-1 rounded bg-[#333] text-white disabled:opacity-50 focus:outline-none focus:ring-0 border-none",onClick:()=>x(se=>se+1),disabled:f===L,children:"Next"})]})]})})]})},zX=({title:t,data:e})=>i.jsxs("div",{className:"flex flex-col justify-start items-start gap-4 w-full",children:[i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full",children:[i.jsx("div",{className:"text-[#fff] text-xs font-normal font-manrope leading-[13px] tracking-wide min-w-max",children:t}),e.map((n,r)=>i.jsxs("div",{className:"flex justify-between sm:justify-start items-center gap-2 w-full",children:[i.jsx("span",{className:"flex justify-start items-center text-[#9b9b9b] text-xs font-medium min-w-[30px]",children:n.label}),i.jsxs("span",{className:`${n.value==null||isNaN(parseFloat(n.value))||n.value==0?"text-white":n.value>0?"text-[#1DE6A3]":"text-[#FF7173]"} text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:[t==="Growth Rate"||t==="Drawdown"?"":"$",n.format?n.format(Math.abs(n.value)):Ms(n.value),t==="Growth Rate"||t==="Drawdown"?"%":""]})]},r))]}),(t==="Growth Rate"||t==="PNL")&&i.jsx("div",{className:"h-px w-full min-w-full sm:hidden bg-[#404040]"})]}),yan=({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(Ca,{open:t,onClose:a,className:"relative z-50",children:[i.jsx(wa,{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(xa,{as:pm.div,initial:{opacity:0,y:22,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",bounce:.22,duration:.5},className:"relative transform overflow-hidden rounded-3xl w-full xl:w-[70%] 2xl:w-[60%] p-[1px] bg-gradient-to-br from-black/90 via-black/70 to-black/50",children:i.jsxs("div",{className:"relative flex flex-col justify-start items-center gap-6 w-full min-h-[420px] p-4 sm:p-8 rounded-3xl",children:[i.jsxs("div",{className:"absolute inset-0 -z-10 overflow-hidden rounded-3xl",children:[i.jsx(pm.div,{className:"absolute -inset-28 opacity-60",style:{background:"radial-gradient(60% 60% at 20% 20%, rgba(103,255,189,0.18) 0%, transparent 60%), radial-gradient(60% 60% at 80% 30%, rgba(117,53,254,0.18) 0%, transparent 60%), radial-gradient(70% 70% at 50% 90%, rgba(255,121,124,0.18) 0%, transparent 60%)"},animate:{rotate:[0,360]},transition:{duration:60,repeat:1/0,ease:"linear"}}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(255,255,255,0.06),transparent_60%)]"}),i.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(rgba(255,255,255,0.06)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.06)_1px,transparent_1px)] bg-[size:18px_18px] opacity-10"})]}),i.jsx("button",{onClick:a,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"flex justify-start items-center w-full",children:i.jsxs("div",{className:"flex flex-col items-start w-full gap-3 sm:gap-5",children:[i.jsx("div",{className:"text-white font-manrope text-[20px] sm:text-[22px] font-extrabold leading-none -ml-[3px] tracking-[-0.2px]",children:"🔥 Daily Picks"}),i.jsx("div",{className:"text-[13px] sm:text-[14px] text-start text-white/90 font-manrope font-semibold leading-[18px] max-w-[70ch]",children:"Our algorithm highlights traders with proven skills, strong profits, and low drawdowns — ready for you to copy."})]})}),i.jsx("div",{className:"flex justify-start items-center w-full",children:i.jsx(ban,{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"})]})]})})})})]})},van=()=>{const[t,e]=h.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(yan,{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 wan(){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(van,{})}),i.jsxs("div",{className:"h-full w-full flex items-center justify-end gap-2",children:[i.jsx(D$t,{}),i.jsx(B$t,{}),i.jsx($$t,{}),i.jsx(U$t,{})]})]})})}const Can=()=>{const t=Xl();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(L$t,{}),i.jsx("div",{className:"hidden sm:block",children:i.jsx(c$t,{})}),i.jsx("div",{className:"block sm:hidden",children:i.jsx(R$t,{})}),i.jsx("div",{style:{height:"calc(100vh - 4.875rem)"},className:"flex flex-col items-stretch justify-start flex-grow h-full w-[100vw] overflow-auto",children:i.jsx("main",{children:i.jsx(JQe,{})})}),i.jsx(wan,{})]})},na=({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})]}),eo=({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"})}),fz=({sortKey:t,state:e,className:n})=>"-"+t===e?i.jsx(eo,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] rotate-180 "+n}):t===e?i.jsx(eo,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}):i.jsx(eo,{className:"text-[#9B9B9B] hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}),el=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s,isFilter:a})=>{const o=()=>{r(n===`-${e}`?e:`-${e}`)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>o(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope cursor-pointer`,children:[i.jsx("div",{className:`${n===e||n===`-${e}`?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(fz,{sortKey:e,state:n,className:""})]})})};function Ll(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(Vs,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!0})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{value:e,onChange:f=>n(f.target.value),onBlur:a,onFocus:c,onBlurCapture:u,type:"number",name:t.minInputName,onKeyDown:["Win Count","Loss Count","Trades Count","Tx Count","Perp Equity","Margin %","Margin Used","Avg. Lvg.","Drawdown PnL"].includes(t.name)?d:void 0,placeholder:"Min",className:`py-0.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-sm font-medium font-inter leading-[8px] w-1/2 px-2 ${e!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`}),i.jsx("input",{value:r,onChange:f=>s(f.target.value),onBlur:o,onFocus:c,onBlurCapture:u,type:"number",name:t.maxInputName,onKeyDown:["Win Count","Loss Count","Trades Count","Tx Count","Perp Equity","Margin %","Margin Used","Avg. Lvg.","Drawdown PnL"].includes(t.name)?d:void 0,placeholder:"Max",className:`bg-[#1b1b1b] rounded-md border border-[#303030] py-0.5 h-8 block sm:text-sm font-semibold font-manrope leading-none w-1/2 px-2 ${r!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`})]})]})}function F4e(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 San=({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"})}),HX=({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(San,{})})]}),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})]})},Nan=({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"})]}),jan=({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"})}),Aan=({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"})});GUe();function _an(t){var Q,se,ee,K,re,de,G,ie,ae,q;const[e,n]=h.useState(!1),r=h.useRef(null),[s,a]=h.useState(!1),o=h.useRef(null);h.useEffect(()=>{var ne;const W=(ne=t.advancedFilters)==null?void 0:ne.coin;if(t.dataCoin.length>0){const he=W.split(",").map(_e=>t.dataCoin.find(xe=>xe.value===_e)).filter(Boolean);t.setSelectedCoins(he)}},[t.dataCoin]),h.useEffect(()=>{var ne;const W=(ne=t.advancedFilters)==null?void 0:ne.refcode;if(W&&t.dataReferral.length>0){const he=W.split(",").map(_e=>t.dataReferral.find(xe=>xe.value===_e)).filter(Boolean);t.setSelectedReferrals(he)}},[t.dataReferral]);const l=W=>{if(!W)return;const oe=Array.isArray(W)?W:[W],he=t.selectedCoins||[],_e=[...he,...oe.filter(ge=>!he.some(Ce=>Ce.value===ge.value))],Se=_e.map(ge=>ge.value).join(",");t.setSelectedCoins(_e),t.setAdvancedFilters(ge=>({...ge,coin:Se}))},c=W=>{if(!W)return;const oe=Array.isArray(W)?W:[W],he=t.selectedReferrals||[],_e=[...he,...oe.filter(Se=>!he.some(ge=>ge.value===Se.value))],xe=_e.map(Se=>Se.value);xe.join(","),t.setSelectedReferrals(_e),t.setAdvancedFilters(Se=>({...Se,refcode:xe}))},u=W=>{const{name:ne,value:oe}=W.target;t.setAdvancedFilters(he=>({...he,[ne]:oe}))},d={control:(W,{isFocused:ne})=>{var oe,he,_e,xe,Se,ge,Ce,je;return{...W,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((oe=t.advancedFilters)==null?void 0:oe.coin)&&((he=t.advancedFilters)==null?void 0:he.coin.length)>0||typeof((_e=t.advancedFilters)==null?void 0:_e.coin)=="string"&&((xe=t.advancedFilters)==null?void 0:xe.coin.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((Se=t.advancedFilters)==null?void 0:Se.coin)&&((ge=t.advancedFilters)==null?void 0:ge.coin.length)>0||typeof((Ce=t.advancedFilters)==null?void 0:Ce.coin)=="string"&&((je=t.advancedFilters)==null?void 0:je.coin.trim())!==""?"1px solid #8d67ff":"none"}}},menu:W=>({...W,backgroundColor:"#353535",maxWidth:"248px"}),menuList:W=>({...W,backgroundColor:"#353535",maxHeight:"180px",zIndex:50}),clearIndicator:W=>({...W,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:W=>({...W,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:(W,{data:ne,isDisabled:oe,isFocused:he,isSelected:_e})=>{const xe=yi(ne.color);return{...W,fontSize:"14px",fontWeight:"600",backgroundColor:oe?void 0:_e?ne.color:he?xe.alpha(.1).css():void 0,color:"white",cursor:oe?"not-allowed":"pointer",":active":{...W[":active"],backgroundColor:oe?void 0:_e?ne.color:xe.alpha(.9).css()}}},multiValue:(W,{data:ne})=>{const oe=yi(ne.color);return{...W,backgroundColor:oe.alpha(.4).css()}},multiValueLabel:(W,{data:ne})=>({...W,color:"white"}),multiValueRemove:(W,{data:ne})=>({...W,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:W=>({...W,color:"white"}),valueContainer:W=>({...W,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},f={control:(W,{isFocused:ne})=>{var oe,he,_e,xe,Se,ge,Ce,je;return{...W,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((oe=t.advancedFilters)==null?void 0:oe.refcode)&&((he=t.advancedFilters)==null?void 0:he.refcode.length)>0||typeof((_e=t.advancedFilters)==null?void 0:_e.refcode)=="string"&&((xe=t.advancedFilters)==null?void 0:xe.refcode.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((Se=t.advancedFilters)==null?void 0:Se.refcode)&&((ge=t.advancedFilters)==null?void 0:ge.refcode.length)>0||typeof((Ce=t.advancedFilters)==null?void 0:Ce.refcode)=="string"&&((je=t.advancedFilters)==null?void 0:je.refcode.trim())!==""?"1px solid #8d67ff":"none"}}},menu:W=>({...W,backgroundColor:"#353535",maxWidth:"248px"}),menuList:W=>({...W,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:W=>({...W,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:W=>({...W,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:(W,{data:ne,isDisabled:oe,isFocused:he,isSelected:_e})=>{const xe=yi(ne.color);return{...W,fontSize:"14px",fontWeight:"600",backgroundColor:oe?void 0:_e?ne.color:he?xe.alpha(.1).css():void 0,color:"white",cursor:oe?"not-allowed":"pointer",":active":{...W[":active"],backgroundColor:oe?void 0:_e?ne.color:xe.alpha(.9).css()}}},multiValue:(W,{data:ne})=>{const oe=yi(ne.color);return{...W,backgroundColor:oe.alpha(.4).css()}},multiValueLabel:(W,{data:ne})=>({...W,color:"white"}),multiValueRemove:(W,{data:ne})=>({...W,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:W=>({...W,color:"white"}),valueContainer:W=>({...W,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},x=(W,ne)=>{var he;const oe=(he=ne.selectedCoins)==null?void 0:he.filter(_e=>_e.value!==W.value);ne.setSelectedCoins(oe),ne.setAdvancedFilters(_e=>({..._e,coin:oe==null?void 0:oe.map(Se=>Se.value)}))},g=(W,ne)=>{var he;const oe=(he=ne.selectedReferrals)==null?void 0:he.filter(_e=>_e.value!==W.value);ne.setSelectedReferrals(oe),ne.setAdvancedFilters(_e=>({..._e,refcode:oe==null?void 0:oe.map(Se=>Se.value)}))};h.useEffect(()=>{const W=ne=>{r.current&&!r.current.contains(ne.target)&&n(!1)};return document.addEventListener("mousedown",W),()=>{document.removeEventListener("mousedown",W)}},[]),h.useEffect(()=>{const W=ne=>{o.current&&!o.current.contains(ne.target)&&a(!1)};return document.addEventListener("mousedown",W),()=>{document.removeEventListener("mousedown",W)}},[]);const y=async()=>{t.setAdvancedFilters(W=>({...W,user_token:""}))},v=({src:W,alt:ne})=>{const[oe,he]=Ie.useState(!1);return oe?i.jsx("div",{className:"rounded-full w-5 h-5 min-w-5 min-h-5 mr-1 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}):i.jsx("img",{src:W,alt:ne,className:"rounded-full w-5 h-5 min-w-5 min-h-5 mr-1",loading:"lazy",onError:()=>he(!0)})},C=W=>{const{data:ne,innerRef:oe,innerProps:he,selectProps:_e}=W,xe=_e.styles.option({},W);return i.jsxs("div",{ref:oe,...he,style:xe,className:"flex items-center p-2",children:[i.jsx(v,{src:ne.icon,alt:ne.label}),ne.label]})},N=(W,ne)=>ne.reduce((oe,he)=>{const _e=W[he];return _e!==void 0&&_e!==""&&_e!==null&&oe++,oe},0),I=()=>{const W=t.advancedFilters.is_favorite_wallet?"":!0;t.setAdvancedFilters(ne=>({...ne,is_favorite_wallet:W}))},P=["min_pnl","max_pnl","min_win_complated_rate","max_win_complated_rate","min_complated_trades_count","max_complated_trades_count","min_complated_win_count","max_complated_win_count","min_complated_loss_count","max_complated_loss_count","min_long_kar","max_long_kar","min_short_kar","max_short_kar","min_long_win_rate","max_long_win_rate","min_short_win_rate","max_short_win_rate","min_rTx_count","max_rTx_count"],M=["min_pnl","max_pnl"],F=["min_uPnl","max_uPnl","max_sharpe","min_sharpe","max_growth_rate","min_growth_rate","max_perp_dd","min_perp_dd","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_rToken_count","max_rToken_count","min_uToken_count","max_uToken_count"],$=["min_uPnl","max_uPnl","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_uToken_count","max_uToken_count"],L=["min_uPnl","max_uPnl","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_rToken_count","max_rToken_count","min_uToken_count","max_uToken_count"],z=["min_first_time","max_first_time","min_end_time","max_end_time"];return i.jsxs("div",{className:"text-white flex flex-wrap justify-start sm:justify-center font-manrope gap-4 pt-2",children:[i.jsxs("div",{className:"col-span-1 flex flex-col justify-start gap-[7px] w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Search Wallet"}),i.jsx("div",{onClick:()=>{y()},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"flex items-center relative",children:[i.jsx("input",{value:(Q=t.advancedFilters)==null?void 0:Q.user_token,onChange:u,type:"text",name:"user_token",placeholder:"Search Wallet",className:`${(se=t.advancedFilters)!=null&&se.user_token?"border border-[#8d67ff]":""} py-[4px] bg-[#353535] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-full sm:w-full pl-[30px] pr-2 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[32px]`}),i.jsx(zy,{className:"text-[#646464] absolute left-1.5"})]})]}),t.period!=999&&i.jsxs("div",{className:"col-span-1 flex flex-col gap-[7px] justify-start w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("div",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Search Coin"}),i.jsx("div",{onClick:()=>{t.setSelectedCoins([]),t.setAdvancedFilters(W=>({...W,coin:[]}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear Coins"})})]}),i.jsx("div",{className:"float-left w-full",ref:r,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:"text-[#646464] absolute left-[6px] top-[7px] z-10"}),i.jsx(hl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter(W=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(ne=>ne.value===W.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&&((ee=t.selectedCoins)==null?void 0:ee.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((K=t.selectedCoins)==null?void 0:K.map(W=>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:W==null?void 0:W.icon,alt:W==null?void 0:W.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:W.label}),i.jsx("div",{onClick:ne=>{ne.stopPropagation(),x(W,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},W.value)))}),i.jsx("div",{className:`${((re=t.selectedCoins)==null?void 0:re.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[248px]`,children:t.selectedCoins&&((de=t.selectedCoins)==null?void 0:de.map(W=>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:W==null?void 0:W.icon,alt:W==null?void 0:W.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:W.label}),i.jsx("div",{onClick:()=>x(W,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},W.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:A_e,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:I,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:I,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:Zlt,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(W=>({...W,refcode:[]}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsx("div",{className:"float-left w-full",ref:o,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:`${e?"-z-10":"z-10"} text-[#646464] absolute left-[6px] top-[7px]`}),i.jsx(hl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataReferral.filter(W=>Array.isArray(t.selectedReferrals)&&!t.selectedReferrals.some(ne=>ne.value===W.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(W=>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:W.label}),i.jsx("div",{onClick:ne=>{ne.stopPropagation(),g(W,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},W.value)))}),i.jsx("div",{className:`${((ae=t.selectedReferrals)==null?void 0:ae.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[248px]`,children:t.selectedReferrals&&((q=t.selectedReferrals)==null?void 0:q.map(W=>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:W.label}),i.jsx("div",{onClick:()=>g(W,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},W.value)))})]})})]})]}),i.jsxs(HX,{title:"Wallet Filters",titleInfo:N(t.advancedFilters,t.period!=999?P:M),icon:i.jsx(Nan,{className:"text-white"}),children:[i.jsx(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(HX,{title:"Performance Filters",titleInfo:N(t.advancedFilters,t.period==999?$:t.period==1?L:F),icon:i.jsx(jan,{}),children:[i.jsx(Ll,{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(Ll,{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(Ll,{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(Ll,{minFilterType:t.advancedFilters.min_sharpe,maxFilterType:t.advancedFilters.max_sharpe,handleChange:u,minInputName:"min_sharpe",maxInputName:"max_sharpe",name:"Sharpe",isTooltip:!1}),i.jsx(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(Ll,{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(HX,{title:"Date Filters",titleInfo:N(t.advancedFilters,z),icon:i.jsx(Aan,{}),children:[i.jsx(F4e,{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(F4e,{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 Ean=({period:t,advancedFilters:e,setAdvancedFilters:n,resetFilters:r,setFilters:s,minFirstValue:a,setMinFirstValue:o,maxFirstValue:l,setMaxFirstValue:c,minEndValue:u,setMinEndValue:d,maxEndValue:f,setMaxEndValue:x,dataCoin:g,selectedCoins:y,setSelectedCoins:v,isLoadingCoin:C,setIsLoadingCoin:N,dataReferral:I,selectedReferrals:P,setSelectedReferrals:M,isLoadingReferral:F,setIsLoadingReferral:$})=>{const[L,z]=h.useState(!1);return h.useEffect(()=>{localStorage.getItem("fire_ref_modal_seen")||z(!0)},[]),i.jsx(i.Fragment,{children:i.jsxs("div",{className:"bg-[#232323] rounded-2xl min-h-[340px] sm:max-h-full lg:min-h-[66vh] order-last lg:order-none lg:w-min min-w-[286px] lg:max-w-[286px] p-1 py-3 font-manrope overflow-hidden relative h-[calc(100vh-150px)] sm:h-[calc(100vh-125px)]",children:[i.jsxs("div",{className:"w-full flex justify-between items-center pt-[2px] pl-3 pr-1 pb-[10px]",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[8px]",children:"Filters"}),i.jsx("div",{className:"flex sm:hidden justify-center",children:i.jsx("div",{onClick:()=>s(),className:"w-[134px] h-6 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] pointer-events-none",children:"Search"})})}),i.jsx("div",{onClick:()=>{r()},className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex mr-3 cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("div",{className:"h-full w-full overflow-y-scroll font-manrope py-1 px-3",children:i.jsx("div",{className:"font-manrope font-normal pb-[120px] sm:pb-[80px] max-w-full lg:max-w-[256px]",children:i.jsx(_an,{period:t,resetFilters:r,setFilters:s,advancedFilters:e,setAdvancedFilters:n,minFirstValue:a,setMinFirstValue:o,maxFirstValue:l,setMaxFirstValue:c,minEndValue:u,setMinEndValue:d,maxEndValue:f,setMaxEndValue:x,dataCoin:g,selectedCoins:y,setSelectedCoins:v,isLoadingCoin:C,setIsLoadingCoin:N,dataReferral:I,selectedReferrals:P,setSelectedReferrals:M,isLoadingReferral:F,setIsLoadingReferral:$})})}),i.jsx("div",{className:"hidden sm:block absolute bottom-0 w-full",children:i.jsx("div",{className:"sticky h-12 bg-[#1b1b1b]/30 rounded-bl-2xl rounded-br-2xl border-t border-[#353535] backdrop-blur-[32px] min-h-14 pt-[11px] w-full z-10",children:i.jsx("div",{className:"flex justify-center -ml-3",children:i.jsx("div",{onClick:()=>s(),className:"w-[234px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] pointer-events-none",children:"Search"})})})})})]})})},hVe=()=>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:vlt,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"]})]})]})]}),O4e=({content:t,positionTop:e,alignRight:n,type:r})=>{const s=t?r==="coin"?t.split(", ").map(a=>{const[o,l]=a.split(" (");return{name:o,value:l==null?void 0:l.replace(")","")}}):r==="position"?t==null?void 0:t.map(a=>({name:a.coin,value:a.unrealized_pnl})):[]:[];return i.jsx("span",{className:`tooltip ${n?"left-5 top-1/2 -translate-y-1/2 ":e?"-top-6 translate-x-[10%] -left-[20%]":"-top-6 translate-x-[10%] right-[20%] mr-9"} transform text-white font-manrope font-semibold text-xs leading-3 whitespace-nowrap mt-1`,children:i.jsxs("div",{className:`${e?"ml-6":"mr-6"} border border-[#404040] bg-[#222222] p-2 rounded-sm relative`,children:[i.jsx("div",{className:"overflow-y-auto scroll-design-search-scroll w-max min-h-[31px] h-max max-h-[160px]",children:i.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:(s==null?void 0:s.length)>0?s==null?void 0:s.map((a,o)=>i.jsxs("li",{className:`${o===(s==null?void 0:s.length)-1?"mb-0":"mb-[5px]"} flex justify-between pl-1 pr-2 h-max p-2 rounded border border-[#7d7c7c]`,children:[i.jsx("span",{className:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))||(a==null?void 0:a.value)==0?"text-white":(a==null?void 0:a.value)>0?"text-[#1DE6A3]":"text-[#FF7173]"} flex justify-start items-center gap-1 min-w-20 border-r border-white`,children:a==null?void 0:a.name}),i.jsx("span",{className:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))||(a==null?void 0:a.value)==0?"text-white":(a==null?void 0:a.value)>0?"text-[#1DE6A3]":"text-[#FF7173]"} pl-4`,children:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))?"-":Ms(Math.abs(a==null?void 0:a.value))}`})]},o)):i.jsx("span",{children:"No data available"})})}),i.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`absolute transform -z-1 ${n?"-rotate-90 left-1 -translate-x-full -translate-y-1/2 top-1/2 ":e?"-left-2 top-[15%] -rotate-90 -translate-y-1/2":"-right-2 top-[15%] rotate-90 -translate-y-1/2"}`,children:i.jsx("path",{d:"M3.70096 1.25C4.27831 0.25 5.72169 0.25 6.29904 1.25L8.89711 5.75C9.47446 6.75 8.75278 8 7.59808 8H2.40192C1.24722 8 0.525536 6.75 1.10289 5.75L3.70096 1.25Z",fill:"#404040",stroke:"#404040"})})]})})},ude=({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 kan({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(Vs,{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 Tan=({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 Ian({open:t,setOpen:e}){return i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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 Pan(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 Fan=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function Vy(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let jC=null;function pVe(t={}){return jC||(t.includeStyleProperties?(jC=t.includeStyleProperties,jC):(jC=Vy(window.getComputedStyle(document.documentElement)),jC))}function $D(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function Oan(t){const e=$D(t,"border-left-width"),n=$D(t,"border-right-width");return t.clientWidth+e+n}function Man(t){const e=$D(t,"border-top-width"),n=$D(t,"border-bottom-width");return t.clientHeight+e+n}function mVe(t,e={}){const n=e.width||Oan(t),r=e.height||Man(t);return{width:n,height:r}}function Ran(){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 Rf=16384;function Lan(t){(t.width>Rf||t.height>Rf)&&(t.width>Rf&&t.height>Rf?t.width>t.height?(t.height*=Rf/t.width,t.width=Rf):(t.width*=Rf/t.height,t.height=Rf):t.width>Rf?(t.height*=Rf/t.width,t.width=Rf):(t.width*=Rf/t.height,t.height=Rf))}function UD(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 Dan(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Ban(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),Dan(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 $an(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Uan(t,e){return pVe(e).map(n=>{const r=t.getPropertyValue(n),s=t.getPropertyPriority(n);return`${n}: ${r}${s?" !important":""};`}).join(" ")}function zan(t,e,n,r){const s=`.${t}:${e}`,a=n.cssText?$an(n):Uan(n,r);return document.createTextNode(`${s}{${a}}`)}function M4e(t,e,n,r){const s=window.getComputedStyle(t,n),a=s.getPropertyValue("content");if(a===""||a==="none")return;const o=Fan();try{e.className=`${e.className} ${o}`}catch{return}const l=document.createElement("style");l.appendChild(zan(o,n,s,r)),e.appendChild(l)}function Han(t,e,n){M4e(t,e,":before",n),M4e(t,e,":after",n)}const R4e="application/font-woff",L4e="image/jpeg",Van={woff:R4e,woff2:R4e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:L4e,jpeg:L4e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Wan(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function dde(t){const e=Wan(t).toLowerCase();return Van[e]||""}function qan(t){return t.split(/,/)[1]}function Xre(t){return t.search(/^(data:)/)!==-1}function Gan(t,e){return`data:${e};base64,${t}`}async function xVe(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 VX={};function Kan(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 fde(t,e,n){const r=Kan(t,e,n.includeQueryParams);if(VX[r]!=null)return VX[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let s;try{const a=await xVe(t,n.fetchRequestInit,({res:o,result:l})=>(e||(e=o.headers.get("Content-Type")||""),qan(l)));s=Gan(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 VX[r]=s,s}async function Yan(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):UD(e)}async function Xan(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 UD(l)}const n=t.poster,r=dde(n),s=await fde(n,r,e);return UD(s)}async function Qan(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await hz(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Zan(t,e){return mf(t,HTMLCanvasElement)?Yan(t):mf(t,HTMLVideoElement)?Xan(t,e):mf(t,HTMLIFrameElement)?Qan(t,e):t.cloneNode(gVe(t))}const Jan=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",gVe=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function eon(t,e,n){var r,s;if(gVe(e))return e;let a=[];return Jan(t)&&t.assignedNodes?a=Vy(t.assignedNodes()):mf(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=Vy(t.contentDocument.body.childNodes):a=Vy(((s=t.shadowRoot)!==null&&s!==void 0?s:t).childNodes),a.length===0||mf(t,HTMLVideoElement)||await a.reduce((o,l)=>o.then(()=>hz(l,n)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function ton(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):pVe(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 non(t,e){mf(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),mf(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function ron(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)&&(ton(t,e,n),Han(t,e,n),non(t,e),ron(t,e)),e}async function ion(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 hz(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 hz(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>Zan(r,e)).then(r=>eon(t,r,e)).then(r=>son(t,r,e)).then(r=>ion(r,e))}const bVe=/url\((['"]?)([^'"]+?)\1\)/g,aon=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,oon=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function lon(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function con(t){const e=[];return t.replace(bVe,(n,r,s)=>(e.push(s),n)),e.filter(n=>!Xre(n))}async function uon(t,e,n,r,s){try{const a=n?Pan(e,n):e,o=dde(e);let l;return s||(l=await fde(a,o,r)),t.replace(lon(e),`$1${l}$3`)}catch{}return t}function don(t,{preferredFontFormat:e}){return e?t.replace(oon,n=>{for(;;){const[r,,s]=aon.exec(n)||[];if(!s)return"";if(s===e)return`src: ${r};`}}):t}function yVe(t){return t.search(bVe)!==-1}async function vVe(t,e,n){if(!yVe(t))return t;const r=don(t,n);return con(r).reduce((a,o)=>a.then(l=>uon(l,o,e,n)),Promise.resolve(r))}async function AC(t,e,n){var r;const s=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(s){const a=await vVe(s,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function fon(t,e){await AC("background",t,e)||await AC("background-image",t,e),await AC("mask",t,e)||await AC("-webkit-mask",t,e)||await AC("mask-image",t,e)||await AC("-webkit-mask-image",t,e)}async function hon(t,e){const n=mf(t,HTMLImageElement);if(!(n&&!Xre(t.src))&&!(mf(t,SVGImageElement)&&!Xre(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,s=await fde(r,dde(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 pon(t,e){const r=Vy(t.childNodes).map(s=>wVe(s,e));await Promise.all(r).then(()=>t)}async function wVe(t,e){mf(t,Element)&&(await fon(t,e),await hon(t,e),await pon(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 D4e={};async function B4e(t){let e=D4e[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},D4e[t]=e,e}async function $4e(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),xVe(l,e.fetchRequestInit,({result:c})=>(n=n.replace(o,`url(${c})`),[o,c]))});return Promise.all(a).then(()=>n)}function U4e(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 xon(t,e){const n=[],r=[];return t.forEach(s=>{if("cssRules"in s)try{Vy(s.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let l=o+1;const c=a.href,u=B4e(c).then(d=>$4e(d,e)).then(d=>U4e(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(B4e(s.href).then(l=>$4e(l,e)).then(l=>U4e(l).forEach(c=>{o.insertRule(c,o.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",a)}}),Promise.all(r).then(()=>(t.forEach(s=>{if("cssRules"in s)try{Vy(s.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${s.href}`,a)}}),n))}function gon(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>yVe(e.style.getPropertyValue("src")))}async function bon(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Vy(t.ownerDocument.styleSheets),r=await xon(n,e);return gon(r)}function CVe(t){return t.trim().replace(/["']/g,"")}function yon(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(CVe(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function von(t,e){const n=await bon(t,e),r=yon(t);return(await Promise.all(n.filter(a=>r.has(CVe(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return vVe(a.cssText,o,e)}))).join(`
`)}async function won(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await von(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 Con(t,e={}){const{width:n,height:r}=mVe(t,e),s=await hz(t,e,!0);return await won(s,e),await wVe(s,e),mon(s,e),await Ban(s,n,r)}async function Son(t,e={}){const{width:n,height:r}=mVe(t,e),s=await Con(t,e),a=await UD(s),o=document.createElement("canvas"),l=o.getContext("2d"),c=e.pixelRatio||Ran(),u=e.canvasWidth||n,d=e.canvasHeight||r;return o.width=u*c,o.height=d*c,e.skipAutoScale||Lan(o),o.style.width=`${u}`,o.style.height=`${d}`,e.backgroundColor&&(l.fillStyle=e.backgroundColor,l.fillRect(0,0,o.width,o.height)),l.drawImage(a,0,0,o.width,o.height),o}async function V1(t,e={}){return(await Son(t,e)).toDataURL()}function Non({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 V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),c=document.createElement("a");c.href=l,c.download="dextrabot.png",document.body.appendChild(c),c.click(),document.body.removeChild(c),dn.success("PNG successfully downloaded!")}catch(l){console.error("Error generating PNG:",l),dn.error("Failed to download PNG.")}};return i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(l=>({...l,pnl:0,winRate:0,tradeCount:0,longWinRate:0,shortWinRate:0,leverage:0,roe:0,unrealizedPnL:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[838px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[830px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[482px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[42px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:`${s==999?"mt-20":"mt-[44px]"} flex flex-col items-start justify-start gap-2 `,children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"PnL"}),i.jsx("div",{className:`${(n==null?void 0:n.pnl)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[66px] font-semibold font-manrope leading-[52px] inline-flex justify-center items-center min-w-max`,children:(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`})]}),i.jsxs("div",{className:`${s==999?"hidden":""} flex justify-start items-start gap-[65px] pt-[26px]`,children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max min-w-[140px]",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.winRate)==null||isNaN(parseFloat(n==null?void 0:n.winRate))?"--":(n==null?void 0:n.winRate)+"%"}`})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"TX COUNT"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.tradeCount)==null||isNaN(parseFloat(n==null?void 0:n.tradeCount))?"--":Ms(n==null?void 0:n.tradeCount)}`})]})]}),i.jsxs("div",{className:`${s==999?"hidden":""} flex justify-start items-start gap-[65px] pt-[8px]`,children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"LONG WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.longWinRate)==null||isNaN(parseFloat(n==null?void 0:n.longWinRate))?"--":(n==null?void 0:n.longWinRate)+"%"}`})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"SHORT WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.shortWinRate)==null||isNaN(parseFloat(n==null?void 0:n.shortWinRate))?"--":(n==null?void 0:n.shortWinRate)+"%"}`})]})]}),(n==null?void 0:n.referral)&&i.jsx("div",{className:`${s==999?"pt-[150px]":"pt-[26px]"} flex justify-start items-start gap-[65px]`,children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral?"pt-[1px]":s==999?"pt-[240px]":"pt-[82px]"} flex justify-start items-start `,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[378px] overflow-hidden",children:(n==null?void 0:n.pnl)>=0?i.jsx("img",{src:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Numbers don’t lie! 🔥 Total Profit:"," ",(n==null?void 0:n.pnl)>=0?"":"-",(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders and save 4% on fees using my referral: ",n==null?void 0:n.referral," ","@Dextrabot"," "]}):i.jsxs("span",{children:["Numbers don’t lie! 🔥 Total Profit:"," ",(n==null?void 0:n.pnl)>=0?"":"-",(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders! @Dextrabot"]})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:l=>{l.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),dn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:()=>{o()},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Numbers%20don’t%20lie!%20🔥%20Total%20Profit:%20${(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`${(n==null?void 0:n.pnl)>=0?"":"-"}%24${Ms(Math.abs(n==null?void 0:n.pnl))}`}%20🚀%20Tap%20into%20the%20best%20trades%20with%20Dextrabot%20on%20Hyperliquid!%20Copy%20top%20traders${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20and%20save%204%25%20on%20fees%20using%20my%20referral:%20${n==null?void 0:n.referral}`:"!"}%20%40Dextrabot%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}function jon({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 V1(s.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),l=document.createElement("a");l.href=o,l.download="dextrabot.png",document.body.appendChild(l),l.click(),document.body.removeChild(l),dn.success("PNG successfully downloaded!")}catch(o){console.error("Error generating PNG:",o),dn.error("Failed to download PNG.")}};return i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(o=>({...o,pnl:0,winRate:0,tradeCount:0,longWinRate:0,shortWinRate:0,leverage:0,roe:0,unrealizedPnL:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:s,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[42px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsx("div",{className:"flex justify-start items-center gap-2 relative mt-16",children:i.jsx("div",{className:"bg-[#67ffbd]/20 text-[#67ffbd] h-9 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide",children:`${(n==null?void 0:n.leverage)==null||isNaN(parseFloat(n==null?void 0:n.leverage))?"--":`${parseFloat(n==null?void 0:n.leverage).toFixed(2)}x`}`})}),i.jsxs("div",{className:`${(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center min-w-max`,children:[(n==null?void 0:n.roe)>=0?"+":"-",`${(n==null?void 0:n.roe)==null||isNaN(parseFloat(n==null?void 0:n.roe))?"--":`${Ms(Math.abs(n==null?void 0:n.roe))}%`}`]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[22px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max min-w-[130px]",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"UNREALIZED PNL"}),i.jsx("div",{className:`${(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))||(n==null?void 0:n.unrealizedPnL)==0?"text-white":(n==null?void 0:n.unrealizedPnL)>0?"text-[#1DE6A3]":"text-[#FF7173]"} text-[32px] font-semibold font-manrope leading-none flex`,children:(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`})]})}),(n==null?void 0:n.referral)&&i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[26px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral?"pt-[16px]":"pt-[112px]"} flex justify-start items-start`,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[398px] overflow-hidden",children:(n==null?void 0:n.roe)>=0?i.jsx("img",{src:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Numbers don’t lie! 🔥 Unrealized PnL:"," ",(n==null?void 0:n.unrealizedPnL)>=0?"":"-",(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders and save 4% on fees using my referral: ",n==null?void 0:n.referral," ","@Dextrabot"," "]}):i.jsxs("span",{children:["Numbers don’t lie! 🔥 Unrealized PnL:"," ",(n==null?void 0:n.unrealizedPnL)>=0?"":"-",(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders! @Dextrabot"]})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:o=>{o.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),dn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:()=>{a()},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Numbers%20don’t%20lie!%20🔥%20Unrealized%20PnL:%20${(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`${(n==null?void 0:n.unrealizedPnL)>=0?"":"-"}$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`}%20🚀%20Tap%20into%20the%20best%20trades%20with%20Dextrabot%20on%20Hyperliquid!%20Copy%20top%20traders${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20and%20save%204%25%20on%20fees%20using%20my%20referral:%20${n==null?void 0:n.referral}`:"!"}%20%40Dextrabot%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}const SVe=()=>{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(Ca,{open:t,onClose:n,className:"relative z-50 font-manrope hidden lg:block",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#1b1b1b] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[480px] h-max relative bg-[#1b1b1b] rounded-3xl pb-8",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{n()},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#67FFBD52]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-2 px-2",children:i.jsx("img",{src:Olt,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. 🚀"})]})]})})})})})]})},Aon=({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}`})]})})}),_on=({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:N,copyTradeWatchList:I,getCopyTradeWatchList:P,trackedWatchList:M,getTrackedWatchList:F,setSignModalOpen:$,setTelegramChatId:L,setSubscriberRole:z,setSubsExpireDay:Q,setMushboomerETH:se,setMushboomerSOL:ee,setIsReferralCode:K,isReferralCodeName:re,setIsReferralCodeName:de,setIsWhitelist:G,setHyperToken:ie,setHyperAddress:ae}=h.useContext(Yr),{isConnected:q,address:W}=es();Ao(),Xl();const[ne,oe]=h.useState(!1),[he,_e]=h.useState(null),[xe,Se]=h.useState(null),[ge,Ce]=h.useState(""),[je,Oe]=h.useState(""),[$e,Ye]=h.useState(""),[Je,ht]=h.useState(""),[rt,st]=h.useState(""),[He,Ve]=h.useState([]),[bt,xt]=h.useState(!0),[Qt,St]=h.useState([]),[on,cn]=h.useState([]),[Vn,tn]=h.useState(!0),[fn,rn]=h.useState([]),[nt,it]=h.useState(!1),[Ut,hn]=h.useState(!1),nn=`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`,pt=`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 It(pe){if(!pe)return"--";const qe=parseInt(pe==null?void 0:pe.split(":")[0]),Ae=parseInt(pe==null?void 0:pe.split(":")[1]);return`${qe}h ${Ae}m`}h.useEffect(()=>{(async()=>{var ze,zt;const qe=window.localStorage.getItem("hyperToken"),Ae=window.localStorage.getItem("hyperAddress");if(!(!qe||!Ae))try{const kt=await vi(Ae.toLowerCase(),qe);kt!=null&&kt.success?(L(kt==null?void 0:kt.telegram_chat_id),z(kt==null?void 0:kt.subscriber_role),Q(kt==null?void 0:kt.subs_expire_day),se((ze=kt==null?void 0:kt.mushboomer_counts)==null?void 0:ze.eth),ee((zt=kt==null?void 0:kt.mushboomer_counts)==null?void 0:zt.sol),K(kt==null?void 0:kt.referral_code),de(kt==null?void 0:kt.refcode),G(kt==null?void 0:kt.whitelist),ie(qe),ae(Ae)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),ie(""),ae(""))}catch(kt){console.error("Token verification error:",kt),console.error(kt.message||"An unknown error occurred.")}})()},[]);const Ge={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{(async()=>{var qe,Ae;try{const zt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),kt=()=>yi.random().hex(),gt=(Ae=(qe=zt.coins)==null?void 0:qe.filter(Mt=>!Mt.startsWith("@")&&!Mt.endsWith("/USDC")))==null?void 0:Ae.map(Mt=>({value:Mt,label:Mt.endsWith("/USDC")?Mt+" (Spot)":Mt,color:kt(),icon:`https://app.hyperliquid.xyz/coins/${Ge[Mt]||(Mt==null?void 0:Mt.split("/")[0])}.svg`}));Ve(gt),xt(!1)}catch(ze){console.error("Data retrieval error:",ze),xt(!1)}})()},[]),h.useEffect(()=>{(async()=>{var qe,Ae;try{const zt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_refcodes/")).json(),kt=()=>yi.random().hex(),gt=(Ae=(qe=zt==null?void 0:zt.refcodes)==null?void 0:qe.filter(Mt=>Mt.code!=="DEXTRABOT"))==null?void 0:Ae.slice(0,1300).map(Mt=>({value:Mt.code,label:Mt.code,color:kt()}));cn(gt),tn(!1)}catch(ze){console.error("Data retrieval error:",ze),tn(!1)}})()},[]);const ct=pe=>{const qe=["Growth Rate","Drawdown","Drawdown PnL","Sharpe"],Ae=[{header:"Popular Wallet",value:ze=>{const zt=Number(ze.copier_count)||0;return zt===0?"":zt<=5?"F":zt<=10?"FF":"FFF"}},{header:"Wallet",value:ze=>ze.user_token},{header:"PnL",value:ze=>(ze==null?void 0:ze[nn])==null||isNaN(+(ze==null?void 0:ze[nn]))?"--":`$${Ms(ze==null?void 0:ze[nn])}`},{header:"uPnL",value:ze=>ze.total_unrealized_pnl==null||isNaN(+ze.total_unrealized_pnl)?"--":`$${Ms(ze.total_unrealized_pnl)}`},{header:"Perp Equity",value:ze=>ze.portfolio_perp_all_time_value==null||isNaN(+ze.portfolio_perp_all_time_value)?"--":`$${Ms(Math.abs(ze.portfolio_perp_all_time_value))}`},{header:"Win Rate",value:ze=>ze.win_complated_rate==null||isNaN(+ze.win_complated_rate)||pe==999?"--":`%${Math.abs(ze.win_complated_rate)}`},{header:"Trades Count",value:ze=>ze.complated_trades_count==null||isNaN(+ze.complated_trades_count)||pe==999?"--":`${Ms(Math.abs(ze.complated_trades_count))}`},{header:"Win Count",value:ze=>ze.complated_win_count==null||isNaN(+ze.complated_win_count)||pe==999?"--":`${Ms(Math.abs(ze.complated_win_count))}`},{header:"Loss Count",value:ze=>ze.complated_loss_count==null||isNaN(+ze.complated_loss_count)?"--":`${Ms(Math.abs(ze.complated_loss_count))}`},{header:"Long PnL",value:ze=>ze.long_kar==null||isNaN(+ze.long_kar)||pe==999?"--":`$${Ms(Math.abs(ze.long_kar))}`},{header:"Short PnL",value:ze=>ze.short_kar==null||isNaN(+ze.short_kar)||pe==999?"--":`$${Ms(ze.short_kar)}`},{header:"Growth Rate",value:ze=>(ze==null?void 0:ze[pt])==null||isNaN(+(ze==null?void 0:ze[pt]))||pe==1||pe==999?"--":`%${Ms(ze==null?void 0:ze[pt])}`},{header:"Drawdown",value:ze=>(ze==null?void 0:ze[Vt])==null||isNaN(+(ze==null?void 0:ze[Vt]))||pe==999?"--":`%${Ms(ze==null?void 0:ze[Vt])}`},{header:"Sharpe",value:ze=>(ze==null?void 0:ze[We])==null||isNaN(+(ze==null?void 0:ze[We]))||pe==999?"--":`${ze==null?void 0:ze[We]}`},{header:"Tx Count",value:ze=>ze.rtx_count==null||isNaN(+ze.rtx_count)||pe==999?"--":`${Ms(ze.rtx_count)}`},{header:"ROE (%)",value:ze=>ze.margin_roi==null||isNaN(+ze.margin_roi)?"--":`${Ms(ze.margin_roi)}%`},{header:"Margin / Used",value:ze=>ze.margin_used==null||isNaN(+ze.margin_used)||ze.margin_percentage==null||isNaN(+ze.margin_percentage)?"--":`${Ms(ze.margin_used)} / %${parseFloat(ze.margin_percentage).toFixed(2)}`},{header:"Avg. Lvg.",value:ze=>ze.avg_uleverage_value==null||isNaN(+ze.avg_uleverage_value)?"--":`${parseFloat(ze.avg_uleverage_value).toFixed(2)}x`},{header:"Funding",value:ze=>ze.funding==null||isNaN(+ze.funding)?"--":`$${Ms(ze.funding)}`},{header:"rToken #",value:ze=>ze.token_count==null||isNaN(+ze.token_count)||pe==999?"--":Ms(ze.token_count)},{header:"uToken #",value:ze=>ze.position_count==null||isNaN(+ze.position_count)?"--":Ms(ze.position_count)},{header:"Avg. Dur.",value:ze=>pe==999?"--":`${It(ze.complated_avg_duration)}`},{header:"First Tx Time",value:ze=>pe==999?"--":CP(ze.first_time)},{header:"Last Tx Time",value:ze=>pe==999?"--":CP(ze.end_time)}];return pe===1?Ae.filter(ze=>!qe.includes(ze.header)):Ae},vt=()=>{if(!(f!=null&&f.length))return;const pe=new Date,qe=vn=>vn.toString().padStart(2,"0"),Ae=`discoverwallet_${qe(pe.getDate())}${qe(pe.getMonth()+1)}${pe.getFullYear()}_${qe(pe.getHours())}${qe(pe.getMinutes())}.csv`,ze=ct(a),zt=ze.map(vn=>`"${vn.header}"`).join(","),kt=f==null?void 0:f.map(vn=>ze==null?void 0:ze.map(Wn=>`"${Wn.value(vn)}"`).join(",")),gt=new Blob([zt+`\r
`+kt.join(`\r
`)],{type:"text/csv;charset=utf-8;"}),Mt=URL.createObjectURL(gt);Object.assign(document.createElement("a"),{href:Mt,download:Ae}).click(),URL.revokeObjectURL(Mt)},[Ht,Rt]=h.useState("-perp_pnl"),[mn,un]=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 pe(){try{y(!0);const qe={period:a===999?"all_time":a,order:Ht,offset:e===-50?"0":e.toString(),limit:"50",...mn},Ae=Object.entries(qe).filter(([Mt,ln])=>ln!=null).map(([Mt,ln])=>`${encodeURIComponent(Mt)}=${encodeURIComponent(ln)}`).join("&"),ze=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${Ae}`,zt=await fetch(ze.toString());if(!zt.ok)throw new Error(`HTTP error! status: ${zt.status}`);const kt=await zt.json();r(Math.ceil(kt.count/50)),s(kt.count),t((e+50)/50),window.localStorage.getItem("hyperToken")&&(P(),F()),x(kt.results)}catch(qe){x([]),console.error("Error fetching data:",qe),C(qe.message)}finally{y(!1)}}pe()},[e,Ht,a]);async function yn(pe){try{y(!0);const qe={period:a===999?"all_time":a,order:Ht,offset:e===-50?"0":e.toString(),limit:"50",...mn},Ae=Object.entries(qe).filter(([Mt,ln])=>ln!=null).map(([Mt,ln])=>`${encodeURIComponent(Mt)}=${encodeURIComponent(ln)}`).join("&"),ze=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${Ae}`,zt=await fetch(ze);if(!zt.ok)throw new Error(`HTTP error! status: ${zt.status}`);const kt=await zt.json();t(1),r(Math.ceil(kt.count/50)),s(kt.count),n(0),window.localStorage.getItem("hyperToken")&&(P(),F()),x(kt.results)}catch(qe){x([]),console.error("Error fetching data:",qe),C(qe.message)}finally{y(!1)}}async function _n(pe){try{y(!0);const qe=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(!qe.ok)throw new Error(`HTTP error! status: ${qe.status}`);const Ae=await qe.json();t(50/50),r(Math.ceil(Ae.count/50)),s(Ae.count),n(0),x(Ae.results),window.localStorage.getItem("hyperToken")&&(P(),F()),un({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:""}),Oe(""),Ye(""),ht(""),st(""),St([])}catch(qe){x([]),console.error("Error resetting filters:",qe),C(qe.message)}finally{y(!1)}}const In=async({walletAddress:pe,isFollow:qe,isScalper:Ae})=>{try{Ce(pe);const ze=window.localStorage.getItem("hyperToken"),zt=window.localStorage.getItem("hyperAddress");if(!ze){$(!0);return}const kt=qe?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",gt=qe?{address:W?W.toLowerCase():zt,token:ze,follow_address:pe.toLowerCase()}:{address:W?W.toLowerCase():zt,token:ze},Mt=await fetch(kt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(gt)});if(!Mt.ok)throw new Error(`Server responded with status ${Mt.status}`);const ln=await Mt.json();ln.success?(_e(Array.isArray(ln==null?void 0:ln.data)?[...ln.data].sort((vn,Wn)=>new Date(Wn.created_at||0)-new Date(vn.created_at||0)):ln==null?void 0:ln.data),Se(Ae),oe(!0)):(console.log(ln.error_message),dn.error(ln.error_message))}catch(ze){console.error("Error in like function:",ze),dn.error(ze.message||"Something went wrong!")}},Sn=pe=>pe>=640&&pe<1024?7:pe>=1024&&pe<1240?6:pe>=1240&&pe<1540?7:pe>=1540?10:4,[Yn,Xn]=h.useState(!1),[zn,Kn]=h.useState(!1),[jn,De]=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(SVe,{}),i.jsx(Ian,{open:nt,setOpen:it}),i.jsx(U5,{open:ne,setOpen:oe,copyTradeData:he,setCopyTradeData:_e,copyTradeWallet:ge,setCopyTradeWallet:Ce,isScalper:xe}),i.jsx(Non,{open:Yn,setOpen:Xn,data:jn,setTradeInfo:De,period:a}),i.jsx(jon,{open:zn,setOpen:Kn,data:jn,setTradeInfo:De}),i.jsxs("div",{className:"block lg:hidden w-full p-2 space-y-2",children:[i.jsx(KLe,{}),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:vt,children:"Export CSV"})]}),i.jsx("div",{className:"lg:hidden flex w-full p-2",children:i.jsx("button",{className:"px-2 py-2 text-xs font-medium rounded-2xl border border-gray-600 text-white hover:bg-[#1D1D1D] w-full bg-[#171717]",onClick:()=>hn(!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(Ean,{period:a,advancedFilters:mn,setAdvancedFilters:un,resetFilters:_n,setFilters:yn,minFirstValue:je,setMinFirstValue:Oe,maxFirstValue:$e,setMaxFirstValue:Ye,minEndValue:Je,setMinEndValue:ht,maxEndValue:rt,setMaxEndValue:st,dataCoin:He,selectedCoins:Qt,setSelectedCoins:St,isLoadingCoin:bt,setIsLoadingCoin:xt,dataReferral:on,selectedReferrals:fn,setSelectedReferrals:rn,isLoadingReferral:Vn,setIsLoadingReferral:tn})}),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(ude,{periods:o,selectedPeriod:a,handlePeriod:d,borderColor:"discover"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(kan,{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:vt,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(lo,{content:"🔥🔥🔥 Copytrend indicator. More flames = more followers.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[215px] min-w-[215px] leading-[16px] -mb-5"})})]})}),i.jsx(el,{title:"",sortKey:"copier_count",sortOption: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(el,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:"Realized profit/loss from completed trades.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[200px] min-w-[200px] leading-[16px] -mb-5"})})]})}),i.jsx(el,{title:"PnL",sortKey:"perp_pnl",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"uPnL",sortKey:"total_unrealized_pnl",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Perp Equity",sortKey:"portfolio_perp_all_time_value",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Win Rate",sortKey:"win_complated_rate",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Total/Win/Loss",sortKey:"complated_trades_count",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Long PnL",sortKey:"long_kar",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Short PnL",sortKey:"short_kar",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:"Available for 7, 30, 90 days",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Growth Rate"}):i.jsx(el,{title:"Growth Rate",sortKey:"growth_rate",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:"Available for 7, 30, 90 days",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Drawdown"}):i.jsx(el,{title:"Drawdown",sortKey:"perp_dd",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:a==1||a==999?"Available for 7, 30, 90 days":"Sharpe_tooltip",positionTop:!1,alignRight:!1,tooltipCss:a==1||a==999?"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2":"max-w-[80px] min-w-[80px] leading-[16px] -mb-12"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Sharpe"}):i.jsx(el,{title:"Sharpe",sortKey:"sharpe",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Tx Count",sortKey:"rtx_count",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"ROE",sortKey:"margin_roi",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Margin",sortKey:"margin_percentage",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Avg. Lvg.",sortKey:"avg_uleverage_value",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Funding",sortKey:"funding",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"rToken #",sortKey:"token_count",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"uToken #",sortKey:"position_count",sortOption: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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Avg. Dur.",sortKey:"complated_avg_duration",sortOption: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(el,{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(el,{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:Sn(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(Ba,{})})})}):v&&!f?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Sn(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:Sn(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(hVe,{})})})}):f&&(f==null?void 0:f.map((pe,qe)=>i.jsxs(Ie.Fragment,{children:[i.jsxs("tr",{className:`${qe%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:`${qe%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:Ae=>{Ae.preventDefault();const ze=I==null?void 0:I.some(zt=>zt.wallet_address===(pe==null?void 0:pe.user_token));In({walletAddress:pe==null?void 0:pe.user_token,isFollow:ze,isScalper:pe==null?void 0:pe.is_scalper})},className:`
${I.some(Ae=>Ae.wallet_address===(pe==null?void 0:pe.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($5,{walletAddress:pe==null?void 0:pe.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:M.some(Ae=>Ae.wallet_address===(pe==null?void 0:pe.user_token))?i.jsx("img",{src:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${qe%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:`${pe!=null&&pe.is_favorite_wallet?"":"hidden"} relative w-1 h-[16px] bg-[#4a3131] rounded-md`,children:i.jsx("div",{className:`${(pe==null?void 0:pe.copier_count)>=1&&(pe==null?void 0:pe.copier_count)<=5?"bg-[#FFAA22] shadow-[0px_2px_4px_0px_rgba(255,170,34,0.32)]":(pe==null?void 0:pe.copier_count)>5&&(pe==null?void 0:pe.copier_count)<=10?"bg-[#FF8C00] shadow-[0px_2px_4px_0px_rgba(255,140,0,0.32)]":(pe==null?void 0:pe.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:`${(pe==null?void 0:pe.copier_count)>=1&&(pe==null?void 0:pe.copier_count)<=5?25:(pe==null?void 0:pe.copier_count)>5&&(pe==null?void 0:pe.copier_count)<=10?50:(pe==null?void 0:pe.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:pe!=null&&pe.is_favorite_wallet?"🔥":""})]})})})})}),i.jsx("td",{scope:"row",className:`${qe%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/${pe==null?void 0:pe.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(na,{info1:`${(pe==null?void 0:pe.user_token).slice(0,5)+"..."+(pe==null?void 0:pe.user_token).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Ae=>{Ae.stopPropagation(),navigator.clipboard.writeText(pe==null?void 0:pe.user_token),dn.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:_o,alt:"",className:"cursor-pointer"})]})})}),i.jsx("td",{className:"",children:i.jsxs("div",{onClick:Ae=>{Ae.preventDefault(),(pe==null?void 0:pe[nn])!=null&&!isNaN(parseFloat(pe==null?void 0:pe[nn]))&&(De(ze=>({...ze,pnl:pe==null?void 0:pe[nn],winRate:pe==null?void 0:pe.win_complated_rate,tradeCount:pe==null?void 0:pe.rtx_count,longWinRate:pe==null?void 0:pe.long_win_rate,shortWinRate:pe==null?void 0:pe.short_win_rate,roe:pe==null?void 0:pe.margin_roi,referral:window.localStorage.getItem("hyperToken")?re:null})),Xn(!0))},className:`${(pe==null?void 0:pe[nn])!=null&&!isNaN(parseFloat(pe==null?void 0:pe[nn]))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(na,{info1:`$${Ms(Math.abs(pe==null?void 0:pe[nn]))}`,info1_Color:`${(pe==null?void 0:pe[nn])==null||isNaN(parseFloat(pe==null?void 0:pe[nn]))||(pe==null?void 0:pe[nn])==0?"text-white":(pe==null?void 0:pe[nn])>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(pe==null?void 0:pe[nn])!=null&&!isNaN(parseFloat(pe==null?void 0:pe[nn]))&&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:Ae=>{Ae.preventDefault(),(pe==null?void 0:pe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(pe==null?void 0:pe.total_unrealized_pnl))&&(De(ze=>({...ze,pnl:pe==null?void 0:pe[nn],unrealizedPnL:pe==null?void 0:pe.total_unrealized_pnl,roe:pe==null?void 0:pe.margin_roi,leverage:pe==null?void 0:pe.avg_uleverage_value,referral:N?re:null})),Kn(!0))},className:`${(pe==null?void 0:pe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(pe==null?void 0:pe.total_unrealized_pnl))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(na,{info1:(pe==null?void 0:pe.total_unrealized_pnl)==null||isNaN(parseFloat(pe==null?void 0:pe.total_unrealized_pnl))?"--":`$${Ms(Math.abs(pe==null?void 0:pe.total_unrealized_pnl))}`,info1_Color:`${(pe==null?void 0:pe.total_unrealized_pnl)==null||isNaN(parseFloat(pe==null?void 0:pe.total_unrealized_pnl))||(pe==null?void 0:pe.total_unrealized_pnl)==0?"text-white":(pe==null?void 0:pe.total_unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(pe==null?void 0:pe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(pe==null?void 0:pe.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(na,{info1:(pe==null?void 0:pe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(pe==null?void 0:pe.portfolio_perp_all_time_value))?"--":`$${Ms(Math.abs(pe==null?void 0:pe.portfolio_perp_all_time_value))}`,info1_Color:`${(pe==null?void 0:pe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(pe==null?void 0:pe.portfolio_perp_all_time_value))||(pe==null?void 0:pe.portfolio_perp_all_time_value)==0?"text-white":(pe==null?void 0:pe.portfolio_perp_all_time_value)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(na,{info1:(pe==null?void 0:pe.win_complated_rate)==null||isNaN(parseFloat(pe==null?void 0:pe.win_complated_rate))?"--":`${Math.abs(pe==null?void 0:pe.win_complated_rate)}%`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(Aon,{info1:(pe==null?void 0:pe.complated_trades_count)==null||isNaN(parseFloat(pe==null?void 0:pe.complated_trades_count))?"--":`${Ms(Math.abs(pe==null?void 0:pe.complated_trades_count))}`,info2:(pe==null?void 0:pe.complated_win_count)==null||isNaN(parseFloat(pe==null?void 0:pe.complated_win_count))?"--":`${Ms(Math.abs(pe==null?void 0:pe.complated_win_count))}`,info3:(pe==null?void 0:pe.complated_loss_count)==null||isNaN(parseFloat(pe==null?void 0:pe.complated_loss_count))?"--":`${Ms(Math.abs(pe==null?void 0:pe.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(na,{info1:(pe==null?void 0:pe.long_kar)==null||isNaN(parseFloat(pe==null?void 0:pe.long_kar))?"--":`$${Ms(Math.abs(pe==null?void 0:pe.long_kar))}`,info1_Color:`${(pe==null?void 0:pe.long_kar)==null||isNaN(parseFloat(pe==null?void 0:pe.long_kar))||(pe==null?void 0:pe.long_kar)==0?"text-white":(pe==null?void 0:pe.long_kar)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(na,{info1:`$${(pe==null?void 0:pe.short_kar)==null||isNaN(parseFloat(pe==null?void 0:pe.short_kar))?"--":Ms(Math.abs(pe==null?void 0:pe.short_kar))}`,info1_Color:`${(pe==null?void 0:pe.short_kar)==null||isNaN(parseFloat(pe==null?void 0:pe.short_kar))||(pe==null?void 0:pe.short_kar)==0?"text-white":(pe==null?void 0:pe.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(Us,{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(na,{info1:`${a==1||a==999||(pe==null?void 0:pe[pt])==null||isNaN(parseFloat(pe==null?void 0:pe[pt]))||pt=="portfolio_perp_day_growth_rate"?"--":`${Ms(pe==null?void 0:pe[pt])}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(pe==null?void 0:pe[pt])==null||isNaN(parseFloat(pe==null?void 0:pe[pt]))||pt=="portfolio_perp_day_growth_rate"||(pe==null?void 0:pe[pt])==0?"text-white":(pe==null?void 0:pe[pt])>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(Us,{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(na,{info1:`${a==1||a==999||(pe==null?void 0:pe[Vt])==null||isNaN(parseFloat(pe==null?void 0:pe[Vt]))||Vt=="portfolio_perp_day_dd"?"--":`${Ms(Math.abs(pe==null?void 0:pe[Vt]))}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(pe==null?void 0:pe[Vt])==null||isNaN(parseFloat(pe==null?void 0:pe[Vt]))||Vt=="portfolio_perp_day_dd"||(pe==null?void 0:pe[Vt])==0?"text-white":(pe==null?void 0:pe[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(Us,{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(na,{info1:`${a==1||a==999||(pe==null?void 0:pe[We])==null||isNaN(parseFloat(pe==null?void 0:pe[We]))||We=="portfolio_perp_day_sharpe"?"--":`${Er(pe==null?void 0:pe[We])}`}`,info1_Color:`${a==1||a==999?"text-gray-600":(pe==null?void 0:pe[We])==null||isNaN(parseFloat(pe==null?void 0:pe[We]))||We=="portfolio_perp_day_sharpe"?"text-white":(pe==null?void 0:pe[We])>=1&&(pe==null?void 0:pe[We])<=2?"text-[#E5BB18]":(pe==null?void 0:pe[We])>2?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(na,{info1:`${(pe==null?void 0:pe.rtx_count)==null||isNaN(parseFloat(pe==null?void 0:pe.rtx_count))?"--":Ms(pe==null?void 0:pe.rtx_count)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(na,{info1:`${(pe==null?void 0:pe.margin_roi)==null||isNaN(parseFloat(pe==null?void 0:pe.margin_roi))?"--":`${Ms(Math.abs(pe==null?void 0:pe.margin_roi))}%`}`,info1_Color:`${(pe==null?void 0:pe.margin_roi)==null||isNaN(parseFloat(pe==null?void 0:pe.margin_roi))||(pe==null?void 0:pe.margin_roi)==0?"text-white":(pe==null?void 0:pe.margin_roi)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:i.jsx(Tan,{info1:`${(pe==null?void 0:pe.margin_used)==null||isNaN(parseFloat(pe==null?void 0:pe.margin_used))?"--":Ms(pe==null?void 0:pe.margin_used)}`,info2:`${(pe==null?void 0:pe.margin_percentage)==null||isNaN(parseFloat(pe==null?void 0:pe.margin_percentage))?"--":parseFloat(pe==null?void 0:pe.margin_percentage).toFixed(2)+"%"}`,info1_Color:"text-white",info2_Color:"text-[#979797]",rowTwo:!1})}),i.jsx("td",{children:i.jsx(na,{info1:`${(pe==null?void 0:pe.avg_uleverage_value)==null||isNaN(parseFloat(pe==null?void 0:pe.avg_uleverage_value))?"--":`${parseFloat(pe==null?void 0:pe.avg_uleverage_value).toFixed(2)}x`}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(na,{info1:`${(pe==null?void 0:pe.funding)==null||isNaN(parseFloat(pe==null?void 0:pe.funding))?"--":`$${Ms(Math.abs(pe==null?void 0:pe.funding))}`}`,info1_Color:`${(pe==null?void 0:pe.funding)==null||isNaN(parseFloat(pe==null?void 0:pe.funding))||(pe==null?void 0:pe.funding)==0?"text-white":(pe==null?void 0:pe.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:`${(pe==null?void 0:pe.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:(pe==null?void 0:pe.token_count)==null||isNaN(parseFloat(pe==null?void 0:pe.token_count))?"--":Ms(pe==null?void 0:pe.token_count)})}),(pe==null?void 0:pe.token_count)>0&&i.jsx(O4e,{content:pe==null?void 0:pe.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:`${(pe==null?void 0:pe.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:(pe==null?void 0:pe.position_count)==null||isNaN(parseFloat(pe==null?void 0:pe.position_count))?"--":Ms(pe==null?void 0:pe.position_count)})}),(pe==null?void 0:pe.position_count)>0&&i.jsx(O4e,{content:pe==null?void 0:pe.open_positions,positionTop:a!=999,alignRight:!1,type:"position"})]})})})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(na,{info1:`${It(pe==null?void 0:pe.complated_avg_duration)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(na,{info1:`${CP(pe==null?void 0:pe.first_time)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":"pr-6 sm:rounded-r-2xl"}`,children:i.jsx(na,{info1:`${CP(pe==null?void 0:pe.end_time)}`,info1_Color:"text-white",rowTwo:!1})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},qe)))})]})})]})]})]})};var WX,z4e;function Eon(){if(z4e)return WX;z4e=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 WX=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}},WX}var kon=Eon();const Ton=Ti(kon);var qX,H4e;function Ion(){if(H4e)return qX;H4e=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 qX=t,qX}var Pon=Ion();const V4e=Ti(Pon);var GX,W4e;function Fon(){return W4e||(W4e=1,GX=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}),GX}var Oon=Fon();const Mon=Ti(Oon);var NVe=(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))(NVe||{}),KX={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"]}},q4e=Object.values(NVe),hde={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Ron=Object.entries(hde).reduce((t,[e,n])=>(t[n]=e,t),{}),bm="data-rh",$4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},U4=(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},Lon=t=>{let e=U4(t,"title");const n=U4(t,$4.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=U4(t,$4.DEFAULT_TITLE);return e||r||void 0},Don=t=>U4(t,$4.ON_CHANGE_CLIENT_STATE)||(()=>{}),YX=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),Bon=(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},[]),$on=t=>console&&typeof console.warn=="function"&&console.warn(t),y7=(t,e,n)=>{const r={};return n.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&$on(`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()},Uon=(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},zon=t=>({baseTag:Bon(["href"],t),bodyAttributes:YX("bodyAttributes",t),defer:U4(t,$4.DEFER),encode:U4(t,$4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:YX("htmlAttributes",t),linkTags:y7("link",["rel","href"],t),metaTags:y7("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:y7("noscript",["innerHTML"],t),onChangeClientState:Don(t),scriptTags:y7("script",["src","innerHTML"],t),styleTags:y7("style",["cssText"],t),title:Lon(t),titleAttributes:YX("titleAttributes",t),prioritizeSeoTags:Uon(t,$4.PRIORITIZE_SEO_TAGS)}),jVe=t=>Array.isArray(t)?t.join(""):t,Hon=(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},XX=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(Hon(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},G4e=(t,e)=>({...t,[e]:void 0}),Von=["noscript","script","style"],Qre=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),AVe=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),Won=(t,e,n,r)=>{const s=AVe(n),a=jVe(e);return s?`<${t} ${bm}="true" ${s}>${Qre(a,r)}</${t}>`:`<${t} ${bm}="true">${Qre(a,r)}</${t}>`},qon=(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}="${Qre(a[d],n)}"`;return u?`${u} ${f}`:f},""),l=a.innerHTML||a.cssText||"",c=Von.indexOf(t)===-1;return`${r}<${t} ${bm}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),_Ve=(t,e={})=>Object.keys(t).reduce((n,r)=>{const s=hde[r];return n[s||r]=t[r],n},e),Gon=(t,e,n)=>{const r={key:e,[bm]:!0},s=_Ve(n,r);return[Ie.createElement("title",s,e)]},bM=(t,e)=>e.map((n,r)=>{const s={key:r,[bm]:!0};return Object.keys(n).forEach(a=>{const l=hde[a]||a;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=n[a]}),Ie.createElement(t,s)}),Wh=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>Gon(t,e.title,e.titleAttributes),toString:()=>Won(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>_Ve(e),toString:()=>AVe(e)};default:return{toComponent:()=>bM(t,e),toString:()=>qon(t,e,n)}}},Kon=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const s=XX(t,KX.meta),a=XX(e,KX.link),o=XX(n,KX.script);return{priorityMethods:{toComponent:()=>[...bM("meta",s.priority),...bM("link",a.priority),...bM("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}},Yon=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}=Kon(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)}},EVe=Yon,AF=[],kVe=!!(typeof window<"u"&&window.document&&window.document.createElement),Zre=class{constructor(t,e){Gn(this,"instances",[]);Gn(this,"canUseDOM",kVe);Gn(this,"context");Gn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?AF:this.instances,add:t=>{(this.canUseDOM?AF:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?AF:this.instances).indexOf(t);(this.canUseDOM?AF:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=EVe({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Xon={},TVe=Ie.createContext(Xon),a3,Ga=(a3=class extends h.Component{constructor(n){super(n);Gn(this,"helmetData");this.helmetData=new Zre(this.props.context||{},a3.canUseDOM)}render(){return Ie.createElement(TVe.Provider,{value:this.helmetData.value},this.props.children)}},Gn(a3,"canUseDOM",kVe),a3),_C=(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}},Jre=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const r=n.getAttribute(bm),s=r?r.split(","):[],a=[...s],o=Object.keys(e);for(const l of o){const c=e[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=a.indexOf(l);u!==-1&&a.splice(u,1)}for(let l=a.length-1;l>=0;l-=1)n.removeAttribute(a[l]);s.length===a.length?n.removeAttribute(bm):n.getAttribute(bm)!==o.join(",")&&n.setAttribute(bm,o.join(","))},Qon=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=jVe(t)),Jre("title",e)},K4e=(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;Jre("body",r),Jre("html",s),Qon(f,x);const g={baseTag:_C("base",n),linkTags:_C("link",a),metaTags:_C("meta",o),noscriptTags:_C("noscript",l),scriptTags:_C("script",u),styleTags:_C("style",d)},y={},v={};Object.keys(g).forEach(C=>{const{newTags:N,oldTags:I}=g[C];N.length&&(y[C]=N),I.length&&(v[C]=g[C].oldTags)}),e&&e(),c(t,y,v)},v7=null,Zon=t=>{v7&&cancelAnimationFrame(v7),t.defer?v7=requestAnimationFrame(()=>{K4e(t,()=>{v7=null})}):(K4e(t),v7=null)},Jon=Zon,Y4e=class extends h.Component{constructor(){super(...arguments);Gn(this,"rendered",!1)}shouldComponentUpdate(e){return!Mon(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=zon(e.get().map(a=>{const o={...a.props};return delete o.context,o}));Ga.canUseDOM?Jon(s):r=EVe(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}},IZ,no=(IZ=class extends h.Component{shouldComponentUpdate(t){return!Ton(G4e(this.props,"helmetData"),G4e(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 V4e(q4e.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 ${q4e.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),V4e(!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 Ie.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:s,...a}=r.props,o=Object.keys(a).reduce((c,u)=>(c[Ron[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 Zre)){const s=r;r=new Zre(s.context,!0),delete n.helmetData}return r?Ie.createElement(Y4e,{...n,context:r.value}):Ie.createElement(TVe.Consumer,null,s=>Ie.createElement(Y4e,{...n,context:s}))}},Gn(IZ,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),IZ);const eln=()=>{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(Ga,{children:i.jsxs(no,{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(_on,{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(fz,{sortKey:e,state:n,className:""})]})})};var _F={},EF={exports:{}};/*!
* ApexCharts v3.54.1
* (c) 2018-2024 ApexCharts
* Released under the MIT License.
*/var X4e;function tln(){return X4e||(X4e=1,function(t,e){function n(ke,m){(m==null||m>ke.length)&&(m=ke.length);for(var p=0,S=Array(m);p<m;p++)S[p]=ke[p];return S}function r(ke){if(ke===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ke}function s(ke,m){if(!(ke instanceof m))throw new TypeError("Cannot call a class as a function")}function a(ke,m){for(var p=0;p<m.length;p++){var S=m[p];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(ke,I(S.key),S)}}function o(ke,m,p){return m&&a(ke.prototype,m),p&&a(ke,p),Object.defineProperty(ke,"prototype",{writable:!1}),ke}function l(ke,m){var p=typeof Symbol<"u"&&ke[Symbol.iterator]||ke["@@iterator"];if(!p){if(Array.isArray(ke)||(p=M(ke))||m){p&&(ke=p);var S=0,A=function(){};return{s:A,n:function(){return S>=ke.length?{done:!0}:{done:!1,value:ke[S++]}},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,T=!0,D=!1;return{s:function(){p=p.call(ke)},n:function(){var V=p.next();return T=V.done,V},e:function(V){D=!0,k=V},f:function(){try{T||p.return==null||p.return()}finally{if(D)throw k}}}}function c(ke){var m=x();return function(){var p,S=d(ke);if(m){var A=d(this).constructor;p=Reflect.construct(S,arguments,A)}else p=S.apply(this,arguments);return function(k,T){if(T&&(typeof T=="object"||typeof T=="function"))return T;if(T!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r(k)}(this,p)}}function u(ke,m,p){return(m=I(m))in ke?Object.defineProperty(ke,m,{value:p,enumerable:!0,configurable:!0,writable:!0}):ke[m]=p,ke}function d(ke){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},d(ke)}function f(ke,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");ke.prototype=Object.create(m&&m.prototype,{constructor:{value:ke,writable:!0,configurable:!0}}),Object.defineProperty(ke,"prototype",{writable:!1}),m&&v(ke,m)}function x(){try{var ke=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x=function(){return!!ke})()}function g(ke,m){var p=Object.keys(ke);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(ke);m&&(S=S.filter(function(A){return Object.getOwnPropertyDescriptor(ke,A).enumerable})),p.push.apply(p,S)}return p}function y(ke){for(var m=1;m<arguments.length;m++){var p=arguments[m]!=null?arguments[m]:{};m%2?g(Object(p),!0).forEach(function(S){u(ke,S,p[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ke,Object.getOwnPropertyDescriptors(p)):g(Object(p)).forEach(function(S){Object.defineProperty(ke,S,Object.getOwnPropertyDescriptor(p,S))})}return ke}function v(ke,m){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(p,S){return p.__proto__=S,p},v(ke,m)}function C(ke,m){return function(p){if(Array.isArray(p))return p}(ke)||function(p,S){var A=p==null?null:typeof Symbol<"u"&&p[Symbol.iterator]||p["@@iterator"];if(A!=null){var k,T,D,V,X=[],le=!0,ce=!1;try{if(D=(A=A.call(p)).next,S===0){if(Object(A)!==A)return;le=!1}else for(;!(le=(k=D.call(A)).done)&&(X.push(k.value),X.length!==S);le=!0);}catch(fe){ce=!0,T=fe}finally{try{if(!le&&A.return!=null&&(V=A.return(),Object(V)!==V))return}finally{if(ce)throw T}}return X}}(ke,m)||M(ke,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 N(ke){return function(m){if(Array.isArray(m))return n(m)}(ke)||function(m){if(typeof Symbol<"u"&&m[Symbol.iterator]!=null||m["@@iterator"]!=null)return Array.from(m)}(ke)||M(ke)||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 I(ke){var m=function(p,S){if(typeof p!="object"||!p)return p;var A=p[Symbol.toPrimitive];if(A!==void 0){var k=A.call(p,S||"default");if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(p)}(ke,"string");return typeof m=="symbol"?m:m+""}function P(ke){return P=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},P(ke)}function M(ke,m){if(ke){if(typeof ke=="string")return n(ke,m);var p={}.toString.call(ke).slice(8,-1);return p==="Object"&&ke.constructor&&(p=ke.constructor.name),p==="Map"||p==="Set"?Array.from(ke):p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p)?n(ke,m):void 0}}var F=function(){function ke(){s(this,ke)}return o(ke,[{key:"shadeRGBColor",value:function(m,p){var S=p.split(","),A=m<0?0:255,k=m<0?-1*m:m,T=parseInt(S[0].slice(4),10),D=parseInt(S[1],10),V=parseInt(S[2],10);return"rgb("+(Math.round((A-T)*k)+T)+","+(Math.round((A-D)*k)+D)+","+(Math.round((A-V)*k)+V)+")"}},{key:"shadeHexColor",value:function(m,p){var S=parseInt(p.slice(1),16),A=m<0?0:255,k=m<0?-1*m:m,T=S>>16,D=S>>8&255,V=255&S;return"#"+(16777216+65536*(Math.round((A-T)*k)+T)+256*(Math.round((A-D)*k)+D)+(Math.round((A-V)*k)+V)).toString(16).slice(1)}},{key:"shadeColor",value:function(m,p){return ke.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&&P(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,S=[];for(p=0;p<m.length;p++)S[p]=m[p];return S}},{key:"extend",value:function(m,p){var S=this;typeof Object.assign!="function"&&(Object.assign=function(k){if(k==null)throw new TypeError("Cannot convert undefined or null to object");for(var T=Object(k),D=1;D<arguments.length;D++){var V=arguments[D];if(V!=null)for(var X in V)V.hasOwnProperty(X)&&(T[X]=V[X])}return T});var A=Object.assign({},m);return this.isObject(m)&&this.isObject(p)&&Object.keys(p).forEach(function(k){S.isObject(p[k])&&k in m?A[k]=S.extend(m[k],p[k]):Object.assign(A,u({},k,p[k]))}),A}},{key:"extendArray",value:function(m,p){var S=[];return m.map(function(A){S.push(ke.extend(p,A))}),m=S}},{key:"monthMod",value:function(m){return m%12}},{key:"clone",value:function(m){if(ke.is("Array",m)){for(var p=[],S=0;S<m.length;S++)p[S]=this.clone(m[S]);return p}if(ke.is("Null",m))return null;if(ke.is("Date",m))return m;if(P(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 S="",A=m<0?"-":"",k=p[0].replace(".",""),T=Number(p[1])+1;if(T<0){for(S=A+"0.";T++;)S+="0";return S+k.replace(/^-/,"")}for(T-=k.length;T--;)S+="0";return k+S}},{key:"getDimensions",value:function(m){var p=getComputedStyle(m,null),S=m.clientHeight,A=m.clientWidth;return S-=parseFloat(p.paddingTop)+parseFloat(p.paddingBottom),[A-=parseFloat(p.paddingLeft)+parseFloat(p.paddingRight),S]}},{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,S){return Array.isArray(S)&&(S=S.reduce(function(A,k){return A.length>k.length?A:k})),p.length>S.length?p:S},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 S=m.replace("#","");S=S.match(new RegExp("(.{"+S.length/3+"})","g"));for(var A=0;A<S.length;A++)S[A]=parseInt(S[A].length===1?S[A]+S[A]:S[A],16);return p!==void 0&&S.push(p),"rgba("+S.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 S=[],A=2*Math.PI/p,k=0;k<p;k++){var T={};T.x=m*Math.sin(k*A),T.y=-m*Math.cos(k*A),S.push(T)}return S}},{key:"polarToCartesian",value:function(m,p,S,A){var k=(A-90)*Math.PI/180;return{x:m+S*Math.cos(k),y:p+S*Math.sin(k)}}},{key:"escapeString",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x",S=m.toString().slice();return S=S.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,p)}},{key:"negToZero",value:function(m){return m<0?0:m}},{key:"moveIndexInArray",value:function(m,p,S){if(S>=m.length)for(var A=S-m.length+1;A--;)m.push(void 0);return m.splice(S,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 S in p)p.hasOwnProperty(S)&&(m.style.key=p[S])}},{key:"preciseAddition",value:function(m,p){var S=(String(m).split(".")[1]||"").length,A=(String(p).split(".")[1]||"").length,k=Math.pow(10,Math.max(S,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 S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,A=Math.pow(10,S-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=[],S=2;m>=2;)m%S==0?(p.push(S),m/=S):S++;return p}},{key:"mod",value:function(m,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,A=Math.pow(10,S-Math.floor(Math.log10(Math.max(m,p))));return(m=Math.round(Math.abs(m)*A))%(p=Math.round(Math.abs(p)*A))/A}}]),ke}(),$=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.setEasingFunctions()}return o(ke,[{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 S=1.70158;return(p-=1)*p*((S+1)*p+S)+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,S,A){m.attr(p).animate(A).attr(S)}},{key:"animateMarker",value:function(m,p,S,A){m.attr({opacity:0}).animate(p,S).attr({opacity:1}).afterAll(function(){A()})}},{key:"animateRect",value:function(m,p,S,A,k){m.attr(p).animate(A).attr(S).afterAll(function(){return k()})}},{key:"animatePathsGradually",value:function(m){var p=m.el,S=m.realIndex,A=m.j,k=m.fill,T=m.pathFrom,D=m.pathTo,V=m.speed,X=m.delay,le=this.w,ce=0;le.config.chart.animations.animateGradually.enabled&&(ce=le.config.chart.animations.animateGradually.delay),le.config.chart.animations.dynamicAnimation.enabled&&le.globals.dataChanged&&le.config.chart.type!=="bar"&&(ce=0),this.morphSVG(p,S,A,le.config.chart.type!=="line"||le.globals.comboCharts?k:"stroke",T,D,V,X*ce)}},{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,S,A,k,T,D,V){var X=this,le=this.w;k||(k=m.attr("pathFrom")),T||(T=m.attr("pathTo"));var ce=function(fe){return le.config.chart.type==="radar"&&(D=1),"M 0 ".concat(le.globals.gridHeight)};(!k||k.indexOf("undefined")>-1||k.indexOf("NaN")>-1)&&(k=ce()),(!T||T.indexOf("undefined")>-1||T.indexOf("NaN")>-1)&&(T=ce()),le.globals.shouldAnimate||(D=1),m.plot(k).animate(1,le.globals.easing,V).plot(k).animate(D,le.globals.easing,V).plot(T).afterAll(function(){F.isNumber(S)?S===le.globals.series[le.globals.maxValsInArrayIndex].length-2&&le.globals.shouldAnimate&&X.animationCompleted(m):A!=="none"&&le.globals.shouldAnimate&&(!le.globals.comboCharts&&p===le.globals.series.length-1||le.globals.comboCharts)&&X.animationCompleted(m),X.showDelayedElements()})}}]),ke}(),L=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"getDefaultFilter",value:function(m,p){var S=this.w;m.unfilter(!0),new window.SVG.Filter().size("120%","180%","-5%","-40%"),S.config.states.normal.filter!=="none"?this.applyFilter(m,p,S.config.states.normal.filter.type,S.config.states.normal.filter.value):S.config.chart.dropShadow.enabled&&this.dropShadow(m,S.config.chart.dropShadow,p)}},{key:"addNormalFilter",value:function(m,p){var S=this.w;S.config.chart.dropShadow.enabled&&!m.node.classList.contains("apexcharts-marker")&&this.dropShadow(m,S.config.chart.dropShadow,p)}},{key:"addLightenFilter",value:function(m,p,S){var A=this,k=this.w,T=S.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:T}})}),m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)}},{key:"addDarkenFilter",value:function(m,p,S){var A=this,k=this.w,T=S.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:T}})}),m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)}},{key:"applyFilter",value:function(m,p,S){var A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.5;switch(S){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,S){var A,k=this.w,T=S.blur,D=S.top,V=S.left,X=S.color,le=S.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 ce=m.flood(Array.isArray(X)?X[p]:X,le).composite(m.sourceAlpha,"in").offset(V,D).gaussianBlur(T).merge(m.source);return m.blend(m.source,ce)}},{key:"dropShadow",value:function(m,p){var S,A,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,T=p.top,D=p.left,V=p.blur,X=p.color,le=p.opacity,ce=p.noUserSpaceOnUse,fe=this.w;return m.unfilter(!0),F.isMsEdge()&&fe.config.chart.type==="radialBar"||((S=fe.config.chart.dropShadow.enabledOnSeries)===null||S===void 0?void 0:S.length)>0&&((A=fe.config.chart.dropShadow.enabledOnSeries)===null||A===void 0?void 0:A.indexOf(k))===-1||(X=Array.isArray(X)?X[k]:X,m.filter(function(ye){var Pe=null;Pe=F.isSafari()||F.isFirefox()||F.isMsEdge()?ye.flood(X,le).composite(ye.sourceAlpha,"in").offset(D,T).gaussianBlur(V):ye.flood(X,le).composite(ye.sourceAlpha,"in").offset(D,T).gaussianBlur(V).merge(ye.source),ye.blend(ye.source,Pe)}),ce||m.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(m.filterer.node)),m}},{key:"setSelectionFilter",value:function(m,p,S){var A=this.w;if(A.globals.selectedDataPoints[p]!==void 0&&A.globals.selectedDataPoints[p].indexOf(S)>-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 S in p)p.hasOwnProperty(S)&&m.setAttribute(S,p[S])})({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}]),ke}(),z=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"roundPathCorners",value:function(m,p){function S(at,ut,yt){var Lt=ut.x-at.x,Gt=ut.y-at.y,an=Math.sqrt(Lt*Lt+Gt*Gt);return A(at,ut,Math.min(1,yt/an))}function A(at,ut,yt){return{x:at.x+(ut.x-at.x)*yt,y:at.y+(ut.y-at.y)*yt}}function k(at,ut){at.length>2&&(at[at.length-2]=ut.x,at[at.length-1]=ut.y)}function T(at){return{x:parseFloat(at[at.length-2]),y:parseFloat(at[at.length-1])}}m.indexOf("NaN")>-1&&(m="");var D=m.split(/[,\s]/).reduce(function(at,ut){var yt=ut.match("([a-zA-Z])(.+)");return yt?(at.push(yt[1]),at.push(yt[2])):at.push(ut),at},[]).reduce(function(at,ut){return parseFloat(ut)==ut&&at.length?at[at.length-1].push(ut):at.push([ut]),at},[]),V=[];if(D.length>1){var X=T(D[0]),le=null;D[D.length-1][0]=="Z"&&D[0].length>2&&(le=["L",X.x,X.y],D[D.length-1]=le),V.push(D[0]);for(var ce=1;ce<D.length;ce++){var fe=V[V.length-1],ye=D[ce],Pe=ye==le?D[1]:D[ce+1];if(Pe&&fe&&fe.length>2&&ye[0]=="L"&&Pe.length>2&&Pe[0]=="L"){var Me,Ke,we=T(fe),Te=T(ye),te=T(Pe);Me=S(Te,we,p),Ke=S(Te,te,p),k(ye,Me),ye.origPoint=Te,V.push(ye);var ve=A(Me,Te,.5),Be=A(Te,Ke,.5),Ue=["C",ve.x,ve.y,Be.x,Be.y,Ke.x,Ke.y];Ue.origPoint=Te,V.push(Ue)}else V.push(ye)}if(le){var Fe=T(V[V.length-1]);V.push(["Z"]),k(V[0],Fe)}}else V=D;return V.reduce(function(at,ut){return at+ut.join(" ")+" "},"")}},{key:"drawLine",value:function(m,p,S,A){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"#a8a8a8",T=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:S,y2:A,stroke:k,"stroke-dasharray":T,"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,S=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,T=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,X=arguments.length>8&&arguments[8]!==void 0?arguments[8]:null,le=arguments.length>9&&arguments[9]!==void 0?arguments[9]:0,ce=this.w.globals.dom.Paper.rect();return ce.attr({x:m,y:p,width:S>0?S:0,height:A>0?A:0,rx:k,ry:k,opacity:D,"stroke-width":V!==null?V:0,stroke:X!==null?X:"none","stroke-dasharray":le}),ce.node.setAttribute("fill",T),ce}},{key:"drawPolygon",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#e1e1e1",S=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":S})}},{key:"drawCircle",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;m<0&&(m=0);var S=this.w.globals.dom.Paper.circle(2*m);return p!==null&&S.attr(p),S}},{key:"drawPath",value:function(m){var p=m.d,S=p===void 0?"":p,A=m.stroke,k=A===void 0?"#a8a8a8":A,T=m.strokeWidth,D=T===void 0?1:T,V=m.fill,X=m.fillOpacity,le=X===void 0?1:X,ce=m.strokeOpacity,fe=ce===void 0?1:ce,ye=m.classes,Pe=m.strokeLinecap,Me=Pe===void 0?null:Pe,Ke=m.strokeDashArray,we=Ke===void 0?0:Ke,Te=this.w;return Me===null&&(Me=Te.config.stroke.lineCap),(S.indexOf("undefined")>-1||S.indexOf("NaN")>-1)&&(S="M 0 ".concat(Te.globals.gridHeight)),Te.globals.dom.Paper.path(S).attr({fill:V,"fill-opacity":le,stroke:k,"stroke-opacity":fe,"stroke-linecap":Me,"stroke-width":D,"stroke-dasharray":we,class:ye})}},{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 S=["M",m,p].join(" ");return S}},{key:"line",value:function(m,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=null;return S===null?A=[" L",m,p].join(" "):S==="H"?A=[" H",m].join(" "):S==="V"&&(A=[" V",p].join(" ")),A}},{key:"curve",value:function(m,p,S,A,k,T){var D=["C",m,p,S,A,k,T].join(" ");return D}},{key:"quadraticCurve",value:function(m,p,S,A){return["Q",m,p,S,A].join(" ")}},{key:"arc",value:function(m,p,S,A,k,T,D){var V="A";arguments.length>7&&arguments[7]!==void 0&&arguments[7]&&(V="a");var X=[V,m,p,S,A,k,T,D].join(" ");return X}},{key:"renderPaths",value:function(m){var p,S=m.j,A=m.realIndex,k=m.pathFrom,T=m.pathTo,D=m.stroke,V=m.strokeWidth,X=m.strokeLinecap,le=m.fill,ce=m.animationDelay,fe=m.initialSpeed,ye=m.dataChangeSpeed,Pe=m.className,Me=m.chartType,Ke=m.shouldClipToGrid,we=Ke===void 0||Ke,Te=m.bindEventsOnPaths,te=Te===void 0||Te,ve=m.drawShadow,Be=ve===void 0||ve,Ue=this.w,Fe=new L(this.ctx),at=new $(this.ctx),ut=this.w.config.chart.animations.enabled,yt=ut&&this.w.config.chart.animations.dynamicAnimation.enabled,Lt=!!(ut&&!Ue.globals.resized||yt&&Ue.globals.dataChanged&&Ue.globals.shouldAnimate);Lt?p=k:(p=T,Ue.globals.animationEnded=!0);var Gt=Ue.config.stroke.dashArray,an=0;an=Array.isArray(Gt)?Gt[A]:Ue.config.stroke.dashArray;var et=this.drawPath({d:p,stroke:D,strokeWidth:V,fill:le,fillOpacity:1,classes:Pe,strokeLinecap:X,strokeDashArray:an});if(et.attr("index",A),we&&(Me==="bar"&&!Ue.globals.isHorizontal||Ue.globals.comboCharts?et.attr({"clip-path":"url(#gridRectBarMask".concat(Ue.globals.cuid,")")}):et.attr({"clip-path":"url(#gridRectMask".concat(Ue.globals.cuid,")")})),Ue.config.states.normal.filter.type!=="none")Fe.getDefaultFilter(et,A);else if(Ue.config.chart.dropShadow.enabled&&Be){var Pt=Ue.config.chart.dropShadow;Fe.dropShadow(et,Pt,A)}te&&(et.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,et)),et.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,et)),et.node.addEventListener("mousedown",this.pathMouseDown.bind(this,et))),et.attr({pathTo:T,pathFrom:k});var qt={el:et,j:S,realIndex:A,pathFrom:k,pathTo:T,fill:le,strokeWidth:V,delay:ce};return!ut||Ue.globals.resized||Ue.globals.dataChanged?!Ue.globals.resized&&Ue.globals.dataChanged||at.showDelayedElements():at.animatePathsGradually(y(y({},qt),{},{speed:fe})),Ue.globals.dataChanged&&yt&&Lt&&at.animatePathsGradually(y(y({},qt),{},{speed:ye})),et}},{key:"drawPattern",value:function(m,p,S){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,S,function(T){m==="horizontalLines"?T.line(0,0,S,0).stroke({color:A,width:k+1}):m==="verticalLines"?T.line(0,0,0,p).stroke({color:A,width:k+1}):m==="slantedLines"?T.line(0,0,p,S).stroke({color:A,width:k}):m==="squares"?T.rect(p,S).fill("none").stroke({color:A,width:k}):m==="circles"&&T.circle(p).fill("none").stroke({color:A,width:k})})}},{key:"drawGradient",value:function(m,p,S,A,k){var T,D=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,V=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,X=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,le=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0,ce=this.w;p.length<9&&p.indexOf("#")===0&&(p=F.hexToRgba(p,A)),S.length<9&&S.indexOf("#")===0&&(S=F.hexToRgba(S,k));var fe=0,ye=1,Pe=1,Me=null;V!==null&&(fe=V[0]!==void 0?V[0]/100:0,ye=V[1]!==void 0?V[1]/100:1,Pe=V[2]!==void 0?V[2]/100:1,Me=V[3]!==void 0?V[3]/100:null);var Ke=!(ce.config.chart.type!=="donut"&&ce.config.chart.type!=="pie"&&ce.config.chart.type!=="polarArea"&&ce.config.chart.type!=="bubble");if(T=X===null||X.length===0?ce.globals.dom.Paper.gradient(Ke?"radial":"linear",function(te){te.at(fe,p,A),te.at(ye,S,k),te.at(Pe,S,k),Me!==null&&te.at(Me,p,A)}):ce.globals.dom.Paper.gradient(Ke?"radial":"linear",function(te){(Array.isArray(X[le])?X[le]:X).forEach(function(ve){te.at(ve.offset/100,ve.color,ve.opacity)})}),Ke){var we=ce.globals.gridWidth/2,Te=ce.globals.gridHeight/2;ce.config.chart.type!=="bubble"?T.attr({gradientUnits:"userSpaceOnUse",cx:we,cy:Te,r:D}):T.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else m==="vertical"?T.from(0,0).to(0,1):m==="diagonal"?T.from(0,0).to(1,1):m==="horizontal"?T.from(0,1).to(1,1):m==="diagonal2"&&T.from(1,0).to(0,1);return T}},{key:"getTextBasedOnMaxWidth",value:function(m){var p=m.text,S=m.maxWidth,A=m.fontSize,k=m.fontFamily,T=this.getTextRects(p,A,k),D=T.width/p.length,V=Math.floor(S/D);return S<T.width?p.slice(0,V-3)+"...":p}},{key:"drawText",value:function(m){var p=this,S=m.x,A=m.y,k=m.text,T=m.textAnchor,D=m.fontSize,V=m.fontFamily,X=m.fontWeight,le=m.foreColor,ce=m.opacity,fe=m.maxWidth,ye=m.cssClass,Pe=ye===void 0?"":ye,Me=m.isPlainText,Ke=Me===void 0||Me,we=m.dominantBaseline,Te=we===void 0?"auto":we,te=this.w;k===void 0&&(k="");var ve=k;T||(T="start"),le&&le.length||(le=te.config.chart.foreColor),V=V||te.config.chart.fontFamily,X=X||"regular";var Be,Ue={maxWidth:fe,fontSize:D=D||"11px",fontFamily:V};return Array.isArray(k)?Be=te.globals.dom.Paper.text(function(Fe){for(var at=0;at<k.length;at++)ve=k[at],fe&&(ve=p.getTextBasedOnMaxWidth(y({text:k[at]},Ue))),at===0?Fe.tspan(ve):Fe.tspan(ve).newLine()}):(fe&&(ve=this.getTextBasedOnMaxWidth(y({text:k},Ue))),Be=Ke?te.globals.dom.Paper.plain(k):te.globals.dom.Paper.text(function(Fe){return Fe.tspan(ve)})),Be.attr({x:S,y:A,"text-anchor":T,"dominant-baseline":Te,"font-size":D,"font-family":V,"font-weight":X,fill:le,class:"apexcharts-text "+Pe}),Be.node.style.fontFamily=V,Be.node.style.opacity=ce,Be}},{key:"getMarkerPath",value:function(m,p,S,A){var k="";switch(S){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 T=5;A*=1.15,S==="sparkle"&&(A/=1.1,T=4);for(var D=Math.PI/T,V=0;V<=2*T;V++){var X=V*D,le=V%2==0?A:A/2;k+=(V===0?"M":"L")+(m+le*Math.sin(X))+","+(p-le*Math.cos(X))}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,S,A,k){var T=this.drawPath({d:this.getMarkerPath(m,p,S,A,k),stroke:k.pointStrokeColor,strokeDashArray:k.pointStrokeDashArray,strokeWidth:k.pointStrokeWidth,fill:k.pointFillColor,fillOpacity:k.pointFillOpacity,strokeOpacity:k.pointStrokeOpacity});return T.attr({cx:m,cy:p,shape:k.shape,class:k.class?k.class:""}),T}},{key:"drawMarker",value:function(m,p,S){m=m||0;var A=S.pSize||0;return F.isNumber(p)||(A=0,p=0),this.drawMarkerShape(m,p,S==null?void 0:S.shape,A,y(y({},S),S.shape==="line"||S.shape==="plus"||S.shape==="cross"?{pointStrokeColor:S.pointFillColor,pointStrokeOpacity:S.pointFillOpacity}:{}))}},{key:"pathMouseEnter",value:function(m,p){var S=this.w,A=new L(this.ctx),k=parseInt(m.node.getAttribute("index"),10),T=parseInt(m.node.getAttribute("j"),10);if(typeof S.config.chart.events.dataPointMouseEnter=="function"&&S.config.chart.events.dataPointMouseEnter(p,this.ctx,{seriesIndex:k,dataPointIndex:T,w:S}),this.ctx.events.fireEvent("dataPointMouseEnter",[p,this.ctx,{seriesIndex:k,dataPointIndex:T,w:S}]),(S.config.states.active.filter.type==="none"||m.node.getAttribute("selected")!=="true")&&S.config.states.hover.filter.type!=="none"&&!S.globals.isTouchDevice){var D=S.config.states.hover.filter;A.applyFilter(m,k,D.type,D.value)}}},{key:"pathMouseLeave",value:function(m,p){var S=this.w,A=new L(this.ctx),k=parseInt(m.node.getAttribute("index"),10),T=parseInt(m.node.getAttribute("j"),10);typeof S.config.chart.events.dataPointMouseLeave=="function"&&S.config.chart.events.dataPointMouseLeave(p,this.ctx,{seriesIndex:k,dataPointIndex:T,w:S}),this.ctx.events.fireEvent("dataPointMouseLeave",[p,this.ctx,{seriesIndex:k,dataPointIndex:T,w:S}]),S.config.states.active.filter.type!=="none"&&m.node.getAttribute("selected")==="true"||S.config.states.hover.filter.type!=="none"&&A.getDefaultFilter(m,k)}},{key:"pathMouseDown",value:function(m,p){var S=this.w,A=new L(this.ctx),k=parseInt(m.node.getAttribute("index"),10),T=parseInt(m.node.getAttribute("j"),10),D="false";if(m.node.getAttribute("selected")==="true"){if(m.node.setAttribute("selected","false"),S.globals.selectedDataPoints[k].indexOf(T)>-1){var V=S.globals.selectedDataPoints[k].indexOf(T);S.globals.selectedDataPoints[k].splice(V,1)}}else{if(!S.config.states.active.allowMultipleDataPointsSelection&&S.globals.selectedDataPoints.length>0){S.globals.selectedDataPoints=[];var X=S.globals.dom.Paper.select(".apexcharts-series path").members,le=S.globals.dom.Paper.select(".apexcharts-series circle, .apexcharts-series rect").members,ce=function(Pe){Array.prototype.forEach.call(Pe,function(Me){Me.node.setAttribute("selected","false"),A.getDefaultFilter(Me,k)})};ce(X),ce(le)}m.node.setAttribute("selected","true"),D="true",S.globals.selectedDataPoints[k]===void 0&&(S.globals.selectedDataPoints[k]=[]),S.globals.selectedDataPoints[k].push(T)}if(D==="true"){var fe=S.config.states.active.filter;if(fe!=="none")A.applyFilter(m,k,fe.type,fe.value);else if(S.config.states.hover.filter!=="none"&&!S.globals.isTouchDevice){var ye=S.config.states.hover.filter;A.applyFilter(m,k,ye.type,ye.value)}}else S.config.states.active.filter.type!=="none"&&(S.config.states.hover.filter.type==="none"||S.globals.isTouchDevice?A.getDefaultFilter(m,k):(ye=S.config.states.hover.filter,A.applyFilter(m,k,ye.type,ye.value)));typeof S.config.chart.events.dataPointSelection=="function"&&S.config.chart.events.dataPointSelection(p,this.ctx,{selectedDataPoints:S.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:T,w:S}),p&&this.ctx.events.fireEvent("dataPointSelection",[p,this.ctx,{selectedDataPoints:S.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:T,w:S}])}},{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,S,A){var k=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],T=this.w,D=this.drawText({x:-200,y:-200,text:m,textAnchor:"start",fontSize:p,fontFamily:S,foreColor:"#fff",opacity:0});A&&D.attr("transform",A),T.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,S){if(typeof m.getComputedTextLength=="function"&&(m.textContent=p,p.length>0&&m.getComputedTextLength()>=S/1.1)){for(var A=p.length-3;A>0;A-=3)if(m.getSubStringLength(0,A)<=S/1.1)return void(m.textContent=p.substring(0,A)+"...");m.textContent="."}}}],[{key:"setAttrs",value:function(m,p){for(var S in p)p.hasOwnProperty(S)&&m.setAttribute(S,p[S])}}]),ke}(),Q=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"getStackedSeriesTotals",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=this.w,S=[];if(p.globals.series.length===0)return S;for(var A=0;A<p.globals.series[p.globals.maxValsInArrayIndex].length;A++){for(var k=0,T=0;T<p.globals.series.length;T++)p.globals.series[T][A]!==void 0&&m.indexOf(T)===-1&&(k+=p.globals.series[T][A]);S.push(k)}return S}},{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,S){return p+S},0):this.w.globals.series[m].reduce(function(p,S){return p+S},0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var m=this,p=this.w,S=[];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 T=p.globals.series.map(function(D,V){return k.indexOf(V)===-1?V:-1}).filter(function(D){return D!==-1});S.push(m.getStackedSeriesTotals(T))}),S}},{key:"setSeriesYAxisMappings",value:function(){var m=this.w.globals,p=this.w.config,S=[],A=[],k=[],T=m.series.length>p.yaxis.length||p.yaxis.some(function(ce){return Array.isArray(ce.seriesName)});p.series.forEach(function(ce,fe){k.push(fe),A.push(null)}),p.yaxis.forEach(function(ce,fe){S[fe]=[]});var D=[];p.yaxis.forEach(function(ce,fe){var ye=!1;if(ce.seriesName){var Pe=[];Array.isArray(ce.seriesName)?Pe=ce.seriesName:Pe.push(ce.seriesName),Pe.forEach(function(Me){p.series.forEach(function(Ke,we){if(Ke.name===Me){var Te=we;fe===we||T?!T||k.indexOf(we)>-1?S[fe].push([fe,we]):console.warn("Series '"+Ke.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(S[we].push([we,fe]),Te=fe),ye=!0,(Te=k.indexOf(Te))!==-1&&k.splice(Te,1)}})})}ye||D.push(fe)}),S=S.map(function(ce,fe){var ye=[];return ce.forEach(function(Pe){A[Pe[1]]=Pe[0],ye.push(Pe[1])}),ye});for(var V=p.yaxis.length-1,X=0;X<D.length&&(V=D[X],S[V]=[],k);X++){var le=k[0];k.shift(),S[V].push(le),A[le]=V}k.forEach(function(ce){S[V].push(ce),A[ce]=V}),m.seriesYAxisMap=S.map(function(ce){return ce}),m.seriesYAxisReverseMap=A.map(function(ce){return ce}),m.seriesYAxisMap.forEach(function(ce,fe){ce.forEach(function(ye){p.series[ye]&&p.series[ye].group===void 0&&(p.series[ye].group="apexcharts-axis-".concat(fe.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,S,A){return p===A[0]})}},{key:"getCategoryLabels",value:function(m){var p=this.w,S=m.slice();return p.config.xaxis.convertedCatToNumeric&&(S=m.map(function(A,k){return p.config.xaxis.labels.formatter(A-p.globals.minX+1)})),S}},{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(S){p=Math.max(p,S)}),m.config.markers.discrete&&m.config.markers.discrete.length&&m.config.markers.discrete.forEach(function(S){p=Math.max(p,S.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,S){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 S=this.w;return S.globals.series.map(function(A,k){for(var T=0,D=0;D<A.length;D++)S.globals.seriesX[k][D]>m&&S.globals.seriesX[k][D]<p&&(T+=A[D]);return T})}},{key:"getPercentSeries",value:function(){var m=this.w;m.globals.seriesPercent=m.globals.series.map(function(p,S){var A=[];if(Array.isArray(p))for(var k=0;k<p.length;k++){var T=m.globals.stackedSeriesTotals[k],D=0;T&&(D=100*p[k]/T),A.push(D)}else{var V=100*p/m.globals.seriesTotals.reduce(function(X,le){return X+le},0);A.push(V)}return A})}},{key:"getCalculatedRatios",value:function(){var m,p,S,A=this,k=this.w,T=k.globals,D=[],V=0,X=[],le=.1,ce=0;if(T.yRange=[],T.isMultipleYAxis)for(var fe=0;fe<T.minYArr.length;fe++)T.yRange.push(Math.abs(T.minYArr[fe]-T.maxYArr[fe])),X.push(0);else T.yRange.push(Math.abs(T.minY-T.maxY));T.xRange=Math.abs(T.maxX-T.minX),T.zRange=Math.abs(T.maxZ-T.minZ);for(var ye=0;ye<T.yRange.length;ye++)D.push(T.yRange[ye]/T.gridHeight);if(p=T.xRange/T.gridWidth,m=T.yRange/T.gridWidth,S=T.xRange/T.gridHeight,(V=T.zRange/T.gridHeight*16)||(V=1),T.minY!==Number.MIN_VALUE&&Math.abs(T.minY)!==0&&(T.hasNegs=!0),k.globals.seriesYAxisReverseMap.length>0){var Pe=function(Ke,we){var Te=k.config.yaxis[k.globals.seriesYAxisReverseMap[we]],te=Ke<0?-1:1;return Ke=Math.abs(Ke),Te.logarithmic&&(Ke=A.getBaseLog(Te.logBase,Ke)),-te*Ke/D[we]};if(T.isMultipleYAxis){X=[];for(var Me=0;Me<D.length;Me++)X.push(Pe(T.minYArr[Me],Me))}else(X=[]).push(Pe(T.minY,0)),T.minY!==Number.MIN_VALUE&&Math.abs(T.minY)!==0&&(le=-T.minY/m,ce=T.minX/p)}else(X=[]).push(0),le=0,ce=0;return{yRatio:D,invertedYRatio:m,zRatio:V,xRatio:p,invertedXRatio:S,baseLineInvertedY:le,baseLineY:X,baseLineX:ce}}},{key:"getLogSeries",value:function(m){var p=this,S=this.w;return S.globals.seriesLog=m.map(function(A,k){var T=S.globals.seriesYAxisReverseMap[k];return S.config.yaxis[T]&&S.config.yaxis[T].logarithmic?A.map(function(D){return D===null?null:p.getLogVal(S.config.yaxis[T].logBase,D,k)}):A}),S.globals.invalidLogScale?m:S.globals.seriesLog}},{key:"getBaseLog",value:function(m,p){return Math.log(p)/Math.log(m)}},{key:"getLogVal",value:function(m,p,S){if(p<=0)return 0;var A=this.w,k=A.globals.minYArr[S]===0?-1:this.getBaseLog(m,A.globals.minYArr[S]),T=(A.globals.maxYArr[S]===0?0:this.getBaseLog(m,A.globals.maxYArr[S]))-k;return p<1?p/T:(this.getBaseLog(m,p)-k)/T}},{key:"getLogYRatios",value:function(m){var p=this,S=this.w,A=this.w.globals;return A.yLogRatio=m.slice(),A.logYRange=A.yRange.map(function(k,T){var D=S.globals.seriesYAxisReverseMap[T];if(S.config.yaxis[D]&&p.w.config.yaxis[D].logarithmic){var V,X=-Number.MAX_VALUE,le=Number.MIN_VALUE;return A.seriesLog.forEach(function(ce,fe){ce.forEach(function(ye){S.config.yaxis[fe]&&S.config.yaxis[fe].logarithmic&&(X=Math.max(ye,X),le=Math.min(ye,le))})}),V=Math.pow(A.yRange[T],Math.abs(le-X)/A.yRange[T]),A.yLogRatio[T]=V/A.gridHeight,V}}),A.invalidLogScale?m.slice():A.yLogRatio}},{key:"drawSeriesByGroup",value:function(m,p,S,A){var k=this.w,T=[];return m.series.length>0&&p.forEach(function(D){var V=[],X=[];m.i.forEach(function(le,ce){k.config.series[le].group===D&&(V.push(m.series[ce]),X.push(le))}),V.length>0&&T.push(A.draw(V,S,X))}),T}}],[{key:"checkComboSeries",value:function(m,p){var S=!1,A=0,k=0;return p===void 0&&(p="line"),m.length&&m[0].type!==void 0&&m.forEach(function(T){T.type!=="bar"&&T.type!=="column"&&T.type!=="candlestick"&&T.type!=="boxPlot"||A++,T.type!==void 0&&T.type!==p&&k++}),k>0&&(S=!0),{comboBarCount:A,comboCharts:S}}},{key:"extendArrayProps",value:function(m,p,S){var A,k,T,D,V,X;return(A=p)!==null&&A!==void 0&&A.yaxis&&(p=m.extendYAxis(p,S)),(k=p)!==null&&k!==void 0&&k.annotations&&(p.annotations.yaxis&&(p=m.extendYAxisAnnotations(p)),(T=p)!==null&&T!==void 0&&(D=T.annotations)!==null&&D!==void 0&&D.xaxis&&(p=m.extendXAxisAnnotations(p)),(V=p)!==null&&V!==void 0&&(X=V.annotations)!==null&&X!==void 0&&X.points&&(p=m.extendPointAnnotations(p))),p}}]),ke}(),se=function(){function ke(m){s(this,ke),this.w=m.w,this.annoCtx=m}return o(ke,[{key:"setOrientations",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,S=this.w;if(m.label.orientation==="vertical"){var A=p!==null?p:0,k=S.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(A,"']"));if(k!==null){var T=k.getBoundingClientRect();k.setAttribute("x",parseFloat(k.getAttribute("x"))-T.height+4);var D=m.label.position==="top"?T.width:-T.width;k.setAttribute("y",parseFloat(k.getAttribute("y"))+D);var V=this.annoCtx.graphics.rotateAroundCenter(k),X=V.x,le=V.y;k.setAttribute("transform","rotate(-90 ".concat(X," ").concat(le,")"))}}}},{key:"addBackgroundToAnno",value:function(m,p){var S=this.w;if(!m||!p.label.text||!String(p.label.text).trim())return null;var A=S.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),k=m.getBoundingClientRect(),T=p.label.style.padding,D=T.left,V=T.right,X=T.top,le=T.bottom;if(p.label.orientation==="vertical"){var ce=[D,V,X,le];X=ce[0],le=ce[1],D=ce[2],V=ce[3]}var fe=k.left-A.left-D,ye=k.top-A.top-X,Pe=this.annoCtx.graphics.drawRect(fe-S.globals.barPadForNumericAxis,ye,k.width+D+V,k.height+X+le,p.label.borderRadius,p.label.style.background,1,p.label.borderWidth,p.label.borderColor,0);return p.id&&Pe.node.classList.add(p.id),Pe}},{key:"annotationsBackground",value:function(){var m=this,p=this.w,S=function(A,k,T){var D=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(T,"-annotations .apexcharts-").concat(T,"-annotation-label[rel='").concat(k,"']"));if(D){var V=D.parentNode,X=m.addBackgroundToAnno(D,A);X&&(V.insertBefore(X.node,D),A.label.mouseEnter&&X.node.addEventListener("mouseenter",A.label.mouseEnter.bind(m,A)),A.label.mouseLeave&&X.node.addEventListener("mouseleave",A.label.mouseLeave.bind(m,A)),A.label.click&&X.node.addEventListener("click",A.label.click.bind(m,A)))}};p.config.annotations.xaxis.forEach(function(A,k){return S(A,k,"xaxis")}),p.config.annotations.yaxis.forEach(function(A,k){return S(A,k,"yaxis")}),p.config.annotations.points.forEach(function(A,k){return S(A,k,"point")})}},{key:"getY1Y2",value:function(m,p){var S,A=this.w,k=m==="y1"?p.y:p.y2,T=!1;if(this.annoCtx.invertAxis){var D=A.config.xaxis.convertedCatToNumeric?A.globals.categoryLabels:A.globals.labels,V=D.indexOf(k),X=A.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(V+1,")"));S=X?parseFloat(X.getAttribute("y")):(A.globals.gridHeight/D.length-1)*(V+1)-A.globals.barHeight,p.seriesIndex!==void 0&&A.globals.barHeight&&(S-=A.globals.barHeight/2*(A.globals.series.length-1)-A.globals.barHeight*p.seriesIndex)}else{var le,ce=A.globals.seriesYAxisMap[p.yAxisIndex][0],fe=A.config.yaxis[p.yAxisIndex].logarithmic?new Q(this.annoCtx.ctx).getLogVal(A.config.yaxis[p.yAxisIndex].logBase,k,ce)/A.globals.yLogRatio[ce]:(k-A.globals.minYArr[ce])/(A.globals.yRange[ce]/A.globals.gridHeight);S=A.globals.gridHeight-Math.min(Math.max(fe,0),A.globals.gridHeight),T=fe>A.globals.gridHeight||fe<0,!p.marker||p.y!==void 0&&p.y!==null||(S=0),(le=A.config.yaxis[p.yAxisIndex])!==null&&le!==void 0&&le.reversed&&(S=fe)}return typeof k=="string"&&k.includes("px")&&(S=parseFloat(k)),{yP:S,clipped:T}}},{key:"getX1X2",value:function(m,p){var S=this.w,A=m==="x1"?p.x:p.x2,k=this.annoCtx.invertAxis?S.globals.minY:S.globals.minX,T=this.annoCtx.invertAxis?S.globals.maxY:S.globals.maxX,D=this.annoCtx.invertAxis?S.globals.yRange[0]:S.globals.xRange,V=!1,X=this.annoCtx.inversedReversedAxis?(T-A)/(D/S.globals.gridWidth):(A-k)/(D/S.globals.gridWidth);return S.config.xaxis.type!=="category"&&!S.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||S.globals.dataFormatXNumeric||S.config.chart.sparkline.enabled||(X=this.getStringX(A)),typeof A=="string"&&A.includes("px")&&(X=parseFloat(A)),A==null&&p.marker&&(X=S.globals.gridWidth),p.seriesIndex!==void 0&&S.globals.barWidth&&!this.annoCtx.invertAxis&&(X-=S.globals.barWidth/2*(S.globals.series.length-1)-S.globals.barWidth*p.seriesIndex),X>S.globals.gridWidth?(X=S.globals.gridWidth,V=!0):X<0&&(X=0,V=!0),{x:X,clipped:V}}},{key:"getStringX",value:function(m){var p=this.w,S=m;p.config.xaxis.convertedCatToNumeric&&p.globals.categoryLabels.length&&(m=p.globals.categoryLabels.indexOf(m)+1);var A=p.globals.labels.map(function(T){return Array.isArray(T)?T.join(" "):T}).indexOf(m),k=p.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(A+1,")"));return k&&(S=parseFloat(k.getAttribute("x"))),S}}]),ke}(),ee=function(){function ke(m){s(this,ke),this.w=m.w,this.annoCtx=m,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new se(this.annoCtx)}return o(ke,[{key:"addXaxisAnnotation",value:function(m,p,S){var A,k=this.w,T=this.helpers.getX1X2("x1",m),D=T.x,V=T.clipped,X=!0,le=m.label.text,ce=m.strokeDashArray;if(F.isNumber(D)){if(m.x2===null||m.x2===void 0){if(!V){var fe=this.annoCtx.graphics.drawLine(D+m.offsetX,0+m.offsetY,D+m.offsetX,k.globals.gridHeight+m.offsetY,m.borderColor,ce,m.borderWidth);p.appendChild(fe.node),m.id&&fe.node.classList.add(m.id)}}else{var ye=this.helpers.getX1X2("x2",m);if(A=ye.x,X=ye.clipped,!V||!X){if(A<D){var Pe=D;D=A,A=Pe}var Me=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,ce);Me.node.classList.add("apexcharts-annotation-rect"),Me.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Me.node),m.id&&Me.node.classList.add(m.id)}}if(!V||!X){var Ke=this.annoCtx.graphics.getTextRects(le,parseFloat(m.label.style.fontSize)),we=m.label.position==="top"?4:m.label.position==="center"?k.globals.gridHeight/2+(m.label.orientation==="vertical"?Ke.width/2:0):k.globals.gridHeight,Te=this.annoCtx.graphics.drawText({x:D+m.label.offsetX,y:we+m.label.offsetY-(m.label.orientation==="vertical"?m.label.position==="top"?Ke.width/2-12:-Ke.width/2:0),text:le,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:"")});Te.attr({rel:S}),p.appendChild(Te.node),this.annoCtx.helpers.setOrientations(m,S)}}}},{key:"drawXAxisAnnotations",value:function(){var m=this,p=this.w,S=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return p.config.annotations.xaxis.map(function(A,k){m.addXaxisAnnotation(A,S.node,k)}),S}}]),ke}(),K=function(){function ke(m){s(this,ke),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(ke,[{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 S=Date.parse(m.replace(/-/g,"/").replace(/[a-z]+/gi," "));return S=this.getTimeStamp(S)}},{key:"parseDateWithTimezone",value:function(m){return Date.parse(m.replace(/-/g,"/").replace(/[a-z]+/gi," "))}},{key:"formatDate",value:function(m,p){var S=this.w.globals.locale,A=this.w.config.xaxis.labels.datetimeUTC,k=["\0"].concat(N(S.months)),T=[""].concat(N(S.shortMonths)),D=[""].concat(N(S.days)),V=[""].concat(N(S.shortDays));function X(at,ut){var yt=at+"";for(ut=ut||2;yt.length<ut;)yt="0"+yt;return yt}var le=A?m.getUTCFullYear():m.getFullYear();p=(p=(p=p.replace(/(^|[^\\])yyyy+/g,"$1"+le)).replace(/(^|[^\\])yy/g,"$1"+le.toString().substr(2,2))).replace(/(^|[^\\])y/g,"$1"+le);var ce=(A?m.getUTCMonth():m.getMonth())+1;p=(p=(p=(p=p.replace(/(^|[^\\])MMMM+/g,"$1"+k[0])).replace(/(^|[^\\])MMM/g,"$1"+T[0])).replace(/(^|[^\\])MM/g,"$1"+X(ce))).replace(/(^|[^\\])M/g,"$1"+ce);var fe=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"+X(fe))).replace(/(^|[^\\])d/g,"$1"+fe);var ye=A?m.getUTCHours():m.getHours(),Pe=ye>12?ye-12:ye===0?12:ye;p=(p=(p=(p=p.replace(/(^|[^\\])HH+/g,"$1"+X(ye))).replace(/(^|[^\\])H/g,"$1"+ye)).replace(/(^|[^\\])hh+/g,"$1"+X(Pe))).replace(/(^|[^\\])h/g,"$1"+Pe);var Me=A?m.getUTCMinutes():m.getMinutes();p=(p=p.replace(/(^|[^\\])mm+/g,"$1"+X(Me))).replace(/(^|[^\\])m/g,"$1"+Me);var Ke=A?m.getUTCSeconds():m.getSeconds();p=(p=p.replace(/(^|[^\\])ss+/g,"$1"+X(Ke))).replace(/(^|[^\\])s/g,"$1"+Ke);var we=A?m.getUTCMilliseconds():m.getMilliseconds();p=p.replace(/(^|[^\\])fff+/g,"$1"+X(we,3)),we=Math.round(we/10),p=p.replace(/(^|[^\\])ff/g,"$1"+X(we)),we=Math.round(we/10);var Te=ye<12?"AM":"PM";p=(p=(p=p.replace(/(^|[^\\])f/g,"$1"+we)).replace(/(^|[^\\])TT+/g,"$1"+Te)).replace(/(^|[^\\])T/g,"$1"+Te.charAt(0));var te=Te.toLowerCase();p=(p=p.replace(/(^|[^\\])tt+/g,"$1"+te)).replace(/(^|[^\\])t/g,"$1"+te.charAt(0));var ve=-m.getTimezoneOffset(),Be=A||!ve?"Z":ve>0?"+":"-";if(!A){var Ue=(ve=Math.abs(ve))%60;Be+=X(Math.floor(ve/60))+":"+X(Ue)}p=p.replace(/(^|[^\\])K/g,"$1"+Be);var Fe=(A?m.getUTCDay():m.getDay())+1;return p=(p=(p=(p=(p=p.replace(new RegExp(D[0],"g"),D[Fe])).replace(new RegExp(V[0],"g"),V[Fe])).replace(new RegExp(k[0],"g"),k[ce])).replace(new RegExp(T[0],"g"),T[ce])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(m,p,S){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),T=this.getDate(p),D=this.formatDate(k,"yyyy MM dd HH mm ss fff").split(" "),V=this.formatDate(T,"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,S){return this.determineDaysOfMonths(m,p)-S}},{key:"determineDaysOfYear",value:function(m){var p=365;return this.isLeapYear(m)&&(p=366),p}},{key:"determineRemainingDaysOfYear",value:function(m,p,S){var A=this.daysCntOfYear[p]+S;return p>1&&this.isLeapYear()&&A++,A}},{key:"determineDaysOfMonths",value:function(m,p){var S=30;switch(m=F.monthMod(m),!0){case this.months30.indexOf(m)>-1:m===2&&(S=this.isLeapYear(p)?29:28);break;case this.months31.indexOf(m)>-1:default:S=31}return S}}]),ke}(),re=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.tooltipKeyFormat="dd MMM"}return o(ke,[{key:"xLabelFormat",value:function(m,p,S,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 T=new K(this.ctx);return T.formatDate(T.getDate(p),k.config.tooltip.x.format)}return m(p,S,A)}},{key:"defaultGeneralFormatter",value:function(m){return Array.isArray(m)?m.map(function(p){return p}):m}},{key:"defaultYFormatter",value:function(m,p,S){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(S){return m.defaultGeneralFormatter(S)},p.globals.ttKeyFormatter=function(S){return m.defaultGeneralFormatter(S)},p.globals.ttZFormatter=function(S){return S},p.globals.legendFormatter=function(S){return m.defaultGeneralFormatter(S)},p.config.xaxis.labels.formatter!==void 0?p.globals.xLabelFormatter=p.config.xaxis.labels.formatter:p.globals.xLabelFormatter=function(S){if(F.isNumber(S)){if(!p.config.xaxis.convertedCatToNumeric&&p.config.xaxis.type==="numeric"){if(F.isNumber(p.config.xaxis.decimalsInFloat))return S.toFixed(p.config.xaxis.decimalsInFloat);var A=p.globals.maxX-p.globals.minX;return A>0&&A<100?S.toFixed(1):S.toFixed(0)}return p.globals.isBarHorizontal&&p.globals.maxY-p.globals.minYArr<4?S.toFixed(1):S.toFixed(0)}return S},typeof p.config.tooltip.x.formatter=="function"?p.globals.ttKeyFormatter=p.config.tooltip.x.formatter:p.globals.ttKeyFormatter=p.globals.xLabelFormatter,typeof p.config.xaxis.tooltip.formatter=="function"&&(p.globals.xaxisTooltipFormatter=p.config.xaxis.tooltip.formatter),(Array.isArray(p.config.tooltip.y)||p.config.tooltip.y.formatter!==void 0)&&(p.globals.ttVal=p.config.tooltip.y),p.config.tooltip.z.formatter!==void 0&&(p.globals.ttZFormatter=p.config.tooltip.z.formatter),p.config.legend.formatter!==void 0&&(p.globals.legendFormatter=p.config.legend.formatter),p.config.yaxis.forEach(function(S,A){S.labels.formatter!==void 0?p.globals.yLabelFormatters[A]=S.labels.formatter:p.globals.yLabelFormatters[A]=function(k){return p.globals.xyCharts?Array.isArray(k)?k.map(function(T){return m.defaultYFormatter(T,S,A)}):m.defaultYFormatter(k,S,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(S,A){return S.length>A.length?S:A},0);m.globals.yAxisScale[0].niceMax=p,m.globals.yAxisScale[0].niceMin=p}}}]),ke}(),de=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"getLabel",value:function(m,p,S,A){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],T=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"12px",D=!(arguments.length>6&&arguments[6]!==void 0)||arguments[6],V=this.w,X=m[A]===void 0?"":m[A],le=X,ce=V.globals.xLabelFormatter,fe=V.config.xaxis.labels.formatter,ye=!1,Pe=new re(this.ctx),Me=X;D&&(le=Pe.xLabelFormat(ce,X,Me,{i:A,dateFormatter:new K(this.ctx).formatDate,w:V}),fe!==void 0&&(le=fe(X,m[A],{i:A,dateFormatter:new K(this.ctx).formatDate,w:V})));var Ke,we;p.length>0?(Ke=p[A].unit,we=null,p.forEach(function(Be){Be.unit==="month"?we="year":Be.unit==="day"?we="month":Be.unit==="hour"?we="day":Be.unit==="minute"&&(we="hour")}),ye=we===Ke,S=p[A].position,le=p[A].value):V.config.xaxis.type==="datetime"&&fe===void 0&&(le=""),le===void 0&&(le=""),le=Array.isArray(le)?le:le.toString();var Te=new z(this.ctx),te={};te=V.globals.rotateXLabels&&D?Te.getTextRects(le,parseInt(T,10),null,"rotate(".concat(V.config.xaxis.labels.rotate," 0 0)"),!1):Te.getTextRects(le,parseInt(T,10));var ve=!V.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(le)&&(String(le)==="NaN"||k.indexOf(le)>=0&&ve)&&(le=""),{x:S,text:le,textRect:te,isBold:ye}}},{key:"checkLabelBasedOnTickamount",value:function(m,p,S){var A=this.w,k=A.config.xaxis.tickAmount;return k==="dataPoints"&&(k=Math.round(A.globals.gridWidth/120)),k>S||m%Math.round(S/(k+1))==0||(p.text=""),p}},{key:"checkForOverflowingLabels",value:function(m,p,S,A,k){var T=this.w;if(m===0&&T.globals.skipFirstTimelinelabel&&(p.text=""),m===S-1&&T.globals.skipLastTimelinelabel&&(p.text=""),T.config.xaxis.labels.hideOverlappingLabels&&A.length>0){var D=k[k.length-1];p.x<D.textRect.width/(T.globals.rotateXLabels?Math.abs(T.config.xaxis.labels.rotate)/12:1.01)+D.x&&(p.text="")}return p}},{key:"checkForReversedLabels",value:function(m,p){var S=this.w;return S.config.yaxis[m]&&S.config.yaxis[m].reversed&&p.reverse(),p}},{key:"yAxisAllSeriesCollapsed",value:function(m){var p=this.w.globals;return!p.seriesYAxisMap[m].some(function(S){return p.collapsedSeriesIndices.indexOf(S)===-1})}},{key:"translateYAxisIndex",value:function(m){var p=this.w,S=p.globals,A=p.config.yaxis;return S.series.length>A.length||A.some(function(k){return Array.isArray(k.seriesName)})?m:S.seriesYAxisReverseMap[m]}},{key:"isYAxisHidden",value:function(m){var p=this.w,S=p.config.yaxis[m];if(!S.show||this.yAxisAllSeriesCollapsed(m))return!0;if(!S.showForNullSeries){var A=p.globals.seriesYAxisMap[m],k=new Q(this.ctx);return A.every(function(T){return k.isSeriesNull(T)})}return!1}},{key:"getYAxisForeColor",value:function(m,p){var S=this.w;return Array.isArray(m)&&S.globals.yAxisScale[p]&&this.ctx.theme.pushExtraColors(m,S.globals.yAxisScale[p].result.length,!1),m}},{key:"drawYAxisTicks",value:function(m,p,S,A,k,T,D){var V=this.w,X=new z(this.ctx),le=V.globals.translateY+V.config.yaxis[k].labels.offsetY;if(V.globals.isBarHorizontal?le=0:V.config.chart.type==="heatmap"&&(le+=T/2),A.show&&p>0){V.config.yaxis[k].opposite===!0&&(m+=A.width);for(var ce=p;ce>=0;ce--){var fe=X.drawLine(m+S.offsetX-A.width+A.offsetX,le+A.offsetY,m+S.offsetX+A.offsetX,le+A.offsetY,A.color);D.add(fe),le+=T}}}}]),ke}(),G=function(){function ke(m){s(this,ke),this.w=m.w,this.annoCtx=m,this.helpers=new se(this.annoCtx),this.axesUtils=new de(this.annoCtx)}return o(ke,[{key:"addYaxisAnnotation",value:function(m,p,S){var A,k=this.w,T=m.strokeDashArray,D=this.helpers.getY1Y2("y1",m),V=D.yP,X=D.clipped,le=!0,ce=!1,fe=m.label.text;if(m.y2===null||m.y2===void 0){if(!X){ce=!0;var ye=this.annoCtx.graphics.drawLine(0+m.offsetX,V+m.offsetY,this._getYAxisAnnotationWidth(m),V+m.offsetY,m.borderColor,T,m.borderWidth);p.appendChild(ye.node),m.id&&ye.node.classList.add(m.id)}}else{if(A=(D=this.helpers.getY1Y2("y2",m)).yP,le=D.clipped,A>V){var Pe=V;V=A,A=Pe}if(!X||!le){ce=!0;var Me=this.annoCtx.graphics.drawRect(0+m.offsetX,A+m.offsetY,this._getYAxisAnnotationWidth(m),V-A,0,m.fillColor,m.opacity,1,m.borderColor,T);Me.node.classList.add("apexcharts-annotation-rect"),Me.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Me.node),m.id&&Me.node.classList.add(m.id)}}if(ce){var Ke=m.label.position==="right"?k.globals.gridWidth:m.label.position==="center"?k.globals.gridWidth/2:0,we=this.annoCtx.graphics.drawText({x:Ke+m.label.offsetX,y:(A??V)+m.label.offsetY-3,text:fe,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:"")});we.attr({rel:S}),p.appendChild(we.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,S=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,S.node,k)}),S}}]),ke}(),ie=function(){function ke(m){s(this,ke),this.w=m.w,this.annoCtx=m,this.helpers=new se(this.annoCtx)}return o(ke,[{key:"addPointAnnotation",value:function(m,p,S){if(!(this.w.globals.collapsedSeriesIndices.indexOf(m.seriesIndex)>-1)){var A=this.helpers.getX1X2("x1",m),k=A.x,T=A.clipped,D=(A=this.helpers.getY1Y2("y1",m)).yP,V=A.clipped;if(F.isNumber(k)&&!V&&!T){var X={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:"")},le=this.annoCtx.graphics.drawMarker(k+m.marker.offsetX,D+m.marker.offsetY,X);p.appendChild(le.node);var ce=m.label.text?m.label.text:"",fe=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: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-point-annotation-label ".concat(m.label.style.cssClass," ").concat(m.id?m.id:"")});if(fe.attr({rel:S}),p.appendChild(fe.node),m.customSVG.SVG){var ye=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+m.customSVG.cssClass});ye.attr({transform:"translate(".concat(k+m.customSVG.offsetX,", ").concat(D+m.customSVG.offsetY,")")}),ye.node.innerHTML=m.customSVG.SVG,p.appendChild(ye.node)}if(m.image.path){var Pe=m.image.width?m.image.width:20,Me=m.image.height?m.image.height:20;le=this.annoCtx.addImage({x:k+m.image.offsetX-Pe/2,y:D+m.image.offsetY-Me/2,width:Pe,height:Me,path:m.image.path,appendTo:".apexcharts-point-annotations"})}m.mouseEnter&&le.node.addEventListener("mouseenter",m.mouseEnter.bind(this,m)),m.mouseLeave&&le.node.addEventListener("mouseleave",m.mouseLeave.bind(this,m)),m.click&&le.node.addEventListener("click",m.click.bind(this,m))}}}},{key:"drawPointAnnotations",value:function(){var m=this,p=this.w,S=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return p.config.annotations.points.map(function(A,k){m.addPointAnnotation(A,S.node,k)}),S}}]),ke}(),ae={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},q=function(){function ke(){s(this,ke),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(ke,[{key:"init",value:function(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,easing:"easeinout",speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"",locales:[ae],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.35},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{line:{isSlopeChart:!1},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(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,S){return p+S},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,S){return p+S},0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(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}}}}}]),ke}(),W=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.graphics=new z(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new se(this),this.xAxisAnnotations=new ee(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(ke,[{key:"drawAxesAnnotations",value:function(){var m=this.w;if(m.globals.axisCharts&&m.globals.dataPoints){for(var p=this.yAxisAnnotations.drawYAxisAnnotations(),S=this.xAxisAnnotations.drawXAxisAnnotations(),A=this.pointsAnnotations.drawPointAnnotations(),k=m.config.chart.animations.enabled,T=[p,S,A],D=[S.node,p.node,A.node],V=0;V<3;V++)m.globals.dom.elGraphical.add(T[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,S){m.addImage(p,S)})}},{key:"drawTextAnnos",value:function(){var m=this;this.w.config.annotations.texts.map(function(p,S){m.addText(p,S)})}},{key:"addXaxisAnnotation",value:function(m,p,S){this.xAxisAnnotations.addXaxisAnnotation(m,p,S)}},{key:"addYaxisAnnotation",value:function(m,p,S){this.yAxisAnnotations.addYaxisAnnotation(m,p,S)}},{key:"addPointAnnotation",value:function(m,p,S){this.pointsAnnotations.addPointAnnotation(m,p,S)}},{key:"addText",value:function(m,p){var S=m.x,A=m.y,k=m.text,T=m.textAnchor,D=m.foreColor,V=m.fontSize,X=m.fontFamily,le=m.fontWeight,ce=m.cssClass,fe=m.backgroundColor,ye=m.borderWidth,Pe=m.strokeDashArray,Me=m.borderRadius,Ke=m.borderColor,we=m.appendTo,Te=we===void 0?".apexcharts-svg":we,te=m.paddingLeft,ve=te===void 0?4:te,Be=m.paddingRight,Ue=Be===void 0?4:Be,Fe=m.paddingBottom,at=Fe===void 0?2:Fe,ut=m.paddingTop,yt=ut===void 0?2:ut,Lt=this.w,Gt=this.graphics.drawText({x:S,y:A,text:k,textAnchor:T||"start",fontSize:V||"12px",fontWeight:le||"regular",fontFamily:X||Lt.config.chart.fontFamily,foreColor:D||Lt.config.chart.foreColor,cssClass:ce}),an=Lt.globals.dom.baseEl.querySelector(Te);an&&an.appendChild(Gt.node);var et=Gt.bbox();if(k){var Pt=this.graphics.drawRect(et.x-ve,et.y-yt,et.width+ve+Ue,et.height+at+yt,Me,fe||"transparent",1,ye,Ke,Pe);an.insertBefore(Pt.node,Gt.node)}}},{key:"addImage",value:function(m,p){var S=this.w,A=m.path,k=m.x,T=k===void 0?0:k,D=m.y,V=D===void 0?0:D,X=m.width,le=X===void 0?20:X,ce=m.height,fe=ce===void 0?20:ce,ye=m.appendTo,Pe=ye===void 0?".apexcharts-svg":ye,Me=S.globals.dom.Paper.image(A);Me.size(le,fe).move(T,V);var Ke=S.globals.dom.baseEl.querySelector(Pe);return Ke&&Ke.appendChild(Me.node),Me}},{key:"addXaxisAnnotationExternal",value:function(m,p,S){return this.addAnnotationExternal({params:m,pushToMemory:p,context:S,type:"xaxis",contextMethod:S.addXaxisAnnotation}),S}},{key:"addYaxisAnnotationExternal",value:function(m,p,S){return this.addAnnotationExternal({params:m,pushToMemory:p,context:S,type:"yaxis",contextMethod:S.addYaxisAnnotation}),S}},{key:"addPointAnnotationExternal",value:function(m,p,S){return this.invertAxis===void 0&&(this.invertAxis=S.w.globals.isBarHorizontal),this.addAnnotationExternal({params:m,pushToMemory:p,context:S,type:"point",contextMethod:S.addPointAnnotation}),S}},{key:"addAnnotationExternal",value:function(m){var p=m.params,S=m.pushToMemory,A=m.context,k=m.type,T=m.contextMethod,D=A,V=D.w,X=V.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations")),le=X.childNodes.length+1,ce=new q,fe=Object.assign({},k==="xaxis"?ce.xAxisAnnotation:k==="yaxis"?ce.yAxisAnnotation:ce.pointAnnotation),ye=F.extend(fe,p);switch(k){case"xaxis":this.addXaxisAnnotation(ye,X,le);break;case"yaxis":this.addYaxisAnnotation(ye,X,le);break;case"point":this.addPointAnnotation(ye,X,le)}var Pe=V.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations .apexcharts-").concat(k,"-annotation-label[rel='").concat(le,"']")),Me=this.helpers.addBackgroundToAnno(Pe,ye);return Me&&X.insertBefore(Me.node,Pe),S&&V.globals.memory.methodsToExec.push({context:D,id:ye.id?ye.id:F.randomId(),method:T,label:"addAnnotation",params:p}),A}},{key:"clearAnnotations",value:function(m){for(var p=m.w,S=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);S=F.listToArray(S),Array.prototype.forEach.call(S,function(k){for(;k.firstChild;)k.removeChild(k.firstChild)})}},{key:"removeAnnotation",value:function(m,p){var S=m.w,A=S.globals.dom.baseEl.querySelectorAll(".".concat(p));A&&(S.globals.memory.methodsToExec.map(function(k,T){k.id===p&&S.globals.memory.methodsToExec.splice(T,1)}),Array.prototype.forEach.call(A,function(k){k.parentElement.removeChild(k)}))}}]),ke}(),ne=function(ke){var m,p=ke.isTimeline,S=ke.ctx,A=ke.seriesIndex,k=ke.dataPointIndex,T=ke.y1,D=ke.y2,V=ke.w,X=V.globals.seriesRangeStart[A][k],le=V.globals.seriesRangeEnd[A][k],ce=V.globals.labels[k],fe=V.config.series[A].name?V.config.series[A].name:"",ye=V.globals.ttKeyFormatter,Pe=V.config.tooltip.y.title.formatter,Me={w:V,seriesIndex:A,dataPointIndex:k,start:X,end:le};typeof Pe=="function"&&(fe=Pe(fe,Me)),(m=V.config.series[A].data[k])!==null&&m!==void 0&&m.x&&(ce=V.config.series[A].data[k].x),p||V.config.xaxis.type==="datetime"&&(ce=new re(S).xLabelFormat(V.globals.ttKeyFormatter,ce,ce,{i:void 0,dateFormatter:new K(S).formatDate,w:V})),typeof ye=="function"&&(ce=ye(ce,Me)),Number.isFinite(T)&&Number.isFinite(D)&&(X=T,le=D);var Ke="",we="",Te=V.globals.colors[A];if(V.config.tooltip.x.formatter===void 0)if(V.config.xaxis.type==="datetime"){var te=new K(S);Ke=te.formatDate(te.getDate(X),V.config.tooltip.x.format),we=te.formatDate(te.getDate(le),V.config.tooltip.x.format)}else Ke=X,we=le;else Ke=V.config.tooltip.x.formatter(X),we=V.config.tooltip.x.formatter(le);return{start:X,end:le,startVal:Ke,endVal:we,ylabel:ce,color:Te,seriesName:fe}},oe=function(ke){var m=ke.color,p=ke.seriesName,S=ke.ylabel,A=ke.start,k=ke.end,T=ke.seriesIndex,D=ke.dataPointIndex,V=ke.ctx.tooltip.tooltipLabels.getFormatters(T);A=V.yLbFormatter(A),k=V.yLbFormatter(k);var X=V.yLbFormatter(ke.w.globals.series[T][D]),le=`<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">'+S+": </span> "+(ke.w.globals.comboCharts?ke.w.config.series[T].type==="rangeArea"||ke.w.config.series[T].type==="rangeBar"?le:"<span>".concat(X,"</span>"):le)+" </div></div>"},he=function(){function ke(m){s(this,ke),this.opts=m}return o(ke,[{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 S=p.w.config.series[p.seriesIndex].name;return m!==null?S+": "+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 S=p.seriesIndex,A=p.dataPointIndex,k=p.w;return m._getBoxTooltip(k,S,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 S=p.seriesIndex,A=p.dataPointIndex,k=p.w;return m._getBoxTooltip(k,S,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 S=p.seriesIndex,A=p.dataPointIndex,k=p.w,T=function(){var D=k.globals.seriesRangeStart[S][A];return k.globals.seriesRangeEnd[S][A]-D};return k.globals.comboCharts?k.config.series[S].type==="rangeBar"||k.config.series[S].type==="rangeArea"?T():m:T()},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 S=ne(y(y({},p),{},{isTimeline:!0})),A=S.color,k=S.seriesName,T=S.ylabel,D=S.startVal,V=S.endVal;return oe(y(y({},p),{},{color:A,seriesName:k,ylabel:T,start:D,end:V}))}(m):function(p){var S=ne(p),A=S.color,k=S.seriesName,T=S.ylabel,D=S.start,V=S.end;return oe(y(y({},p),{},{color:A,seriesName:k,ylabel:T,start:D,end:V}))}(m)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(m){var p,S;return(p=m.plotOptions.bar)!==null&&p!==void 0&&p.barHeight||(m.plotOptions.bar.barHeight=2),(S=m.plotOptions.bar)!==null&&S!==void 0&&S.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 S=ne(p),A=S.color,k=S.seriesName,T=S.ylabel,D=S.start,V=S.end;return oe(y(y({},p),{},{color:A,seriesName:k,ylabel:T,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(S,A){m.yaxis[A].min=0,m.yaxis[A].max=100}),m.chart.type==="bar"&&(m.dataLabels.formatter=p||function(S){return typeof S=="number"&&S?S.toFixed(0)+"%":S}),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,S){m.xaxis.type="numeric",m.xaxis.labels=m.xaxis.labels||{},m.xaxis.labels.formatter=m.xaxis.labels.formatter||function(T){return F.isNumber(T)?Math.floor(T):T};var A=m.xaxis.labels.formatter,k=m.xaxis.categories&&m.xaxis.categories.length?m.xaxis.categories:m.labels;return S&&S.length&&(k=S.map(function(T){return Array.isArray(T)?T:String(T)})),k&&k.length&&(m.xaxis.labels.formatter=function(T){return F.isNumber(T)?A(k[Math.floor(T)-1]):A(T)}),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,S,A,k){var T=m.globals.seriesCandleO[p][S],D=m.globals.seriesCandleH[p][S],V=m.globals.seriesCandleM[p][S],X=m.globals.seriesCandleL[p][S],le=m.globals.seriesCandleC[p][S];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][S],`</strong>
</div>`):'<div class="apexcharts-tooltip-box apexcharts-tooltip-'.concat(m.config.chart.type,'">')+"<div>".concat(A[0],': <span class="value">')+T+"</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">')+X+"</span></div>"+"<div>".concat(A[4],': <span class="value">')+le+"</span></div></div>"}}]),ke}(),_e=function(){function ke(m){s(this,ke),this.opts=m}return o(ke,[{key:"init",value:function(m){var p=m.responsiveOverride,S=this.opts,A=new q,k=new he(S);this.chartType=S.chart.type,S=this.extendYAxis(S),S=this.extendAnnotations(S);var T=A.init(),D={};if(S&&P(S)==="object"){var V,X,le,ce,fe,ye,Pe,Me,Ke,we,Te={};Te=["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(S.chart.type)!==-1?k[S.chart.type]():k.line(),(V=S.plotOptions)!==null&&V!==void 0&&(X=V.bar)!==null&&X!==void 0&&X.isFunnel&&(Te=k.funnel()),S.chart.stacked&&S.chart.type==="bar"&&(Te=k.stackedBars()),(le=S.chart.brush)!==null&&le!==void 0&&le.enabled&&(Te=k.brush(Te)),(ce=S.plotOptions)!==null&&ce!==void 0&&(fe=ce.line)!==null&&fe!==void 0&&fe.isSlopeChart&&(Te=k.slope()),S.chart.stacked&&S.chart.stackType==="100%"&&(S=k.stacked100(S)),(ye=S.plotOptions)!==null&&ye!==void 0&&(Pe=ye.bar)!==null&&Pe!==void 0&&Pe.isDumbbell&&(S=k.dumbbell(S)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(S),S.xaxis=S.xaxis||window.Apex.xaxis||{},p||(S.xaxis.convertedCatToNumeric=!1),((Me=(S=this.checkForCatToNumericXAxis(this.chartType,Te,S)).chart.sparkline)!==null&&Me!==void 0&&Me.enabled||(Ke=window.Apex.chart)!==null&&Ke!==void 0&&(we=Ke.sparkline)!==null&&we!==void 0&&we.enabled)&&(Te=k.sparkline(Te)),D=F.extend(T,Te)}var te=F.extend(D,window.Apex);return T=F.extend(te,S),T=this.handleUserInputErrors(T)}},{key:"checkForCatToNumericXAxis",value:function(m,p,S){var A,k,T=new he(S),D=(m==="bar"||m==="boxPlot")&&((A=S.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",X=S.xaxis.type!=="datetime"&&S.xaxis.type!=="numeric",le=S.xaxis.tickPlacement?S.xaxis.tickPlacement:p.xaxis&&p.xaxis.tickPlacement;return D||V||!X||le==="between"||(S=T.convertCatToNumeric(S)),S}},{key:"extendYAxis",value:function(m,p){var S=new q;(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(S.yAxis,m.yaxis)]:m.yaxis=F.extendArray(m.yaxis,S.yAxis);var A=!1;m.yaxis.forEach(function(T){T.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(T,D){if(T.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(S.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 q;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 q;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 q;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}}]),ke}(),xe=function(){function ke(){s(this,ke)}return o(ke,[{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}}]),ke}(),Se=function(){function ke(m){s(this,ke),this.opts=m}return o(ke,[{key:"init",value:function(){var m=new _e(this.opts).init({responsiveOverride:!1});return{config:m,globals:new xe().init(m)}}}]),ke}(),ge=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return o(ke,[{key:"clippedImgArea",value:function(m){var p=this.w,S=p.config,A=parseInt(p.globals.gridWidth,10),k=parseInt(p.globals.gridHeight,10),T=A>k?A:k,D=m.image,V=0,X=0;m.width===void 0&&m.height===void 0?S.fill.image.width!==void 0&&S.fill.image.height!==void 0?(V=S.fill.image.width+1,X=S.fill.image.height):(V=T+1,X=T):(V=m.width,X=m.height);var le=document.createElementNS(p.globals.SVGNS,"pattern");z.setAttrs(le,{id:m.patternID,patternUnits:m.patternUnits?m.patternUnits:"userSpaceOnUse",width:V+"px",height:X+"px"});var ce=document.createElementNS(p.globals.SVGNS,"image");le.appendChild(ce),ce.setAttributeNS(window.SVG.xlink,"href",D),z.setAttrs(ce,{x:0,y:0,preserveAspectRatio:"none",width:V+"px",height:X+"px"}),ce.style.opacity=m.opacity,p.globals.dom.elDefs.node.appendChild(le)}},{key:"getSeriesIndex",value:function(m){var p=this.w,S=p.config.chart.type;return(S==="bar"||S==="rangeBar")&&p.config.plotOptions.bar.distributed||S==="heatmap"||S==="treemap"?this.seriesIndex=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 S,A,k,T=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),X=Array.isArray(T.fill.opacity)?T.fill.opacity[this.seriesIndex]:T.fill.opacity;m.color&&(D=m.color),D||(D="#fff",console.warn("undefined color - ApexCharts"));var le=D;if(D.indexOf("rgb")===-1?D.length<9&&(le=F.hexToRgba(D,X)):D.indexOf("rgba")>-1&&(X=F.getOpacityFromRGBA(D)),m.opacity&&(X=m.opacity),V==="pattern"&&(A=this.handlePatternFill({fillConfig:m.fillConfig,patternFill:A,fillColor:D,fillOpacity:X,defaultColor:le})),V==="gradient"&&(k=this.handleGradientFill({fillConfig:m.fillConfig,fillColor:D,fillOpacity:X,i:this.seriesIndex})),V==="image"){var ce=T.fill.image.src,fe=m.patternID?m.patternID:"",ye="pattern".concat(p.globals.cuid).concat(m.seriesNumber+1).concat(fe);this.patternIDs.indexOf(ye)===-1&&(this.clippedImgArea({opacity:X,image:Array.isArray(ce)?m.seriesNumber<ce.length?ce[m.seriesNumber]:ce[0]:ce,width:m.width?m.width:void 0,height:m.height?m.height:void 0,patternUnits:m.patternUnits,patternID:ye}),this.patternIDs.push(ye)),S="url(#".concat(ye,")")}else S=V==="gradient"?k:V==="pattern"?A:le;return m.solid&&(S=le),S}},{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,S=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),S.fillColors!==void 0&&(A=[],Array.isArray(S.fillColors)?A=S.fillColors.slice():A.push(S.fillColors)),A}},{key:"handlePatternFill",value:function(m){var p=m.fillConfig,S=m.patternFill,A=m.fillColor,k=m.fillOpacity,T=m.defaultColor,D=this.w.config.fill;p&&(D=p);var V=this.opts,X=new z(this.ctx),le=Array.isArray(D.pattern.strokeWidth)?D.pattern.strokeWidth[this.seriesIndex]:D.pattern.strokeWidth,ce=A;return Array.isArray(D.pattern.style)?S=D.pattern.style[V.seriesNumber]!==void 0?X.drawPattern(D.pattern.style[V.seriesNumber],D.pattern.width,D.pattern.height,ce,le,k):T:S=X.drawPattern(D.pattern.style,D.pattern.width,D.pattern.height,ce,le,k),S}},{key:"handleGradientFill",value:function(m){var p=m.fillColor,S=m.fillOpacity,A=m.fillConfig,k=m.i,T=this.w.config.fill;A&&(T=y(y({},T),A));var D,V=this.opts,X=new z(this.ctx),le=new F,ce=T.gradient.type,fe=p,ye=T.gradient.opacityFrom===void 0?S:Array.isArray(T.gradient.opacityFrom)?T.gradient.opacityFrom[k]:T.gradient.opacityFrom;fe.indexOf("rgba")>-1&&(ye=F.getOpacityFromRGBA(fe));var Pe=T.gradient.opacityTo===void 0?S:Array.isArray(T.gradient.opacityTo)?T.gradient.opacityTo[k]:T.gradient.opacityTo;if(T.gradient.gradientToColors===void 0||T.gradient.gradientToColors.length===0)D=T.gradient.shade==="dark"?le.shadeColor(-1*parseFloat(T.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p):le.shadeColor(parseFloat(T.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p);else if(T.gradient.gradientToColors[V.seriesNumber]){var Me=T.gradient.gradientToColors[V.seriesNumber];D=Me,Me.indexOf("rgba")>-1&&(Pe=F.getOpacityFromRGBA(Me))}else D=p;if(T.gradient.gradientFrom&&(fe=T.gradient.gradientFrom),T.gradient.gradientTo&&(D=T.gradient.gradientTo),T.gradient.inverseColors){var Ke=fe;fe=D,D=Ke}return fe.indexOf("rgb")>-1&&(fe=F.rgb2hex(fe)),D.indexOf("rgb")>-1&&(D=F.rgb2hex(D)),X.drawGradient(ce,fe,D,ye,Pe,V.size,T.gradient.stops,T.gradient.colorStops,k)}}]),ke}(),Ce=function(){function ke(m,p){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{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(S){return m.config.markers.size})}},{key:"plotChartMarkers",value:function(m,p,S,A){var k,T=arguments.length>4&&arguments[4]!==void 0&&arguments[4],D=this.w,V=p,X=m,le=null,ce=new z(this.ctx),fe=D.config.markers.discrete&&D.config.markers.discrete.length;if((D.globals.markers.size[p]>0||T||fe)&&(le=ce.group({class:T||fe?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(D.globals.cuid,")")),Array.isArray(X.x))for(var ye=0;ye<X.x.length;ye++){var Pe=S;S===1&&ye===0&&(Pe=0),S===1&&ye===1&&(Pe=1);var Me="apexcharts-marker";if(D.config.chart.type!=="line"&&D.config.chart.type!=="area"||D.globals.comboCharts||D.config.tooltip.intersect||(Me+=" no-pointer-events"),(Array.isArray(D.config.markers.size)?D.globals.markers.size[p]>0:D.config.markers.size>0)||T||fe){F.isNumber(X.y[ye])?Me+=" w".concat(F.randomId()):Me="apexcharts-nullpoint";var Ke=this.getMarkerConfig({cssClass:Me,seriesIndex:p,dataPointIndex:Pe});D.config.series[V].data[Pe]&&(D.config.series[V].data[Pe].fillColor&&(Ke.pointFillColor=D.config.series[V].data[Pe].fillColor),D.config.series[V].data[Pe].strokeColor&&(Ke.pointStrokeColor=D.config.series[V].data[Pe].strokeColor)),A!==void 0&&(Ke.pSize=A),(X.x[ye]<-D.globals.markers.largestSize||X.x[ye]>D.globals.gridWidth+D.globals.markers.largestSize||X.y[ye]<-D.globals.markers.largestSize||X.y[ye]>D.globals.gridHeight+D.globals.markers.largestSize)&&(Ke.pSize=0),(k=ce.drawMarker(X.x[ye],X.y[ye],Ke)).attr("rel",Pe),k.attr("j",Pe),k.attr("index",p),k.node.setAttribute("default-marker-size",Ke.pSize),new L(this.ctx).setSelectionFilter(k,p,Pe),this.addEvents(k),le&&le.add(k)}else D.globals.pointsArray[p]===void 0&&(D.globals.pointsArray[p]=[]),D.globals.pointsArray[p].push([X.x[ye],X.y[ye]])}return le}},{key:"getMarkerConfig",value:function(m){var p=m.cssClass,S=m.seriesIndex,A=m.dataPointIndex,k=A===void 0?null:A,T=m.radius,D=T===void 0?null:T,V=m.size,X=V===void 0?null:V,le=m.strokeWidth,ce=le===void 0?null:le,fe=this.w,ye=this.getMarkerStyle(S),Pe=X===null?fe.globals.markers.size[S]:X,Me=fe.config.markers;return k!==null&&Me.discrete.length&&Me.discrete.map(function(Ke){Ke.seriesIndex===S&&Ke.dataPointIndex===k&&(ye.pointStrokeColor=Ke.strokeColor,ye.pointFillColor=Ke.fillColor,Pe=Ke.size,ye.pointShape=Ke.shape)}),{pSize:D===null?Pe:D,pRadius:D!==null?D:Me.radius,pointStrokeWidth:ce!==null?ce:Array.isArray(Me.strokeWidth)?Me.strokeWidth[S]:Me.strokeWidth,pointStrokeColor:ye.pointStrokeColor,pointFillColor:ye.pointFillColor,shape:ye.pointShape||(Array.isArray(Me.shape)?Me.shape[S]:Me.shape),class:p,pointStrokeOpacity:Array.isArray(Me.strokeOpacity)?Me.strokeOpacity[S]:Me.strokeOpacity,pointStrokeDashArray:Array.isArray(Me.strokeDashArray)?Me.strokeDashArray[S]:Me.strokeDashArray,pointFillOpacity:Array.isArray(Me.fillOpacity)?Me.fillOpacity[S]:Me.fillOpacity,seriesIndex:S}}},{key:"addEvents",value:function(m){var p=this.w,S=new z(this.ctx);m.node.addEventListener("mouseenter",S.pathMouseEnter.bind(this.ctx,m)),m.node.addEventListener("mouseleave",S.pathMouseLeave.bind(this.ctx,m)),m.node.addEventListener("mousedown",S.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",S.pathMouseDown.bind(this.ctx,m),{passive:!0})}},{key:"getMarkerStyle",value:function(m){var p=this.w,S=p.globals.markers.colors,A=p.config.markers.strokeColor||p.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(A)?A[m]:A,pointFillColor:Array.isArray(S)?S[m]:S}}}]),ke}(),je=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.initialAnim=this.w.config.chart.animations.enabled}return o(ke,[{key:"draw",value:function(m,p,S){var A=this.w,k=new z(this.ctx),T=S.realIndex,D=S.pointsPos,V=S.zRatio,X=S.elParent,le=k.group({class:"apexcharts-series-markers apexcharts-series-".concat(A.config.chart.type)});if(le.attr("clip-path","url(#gridRectMarkerMask".concat(A.globals.cuid,")")),Array.isArray(D.x))for(var ce=0;ce<D.x.length;ce++){var fe=p+1,ye=!0;p===0&&ce===0&&(fe=0),p===0&&ce===1&&(fe=1);var Pe=A.globals.markers.size[T];if(V!==1/0){var Me=A.config.plotOptions.bubble;Pe=A.globals.seriesZ[T][fe],Me.zScaling&&(Pe/=V),Me.minBubbleRadius&&Pe<Me.minBubbleRadius&&(Pe=Me.minBubbleRadius),Me.maxBubbleRadius&&Pe>Me.maxBubbleRadius&&(Pe=Me.maxBubbleRadius)}var Ke=D.x[ce],we=D.y[ce];if(Pe=Pe||0,we!==null&&A.globals.series[T][fe]!==void 0||(ye=!1),ye){var Te=this.drawPoint(Ke,we,Pe,T,fe,p);le.add(Te)}X.add(le)}}},{key:"drawPoint",value:function(m,p,S,A,k,T){var D=this.w,V=A,X=new $(this.ctx),le=new L(this.ctx),ce=new ge(this.ctx),fe=new Ce(this.ctx),ye=new z(this.ctx),Pe=fe.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"?S:null}),Me=ce.fillPath({seriesNumber:A,dataPointIndex:k,color:Pe.pointFillColor,patternUnits:"objectBoundingBox",value:D.globals.series[A][T]}),Ke=ye.drawMarker(m,p,Pe);if(D.config.series[V].data[k]&&D.config.series[V].data[k].fillColor&&(Me=D.config.series[V].data[k].fillColor),Ke.attr({fill:Me}),D.config.chart.dropShadow.enabled){var we=D.config.chart.dropShadow;le.dropShadow(Ke,we,A)}if(!this.initialAnim||D.globals.dataChanged||D.globals.resized)D.globals.animationEnded=!0;else{var Te=D.config.chart.animations.speed;X.animateMarker(Ke,Te,D.globals.easing,function(){window.setTimeout(function(){X.animationCompleted(Ke)},100)})}return Ke.attr({rel:k,j:k,index:A,"default-marker-size":Pe.pSize}),le.setSelectionFilter(Ke,A,k),fe.addEvents(Ke),Ke.node.classList.add("apexcharts-marker"),Ke}},{key:"centerTextInBubble",value:function(m){var p=this.w;return{y:m+=parseInt(p.config.dataLabels.style.fontSize,10)/4}}}]),ke}(),Oe=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"dataLabelsCorrection",value:function(m,p,S,A,k,T,D){var V=this.w,X=!1,le=new z(this.ctx).getTextRects(S,D),ce=le.width,fe=le.height;p<0&&(p=0),p>V.globals.gridHeight+fe&&(p=V.globals.gridHeight+fe/2),V.globals.dataLabelsRects[A]===void 0&&(V.globals.dataLabelsRects[A]=[]),V.globals.dataLabelsRects[A].push({x:m,y:p,width:ce,height:fe});var ye=V.globals.dataLabelsRects[A].length-2,Pe=V.globals.lastDrawnDataLabelsIndexes[A]!==void 0?V.globals.lastDrawnDataLabelsIndexes[A][V.globals.lastDrawnDataLabelsIndexes[A].length-1]:0;if(V.globals.dataLabelsRects[A][ye]!==void 0){var Me=V.globals.dataLabelsRects[A][Pe];(m>Me.x+Me.width||p>Me.y+Me.height||p+fe<Me.y||m+ce<Me.x)&&(X=!0)}return(k===0||T)&&(X=!0),{x:m,y:p,textRects:le,drawnextLabel:X}}},{key:"drawDataLabel",value:function(m){var p=this,S=m.type,A=m.pos,k=m.i,T=m.j,D=m.isRangeStart,V=m.strokeWidth,X=V===void 0?2:V,le=this.w,ce=new z(this.ctx),fe=le.config.dataLabels,ye=0,Pe=0,Me=T,Ke=null;if(le.globals.collapsedSeriesIndices.indexOf(k)!==-1||!fe.enabled||!Array.isArray(A.x))return Ke;Ke=ce.group({class:"apexcharts-data-labels"});for(var we=0;we<A.x.length;we++)if(ye=A.x[we]+fe.offsetX,Pe=A.y[we]+fe.offsetY+X,!isNaN(ye)){T===1&&we===0&&(Me=0),T===1&&we===1&&(Me=1);var Te=le.globals.series[k][Me];S==="rangeArea"&&(Te=D?le.globals.seriesRangeStart[k][Me]:le.globals.seriesRangeEnd[k][Me]);var te="",ve=function(Ue){return le.config.dataLabels.formatter(Ue,{ctx:p.ctx,seriesIndex:k,dataPointIndex:Me,w:le})};le.config.chart.type==="bubble"?(te=ve(Te=le.globals.seriesZ[k][Me]),Pe=A.y[we],Pe=new je(this.ctx).centerTextInBubble(Pe,k,Me).y):Te!==void 0&&(te=ve(Te));var Be=le.config.dataLabels.textAnchor;le.globals.isSlopeChart&&(Be=Me===0?"end":Me===le.config.series[k].data.length-1?"start":"middle"),this.plotDataLabelsText({x:ye,y:Pe,text:te,i:k,j:Me,parent:Ke,offsetCorrection:!0,dataLabelsConfig:le.config.dataLabels,textAnchor:Be})}return Ke}},{key:"plotDataLabelsText",value:function(m){var p=this.w,S=new z(this.ctx),A=m.x,k=m.y,T=m.i,D=m.j,V=m.text,X=m.textAnchor,le=m.fontSize,ce=m.parent,fe=m.dataLabelsConfig,ye=m.color,Pe=m.alwaysDrawDataLabel,Me=m.offsetCorrection,Ke=m.className,we=null;if(Array.isArray(p.config.dataLabels.enabledOnSeries)&&p.config.dataLabels.enabledOnSeries.indexOf(T)<0)return we;var Te={x:A,y:k,drawnextLabel:!0,textRects:null};Me&&(Te=this.dataLabelsCorrection(A,k,V,T,D,Pe,parseInt(fe.style.fontSize,10))),p.globals.zoomed||(A=Te.x,k=Te.y),Te.textRects&&(A<-20-Te.textRects.width||A>p.globals.gridWidth+Te.textRects.width+30)&&(V="");var te=p.globals.dataLabels.style.colors[T];((p.config.chart.type==="bar"||p.config.chart.type==="rangeBar")&&p.config.plotOptions.bar.distributed||p.config.dataLabels.distributed)&&(te=p.globals.dataLabels.style.colors[D]),typeof te=="function"&&(te=te({series:p.globals.series,seriesIndex:T,dataPointIndex:D,w:p})),ye&&(te=ye);var ve=fe.offsetX,Be=fe.offsetY;if(p.config.chart.type!=="bar"&&p.config.chart.type!=="rangeBar"||(ve=0,Be=0),p.globals.isSlopeChart&&(D!==0&&(ve=-2*fe.offsetX+5),D!==0&&D!==p.config.series[T].data.length-1&&(ve=0)),Te.drawnextLabel){if((we=S.drawText({width:100,height:parseInt(fe.style.fontSize,10),x:A+ve,y:k+Be,foreColor:te,textAnchor:X||fe.textAnchor,text:V,fontSize:le||fe.style.fontSize,fontFamily:fe.style.fontFamily,fontWeight:fe.style.fontWeight||"normal"})).attr({class:Ke||"apexcharts-datalabel",cx:A,cy:k}),fe.dropShadow.enabled){var Ue=fe.dropShadow;new L(this.ctx).dropShadow(we,Ue)}ce.add(we),p.globals.lastDrawnDataLabelsIndexes[T]===void 0&&(p.globals.lastDrawnDataLabelsIndexes[T]=[]),p.globals.lastDrawnDataLabelsIndexes[T].push(D)}return we}},{key:"addBackgroundToDataLabel",value:function(m,p){var S=this.w,A=S.config.dataLabels.background,k=A.padding,T=A.padding/2,D=p.width,V=p.height,X=new z(this.ctx).drawRect(p.x-k,p.y-T/2,D+2*k,V+T,A.borderRadius,S.config.chart.background!=="transparent"&&S.config.chart.background?S.config.chart.background:"#fff",A.opacity,A.borderWidth,A.borderColor);return A.dropShadow.enabled&&new L(this.ctx).dropShadow(X,A.dropShadow),X}},{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"),S=0;S<p.length;S++){var A=p[S],k=A.getBBox(),T=null;if(k.width&&k.height&&(T=this.addBackgroundToDataLabel(A,k)),T){A.parentNode.insertBefore(T.node,A);var D=A.getAttribute("fill");m.config.chart.animations.enabled&&!m.globals.resized&&!m.globals.dataChanged?T.animate().attr({fill:D}):T.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"),S=m.globals.dom.baseEl.querySelector(".apexcharts-plot-series:last-child"),A=0;A<p.length;A++)S&&S.insertBefore(p[A],S.nextSibling)}}]),ke}(),$e=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.legendInactiveClass="legend-mouseover-inactive"}return o(ke,[{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),S=parseInt(p.getAttribute("data:realIndex"),10);return{isHidden:p.classList.contains("apexcharts-series-collapsed"),realIndex:S}}},{key:"addCollapsedClassToSeries",value:function(m,p){var S=this.w;function A(k){for(var T=0;T<k.length;T++)k[T].index===p&&m.node.classList.add("apexcharts-series-collapsed")}A(S.globals.collapsedSeries),A(S.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],S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],A=this.w,k=F.clone(A.globals.initialSeries);A.globals.previousPaths=[],S?(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,S=0;S<m.length;S++)p.globals.collapsedSeriesIndices.indexOf(S)>-1&&(m[S].data=[]);return m}},{key:"highlightSeries",value:function(m){var p=this.w,S=this.getSeriesByName(m),A=parseInt(S==null?void 0:S.getAttribute("data:realIndex"),10),k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),T=null,D=null,V=null;if(p.globals.axisCharts||p.config.chart.type==="radialBar")if(p.globals.axisCharts){T=p.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(A,"']")),D=p.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(A,"']"));var X=p.globals.seriesYAxisReverseMap[A];V=p.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(X,"']"))}else T=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(A+1,"']"));else T=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(A+1,"'] path"));for(var le=0;le<k.length;le++)k[le].classList.add(this.legendInactiveClass);if(T)p.globals.axisCharts||T.parentNode.classList.remove(this.legendInactiveClass),T.classList.remove(this.legendInactiveClass),D!==null&&D.classList.remove(this.legendInactiveClass),V!==null&&V.classList.remove(this.legendInactiveClass);else for(var ce=0;ce<k.length;ce++)k[ce].classList.remove(this.legendInactiveClass)}},{key:"toggleSeriesOnHover",value:function(m,p){var S=this.w;p||(p=m.target);var A=S.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis");if(m.type==="mousemove"){var k=parseInt(p.getAttribute("rel"),10)-1;this.highlightSeries(S.globals.seriesNames[k])}else if(m.type==="mouseout")for(var T=0;T<A.length;T++)A[T].classList.remove(this.legendInactiveClass)}},{key:"highlightRangeInSeries",value:function(m,p){var S=this,A=this.w,k=A.globals.dom.baseEl.getElementsByClassName("apexcharts-heatmap-rect"),T=function(X){for(var le=0;le<k.length;le++)k[le].classList[X](S.legendInactiveClass)};if(m.type==="mousemove"){var D=parseInt(p.getAttribute("rel"),10)-1;T("add");var V=A.config.plotOptions.heatmap.colorScale.ranges;(function(X,le){for(var ce=0;ce<k.length;ce++){var fe=Number(k[ce].getAttribute("val"));fe>=X.from&&(fe<X.to||X.to===le&&fe===le)&&k[ce].classList.remove(S.legendInactiveClass)}})(V[D],V.reduce(function(X,le){return Math.max(X,le.to)},0))}else m.type==="mouseout"&&T("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]:[],S=this.w,A=0;if(S.config.series.length>1){for(var k=S.config.series.map(function(D,V){return D.data&&D.data.length>0&&S.globals.collapsedSeriesIndices.indexOf(V)===-1&&(!S.globals.comboCharts||p.length===0||p.length&&p.indexOf(S.config.series[V].type)>-1)?V:-1}),T=m==="asc"?0:k.length-1;m==="asc"?T<k.length:T>=0;m==="asc"?T++:T--)if(k[T]!==-1){A=k[T];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(T,D,V){for(var X=T[D].childNodes,le={type:V,paths:[],realIndex:T[D].getAttribute("data:realIndex")},ce=0;ce<X.length;ce++)if(X[ce].hasAttribute("pathTo")){var fe=X[ce].getAttribute("pathTo");le.paths.push({d:fe})}m.globals.previousPaths.push(le)}m.globals.previousPaths=[],["line","area","bar","rangebar","rangeArea","candlestick","radar"].forEach(function(T){for(var D,V=(D=T,m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(D,"-series .apexcharts-series"))),X=0;X<V.length;X++)p(V,X,T)}),this.handlePrevBubbleScatterPaths("bubble"),this.handlePrevBubbleScatterPaths("scatter");var S=m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m.config.chart.type," .apexcharts-series"));if(S.length>0)for(var A=function(T){for(var D=m.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(T,"'] rect")),V=[],X=function(ce){var fe=function(Pe){return D[ce].getAttribute(Pe)},ye={x:parseFloat(fe("x")),y:parseFloat(fe("y")),width:parseFloat(fe("width")),height:parseFloat(fe("height"))};V.push({rect:ye,color:D[ce].getAttribute("color")})},le=0;le<D.length;le++)X(le);m.globals.previousPaths.push(V)},k=0;k<S.length;k++)A(k);m.globals.axisCharts||(m.globals.previousPaths=m.globals.series)}},{key:"handlePrevBubbleScatterPaths",value:function(m){var p=this.w,S=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m,"-series .apexcharts-series"));if(S.length>0)for(var A=0;A<S.length;A++){for(var k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(m,"-series .apexcharts-series[data\\:realIndex='").concat(A,"'] circle")),T=[],D=0;D<k.length;D++)T.push({x:k[D].getAttribute("cx"),y:k[D].getAttribute("cy"),r:k[D].getAttribute("r")});p.globals.previousPaths.push(T)}}},{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,S=new z(this.ctx),A=m.globals.svgWidth/2,k=m.globals.svgHeight/2,T="middle";if(m.globals.noData=!0,m.globals.animationEnded=!0,p.align==="left"?(A=10,T="start"):p.align==="right"&&(A=m.globals.svgWidth-10,T="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=S.drawText({x:A,y:k,text:p.text,textAnchor:T,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,S=0;S<m.length;S++)if(m[S].length===0)for(var A=0;A<m[p.globals.maxValsInArrayIndex].length;A++)m[S].push(0);return m}},{key:"hasAllSeriesEqualX",value:function(){for(var m=!0,p=this.w,S=this.filteredSeriesX(),A=0;A<S.length-1;A++)if(S[A][0]!==S[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}}]),ke}(),Ye=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new Q(this.ctx)}return o(ke,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var m=this.w.config.series.slice(),p=new $e(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 $e(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 S=this.w.config,A=this.w.globals,k=S.chart.type==="boxPlot"||S.series[p].type==="boxPlot",T=0;T<m[p].data.length;T++)if(m[p].data[T][1]!==void 0&&(Array.isArray(m[p].data[T][1])&&m[p].data[T][1].length===4&&!k?this.twoDSeries.push(F.parseNumber(m[p].data[T][1][3])):m[p].data[T].length>=5?this.twoDSeries.push(F.parseNumber(m[p].data[T][4])):this.twoDSeries.push(F.parseNumber(m[p].data[T][1])),A.dataFormatXNumeric=!0),S.xaxis.type==="datetime"){var D=new Date(m[p].data[T][0]);D=new Date(D).getTime(),this.twoDSeriesX.push(D)}else this.twoDSeriesX.push(m[p].data[T][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 S=this.w.config,A=this.w.globals,k=new K(this.ctx),T=p;A.collapsedSeriesIndices.indexOf(p)>-1&&(T=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[T].data.length;V++){var X=typeof m[T].data[V].x=="string",le=Array.isArray(m[T].data[V].x),ce=!le&&!!k.isValidDate(m[T].data[V].x);if(X||ce)if(X||S.xaxis.convertedCatToNumeric){var fe=A.isBarHorizontal&&A.isRangeData;S.xaxis.type!=="datetime"||fe?(this.fallbackToCategory=!0,this.twoDSeriesX.push(m[T].data[V].x),isNaN(m[T].data[V].x)||this.w.config.xaxis.type==="category"||typeof m[T].data[V].x=="string"||(A.isXNumeric=!0)):this.twoDSeriesX.push(k.parseDate(m[T].data[V].x))}else S.xaxis.type==="datetime"?this.twoDSeriesX.push(k.parseDate(m[T].data[V].x.toString())):(A.dataFormatXNumeric=!0,A.isXNumeric=!0,this.twoDSeriesX.push(parseFloat(m[T].data[V].x)));else le?(this.fallbackToCategory=!0,this.twoDSeriesX.push(m[T].data[V].x)):(A.isXNumeric=!0,A.dataFormatXNumeric=!0,this.twoDSeriesX.push(m[T].data[V].x))}if(m[p].data[0]&&m[p].data[0].z!==void 0){for(var ye=0;ye<m[p].data.length;ye++)this.threeDSeries.push(m[p].data[ye].z);A.isDataXYZ=!0}}},{key:"handleRangeData",value:function(m,p){var S=this.w.globals,A={};return this.isFormat2DArray()?A=this.handleRangeDataFormat("array",m,p):this.isFormatXY()&&(A=this.handleRangeDataFormat("xy",m,p)),S.seriesRangeStart.push(A.start===void 0?[]:A.start),S.seriesRangeEnd.push(A.end===void 0?[]:A.end),S.seriesRange.push(A.rangeUniques),S.seriesRange.forEach(function(k,T){k&&k.forEach(function(D,V){D.y.forEach(function(X,le){for(var ce=0;ce<D.y.length;ce++)if(le!==ce){var fe=X.y1,ye=X.y2,Pe=D.y[ce].y1;fe<=D.y[ce].y2&&Pe<=ye&&(D.overlaps.indexOf(X.rangeName)<0&&D.overlaps.push(X.rangeName),D.overlaps.indexOf(D.y[ce].rangeName)<0&&D.overlaps.push(D.y[ce].rangeName))}})})}),A}},{key:"handleCandleStickBoxData",value:function(m,p){var S=this.w.globals,A={};return this.isFormat2DArray()?A=this.handleCandleStickBoxDataFormat("array",m,p):this.isFormatXY()&&(A=this.handleCandleStickBoxDataFormat("xy",m,p)),S.seriesCandleO[p]=A.o,S.seriesCandleH[p]=A.h,S.seriesCandleM[p]=A.m,S.seriesCandleL[p]=A.l,S.seriesCandleC[p]=A.c,A}},{key:"handleRangeDataFormat",value:function(m,p,S){var A=[],k=[],T=p[S].data.filter(function(le,ce,fe){return ce===fe.findIndex(function(ye){return ye.x===le.x})}).map(function(le,ce){return{x:le.x,overlaps:[],y:[]}});if(m==="array")for(var D=0;D<p[S].data.length;D++)Array.isArray(p[S].data[D])?(A.push(p[S].data[D][1][0]),k.push(p[S].data[D][1][1])):(A.push(p[S].data[D]),k.push(p[S].data[D]));else if(m==="xy")for(var V=function(le){var ce=Array.isArray(p[S].data[le].y),fe=F.randomId(),ye=p[S].data[le].x,Pe={y1:ce?p[S].data[le].y[0]:p[S].data[le].y,y2:ce?p[S].data[le].y[1]:p[S].data[le].y,rangeName:fe};p[S].data[le].rangeName=fe;var Me=T.findIndex(function(Ke){return Ke.x===ye});T[Me].y.push(Pe),A.push(Pe.y1),k.push(Pe.y2)},X=0;X<p[S].data.length;X++)V(X);return{start:A,end:k,rangeUniques:T}}},{key:"handleCandleStickBoxDataFormat",value:function(m,p,S){var A=this.w,k=A.config.chart.type==="boxPlot"||A.config.series[S].type==="boxPlot",T=[],D=[],V=[],X=[],le=[];if(m==="array")if(k&&p[S].data[0].length===6||!k&&p[S].data[0].length===5)for(var ce=0;ce<p[S].data.length;ce++)T.push(p[S].data[ce][1]),D.push(p[S].data[ce][2]),k?(V.push(p[S].data[ce][3]),X.push(p[S].data[ce][4]),le.push(p[S].data[ce][5])):(X.push(p[S].data[ce][3]),le.push(p[S].data[ce][4]));else for(var fe=0;fe<p[S].data.length;fe++)Array.isArray(p[S].data[fe][1])&&(T.push(p[S].data[fe][1][0]),D.push(p[S].data[fe][1][1]),k?(V.push(p[S].data[fe][1][2]),X.push(p[S].data[fe][1][3]),le.push(p[S].data[fe][1][4])):(X.push(p[S].data[fe][1][2]),le.push(p[S].data[fe][1][3])));else if(m==="xy")for(var ye=0;ye<p[S].data.length;ye++)Array.isArray(p[S].data[ye].y)&&(T.push(p[S].data[ye].y[0]),D.push(p[S].data[ye].y[1]),k?(V.push(p[S].data[ye].y[2]),X.push(p[S].data[ye].y[3]),le.push(p[S].data[ye].y[4])):(X.push(p[S].data[ye].y[2]),le.push(p[S].data[ye].y[3])));return{o:T,h:D,m:V,l:X,c:le}}},{key:"parseDataAxisCharts",value:function(m){var p=this,S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.ctx,A=this.w.config,k=this.w.globals,T=new K(S),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(ye,Pe){ye.name!==void 0?k.seriesNames.push(ye.name):k.seriesNames.push("series-"+parseInt(Pe+1,10))}),this.coreUtils.setSeriesYAxisMappings();var V=[],X=N(new Set(A.series.map(function(ye){return ye.group})));A.series.forEach(function(ye,Pe){var Me=X.indexOf(ye.group);V[Me]||(V[Me]=[]),V[Me].push(k.seriesNames[Pe])}),k.seriesGroups=V;for(var le=function(){for(var ye=0;ye<D.length;ye++)if(typeof D[ye]=="string"){if(!T.isValidDate(D[ye]))throw new Error("You have provided invalid Date format. Please provide a valid JavaScript Date");p.twoDSeriesX.push(T.parseDate(D[ye]))}else p.twoDSeriesX.push(D[ye])},ce=0;ce<m.length;ce++){if(this.twoDSeries=[],this.twoDSeriesX=[],this.threeDSeries=[],m[ce].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[ce].type!=="rangeBar"&&m[ce].type!=="rangeArea"||(k.isRangeData=!0,A.chart.type!=="rangeBar"&&A.chart.type!=="rangeArea"||this.handleRangeData(m,ce)),this.isMultiFormat())this.isFormat2DArray()?this.handleFormat2DArray(m,ce):this.isFormatXY()&&this.handleFormatXY(m,ce),A.chart.type!=="candlestick"&&m[ce].type!=="candlestick"&&A.chart.type!=="boxPlot"&&m[ce].type!=="boxPlot"||this.handleCandleStickBoxData(m,ce),k.series.push(this.twoDSeries),k.labels.push(this.twoDSeriesX),k.seriesX.push(this.twoDSeriesX),k.seriesGoals=this.seriesGoals,ce!==this.activeSeriesIndex||this.fallbackToCategory||(k.isXNumeric=!0);else{A.xaxis.type==="datetime"?(k.isXNumeric=!0,le(),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 fe=m[ce].data.map(function(ye){return F.parseNumber(ye)});k.series.push(fe)}k.seriesZ.push(this.threeDSeries),m[ce].color!==void 0?k.seriesColors.push(m[ce].color):k.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(m){var p=this.w.globals,S=this.w.config;p.series=m.slice(),p.seriesNames=S.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,S=this.w.globals;p.xaxis.categories.length>0?S.labels=p.xaxis.categories:p.labels.length>0?S.labels=p.labels.slice():this.fallbackToCategory?(S.labels=S.labels[0],S.seriesRange.length&&(S.seriesRange.map(function(A){A.forEach(function(k){S.labels.indexOf(k.x)<0&&k.x&&S.labels.push(k.x)})}),S.labels=Array.from(new Set(S.labels.map(JSON.stringify)),JSON.parse)),p.xaxis.convertedCatToNumeric&&(new he(p).convertCatToNumericXaxis(p,this.ctx,S.seriesX[0]),this._generateExternalLabels(m))):this._generateExternalLabels(m)}},{key:"_generateExternalLabels",value:function(m){var p=this.w.globals,S=this.w.config,A=[];if(p.axisCharts){if(p.series.length>0)if(this.isFormatXY())for(var k=S.series.map(function(ce,fe){return ce.data.filter(function(ye,Pe,Me){return Me.findIndex(function(Ke){return Ke.x===ye.x})===Pe})}),T=k.reduce(function(ce,fe,ye,Pe){return Pe[ce].length>fe.length?ce:ye},0),D=0;D<k[T].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 X=0;X<m.length;X++)p.seriesX.push(A);this.w.globals.isBarHorizontal||(p.isXNumeric=!0)}if(A.length===0){A=p.axisCharts?[]:p.series.map(function(ce,fe){return fe+1});for(var le=0;le<m.length;le++)p.seriesX.push(A)}p.labels=A,S.xaxis.convertedCatToNumeric&&(p.categoryLabels=A.map(function(ce){return S.xaxis.labels.formatter(ce)})),p.noLabelsProvided=!0}},{key:"parseData",value:function(m){var p=this.w,S=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),S.chart.stacked){var k=new $e(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&&(S.xaxis.type!=="numeric"||S.labels.length!==0||S.xaxis.categories.length!==0)||this.handleExternalLabelsData(m);for(var T=this.coreUtils.getCategoryLabels(A.labels),D=0;D<T.length;D++)if(Array.isArray(T[D])){A.isMultiLineX=!0;break}}},{key:"excludeCollapsedSeriesInYAxis",value:function(){var m=this.w,p=[];m.globals.seriesYAxisMap.forEach(function(S,A){var k=0;S.forEach(function(T){m.globals.collapsedSeriesIndices.indexOf(T)!==-1&&k++}),k>0&&k==S.length&&p.push(A)}),m.globals.ignoreYAxisIndexes=p.map(function(S){return S})}}]),ke}(),Je=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"scaleSvgNode",value:function(m,p){var S=parseFloat(m.getAttributeNS(null,"width")),A=parseFloat(m.getAttributeNS(null,"height"));m.setAttributeNS(null,"width",S*p),m.setAttributeNS(null,"height",A*p),m.setAttributeNS(null,"viewBox","0 0 "+S+" "+A)}},{key:"getSvgString",value:function(){var m=this;return new Promise(function(p){var S=m.w,A=S.config.chart.toolbar.export.width,k=S.config.chart.toolbar.export.scale||A/S.globals.svgWidth;k||(k=1);var T=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(){T=new XMLSerializer().serializeToString(D),p(T.replace(/ /g," "))})})}},{key:"convertImagesToBase64",value:function(m){var p=this,S=m.getElementsByTagName("image"),A=Array.from(S).map(function(k){var T=k.getAttributeNS("http://www.w3.org/1999/xlink","href");return T&&!T.startsWith("data:")?p.getBase64FromUrl(T).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,S){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=S,A.src=m})}},{key:"cleanup",value:function(){var m=this.w,p=m.globals.dom.baseEl.getElementsByClassName("apexcharts-xcrosshairs"),S=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)),S&&S[0]&&(S[0].setAttribute("y",-100),S[0].setAttribute("y1",-100),S[0].setAttribute("y2",-100))}},{key:"svgUrl",value:function(){var m=this;return new Promise(function(p){m.cleanup(),m.getSvgString().then(function(S){var A=new Blob([S],{type:"image/svg+xml;charset=utf-8"});p(URL.createObjectURL(A))})})}},{key:"dataURI",value:function(m){var p=this;return new Promise(function(S){var A=p.w,k=m?m.scale||m.width/A.globals.svgWidth:1;p.cleanup();var T=document.createElement("canvas");T.width=A.globals.svgWidth*k,T.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=T.getContext("2d");V.fillStyle=D,V.fillRect(0,0,T.width*k,T.height*k),p.getSvgString().then(function(X){var le="data:image/svg+xml,"+encodeURIComponent(X),ce=new Image;ce.crossOrigin="anonymous",ce.onload=function(){if(V.drawImage(ce,0,0),T.msToBlob){var fe=T.msToBlob();S({blob:fe})}else{var ye=T.toDataURL("image/png");S({imgURI:ye})}},ce.src=le})})}},{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,S=this.w.config.chart.toolbar.export.width,A=p?{scale:p}:S?{width:S}:void 0;this.dataURI(A).then(function(k){var T=k.imgURI,D=k.blob;D?navigator.msSaveOrOpenBlob(D,m.w.globals.chartID+".png"):m.triggerDownload(T,m.w.config.chart.toolbar.export.png.filename,".png")})}},{key:"exportToCSV",value:function(m){var p=this,S=m.series,A=m.fileName,k=m.columnDelimiter,T=k===void 0?",":k,D=m.lineDelimiter,V=D===void 0?`
`:D,X=this.w;S||(S=X.config.series);var le,ce,fe=[],ye=[],Pe="",Me=X.globals.series.map(function(Fe,at){return X.globals.collapsedSeriesIndices.indexOf(at)===-1?Fe:[]}),Ke=function(Fe){return typeof X.config.chart.toolbar.export.csv.categoryFormatter=="function"?X.config.chart.toolbar.export.csv.categoryFormatter(Fe):X.config.xaxis.type==="datetime"&&String(Fe).length>=10?new Date(Fe).toDateString():F.isNumber(Fe)?Fe:Fe.split(T).join("")},we=function(Fe){return typeof X.config.chart.toolbar.export.csv.valueFormatter=="function"?X.config.chart.toolbar.export.csv.valueFormatter(Fe):Fe},Te=Math.max.apply(Math,N(S.map(function(Fe){return Fe.data?Fe.data.length:0}))),te=new Ye(this.ctx),ve=new de(this.ctx),Be=function(Fe){var at="";if(X.globals.axisCharts){if(X.config.xaxis.type==="category"||X.config.xaxis.convertedCatToNumeric)if(X.globals.isBarHorizontal){var ut=X.globals.yLabelFormatters[0],yt=new $e(p.ctx).getActiveConfigSeriesIndex();at=ut(X.globals.labels[Fe],{seriesIndex:yt,dataPointIndex:Fe,w:X})}else at=ve.getLabel(X.globals.labels,X.globals.timescaleLabels,0,Fe).text;X.config.xaxis.type==="datetime"&&(X.config.xaxis.categories.length?at=X.config.xaxis.categories[Fe]:X.config.labels.length&&(at=X.config.labels[Fe]))}else at=X.config.labels[Fe];return at===null?"nullvalue":(Array.isArray(at)&&(at=at.join(" ")),F.isNumber(at)?at:at.split(T).join(""))},Ue=function(Fe,at){if(fe.length&&at===0&&ye.push(fe.join(T)),Fe.data){Fe.data=Fe.data.length&&Fe.data||N(Array(Te)).map(function(){return""});for(var ut=0;ut<Fe.data.length;ut++){fe=[];var yt=Be(ut);if(yt!=="nullvalue"){if(yt||(te.isFormatXY()?yt=S[at].data[ut].x:te.isFormat2DArray()&&(yt=S[at].data[ut]?S[at].data[ut][0]:"")),at===0){fe.push(Ke(yt));for(var Lt=0;Lt<X.globals.series.length;Lt++){var Gt,an=te.isFormatXY()?(Gt=S[Lt].data[ut])===null||Gt===void 0?void 0:Gt.y:Me[Lt][ut];fe.push(we(an))}}(X.config.chart.type==="candlestick"||Fe.type&&Fe.type==="candlestick")&&(fe.pop(),fe.push(X.globals.seriesCandleO[at][ut]),fe.push(X.globals.seriesCandleH[at][ut]),fe.push(X.globals.seriesCandleL[at][ut]),fe.push(X.globals.seriesCandleC[at][ut])),(X.config.chart.type==="boxPlot"||Fe.type&&Fe.type==="boxPlot")&&(fe.pop(),fe.push(X.globals.seriesCandleO[at][ut]),fe.push(X.globals.seriesCandleH[at][ut]),fe.push(X.globals.seriesCandleM[at][ut]),fe.push(X.globals.seriesCandleL[at][ut]),fe.push(X.globals.seriesCandleC[at][ut])),X.config.chart.type==="rangeBar"&&(fe.pop(),fe.push(X.globals.seriesRangeStart[at][ut]),fe.push(X.globals.seriesRangeEnd[at][ut])),fe.length&&ye.push(fe.join(T))}}}};fe.push(X.config.chart.toolbar.export.csv.headerCategory),X.config.chart.type==="boxPlot"?(fe.push("minimum"),fe.push("q1"),fe.push("median"),fe.push("q3"),fe.push("maximum")):X.config.chart.type==="candlestick"?(fe.push("open"),fe.push("high"),fe.push("low"),fe.push("close")):X.config.chart.type==="rangeBar"?(fe.push("minimum"),fe.push("maximum")):S.map(function(Fe,at){var ut=(Fe.name?Fe.name:"series-".concat(at))+"";X.globals.axisCharts&&fe.push(ut.split(T).join("")?ut.split(T).join(""):"series-".concat(at))}),X.globals.axisCharts||(fe.push(X.config.chart.toolbar.export.csv.headerValue),ye.push(fe.join(T))),X.globals.allSeriesHasEqualX||!X.globals.axisCharts||X.config.xaxis.categories.length||X.config.labels.length?S.map(function(Fe,at){X.globals.axisCharts?Ue(Fe,at):((fe=[]).push(Ke(X.globals.labels[at])),fe.push(we(Me[at])),ye.push(fe.join(T)))}):(le=new Set,ce={},S.forEach(function(Fe,at){Fe==null||Fe.data.forEach(function(ut){var yt,Lt;if(te.isFormatXY())yt=ut.x,Lt=ut.y;else{if(!te.isFormat2DArray())return;yt=ut[0],Lt=ut[1]}ce[yt]||(ce[yt]=Array(S.length).fill("")),ce[yt][at]=we(Lt),le.add(yt)})}),fe.length&&ye.push(fe.join(T)),Array.from(le).sort().forEach(function(Fe){ye.push([Ke(Fe),ce[Fe].join(T)])})),Pe+=ye.join(V),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\uFEFF"+Pe),A||X.config.chart.toolbar.export.csv.filename,".csv")}},{key:"triggerDownload",value:function(m,p,S){var A=document.createElement("a");A.href=m,A.download=(p||this.w.globals.chartID)+S,document.body.appendChild(A),A.click(),document.body.removeChild(A)}}]),ke}(),ht=function(){function ke(m,p){s(this,ke),this.ctx=m,this.elgrid=p,this.w=m.w;var S=this.w;this.axesUtils=new de(m),this.xaxisLabels=S.globals.labels.slice(),S.globals.timescaleLabels.length>0&&!S.globals.isBarHorizontal&&(this.xaxisLabels=S.globals.timescaleLabels.slice()),S.config.xaxis.overwriteCategories&&(this.xaxisLabels=S.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],S.config.xaxis.position==="top"?this.offY=0:this.offY=S.globals.gridHeight,this.offY=this.offY+S.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal=S.config.chart.type==="bar"&&S.config.plotOptions.bar.horizontal,this.xaxisFontSize=S.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=S.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=S.config.xaxis.labels.style.colors,this.xaxisBorderWidth=S.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=S.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=S.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=S.config.xaxis.axisBorder.height,this.yaxis=S.config.yaxis[0]}return o(ke,[{key:"drawXaxis",value:function(){var m=this.w,p=new z(this.ctx),S=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,")")});S.add(A);for(var k=[],T=0;T<this.xaxisLabels.length;T++)k.push(this.xaxisLabels[T]);if(this.drawXAxisLabelAndGroup(!0,p,A,k,m.globals.isXNumeric,function(Pe,Me){return Me}),m.globals.hasXaxisGroups){var D=m.globals.groups;k=[];for(var V=0;V<D.length;V++)k.push(D[V].title);var X={};m.config.xaxis.group.style&&(X.xaxisFontSize=m.config.xaxis.group.style.fontSize,X.xaxisFontFamily=m.config.xaxis.group.style.fontFamily,X.xaxisForeColors=m.config.xaxis.group.style.colors,X.fontWeight=m.config.xaxis.group.style.fontWeight,X.cssClass=m.config.xaxis.group.style.cssClass),this.drawXAxisLabelAndGroup(!1,p,A,k,!1,function(Pe,Me){return D[Pe].cols*Me},X)}if(m.config.xaxis.title.text!==void 0){var le=p.group({class:"apexcharts-xaxis-title"}),ce=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});le.add(ce),S.add(le)}if(m.config.xaxis.axisBorder.show){var fe=m.globals.barPadForNumericAxis,ye=p.drawLine(m.globals.padHorizontal+m.config.xaxis.axisBorder.offsetX-fe,this.offY,this.xaxisBorderWidth+fe,this.offY,m.config.xaxis.axisBorder.color,0,this.xaxisBorderHeight);this.elgrid&&this.elgrid.elGridBorders&&m.config.grid.show?this.elgrid.elGridBorders.add(ye):S.add(ye)}return S}},{key:"drawXAxisLabelAndGroup",value:function(m,p,S,A,k,T){var D,V=this,X=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{},le=[],ce=[],fe=this.w,ye=X.xaxisFontSize||this.xaxisFontSize,Pe=X.xaxisFontFamily||this.xaxisFontFamily,Me=X.xaxisForeColors||this.xaxisForeColors,Ke=X.fontWeight||fe.config.xaxis.labels.style.fontWeight,we=X.cssClass||fe.config.xaxis.labels.style.cssClass,Te=fe.globals.padHorizontal,te=A.length,ve=fe.config.xaxis.type==="category"?fe.globals.dataPoints:te;if(ve===0&&te>ve&&(ve=te),k){var Be=ve>1?ve-1:ve;D=fe.globals.gridWidth/Math.min(Be,te-1),Te=Te+T(0,D)/2+fe.config.xaxis.labels.offsetX}else D=fe.globals.gridWidth/ve,Te=Te+T(0,D)+fe.config.xaxis.labels.offsetX;for(var Ue=function(at){var ut=Te-T(at,D)/2+fe.config.xaxis.labels.offsetX;at===0&&te===1&&D/2===Te&&ve===1&&(ut=fe.globals.gridWidth/2);var yt=V.axesUtils.getLabel(A,fe.globals.timescaleLabels,ut,at,le,ye,m),Lt=28;if(fe.globals.rotateXLabels&&m&&(Lt=22),fe.config.xaxis.title.text&&fe.config.xaxis.position==="top"&&(Lt+=parseFloat(fe.config.xaxis.title.style.fontSize)+2),m||(Lt=Lt+parseFloat(ye)+(fe.globals.xAxisLabelsHeight-fe.globals.xAxisGroupLabelsHeight)+(fe.globals.rotateXLabels?10:0)),yt=fe.config.xaxis.tickAmount!==void 0&&fe.config.xaxis.tickAmount!=="dataPoints"&&fe.config.xaxis.type!=="datetime"?V.axesUtils.checkLabelBasedOnTickamount(at,yt,te):V.axesUtils.checkForOverflowingLabels(at,yt,te,le,ce),fe.config.xaxis.labels.show){var Gt=p.drawText({x:yt.x,y:V.offY+fe.config.xaxis.labels.offsetY+Lt-(fe.config.xaxis.position==="top"?fe.globals.xAxisHeight+fe.config.xaxis.axisTicks.height-2:0),text:yt.text,textAnchor:"middle",fontWeight:yt.isBold?600:Ke,fontSize:ye,fontFamily:Pe,foreColor:Array.isArray(Me)?m&&fe.config.xaxis.convertedCatToNumeric?Me[fe.globals.minX+at-1]:Me[at]:Me,isPlainText:!1,cssClass:(m?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+we});if(S.add(Gt),Gt.on("click",function(et){if(typeof fe.config.chart.events.xAxisLabelClick=="function"){var Pt=Object.assign({},fe,{labelIndex:at});fe.config.chart.events.xAxisLabelClick(et,V.ctx,Pt)}}),m){var an=document.createElementNS(fe.globals.SVGNS,"title");an.textContent=Array.isArray(yt.text)?yt.text.join(" "):yt.text,Gt.node.appendChild(an),yt.text!==""&&(le.push(yt.text),ce.push(yt))}}at<te-1&&(Te+=T(at+1,D))},Fe=0;Fe<=te-1;Fe++)Ue(Fe)}},{key:"drawXaxisInversed",value:function(m){var p,S,A=this,k=this.w,T=new z(this.ctx),D=k.config.yaxis[0].opposite?k.globals.translateYAxisX[m]:0,V=T.group({class:"apexcharts-yaxis apexcharts-xaxis-inversed",rel:m}),X=T.group({class:"apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g",transform:"translate("+D+", 0)"});V.add(X);var le=[];if(k.config.yaxis[m].show)for(var ce=0;ce<this.xaxisLabels.length;ce++)le.push(this.xaxisLabels[ce]);p=k.globals.gridHeight/le.length,S=-p/2.2;var fe=k.globals.yLabelFormatters[0],ye=k.config.yaxis[0].labels;if(ye.show)for(var Pe=function(Be){var Ue=le[Be]===void 0?"":le[Be];Ue=fe(Ue,{seriesIndex:m,dataPointIndex:Be,w:k});var Fe=A.axesUtils.getYAxisForeColor(ye.style.colors,m),at=0;Array.isArray(Ue)&&(at=Ue.length/2*parseInt(ye.style.fontSize,10));var ut=ye.offsetX-15,yt="end";A.yaxis.opposite&&(yt="start"),k.config.yaxis[0].labels.align==="left"?(ut=ye.offsetX,yt="start"):k.config.yaxis[0].labels.align==="center"?(ut=ye.offsetX,yt="middle"):k.config.yaxis[0].labels.align==="right"&&(yt="end");var Lt=T.drawText({x:ut,y:S+p+ye.offsetY-at,text:Ue,textAnchor:yt,foreColor:Array.isArray(Fe)?Fe[Be]:Fe,fontSize:ye.style.fontSize,fontFamily:ye.style.fontFamily,fontWeight:ye.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-yaxis-label "+ye.style.cssClass,maxWidth:ye.maxWidth});X.add(Lt),Lt.on("click",function(et){if(typeof k.config.chart.events.xAxisLabelClick=="function"){var Pt=Object.assign({},k,{labelIndex:Be});k.config.chart.events.xAxisLabelClick(et,A.ctx,Pt)}});var Gt=document.createElementNS(k.globals.SVGNS,"title");if(Gt.textContent=Array.isArray(Ue)?Ue.join(" "):Ue,Lt.node.appendChild(Gt),k.config.yaxis[m].labels.rotate!==0){var an=T.rotateAroundCenter(Lt.node);Lt.node.setAttribute("transform","rotate(".concat(k.config.yaxis[m].labels.rotate," 0 ").concat(an.y,")"))}S+=p},Me=0;Me<=le.length-1;Me++)Pe(Me);if(k.config.yaxis[0].title.text!==void 0){var Ke=T.group({class:"apexcharts-yaxis-title apexcharts-xaxis-title-inversed",transform:"translate("+D+", 0)"}),we=T.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});Ke.add(we),V.add(Ke)}var Te=0;this.isCategoryBarHorizontal&&k.config.yaxis[0].opposite&&(Te=k.globals.gridWidth);var te=k.config.xaxis.axisBorder;if(te.show){var ve=T.drawLine(k.globals.padHorizontal+te.offsetX+Te,1+te.offsetY,k.globals.padHorizontal+te.offsetX+Te,k.globals.gridHeight+te.offsetY,te.color,0);this.elgrid&&this.elgrid.elGridBorders&&k.config.grid.show?this.elgrid.elGridBorders.add(ve):V.add(ve)}return k.config.yaxis[0].axisTicks.show&&this.axesUtils.drawYAxisTicks(Te,le.length,k.config.yaxis[0].axisBorder,k.config.yaxis[0].axisTicks,0,p,V),V}},{key:"drawXaxisTicks",value:function(m,p,S){var A=this.w,k=m;if(!(m<0||m-2>A.globals.gridWidth)){var T=this.offY+A.config.xaxis.axisTicks.offsetY;if(p=p+T+A.config.xaxis.axisTicks.height,A.config.xaxis.position==="top"&&(p=T-A.config.xaxis.axisTicks.height),A.config.xaxis.axisTicks.show){var D=new z(this.ctx).drawLine(m+A.config.xaxis.axisTicks.offsetX,T+A.config.xaxis.offsetY,k+A.config.xaxis.axisTicks.offsetX,p+A.config.xaxis.offsetY,A.config.xaxis.axisTicks.color);S.add(D),D.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var m=this.w,p=[],S=this.xaxisLabels.length,A=m.globals.padHorizontal;if(m.globals.timescaleLabels.length>0)for(var k=0;k<S;k++)A=this.xaxisLabels[k].position,p.push(A);else for(var T=S,D=0;D<T;D++){var V=T;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 z(this.ctx),S=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"),T=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"),S.setAttribute("transform","translate(0, ".concat(-10,")"));var X=A[D].childNodes;m.config.xaxis.labels.trim&&Array.prototype.forEach.call(X,function(ye){p.placeTextWithEllipsis(ye,ye.textContent,m.globals.xAxisLabelsHeight-(m.config.legend.position==="bottom"?20:10))})}else(function(){for(var ye=m.globals.gridWidth/(m.globals.labels.length+1),Pe=0;Pe<A.length;Pe++){var Me=A[Pe].childNodes;m.config.xaxis.labels.trim&&m.config.xaxis.type!=="datetime"&&Array.prototype.forEach.call(Me,function(Ke){p.placeTextWithEllipsis(Ke,Ke.textContent,ye)})}})();if(k.length>0){var le=k[k.length-1].getBBox(),ce=k[0].getBBox();le.x<-20&&k[k.length-1].parentNode.removeChild(k[k.length-1]),ce.x+ce.width>m.globals.gridWidth&&!m.globals.isBarHorizontal&&k[0].parentNode.removeChild(k[0]);for(var fe=0;fe<T.length;fe++)p.placeTextWithEllipsis(T[fe],T[fe].textContent,m.config.yaxis[0].labels.maxWidth-(m.config.yaxis[0].title.text?2*parseFloat(m.config.yaxis[0].title.style.fontSize):0)-15)}}}]),ke}(),rt=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w;var p=this.w;this.xaxisLabels=p.globals.labels.slice(),this.axesUtils=new de(m),this.isRangeBar=p.globals.seriesRange.length&&p.globals.isBarHorizontal,p.globals.timescaleLabels.length>0&&(this.xaxisLabels=p.globals.timescaleLabels.slice())}return o(ke,[{key:"drawGridArea",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,p=this.w,S=new z(this.ctx);m||(m=S.group({class:"apexcharts-grid"}));var A=S.drawLine(p.globals.padHorizontal,1,p.globals.padHorizontal,p.globals.gridHeight,"transparent"),k=S.drawLine(p.globals.padHorizontal,p.globals.gridHeight,p.globals.gridWidth,p.globals.gridHeight,"transparent");return 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,S=new z(this.ctx),A=Array.isArray(m.config.stroke.width)?Math.max.apply(Math,N(m.config.stroke.width)):m.config.stroke.width,k=function(le){var ce=document.createElementNS(p.SVGNS,"clipPath");return ce.setAttribute("id",le),ce};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 T=0,D=0;(["bar","rangeBar","candlestick","boxPlot"].includes(m.config.chart.type)||m.globals.comboBarCount>0)&&m.globals.isXNumeric&&!m.globals.isBarHorizontal&&(T=Math.max(m.config.grid.padding.left,p.barPadForNumericAxis),D=Math.max(m.config.grid.padding.right,p.barPadForNumericAxis)),p.dom.elGridRect=S.drawRect(0,0,p.gridWidth,p.gridHeight,0,"#fff"),p.dom.elGridRectBar=S.drawRect(-A/2-T-2,-A/2-2,p.gridWidth+A+D+T+4,p.gridHeight+A+4,0,"#fff");var V=m.globals.markers.largestSize;p.dom.elGridRectMarker=S.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 X=p.dom.baseEl.querySelector("defs");X.appendChild(p.dom.elGridRectMask),X.appendChild(p.dom.elGridRectBarMask),X.appendChild(p.dom.elGridRectMarkerMask),X.appendChild(p.dom.elForecastMask),X.appendChild(p.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(m){var p=m.i,S=m.x1,A=m.y1,k=m.x2,T=m.y2,D=m.xCount,V=m.parent,X=this.w;if(!(p===0&&X.globals.skipFirstTimelinelabel||p===D-1&&X.globals.skipLastTimelinelabel&&!X.config.xaxis.labels.formatter||X.config.chart.type==="radar")){X.config.grid.xaxis.lines.show&&this._drawGridLine({i:p,x1:S,y1:A,x2:k,y2:T,xCount:D,parent:V});var le=0;if(X.globals.hasXaxisGroups&&X.config.xaxis.tickPlacement==="between"){var ce=X.globals.groups;if(ce){for(var fe=0,ye=0;fe<p&&ye<ce.length;ye++)fe+=ce[ye].cols;fe===p&&(le=.6*X.globals.xAxisLabelsHeight)}}new ht(this.ctx).drawXaxisTicks(S,le,X.globals.dom.elGraphical)}}},{key:"_drawGridLine",value:function(m){var p=m.i,S=m.x1,A=m.y1,k=m.x2,T=m.y2,D=m.xCount,V=m.parent,X=this.w,le=V.node.classList.contains("apexcharts-gridlines-horizontal"),ce=X.globals.barPadForNumericAxis,fe=A===0&&T===0||S===0&&k===0||A===X.globals.gridHeight&&T===X.globals.gridHeight||X.globals.isBarHorizontal&&(p===0||p===D-1),ye=new z(this).drawLine(S-(le?ce:0),A,k+(le?ce:0),T,X.config.grid.borderColor,X.config.grid.strokeDashArray);ye.node.classList.add("apexcharts-gridline"),fe&&X.config.grid.show?this.elGridBorders.add(ye):V.add(ye)}},{key:"_drawGridBandRect",value:function(m){var p=m.c,S=m.x1,A=m.y1,k=m.x2,T=m.y2,D=m.type,V=this.w,X=new z(this.ctx),le=V.globals.barPadForNumericAxis,ce=V.config.grid[D].colors[p],fe=X.drawRect(S-(D==="row"?le:0),A,k+(D==="row"?2*le:0),T,0,ce,V.config.grid[D].opacity);this.elg.add(fe),fe.attr("clip-path","url(#gridRectMask".concat(V.globals.cuid,")")),fe.node.classList.add("apexcharts-grid-".concat(D))}},{key:"_drawXYLines",value:function(m){var p=this,S=m.xCount,A=m.tickAmount,k=this.w;if(k.config.grid.xaxis.lines.show||k.config.xaxis.axisTicks.show){var T,D=k.globals.padHorizontal,V=k.globals.gridHeight;k.globals.timescaleLabels.length?function(Pe){for(var Me=Pe.xC,Ke=Pe.x1,we=Pe.y1,Te=Pe.x2,te=Pe.y2,ve=0;ve<Me;ve++)Ke=p.xaxisLabels[ve].position,Te=p.xaxisLabels[ve].position,p._drawGridLines({i:ve,x1:Ke,y1:we,x2:Te,y2:te,xCount:S,parent:p.elgridLinesV})}({xC:S,x1:D,y1:0,x2:T,y2:V}):(k.globals.isXNumeric&&(S=k.globals.xAxisScale.result.length),function(Pe){for(var Me=Pe.xC,Ke=Pe.x1,we=Pe.y1,Te=Pe.x2,te=Pe.y2,ve=0;ve<Me+(k.globals.isXNumeric?0:1);ve++)ve===0&&Me===1&&k.globals.dataPoints===1&&(Te=Ke=k.globals.gridWidth/2),p._drawGridLines({i:ve,x1:Ke,y1:we,x2:Te,y2:te,xCount:S,parent:p.elgridLinesV}),Te=Ke+=k.globals.gridWidth/(k.globals.isXNumeric?Me-1:Me)}({xC:S,x1:D,y1:0,x2:T,y2:V}))}if(k.config.grid.yaxis.lines.show){var X=0,le=0,ce=k.globals.gridWidth,fe=A+1;this.isRangeBar&&(fe=k.globals.labels.length);for(var ye=0;ye<fe+(this.isRangeBar?1:0);ye++)this._drawGridLine({i:ye,xCount:fe+(this.isRangeBar?1:0),x1:0,y1:X,x2:ce,y2:le,parent:this.elgridLinesH}),le=X+=k.globals.gridHeight/(this.isRangeBar?fe:A)}}},{key:"_drawInvertedXYLines",value:function(m){var p=m.xCount,S=this.w;if(S.config.grid.xaxis.lines.show||S.config.xaxis.axisTicks.show)for(var A,k=S.globals.padHorizontal,T=S.globals.gridHeight,D=0;D<p+1;D++)S.config.grid.xaxis.lines.show&&this._drawGridLine({i:D,xCount:p+1,x1:k,y1:0,x2:A,y2:T,parent:this.elgridLinesV}),new ht(this.ctx).drawXaxisTicks(k,0,S.globals.dom.elGraphical),A=k+=S.globals.gridWidth/p;if(S.config.grid.yaxis.lines.show)for(var V=0,X=0,le=S.globals.gridWidth,ce=0;ce<S.globals.dataPoints+1;ce++)this._drawGridLine({i:ce,xCount:S.globals.dataPoints+1,x1:0,y1:V,x2:le,y2:X,parent:this.elgridLinesH}),X=V+=S.globals.gridHeight/S.globals.dataPoints}},{key:"renderGrid",value:function(){var m=this.w,p=m.globals,S=new z(this.ctx);this.elg=S.group({class:"apexcharts-grid"}),this.elgridLinesH=S.group({class:"apexcharts-gridlines-horizontal"}),this.elgridLinesV=S.group({class:"apexcharts-gridlines-vertical"}),this.elGridBorders=S.group({class:"apexcharts-grid-borders"}),this.elg.add(this.elgridLinesH),this.elg.add(this.elgridLinesV),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,T=p.yAxisScale[A].result.length-1;if(!p.isBarHorizontal||this.isRangeBar){var D,V,X;k=this.xaxisLabels.length,this.isRangeBar&&(T=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||(X=V.result)===null||X===void 0?void 0:X.length)>0&&m.config.xaxis.type!=="datetime"&&(k=p.yAxisScale[A].result.length-1)),this._drawXYLines({xCount:k,tickAmount:T})}else k=T,T=p.xTickAmount,this._drawInvertedXYLines({xCount:k,tickAmount:T});return this.drawGridBands(k,T),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:p.gridWidth/k}}},{key:"drawGridBands",value:function(m,p){var S,A,k=this,T=this.w;if(((S=T.config.grid.row.colors)===null||S===void 0?void 0:S.length)>0&&function(Pe,Me,Ke,we,Te,te){for(var ve=0,Be=0;ve<Me;ve++,Be++)Be>=T.config.grid[Pe].colors.length&&(Be=0),k._drawGridBandRect({c:Be,x1:Ke,y1:we,x2:Te,y2:te,type:Pe}),we+=T.globals.gridHeight/p}("row",p,0,0,T.globals.gridWidth,T.globals.gridHeight/p),((A=T.config.grid.column.colors)===null||A===void 0?void 0:A.length)>0){var D=T.globals.isBarHorizontal||T.config.xaxis.tickPlacement!=="on"||T.config.xaxis.type!=="category"&&!T.config.xaxis.convertedCatToNumeric?m:m-1;T.globals.isXNumeric&&(D=T.globals.xAxisScale.result.length-1);for(var V=T.globals.padHorizontal,X=T.globals.padHorizontal+T.globals.gridWidth/D,le=T.globals.gridHeight,ce=0,fe=0;ce<m;ce++,fe++){var ye;fe>=T.config.grid.column.colors.length&&(fe=0),T.config.xaxis.type==="datetime"&&(V=this.xaxisLabels[ce].position,X=(((ye=this.xaxisLabels[ce+1])===null||ye===void 0?void 0:ye.position)||T.globals.gridWidth)-this.xaxisLabels[ce].position),this._drawGridBandRect({c:fe,x1:V,y1:0,x2:X,y2:le,type:"column"}),V+=T.globals.gridWidth/D}}}}]),ke}(),st=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.coreUtils=new Q(this.ctx)}return o(ke,[{key:"niceScale",value:function(m,p){var S,A,k,T,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,V=1e-11,X=this.w,le=X.globals;le.isBarHorizontal?(S=X.config.xaxis,A=Math.max((le.svgWidth-100)/25,2)):(S=X.config.yaxis[D],A=Math.max((le.svgHeight-100)/15,2)),F.isNumber(A)||(A=10),k=S.min!==void 0&&S.min!==null,T=S.max!==void 0&&S.min!==null;var ce=S.stepSize!==void 0&&S.stepSize!==null,fe=S.tickAmount!==void 0&&S.tickAmount!==null,ye=fe?S.tickAmount:le.niceScaleDefaultTicks[Math.min(Math.round(A/2),le.niceScaleDefaultTicks.length-1)];if(le.isMultipleYAxis&&!fe&&le.multiAxisTickAmount>0&&(ye=le.multiAxisTickAmount,fe=!0),ye=ye==="dataPoints"?le.dataPoints-1:Math.abs(Math.round(ye)),(m===Number.MIN_VALUE&&p===0||!F.isNumber(m)&&!F.isNumber(p)||m===Number.MIN_VALUE&&p===-Number.MAX_VALUE)&&(m=F.isNumber(S.min)?S.min:0,p=F.isNumber(S.max)?S.max:m+ye,le.allSeriesCollapsed=!1),m>p){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var Pe=p;p=m,m=Pe}else m===p&&(m=m===0?0:m-1,p=p===0?2:p+1);var Me=[];ye<1&&(ye=1);var Ke=ye,we=Math.abs(p-m);!k&&m>0&&m/we<.15&&(m=0,k=!0),!T&&p<0&&-p/we<.15&&(p=0,T=!0);var Te=(we=Math.abs(p-m))/Ke,te=Te,ve=Math.floor(Math.log10(te)),Be=Math.pow(10,ve),Ue=Math.ceil(te/Be);if(Te=te=(Ue=le.niceScaleAllowedMagMsd[le.yValueDecimal===0?0:1][Ue])*Be,le.isBarHorizontal&&S.stepSize&&S.type!=="datetime"?(Te=S.stepSize,ce=!0):ce&&(Te=S.stepSize),ce&&S.forceNiceScale){var Fe=Math.floor(Math.log10(Te));Te*=Math.pow(10,ve-Fe)}if(k&&T){var at=we/Ke;if(fe)if(ce)if(F.mod(we,Te)!=0){var ut=F.getGCD(Te,at);Te=at/ut<10?ut:at}else F.mod(Te,at)==0?Te=at:(at=Te,fe=!1);else Te=at;else if(ce)F.mod(we,Te)==0?at=Te:Te=at;else if(F.mod(we,Te)==0)at=Te;else{at=we/(Ke=Math.ceil(we/Te));var yt=F.getGCD(we,Te);we/yt<A&&(at=yt),Te=at}Ke=Math.round(we/Te)}else{if(k||T){if(T)if(fe)m=p-Te*Ke;else{var Lt=m;m=Te*Math.floor(m/Te),Math.abs(p-m)/F.getGCD(we,Te)>A&&(m=p-Te*ye,m+=Te*Math.floor((Lt-m)/Te))}else if(k)if(fe)p=m+Te*Ke;else{var Gt=p;p=Te*Math.ceil(p/Te),Math.abs(p-m)/F.getGCD(we,Te)>A&&(p=m+Te*ye,p+=Te*Math.ceil((Gt-p)/Te))}}else if(le.isMultipleYAxis&&fe){var an=Te*Math.floor(m/Te),et=an+Te*Ke;et<p&&(Te*=2),et=p,p=(m=an)+Te*Ke,we=Math.abs(p-m),m>0&&m<Math.abs(et-p)&&(m=0,p=Te*Ke),p<0&&-p<Math.abs(an-m)&&(p=0,m=-Te*Ke)}else m=Te*Math.floor(m/Te),p=Te*Math.ceil(p/Te);we=Math.abs(p-m),Te=F.getGCD(we,Te),Ke=Math.round(we/Te)}if(fe||k||T||(Ke=Math.ceil((we-V)/(Te+V)))>16&&F.getPrimeFactors(Ke).length<2&&Ke++,!fe&&S.forceNiceScale&&le.yValueDecimal===0&&Ke>we&&(Ke=we,Te=Math.round(we/Ke)),Ke>A&&(!fe&&!ce||S.forceNiceScale)){var Pt=F.getPrimeFactors(Ke),qt=Pt.length-1,ft=Ke;e:for(var tt=0;tt<qt;tt++)for(var Bt=0;Bt<=qt-tt;Bt++){for(var gn=Math.min(Bt+tt,qt),tr=ft,Dn=1,er=Bt;er<=gn;er++)Dn*=Pt[er];if((tr/=Dn)<A){ft=tr;break e}}Te=ft===Ke?we:we/ft,Ke=Math.round(we/Te)}le.isMultipleYAxis&&le.multiAxisTickAmount==0&&le.ignoreYAxisIndexes.indexOf(D)<0&&(le.multiAxisTickAmount=Ke);var Sr=m-Te,dr=Te*V;do Sr+=Te,Me.push(F.stripNumber(Sr,7));while(p-Sr>dr);return{result:Me,niceMin:Me[0],niceMax:Me[Me.length-1]}}},{key:"linearScale",value:function(m,p){var S=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,T=Math.abs(p-m),D=[];if(m===p)return{result:D=[m],niceMin:D[0],niceMax:D[D.length-1]};(S=this._adjustTicksForSmallRange(S,A,T))==="dataPoints"&&(S=this.w.globals.dataPoints-1),k||(k=T/S),k=Math.round(10*(k+Number.EPSILON))/10,S===Number.MAX_VALUE&&(S=5,k=1);for(var V=m;S>=0;)D.push(V),V=F.preciseAddition(V,k),S-=1;return{result:D,niceMin:D[0],niceMax:D[D.length-1]}}},{key:"logarithmicScaleNice",value:function(m,p,S){p<=0&&(p=Math.max(m,S)),m<=0&&(m=Math.min(p,S));for(var A=[],k=Math.ceil(Math.log(p)/Math.log(S)+1),T=Math.floor(Math.log(m)/Math.log(S));T<k;T++)A.push(Math.pow(S,T));return{result:A,niceMin:A[0],niceMax:A[A.length-1]}}},{key:"logarithmicScale",value:function(m,p,S){p<=0&&(p=Math.max(m,S)),m<=0&&(m=Math.min(p,S));for(var A=[],k=Math.log(p)/Math.log(S),T=Math.log(m)/Math.log(S),D=k-T,V=Math.round(D),X=D/V,le=0,ce=T;le<V;le++,ce+=X)A.push(Math.pow(S,ce));return A.push(Math.pow(S,k)),{result:A,niceMin:m,niceMax:p}}},{key:"_adjustTicksForSmallRange",value:function(m,p,S){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(S))}return A<m?A:m}},{key:"setYScaleForIndex",value:function(m,p,S){var A=this.w.globals,k=this.w.config,T=A.isBarHorizontal?k.xaxis:k.yaxis[m];A.yAxisScale[m]===void 0&&(A.yAxisScale[m]=[]);var D=Math.abs(S-p);T.logarithmic&&D<=5&&(A.invalidLogScale=!0),T.logarithmic&&D>5?(A.allSeriesCollapsed=!1,A.yAxisScale[m]=T.forceNiceScale?this.logarithmicScaleNice(p,S,T.logBase):this.logarithmicScale(p,S,T.logBase)):S!==-Number.MAX_VALUE&&F.isNumber(S)&&p!==Number.MAX_VALUE&&F.isNumber(p)?(A.allSeriesCollapsed=!1,A.yAxisScale[m]=this.niceScale(p,S,m)):A.yAxisScale[m]=this.niceScale(Number.MIN_VALUE,0,m)}},{key:"setXScale",value:function(m,p){var S=this.w,A=S.globals,k=Math.abs(p-m);if(p!==-Number.MAX_VALUE&&F.isNumber(p)){var T=A.xTickAmount+1;k<10&&k>1&&(T=k),A.xAxisScale=this.linearScale(m,p,T,0,S.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,S=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var A=S.seriesYAxisMap,k=S.minYArr,T=S.maxYArr;S.allSeriesCollapsed=!0,S.barGroups=[],A.forEach(function(D,V){var X=[];D.forEach(function(le){var ce=p.series[le].group;X.indexOf(ce)<0&&X.push(ce)}),D.length>0?function(){var le,ce,fe=Number.MAX_VALUE,ye=-Number.MAX_VALUE,Pe=fe,Me=ye;if(p.chart.stacked)(function(){var Te=new Array(S.dataPoints).fill(0),te=[],ve=[],Be=[];X.forEach(function(){te.push(Te.map(function(){return Number.MIN_VALUE})),ve.push(Te.map(function(){return Number.MIN_VALUE})),Be.push(Te.map(function(){return Number.MIN_VALUE}))});for(var Ue=function(at){!le&&p.series[D[at]].type&&(le=p.series[D[at]].type);var ut=D[at];ce=p.series[ut].group?p.series[ut].group:"axis-".concat(V),!(S.collapsedSeriesIndices.indexOf(ut)<0&&S.ancillaryCollapsedSeriesIndices.indexOf(ut)<0)||(S.allSeriesCollapsed=!1,X.forEach(function(yt,Lt){if(p.series[ut].group===yt)for(var Gt=0;Gt<S.series[ut].length;Gt++){var an=S.series[ut][Gt];an>=0?ve[Lt][Gt]+=an:Be[Lt][Gt]+=an,te[Lt][Gt]+=an,Pe=Math.min(Pe,an),Me=Math.max(Me,an)}})),le!=="bar"&&le!=="column"||S.barGroups.push(ce)},Fe=0;Fe<D.length;Fe++)Ue(Fe);le||(le=p.chart.type),le==="bar"||le==="column"?X.forEach(function(at,ut){fe=Math.min(fe,Math.min.apply(null,Be[ut])),ye=Math.max(ye,Math.max.apply(null,ve[ut]))}):(X.forEach(function(at,ut){Pe=Math.min(Pe,Math.min.apply(null,te[ut])),Me=Math.max(Me,Math.max.apply(null,te[ut]))}),fe=Pe,ye=Me),fe===Number.MIN_VALUE&&ye===Number.MIN_VALUE&&(ye=-Number.MAX_VALUE)})();else for(var Ke=0;Ke<D.length;Ke++){var we=D[Ke];fe=Math.min(fe,k[we]),ye=Math.max(ye,T[we]),!(S.collapsedSeriesIndices.indexOf(we)<0&&S.ancillaryCollapsedSeriesIndices.indexOf(we)<0)||(S.allSeriesCollapsed=!1)}p.yaxis[V].min!==void 0&&(fe=typeof p.yaxis[V].min=="function"?p.yaxis[V].min(fe):p.yaxis[V].min),p.yaxis[V].max!==void 0&&(ye=typeof p.yaxis[V].max=="function"?p.yaxis[V].max(ye):p.yaxis[V].max),S.barGroups=S.barGroups.filter(function(Te,te,ve){return ve.indexOf(Te)===te}),m.setYScaleForIndex(V,fe,ye),D.forEach(function(Te){k[Te]=S.yAxisScale[V].niceMin,T[Te]=S.yAxisScale[V].niceMax})}():m.setYScaleForIndex(V,0,-Number.MAX_VALUE)})}}]),ke}(),He=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.scales=new st(m)}return o(ke,[{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,S=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,T=this.w.globals,D=-Number.MAX_VALUE,V=Number.MIN_VALUE;A===null&&(A=m+1);var X=T.series,le=X,ce=X;k.chart.type==="candlestick"?(le=T.seriesCandleL,ce=T.seriesCandleH):k.chart.type==="boxPlot"?(le=T.seriesCandleO,ce=T.seriesCandleC):T.isRangeData&&(le=T.seriesRangeStart,ce=T.seriesRangeEnd);var fe=!1;if(T.seriesX.length>=A){var ye,Pe=(ye=T.brushSource)===null||ye===void 0?void 0:ye.w.config.chart.brush;(k.chart.zoom.enabled&&k.chart.zoom.autoScaleYaxis||Pe!=null&&Pe.enabled&&Pe!=null&&Pe.autoScaleYaxis)&&(fe=!0)}for(var Me=m;Me<A;Me++){T.dataPoints=Math.max(T.dataPoints,X[Me].length);var Ke=k.series[Me].type;T.categoryLabels.length&&(T.dataPoints=T.categoryLabels.filter(function(Be){return Be!==void 0}).length),T.labels.length&&k.xaxis.type!=="datetime"&&T.series.reduce(function(Be,Ue){return Be+Ue.length},0)!==0&&(T.dataPoints=Math.max(T.dataPoints,T.labels.length));var we=0,Te=X[Me].length-1;if(fe){if(k.xaxis.min)for(;we<Te&&T.seriesX[Me][we]<k.xaxis.min;we++);if(k.xaxis.max)for(;Te>we&&T.seriesX[Me][Te]>k.xaxis.max;Te--);}for(var te=we;te<=Te&&te<T.series[Me].length;te++){var ve=X[Me][te];if(ve!==null&&F.isNumber(ve)){switch(ce[Me][te]!==void 0&&(D=Math.max(D,ce[Me][te]),p=Math.min(p,ce[Me][te])),le[Me][te]!==void 0&&(p=Math.min(p,le[Me][te]),S=Math.max(S,le[Me][te])),Ke){case"candlestick":T.seriesCandleC[Me][te]!==void 0&&(D=Math.max(D,T.seriesCandleH[Me][te]),p=Math.min(p,T.seriesCandleL[Me][te]));break;case"boxPlot":T.seriesCandleC[Me][te]!==void 0&&(D=Math.max(D,T.seriesCandleC[Me][te]),p=Math.min(p,T.seriesCandleO[Me][te]))}Ke&&Ke!=="candlestick"&&Ke!=="boxPlot"&&Ke!=="rangeArea"&&Ke!=="rangeBar"&&(D=Math.max(D,T.series[Me][te]),p=Math.min(p,T.series[Me][te])),S=D,T.seriesGoals[Me]&&T.seriesGoals[Me][te]&&Array.isArray(T.seriesGoals[Me][te])&&T.seriesGoals[Me][te].forEach(function(Be){V!==Number.MIN_VALUE&&(V=Math.min(V,Be.value),p=V),D=Math.max(D,Be.value),S=D}),F.isFloat(ve)&&(ve=F.noExponents(ve),T.yValueDecimal=Math.max(T.yValueDecimal,ve.toString().split(".")[1].length)),V>le[Me][te]&&le[Me][te]<0&&(V=le[Me][te])}else T.hasNullValues=!0}Ke!=="bar"&&Ke!=="column"||(V<0&&D<0&&(D=0,S=Math.max(S,0)),V===Number.MIN_VALUE&&(V=0,p=Math.min(p,0)))}return k.chart.type==="rangeBar"&&T.seriesRangeStart.length&&T.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:S}}},{key:"setYRange",value:function(){var m=this.w.globals,p=this.w.config;m.maxY=-Number.MAX_VALUE,m.minY=Number.MIN_VALUE;var S,A=Number.MAX_VALUE;if(m.isMultipleYAxis){A=Number.MAX_VALUE;for(var k=0;k<m.series.length;k++)S=this.getMinYMaxY(k),m.minYArr[k]=S.lowestY,m.maxYArr[k]=S.highestY,A=Math.min(A,S.lowestY)}return S=this.getMinYMaxY(0,A,null,m.series.length),p.chart.type==="bar"?(m.minY=S.minY,m.maxY=S.maxY):(m.minY=S.lowestY,m.maxY=S.highestY),A=S.lowestY,p.chart.stacked&&this._setStackedMinMax(),p.chart.type==="line"||p.chart.type==="area"||p.chart.type==="scatter"||p.chart.type==="candlestick"||p.chart.type==="boxPlot"||p.chart.type==="rangeBar"&&!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(S.minY,m.minY):S.minY,p.yaxis.forEach(function(T,D){T.max!==void 0&&(typeof T.max=="number"?m.maxYArr[D]=T.max:typeof T.max=="function"&&(m.maxYArr[D]=T.max(m.isMultipleYAxis?m.maxYArr[D]:m.maxY)),m.maxY=m.maxYArr[D]),T.min!==void 0&&(typeof T.min=="number"?m.minYArr[D]=T.min:typeof T.min=="function"&&(m.minYArr[D]=T.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(T){p.xaxis[T]!==void 0&&typeof p.xaxis[T]=="number"&&(T==="min"?m.minY=p.xaxis[T]:m.maxY=p.xaxis[T])}),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(T){switch(T.type||p.chart.type){case"bar":case"column":m.barGroups.push(T.group);break;case"line":m.lineGroups.push(T.group);break;case"area":m.areaGroups.push(T.group)}}),m.barGroups=m.barGroups.filter(function(T,D,V){return V.indexOf(T)===D}),m.lineGroups=m.lineGroups.filter(function(T,D,V){return V.indexOf(T)===D}),m.areaGroups=m.areaGroups.filter(function(T,D,V){return V.indexOf(T)===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,S=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 X=0;X<m.labels[V].length;X++)m.labels[V][X]!==null&&F.isNumber(m.labels[V][X])&&(m.maxX=Math.max(m.maxX,m.labels[V][X]),m.initialMaxX=Math.max(m.maxX,m.labels[V][X]),m.minX=Math.min(m.minX,m.labels[V][X]),m.initialMinX=Math.min(m.minX,m.labels[V][X]))}(),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 T=[],D=m.minX-1;D<m.maxX;D++)T.push(D+1);m.xAxisScale={result:T,niceMin:T[0],niceMax:T[T.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());S&&(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 S=0;S<m.seriesZ[p].length;S++)m.seriesZ[p][S]!==null&&F.isNumber(m.seriesZ[p][S])&&(m.maxZ=Math.max(m.maxZ,m.seriesZ[p][S]),m.minZ=Math.min(m.minZ,m.seriesZ[p][S]))}}},{key:"_handleSingleDataPoint",value:function(){var m=this.w.globals,p=this.w.config;if(m.minX===m.maxX){var S=new K(this.ctx);if(p.xaxis.type==="datetime"){var A=S.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=S.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,S){p.length===1&&p.push(m.seriesX[m.maxValsInArrayIndex][m.seriesX[m.maxValsInArrayIndex].length-1]);var A=p.slice();A.sort(function(k,T){return k-T}),A.forEach(function(k,T){if(T>0){var D=k-A[T-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 S=p.seriesGroups;S.length||(S=[this.w.globals.seriesNames.map(function(T){return T})]);var A={},k={};S.forEach(function(T){A[T]=[],k[T]=[],m.w.config.series.map(function(D,V){return T.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 X,le,ce,fe;A[T][V]===void 0&&(A[T][V]=0,k[T][V]=0),(m.w.config.chart.stacked&&!p.comboCharts||m.w.config.chart.stacked&&p.comboCharts&&(!m.w.config.chart.stackOnlyBar||((X=m.w.config.series)===null||X===void 0||(le=X[D])===null||le===void 0?void 0:le.type)==="bar"||((ce=m.w.config.series)===null||ce===void 0||(fe=ce[D])===null||fe===void 0?void 0:fe.type)==="column"))&&p.series[D][V]!==null&&F.isNumber(p.series[D][V])&&(p.series[D][V]>0?A[T][V]+=parseFloat(p.series[D][V])+1e-4:k[T][V]+=parseFloat(p.series[D][V]))}})}),Object.entries(A).forEach(function(T){var D=C(T,1)[0];A[D].forEach(function(V,X){p.maxY=Math.max(p.maxY,A[D][X]),p.minY=Math.min(p.minY,k[D][X])})})}}}]),ke}(),Ve=function(){function ke(m,p){s(this,ke),this.ctx=m,this.elgrid=p,this.w=m.w;var S=this.w;this.xaxisFontSize=S.config.xaxis.labels.style.fontSize,this.axisFontFamily=S.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=S.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal=S.config.chart.type==="bar"&&S.config.plotOptions.bar.horizontal,this.xAxisoffX=S.config.xaxis.position==="bottom"?S.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new de(m)}return o(ke,[{key:"drawYaxis",value:function(m){var p=this.w,S=new z(this.ctx),A=p.config.yaxis[m].labels.style,k=A.fontSize,T=A.fontFamily,D=A.fontWeight,V=S.group({class:"apexcharts-yaxis",rel:m,transform:"translate(".concat(p.globals.translateYAxisX[m],", 0)")});if(this.axesUtils.isYAxisHidden(m))return V;var X=S.group({class:"apexcharts-yaxis-texts-g"});V.add(X);var le=p.globals.yAxisScale[m].result.length-1,ce=p.globals.gridHeight/le,fe=p.globals.yLabelFormatters[m],ye=this.axesUtils.checkForReversedLabels(m,p.globals.yAxisScale[m].result.slice());if(p.config.yaxis[m].labels.show){var Pe=p.globals.translateY+p.config.yaxis[m].labels.offsetY;p.globals.isBarHorizontal?Pe=0:p.config.chart.type==="heatmap"&&(Pe-=ce/2),Pe+=parseInt(k,10)/3;for(var Me=le;Me>=0;Me--){var Ke=fe(ye[Me],Me,p),we=p.config.yaxis[m].labels.padding;p.config.yaxis[m].opposite&&p.config.yaxis.length!==0&&(we*=-1);var Te=this.getTextAnchor(p.config.yaxis[m].labels.align,p.config.yaxis[m].opposite),te=this.axesUtils.getYAxisForeColor(A.colors,m),ve=Array.isArray(te)?te[Me]:te,Be=F.listToArray(p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-label tspan"))).map(function(Fe){return Fe.textContent}),Ue=S.drawText({x:we,y:Pe,text:Be.includes(Ke)&&!p.config.yaxis[m].labels.showDuplicates?"":Ke,textAnchor:Te,fontSize:k,fontFamily:T,fontWeight:D,maxWidth:p.config.yaxis[m].labels.maxWidth,foreColor:ve,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(A.cssClass)});X.add(Ue),this.addTooltip(Ue,Ke),p.config.yaxis[m].labels.rotate!==0&&this.rotateLabel(S,Ue,firstLabel,p.config.yaxis[m].labels.rotate),Pe+=ce}}return this.addYAxisTitle(S,V,m),this.addAxisBorder(S,V,m,le,ce),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 S=document.createElementNS(this.w.globals.SVGNS,"title");S.textContent=Array.isArray(p)?p.join(" "):p,m.node.appendChild(S)}},{key:"rotateLabel",value:function(m,p,S,A){var k=m.rotateAroundCenter(S.node),T=m.rotateAroundCenter(p.node);p.node.setAttribute("transform","rotate(".concat(A," ").concat(k.x," ").concat(T.y,")"))}},{key:"addYAxisTitle",value:function(m,p,S){var A=this.w;if(A.config.yaxis[S].title.text!==void 0){var k=m.group({class:"apexcharts-yaxis-title"}),T=A.config.yaxis[S].opposite?A.globals.translateYAxisX[S]:0,D=m.drawText({x:T,y:A.globals.gridHeight/2+A.globals.translateY+A.config.yaxis[S].title.offsetY,text:A.config.yaxis[S].title.text,textAnchor:"end",foreColor:A.config.yaxis[S].title.style.color,fontSize:A.config.yaxis[S].title.style.fontSize,fontWeight:A.config.yaxis[S].title.style.fontWeight,fontFamily:A.config.yaxis[S].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(A.config.yaxis[S].title.style.cssClass)});k.add(D),p.add(k)}}},{key:"addAxisBorder",value:function(m,p,S,A,k){var T=this.w,D=T.config.yaxis[S].axisBorder,V=31+D.offsetX;if(T.config.yaxis[S].opposite&&(V=-31-D.offsetX),D.show){var X=m.drawLine(V,T.globals.translateY+D.offsetY-2,V,T.globals.gridHeight+T.globals.translateY+D.offsetY+2,D.color,0,D.width);p.add(X)}T.config.yaxis[S].axisTicks.show&&this.axesUtils.drawYAxisTicks(V,A,D,T.config.yaxis[S].axisTicks,S,k,p)}},{key:"drawYaxisInversed",value:function(m){var p=this.w,S=new z(this.ctx),A=S.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),k=S.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(p.globals.translateXAxisX,", ").concat(p.globals.translateXAxisY,")")});A.add(k);var T=p.globals.yAxisScale[m].result.length-1,D=p.globals.gridWidth/T+.1,V=D+p.config.xaxis.labels.offsetX,X=p.globals.xLabelFormatter,le=this.axesUtils.checkForReversedLabels(m,p.globals.yAxisScale[m].result.slice()),ce=p.globals.timescaleLabels;if(ce.length>0&&(this.xaxisLabels=ce.slice(),T=(le=ce.slice()).length),p.config.xaxis.labels.show)for(var fe=ce.length?0:T;ce.length?fe<ce.length:fe>=0;ce.length?fe++:fe--){var ye=X(le[fe],fe,p),Pe=p.globals.gridWidth+p.globals.padHorizontal-(V-D+p.config.xaxis.labels.offsetX);if(ce.length){var Me=this.axesUtils.getLabel(le,ce,Pe,fe,this.drawnLabels,this.xaxisFontSize);Pe=Me.x,ye=Me.text,this.drawnLabels.push(Me.text),fe===0&&p.globals.skipFirstTimelinelabel&&(ye=""),fe===le.length-1&&p.globals.skipLastTimelinelabel&&(ye="")}var Ke=S.drawText({x:Pe,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:ye,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(Ke),Ke.tspan(ye),this.addTooltip(Ke,ye),V+=D}return this.inversedYAxisTitleText(A),this.inversedYAxisBorder(A),A}},{key:"inversedYAxisBorder",value:function(m){var p=this.w,S=new z(this.ctx),A=p.config.xaxis.axisBorder;if(A.show){var k=0;p.config.chart.type==="bar"&&p.globals.isXNumeric&&(k-=15);var T=S.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(T):m.add(T)}}},{key:"inversedYAxisTitleText",value:function(m){var p=this.w,S=new z(this.ctx);if(p.config.xaxis.title.text!==void 0){var A=S.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),k=S.drawText({x:p.globals.gridWidth/2+p.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(p.config.xaxis.title.style.fontSize)+p.config.xaxis.title.offsetY+20,text:p.config.xaxis.title.text,textAnchor:"middle",fontSize:p.config.xaxis.title.style.fontSize,fontFamily:p.config.xaxis.title.style.fontFamily,fontWeight:p.config.xaxis.title.style.fontWeight,foreColor:p.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(p.config.xaxis.title.style.cssClass)});A.add(k),m.add(A)}}},{key:"yAxisTitleRotate",value:function(m,p){var S=this.w,A=new z(this.ctx),k=S.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-texts-g")),T=k?k.getBoundingClientRect():{width:0,height:0},D=S.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(m,"'] .apexcharts-yaxis-title text")),V=D?D.getBoundingClientRect():{width:0,height:0};if(D){var X=this.xPaddingForYAxisTitle(m,T,V,p);D.setAttribute("x",X.xPos-(p?10:0));var le=A.rotateAroundCenter(D);D.setAttribute("transform","rotate(".concat(p?-1*S.config.yaxis[m].title.rotate:S.config.yaxis[m].title.rotate," ").concat(le.x," ").concat(le.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(m,p,S,A){var k=this.w,T=0,D=10;return k.config.yaxis[m].title.text===void 0||m<0?{xPos:T,padd:0}:(A?T=p.width+k.config.yaxis[m].title.offsetX+S.width/2+D/2:(T=-1*p.width+k.config.yaxis[m].title.offsetX+D/2+S.width/2,k.globals.isBarHorizontal&&(D=25,T=-1*p.width-k.config.yaxis[m].title.offsetX-D)),{xPos:T,padd:D})}},{key:"setYAxisXPosition",value:function(m,p){var S=this.w,A=0,k=0,T=18,D=1;S.config.yaxis.length>1&&(this.multipleYs=!0),S.config.yaxis.forEach(function(V,X){var le=S.globals.ignoreYAxisIndexes.includes(X)||!V.show||V.floating||m[X].width===0,ce=m[X].width+p[X].width;V.opposite?S.globals.isBarHorizontal?(k=S.globals.gridWidth+S.globals.translateX-1,S.globals.translateYAxisX[X]=k-V.labels.offsetX):(k=S.globals.gridWidth+S.globals.translateX+D,le||(D+=ce+20),S.globals.translateYAxisX[X]=k-V.labels.offsetX+20):(A=S.globals.translateX-T,le||(T+=ce+20),S.globals.translateYAxisX[X]=A+V.labels.offsetX)})}},{key:"setYAxisTextAlignments",value:function(){var m=this.w;F.listToArray(m.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach(function(p,S){var A=m.config.yaxis[S];if(A&&!A.floating&&A.labels.align!==void 0){var k=m.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(S,"'] .apexcharts-yaxis-texts-g")),T=F.listToArray(m.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(S,"'] .apexcharts-yaxis-label"))),D=k.getBoundingClientRect();T.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)"))}})}}]),ke}(),bt=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.documentEvent=F.bind(this.documentEvent,this)}return o(ke,[{key:"addEventListener",value:function(m,p){var S=this.w;S.globals.events.hasOwnProperty(m)?S.globals.events[m].push(p):S.globals.events[m]=[p]}},{key:"removeEventListener",value:function(m,p){var S=this.w;if(S.globals.events.hasOwnProperty(m)){var A=S.globals.events[m].indexOf(p);A!==-1&&S.globals.events[m].splice(A,1)}}},{key:"fireEvent",value:function(m,p){var S=this.w;if(S.globals.events.hasOwnProperty(m)){p&&p.length||(p=[]);for(var A=S.globals.events[m],k=A.length,T=0;T<k;T++)A[T].apply(null,p)}}},{key:"setupEventHandlers",value:function(){var m=this,p=this.w,S=this.ctx,A=p.globals.dom.baseEl.querySelector(p.globals.chartClass);this.ctx.eventList.forEach(function(k){A.addEventListener(k,function(T){var D=Object.assign({},p,{seriesIndex:p.globals.axisCharts?p.globals.capturedSeriesIndex:0,dataPointIndex:p.globals.capturedDataPointIndex});T.type==="mousemove"||T.type==="touchmove"?typeof p.config.chart.events.mouseMove=="function"&&p.config.chart.events.mouseMove(T,S,D):T.type==="mouseleave"||T.type==="touchleave"?typeof p.config.chart.events.mouseLeave=="function"&&p.config.chart.events.mouseLeave(T,S,D):(T.type==="mouseup"&&T.which===1||T.type==="touchend")&&(typeof p.config.chart.events.click=="function"&&p.config.chart.events.click(T,S,D),S.ctx.events.fireEvent("click",[T,S,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,S=m.target.className;if(m.type==="click"){var A=p.globals.dom.baseEl.querySelector(".apexcharts-menu");A&&A.classList.contains("apexcharts-menu-open")&&S!=="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}}]),ke}(),xt=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{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 S=p.filter(function(k){return k.name===m})[0];if(!S)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var A=F.extend(ae,S);this.w.globals.locale=A.options}}]),ke}(),Qt=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"drawAxis",value:function(m,p){var S,A,k=this,T=this.w.globals,D=this.w.config,V=new ht(this.ctx,p),X=new Ve(this.ctx,p);T.axisCharts&&m!=="radar"&&(T.isBarHorizontal?(A=X.drawYaxisInversed(0),S=V.drawXaxisInversed(0),T.dom.elGraphical.add(S),T.dom.elGraphical.add(A)):(S=V.drawXaxis(),T.dom.elGraphical.add(S),D.yaxis.map(function(le,ce){if(T.ignoreYAxisIndexes.indexOf(ce)===-1&&(A=X.drawYaxis(ce),T.dom.Paper.add(A),k.w.config.grid.position==="back")){var fe=T.dom.Paper.children()[1];fe.remove(),T.dom.Paper.add(fe)}})))}}]),ke}(),St=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"drawXCrosshairs",value:function(){var m=this.w,p=new z(this.ctx),S=new L(this.ctx),A=m.config.xaxis.crosshairs.fill.gradient,k=m.config.xaxis.crosshairs.dropShadow,T=m.config.xaxis.crosshairs.fill.type,D=A.colorFrom,V=A.colorTo,X=A.opacityFrom,le=A.opacityTo,ce=A.stops,fe=k.enabled,ye=k.left,Pe=k.top,Me=k.blur,Ke=k.color,we=k.opacity,Te=m.config.xaxis.crosshairs.fill.color;if(m.config.xaxis.crosshairs.show){T==="gradient"&&(Te=p.drawGradient("vertical",D,V,X,le,null,ce,null));var te=p.drawRect();m.config.xaxis.crosshairs.width===1&&(te=p.drawLine());var ve=m.globals.gridHeight;(!F.isNumber(ve)||ve<0)&&(ve=0);var Be=m.config.xaxis.crosshairs.width;(!F.isNumber(Be)||Be<0)&&(Be=0),te.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:ve,width:Be,height:ve,fill:Te,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}),fe&&(te=S.dropShadow(te,{left:ye,top:Pe,blur:Me,color:Ke,opacity:we})),m.globals.dom.elGraphical.add(te)}}},{key:"drawYCrosshairs",value:function(){var m=this.w,p=new z(this.ctx),S=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,S.stroke.color,S.stroke.dashArray,S.stroke.width);k.attr({class:"apexcharts-ycrosshairs"}),m.globals.dom.elGraphical.add(k)}var T=p.drawLine(-A,0,m.globals.gridWidth+A,0,S.stroke.color,0,0);T.attr({class:"apexcharts-ycrosshairs-hidden"}),m.globals.dom.elGraphical.add(T)}}]),ke}(),on=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"checkResponsiveConfig",value:function(m){var p=this,S=this.w,A=S.config;if(A.responsive.length!==0){var k=A.responsive.slice();k.sort(function(X,le){return X.breakpoint>le.breakpoint?1:le.breakpoint>X.breakpoint?-1:0}).reverse();var T=new _e({}),D=function(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},le=k[0].breakpoint,ce=window.innerWidth>0?window.innerWidth:screen.width;if(ce>le){var fe=F.clone(S.globals.initialConfig);fe.series=F.clone(S.config.series);var ye=Q.extendArrayProps(T,fe,S);X=F.extend(ye,X),X=F.extend(S.config,X),p.overrideResponsiveOptions(X)}else for(var Pe=0;Pe<k.length;Pe++)ce<k[Pe].breakpoint&&(X=Q.extendArrayProps(T,k[Pe].options,S),X=F.extend(S.config,X),p.overrideResponsiveOptions(X))};if(m){var V=Q.extendArrayProps(T,m,S);V=F.extend(S.config,V),D(V=F.extend(V,m))}else D({})}}},{key:"overrideResponsiveOptions",value:function(m){var p=new _e(m).init({responsiveOverride:!0});this.w.config=p}}]),ke}(),cn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.colors=[],this.isColorFn=!1,this.isHeatmapDistributed=this.checkHeatmapDistributed(),this.isBarDistributed=this.checkBarDistributed()}return o(ke,[{key:"checkHeatmapDistributed",value:function(){var m=this.w.config,p=m.chart,S=m.plotOptions;return p.type==="treemap"&&S.treemap&&S.treemap.distributed||p.type==="heatmap"&&S.heatmap&&S.heatmap.distributed}},{key:"checkBarDistributed",value:function(){var m=this.w.config,p=m.chart,S=m.plotOptions;return S.bar&&S.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 S=N(m.config.colors||m.config.fill.colors||[]);m.globals.colors=this.getColors(S),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,S=this.w;return m&&m.length!==0?Array.isArray(m)&&m.length>0&&typeof m[0]=="function"?(this.isColorFn=!0,S.config.series.map(function(A,k){var T=m[k]||m[0];return typeof T=="function"?T({value:S.globals.axisCharts?S.globals.series[k][0]||0:S.globals.series[k],seriesIndex:k,dataPointIndex:k,w:p.w}):T})):m:this.predefined()}},{key:"applySeriesColors",value:function(m,p){m.forEach(function(S,A){S&&(p[A]=S)})}},{key:"getMonochromeColors",value:function(m,p,S){var A=m.color,k=m.shadeIntensity,T=m.shadeTo,D=this.isBarDistributed||this.isHeatmapDistributed?p[0].length*p.length:p.length,V=1/(D/k),X=0;return Array.from({length:D},function(){var le=T==="dark"?S.shadeColor(-1*X,A):S.shadeColor(X,A);return X+=V,le})}},{key:"applyColorTypes",value:function(m,p){var S=this,A=this.w;m.forEach(function(k){A.globals[k].colors=A.config[k].colors===void 0?S.isColorFn?A.config.colors:p:A.config[k].colors.slice(),S.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 S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=this.w,k=p||A.globals.series.length;if(S===null&&(S=this.isBarDistributed||this.isHeatmapDistributed||A.config.chart.type==="heatmap"&&A.config.plotOptions.heatmap&&A.config.plotOptions.heatmap.colorScale.inverse),S&&A.globals.series.length&&(k=A.globals.series[A.globals.maxValsInArrayIndex].length*A.globals.series.length),m.length<k)for(var T=k-m.length,D=0;D<T;D++)m.push(m[D])}},{key:"updateThemeOptions",value:function(m){m.chart=m.chart||{},m.tooltip=m.tooltip||{};var p=m.theme.mode,S=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=S,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}}]),ke}(),Vn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"draw",value:function(){this.drawTitleSubtitle("title"),this.drawTitleSubtitle("subtitle")}},{key:"drawTitleSubtitle",value:function(m){var p=this.w,S=m==="title"?p.config.title:p.config.subtitle,A=p.globals.svgWidth/2,k=S.offsetY,T="middle";if(S.align==="left"?(A=10,T="start"):S.align==="right"&&(A=p.globals.svgWidth-10,T="end"),A+=S.offsetX,k=k+parseInt(S.style.fontSize,10)+S.margin/2,S.text!==void 0){var D=new z(this.ctx).drawText({x:A,y:k,text:S.text,textAnchor:T,fontSize:S.style.fontSize,fontFamily:S.style.fontFamily,fontWeight:S.style.fontWeight,foreColor:S.style.color,opacity:1});D.node.setAttribute("class","apexcharts-".concat(m,"-text")),p.globals.dom.Paper.add(D)}}}]),ke}(),tn=function(){function ke(m){s(this,ke),this.w=m.w,this.dCtx=m}return o(ke,[{key:"getTitleSubtitleCoords",value:function(m){var p=this.w,S=0,A=0,k=m==="title"?p.config.title.floating:p.config.subtitle.floating,T=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(m,"-text"));if(T!==null&&!k){var D=T.getBoundingClientRect();S=D.width,A=p.globals.axisCharts?D.height+5:D.height}return{width:S,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 S=Object.assign({},F.getBoundingClientRect(p));return p!==null&&!m.config.legend.floating&&m.config.legend.show?this.dCtx.lgRect={x:S.x,y:S.y,height:S.height,width:S.height===0?0:S.width}:this.dCtx.lgRect={x:0,y:0,height:0,width:0},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,S=[];p.config.series.forEach(function(V,X){V.data.forEach(function(le,ce){var fe;fe=p.globals.series[X][ce],A=p.config.dataLabels.formatter(fe,{ctx:m.dCtx.ctx,seriesIndex:X,dataPointIndex:ce,w:p}),S.push(A)})});var A=F.getLargestStringFromArr(S),k=new z(this.dCtx.ctx),T=p.config.dataLabels.style,D=k.getTextRects(A,parseInt(T.fontSize),T.fontFamily);return{width:1.05*D.width,height:D.height}}},{key:"getLargestStringFromMultiArr",value:function(m,p){var S=m;if(this.w.globals.isMultiLineX){var A=p.map(function(T,D){return Array.isArray(T)?T.length:1}),k=Math.max.apply(Math,N(A));S=p[A.indexOf(k)]}return S}}]),ke}(),fn=function(){function ke(m){s(this,ke),this.w=m.w,this.dCtx=m}return o(ke,[{key:"getxAxisLabelsCoords",value:function(){var m,p=this.w,S=p.globals.labels.slice();if(p.config.xaxis.convertedCatToNumeric&&S.length===0&&(S=p.globals.categoryLabels),p.globals.timescaleLabels.length>0){var 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,T=F.getLargestStringFromArr(S),D=this.dCtx.dimHelpers.getLargestStringFromMultiArr(T,S);p.globals.isBarHorizontal&&(D=T=p.globals.yAxisScale[0].result.reduce(function(Pe,Me){return Pe.length>Me.length?Pe:Me},0));var V=new re(this.dCtx.ctx),X=T;T=V.xLabelFormat(k,T,X,{i:void 0,dateFormatter:new K(this.dCtx.ctx).formatDate,w:p}),D=V.xLabelFormat(k,D,X,{i:void 0,dateFormatter:new K(this.dCtx.ctx).formatDate,w:p}),(p.config.xaxis.convertedCatToNumeric&&T===void 0||String(T).trim()==="")&&(D=T="1");var le=new z(this.dCtx.ctx),ce=le.getTextRects(T,p.config.xaxis.labels.style.fontSize),fe=ce;if(T!==D&&(fe=le.getTextRects(D,p.config.xaxis.labels.style.fontSize)),(m={width:ce.width>=fe.width?ce.width:fe.width,height:ce.height>=fe.height?ce.height:fe.height}).width*S.length>p.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&p.config.xaxis.labels.rotate!==0||p.config.xaxis.labels.rotateAlways){if(!p.globals.isBarHorizontal){p.globals.rotateXLabels=!0;var ye=function(Pe){return le.getTextRects(Pe,p.config.xaxis.labels.style.fontSize,p.config.xaxis.labels.style.fontFamily,"rotate(".concat(p.config.xaxis.labels.rotate," 0 0)"),!1)};ce=ye(T),T!==D&&(fe=ye(D)),m.height=(ce.height>fe.height?ce.height:fe.height)/1.5,m.width=ce.width>fe.width?ce.width:fe.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 S,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(ce){return ce.title}),T=F.getLargestStringFromArr(k),D=this.dCtx.dimHelpers.getLargestStringFromMultiArr(T,k),V=new z(this.dCtx.ctx),X=V.getTextRects(T,A),le=X;return T!==D&&(le=V.getTextRects(D,A)),S={width:X.width>=le.width?X.width:le.width,height:X.height>=le.height?X.height:le.height},p.config.xaxis.labels.show||(S={width:0,height:0}),{width:S.width,height:S.height}}},{key:"getxAxisTitleCoords",value:function(){var m=this.w,p=0,S=0;if(m.config.xaxis.title.text!==void 0){var A=new z(this.dCtx.ctx).getTextRects(m.config.xaxis.title.text,m.config.xaxis.title.style.fontSize);p=A.width,S=A.height}return{width:p,height:S}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var m,p=this.w;this.dCtx.timescaleLabels=p.globals.timescaleLabels.slice();var S=this.dCtx.timescaleLabels.map(function(k){return k.value}),A=S.reduce(function(k,T){return k===void 0?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):k.length>T.length?k:T},0);return 1.05*(m=new z(this.dCtx.ctx).getTextRects(A,p.config.xaxis.labels.style.fontSize)).width*S.length>p.globals.gridWidth&&p.config.xaxis.labels.rotate!==0&&(p.globals.overlappingXLabels=!0),m}},{key:"additionalPaddingXLabels",value:function(m){var p=this,S=this.w,A=S.globals,k=S.config,T=k.xaxis.type,D=m.width;A.skipLastTimelinelabel=!1,A.skipFirstTimelinelabel=!1;var V=S.config.yaxis[0].opposite&&S.globals.isBarHorizontal,X=function(le,ce){k.yaxis.length>1&&function(fe){return A.collapsedSeriesIndices.indexOf(fe)!==-1}(ce)||function(fe){if(p.dCtx.timescaleLabels&&p.dCtx.timescaleLabels.length){var ye=p.dCtx.timescaleLabels[0],Pe=p.dCtx.timescaleLabels[p.dCtx.timescaleLabels.length-1].position+D/1.75-p.dCtx.yAxisWidthRight,Me=ye.position-D/1.75+p.dCtx.yAxisWidthLeft,Ke=S.config.legend.position==="right"&&p.dCtx.lgRect.width>0?p.dCtx.lgRect.width:0;Pe>A.svgWidth-A.translateX-Ke&&(A.skipLastTimelinelabel=!0),Me<-(fe.show&&!fe.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 T==="datetime"?p.dCtx.gridPad.right<D&&!A.rotateXLabels&&(A.skipLastTimelinelabel=!0):T!=="datetime"&&p.dCtx.gridPad.right<D/2-p.dCtx.yAxisWidthRight&&!A.rotateXLabels&&!S.config.xaxis.labels.trim&&(p.dCtx.xPadRight=D/2+1)}(le)};k.yaxis.forEach(function(le,ce){V?(p.dCtx.gridPad.left<D&&(p.dCtx.xPadLeft=D/2+1),p.dCtx.xPadRight=D/2+1):X(le,ce)})}}]),ke}(),rn=function(){function ke(m){s(this,ke),this.w=m.w,this.dCtx=m}return o(ke,[{key:"getyAxisLabelsCoords",value:function(){var m=this,p=this.w,S=[],A=10,k=new de(this.dCtx.ctx);return p.config.yaxis.map(function(T,D){var V={seriesIndex:D,dataPointIndex:-1,w:p},X=p.globals.yAxisScale[D],le=0;if(!k.isYAxisHidden(D)&&T.labels.show&&T.labels.minWidth!==void 0&&(le=T.labels.minWidth),!k.isYAxisHidden(D)&&T.labels.show&&X.result.length){var ce=p.globals.yLabelFormatters[D],fe=X.niceMin===Number.MIN_VALUE?0:X.niceMin,ye=X.result.reduce(function(ve,Be){var Ue,Fe;return((Ue=String(ce(ve,V)))===null||Ue===void 0?void 0:Ue.length)>((Fe=String(ce(Be,V)))===null||Fe===void 0?void 0:Fe.length)?ve:Be},fe),Pe=ye=ce(ye,V);if(ye!==void 0&&ye.length!==0||(ye=X.niceMax),p.globals.isBarHorizontal){A=0;var Me=p.globals.labels.slice();ye=F.getLargestStringFromArr(Me),ye=ce(ye,{seriesIndex:D,dataPointIndex:-1,w:p}),Pe=m.dCtx.dimHelpers.getLargestStringFromMultiArr(ye,Me)}var Ke=new z(m.dCtx.ctx),we="rotate(".concat(T.labels.rotate," 0 0)"),Te=Ke.getTextRects(ye,T.labels.style.fontSize,T.labels.style.fontFamily,we,!1),te=Te;ye!==Pe&&(te=Ke.getTextRects(Pe,T.labels.style.fontSize,T.labels.style.fontFamily,we,!1)),S.push({width:(le>te.width||le>Te.width?le:te.width>Te.width?te.width:Te.width)+A,height:te.height>Te.height?te.height:Te.height})}else S.push({width:0,height:0})}),S}},{key:"getyAxisTitleCoords",value:function(){var m=this,p=this.w,S=[];return p.config.yaxis.map(function(A,k){if(A.show&&A.title.text!==void 0){var T=new z(m.dCtx.ctx),D="rotate(".concat(A.title.rotate," 0 0)"),V=T.getTextRects(A.title.text,A.title.style.fontSize,A.title.style.fontFamily,D,!1);S.push({width:V.width,height:V.height})}else S.push({width:0,height:0})}),S}},{key:"getTotalYAxisWidth",value:function(){var m=this.w,p=0,S=0,A=0,k=m.globals.yAxisScale.length>1?10:0,T=new de(this.dCtx.ctx),D=function(V,X){var le=m.config.yaxis[X].floating,ce=0;V.width>0&&!le?(ce=V.width+k,function(fe){return m.globals.ignoreYAxisIndexes.indexOf(fe)>-1}(X)&&(ce=ce-V.width-k)):ce=le||T.isYAxisHidden(X)?0:5,m.config.yaxis[X].opposite?A+=ce:S+=ce,p+=ce};return m.globals.yLabelsCoords.map(function(V,X){D(V,X)}),m.globals.yTitleCoords.map(function(V,X){D(V,X)}),m.globals.isBarHorizontal&&!m.config.yaxis[0].floating&&(p=m.globals.yLabelsCoords[0].width+m.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=S,this.dCtx.yAxisWidthRight=A,p}}]),ke}(),nt=function(){function ke(m){s(this,ke),this.w=m.w,this.dCtx=m}return o(ke,[{key:"gridPadForColumnsInNumericAxis",value:function(m){var p=this.w,S=p.config,A=p.globals;if(A.noData||A.collapsedSeries.length+A.ancillaryCollapsedSeries.length===S.series.length)return 0;var k=function(ye){return["bar","rangeBar","candlestick","boxPlot"].includes(ye)},T=S.chart.type,D=0,V=k(T)?S.series.length:1;A.comboBarCount>0&&(V=A.comboBarCount),A.collapsedSeries.forEach(function(ye){k(ye.type)&&(V-=1)}),S.chart.stacked&&(V=1);var X=k(T)||A.comboBarCount>0,le=Math.abs(A.initialMaxX-A.initialMinX);if(X&&A.isXNumeric&&!A.isBarHorizontal&&V>0&&le!==0){le<=3&&(le=A.dataPoints);var ce=le/m,fe=A.minXDiff&&A.minXDiff/ce>0?A.minXDiff/ce:0;fe>m/2&&(fe/=2),(D=fe*parseInt(S.plotOptions.bar.columnWidth,10)/100)<1&&(D=1),A.barPadForNumericAxis=D}return D}},{key:"gridPadFortitleSubtitle",value:function(){var m=this,p=this.w,S=p.globals,A=this.dCtx.isSparkline||!S.axisCharts?0:10;["title","subtitle"].forEach(function(D){p.config[D].text!==void 0?A+=p.config[D].margin:A+=m.dCtx.isSparkline||!S.axisCharts?0:5}),!p.config.legend.show||p.config.legend.position!=="bottom"||p.config.legend.floating||S.axisCharts||(A+=10);var k=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),T=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");S.gridHeight-=k.height+T.height+A,S.translateY+=k.height+T.height+A}},{key:"setGridXPosForDualYAxis",value:function(m,p){var S=this.w,A=new de(this.dCtx.ctx);S.config.yaxis.forEach(function(k,T){S.globals.ignoreYAxisIndexes.indexOf(T)!==-1||k.floating||A.isYAxisHidden(T)||(k.opposite&&(S.globals.translateX-=p[T].width+m[T].width+parseInt(k.labels.style.fontSize,10)/1.2+12),S.globals.translateX<2&&(S.globals.translateX=2))})}}]),ke}(),it=function(){function ke(m){s(this,ke),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 tn(this),this.dimYAxis=new rn(this),this.dimXAxis=new fn(this),this.dimGrid=new nt(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return o(ke,[{key:"plotCoords",value:function(){var m=this,p=this.w,S=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,N(p.config.stroke.width)):p.config.stroke.width;this.isSparkline&&((p.config.markers.discrete.length>0||p.config.markers.size>0)&&Object.entries(this.gridPad).forEach(function(T){var D=C(T,2),V=D[0],X=D[1];m.gridPad[V]=Math.max(X,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)),S.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),S.gridHeight=S.gridHeight-this.gridPad.top-this.gridPad.bottom,S.gridWidth=S.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var k=this.dimGrid.gridPadForColumnsInNumericAxis(S.gridWidth);S.gridWidth=S.gridWidth-2*k,S.translateX=S.translateX+this.gridPad.left+this.xPadLeft+(k>0?k:0),S.translateY=S.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var m=this,p=this.w,S=p.globals,A=this.dimYAxis.getyAxisLabelsCoords(),k=this.dimYAxis.getyAxisTitleCoords();S.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),p.globals.yLabelsCoords=[],p.globals.yTitleCoords=[],p.config.yaxis.map(function(ye,Pe){p.globals.yLabelsCoords.push({width:A[Pe].width,index:Pe}),p.globals.yTitleCoords.push({width:k[Pe].width,index:Pe})}),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var T=this.dimXAxis.getxAxisLabelsCoords(),D=this.dimXAxis.getxAxisGroupLabelsCoords(),V=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(T,V,D),S.translateXAxisY=p.globals.rotateXLabels?this.xAxisHeight/8:-4,S.translateXAxisX=p.globals.rotateXLabels&&p.globals.isXNumeric&&p.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,p.globals.isBarHorizontal&&(S.rotateXLabels=!1,S.translateXAxisY=parseInt(p.config.xaxis.labels.style.fontSize,10)/1.5*-1),S.translateXAxisY=S.translateXAxisY+p.config.xaxis.labels.offsetY,S.translateXAxisX=S.translateXAxisX+p.config.xaxis.labels.offsetX;var X=this.yAxisWidth,le=this.xAxisHeight;S.xAxisLabelsHeight=this.xAxisHeight-V.height,S.xAxisGroupLabelsHeight=S.xAxisLabelsHeight-T.height,S.xAxisLabelsWidth=this.xAxisWidth,S.xAxisHeight=this.xAxisHeight;var ce=10;(p.config.chart.type==="radar"||this.isSparkline)&&(X=0,le=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||p.config.chart.type==="treemap")&&(X=0,le=0,ce=0),this.isSparkline||p.config.chart.type==="treemap"||this.dimXAxis.additionalPaddingXLabels(T);var fe=function(){S.translateX=X+m.datalabelsCoords.width,S.gridHeight=S.svgHeight-m.lgRect.height-le-(m.isSparkline||p.config.chart.type==="treemap"?0:p.globals.rotateXLabels?10:15),S.gridWidth=S.svgWidth-X-2*m.datalabelsCoords.width};switch(p.config.xaxis.position==="top"&&(ce=S.xAxisHeight-p.config.xaxis.axisTicks.height-5),p.config.legend.position){case"bottom":S.translateY=ce,fe();break;case"top":S.translateY=this.lgRect.height+ce,fe();break;case"left":S.translateY=ce,S.translateX=this.lgRect.width+X+this.datalabelsCoords.width,S.gridHeight=S.svgHeight-le-12,S.gridWidth=S.svgWidth-this.lgRect.width-X-2*this.datalabelsCoords.width;break;case"right":S.translateY=ce,S.translateX=X+this.datalabelsCoords.width,S.gridHeight=S.svgHeight-le-12,S.gridWidth=S.svgWidth-this.lgRect.width-X-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(k,A),new Ve(this.ctx).setYAxisXPosition(A,k)}},{key:"setDimensionsForNonAxisCharts",value:function(){var m=this.w,p=m.globals,S=m.config,A=0;m.config.legend.show&&!m.config.legend.floating&&(A=20);var k=S.chart.type==="pie"||S.chart.type==="polarArea"||S.chart.type==="donut"?"pie":"radialBar",T=S.plotOptions[k].offsetY,D=S.plotOptions[k].offsetX;if(!S.legend.show||S.legend.floating){p.gridHeight=p.svgHeight;var V=p.dom.elWrap.getBoundingClientRect().width;return p.gridWidth=Math.min(V,p.gridHeight),p.translateY=T,void(p.translateX=D+(p.svgWidth-p.gridWidth)/2)}switch(S.legend.position){case"bottom":p.gridHeight=p.svgHeight-this.lgRect.height,p.gridWidth=p.svgWidth,p.translateY=T-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+T+10,p.translateX=D+(p.svgWidth-p.gridWidth)/2;break;case"left":p.gridWidth=p.svgWidth-this.lgRect.width-A,p.gridHeight=S.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=T,p.translateX=D+this.lgRect.width+A;break;case"right":p.gridWidth=p.svgWidth-this.lgRect.width-A-5,p.gridHeight=S.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=T,p.translateX=D+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(m,p,S){var A=this.w,k=A.globals.hasXaxisGroups?2:1,T=S.height+m.height+p.height,D=A.globals.isMultiLineX?1.2:A.globals.LINE_HEIGHT_RATIO,V=A.globals.rotateXLabels?22:10,X=A.globals.rotateXLabels&&A.config.legend.position==="bottom"?10:0;this.xAxisHeight=T*D+k*V+X,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 le=0,ce=0;A.config.yaxis.forEach(function(fe){le+=fe.labels.minWidth,ce+=fe.labels.maxWidth}),this.yAxisWidth<le&&(this.yAxisWidth=le),this.yAxisWidth>ce&&(this.yAxisWidth=ce)}}]),ke}(),Ut=function(){function ke(m){s(this,ke),this.w=m.w,this.lgCtx=m}return o(ke,[{key:"getLegendStyles",value:function(){var m,p,S,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||(S=p.chart)===null||S===void 0?void 0:S.nonce)||this.w.config.chart.nonce;k&&A.setAttribute("nonce",k);var T=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(T),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 S=this,A=this.w;if(A.globals.axisCharts||A.config.chart.type==="radialBar"){A.globals.resized=!0;var k=null,T=null;A.globals.risingSeries=[],A.globals.axisCharts?(k=A.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(m,"']")),T=parseInt(k.getAttribute("data:realIndex"),10)):(k=A.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(m+1,"']")),T=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(le){S.riseCollapsedSeries(le.cs,le.csi,T)}):this.hideSeries({seriesEl:k,realIndex:T})}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 X=A.config.plotOptions.pie.donut.labels;new z(this.lgCtx.ctx).pathMouseDown(D.members[0],null),this.lgCtx.ctx.pie.printDataLabelsInner(D.members[0].node,X)}D.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(m){var p=m.realIndex,S=this.w,A=S.globals,k=F.clone(S.config.series);if(A.axisCharts){var T=S.config.yaxis[A.seriesYAxisReverseMap[p]],D={index:p,data:k[p].data.slice(),type:k[p].type||S.config.chart.type};if(T&&T.show&&T.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===S.config.series.length,this._getSeriesBasedOnCollapsedState(k)}},{key:"hideSeries",value:function(m){for(var p=m.seriesEl,S=m.realIndex,A=this.w,k=this.getSeriesAfterCollapsing({realIndex:S}),T=p.childNodes,D=0;D<T.length;D++)T[D].classList.contains("apexcharts-series-markers-wrap")&&(T[D].classList.contains("apexcharts-hide")?T[D].classList.remove("apexcharts-hide"):T[D].classList.add("apexcharts-hide"));this.lgCtx.ctx.updateHelpers._updateSeries(k,A.config.chart.animations.dynamicAnimation.enabled)}},{key:"riseCollapsedSeries",value:function(m,p,S){var A=this.w,k=F.clone(A.config.series);if(m.length>0){for(var T=0;T<m.length;T++)m[T].index===S&&(A.globals.axisCharts?k[S].data=m[T].data.slice():k[S]=m[T].data,k[S].hidden=!1,m.splice(T,1),p.splice(T,1),A.globals.risingSeries.push(S));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,S=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=[],S++)}):m.forEach(function(A,k){!p.globals.collapsedSeriesIndices.indexOf(k)<0&&(m[k]=0,S++)}),p.globals.allSeriesCollapsed=S===m.length,m}}]),ke}(),hn=function(){function ke(m){s(this,ke),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(ke,[{key:"init",value:function(){var m=this.w,p=m.globals,S=m.config,A=S.legend.showForSingleSeries&&p.series.length===1||this.isBarsDistributed||p.series.length>1;if(this.legendHelpers.appendToForeignObject(),(A||!p.axisCharts)&&S.legend.show){for(;p.dom.elLegendWrap.firstChild;)p.dom.elLegendWrap.removeChild(p.dom.elLegendWrap.firstChild);this.drawLegends(),S.legend.position==="bottom"||S.legend.position==="top"?this.legendAlignHorizontal():S.legend.position!=="right"&&S.legend.position!=="left"||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(m){var p=m.i,S=m.fillcolor,A=this.w,k=document.createElement("span");k.classList.add("apexcharts-legend-marker");var T=A.config.legend.markers.shape||A.config.markers.shape,D=T;Array.isArray(T)&&(D=T[p]);var V=Array.isArray(A.config.legend.markers.size)?parseFloat(A.config.legend.markers.size[p]):parseFloat(A.config.legend.markers.size),X=Array.isArray(A.config.legend.markers.offsetX)?parseFloat(A.config.legend.markers.offsetX[p]):parseFloat(A.config.legend.markers.offsetX),le=Array.isArray(A.config.legend.markers.offsetY)?parseFloat(A.config.legend.markers.offsetY[p]):parseFloat(A.config.legend.markers.offsetY),ce=Array.isArray(A.config.legend.markers.strokeWidth)?parseFloat(A.config.legend.markers.strokeWidth[p]):parseFloat(A.config.legend.markers.strokeWidth),fe=k.style;if(fe.height=2*(V+ce)+"px",fe.width=2*(V+ce)+"px",fe.left=X+"px",fe.top=le+"px",A.config.legend.markers.customHTML)fe.background="transparent",fe.color=S[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 ye=new Ce(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(D),seriesIndex:p,strokeWidth:ce,size:V}),Pe=SVG(k).size("100%","100%"),Me=new z(this.ctx).drawMarker(0,0,y(y({},ye),{},{pointFillColor:Array.isArray(S)?S[p]:ye.pointFillColor,shape:D}));SVG.select(".apexcharts-legend-marker.apexcharts-marker").members.forEach(function(Ke){Ke.node.classList.contains("apexcharts-marker-triangle")?Ke.node.style.transform="translate(50%, 45%)":Ke.node.style.transform="translate(50%, 50%)"}),Pe.add(Me)}return k}},{key:"drawLegends",value:function(){var m=this,p=this.w,S=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 T=p.config.plotOptions.heatmap.colorScale.ranges;A=T.map(function(Be){return Be.name?Be.name:Be.from+" - "+Be.to}),k=T.map(function(Be){return Be.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,X=V?A.length-1:0;V?X>=0:X<=A.length-1;V?X--:X++){var le,ce=D(A[X],{seriesIndex:X,w:p}),fe=!1,ye=!1;if(p.globals.collapsedSeries.length>0)for(var Pe=0;Pe<p.globals.collapsedSeries.length;Pe++)p.globals.collapsedSeries[Pe].index===X&&(fe=!0);if(p.globals.ancillaryCollapsedSeriesIndices.length>0)for(var Me=0;Me<p.globals.ancillaryCollapsedSeriesIndices.length;Me++)p.globals.ancillaryCollapsedSeriesIndices[Me]===X&&(ye=!0);var Ke=this.createLegendMarker({i:X,fillcolor:k});z.setAttrs(Ke,{rel:X+1,"data:collapsed":fe||ye}),(fe||ye)&&Ke.classList.add("apexcharts-inactive-legend");var we=document.createElement("div"),Te=document.createElement("span");Te.classList.add("apexcharts-legend-text"),Te.innerHTML=Array.isArray(ce)?ce.join(" "):ce;var te=p.config.legend.labels.useSeriesColors?p.globals.colors[X]:Array.isArray(p.config.legend.labels.colors)?(le=p.config.legend.labels.colors)===null||le===void 0?void 0:le[X]:p.config.legend.labels.colors;te||(te=p.config.chart.foreColor),Te.style.color=te,Te.style.fontSize=parseFloat(p.config.legend.fontSize)+"px",Te.style.fontWeight=p.config.legend.fontWeight,Te.style.fontFamily=S||p.config.chart.fontFamily,z.setAttrs(Te,{rel:X+1,i:X,"data:default-text":encodeURIComponent(ce),"data:collapsed":fe||ye}),we.appendChild(Ke),we.appendChild(Te);var ve=new Q(this.ctx);p.config.legend.showForZeroSeries||ve.getSeriesTotalByIndex(X)===0&&ve.seriesHaveSameValues(X)&&!ve.isSeriesNull(X)&&p.globals.collapsedSeriesIndices.indexOf(X)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(X)===-1&&we.classList.add("apexcharts-hidden-zero-series"),p.config.legend.showForNullSeries||ve.isSeriesNull(X)&&p.globals.collapsedSeriesIndices.indexOf(X)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(X)===-1&&we.classList.add("apexcharts-hidden-null-series"),p.globals.dom.elLegendWrap.appendChild(we),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),we.classList.add("apexcharts-legend-series"),we.style.margin="".concat(p.config.legend.itemMargin.vertical,"px ").concat(p.config.legend.itemMargin.horizontal,"px"),p.globals.dom.elLegendWrap.style.width=p.config.legend.width?p.config.legend.width+"px":"",p.globals.dom.elLegendWrap.style.height=p.config.legend.height?p.config.legend.height+"px":"",z.setAttrs(we,{rel:X+1,seriesName:F.escapeString(A[X]),"data:collapsed":fe||ye}),(fe||ye)&&we.classList.add("apexcharts-inactive-legend"),p.config.legend.onItemClick.toggleDataSeries||we.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 S=this.w,A=S.globals.dom.elLegendWrap,k=A.clientHeight,T=0,D=0;if(S.config.legend.position==="bottom")D=S.globals.svgHeight-Math.min(k,S.globals.svgHeight/2)-5;else if(S.config.legend.position==="top"){var V=new it(this.ctx),X=V.dimHelpers.getTitleSubtitleCoords("title").height,le=V.dimHelpers.getTitleSubtitleCoords("subtitle").height;D=(X>0?X-10:0)+(le>0?le-10:0)}A.style.position="absolute",T=T+m+S.config.legend.offsetX,D=D+p+S.config.legend.offsetY,A.style.left=T+"px",A.style.top=D+"px",S.config.legend.position==="right"&&(A.style.left="auto",A.style.right=25+S.config.legend.offsetX+"px"),["width","height"].forEach(function(ce){A.style[ce]&&(A.style[ce]=parseInt(S.config.legend[ce],10)+"px")})}},{key:"legendAlignHorizontal",value:function(){var m=this.w;m.globals.dom.elLegendWrap.style.right=0;var p=new it(this.ctx),S=p.dimHelpers.getTitleSubtitleCoords("title"),A=p.dimHelpers.getTitleSubtitleCoords("subtitle"),k=0;m.config.legend.position==="top"&&(k=S.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(),S=0;m.config.legend.position==="left"&&(S=20),m.config.legend.position==="right"&&(S=m.globals.svgWidth-p.clww-10),this.setLegendWrapXY(S,20)}},{key:"onLegendHovered",value:function(m){var p=this.w,S=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(S){var A=parseInt(m.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,A,this.w]),new $e(this.ctx).highlightRangeInSeries(m,m.target)}}else!m.target.classList.contains("apexcharts-inactive-legend")&&S&&new $e(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 S=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,S,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,S,this.w]);var T=this.w.config.legend.markers.onClick;typeof T=="function"&&m.target.classList.contains("apexcharts-legend-marker")&&(T(this.ctx,S,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,S,this.w])),p.config.chart.type!=="treemap"&&p.config.chart.type!=="heatmap"&&!this.isBarsDistributed&&p.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(S,A)}}}]),ke}(),nn=function(){function ke(m){s(this,ke),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(ke,[{key:"createToolbar",value:function(){var m=this,p=this.w,S=function(){return document.createElement("div")},A=S();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=S(),this.elZoomIn=S(),this.elZoomOut=S(),this.elPan=S(),this.elSelection=S(),this.elZoomReset=S(),this.elMenuIcon=S(),this.elMenu=S(),this.elCustomIcons=[],this.t=p.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var k=0;k<this.t.customIcons.length;k++)this.elCustomIcons.push(S());var T=[],D=function(ce,fe,ye){var Pe=ce.toLowerCase();m.t[Pe]&&p.config.chart.zoom.enabled&&T.push({el:fe,icon:typeof m.t[Pe]=="string"?m.t[Pe]:ye,title:m.localeValues[ce],class:"apexcharts-".concat(Pe,"-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(ce){m.t[ce]&&p.config.chart[ce].enabled&&T.push({el:ce==="zoom"?m.elZoom:m.elSelection,icon:typeof m.t[ce]=="string"?m.t[ce]:ce==="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[ce==="zoom"?"selectionZoom":"selection"],class:p.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(ce,"-icon")})};V("zoom"),V("selection"),this.t.pan&&p.config.chart.zoom.enabled&&T.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&&T.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 X=0;X<this.elCustomIcons.length;X++)T.push({el:this.elCustomIcons[X],icon:this.t.customIcons[X].icon,title:this.t.customIcons[X].title,index:this.t.customIcons[X].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[X].class});T.forEach(function(ce,fe){ce.index&&F.moveIndexInArray(T,fe,ce.index)});for(var le=0;le<T.length;le++)z.setAttrs(T[le].el,{class:T[le].class,title:T[le].title}),T[le].el.innerHTML=T[le].icon,A.appendChild(T[le].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),z.setAttrs(this.elMenu,{class:"apexcharts-menu"});for(var p=[{name:"exportSVG",title:this.localeValues.exportToSVG},{name:"exportPNG",title:this.localeValues.exportToPNG},{name:"exportCSV",title:this.localeValues.exportToCSV}],S=0;S<p.length;S++)this.elMenuItems.push(document.createElement("div")),this.elMenuItems[S].innerHTML=p[S].title,z.setAttrs(this.elMenuItems[S],{class:"apexcharts-menu-item ".concat(p[S].name),title:p[S].title}),this.elMenu.appendChild(this.elMenuItems[S])}},{key:"addToolbarEventListeners",value:function(){var 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(S){S.classList.contains("exportSVG")?S.addEventListener("click",m.handleDownload.bind(m,"svg")):S.classList.contains("exportPNG")?S.addEventListener("click",m.handleDownload.bind(m,"png")):S.classList.contains("exportCSV")&&S.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 S=m==="selection"?p.ctx.toolbar.elSelection:p.ctx.toolbar.elZoom,A=m==="selection"?"selectionEnabled":"zoomEnabled";p.w.globals[A]=!p.w.globals[A],S.classList.contains(p.ctx.toolbar.selectedClass)?S.classList.remove(p.ctx.toolbar.selectedClass):S.classList.add(p.ctx.toolbar.selectedClass)})}},{key:"getToolbarIconsReference",value:function(){var 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,S=m==="pan"?this.elZoom:this.elPan;p&&p.classList.add(this.selectedClass),S&&S.classList.remove(this.selectedClass)}},{key:"togglePanning",value:function(){this.ctx.getSyncedCharts().forEach(function(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(S){S&&S.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,S=(this.minX+p)/2,A=(this.maxX+p)/2,k=this._getNewMinXMaxX(S,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,S=this.minX-(p-this.minX),A=this.maxX-(p-this.maxX),k=this._getNewMinXMaxX(S,A);m.globals.disableZoomOut||this.zoomUpdateOptions(k.minX,k.maxX)}}},{key:"_getNewMinXMaxX",value:function(m,p){var S=this.w.config.xaxis.convertedCatToNumeric;return{minX:S?Math.floor(m):m,maxX:S?Math.floor(p):p}}},{key:"zoomUpdateOptions",value:function(m,p){var S=this.w;if(m!==void 0||p!==void 0){if(!(S.config.xaxis.convertedCatToNumeric&&(m<1&&(m=1,p=S.globals.dataPoints),p-m<2))){var A={min:m,max:p},k=this.getBeforeZoomRange(A);k&&(A=k.xaxis);var T={xaxis:A},D=F.clone(S.globals.initialConfig.yaxis);S.config.chart.group||(T.yaxis=D),this.w.globals.zoomed=!0,this.ctx.updateHelpers._updateOptions(T,!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 S=null;return typeof this.ev.beforeZoom=="function"&&(S=this.ev.beforeZoom(this,{xaxis:m,yaxis:p})),S}},{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,S=new Je(this.ctx);switch(m){case"svg":S.exportToSVG(this.ctx);break;case"png":S.exportToPng(this.ctx);break;case"csv":S.exportToCSV({series:p.config.series,columnDelimiter:p.config.chart.toolbar.export.csv.columnDelimiter})}}},{key:"handleZoomReset",value:function(m){this.ctx.getSyncedCharts().forEach(function(p){var S=p.w;if(S.globals.lastXAxis.min=S.globals.initialConfig.xaxis.min,S.globals.lastXAxis.max=S.globals.initialConfig.xaxis.max,p.updateHelpers.revertDefaultAxisMinMax(),typeof S.config.chart.events.beforeResetZoom=="function"){var A=S.config.chart.events.beforeResetZoom(p,S);A&&p.updateHelpers.revertDefaultAxisMinMax(A)}typeof S.config.chart.events.zoomed=="function"&&p.ctx.toolbar.zoomCallback({min:S.config.xaxis.min,max:S.config.xaxis.max}),S.globals.zoomed=!1;var k=p.ctx.series.emptyCollapsedSeries(F.clone(S.globals.initialSeries));p.updateHelpers._updateSeries(k,S.config.chart.animations.dynamicAnimation.enabled)})}},{key:"destroy",value:function(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null}}]),ke}(),Vt=function(ke){f(p,nn);var m=c(p);function p(S){var A;return s(this,p),(A=m.call(this,S)).ctx=S,A.w=S.w,A.dragged=!1,A.graphics=new z(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(S){var A=this,k=S.xyRatios,T=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=T.globals.dom.baseEl.querySelector(".apexcharts-grid"),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),T.globals.dom.elGraphical.add(this.zoomRect),T.globals.dom.elGraphical.add(this.selectionRect),T.config.chart.selection.type==="x"?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:T.globals.gridWidth,maxY:T.globals.gridHeight}).on("dragmove",this.selectionDragging.bind(this,"dragging")):T.config.chart.selection.type==="y"?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:T.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=T.globals.dom.baseEl.querySelector("".concat(T.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})}),T.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(S,A){var k=this.w,T=this,D=this.ctx.toolbar,V=k.globals.zoomEnabled?k.config.chart.zoom.type:k.config.chart.selection.type,X=k.config.chart.toolbar.autoSelected;if(A.shiftKey?(this.shiftWasPressed=!0,D.enableZoomPanFromToolbar(X==="pan"?"zoom":"pan")):this.shiftWasPressed&&(D.enableZoomPanFromToolbar(X),this.shiftWasPressed=!1),A.target){var le,ce=A.target.classList;if(A.target.parentNode&&A.target.parentNode!==null&&(le=A.target.parentNode.classList),!(ce.contains("apexcharts-selection-rect")||ce.contains("apexcharts-legend-marker")||ce.contains("apexcharts-legend-text")||le&&le.contains("apexcharts-toolbar"))){if(T.clientX=A.type==="touchmove"||A.type==="touchstart"?A.touches[0].clientX:A.type==="touchend"?A.changedTouches[0].clientX:A.clientX,T.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 fe=T.gridRect.getBoundingClientRect();T.startX=T.clientX-fe.left,T.startY=T.clientY-fe.top,T.dragged=!1,T.w.globals.mousedown=!0}if((A.type==="mousemove"&&A.which===1||A.type==="touchmove")&&(T.dragged=!0,k.globals.panEnabled?(k.globals.selection=null,T.w.globals.mousedown&&T.panDragging({context:T,zoomtype:V,xyRatios:S})):(T.w.globals.mousedown&&k.globals.zoomEnabled||T.w.globals.mousedown&&k.globals.selectionEnabled)&&(T.selection=T.selectionDrawing({context:T,zoomtype:V}))),A.type==="mouseup"||A.type==="touchend"||A.type==="mouseleave"){var ye,Pe=(ye=T.gridRect)===null||ye===void 0?void 0:ye.getBoundingClientRect();Pe&&T.w.globals.mousedown&&(T.endX=T.clientX-Pe.left,T.endY=T.clientY-Pe.top,T.dragX=Math.abs(T.endX-T.startX),T.dragY=Math.abs(T.endY-T.startY),(k.globals.zoomEnabled||k.globals.selectionEnabled)&&T.selectionDrawn({context:T,zoomtype:V}),k.globals.panEnabled&&k.config.xaxis.convertedCatToNumeric&&T.delayedPanScrolled()),k.globals.zoomEnabled&&T.hideSelectionRect(this.selectionRect),T.dragged=!1,T.w.globals.mousedown=!1}this.makeSelectionRectDraggable()}}}},{key:"mouseWheelEvent",value:function(S){var A=this,k=this.w;S.preventDefault();var T=Date.now();T-k.globals.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(S),k.globals.lastWheelExecution=T),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){T-k.globals.lastWheelExecution>A.wheelDelay&&(A.executeMouseWheelZoom(S),k.globals.lastWheelExecution=T)},this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(S){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 T=(A=this.gridRect)===null||A===void 0?void 0:A.getBoundingClientRect();if(T){var D,V,X,le=(S.clientX-T.left)/T.width,ce=this.minX,fe=this.maxX,ye=fe-ce;if(S.deltaY<0){var Pe=ce+le*ye;V=Pe-(D=.5*ye)/2,X=Pe+D/2}else V=ce-(D=1.5*ye)/2,X=fe+D/2;if(!k.globals.isRangeBar){V=Math.max(V,k.globals.initialMinX),X=Math.min(X,k.globals.initialMaxX);var Me=.01*(k.globals.initialMaxX-k.globals.initialMinX);if(X-V<Me){var Ke=(V+X)/2;V=Ke-Me/2,X=Ke+Me/2}}var we=this._getNewMinXMaxX(V,X);isNaN(we.minX)||isNaN(we.maxX)||this.zoomUpdateOptions(we.minX,we.maxX)}}},{key:"makeSelectionRectDraggable",value:function(){var S=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:S.globals.gridWidth,maxY:S.globals.gridHeight}}).on("resizing",this.selectionDragging.bind(this,"resizing"))}}},{key:"preselectedSelection",value:function(){var S=this.w,A=this.xyRatios;if(!S.globals.zoomEnabled){if(S.globals.selection!==void 0&&S.globals.selection!==null)this.drawSelectionRect(S.globals.selection);else if(S.config.chart.selection.xaxis.min!==void 0&&S.config.chart.selection.xaxis.max!==void 0){var k=(S.config.chart.selection.xaxis.min-S.globals.minX)/A.xRatio,T=S.globals.gridWidth-(S.globals.maxX-S.config.chart.selection.xaxis.max)/A.xRatio-k;S.globals.isRangeBar&&(k=(S.config.chart.selection.xaxis.min-S.globals.yAxisScale[0].niceMin)/A.invertedYRatio,T=(S.config.chart.selection.xaxis.max-S.config.chart.selection.xaxis.min)/A.invertedYRatio);var D={x:k,y:0,width:T,height:S.globals.gridHeight,translateX:0,translateY:0,selectionEnabled:!0};this.drawSelectionRect(D),this.makeSelectionRectDraggable(),typeof S.config.chart.events.selection=="function"&&S.config.chart.events.selection(this.ctx,{xaxis:{min:S.config.chart.selection.xaxis.min,max:S.config.chart.selection.xaxis.max},yaxis:{}})}}}},{key:"drawSelectionRect",value:function(S){var A=S.x,k=S.y,T=S.width,D=S.height,V=S.translateX,X=V===void 0?0:V,le=S.translateY,ce=le===void 0?0:le,fe=this.w,ye=this.zoomRect,Pe=this.selectionRect;if(this.dragged||fe.globals.selection!==null){var Me={transform:"translate("+X+", "+ce+")"};fe.globals.zoomEnabled&&this.dragged&&(T<0&&(T=1),ye.attr({x:A,y:k,width:T,height:D,fill:fe.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":fe.config.chart.zoom.zoomedArea.fill.opacity,stroke:fe.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":fe.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":fe.config.chart.zoom.zoomedArea.stroke.opacity}),z.setAttrs(ye.node,Me)),fe.globals.selectionEnabled&&(Pe.attr({x:A,y:k,width:T>0?T:0,height:D>0?D:0,fill:fe.config.chart.selection.fill.color,"fill-opacity":fe.config.chart.selection.fill.opacity,stroke:fe.config.chart.selection.stroke.color,"stroke-width":fe.config.chart.selection.stroke.width,"stroke-dasharray":fe.config.chart.selection.stroke.dashArray,"stroke-opacity":fe.config.chart.selection.stroke.opacity}),z.setAttrs(Pe.node,Me))}}},{key:"hideSelectionRect",value:function(S){S&&S.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(S){var A=S.context,k=S.zoomtype,T=this.w,D=A,V=this.gridRect.getBoundingClientRect(),X=D.startX-1,le=D.startY,ce=!1,fe=!1,ye=D.clientX-V.left-X,Pe=D.clientY-V.top-le,Me={};return Math.abs(ye+X)>T.globals.gridWidth?ye=T.globals.gridWidth-X:D.clientX-V.left<0&&(ye=X),X>D.clientX-V.left&&(ce=!0,ye=Math.abs(ye)),le>D.clientY-V.top&&(fe=!0,Pe=Math.abs(Pe)),Me=k==="x"?{x:ce?X-ye:X,y:0,width:ye,height:T.globals.gridHeight}:k==="y"?{x:0,y:fe?le-Pe:le,width:T.globals.gridWidth,height:Pe}:{x:ce?X-ye:X,y:fe?le-Pe:le,width:ye,height:Pe},D.drawSelectionRect(Me),D.selectionDragging("resizing"),Me}},{key:"selectionDragging",value:function(S,A){var k=this,T=this.w,D=this.xyRatios,V=this.selectionRect,X=0;S==="resizing"&&(X=30);var le=function(fe){return parseFloat(V.node.getAttribute(fe))},ce={x:le("x"),y:le("y"),width:le("width"),height:le("height")};T.globals.selection=ce,typeof T.config.chart.events.selection=="function"&&T.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout(function(){var fe,ye,Pe,Me,Ke=k.gridRect.getBoundingClientRect(),we=V.node.getBoundingClientRect();T.globals.isRangeBar?(fe=T.globals.yAxisScale[0].niceMin+(we.left-Ke.left)*D.invertedYRatio,ye=T.globals.yAxisScale[0].niceMin+(we.right-Ke.left)*D.invertedYRatio,Pe=0,Me=1):(fe=T.globals.xAxisScale.niceMin+(we.left-Ke.left)*D.xRatio,ye=T.globals.xAxisScale.niceMin+(we.right-Ke.left)*D.xRatio,Pe=T.globals.yAxisScale[0].niceMin+(Ke.bottom-we.bottom)*D.yRatio[0],Me=T.globals.yAxisScale[0].niceMax-(we.top-Ke.top)*D.yRatio[0]);var Te={xaxis:{min:fe,max:ye},yaxis:{min:Pe,max:Me}};T.config.chart.events.selection(k.ctx,Te),T.config.chart.brush.enabled&&T.config.chart.events.brushScrolled!==void 0&&T.config.chart.events.brushScrolled(k.ctx,Te)},X))}},{key:"selectionDrawn",value:function(S){var A=S.context,k=S.zoomtype,T=this.w,D=A,V=this.xyRatios,X=this.ctx.toolbar;if(D.startX>D.endX){var le=D.startX;D.startX=D.endX,D.endX=le}if(D.startY>D.endY){var ce=D.startY;D.startY=D.endY,D.endY=ce}var fe=void 0,ye=void 0;T.globals.isRangeBar?(fe=T.globals.yAxisScale[0].niceMin+D.startX*V.invertedYRatio,ye=T.globals.yAxisScale[0].niceMin+D.endX*V.invertedYRatio):(fe=T.globals.xAxisScale.niceMin+D.startX*V.xRatio,ye=T.globals.xAxisScale.niceMin+D.endX*V.xRatio);var Pe=[],Me=[];if(T.config.yaxis.forEach(function(Ue,Fe){var at=T.globals.seriesYAxisMap[Fe][0];Pe.push(T.globals.yAxisScale[Fe].niceMax-V.yRatio[at]*D.startY),Me.push(T.globals.yAxisScale[Fe].niceMax-V.yRatio[at]*D.endY)}),D.dragged&&(D.dragX>10||D.dragY>10)&&fe!==ye){if(T.globals.zoomEnabled){var Ke=F.clone(T.globals.initialConfig.yaxis),we=F.clone(T.globals.initialConfig.xaxis);if(T.globals.zoomed=!0,T.config.xaxis.convertedCatToNumeric&&(fe=Math.floor(fe),ye=Math.floor(ye),fe<1&&(fe=1,ye=T.globals.dataPoints),ye-fe<2&&(ye=fe+1)),k!=="xy"&&k!=="x"||(we={min:fe,max:ye}),k!=="xy"&&k!=="y"||Ke.forEach(function(Ue,Fe){Ke[Fe].min=Me[Fe],Ke[Fe].max=Pe[Fe]}),X){var Te=X.getBeforeZoomRange(we,Ke);Te&&(we=Te.xaxis?Te.xaxis:we,Ke=Te.yaxis?Te.yaxis:Ke)}var te={xaxis:we};T.config.chart.group||(te.yaxis=Ke),D.ctx.updateHelpers._updateOptions(te,!1,D.w.config.chart.animations.dynamicAnimation.enabled),typeof T.config.chart.events.zoomed=="function"&&X.zoomCallback(we,Ke)}else if(T.globals.selectionEnabled){var ve,Be=null;ve={min:fe,max:ye},k!=="xy"&&k!=="y"||(Be=F.clone(T.config.yaxis)).forEach(function(Ue,Fe){Be[Fe].min=Me[Fe],Be[Fe].max=Pe[Fe]}),T.globals.selection=D.selection,typeof T.config.chart.events.selection=="function"&&T.config.chart.events.selection(D.ctx,{xaxis:ve,yaxis:Be})}}}},{key:"panDragging",value:function(S){var A=S.context,k=this.w,T=A;if(k.globals.lastClientPosition.x!==void 0){var D=k.globals.lastClientPosition.x-T.clientX,V=k.globals.lastClientPosition.y-T.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:T.clientX,y:T.clientY};var X=k.globals.isRangeBar?k.globals.minY:k.globals.minX,le=k.globals.isRangeBar?k.globals.maxY:k.globals.maxX;k.config.xaxis.convertedCatToNumeric||T.panScrolled(X,le)}},{key:"delayedPanScrolled",value:function(){var S=this.w,A=S.globals.minX,k=S.globals.maxX,T=(S.globals.maxX-S.globals.minX)/2;this.moveDirection==="left"?(A=S.globals.minX+T,k=S.globals.maxX+T):this.moveDirection==="right"&&(A=S.globals.minX-T,k=S.globals.maxX-T),A=Math.floor(A),k=Math.floor(k),this.updateScrolledChart({xaxis:{min:A,max:k}},A,k)}},{key:"panScrolled",value:function(S,A){var k=this.w,T=this.xyRatios,D=F.clone(k.globals.initialConfig.yaxis),V=T.xRatio,X=k.globals.minX,le=k.globals.maxX;k.globals.isRangeBar&&(V=T.invertedYRatio,X=k.globals.minY,le=k.globals.maxY),this.moveDirection==="left"?(S=X+k.globals.gridWidth/15*V,A=le+k.globals.gridWidth/15*V):this.moveDirection==="right"&&(S=X-k.globals.gridWidth/15*V,A=le-k.globals.gridWidth/15*V),k.globals.isRangeBar||(S<k.globals.initialMinX||A>k.globals.initialMaxX)&&(S=X,A=le);var ce={xaxis:{min:S,max:A}};k.config.chart.group||(ce.yaxis=D),this.updateScrolledChart(ce,S,A)}},{key:"updateScrolledChart",value:function(S,A,k){var T=this.w;this.ctx.updateHelpers._updateOptions(S,!1,!1),typeof T.config.chart.events.scrolled=="function"&&T.config.chart.events.scrolled(this.ctx,{xaxis:{min:A,max:k}})}}]),p}(),pt=function(){function ke(m){s(this,ke),this.w=m.w,this.ttCtx=m,this.ctx=m.ctx}return o(ke,[{key:"getNearestValues",value:function(m){var p=m.hoverArea,S=m.elGrid,A=m.clientX,k=m.clientY,T=this.w,D=S.getBoundingClientRect(),V=D.width,X=D.height,le=V/(T.globals.dataPoints-1),ce=X/T.globals.dataPoints,fe=this.hasBars();!T.globals.comboCharts&&!fe||T.config.xaxis.convertedCatToNumeric||(le=V/T.globals.dataPoints);var ye=A-D.left-T.globals.barPadForNumericAxis,Pe=k-D.top;ye<0||Pe<0||ye>V||Pe>X?(p.classList.remove("hovering-zoom"),p.classList.remove("hovering-pan")):T.globals.zoomEnabled?(p.classList.remove("hovering-pan"),p.classList.add("hovering-zoom")):T.globals.panEnabled&&(p.classList.remove("hovering-zoom"),p.classList.add("hovering-pan"));var Me=Math.round(ye/le),Ke=Math.floor(Pe/ce);fe&&!T.config.xaxis.convertedCatToNumeric&&(Me=Math.ceil(ye/le),Me-=1);var we=null,Te=null,te=T.globals.seriesXvalues.map(function(at){return at.filter(function(ut){return F.isNumber(ut)})}),ve=T.globals.seriesYvalues.map(function(at){return at.filter(function(ut){return F.isNumber(ut)})});if(T.globals.isXNumeric){var Be=this.ttCtx.getElGrid().getBoundingClientRect(),Ue=ye*(Be.width/V),Fe=Pe*(Be.height/X);we=(Te=this.closestInMultiArray(Ue,Fe,te,ve)).index,Me=Te.j,we!==null&&(te=T.globals.seriesXvalues[we],Me=(Te=this.closestInArray(Ue,te)).index)}return T.globals.capturedSeriesIndex=we===null?-1:we,(!Me||Me<1)&&(Me=0),T.globals.isBarHorizontal?T.globals.capturedDataPointIndex=Ke:T.globals.capturedDataPointIndex=Me,{capturedSeries:we,j:T.globals.isBarHorizontal?Ke:Me,hoverX:ye,hoverY:Pe}}},{key:"closestInMultiArray",value:function(m,p,S,A){var k=this.w,T=0,D=null,V=-1;k.globals.series.length>1?T=this.getFirstActiveXArray(S):D=0;var X=S[T][0],le=Math.abs(m-X);if(S.forEach(function(ye){ye.forEach(function(Pe,Me){var Ke=Math.abs(m-Pe);Ke<=le&&(le=Ke,V=Me)})}),V!==-1){var ce=A[T][V],fe=Math.abs(p-ce);D=T,A.forEach(function(ye,Pe){var Me=Math.abs(p-ye[V]);Me<=fe&&(fe=Me,D=Pe)})}return{index:D,j:V}}},{key:"getFirstActiveXArray",value:function(m){for(var p=this.w,S=0,A=m.map(function(T,D){return T.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){S=A[k];break}return S}},{key:"closestInArray",value:function(m,p){for(var S=p[0],A=null,k=Math.abs(m-S),T=0;T<p.length;T++){var D=Math.abs(m-p[T]);D<k&&(k=D,A=T)}return{index:A}}},{key:"isXoverlap",value:function(m){var p=[],S=this.w.globals.seriesX.filter(function(k){return k[0]!==void 0});if(S.length>0)for(var A=0;A<S.length-1;A++)S[A][m]!==void 0&&S[A+1][m]!==void 0&&S[A][m]!==S[A+1][m]&&p.push("unEqual");return p.length===0}},{key:"isInitialSeriesSameLen",value:function(){for(var m=!0,p=this.w.globals.initialSeries,S=0;S<p.length-1;S++)if(p[S].data.length!==p[S+1].data.length){m=!1;break}return m}},{key:"getBarsHeight",value:function(m){return N(m).reduce(function(p,S){return p+S.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=N(m)).sort(function(S,A){var k=Number(S.getAttribute("data:realIndex")),T=Number(A.getAttribute("data:realIndex"));return T<k?1:T>k?-1:0});var p=[];return m.forEach(function(S){p.push(S.querySelector(".apexcharts-marker"))}),p}},{key:"hasMarkers",value:function(m){return this.getElMarkers(m).length>0}},{key:"getPathFromPoint",value:function(m,p){var S=Number(m.getAttribute("cx")),A=Number(m.getAttribute("cy")),k=m.getAttribute("shape");return new z(this.ctx).getMarkerPath(S,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,S=p.config.markers.hover.size;return S===void 0&&(S=p.globals.markers.size[m]+p.config.markers.hover.sizeOffset),S}},{key:"toggleAllTooltipSeriesGroups",value:function(m){var p=this.w,S=this.ttCtx;S.allTooltipSeriesGroups.length===0&&(S.allTooltipSeriesGroups=p.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var A=S.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")}}]),ke}(),We=function(){function ke(m){s(this,ke),this.w=m.w,this.ctx=m.ctx,this.ttCtx=m,this.tooltipUtil=new pt(m)}return o(ke,[{key:"drawSeriesTexts",value:function(m){var p=m.shared,S=p===void 0||p,A=m.ttItems,k=m.i,T=k===void 0?0:k,D=m.j,V=D===void 0?null:D,X=m.y1,le=m.y2,ce=m.e,fe=this.w;fe.config.tooltip.custom!==void 0?this.handleCustomTooltip({i:T,j:V,y1:X,y2:le,w:fe}):this.toggleActiveInactiveSeries(S,T);var ye=this.getValuesToPrint({i:T,j:V});this.printLabels({i:T,j:V,values:ye,ttItems:A,shared:S,e:ce});var Pe=this.ttCtx.getElTooltip();this.ttCtx.tooltipRect.ttWidth=Pe.getBoundingClientRect().width,this.ttCtx.tooltipRect.ttHeight=Pe.getBoundingClientRect().height}},{key:"printLabels",value:function(m){var p,S=this,A=m.i,k=m.j,T=m.values,D=m.ttItems,V=m.shared,X=m.e,le=this.w,ce=[],fe=function(Be){return le.globals.seriesGoals[Be]&&le.globals.seriesGoals[Be][k]&&Array.isArray(le.globals.seriesGoals[Be][k])},ye=T.xVal,Pe=T.zVal,Me=T.xAxisTTVal,Ke="",we=le.globals.colors[A];k!==null&&le.config.plotOptions.bar.distributed&&(we=le.globals.colors[k]);for(var Te=function(Be,Ue){var Fe=S.getFormatters(A);Ke=S.getSeriesName({fn:Fe.yLbTitleFormatter,index:A,seriesIndex:A,j:k}),le.config.chart.type==="treemap"&&(Ke=Fe.yLbTitleFormatter(String(le.config.series[A].data[k].x),{series:le.globals.series,seriesIndex:A,dataPointIndex:k,w:le}));var at=le.config.tooltip.inverseOrder?Ue:Be;if(le.globals.axisCharts){var ut=function(Gt){var an,et,Pt,qt;return le.globals.isRangeData?Fe.yLbFormatter((an=le.globals.seriesRangeStart)===null||an===void 0||(et=an[Gt])===null||et===void 0?void 0:et[k],{series:le.globals.seriesRangeStart,seriesIndex:Gt,dataPointIndex:k,w:le})+" - "+Fe.yLbFormatter((Pt=le.globals.seriesRangeEnd)===null||Pt===void 0||(qt=Pt[Gt])===null||qt===void 0?void 0:qt[k],{series:le.globals.seriesRangeEnd,seriesIndex:Gt,dataPointIndex:k,w:le}):Fe.yLbFormatter(le.globals.series[Gt][k],{series:le.globals.series,seriesIndex:Gt,dataPointIndex:k,w:le})};if(V)Fe=S.getFormatters(at),Ke=S.getSeriesName({fn:Fe.yLbTitleFormatter,index:at,seriesIndex:A,j:k}),we=le.globals.colors[at],p=ut(at),fe(at)&&(ce=le.globals.seriesGoals[at][k].map(function(Gt){return{attrs:Gt,val:Fe.yLbFormatter(Gt.value,{seriesIndex:at,dataPointIndex:k,w:le})}}));else{var yt,Lt=X==null||(yt=X.target)===null||yt===void 0?void 0:yt.getAttribute("fill");Lt&&(Lt.indexOf("url")!==-1?Lt.indexOf("Pattern")!==-1&&(we=le.globals.dom.baseEl.querySelector(Lt.substr(4).slice(0,-1)).childNodes[0].getAttribute("stroke")):we=Lt),p=ut(A),fe(A)&&Array.isArray(le.globals.seriesGoals[A][k])&&(ce=le.globals.seriesGoals[A][k].map(function(Gt){return{attrs:Gt,val:Fe.yLbFormatter(Gt.value,{seriesIndex:A,dataPointIndex:k,w:le})}}))}}k===null&&(p=Fe.yLbFormatter(le.globals.series[A],y(y({},le),{},{seriesIndex:A,dataPointIndex:A}))),S.DOMHandling({i:A,t:at,j:k,ttItems:D,values:{val:p,goalVals:ce,xVal:ye,xAxisTTVal:Me,zVal:Pe},seriesName:Ke,shared:V,pColor:we})},te=0,ve=le.globals.series.length-1;te<le.globals.series.length;te++,ve--)Te(te,ve)}},{key:"getFormatters",value:function(m){var p,S=this.w,A=S.globals.yLabelFormatters[m];return S.globals.ttVal!==void 0?Array.isArray(S.globals.ttVal)?(A=S.globals.ttVal[m]&&S.globals.ttVal[m].formatter,p=S.globals.ttVal[m]&&S.globals.ttVal[m].title&&S.globals.ttVal[m].title.formatter):(A=S.globals.ttVal.formatter,typeof S.globals.ttVal.title.formatter=="function"&&(p=S.globals.ttVal.title.formatter)):p=S.config.tooltip.y.title.formatter,typeof A!="function"&&(A=S.globals.yLabelFormatters[0]?S.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,S=m.index,A=m.seriesIndex,k=m.j,T=this.w;return p(String(T.globals.seriesNames[S]),{series:T.globals.series,seriesIndex:A,dataPointIndex:k,w:T})}},{key:"DOMHandling",value:function(m){m.i;var p=m.t,S=m.j,A=m.ttItems,k=m.values,T=m.seriesName,D=m.shared,V=m.pColor,X=this.w,le=this.ttCtx,ce=k.val,fe=k.goalVals,ye=k.xVal,Pe=k.xAxisTTVal,Me=k.zVal,Ke=null;Ke=A[p].children,X.config.tooltip.fillSeriesColor&&(A[p].style.backgroundColor=V,Ke[0].style.display="none"),le.showTooltipTitle&&(le.tooltipTitle===null&&(le.tooltipTitle=X.globals.dom.baseEl.querySelector(".apexcharts-tooltip-title")),le.tooltipTitle.innerHTML=ye),le.isXAxisTooltipEnabled&&(le.xaxisTooltipText.innerHTML=Pe!==""?Pe:ye);var we=A[p].querySelector(".apexcharts-tooltip-text-y-label");we&&(we.innerHTML=T||"");var Te=A[p].querySelector(".apexcharts-tooltip-text-y-value");Te&&(Te.innerHTML=ce!==void 0?ce:""),Ke[0]&&Ke[0].classList.contains("apexcharts-tooltip-marker")&&(X.config.tooltip.marker.fillColors&&Array.isArray(X.config.tooltip.marker.fillColors)&&(V=X.config.tooltip.marker.fillColors[p]),Ke[0].style.backgroundColor=V),X.config.tooltip.marker.show||(Ke[0].style.display="none");var te=A[p].querySelector(".apexcharts-tooltip-text-goals-label"),ve=A[p].querySelector(".apexcharts-tooltip-text-goals-value");if(fe.length&&X.globals.seriesGoals[p]){var Be=function(){var at="<div >",ut="<div>";fe.forEach(function(yt,Lt){at+=' <div style="display: flex"><span class="apexcharts-tooltip-marker" style="background-color: '.concat(yt.attrs.strokeColor,'; height: 3px; border-radius: 0; top: 5px;"></span> ').concat(yt.attrs.name,"</div>"),ut+="<div>".concat(yt.val,"</div>")}),te.innerHTML=at+"</div>",ve.innerHTML=ut+"</div>"};D?X.globals.seriesGoals[p][S]&&Array.isArray(X.globals.seriesGoals[p][S])?Be():(te.innerHTML="",ve.innerHTML=""):Be()}else te.innerHTML="",ve.innerHTML="";if(Me!==null&&(A[p].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=X.config.tooltip.z.title,A[p].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=Me!==void 0?Me:""),D&&Ke[0]){if(X.config.tooltip.hideEmptySeries){var Ue=A[p].querySelector(".apexcharts-tooltip-marker"),Fe=A[p].querySelector(".apexcharts-tooltip-text");parseFloat(ce)==0?(Ue.style.display="none",Fe.style.display="none"):(Ue.style.display="block",Fe.style.display="block")}ce==null||X.globals.ancillaryCollapsedSeriesIndices.indexOf(p)>-1||X.globals.collapsedSeriesIndices.indexOf(p)>-1||Array.isArray(le.tConfig.enabledOnSeries)&&le.tConfig.enabledOnSeries.indexOf(p)===-1?Ke[0].parentNode.style.display="none":Ke[0].parentNode.style.display=X.config.tooltip.items.display}else Array.isArray(le.tConfig.enabledOnSeries)&&le.tConfig.enabledOnSeries.indexOf(p)===-1&&(Ke[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(m,p){var S=this.w;if(m)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var A=S.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(p));A&&(A.classList.add("apexcharts-active"),A.style.display=S.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(m){var p=m.i,S=m.j,A=this.w,k=this.ctx.series.filteredSeriesX(),T="",D="",V=null,X=null,le={series:A.globals.series,seriesIndex:p,dataPointIndex:S,w:A},ce=A.globals.ttZFormatter;S===null?X=A.globals.series[p]:A.globals.isXNumeric&&A.config.chart.type!=="treemap"?(T=k[p][S],k[p].length===0&&(T=k[this.tooltipUtil.getFirstActiveXArray(k)][S])):T=new Ye(this.ctx).isFormatXY()?A.config.series[p].data[S]!==void 0?A.config.series[p].data[S].x:"":A.globals.labels[S]!==void 0?A.globals.labels[S]:"";var fe=T;return A.globals.isXNumeric&&A.config.xaxis.type==="datetime"?T=new re(this.ctx).xLabelFormat(A.globals.ttKeyFormatter,fe,fe,{i:void 0,dateFormatter:new K(this.ctx).formatDate,w:this.w}):T=A.globals.isBarHorizontal?A.globals.yLabelFormatters[0](fe,le):A.globals.xLabelFormatter(fe,le),A.config.tooltip.x.formatter!==void 0&&(T=A.globals.ttKeyFormatter(fe,le)),A.globals.seriesZ.length>0&&A.globals.seriesZ[p].length>0&&(V=ce(A.globals.seriesZ[p][S],A)),D=typeof A.config.xaxis.tooltip.formatter=="function"?A.globals.xaxisTooltipFormatter(fe,le):T,{val:Array.isArray(X)?X.join(" "):X,xVal:Array.isArray(T)?T.join(" "):T,xAxisTTVal:Array.isArray(D)?D.join(" "):D,zVal:V}}},{key:"handleCustomTooltip",value:function(m){var p=m.i,S=m.j,A=m.y1,k=m.y2,T=m.w,D=this.ttCtx.getElTooltip(),V=T.config.tooltip.custom;Array.isArray(V)&&V[p]&&(V=V[p]),D.innerHTML=V({ctx:this.ctx,series:T.globals.series,seriesIndex:p,dataPointIndex:S,y1:A,y2:k,w:T})}}]),ke}(),It=function(){function ke(m){s(this,ke),this.ttCtx=m,this.ctx=m.ctx,this.w=m.w}return o(ke,[{key:"moveXCrosshairs",value:function(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,S=this.ttCtx,A=this.w,k=S.getElXCrosshairs(),T=m-S.xcrosshairsWidth/2,D=A.globals.labels.slice().length;if(p!==null&&(T=A.globals.gridWidth/D*p),k===null||A.globals.isBarHorizontal||(k.setAttribute("x",T),k.setAttribute("x1",T),k.setAttribute("x2",T),k.setAttribute("y2",A.globals.gridHeight),k.classList.add("apexcharts-active")),T<0&&(T=0),T>A.globals.gridWidth&&(T=A.globals.gridWidth),S.isXAxisTooltipEnabled){var V=T;A.config.xaxis.crosshairs.width!=="tickWidth"&&A.config.xaxis.crosshairs.width!=="barWidth"||(V=T+S.xcrosshairsWidth/2),this.moveXAxisTooltip(V)}}},{key:"moveYCrosshairs",value:function(m){var p=this.ttCtx;p.ycrosshairs!==null&&z.setAttrs(p.ycrosshairs,{y1:m,y2:m}),p.ycrosshairsHidden!==null&&z.setAttrs(p.ycrosshairsHidden,{y1:m,y2:m})}},{key:"moveXAxisTooltip",value:function(m){var p=this.w,S=this.ttCtx;if(S.xaxisTooltip!==null&&S.xcrosshairsWidth!==0){S.xaxisTooltip.classList.add("apexcharts-active");var A=S.xaxisOffY+p.config.xaxis.tooltip.offsetY+p.globals.translateY+1+p.config.xaxis.offsetY;if(m-=S.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(m)){m+=p.globals.translateX;var k;k=new z(this.ctx).getTextRects(S.xaxisTooltipText.innerHTML),S.xaxisTooltipText.style.minWidth=k.width+"px",S.xaxisTooltip.style.left=m+"px",S.xaxisTooltip.style.top=A+"px"}}}},{key:"moveYAxisTooltip",value:function(m){var p=this.w,S=this.ttCtx;S.yaxisTTEls===null&&(S.yaxisTTEls=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var A=parseInt(S.ycrosshairsHidden.getAttribute("y1"),10),k=p.globals.translateY+A,T=S.yaxisTTEls[m].getBoundingClientRect().height,D=p.globals.translateYAxisX[m]-2;p.config.yaxis[m].opposite&&(D-=26),k-=T/2,p.globals.ignoreYAxisIndexes.indexOf(m)===-1?(S.yaxisTTEls[m].classList.add("apexcharts-active"),S.yaxisTTEls[m].style.top=k+"px",S.yaxisTTEls[m].style.left=D+p.config.yaxis[m].tooltip.offsetX+"px"):S.yaxisTTEls[m].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(m,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,A=this.w,k=this.ttCtx,T=k.getElTooltip(),D=k.tooltipRect,V=S!==null?parseFloat(S):1,X=parseFloat(m)+V+5,le=parseFloat(p)+V/2;if(X>A.globals.gridWidth/2&&(X=X-D.ttWidth-V-10),X>A.globals.gridWidth-D.ttWidth-10&&(X=A.globals.gridWidth-D.ttWidth),X<-20&&(X=-20),A.config.tooltip.followCursor){var ce=k.getElGrid().getBoundingClientRect();(X=k.e.clientX-ce.left)>A.globals.gridWidth/2&&(X-=k.tooltipRect.ttWidth),(le=k.e.clientY+A.globals.translateY-ce.top)>A.globals.gridHeight/2&&(le-=k.tooltipRect.ttHeight)}else A.globals.isBarHorizontal||D.ttHeight/2+le>A.globals.gridHeight&&(le=A.globals.gridHeight-D.ttHeight+A.globals.translateY);isNaN(X)||(X+=A.globals.translateX,T.style.left=X+"px",T.style.top=le+"px")}},{key:"moveMarkers",value:function(m,p){var S=this.w,A=this.ttCtx;if(S.globals.markers.size[m]>0)for(var k=S.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(m,"'] .apexcharts-marker")),T=0;T<k.length;T++)parseInt(k[T].getAttribute("rel"),10)===p&&(A.marker.resetPointsSize(),A.marker.enlargeCurrentPoint(p,k[T]));else A.marker.resetPointsSize(),this.moveDynamicPointOnHover(p,m)}},{key:"moveDynamicPointOnHover",value:function(m,p){var S,A,k,T,D=this.w,V=this.ttCtx,X=new z(this.ctx),le=D.globals.pointsArray,ce=V.tooltipUtil.getHoverMarkerSize(p),fe=D.config.series[p].type;if(!fe||fe!=="column"&&fe!=="candlestick"&&fe!=="boxPlot"){k=(S=le[p][m])===null||S===void 0?void 0:S[0],T=((A=le[p][m])===null||A===void 0?void 0:A[1])||0;var ye=D.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(p,"'] .apexcharts-series-markers path"));if(ye&&T<D.globals.gridHeight&&T>0){var Pe=ye.getAttribute("shape"),Me=X.getMarkerPath(k,T,Pe,1.5*ce);ye.setAttribute("d",Me)}this.moveXCrosshairs(k),V.fixedTooltip||this.moveTooltip(k,T,ce)}}},{key:"moveDynamicPointsOnHover",value:function(m){var p,S=this.ttCtx,A=S.w,k=0,T=0,D=A.globals.pointsArray,V=new $e(this.ctx),X=new z(this.ctx);p=V.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var le=S.tooltipUtil.getHoverMarkerSize(p);D[p]&&(k=D[p][m][0],T=D[p][m][1]);var ce=S.tooltipUtil.getAllMarkers();if(ce!==null)for(var fe=0;fe<A.globals.series.length;fe++){var ye=D[fe];if(A.globals.comboCharts&&ye===void 0&&ce.splice(fe,0,null),ye&&ye.length){var Pe=D[fe][m][1],Me=void 0;ce[fe].setAttribute("cx",k);var Ke=ce[fe].getAttribute("shape");if(A.config.chart.type==="rangeArea"&&!A.globals.comboCharts){var we=m+A.globals.series[fe].length;Me=D[fe][we][1],Pe-=Math.abs(Pe-Me)/2}if(Pe!==null&&!isNaN(Pe)&&Pe<A.globals.gridHeight+le&&Pe+le>0){var Te=X.getMarkerPath(k,Pe,Ke,le);ce[fe].setAttribute("d",Te)}else ce[fe].setAttribute("d","")}}this.moveXCrosshairs(k),S.fixedTooltip||this.moveTooltip(k,T||A.globals.gridHeight,le)}},{key:"moveStickyTooltipOverBars",value:function(m,p){var S=this.w,A=this.ttCtx,k=S.globals.columnSeries?S.globals.columnSeries.length:S.globals.series.length,T=k>=2&&k%2==0?Math.floor(k/2):Math.floor(k/2)+1;S.globals.isBarHorizontal&&(T=new $e(this.ctx).getActiveConfigSeriesIndex("desc")+1);var D=S.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(T,"'] path[j='").concat(m,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(T,"'] path[j='").concat(m,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(T,"'] path[j='").concat(m,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(T,"'] path[j='").concat(m,"']"));D||typeof p!="number"||(D=S.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,X=D?parseFloat(D.getAttribute("cy")):0,le=D?parseFloat(D.getAttribute("barWidth")):0,ce=A.getElGrid().getBoundingClientRect(),fe=D&&(D.classList.contains("apexcharts-candlestick-area")||D.classList.contains("apexcharts-boxPlot-area"));S.globals.isXNumeric?(D&&!fe&&(V-=k%2!=0?le/2:0),D&&fe&&S.globals.comboCharts&&(V-=le/2)):S.globals.isBarHorizontal||(V=A.xAxisTicksPositions[m-1]+A.dataPointsDividedWidth/2,isNaN(V)&&(V=A.xAxisTicksPositions[m]-A.dataPointsDividedWidth/2)),S.globals.isBarHorizontal?X-=A.tooltipRect.ttHeight:S.config.tooltip.followCursor?X=A.e.clientY-ce.top-A.tooltipRect.ttHeight/2:X+A.tooltipRect.ttHeight+15>S.globals.gridHeight&&(X=S.globals.gridHeight),S.globals.isBarHorizontal||this.moveXCrosshairs(V),A.fixedTooltip||this.moveTooltip(V,X||S.globals.gridHeight)}}]),ke}(),Ge=function(){function ke(m){s(this,ke),this.w=m.w,this.ttCtx=m,this.ctx=m.ctx,this.tooltipPosition=new It(m)}return o(ke,[{key:"drawDynamicPoints",value:function(){var m=this.w,p=new z(this.ctx),S=new Ce(this.ctx),A=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series");A=N(A),m.config.chart.stacked&&A.sort(function(ce,fe){return parseFloat(ce.getAttribute("data:realIndex"))-parseFloat(fe.getAttribute("data:realIndex"))});for(var k=0;k<A.length;k++){var T=A[k].querySelector(".apexcharts-series-markers-wrap");if(T!==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 X=S.getMarkerConfig({cssClass:V,seriesIndex:Number(T.getAttribute("data:realIndex"))});(D=p.drawMarker(0,0,X)).node.setAttribute("default-marker-size",0);var le=document.createElementNS(m.globals.SVGNS,"g");le.classList.add("apexcharts-series-markers"),le.appendChild(D.node),T.appendChild(le)}}}},{key:"enlargeCurrentPoint",value:function(m,p){var S=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 T=p.getAttribute("cx"),D=p.getAttribute("cy");if(S!==null&&A!==null&&(T=S,D=A),this.tooltipPosition.moveXCrosshairs(T),!this.fixedTooltip){if(k.config.chart.type==="radar"){var V=this.ttCtx.getElGrid().getBoundingClientRect();T=this.ttCtx.e.clientX-V.left}this.tooltipPosition.moveTooltip(T,D,k.config.markers.hover.size)}}},{key:"enlargePoints",value:function(m){for(var p=this.w,S=this,A=this.ttCtx,k=m,T=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),D=p.config.markers.hover.size,V=0;V<T.length;V++){var X=T[V].getAttribute("rel"),le=T[V].getAttribute("index");if(D===void 0&&(D=p.globals.markers.size[le]+p.config.markers.hover.sizeOffset),k===parseInt(X,10)){S.newPointSize(k,T[V]);var ce=T[V].getAttribute("cx"),fe=T[V].getAttribute("cy");S.tooltipPosition.moveXCrosshairs(ce),A.fixedTooltip||S.tooltipPosition.moveTooltip(ce,fe,D)}else S.oldPointSize(T[V])}}},{key:"newPointSize",value:function(m,p){var S=this.w,A=S.config.markers.hover.size,k=m===0?p.parentNode.firstChild:p.parentNode.lastChild;if(k.getAttribute("default-marker-size")!=="0"){var T=parseInt(k.getAttribute("index"),10);A===void 0&&(A=S.globals.markers.size[T]+S.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")),S=this.ttCtx.tooltipUtil.getPathFromPoint(m,p);m.setAttribute("d",S)}},{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 S=parseFloat(m[p].getAttribute("default-marker-size"));if(F.isNumber(S)&&S>=0){var A=this.ttCtx.tooltipUtil.getPathFromPoint(m[p],S);m[p].setAttribute("d",A)}else m[p].setAttribute("d","M0,0")}}}]),ke}(),ct=function(){function ke(m){s(this,ke),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(ke,[{key:"getAttr",value:function(m,p){return parseFloat(m.target.getAttribute(p))}},{key:"handleHeatTreeTooltip",value:function(m){var p=m.e,S=m.opt,A=m.x,k=m.y,T=m.type,D=this.ttCtx,V=this.w;if(p.target.classList.contains("apexcharts-".concat(T,"-rect"))){var X=this.getAttr(p,"i"),le=this.getAttr(p,"j"),ce=this.getAttr(p,"cx"),fe=this.getAttr(p,"cy"),ye=this.getAttr(p,"width"),Pe=this.getAttr(p,"height");if(D.tooltipLabels.drawSeriesTexts({ttItems:S.ttItems,i:X,j:le,shared:!1,e:p}),V.globals.capturedSeriesIndex=X,V.globals.capturedDataPointIndex=le,A=ce+D.tooltipRect.ttWidth/2+ye,k=fe+D.tooltipRect.ttHeight/2-Pe/2,D.tooltipPosition.moveXCrosshairs(ce+ye/2),A>V.globals.gridWidth/2&&(A=ce-D.tooltipRect.ttWidth/2+ye),D.w.config.tooltip.followCursor){var Me=V.globals.dom.elWrap.getBoundingClientRect();A=V.globals.clientX-Me.left-(A>V.globals.gridWidth/2?D.tooltipRect.ttWidth:0),k=V.globals.clientY-Me.top-(k>V.globals.gridHeight/2?D.tooltipRect.ttHeight:0)}}return{x:A,y:k}}},{key:"handleMarkerTooltip",value:function(m){var p,S,A=m.e,k=m.opt,T=m.x,D=m.y,V=this.w,X=this.ttCtx;if(A.target.classList.contains("apexcharts-marker")){var le=parseInt(k.paths.getAttribute("cx"),10),ce=parseInt(k.paths.getAttribute("cy"),10),fe=parseFloat(k.paths.getAttribute("val"));if(S=parseInt(k.paths.getAttribute("rel"),10),p=parseInt(k.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,X.intersect){var ye=F.findAncestor(k.paths,"apexcharts-series");ye&&(p=parseInt(ye.getAttribute("data:realIndex"),10))}if(X.tooltipLabels.drawSeriesTexts({ttItems:k.ttItems,i:p,j:S,shared:!X.showOnIntersect&&V.config.tooltip.shared,e:A}),A.type==="mouseup"&&X.markerClick(A,p,S),V.globals.capturedSeriesIndex=p,V.globals.capturedDataPointIndex=S,T=le,D=ce+V.globals.translateY-1.4*X.tooltipRect.ttHeight,X.w.config.tooltip.followCursor){var Pe=X.getElGrid().getBoundingClientRect();D=X.e.clientY+V.globals.translateY-Pe.top}fe<0&&(D=ce),X.marker.enlargeCurrentPoint(S,k.paths,T,D)}return{x:T,y:D}}},{key:"handleBarTooltip",value:function(m){var p,S,A=m.e,k=m.opt,T=this.w,D=this.ttCtx,V=D.getElTooltip(),X=0,le=0,ce=0,fe=this.getBarTooltipXY({e:A,opt:k});p=fe.i;var ye=fe.j;T.globals.capturedSeriesIndex=p,T.globals.capturedDataPointIndex=ye,T.globals.isBarHorizontal&&D.tooltipUtil.hasBars()||!T.config.tooltip.shared?(le=fe.x,ce=fe.y,S=Array.isArray(T.config.stroke.width)?T.config.stroke.width[p]:T.config.stroke.width,X=le):T.globals.comboCharts||T.config.tooltip.shared||(X/=2),isNaN(ce)&&(ce=T.globals.svgHeight-D.tooltipRect.ttHeight);var Pe=parseInt(k.paths.parentNode.getAttribute("data:realIndex"),10);if(T.globals.isMultipleYAxis?T.config.yaxis[Pe]&&T.config.yaxis[Pe].reversed:T.config.yaxis[0].reversed,le+D.tooltipRect.ttWidth>T.globals.gridWidth?le-=D.tooltipRect.ttWidth:le<0&&(le=0),D.w.config.tooltip.followCursor){var Me=D.getElGrid().getBoundingClientRect();ce=D.e.clientY-Me.top}D.tooltip===null&&(D.tooltip=T.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),T.config.tooltip.shared||(T.globals.comboBarCount>0?D.tooltipPosition.moveXCrosshairs(X+S/2):D.tooltipPosition.moveXCrosshairs(X)),!D.fixedTooltip&&(!T.config.tooltip.shared||T.globals.isBarHorizontal&&D.tooltipUtil.hasBars())&&(ce=ce+T.globals.translateY-D.tooltipRect.ttHeight/2,V.style.left=le+T.globals.translateX+"px",V.style.top=ce+"px")}},{key:"getBarTooltipXY",value:function(m){var p=this,S=m.e,A=m.opt,k=this.w,T=null,D=this.ttCtx,V=0,X=0,le=0,ce=0,fe=0,ye=S.target.classList;if(ye.contains("apexcharts-bar-area")||ye.contains("apexcharts-candlestick-area")||ye.contains("apexcharts-boxPlot-area")||ye.contains("apexcharts-rangebar-area")){var Pe=S.target,Me=Pe.getBoundingClientRect(),Ke=A.elGrid.getBoundingClientRect(),we=Me.height;fe=Me.height;var Te=Me.width,te=parseInt(Pe.getAttribute("cx"),10),ve=parseInt(Pe.getAttribute("cy"),10);ce=parseFloat(Pe.getAttribute("barWidth"));var Be=S.type==="touchmove"?S.touches[0].clientX:S.clientX;T=parseInt(Pe.getAttribute("j"),10),V=parseInt(Pe.parentNode.getAttribute("rel"),10)-1;var Ue=Pe.getAttribute("data-range-y1"),Fe=Pe.getAttribute("data-range-y2");k.globals.comboCharts&&(V=parseInt(Pe.parentNode.getAttribute("data:realIndex"),10));var at=function(yt){return k.globals.isXNumeric?te-Te/2:p.isVerticalGroupedRangeBar?te+Te/2:te-D.dataPointsDividedWidth+Te/2},ut=function(){return ve-D.dataPointsDividedHeight+we/2-D.tooltipRect.ttHeight/2};D.tooltipLabels.drawSeriesTexts({ttItems:A.ttItems,i:V,j:T,y1:Ue?parseInt(Ue,10):null,y2:Fe?parseInt(Fe,10):null,shared:!D.showOnIntersect&&k.config.tooltip.shared,e:S}),k.config.tooltip.followCursor?k.globals.isBarHorizontal?(X=Be-Ke.left+15,le=ut()):(X=at(),le=S.clientY-Ke.top-D.tooltipRect.ttHeight/2-15):k.globals.isBarHorizontal?((X=te)<D.xyRatios.baseLineInvertedY&&(X=te-D.tooltipRect.ttWidth),le=ut()):(X=at(),le=ve)}return{x:X,y:le,barHeight:fe,barWidth:ce,i:V,j:T}}}]),ke}(),vt=function(){function ke(m){s(this,ke),this.w=m.w,this.ttCtx=m}return o(ke,[{key:"drawXaxisTooltip",value:function(){var m=this.w,p=this.ttCtx,S=m.config.xaxis.position==="bottom";p.xaxisOffY=S?m.globals.gridHeight+1:-m.globals.xAxisHeight-m.config.xaxis.axisTicks.height+3;var A=S?"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,S=0;S<m.config.yaxis.length;S++){var A=m.config.yaxis[S].opposite||m.config.yaxis[S].crosshairs.opposite;p.yaxisOffX=A?m.globals.gridWidth+1:1;var k="apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(S,A?" apexcharts-yaxistooltip-right":" apexcharts-yaxistooltip-left"),T=m.globals.dom.elWrap;m.globals.dom.baseEl.querySelector(".apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(S))===null&&(p.yaxisTooltip=document.createElement("div"),p.yaxisTooltip.setAttribute("class",k+" apexcharts-theme-"+m.config.tooltip.theme),T.appendChild(p.yaxisTooltip),S===0&&(p.yaxisTooltipText=[]),p.yaxisTooltipText[S]=document.createElement("div"),p.yaxisTooltipText[S].classList.add("apexcharts-yaxistooltip-text"),p.yaxisTooltip.appendChild(p.yaxisTooltipText[S]))}}},{key:"setXCrosshairWidth",value:function(){var m=this.w,p=this.ttCtx,S=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 T=m.globals.labels.length;p.xcrosshairsWidth=m.globals.gridWidth/T}}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 X=parseFloat(V.getAttribute("barWidth"));p.xcrosshairsWidth=X}else p.xcrosshairsWidth=1}m.globals.isBarHorizontal&&(p.xcrosshairsWidth=0),S!==null&&p.xcrosshairsWidth>0&&S.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,S){var A=this.ttCtx,k=this.w,T=k.globals,D=T.seriesYAxisMap[m];if(A.yaxisTooltips[m]&&D.length>0){var V=T.yLabelFormatters[m],X=A.getElGrid().getBoundingClientRect(),le=D[0],ce=0;S.yRatio.length>1&&(ce=le);var fe=(p-X.top)*S.yRatio[ce],ye=T.maxYArr[le]-T.minYArr[le],Pe=T.minYArr[le]+(ye-fe);k.config.yaxis[m].reversed&&(Pe=T.maxYArr[le]-(ye-fe)),A.tooltipPosition.moveYCrosshairs(p-X.top),A.yaxisTooltipText[m].innerHTML=V(Pe),A.tooltipPosition.moveYAxisTooltip(m)}}}]),ke}(),Ht=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w;var p=this.w;this.tConfig=p.config.tooltip,this.tooltipUtil=new pt(this),this.tooltipLabels=new We(this),this.tooltipPosition=new It(this),this.marker=new Ge(this),this.intersect=new ct(this),this.axesTooltip=new vt(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(ke,[{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(T,D){return!!(T.show&&T.tooltip.enabled&&p.globals.axisCharts)}),this.allTooltipSeriesGroups=[],p.globals.axisCharts||(this.showTooltipTitle=!1);var S=document.createElement("div");if(S.classList.add("apexcharts-tooltip"),p.config.tooltip.cssClass&&S.classList.add(p.config.tooltip.cssClass),S.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),p.globals.dom.elWrap.appendChild(S),p.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var A=new ht(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,S.appendChild(this.tooltipTitle));var k=p.globals.series.length;(p.globals.xyCharts||p.globals.comboCharts)&&this.tConfig.shared&&(k=this.showOnIntersect?1:p.globals.series.length),this.legendLabels=p.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(k),this.addSVGEvents()}}},{key:"createTTElements",value:function(m){for(var p=this,S=this.w,A=[],k=this.getElTooltip(),T=function(V){var X=document.createElement("div");X.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(V)),X.style.order=S.config.tooltip.inverseOrder?m-V:V+1;var le=document.createElement("span");le.classList.add("apexcharts-tooltip-marker"),le.style.backgroundColor=S.globals.colors[V],X.appendChild(le);var ce=document.createElement("div");ce.classList.add("apexcharts-tooltip-text"),ce.style.fontFamily=p.tConfig.style.fontFamily||S.config.chart.fontFamily,ce.style.fontSize=p.tConfig.style.fontSize,["y","goals","z"].forEach(function(fe){var ye=document.createElement("div");ye.classList.add("apexcharts-tooltip-".concat(fe,"-group"));var Pe=document.createElement("span");Pe.classList.add("apexcharts-tooltip-text-".concat(fe,"-label")),ye.appendChild(Pe);var Me=document.createElement("span");Me.classList.add("apexcharts-tooltip-text-".concat(fe,"-value")),ye.appendChild(Me),ce.appendChild(ye)}),X.appendChild(ce),k.appendChild(X),A.push(X)},D=0;D<m;D++)T(D);return A}},{key:"addSVGEvents",value:function(){var m=this.w,p=m.config.chart.type,S=this.getElTooltip(),A=!(p!=="bar"&&p!=="candlestick"&&p!=="boxPlot"&&p!=="rangeBar"),k=p==="area"||p==="line"||p==="scatter"||p==="bubble"||p==="radar",T=m.globals.dom.Paper.node,D=this.getElGrid();D&&(this.seriesBound=D.getBoundingClientRect());var V,X=[],le=[],ce={hoverArea:T,elGrid:D,tooltipEl:S,tooltipY:X,tooltipX:le,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 fe=0;fe<V.length;fe++)X.push(V[fe].getAttribute("cy")),le.push(V[fe].getAttribute("cx"));if(m.globals.xyCharts&&!this.showOnIntersect||m.globals.comboCharts&&!this.showOnIntersect||A&&this.tooltipUtil.hasBars()&&this.tConfig.shared)this.addPathsEventListeners([T],ce);else if(A&&!m.globals.comboCharts||k&&this.showOnIntersect)this.addDatapointEventsListeners(ce);else if(!m.globals.axisCharts||p==="heatmap"||p==="treemap"){var ye=m.globals.dom.baseEl.querySelectorAll(".apexcharts-series");this.addPathsEventListeners(ye,ce)}if(this.showOnIntersect){var Pe=m.globals.dom.baseEl.querySelectorAll(".apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker");Pe.length>0&&this.addPathsEventListeners(Pe,ce),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(ce)}}},{key:"drawFixedTooltipRect",value:function(){var m=this.w,p=this.getElTooltip(),S=p.getBoundingClientRect(),A=S.width+10,k=S.height+10,T=this.tConfig.fixed.offsetX,D=this.tConfig.fixed.offsetY,V=this.tConfig.fixed.position.toLowerCase();return V.indexOf("right")>-1&&(T=T+m.globals.svgWidth-A+10),V.indexOf("bottom")>-1&&(D=D+m.globals.svgHeight-k-10),p.style.left=T+"px",p.style.top=D+"px",{x:T,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 S=this,A=function(T){var D={paths:m[T],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[T].addEventListener(V,S.onSeriesHover.bind(S,D),{capture:!1,passive:!0})})},k=0;k<m.length;k++)A(k)}},{key:"onSeriesHover",value:function(m,p){var S=this,A=Date.now()-this.lastHoverTime;A>=100?this.seriesHover(m,p):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout(function(){S.seriesHover(m,p)},100-A))}},{key:"seriesHover",value:function(m,p){var S=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(T){var D=S.getElTooltip(T),V={paths:m.paths,tooltipEl:D,tooltipY:m.tooltipY,tooltipX:m.tooltipX,elGrid:m.elGrid,hoverArea:m.hoverArea,ttItems:T.w.globals.tooltip.ttItems};T.w.globals.minX===S.w.globals.minX&&T.w.globals.maxX===S.w.globals.maxX&&T.w.globals.tooltip.seriesHoverByContext({chartCtx:T,ttCtx:T.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,S=m.ttCtx,A=m.opt,k=m.e,T=p.w,D=this.getElTooltip(p);D&&(S.tooltipRect={x:0,y:0,ttWidth:D.getBoundingClientRect().width,ttHeight:D.getBoundingClientRect().height},S.e=k,S.tooltipUtil.hasBars()&&!T.globals.comboCharts&&!S.isBarShared&&this.tConfig.onDatasetHover.highlightDataSeries&&new $e(p).toggleSeriesOnHover(k,k.target.parentNode),S.fixedTooltip&&S.drawFixedTooltipRect(),T.globals.axisCharts?S.axisChartsTooltips({e:k,opt:A,tooltipRect:S.tooltipRect}):S.nonAxisChartsTooltips({e:k,opt:A,tooltipRect:S.tooltipRect}))}},{key:"axisChartsTooltips",value:function(m){var p,S,A=m.e,k=m.opt,T=this.w,D=k.elGrid.getBoundingClientRect(),V=A.type==="touchmove"?A.touches[0].clientX:A.clientX,X=A.type==="touchmove"?A.touches[0].clientY:A.clientY;if(this.clientY=X,this.clientX=V,T.globals.capturedSeriesIndex=-1,T.globals.capturedDataPointIndex=-1,X<D.top||X>D.top+D.height)this.handleMouseOut(k);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!T.config.tooltip.shared){var le=parseInt(k.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(le)<0)return void this.handleMouseOut(k)}var ce=this.getElTooltip(),fe=this.getElXCrosshairs(),ye=[];T.config.chart.group&&(ye=this.ctx.getSyncedCharts());var Pe=T.globals.xyCharts||T.config.chart.type==="bar"&&!T.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||T.globals.comboCharts&&this.tooltipUtil.hasBars();if(A.type==="mousemove"||A.type==="touchmove"||A.type==="mouseup"){if(T.globals.collapsedSeries.length+T.globals.ancillaryCollapsedSeries.length===T.globals.series.length)return;fe!==null&&fe.classList.add("apexcharts-active");var Me=this.yaxisTooltips.filter(function(Te){return Te===!0});if(this.ycrosshairs!==null&&Me.length&&this.ycrosshairs.classList.add("apexcharts-active"),Pe&&!this.showOnIntersect||ye.length>1)this.handleStickyTooltip(A,V,X,k);else if(T.config.chart.type==="heatmap"||T.config.chart.type==="treemap"){var Ke=this.intersect.handleHeatTreeTooltip({e:A,opt:k,x:p,y:S,type:T.config.chart.type});p=Ke.x,S=Ke.y,ce.style.left=p+"px",ce.style.top=S+"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:S});if(this.yaxisTooltips.length)for(var we=0;we<T.config.yaxis.length;we++)this.axesTooltip.drawYaxisTooltipText(we,X,this.xyRatios);T.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,S=m.opt,A=m.tooltipRect,k=this.w,T=S.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:S.ttItems,i:parseInt(T,10)-1,shared:!1});var X=k.globals.clientX-V.left-A.ttWidth/2,le=k.globals.clientY-V.top-A.ttHeight-10;if(D.style.left=X+"px",D.style.top=le+"px",k.config.legend.tooltipHoverFormatter){var ce=T-1,fe=(0,k.config.legend.tooltipHoverFormatter)(this.legendLabels[ce].getAttribute("data:default-text"),{seriesIndex:ce,dataPointIndex:ce,w:k});this.legendLabels[ce].innerHTML=fe}}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(ye){var Pe=ye.getAttribute("data:default-text");ye.innerHTML=decodeURIComponent(Pe)}))}},{key:"handleStickyTooltip",value:function(m,p,S,A){var k=this.w,T=this.tooltipUtil.getNearestValues({context:this,hoverArea:A.hoverArea,elGrid:A.elGrid,clientX:p,clientY:S}),D=T.j,V=T.capturedSeries;k.globals.collapsedSeriesIndices.includes(V)&&(V=null);var X=A.elGrid.getBoundingClientRect();if(T.hoverX<0||T.hoverX>X.width)this.handleMouseOut(A);else if(V!==null)this.handleStickyCapturedSeries(m,V,A,D);else if(this.tooltipUtil.isXoverlap(D)||k.globals.isBarHorizontal){var le=k.globals.series.findIndex(function(ce,fe){return!k.globals.collapsedSeriesIndices.includes(fe)});this.create(m,this,le,D,A.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(m,p,S,A){var k=this.w;if(!this.tConfig.shared&&k.globals.series[p][A]===null)return void this.handleMouseOut(S);if(k.globals.series[p][A]!==void 0)this.tConfig.shared&&this.tooltipUtil.isXoverlap(A)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(m,this,p,A,S.ttItems):this.create(m,this,p,A,S.ttItems,!1);else if(this.tooltipUtil.isXoverlap(A)){var T=k.globals.series.findIndex(function(D,V){return!k.globals.collapsedSeriesIndices.includes(V)});this.create(m,this,T,A,S.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var m=this.w,p=new z(this.ctx),S=m.globals.dom.Paper.select(".apexcharts-bar-area"),A=0;A<S.length;A++)p.pathMouseLeave(S[A])}},{key:"handleMouseOut",value:function(m){var p=this.w,S=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(),S!==null&&S.classList.remove("apexcharts-active"),this.ycrosshairs!==null&&this.ycrosshairs.classList.remove("apexcharts-active"),this.isXAxisTooltipEnabled&&this.xaxisTooltip.classList.remove("apexcharts-active"),this.yaxisTooltips.length){this.yaxisTTEls===null&&(this.yaxisTTEls=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));for(var A=0;A<this.yaxisTTEls.length;A++)this.yaxisTTEls[A].classList.remove("apexcharts-active")}p.config.legend.tooltipHoverFormatter&&this.legendLabels.forEach(function(k){var T=k.getAttribute("data:default-text");k.innerHTML=decodeURIComponent(T)})}},{key:"markerClick",value:function(m,p,S){var A=this.w;typeof A.config.chart.events.markerClick=="function"&&A.config.chart.events.markerClick(m,this.ctx,{seriesIndex:p,dataPointIndex:S,w:A}),this.ctx.events.fireEvent("markerClick",[m,this.ctx,{seriesIndex:p,dataPointIndex:S,w:A}])}},{key:"create",value:function(m,p,S,A,k){var T,D,V,X,le,ce,fe,ye,Pe,Me,Ke,we,Te,te,ve,Be,Ue=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,Fe=this.w,at=p;m.type==="mouseup"&&this.markerClick(m,S,A),Ue===null&&(Ue=this.tConfig.shared);var ut=this.tooltipUtil.hasMarkers(S),yt=this.tooltipUtil.getElBars();if(Fe.config.legend.tooltipHoverFormatter){var Lt=Fe.config.legend.tooltipHoverFormatter,Gt=Array.from(this.legendLabels);Gt.forEach(function(Dn){var er=Dn.getAttribute("data:default-text");Dn.innerHTML=decodeURIComponent(er)});for(var an=0;an<Gt.length;an++){var et=Gt[an],Pt=parseInt(et.getAttribute("i"),10),qt=decodeURIComponent(et.getAttribute("data:default-text")),ft=Lt(qt,{seriesIndex:Ue?Pt:S,dataPointIndex:A,w:Fe});if(Ue)et.innerHTML=Fe.globals.collapsedSeriesIndices.indexOf(Pt)<0?ft:qt;else if(et.innerHTML=Pt===S?ft:qt,S===Pt)break}}var tt=y(y({ttItems:k,i:S,j:A},((T=Fe.globals.seriesRange)===null||T===void 0||(D=T[S])===null||D===void 0||(V=D[A])===null||V===void 0||(X=V.y[0])===null||X===void 0?void 0:X.y1)!==void 0&&{y1:(le=Fe.globals.seriesRange)===null||le===void 0||(ce=le[S])===null||ce===void 0||(fe=ce[A])===null||fe===void 0||(ye=fe.y[0])===null||ye===void 0?void 0:ye.y1}),((Pe=Fe.globals.seriesRange)===null||Pe===void 0||(Me=Pe[S])===null||Me===void 0||(Ke=Me[A])===null||Ke===void 0||(we=Ke.y[0])===null||we===void 0?void 0:we.y2)!==void 0&&{y2:(Te=Fe.globals.seriesRange)===null||Te===void 0||(te=Te[S])===null||te===void 0||(ve=te[A])===null||ve===void 0||(Be=ve.y[0])===null||Be===void 0?void 0:Be.y2});if(Ue){if(at.tooltipLabels.drawSeriesTexts(y(y({},tt),{},{shared:!this.showOnIntersect&&this.tConfig.shared})),ut)Fe.globals.markers.largestSize>0?at.marker.enlargePoints(A):at.tooltipPosition.moveDynamicPointsOnHover(A);else if(this.tooltipUtil.hasBars()&&(this.barSeriesHeight=this.tooltipUtil.getBarsHeight(yt),this.barSeriesHeight>0)){var Bt=new z(this.ctx),gn=Fe.globals.dom.Paper.select(".apexcharts-bar-area[j='".concat(A,"']"));this.deactivateHoverFilter(),this.tooltipPosition.moveStickyTooltipOverBars(A,S);for(var tr=0;tr<gn.length;tr++)Bt.pathMouseEnter(gn[tr])}}else at.tooltipLabels.drawSeriesTexts(y({shared:!1},tt)),this.tooltipUtil.hasBars()&&at.tooltipPosition.moveStickyTooltipOverBars(A,S),ut&&at.tooltipPosition.moveMarkers(S,A)}}]),ke}(),Rt=function(){function ke(m){s(this,ke),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(ke,[{key:"handleBarDataLabels",value:function(m){var p,S,A=m.x,k=m.y,T=m.y1,D=m.y2,V=m.i,X=m.j,le=m.realIndex,ce=m.columnGroupIndex,fe=m.series,ye=m.barHeight,Pe=m.barWidth,Me=m.barXPosition,Ke=m.barYPosition,we=m.visibleSeries,Te=m.renderedPath,te=this.w,ve=new z(this.barCtx.ctx),Be=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[le]:this.barCtx.strokeWidth;te.globals.isXNumeric&&!te.globals.isBarHorizontal?(p=A+parseFloat(Pe*(we+1)),S=k+parseFloat(ye*(we+1))-Be):(p=A+parseFloat(Pe*we),S=k+parseFloat(ye*we));var Ue,Fe=null,at=A,ut=k,yt={},Lt=te.config.dataLabels,Gt=this.barCtx.barOptions.dataLabels,an=this.barCtx.barOptions.dataLabels.total;Ke!==void 0&&this.barCtx.isRangeBar&&(S=Ke,ut=Ke),Me!==void 0&&this.barCtx.isVerticalGroupedRangeBar&&(p=Me,at=Me);var et=Lt.offsetX,Pt=Lt.offsetY,qt={width:0,height:0};if(te.config.dataLabels.enabled){var ft=te.globals.series[V][X];qt=ve.getTextRects(te.config.dataLabels.formatter?te.config.dataLabels.formatter(ft,y(y({},te),{},{seriesIndex:V,dataPointIndex:X,w:te})):te.globals.yLabelFormatters[0](ft),parseFloat(Lt.style.fontSize))}var tt={x:A,y:k,i:V,j:X,realIndex:le,columnGroupIndex:ce,renderedPath:Te,bcx:p,bcy:S,barHeight:ye,barWidth:Pe,textRects:qt,strokeWidth:Be,dataLabelsX:at,dataLabelsY:ut,dataLabelsConfig:Lt,barDataLabelsConfig:Gt,barTotalDataLabelsConfig:an,offX:et,offY:Pt};return yt=this.barCtx.isHorizontal?this.calculateBarsDataLabelsPosition(tt):this.calculateColumnsDataLabelsPosition(tt),Te.attr({cy:yt.bcy,cx:yt.bcx,j:X,val:te.globals.series[V][X],barHeight:ye,barWidth:Pe}),Ue=this.drawCalculatedDataLabels({x:yt.dataLabelsX,y:yt.dataLabelsY,val:this.barCtx.isRangeBar?[T,D]:te.config.chart.stackType==="100%"?fe[le][X]:te.globals.series[le][X],i:le,j:X,barWidth:Pe,barHeight:ye,textRects:qt,dataLabelsConfig:Lt}),te.config.chart.stacked&&an.enabled&&(Fe=this.drawTotalDataLabels({x:yt.totalDataLabelsX,y:yt.totalDataLabelsY,barWidth:Pe,barHeight:ye,realIndex:le,textAnchor:yt.totalDataLabelsAnchor,val:this.getStackedTotalDataLabel({realIndex:le,j:X}),dataLabelsConfig:Lt,barTotalDataLabelsConfig:an})),{dataLabels:Ue,totalDataLabels:Fe}}},{key:"getStackedTotalDataLabel",value:function(m){var p=m.realIndex,S=m.j,A=this.w,k=this.barCtx.stackedSeriesTotals[S];return this.totalFormatter&&(k=this.totalFormatter(k,y(y({},A),{},{seriesIndex:p,dataPointIndex:S,w:A}))),k}},{key:"calculateColumnsDataLabelsPosition",value:function(m){var p=this.w,S=m.i,A=m.j,k=m.realIndex;m.columnGroupIndex;var T,D,V=m.y,X=m.bcx,le=m.barWidth,ce=m.barHeight,fe=m.textRects,ye=m.dataLabelsX,Pe=m.dataLabelsY,Me=m.dataLabelsConfig,Ke=m.barDataLabelsConfig,we=m.barTotalDataLabelsConfig,Te=m.strokeWidth,te=m.offX,ve=m.offY,Be=X;ce=Math.abs(ce);var Ue=p.config.plotOptions.bar.dataLabels.orientation==="vertical",Fe=this.barCtx.barHelpers.getZeroValueEncounters({i:S,j:A}).zeroEncounters;X-=Te/2;var at=p.globals.gridWidth/p.globals.dataPoints;this.barCtx.isVerticalGroupedRangeBar?ye+=le/2:(ye=p.globals.isXNumeric?X-le/2+te:X-at+le/2+te,Fe>0&&p.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(ye-=le*Fe)),Ue&&(ye=ye+fe.height/2-Te/2-2);var ut=p.globals.series[S][A]<0,yt=V;switch(this.barCtx.isReversed&&(yt=V+(ut?ce:-ce)),Ke.position){case"center":Pe=Ue?ut?yt-ce/2+ve:yt+ce/2-ve:ut?yt-ce/2+fe.height/2+ve:yt+ce/2+fe.height/2-ve;break;case"bottom":Pe=Ue?ut?yt-ce+ve:yt+ce-ve:ut?yt-ce+fe.height+Te+ve:yt+ce-fe.height/2+Te-ve;break;case"top":Pe=Ue?ut?yt+ve:yt-ve:ut?yt-fe.height/2-ve:yt+fe.height+ve}if(this.barCtx.lastActiveBarSerieIndex===k&&we.enabled){var Lt=new z(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:k,j:A}),Me.fontSize);T=ut?yt-Lt.height/2-ve-we.offsetY+18:yt+Lt.height+ve+we.offsetY-18;var Gt=at;D=Be+(p.globals.isXNumeric?-le*p.globals.barGroups.length/2:p.globals.barGroups.length*le/2-(p.globals.barGroups.length-1)*le-Gt)+we.offsetX}return p.config.chart.stacked||(Pe<0?Pe=0+Te:Pe+fe.height/3>p.globals.gridHeight&&(Pe=p.globals.gridHeight-Te)),{bcx:X,bcy:V,dataLabelsX:ye,dataLabelsY:Pe,totalDataLabelsX:D,totalDataLabelsY:T,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(m){var p=this.w,S=m.x,A=m.i,k=m.j,T=m.realIndex,D=m.bcy,V=m.barHeight,X=m.barWidth,le=m.textRects,ce=m.dataLabelsX,fe=m.strokeWidth,ye=m.dataLabelsConfig,Pe=m.barDataLabelsConfig,Me=m.barTotalDataLabelsConfig,Ke=m.offX,we=m.offY,Te=p.globals.gridHeight/p.globals.dataPoints;X=Math.abs(X);var te,ve,Be=D-(this.barCtx.isRangeBar?0:Te)+V/2+le.height/2+we-3,Ue="start",Fe=p.globals.series[A][k]<0,at=S;switch(this.barCtx.isReversed&&(at=S+(Fe?-X:X),Ue=Fe?"start":"end"),Pe.position){case"center":ce=Fe?at+X/2-Ke:Math.max(le.width/2,at-X/2)+Ke;break;case"bottom":ce=Fe?at+X-fe-Ke:at-X+fe+Ke;break;case"top":ce=Fe?at-fe-Ke:at-fe+Ke}if(this.barCtx.lastActiveBarSerieIndex===T&&Me.enabled){var ut=new z(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:T,j:k}),ye.fontSize);Fe?(te=at-fe-Ke-Me.offsetX,Ue="end"):te=at+Ke+Me.offsetX+(this.barCtx.isReversed?-(X+fe):fe),ve=Be-le.height/2+ut.height/2+Me.offsetY+fe}return p.config.chart.stacked||(ye.textAnchor==="start"?ce-le.width<0?ce=Fe?le.width+fe:fe:ce+le.width>p.globals.gridWidth&&(ce=Fe?p.globals.gridWidth-fe:p.globals.gridWidth-le.width-fe):ye.textAnchor==="middle"?ce-le.width/2<0?ce=le.width/2+fe:ce+le.width/2>p.globals.gridWidth&&(ce=p.globals.gridWidth-le.width/2-fe):ye.textAnchor==="end"&&(ce<1?ce=le.width+fe:ce+1>p.globals.gridWidth&&(ce=p.globals.gridWidth-le.width-fe))),{bcx:S,bcy:D,dataLabelsX:ce,dataLabelsY:Be,totalDataLabelsX:te,totalDataLabelsY:ve,totalDataLabelsAnchor:Ue}}},{key:"drawCalculatedDataLabels",value:function(m){var p=m.x,S=m.y,A=m.val,k=m.i,T=m.j,D=m.textRects,V=m.barHeight,X=m.barWidth,le=m.dataLabelsConfig,ce=this.w,fe="rotate(0)";ce.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(fe="rotate(-90, ".concat(p,", ").concat(S,")"));var ye=new Oe(this.barCtx.ctx),Pe=new z(this.barCtx.ctx),Me=le.formatter,Ke=null,we=ce.globals.collapsedSeriesIndices.indexOf(k)>-1;if(le.enabled&&!we){Ke=Pe.group({class:"apexcharts-data-labels",transform:fe});var Te="";A!==void 0&&(Te=Me(A,y(y({},ce),{},{seriesIndex:k,dataPointIndex:T,w:ce}))),!A&&ce.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(Te="");var te=ce.globals.series[k][T]<0,ve=ce.config.plotOptions.bar.dataLabels.position;ce.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(ve==="top"&&(le.textAnchor=te?"end":"start"),ve==="center"&&(le.textAnchor="middle"),ve==="bottom"&&(le.textAnchor=te?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&X<Pe.getTextRects(Te,parseFloat(le.style.fontSize)).width&&(Te=""),ce.config.chart.stacked&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&(this.barCtx.isHorizontal?D.width/1.6>Math.abs(X)&&(Te=""):D.height/1.6>Math.abs(V)&&(Te=""));var Be=y({},le);this.barCtx.isHorizontal&&A<0&&(le.textAnchor==="start"?Be.textAnchor="end":le.textAnchor==="end"&&(Be.textAnchor="start")),ye.plotDataLabelsText({x:p,y:S,text:Te,i:k,j:T,parent:Ke,dataLabelsConfig:Be,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return Ke}},{key:"drawTotalDataLabels",value:function(m){var p=m.x,S=m.y,A=m.val,k=m.realIndex,T=m.textAnchor,D=m.barTotalDataLabelsConfig;this.w;var V,X=new z(this.barCtx.ctx);return D.enabled&&p!==void 0&&S!==void 0&&this.barCtx.lastActiveBarSerieIndex===k&&(V=X.drawText({x:p,y:S,foreColor:D.style.color,text:A,textAnchor:T,fontFamily:D.style.fontFamily,fontSize:D.style.fontSize,fontWeight:D.style.fontWeight})),V}}]),ke}(),mn=function(){function ke(m){s(this,ke),this.w=m.w,this.barCtx=m}return o(ke,[{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 S=0;S<m.length;S++)if(m[S].length>0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=m[S].length),p.globals.isXNumeric)for(var A=0;A<m[S].length;A++)p.globals.seriesX[S][A]>p.globals.minX&&p.globals.seriesX[S][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,S,A,k,T,D,V,X=this.w,le=X.globals.dataPoints;this.barCtx.isRangeBar&&(le=X.globals.labels.length);var ce=this.barCtx.seriesLen;if(X.config.plotOptions.bar.rangeBarGroupRows&&(ce=1),this.barCtx.isHorizontal)k=(S=X.globals.gridHeight/le)/ce,X.globals.isXNumeric&&(k=(S=X.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+X.globals.padHorizontal+(this.barCtx.isReversed?X.globals.gridWidth:0)-(this.barCtx.isReversed?2*this.barCtx.baseLineInvertedY:0),this.barCtx.isFunnel&&(V=X.globals.gridWidth/2),p=(S-k*this.barCtx.seriesLen)/2;else{if(A=X.globals.gridWidth/this.barCtx.visibleItems,X.config.xaxis.convertedCatToNumeric&&(A=X.globals.gridWidth/X.globals.dataPoints),T=A/ce*parseInt(this.barCtx.barOptions.columnWidth,10)/100,X.globals.isXNumeric){var fe=this.barCtx.xRatio;X.globals.minXDiff&&X.globals.minXDiff!==.5&&X.globals.minXDiff/fe>0&&(A=X.globals.minXDiff/fe),(T=A/ce*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(T=1)}String(this.barCtx.barOptions.columnWidth).indexOf("%")===-1&&(T=parseInt(this.barCtx.barOptions.columnWidth,10)),D=X.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?X.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),m=X.globals.padHorizontal+(A-T*this.barCtx.seriesLen)/2}return X.globals.barHeight=k,X.globals.barWidth=T,{x:m,y:p,yDivision:S,xDivision:A,barHeight:k,barWidth:T,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,S,A){var k,T,D,V,X,le=this.w,ce=this.barCtx.ctx.fill,fe=null,ye=this.barCtx.barOptions.distributed?S:p;return this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map(function(Pe){m[p][S]>=Pe.from&&m[p][S]<=Pe.to&&(fe=Pe.color)}),(k=le.config.series[p].data[S])!==null&&k!==void 0&&k.fillColor&&(fe=le.config.series[p].data[S].fillColor),ce.fillPath({seriesNumber:this.barCtx.barOptions.distributed?ye:A,dataPointIndex:S,color:fe,value:m[p][S],fillConfig:(T=le.config.series[p].data[S])===null||T===void 0?void 0:T.fill,fillType:(D=le.config.series[p].data[S])!==null&&D!==void 0&&(V=D.fill)!==null&&V!==void 0&&V.type?(X=le.config.series[p].data[S])===null||X===void 0?void 0:X.fill.type:Array.isArray(le.config.fill.type)?le.config.fill.type[A]:le.config.fill.type})}},{key:"getStrokeWidth",value:function(m,p,S){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[S]:this.barCtx.strokeWidth)),A}},{key:"createBorderRadiusArr",value:function(m){var p=this.w,S=!this.w.config.chart.stacked||p.config.plotOptions.bar.borderRadiusWhenStacked!=="last"||p.config.plotOptions.bar.borderRadius<=0,A=m.length,k=m[0].length,T=Array.from({length:A},function(){return Array(k).fill(S?"top":"none")});if(S)return T;for(var D=0;D<k;D++){for(var V=[],X=[],le=0,ce=0;ce<A;ce++){var fe=m[ce][D];fe>0?(V.push(ce),le++):fe<0&&(X.push(ce),le++)}if(V.length>0&&X.length===0)if(V.length===1)T[V[0]][D]="both";else{var ye,Pe=V[0],Me=V[V.length-1],Ke=l(V);try{for(Ke.s();!(ye=Ke.n()).done;){var we=ye.value;T[we][D]=we===Pe?"bottom":we===Me?"top":"none"}}catch(Pt){Ke.e(Pt)}finally{Ke.f()}}else if(X.length>0&&V.length===0)if(X.length===1)T[X[0]][D]="both";else{var Te,te=X[0],ve=X[X.length-1],Be=l(X);try{for(Be.s();!(Te=Be.n()).done;){var Ue=Te.value;T[Ue][D]=Ue===te?"bottom":Ue===ve?"top":"none"}}catch(Pt){Be.e(Pt)}finally{Be.f()}}else if(V.length>0&&X.length>0){var Fe,at=V[V.length-1],ut=l(V);try{for(ut.s();!(Fe=ut.n()).done;){var yt=Fe.value;T[yt][D]=yt===at?"top":"none"}}catch(Pt){ut.e(Pt)}finally{ut.f()}var Lt,Gt=X[X.length-1],an=l(X);try{for(an.s();!(Lt=an.n()).done;){var et=Lt.value;T[et][D]=et===Gt?"bottom":"none"}}catch(Pt){an.e(Pt)}finally{an.f()}}else le===1&&(T[V[0]||X[0]][D]="both")}return T}},{key:"barBackground",value:function(m){var p=m.j,S=m.i,A=m.x1,k=m.x2,T=m.y1,D=m.y2,V=m.elSeries,X=this.w,le=new z(this.barCtx.ctx),ce=new $e(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&ce===S){p>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(p%=this.barCtx.barOptions.colors.backgroundBarColors.length);var fe=this.barCtx.barOptions.colors.backgroundBarColors[p],ye=le.drawRect(A!==void 0?A:0,T!==void 0?T:0,k!==void 0?k:X.globals.gridWidth,D!==void 0?D:X.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,fe,this.barCtx.barOptions.colors.backgroundBarOpacity);V.add(ye),ye.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(m){var p,S=m.barWidth,A=m.barXPosition,k=m.y1,T=m.y2,D=m.strokeWidth,V=m.isReversed,X=m.series,le=m.seriesGroup,ce=m.realIndex,fe=m.i,ye=m.j,Pe=m.w,Me=new z(this.barCtx.ctx);(D=Array.isArray(D)?D[ce]:D)||(D=0);var Ke=S,we=A;(p=Pe.config.series[ce].data[ye])!==null&&p!==void 0&&p.columnWidthOffset&&(we=A-Pe.config.series[ce].data[ye].columnWidthOffset/2,Ke=S+Pe.config.series[ce].data[ye].columnWidthOffset);var Te=D/2,te=we+Te,ve=we+Ke-Te,Be=(X[fe][ye]>=0?1:-1)*(V?-1:1);k+=.001-Te*Be,T+=.001+Te*Be;var Ue=Me.move(te,k),Fe=Me.move(te,k),at=Me.line(ve,k);if(Pe.globals.previousPaths.length>0&&(Fe=this.barCtx.getPreviousPath(ce,ye,!1)),Ue=Ue+Me.line(te,T)+Me.line(ve,T)+at+(Pe.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ce][ye]==="both"?" Z":" z"),Fe=Fe+Me.line(te,k)+at+at+at+at+at+Me.line(te,k)+(Pe.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ce][ye]==="both"?" Z":" z"),this.arrBorderRadius[ce][ye]!=="none"&&(Ue=Me.roundPathCorners(Ue,Pe.config.plotOptions.bar.borderRadius)),Pe.config.chart.stacked){var ut=this.barCtx;(ut=this.barCtx[le]).yArrj.push(T-Te*Be),ut.yArrjF.push(Math.abs(k-T+D*Be)),ut.yArrjVal.push(this.barCtx.series[fe][ye])}return{pathTo:Ue,pathFrom:Fe}}},{key:"getBarpaths",value:function(m){var p,S=m.barYPosition,A=m.barHeight,k=m.x1,T=m.x2,D=m.strokeWidth,V=m.isReversed,X=m.series,le=m.seriesGroup,ce=m.realIndex,fe=m.i,ye=m.j,Pe=m.w,Me=new z(this.barCtx.ctx);(D=Array.isArray(D)?D[ce]:D)||(D=0);var Ke=S,we=A;(p=Pe.config.series[ce].data[ye])!==null&&p!==void 0&&p.barHeightOffset&&(Ke=S-Pe.config.series[ce].data[ye].barHeightOffset/2,we=A+Pe.config.series[ce].data[ye].barHeightOffset);var Te=D/2,te=Ke+Te,ve=Ke+we-Te,Be=(X[fe][ye]>=0?1:-1)*(V?-1:1);k+=.001+Te*Be,T+=.001-Te*Be;var Ue=Me.move(k,te),Fe=Me.move(k,te);Pe.globals.previousPaths.length>0&&(Fe=this.barCtx.getPreviousPath(ce,ye,!1));var at=Me.line(k,ve);if(Ue=Ue+Me.line(T,te)+Me.line(T,ve)+at+(Pe.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ce][ye]==="both"?" Z":" z"),Fe=Fe+Me.line(k,te)+at+at+at+at+at+Me.line(k,te)+(Pe.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ce][ye]==="both"?" Z":" z"),this.arrBorderRadius[ce][ye]!=="none"&&(Ue=Me.roundPathCorners(Ue,Pe.config.plotOptions.bar.borderRadius)),Pe.config.chart.stacked){var ut=this.barCtx;(ut=this.barCtx[le]).xArrj.push(T+Te*Be),ut.xArrjF.push(Math.abs(k-T-D*Be)),ut.xArrjVal.push(this.barCtx.series[fe][ye])}return{pathTo:Ue,pathFrom:Fe}}},{key:"checkZeroSeries",value:function(m){for(var p=m.series,S=this.w,A=0;A<p.length;A++){for(var k=0,T=0;T<p[S.globals.maxValsInArrayIndex].length;T++)k+=p[A][T];k===0&&this.barCtx.zeroSerieses.push(A)}}},{key:"getXForValue",value:function(m,p){var S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2]?p:null;return m!=null&&(S=p+m/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?m/this.barCtx.invertedYRatio:0)),S}},{key:"getYForValue",value:function(m,p,S){var A=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3]?p:null;return m!=null&&(A=p-m/this.barCtx.yRatio[S]+2*(this.barCtx.isReversed?m/this.barCtx.yRatio[S]:0)),A}},{key:"getGoalValues",value:function(m,p,S,A,k,T){var D=this,V=this.w,X=[],le=function(ye,Pe){var Me;X.push((u(Me={},m,m==="x"?D.getXForValue(ye,p,!1):D.getYForValue(ye,S,T,!1)),u(Me,"attrs",Pe),Me))};if(V.globals.seriesGoals[A]&&V.globals.seriesGoals[A][k]&&Array.isArray(V.globals.seriesGoals[A][k])&&V.globals.seriesGoals[A][k].forEach(function(ye){le(ye.value,ye)}),this.barCtx.barOptions.isDumbbell&&V.globals.seriesRange.length){var ce=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:V.globals.colors,fe={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(ce[A])?ce[A][0]:ce[A]};le(V.globals.seriesRangeStart[A][k],fe),le(V.globals.seriesRangeEnd[A][k],y(y({},fe),{},{strokeColor:Array.isArray(ce[A])?ce[A][1]:ce[A]}))}return X}},{key:"drawGoalLine",value:function(m){var p=m.barXPosition,S=m.barYPosition,A=m.goalX,k=m.goalY,T=m.barWidth,D=m.barHeight,V=new z(this.barCtx.ctx),X=V.group({className:"apexcharts-bar-goals-groups"});X.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:X.node}),X.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var le=null;return this.barCtx.isHorizontal?Array.isArray(A)&&A.forEach(function(ce){if(ce.x>=-1&&ce.x<=V.w.globals.gridWidth+1){var fe=ce.attrs.strokeHeight!==void 0?ce.attrs.strokeHeight:D/2,ye=S+fe+D/2;le=V.drawLine(ce.x,ye-2*fe,ce.x,ye,ce.attrs.strokeColor?ce.attrs.strokeColor:void 0,ce.attrs.strokeDashArray,ce.attrs.strokeWidth?ce.attrs.strokeWidth:2,ce.attrs.strokeLineCap),X.add(le)}}):Array.isArray(k)&&k.forEach(function(ce){if(ce.y>=-1&&ce.y<=V.w.globals.gridHeight+1){var fe=ce.attrs.strokeWidth!==void 0?ce.attrs.strokeWidth:T/2,ye=p+fe+T/2;le=V.drawLine(ye-2*fe,ce.y,ye,ce.y,ce.attrs.strokeColor?ce.attrs.strokeColor:void 0,ce.attrs.strokeDashArray,ce.attrs.strokeHeight?ce.attrs.strokeHeight:2,ce.attrs.strokeLineCap),X.add(le)}}),X}},{key:"drawBarShadow",value:function(m){var p=m.prevPaths,S=m.currPaths,A=m.color,k=this.w,T=p.x,D=p.x1,V=p.barYPosition,X=S.x,le=S.x1,ce=S.barYPosition,fe=V+S.barHeight,ye=new z(this.barCtx.ctx),Pe=new F,Me=ye.move(D,fe)+ye.line(T,fe)+ye.line(X,ce)+ye.line(le,ce)+ye.line(D,fe)+(k.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[realIndex][j]==="both"?" Z":" z");return ye.drawPath({d:Me,fill:Pe.shadeColor(.5,F.rgb2hex(A)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadows"})}},{key:"getZeroValueEncounters",value:function(m){var p,S=m.i,A=m.j,k=this.w,T=0,D=0;return(k.config.plotOptions.bar.horizontal?k.globals.series.map(function(V,X){return X}):((p=k.globals.columnSeries)===null||p===void 0?void 0:p.i.map(function(V){return V}))||[]).forEach(function(V){var X=k.globals.seriesPercent[V][A];X&&T++,V<S&&X===0&&D++}),{nonZeroColumns:T,zeroEncounters:D}}},{key:"getGroupIndex",value:function(m){var p=this.w,S=p.globals.seriesGroups.findIndex(function(T){return T.indexOf(p.globals.seriesNames[m])>-1}),A=this.barCtx.columnGroupIndices,k=A.indexOf(S);return k<0&&(A.push(S),k=A.length-1),{groupIndex:S,columnGroupIndex:k}}}]),ke}(),un=function(){function ke(m,p){s(this,ke),this.ctx=m,this.w=m.w;var S=this.w;this.barOptions=S.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=S.config.stroke.width,this.isNullValue=!1,this.isRangeBar=S.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!S.globals.isBarHorizontal&&S.globals.seriesRange.length&&S.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.xyRatios=p,this.xyRatios!==null&&(this.xRatio=p.xRatio,this.yRatio=p.yRatio,this.invertedXRatio=p.invertedXRatio,this.invertedYRatio=p.invertedYRatio,this.baseLineY=p.baseLineY,this.baseLineInvertedY=p.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[];var A=new $e(this.ctx);this.lastActiveBarSerieIndex=A.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var k=A.getBarSeriesIndices(),T=new Q(this.ctx);this.stackedSeriesTotals=T.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 mn(this)}return o(ke,[{key:"draw",value:function(m,p){var S=this.w,A=new z(this.ctx),k=new Q(this.ctx,S);m=k.getLogSeries(m),this.series=m,this.yRatio=k.getLogYRatios(this.yRatio),this.barHelpers.initVariables(m);var T=A.group({class:"apexcharts-bar-series apexcharts-plot-series"});S.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var D=0,V=0;D<m.length;D++,V++){var X,le,ce,fe,ye=void 0,Pe=void 0,Me=[],Ke=[],we=S.globals.comboCharts?p[D]:D,Te=this.barHelpers.getGroupIndex(we).columnGroupIndex,te=A.group({class:"apexcharts-series",rel:D+1,seriesName:F.escapeString(S.globals.seriesNames[we]),"data:realIndex":we});this.ctx.series.addCollapsedClassToSeries(te,we),m[D].length>0&&(this.visibleI=this.visibleI+1);var ve=0,Be=0;this.yRatio.length>1&&(this.yaxisIndex=S.globals.seriesYAxisReverseMap[we],this.translationsIndex=we);var Ue=this.translationsIndex;this.isReversed=S.config.yaxis[this.yaxisIndex]&&S.config.yaxis[this.yaxisIndex].reversed;var Fe=this.barHelpers.initialPositions();Pe=Fe.y,ve=Fe.barHeight,le=Fe.yDivision,fe=Fe.zeroW,ye=Fe.x,Be=Fe.barWidth,X=Fe.xDivision,ce=Fe.zeroH,this.horizontal||Ke.push(ye+Be/2);var at=A.group({class:"apexcharts-datalabels","data:realIndex":we});S.globals.delayedElements.push({el:at.node}),at.node.classList.add("apexcharts-element-hidden");var ut=A.group({class:"apexcharts-bar-goals-markers"}),yt=A.group({class:"apexcharts-bar-shadows"});S.globals.delayedElements.push({el:yt.node}),yt.node.classList.add("apexcharts-element-hidden");for(var Lt=0;Lt<m[D].length;Lt++){var Gt=this.barHelpers.getStrokeWidth(D,Lt,we),an=null,et={indexes:{i:D,j:Lt,realIndex:we,translationsIndex:Ue,bc:V},x:ye,y:Pe,strokeWidth:Gt,elSeries:te};this.isHorizontal?(an=this.drawBarPaths(y(y({},et),{},{barHeight:ve,zeroW:fe,yDivision:le})),Be=this.series[D][Lt]/this.invertedYRatio):(an=this.drawColumnPaths(y(y({},et),{},{xDivision:X,barWidth:Be,zeroH:ce})),ve=this.series[D][Lt]/this.yRatio[Ue]);var Pt=this.barHelpers.getPathFillColor(m,D,Lt,we);if(this.isFunnel&&this.barOptions.isFunnel3d&&this.pathArr.length&&Lt>0){var qt=this.barHelpers.drawBarShadow({color:typeof Pt=="string"&&(Pt==null?void 0:Pt.indexOf("url"))===-1?Pt:F.hexToRgba(S.globals.colors[D]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:an});qt&&yt.add(qt)}this.pathArr.push(an);var ft=this.barHelpers.drawGoalLine({barXPosition:an.barXPosition,barYPosition:an.barYPosition,goalX:an.goalX,goalY:an.goalY,barHeight:ve,barWidth:Be});ft&&ut.add(ft),Pe=an.y,ye=an.x,Lt>0&&Ke.push(ye+Be/2),Me.push(Pe),this.renderSeries({realIndex:we,pathFill:Pt,j:Lt,i:D,columnGroupIndex:Te,pathFrom:an.pathFrom,pathTo:an.pathTo,strokeWidth:Gt,elSeries:te,x:ye,y:Pe,series:m,barHeight:Math.abs(an.barHeight?an.barHeight:ve),barWidth:Math.abs(an.barWidth?an.barWidth:Be),elDataLabelsWrap:at,elGoalsMarkers:ut,elBarShadows:yt,visibleSeries:this.visibleI,type:"bar"})}S.globals.seriesXvalues[we]=Ke,S.globals.seriesYvalues[we]=Me,T.add(te)}return T}},{key:"renderSeries",value:function(m){var p=m.realIndex,S=m.pathFill,A=m.lineFill,k=m.j,T=m.i,D=m.columnGroupIndex,V=m.pathFrom,X=m.pathTo,le=m.strokeWidth,ce=m.elSeries,fe=m.x,ye=m.y,Pe=m.y1,Me=m.y2,Ke=m.series,we=m.barHeight,Te=m.barWidth,te=m.barXPosition,ve=m.barYPosition,Be=m.elDataLabelsWrap,Ue=m.elGoalsMarkers,Fe=m.elBarShadows,at=m.visibleSeries,ut=m.type,yt=m.classes,Lt=this.w,Gt=new z(this.ctx);if(!A){var an=typeof Lt.globals.stroke.colors[p]=="function"?function(tt){var Bt,gn=Lt.config.stroke.colors;return Array.isArray(gn)&&gn.length>0&&((Bt=gn[tt])||(Bt=""),typeof Bt=="function")?Bt({value:Lt.globals.series[tt][k],dataPointIndex:k,w:Lt}):Bt}(p):Lt.globals.stroke.colors[p];A=this.barOptions.distributed?Lt.globals.stroke.colors[k]:an}Lt.config.series[T].data[k]&&Lt.config.series[T].data[k].strokeColor&&(A=Lt.config.series[T].data[k].strokeColor),this.isNullValue&&(S="none");var et=k/Lt.config.chart.animations.animateGradually.delay*(Lt.config.chart.animations.speed/Lt.globals.dataPoints)/2.4,Pt=Gt.renderPaths({i:T,j:k,realIndex:p,pathFrom:V,pathTo:X,stroke:A,strokeWidth:le,strokeLineCap:Lt.config.stroke.lineCap,fill:S,animationDelay:et,initialSpeed:Lt.config.chart.animations.speed,dataChangeSpeed:Lt.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(ut,"-area ").concat(yt),chartType:ut});Pt.attr("clip-path","url(#gridRectBarMask".concat(Lt.globals.cuid,")"));var qt=Lt.config.forecastDataPoints;qt.count>0&&k>=Lt.globals.dataPoints-qt.count&&(Pt.node.setAttribute("stroke-dasharray",qt.dashArray),Pt.node.setAttribute("stroke-width",qt.strokeWidth),Pt.node.setAttribute("fill-opacity",qt.fillOpacity)),Pe!==void 0&&Me!==void 0&&(Pt.attr("data-range-y1",Pe),Pt.attr("data-range-y2",Me)),new L(this.ctx).setSelectionFilter(Pt,p,k),ce.add(Pt);var ft=new Rt(this).handleBarDataLabels({x:fe,y:ye,y1:Pe,y2:Me,i:T,j:k,series:Ke,realIndex:p,columnGroupIndex:D,barHeight:we,barWidth:Te,barXPosition:te,barYPosition:ve,renderedPath:Pt,visibleSeries:at});return ft.dataLabels!==null&&Be.add(ft.dataLabels),ft.totalDataLabels&&Be.add(ft.totalDataLabels),ce.add(Be),Ue&&ce.add(Ue),Fe&&ce.add(Fe),ce}},{key:"drawBarPaths",value:function(m){var p,S=m.indexes,A=m.barHeight,k=m.strokeWidth,T=m.zeroW,D=m.x,V=m.y,X=m.yDivision,le=m.elSeries,ce=this.w,fe=S.i,ye=S.j;if(ce.globals.isXNumeric)p=(V=(ce.globals.seriesX[fe][ye]-ce.globals.minX)/this.invertedXRatio-A)+A*this.visibleI;else if(ce.config.plotOptions.bar.hideZeroBarsWhenGrouped){var Pe=0,Me=0;ce.globals.seriesPercent.forEach(function(we,Te){we[ye]&&Pe++,Te<fe&&we[ye]===0&&Me++}),Pe>0&&(A=this.seriesLen*A/Pe),p=V+A*this.visibleI,p-=A*Me}else p=V+A*this.visibleI;this.isFunnel&&(T-=(this.barHelpers.getXForValue(this.series[fe][ye],T)-T)/2),D=this.barHelpers.getXForValue(this.series[fe][ye],T);var Ke=this.barHelpers.getBarpaths({barYPosition:p,barHeight:A,x1:T,x2:D,strokeWidth:k,isReversed:this.isReversed,series:this.series,realIndex:S.realIndex,i:fe,j:ye,w:ce});return ce.globals.isXNumeric||(V+=X),this.barHelpers.barBackground({j:ye,i:fe,y1:p-A*this.visibleI,y2:A*this.seriesLen,elSeries:le}),{pathTo:Ke.pathTo,pathFrom:Ke.pathFrom,x1:T,x:D,y:V,goalX:this.barHelpers.getGoalValues("x",T,null,fe,ye),barYPosition:p,barHeight:A}}},{key:"drawColumnPaths",value:function(m){var p,S=m.indexes,A=m.x,k=m.y,T=m.xDivision,D=m.barWidth,V=m.zeroH,X=m.strokeWidth,le=m.elSeries,ce=this.w,fe=S.realIndex,ye=S.translationsIndex,Pe=S.i,Me=S.j,Ke=S.bc;if(ce.globals.isXNumeric){var we=this.getBarXForNumericXAxis({x:A,j:Me,realIndex:fe,barWidth:D});A=we.x,p=we.barXPosition}else if(ce.config.plotOptions.bar.hideZeroBarsWhenGrouped){var Te=this.barHelpers.getZeroValueEncounters({i:Pe,j:Me}),te=Te.nonZeroColumns,ve=Te.zeroEncounters;te>0&&(D=this.seriesLen*D/te),p=A+D*this.visibleI,p-=D*ve}else p=A+D*this.visibleI;k=this.barHelpers.getYForValue(this.series[Pe][Me],V,ye);var Be=this.barHelpers.getColumnPaths({barXPosition:p,barWidth:D,y1:V,y2:k,strokeWidth:X,isReversed:this.isReversed,series:this.series,realIndex:fe,i:Pe,j:Me,w:ce});return ce.globals.isXNumeric||(A+=T),this.barHelpers.barBackground({bc:Ke,j:Me,i:Pe,x1:p-X/2-D*this.visibleI,x2:D*this.seriesLen+X/2,elSeries:le}),{pathTo:Be.pathTo,pathFrom:Be.pathFrom,x:A,y:k,goalY:this.barHelpers.getGoalValues("y",null,V,Pe,Me,ye),barXPosition:p,barWidth:D}}},{key:"getBarXForNumericXAxis",value:function(m){var p=m.x,S=m.barWidth,A=m.realIndex,k=m.j,T=this.w,D=A;return T.globals.seriesX[A].length||(D=T.globals.maxValsInArrayIndex),T.globals.seriesX[D][k]&&(p=(T.globals.seriesX[D][k]-T.globals.minX)/this.xRatio-S*this.seriesLen/2),{barXPosition:p+S*this.visibleI,x:p}}},{key:"getPreviousPath",value:function(m,p){for(var S,A=this.w,k=0;k<A.globals.previousPaths.length;k++){var T=A.globals.previousPaths[k];T.paths&&T.paths.length>0&&parseInt(T.realIndex,10)===parseInt(m,10)&&A.globals.previousPaths[k].paths[p]!==void 0&&(S=A.globals.previousPaths[k].paths[p].d)}return S}}]),ke}(),yn=function(ke){f(p,un);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,A){var k=this,T=this.w;this.graphics=new z(this.ctx),this.bar=new un(this.ctx,this.xyRatios);var D=new Q(this.ctx,T);S=D.getLogSeries(S),this.yRatio=D.getLogYRatios(this.yRatio),this.barHelpers.initVariables(S),T.config.chart.stackType==="100%"&&(S=T.globals.comboCharts?A.map(function(Pe){return T.globals.seriesPercent[Pe]}):T.globals.seriesPercent.slice()),this.series=S,this.barHelpers.initializeStackedPrevVars(this);for(var V=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),X=0,le=0,ce=function(Pe,Me){var Ke=void 0,we=void 0,Te=void 0,te=void 0,ve=T.globals.comboCharts?A[Pe]:Pe,Be=k.barHelpers.getGroupIndex(ve),Ue=Be.groupIndex,Fe=Be.columnGroupIndex;k.groupCtx=k[T.globals.seriesGroups[Ue]];var at=[],ut=[],yt=0;k.yRatio.length>1&&(k.yaxisIndex=T.globals.seriesYAxisReverseMap[ve][0],yt=ve),k.isReversed=T.config.yaxis[k.yaxisIndex]&&T.config.yaxis[k.yaxisIndex].reversed;var Lt=k.graphics.group({class:"apexcharts-series",seriesName:F.escapeString(T.globals.seriesNames[ve]),rel:Pe+1,"data:realIndex":ve});k.ctx.series.addCollapsedClassToSeries(Lt,ve);var Gt=k.graphics.group({class:"apexcharts-datalabels","data:realIndex":ve}),an=k.graphics.group({class:"apexcharts-bar-goals-markers"}),et=0,Pt=0,qt=k.initialPositions(X,le,Ke,we,Te,te,yt);le=qt.y,et=qt.barHeight,we=qt.yDivision,te=qt.zeroW,X=qt.x,Pt=qt.barWidth,Ke=qt.xDivision,Te=qt.zeroH,T.globals.barHeight=et,T.globals.barWidth=Pt,k.barHelpers.initializeStackedXYVars(k),k.groupCtx.prevY.length===1&&k.groupCtx.prevY[0].every(function(Sr){return isNaN(Sr)})&&(k.groupCtx.prevY[0]=k.groupCtx.prevY[0].map(function(){return Te}),k.groupCtx.prevYF[0]=k.groupCtx.prevYF[0].map(function(){return 0}));for(var ft=0;ft<T.globals.dataPoints;ft++){var tt=k.barHelpers.getStrokeWidth(Pe,ft,ve),Bt={indexes:{i:Pe,j:ft,realIndex:ve,translationsIndex:yt,bc:Me},strokeWidth:tt,x:X,y:le,elSeries:Lt,columnGroupIndex:Fe,seriesGroup:T.globals.seriesGroups[Ue]},gn=null;k.isHorizontal?(gn=k.drawStackedBarPaths(y(y({},Bt),{},{zeroW:te,barHeight:et,yDivision:we})),Pt=k.series[Pe][ft]/k.invertedYRatio):(gn=k.drawStackedColumnPaths(y(y({},Bt),{},{xDivision:Ke,barWidth:Pt,zeroH:Te})),et=k.series[Pe][ft]/k.yRatio[yt]);var tr=k.barHelpers.drawGoalLine({barXPosition:gn.barXPosition,barYPosition:gn.barYPosition,goalX:gn.goalX,goalY:gn.goalY,barHeight:et,barWidth:Pt});tr&&an.add(tr),le=gn.y,X=gn.x,at.push(X),ut.push(le);var Dn=k.barHelpers.getPathFillColor(S,Pe,ft,ve),er="";T.globals.isBarHorizontal?k.barHelpers.arrBorderRadius[ve][ft]==="bottom"&&T.globals.series[ve][ft]>0&&(er="apexcharts-flip-x"):k.barHelpers.arrBorderRadius[ve][ft]==="bottom"&&T.globals.series[ve][ft]>0&&(er="apexcharts-flip-y"),Lt=k.renderSeries({realIndex:ve,pathFill:Dn,j:ft,i:Pe,columnGroupIndex:Fe,pathFrom:gn.pathFrom,pathTo:gn.pathTo,strokeWidth:tt,elSeries:Lt,x:X,y:le,series:S,barHeight:et,barWidth:Pt,elDataLabelsWrap:Gt,elGoalsMarkers:an,type:"bar",visibleSeries:Fe,classes:er})}T.globals.seriesXvalues[ve]=at,T.globals.seriesYvalues[ve]=ut,k.groupCtx.prevY.push(k.groupCtx.yArrj),k.groupCtx.prevYF.push(k.groupCtx.yArrjF),k.groupCtx.prevYVal.push(k.groupCtx.yArrjVal),k.groupCtx.prevX.push(k.groupCtx.xArrj),k.groupCtx.prevXF.push(k.groupCtx.xArrjF),k.groupCtx.prevXVal.push(k.groupCtx.xArrjVal),V.add(Lt)},fe=0,ye=0;fe<S.length;fe++,ye++)ce(fe,ye);return V}},{key:"initialPositions",value:function(S,A,k,T,D,V,X){var le,ce,fe=this.w;if(this.isHorizontal){T=fe.globals.gridHeight/fe.globals.dataPoints;var ye=fe.config.plotOptions.bar.barHeight;le=String(ye).indexOf("%")===-1?parseInt(ye,10):T*parseInt(ye,10)/100,V=fe.globals.padHorizontal+(this.isReversed?fe.globals.gridWidth-this.baseLineInvertedY:this.baseLineInvertedY),A=(T-le)/2}else{ce=k=fe.globals.gridWidth/fe.globals.dataPoints;var Pe=fe.config.plotOptions.bar.columnWidth;fe.globals.isXNumeric&&fe.globals.dataPoints>1?ce=(k=fe.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:String(Pe).indexOf("%")===-1?ce=parseInt(Pe,10):ce*=parseInt(Pe,10)/100,D=this.isReversed?this.baseLineY[X]:fe.globals.gridHeight-this.baseLineY[X],S=fe.globals.padHorizontal+(k-ce)/2}var Me=fe.globals.barGroups.length||1;return{x:S,y:A,yDivision:T,xDivision:k,barHeight:le/Me,barWidth:ce/Me,zeroH:D,zeroW:V}}},{key:"drawStackedBarPaths",value:function(S){for(var A,k=S.indexes,T=S.barHeight,D=S.strokeWidth,V=S.zeroW,X=S.x,le=S.y,ce=S.columnGroupIndex,fe=S.seriesGroup,ye=S.yDivision,Pe=S.elSeries,Me=this.w,Ke=le+ce*T,we=k.i,Te=k.j,te=k.realIndex,ve=k.translationsIndex,Be=0,Ue=0;Ue<this.groupCtx.prevXF.length;Ue++)Be+=this.groupCtx.prevXF[Ue][Te];var Fe;if((Fe=fe.indexOf(Me.config.series[te].name))>0){var at=V;this.groupCtx.prevXVal[Fe-1][Te]<0?at=this.series[we][Te]>=0?this.groupCtx.prevX[Fe-1][Te]+Be-2*(this.isReversed?Be:0):this.groupCtx.prevX[Fe-1][Te]:this.groupCtx.prevXVal[Fe-1][Te]>=0&&(at=this.series[we][Te]>=0?this.groupCtx.prevX[Fe-1][Te]:this.groupCtx.prevX[Fe-1][Te]-Be+2*(this.isReversed?Be:0)),A=at}else A=V;X=this.series[we][Te]===null?A:A+this.series[we][Te]/this.invertedYRatio-2*(this.isReversed?this.series[we][Te]/this.invertedYRatio:0);var ut=this.barHelpers.getBarpaths({barYPosition:Ke,barHeight:T,x1:A,x2:X,strokeWidth:D,isReversed:this.isReversed,series:this.series,realIndex:k.realIndex,seriesGroup:fe,i:we,j:Te,w:Me});return this.barHelpers.barBackground({j:Te,i:we,y1:Ke,y2:T,elSeries:Pe}),le+=ye,{pathTo:ut.pathTo,pathFrom:ut.pathFrom,goalX:this.barHelpers.getGoalValues("x",V,null,we,Te,ve),barXPosition:A,barYPosition:Ke,x:X,y:le}}},{key:"drawStackedColumnPaths",value:function(S){var A=S.indexes,k=S.x,T=S.y,D=S.xDivision,V=S.barWidth,X=S.zeroH,le=S.columnGroupIndex,ce=S.seriesGroup,fe=S.elSeries,ye=this.w,Pe=A.i,Me=A.j,Ke=A.bc,we=A.realIndex,Te=A.translationsIndex;if(ye.globals.isXNumeric){var te=ye.globals.seriesX[we][Me];te||(te=0),k=(te-ye.globals.minX)/this.xRatio-V/2*ye.globals.barGroups.length}for(var ve,Be=k+le*V,Ue=0,Fe=0;Fe<this.groupCtx.prevYF.length;Fe++)Ue+=isNaN(this.groupCtx.prevYF[Fe][Me])?0:this.groupCtx.prevYF[Fe][Me];var at=Pe;if(ce&&(at=ce.indexOf(ye.globals.seriesNames[we])),at>0&&!ye.globals.isXNumeric||at>0&&ye.globals.isXNumeric&&ye.globals.seriesX[we-1][Me]===ye.globals.seriesX[we][Me]){var ut,yt,Lt,Gt=Math.min(this.yRatio.length+1,we+1);if(this.groupCtx.prevY[at-1]!==void 0&&this.groupCtx.prevY[at-1].length)for(var an=1;an<Gt;an++){var et;if(!isNaN((et=this.groupCtx.prevY[at-an])===null||et===void 0?void 0:et[Me])){Lt=this.groupCtx.prevY[at-an][Me];break}}for(var Pt=1;Pt<Gt;Pt++){var qt,ft;if(((qt=this.groupCtx.prevYVal[at-Pt])===null||qt===void 0?void 0:qt[Me])<0){yt=this.series[Pe][Me]>=0?Lt-Ue+2*(this.isReversed?Ue:0):Lt;break}if(((ft=this.groupCtx.prevYVal[at-Pt])===null||ft===void 0?void 0:ft[Me])>=0){yt=this.series[Pe][Me]>=0?Lt:Lt+Ue-2*(this.isReversed?Ue:0);break}}yt===void 0&&(yt=ye.globals.gridHeight),ve=(ut=this.groupCtx.prevYF[0])!==null&&ut!==void 0&&ut.every(function(Bt){return Bt===0})&&this.groupCtx.prevYF.slice(1,at).every(function(Bt){return Bt.every(function(gn){return isNaN(gn)})})?X:yt}else ve=X;T=this.series[Pe][Me]?ve-this.series[Pe][Me]/this.yRatio[Te]+2*(this.isReversed?this.series[Pe][Me]/this.yRatio[Te]:0):ve;var tt=this.barHelpers.getColumnPaths({barXPosition:Be,barWidth:V,y1:ve,y2:T,yRatio:this.yRatio[Te],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:ce,realIndex:A.realIndex,i:Pe,j:Me,w:ye});return this.barHelpers.barBackground({bc:Ke,j:Me,i:Pe,x1:Be,x2:V,elSeries:fe}),{pathTo:tt.pathTo,pathFrom:tt.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,X,Pe,Me),barXPosition:Be,x:ye.globals.isXNumeric?k:k+D,y:T}}}]),p}(),_n=function(ke){f(p,un);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,A,k){var T=this,D=this.w,V=new z(this.ctx),X=D.globals.comboCharts?A:D.config.chart.type,le=new ge(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=D.config.plotOptions.bar.horizontal;var ce=new Q(this.ctx,D);S=ce.getLogSeries(S),this.series=S,this.yRatio=ce.getLogYRatios(this.yRatio),this.barHelpers.initVariables(S);for(var fe=V.group({class:"apexcharts-".concat(X,"-series apexcharts-plot-series")}),ye=function(Me){T.isBoxPlot=D.config.chart.type==="boxPlot"||D.config.series[Me].type==="boxPlot";var Ke,we,Te,te,ve=void 0,Be=void 0,Ue=[],Fe=[],at=D.globals.comboCharts?k[Me]:Me,ut=T.barHelpers.getGroupIndex(at).columnGroupIndex,yt=V.group({class:"apexcharts-series",seriesName:F.escapeString(D.globals.seriesNames[at]),rel:Me+1,"data:realIndex":at});T.ctx.series.addCollapsedClassToSeries(yt,at),S[Me].length>0&&(T.visibleI=T.visibleI+1);var Lt,Gt,an=0;T.yRatio.length>1&&(T.yaxisIndex=D.globals.seriesYAxisReverseMap[at][0],an=at);var et=T.barHelpers.initialPositions();Be=et.y,Lt=et.barHeight,we=et.yDivision,te=et.zeroW,ve=et.x,Gt=et.barWidth,Ke=et.xDivision,Te=et.zeroH,Fe.push(ve+Gt/2);for(var Pt=V.group({class:"apexcharts-datalabels","data:realIndex":at}),qt=function(tt){var Bt=T.barHelpers.getStrokeWidth(Me,tt,at),gn=null,tr={indexes:{i:Me,j:tt,realIndex:at,translationsIndex:an},x:ve,y:Be,strokeWidth:Bt,elSeries:yt};gn=T.isHorizontal?T.drawHorizontalBoxPaths(y(y({},tr),{},{yDivision:we,barHeight:Lt,zeroW:te})):T.drawVerticalBoxPaths(y(y({},tr),{},{xDivision:Ke,barWidth:Gt,zeroH:Te})),Be=gn.y,ve=gn.x,tt>0&&Fe.push(ve+Gt/2),Ue.push(Be),gn.pathTo.forEach(function(Dn,er){var Sr=!T.isBoxPlot&&T.candlestickOptions.wick.useFillColor?gn.color[er]:D.globals.stroke.colors[Me],dr=le.fillPath({seriesNumber:at,dataPointIndex:tt,color:gn.color[er],value:S[Me][tt]});T.renderSeries({realIndex:at,pathFill:dr,lineFill:Sr,j:tt,i:Me,pathFrom:gn.pathFrom,pathTo:Dn,strokeWidth:Bt,elSeries:yt,x:ve,y:Be,series:S,columnGroupIndex:ut,barHeight:Lt,barWidth:Gt,elDataLabelsWrap:Pt,visibleSeries:T.visibleI,type:D.config.chart.type})})},ft=0;ft<D.globals.dataPoints;ft++)qt(ft);D.globals.seriesXvalues[at]=Fe,D.globals.seriesYvalues[at]=Ue,fe.add(yt)},Pe=0;Pe<S.length;Pe++)ye(Pe);return fe}},{key:"drawVerticalBoxPaths",value:function(S){var A=S.indexes,k=S.x;S.y;var T=S.xDivision,D=S.barWidth,V=S.zeroH,X=S.strokeWidth,le=this.w,ce=new z(this.ctx),fe=A.i,ye=A.j,Pe=!0,Me=le.config.plotOptions.candlestick.colors.upward,Ke=le.config.plotOptions.candlestick.colors.downward,we="";this.isBoxPlot&&(we=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var Te=this.yRatio[A.translationsIndex],te=A.realIndex,ve=this.getOHLCValue(te,ye),Be=V,Ue=V;ve.o>ve.c&&(Pe=!1);var Fe=Math.min(ve.o,ve.c),at=Math.max(ve.o,ve.c),ut=ve.m;le.globals.isXNumeric&&(k=(le.globals.seriesX[te][ye]-le.globals.minX)/this.xRatio-D/2);var yt=k+D*this.visibleI;this.series[fe][ye]===void 0||this.series[fe][ye]===null?(Fe=V,at=V):(Fe=V-Fe/Te,at=V-at/Te,Be=V-ve.h/Te,Ue=V-ve.l/Te,ut=V-ve.m/Te);var Lt=ce.move(yt,V),Gt=ce.move(yt+D/2,Fe);return le.globals.previousPaths.length>0&&(Gt=this.getPreviousPath(te,ye,!0)),Lt=this.isBoxPlot?[ce.move(yt,Fe)+ce.line(yt+D/2,Fe)+ce.line(yt+D/2,Be)+ce.line(yt+D/4,Be)+ce.line(yt+D-D/4,Be)+ce.line(yt+D/2,Be)+ce.line(yt+D/2,Fe)+ce.line(yt+D,Fe)+ce.line(yt+D,ut)+ce.line(yt,ut)+ce.line(yt,Fe+X/2),ce.move(yt,ut)+ce.line(yt+D,ut)+ce.line(yt+D,at)+ce.line(yt+D/2,at)+ce.line(yt+D/2,Ue)+ce.line(yt+D-D/4,Ue)+ce.line(yt+D/4,Ue)+ce.line(yt+D/2,Ue)+ce.line(yt+D/2,at)+ce.line(yt,at)+ce.line(yt,ut)+"z"]:[ce.move(yt,at)+ce.line(yt+D/2,at)+ce.line(yt+D/2,Be)+ce.line(yt+D/2,at)+ce.line(yt+D,at)+ce.line(yt+D,Fe)+ce.line(yt+D/2,Fe)+ce.line(yt+D/2,Ue)+ce.line(yt+D/2,Fe)+ce.line(yt,Fe)+ce.line(yt,at-X/2)],Gt+=ce.move(yt,Fe),le.globals.isXNumeric||(k+=T),{pathTo:Lt,pathFrom:Gt,x:k,y:at,barXPosition:yt,color:this.isBoxPlot?we:Pe?[Me]:[Ke]}}},{key:"drawHorizontalBoxPaths",value:function(S){var A=S.indexes;S.x;var k=S.y,T=S.yDivision,D=S.barHeight,V=S.zeroW,X=S.strokeWidth,le=this.w,ce=new z(this.ctx),fe=A.i,ye=A.j,Pe=this.boxOptions.colors.lower;this.isBoxPlot&&(Pe=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var Me=this.invertedYRatio,Ke=A.realIndex,we=this.getOHLCValue(Ke,ye),Te=V,te=V,ve=Math.min(we.o,we.c),Be=Math.max(we.o,we.c),Ue=we.m;le.globals.isXNumeric&&(k=(le.globals.seriesX[Ke][ye]-le.globals.minX)/this.invertedXRatio-D/2);var Fe=k+D*this.visibleI;this.series[fe][ye]===void 0||this.series[fe][ye]===null?(ve=V,Be=V):(ve=V+ve/Me,Be=V+Be/Me,Te=V+we.h/Me,te=V+we.l/Me,Ue=V+we.m/Me);var at=ce.move(V,Fe),ut=ce.move(ve,Fe+D/2);return le.globals.previousPaths.length>0&&(ut=this.getPreviousPath(Ke,ye,!0)),at=[ce.move(ve,Fe)+ce.line(ve,Fe+D/2)+ce.line(Te,Fe+D/2)+ce.line(Te,Fe+D/2-D/4)+ce.line(Te,Fe+D/2+D/4)+ce.line(Te,Fe+D/2)+ce.line(ve,Fe+D/2)+ce.line(ve,Fe+D)+ce.line(Ue,Fe+D)+ce.line(Ue,Fe)+ce.line(ve+X/2,Fe),ce.move(Ue,Fe)+ce.line(Ue,Fe+D)+ce.line(Be,Fe+D)+ce.line(Be,Fe+D/2)+ce.line(te,Fe+D/2)+ce.line(te,Fe+D-D/4)+ce.line(te,Fe+D/4)+ce.line(te,Fe+D/2)+ce.line(Be,Fe+D/2)+ce.line(Be,Fe)+ce.line(Ue,Fe)+"z"],ut+=ce.move(ve,Fe),le.globals.isXNumeric||(k+=T),{pathTo:at,pathFrom:ut,x:Be,y:k,barYPosition:Fe,color:Pe}}},{key:"getOHLCValue",value:function(S,A){var k=this.w;return{o:this.isBoxPlot?k.globals.seriesCandleH[S][A]:k.globals.seriesCandleO[S][A],h:this.isBoxPlot?k.globals.seriesCandleO[S][A]:k.globals.seriesCandleH[S][A],m:k.globals.seriesCandleM[S][A],l:this.isBoxPlot?k.globals.seriesCandleC[S][A]:k.globals.seriesCandleL[S][A],c:this.isBoxPlot?k.globals.seriesCandleL[S][A]:k.globals.seriesCandleC[S][A]}}}]),p}(),In=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"checkColorRange",value:function(){var m=this.w,p=!1,S=m.config.plotOptions[m.config.chart.type];return S.colorScale.ranges.length>0&&S.colorScale.ranges.map(function(A,k){A.from<=0&&(p=!0)}),p}},{key:"getShadeColor",value:function(m,p,S,A){var k=this.w,T=1,D=k.config.plotOptions[m].shadeIntensity,V=this.determineColor(m,p,S);k.globals.hasNegs||A?T=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:(T=1-V.percent/100,m==="treemap"&&(T=(1-V.percent/100)*(1.25*D)));var X=V.color,le=new F;if(k.config.plotOptions[m].enableShades)if(this.w.config.theme.mode==="dark"){var ce=le.shadeColor(-1*T,V.color);X=F.hexToRgba(F.isColorHex(ce)?ce:F.rgb2hex(ce),k.config.fill.opacity)}else{var fe=le.shadeColor(T,V.color);X=F.hexToRgba(F.isColorHex(fe)?fe:F.rgb2hex(fe),k.config.fill.opacity)}return{color:X,colorProps:V}}},{key:"determineColor",value:function(m,p,S){var A=this.w,k=A.globals.series[p][S],T=A.config.plotOptions[m],D=T.colorScale.inverse?S:p;T.distributed&&A.config.chart.type==="treemap"&&(D=S);var V=A.globals.colors[D],X=null,le=Math.min.apply(Math,N(A.globals.series[p])),ce=Math.max.apply(Math,N(A.globals.series[p]));T.distributed||m!=="heatmap"||(le=A.globals.minY,ce=A.globals.maxY),T.colorScale.min!==void 0&&(le=T.colorScale.min<A.globals.minY?T.colorScale.min:A.globals.minY,ce=T.colorScale.max>A.globals.maxY?T.colorScale.max:A.globals.maxY);var fe=Math.abs(ce)+Math.abs(le),ye=100*k/(fe===0?fe-1e-6:fe);return T.colorScale.ranges.length>0&&T.colorScale.ranges.map(function(Pe,Me){if(k>=Pe.from&&k<=Pe.to){V=Pe.color,X=Pe.foreColor?Pe.foreColor:null,le=Pe.from,ce=Pe.to;var Ke=Math.abs(ce)+Math.abs(le);ye=100*k/(Ke===0?Ke-1e-6:Ke)}}),{color:V,foreColor:X,percent:ye}}},{key:"calculateDataLabels",value:function(m){var p=m.text,S=m.x,A=m.y,k=m.i,T=m.j,D=m.colorProps,V=m.fontSize,X=this.w.config.dataLabels,le=new z(this.ctx),ce=new Oe(this.ctx),fe=null;if(X.enabled){fe=le.group({class:"apexcharts-data-labels"});var ye=X.offsetX,Pe=X.offsetY,Me=S+ye,Ke=A+parseFloat(X.style.fontSize)/3+Pe;ce.plotDataLabelsText({x:Me,y:Ke,text:p,i:k,j:T,color:D.foreColor,parent:fe,fontSize:V,dataLabelsConfig:X})}return fe}},{key:"addListeners",value:function(m){var p=new z(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))}}]),ke}(),Sn=function(){function ke(m,p){s(this,ke),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 In(m),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return o(ke,[{key:"draw",value:function(m){var p=this.w,S=new z(this.ctx),A=S.group({class:"apexcharts-heatmap"});A.attr("clip-path","url(#gridRectMask".concat(p.globals.cuid,")"));var k=p.globals.gridWidth/p.globals.dataPoints,T=p.globals.gridHeight/p.globals.series.length,D=0,V=!1;this.negRange=this.helpers.checkColorRange();var X=m.slice();p.config.yaxis[0].reversed&&(V=!0,X.reverse());for(var le=V?0:X.length-1;V?le<X.length:le>=0;V?le++:le--){var ce=S.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:F.escapeString(p.globals.seriesNames[le]),rel:le+1,"data:realIndex":le});if(this.ctx.series.addCollapsedClassToSeries(ce,le),p.config.chart.dropShadow.enabled){var fe=p.config.chart.dropShadow;new L(this.ctx).dropShadow(ce,fe,le)}for(var ye=0,Pe=p.config.plotOptions.heatmap.shadeIntensity,Me=0;Me<X[le].length;Me++){var Ke=this.helpers.getShadeColor(p.config.chart.type,le,Me,this.negRange),we=Ke.color,Te=Ke.colorProps;p.config.fill.type==="image"&&(we=new ge(this.ctx).fillPath({seriesNumber:le,dataPointIndex:Me,opacity:p.globals.hasNegs?Te.percent<0?1-(1+Te.percent/100):Pe+Te.percent/100:Te.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:T}));var te=this.rectRadius,ve=S.drawRect(ye,D,k,T,te);if(ve.attr({cx:ye,cy:D}),ve.node.classList.add("apexcharts-heatmap-rect"),ce.add(ve),ve.attr({fill:we,i:le,index:le,j:Me,val:m[le][Me],"stroke-width":this.strokeWidth,stroke:p.config.plotOptions.heatmap.useFillColorAsStroke?we:p.globals.stroke.colors[0],color:we}),this.helpers.addListeners(ve),p.config.chart.animations.enabled&&!p.globals.dataChanged){var Be=1;p.globals.resized||(Be=p.config.chart.animations.speed),this.animateHeatMap(ve,ye,D,k,T,Be)}if(p.globals.dataChanged){var Ue=1;if(this.dynamicAnim.enabled&&p.globals.shouldAnimate){Ue=this.dynamicAnim.speed;var Fe=p.globals.previousPaths[le]&&p.globals.previousPaths[le][Me]&&p.globals.previousPaths[le][Me].color;Fe||(Fe="rgba(255, 255, 255, 0)"),this.animateHeatColor(ve,F.isColorHex(Fe)?Fe:F.rgb2hex(Fe),F.isColorHex(we)?we:F.rgb2hex(we),Ue)}}var at=(0,p.config.dataLabels.formatter)(p.globals.series[le][Me],{value:p.globals.series[le][Me],seriesIndex:le,dataPointIndex:Me,w:p}),ut=this.helpers.calculateDataLabels({text:at,x:ye+k/2,y:D+T/2,i:le,j:Me,colorProps:Te,series:X});ut!==null&&ce.add(ut),ye+=k}D+=T,A.add(ce)}var yt=p.globals.yAxisScale[0].result.slice();return p.config.yaxis[0].reversed?yt.unshift(""):yt.push(""),p.globals.yAxisScale[0].result=yt,A}},{key:"animateHeatMap",value:function(m,p,S,A,k,T){var D=new $(this.ctx);D.animateRect(m,{x:p+A/2,y:S+k/2,width:0,height:0},{x:p,y:S,width:A,height:k},T,function(){D.animationCompleted(m)})}},{key:"animateHeatColor",value:function(m,p,S,A){m.attr({fill:p}).animate(A).attr({fill:S})}}]),ke}(),Yn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"drawYAxisTexts",value:function(m,p,S,A){var k=this.w,T=k.config.yaxis[0],D=k.globals.yLabelFormatters[0];return new z(this.ctx).drawText({x:m+T.labels.offsetX,y:p+T.labels.offsetY,text:D(A,S),textAnchor:"middle",fontSize:T.labels.style.fontSize,fontFamily:T.labels.style.fontFamily,foreColor:Array.isArray(T.labels.style.colors)?T.labels.style.colors[S]:T.labels.style.colors})}}]),ke}(),Xn=function(){function ke(m){s(this,ke),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 S=p.config.plotOptions.pie.customScale,A=p.globals.gridWidth/2,k=p.globals.gridHeight/2;this.translateX=A-A*S,this.translateY=k-k*S,this.dataLabelsGroup=new z(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(S,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return o(ke,[{key:"draw",value:function(m){var p=this,S=this.w,A=new z(this.ctx),k=A.group({class:"apexcharts-pie"});if(S.globals.noData)return k;for(var T=0,D=0;D<m.length;D++)T+=F.negToZero(m[D]);var V=[],X=A.group();T===0&&(T=1e-5),m.forEach(function(te){p.maxY=Math.max(p.maxY,te)}),S.config.yaxis[0].max&&(this.maxY=S.config.yaxis[0].max),S.config.grid.position==="back"&&this.chartType==="polarArea"&&this.drawPolarElements(k);for(var le=0;le<m.length;le++){var ce=this.fullAngle*F.negToZero(m[le])/T;V.push(ce),this.chartType==="polarArea"?(V[le]=this.fullAngle/m.length,this.sliceSizes.push(S.globals.radialSize*m[le]/this.maxY)):this.sliceSizes.push(S.globals.radialSize)}if(S.globals.dataChanged){for(var fe,ye=0,Pe=0;Pe<S.globals.previousPaths.length;Pe++)ye+=F.negToZero(S.globals.previousPaths[Pe]);for(var Me=0;Me<S.globals.previousPaths.length;Me++)fe=this.fullAngle*F.negToZero(S.globals.previousPaths[Me])/ye,this.prevSectorAngleArr.push(fe)}if(this.donutSize<0&&(this.donutSize=0),this.chartType==="donut"){var Ke=A.drawCircle(this.donutSize);Ke.attr({cx:this.centerX,cy:this.centerY,fill:S.config.plotOptions.pie.donut.background?S.config.plotOptions.pie.donut.background:"transparent"}),X.add(Ke)}var we=this.drawArcs(V,m);if(this.sliceLabels.forEach(function(te){we.add(te)}),X.attr({transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(S.config.plotOptions.pie.customScale,")")}),X.add(we),k.add(X),this.donutDataLabels.show){var Te=this.renderInnerDataLabels(this.dataLabelsGroup,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});k.add(Te)}return S.config.grid.position==="front"&&this.chartType==="polarArea"&&this.drawPolarElements(k),k}},{key:"drawArcs",value:function(m,p){var S=this.w,A=new L(this.ctx),k=new z(this.ctx),T=new ge(this.ctx),D=k.group({class:"apexcharts-slices"}),V=this.initialAngle,X=this.initialAngle,le=this.initialAngle,ce=this.initialAngle;this.strokeWidth=S.config.stroke.show?S.config.stroke.width:0;for(var fe=0;fe<m.length;fe++){var ye=k.group({class:"apexcharts-series apexcharts-pie-series",seriesName:F.escapeString(S.globals.seriesNames[fe]),rel:fe+1,"data:realIndex":fe});D.add(ye),X=ce,le=(V=le)+m[fe],ce=X+this.prevSectorAngleArr[fe];var Pe=le<V?this.fullAngle+le-V:le-V,Me=T.fillPath({seriesNumber:fe,size:this.sliceSizes[fe],value:p[fe]}),Ke=this.getChangedPath(X,ce),we=k.drawPath({d:Ke,stroke:Array.isArray(this.lineColorArr)?this.lineColorArr[fe]:this.lineColorArr,strokeWidth:0,fill:Me,fillOpacity:S.config.fill.opacity,classes:"apexcharts-pie-area apexcharts-".concat(this.chartType.toLowerCase(),"-slice-").concat(fe)});if(we.attr({index:0,j:fe}),A.setSelectionFilter(we,0,fe),S.config.chart.dropShadow.enabled){var Te=S.config.chart.dropShadow;A.dropShadow(we,Te,fe)}this.addListeners(we,this.donutDataLabels),z.setAttrs(we.node,{"data:angle":Pe,"data:startAngle":V,"data:strokeWidth":this.strokeWidth,"data:value":p[fe]});var te={x:0,y:0};this.chartType==="pie"||this.chartType==="polarArea"?te=F.polarToCartesian(this.centerX,this.centerY,S.globals.radialSize/1.25+S.config.plotOptions.pie.dataLabels.offset,(V+Pe/2)%this.fullAngle):this.chartType==="donut"&&(te=F.polarToCartesian(this.centerX,this.centerY,(S.globals.radialSize+this.donutSize)/2+S.config.plotOptions.pie.dataLabels.offset,(V+Pe/2)%this.fullAngle)),ye.add(we);var ve=0;if(!this.initialAnim||S.globals.resized||S.globals.dataChanged?this.animBeginArr.push(0):((ve=Pe/this.fullAngle*S.config.chart.animations.speed)===0&&(ve=1),this.animDur=ve+this.animDur,this.animBeginArr.push(this.animDur)),this.dynamicAnim&&S.globals.dataChanged?this.animatePaths(we,{size:this.sliceSizes[fe],endAngle:le,startAngle:V,prevStartAngle:X,prevEndAngle:ce,animateStartingPos:!0,i:fe,animBeginArr:this.animBeginArr,shouldSetPrevPaths:!0,dur:S.config.chart.animations.dynamicAnimation.speed}):this.animatePaths(we,{size:this.sliceSizes[fe],endAngle:le,startAngle:V,i:fe,totalItems:m.length-1,animBeginArr:this.animBeginArr,dur:ve}),S.config.plotOptions.pie.expandOnClick&&this.chartType!=="polarArea"&&we.node.addEventListener("mouseup",this.pieClicked.bind(this,fe)),S.globals.selectedDataPoints[0]!==void 0&&S.globals.selectedDataPoints[0].indexOf(fe)>-1&&this.pieClicked(fe),S.config.dataLabels.enabled){var Be=te.x,Ue=te.y,Fe=100*Pe/this.fullAngle+"%";if(Pe!==0&&S.config.plotOptions.pie.dataLabels.minAngleToShowLabel<m[fe]){var at=S.config.dataLabels.formatter;at!==void 0&&(Fe=at(S.globals.seriesPercent[fe][0],{seriesIndex:fe,w:S}));var ut=S.globals.dataLabels.style.colors[fe],yt=k.group({class:"apexcharts-datalabels"}),Lt=k.drawText({x:Be,y:Ue,text:Fe,textAnchor:"middle",fontSize:S.config.dataLabels.style.fontSize,fontFamily:S.config.dataLabels.style.fontFamily,fontWeight:S.config.dataLabels.style.fontWeight,foreColor:ut});if(yt.add(Lt),S.config.dataLabels.dropShadow.enabled){var Gt=S.config.dataLabels.dropShadow;A.dropShadow(Lt,Gt)}Lt.node.classList.add("apexcharts-pie-label"),S.config.chart.animations.animate&&S.globals.resized===!1&&(Lt.node.classList.add("apexcharts-pie-label-delay"),Lt.node.style.animationDelay=S.config.chart.animations.speed/940+"s"),this.sliceLabels.push(yt)}}}return D}},{key:"addListeners",value:function(m,p){var S=new z(this.ctx);m.node.addEventListener("mouseenter",S.pathMouseEnter.bind(this,m)),m.node.addEventListener("mouseleave",S.pathMouseLeave.bind(this,m)),m.node.addEventListener("mouseleave",this.revertDataLabelsInner.bind(this,m.node,p)),m.node.addEventListener("mousedown",S.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 S=this.w,A=p.endAngle<p.startAngle?this.fullAngle+p.endAngle-p.startAngle:p.endAngle-p.startAngle,k=A,T=p.startAngle,D=p.startAngle;p.prevStartAngle!==void 0&&p.prevEndAngle!==void 0&&(T=p.prevEndAngle,k=p.prevEndAngle<p.prevStartAngle?this.fullAngle+p.prevEndAngle-p.prevStartAngle:p.prevEndAngle-p.prevStartAngle),p.i===S.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,T,D,A,k,p)}},{key:"animateArc",value:function(m,p,S,A,k,T){var D,V=this,X=this.w,le=new $(this.ctx),ce=T.size;(isNaN(p)||isNaN(k))&&(p=S,k=A,T.dur=0);var fe=A,ye=S,Pe=p<S?this.fullAngle+p-S:p-S;X.globals.dataChanged&&T.shouldSetPrevPaths&&T.prevEndAngle&&(D=V.getPiePath({me:V,startAngle:T.prevStartAngle,angle:T.prevEndAngle<T.prevStartAngle?this.fullAngle+T.prevEndAngle-T.prevStartAngle:T.prevEndAngle-T.prevStartAngle,size:ce}),m.attr({d:D})),T.dur!==0?m.animate(T.dur,X.globals.easing,T.animBeginArr[T.i]).afterAll(function(){V.chartType!=="pie"&&V.chartType!=="donut"&&V.chartType!=="polarArea"||this.animate(X.config.chart.animations.dynamicAnimation.speed).attr({"stroke-width":V.strokeWidth}),T.i===X.config.series.length-1&&le.animationCompleted(m)}).during(function(Me){fe=Pe+(A-Pe)*Me,T.animateStartingPos&&(fe=k+(A-k)*Me,ye=p-k+(S-(p-k))*Me),D=V.getPiePath({me:V,startAngle:ye,angle:fe,size:ce}),m.node.setAttribute("data:pathOrig",D),m.attr({d:D})}):(D=V.getPiePath({me:V,startAngle:ye,angle:A,size:ce}),T.isTrack||(X.globals.animationEnded=!0),m.node.setAttribute("data:pathOrig",D),m.attr({d:D,"stroke-width":V.strokeWidth}))}},{key:"pieClicked",value:function(m){var p,S=this.w,A=this,k=A.sliceSizes[m]+(S.config.plotOptions.pie.expandOnClick?4:0),T=S.globals.dom.Paper.select(".apexcharts-".concat(A.chartType.toLowerCase(),"-slice-").concat(m)).members[0];if(T.attr("data:pieClicked")!=="true"){var D=S.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area");Array.prototype.forEach.call(D,function(ce){ce.setAttribute("data:pieClicked","false");var fe=ce.getAttribute("data:pathOrig");fe&&ce.setAttribute("d",fe)}),S.globals.capturedDataPointIndex=m,T.attr("data:pieClicked","true");var V=parseInt(T.attr("data:startAngle"),10),X=parseInt(T.attr("data:angle"),10);p=A.getPiePath({me:A,startAngle:V,angle:X,size:k}),X!==360&&T.plot(p)}else{T.attr({"data:pieClicked":"false"}),this.revertDataLabelsInner(T.node,this.donutDataLabels);var le=T.attr("data:pathOrig");T.attr({d:le})}}},{key:"getChangedPath",value:function(m,p){var S="";return this.dynamicAnim&&this.w.globals.dataChanged&&(S=this.getPiePath({me:this,startAngle:m,angle:p-m,size:this.size})),S}},{key:"getPiePath",value:function(m){var p,S=m.me,A=m.startAngle,k=m.angle,T=m.size,D=new z(this.ctx),V=A,X=Math.PI*(V-90)/180,le=k+A;Math.ceil(le)>=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(le=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(le)>this.fullAngle&&(le-=this.fullAngle);var ce=Math.PI*(le-90)/180,fe=S.centerX+T*Math.cos(X),ye=S.centerY+T*Math.sin(X),Pe=S.centerX+T*Math.cos(ce),Me=S.centerY+T*Math.sin(ce),Ke=F.polarToCartesian(S.centerX,S.centerY,S.donutSize,le),we=F.polarToCartesian(S.centerX,S.centerY,S.donutSize,V),Te=k>180?1:0,te=["M",fe,ye,"A",T,T,0,Te,1,Pe,Me];return p=S.chartType==="donut"?[].concat(te,["L",Ke.x,Ke.y,"A",S.donutSize,S.donutSize,0,Te,0,we.x,we.y,"L",fe,ye,"z"]).join(" "):S.chartType==="pie"||S.chartType==="polarArea"?[].concat(te,["L",S.centerX,S.centerY,"L",fe,ye]).join(" "):[].concat(te).join(" "),D.roundPathCorners(p,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(m){var p=this.w,S=new st(this.ctx),A=new z(this.ctx),k=new Yn(this.ctx),T=A.group(),D=A.group(),V=S.niceScale(0,Math.ceil(this.maxY),0),X=V.result.reverse(),le=V.result.length;this.maxY=V.niceMax;for(var ce=p.globals.radialSize,fe=ce/(le-1),ye=0;ye<le-1;ye++){var Pe=A.drawCircle(ce);if(Pe.attr({cx:this.centerX,cy:this.centerY,fill:"none","stroke-width":p.config.plotOptions.polarArea.rings.strokeWidth,stroke:p.config.plotOptions.polarArea.rings.strokeColor}),p.config.yaxis[0].show){var Me=k.drawYAxisTexts(this.centerX,this.centerY-ce+parseInt(p.config.yaxis[0].labels.style.fontSize,10)/2,ye,X[ye]);D.add(Me)}T.add(Pe),ce-=fe}this.drawSpokes(m),m.add(T),m.add(D)}},{key:"renderInnerDataLabels",value:function(m,p,S){var A=this.w,k=new z(this.ctx),T=p.total.show;m.node.innerHTML="",m.node.style.opacity=S.opacity;var D,V,X=S.centerX,le=this.donutDataLabels.total.label?S.centerY:S.centerY-S.centerY/6;D=p.name.color===void 0?A.globals.colors[0]:p.name.color;var ce=p.name.fontSize,fe=p.name.fontFamily,ye=p.name.fontWeight;V=p.value.color===void 0?A.config.chart.foreColor:p.value.color;var Pe=p.value.formatter,Me="",Ke="";if(T?(D=p.total.color,ce=p.total.fontSize,fe=p.total.fontFamily,ye=p.total.fontWeight,Ke=this.donutDataLabels.total.label?p.total.label:"",Me=p.total.formatter(A)):A.globals.series.length===1&&(Me=Pe(A.globals.series[0],A),Ke=A.globals.seriesNames[0]),Ke&&(Ke=p.name.formatter(Ke,p.total.show,A)),p.name.show){var we=k.drawText({x:X,y:le+parseFloat(p.name.offsetY),text:Ke,textAnchor:"middle",foreColor:D,fontSize:ce,fontWeight:ye,fontFamily:fe});we.node.classList.add("apexcharts-datalabel-label"),m.add(we)}if(p.value.show){var Te=p.name.show?parseFloat(p.value.offsetY)+16:p.value.offsetY,te=k.drawText({x:X,y:le+Te,text:Me,textAnchor:"middle",foreColor:V,fontWeight:p.value.fontWeight,fontSize:p.value.fontSize,fontFamily:p.value.fontFamily});te.node.classList.add("apexcharts-datalabel-value"),m.add(te)}return m}},{key:"printInnerLabels",value:function(m,p,S,A){var k,T=this.w;A?k=m.name.color===void 0?T.globals.colors[parseInt(A.parentNode.getAttribute("rel"),10)-1]:m.name.color:T.globals.series.length>1&&m.total.show&&(k=m.total.color);var D=T.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),V=T.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");S=(0,m.value.formatter)(S,T),A||typeof m.total.formatter!="function"||(S=m.total.formatter(T));var X=p===m.total.label;p=this.donutDataLabels.total.label?m.name.formatter(p,X,T):"",D!==null&&(D.textContent=p),V!==null&&(V.textContent=S),D!==null&&(D.style.fill=k)}},{key:"printDataLabelsInner",value:function(m,p){var S=this.w,A=m.getAttribute("data:value"),k=S.globals.seriesNames[parseInt(m.parentNode.getAttribute("rel"),10)-1];S.globals.series.length>1&&this.printInnerLabels(p,k,A,m);var T=S.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");T!==null&&(T.style.opacity=1)}},{key:"drawSpokes",value:function(m){var p=this,S=this.w,A=new z(this.ctx),k=S.config.plotOptions.polarArea.spokes;if(k.strokeWidth!==0){for(var T=[],D=360/S.globals.series.length,V=0;V<S.globals.series.length;V++)T.push(F.polarToCartesian(this.centerX,this.centerY,S.globals.radialSize,S.config.plotOptions.pie.startAngle+D*V));T.forEach(function(X,le){var ce=A.drawLine(X.x,X.y,p.centerX,p.centerY,Array.isArray(k.connectorColors)?k.connectorColors[le]:k.connectorColors);m.add(ce)})}}},{key:"revertDataLabelsInner",value:function(){var m=this.w;if(this.donutDataLabels.show){var p=m.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0],S=this.renderInnerDataLabels(p,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});m.globals.dom.Paper.select(".apexcharts-radialbar, .apexcharts-pie").members[0].add(S)}}}]),ke}(),zn=function(){function ke(m){s(this,ke),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 z(this.ctx),this.lineColorArr=p.globals.stroke.colors!==void 0?p.globals.stroke.colors:p.globals.colors,this.defaultSize=p.globals.svgHeight<p.globals.svgWidth?p.globals.gridHeight:p.globals.gridWidth,this.isLog=p.config.yaxis[0].logarithmic,this.logBase=p.config.yaxis[0].logBase,this.coreUtils=new Q(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(ke,[{key:"draw",value:function(m){var p=this,S=this.w,A=new ge(this.ctx),k=[],T=new Oe(this.ctx);m.length&&(this.dataPointsLen=m[S.globals.maxValsInArrayIndex].length),this.disAngle=2*Math.PI/this.dataPointsLen;var D=S.globals.gridWidth/2,V=S.globals.gridHeight/2,X=D+S.config.plotOptions.radar.offsetX,le=V+S.config.plotOptions.radar.offsetY,ce=this.graphics.group({class:"apexcharts-radar-series apexcharts-plot-series",transform:"translate(".concat(X||0,", ").concat(le||0,")")}),fe=[],ye=null,Pe=null;if(this.yaxisLabels=this.graphics.group({class:"apexcharts-yaxis"}),m.forEach(function(Ke,we){var Te=Ke.length===S.globals.dataPoints,te=p.graphics.group().attr({class:"apexcharts-series","data:longestSeries":Te,seriesName:F.escapeString(S.globals.seriesNames[we]),rel:we+1,"data:realIndex":we});p.dataRadiusOfPercent[we]=[],p.dataRadius[we]=[],p.angleArr[we]=[],Ke.forEach(function(an,et){var Pt=Math.abs(p.maxValue-p.minValue);an-=p.minValue,p.isLog&&(an=p.coreUtils.getLogVal(p.logBase,an,0)),p.dataRadiusOfPercent[we][et]=an/Pt,p.dataRadius[we][et]=p.dataRadiusOfPercent[we][et]*p.size,p.angleArr[we][et]=et*p.disAngle}),fe=p.getDataPointsPos(p.dataRadius[we],p.angleArr[we]);var ve=p.createPaths(fe,{x:0,y:0});ye=p.graphics.group({class:"apexcharts-series-markers-wrap apexcharts-element-hidden"}),Pe=p.graphics.group({class:"apexcharts-datalabels","data:realIndex":we}),S.globals.delayedElements.push({el:ye.node,index:we});var Be={i:we,realIndex:we,animationDelay:we,initialSpeed:S.config.chart.animations.speed,dataChangeSpeed:S.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-radar",shouldClipToGrid:!1,bindEventsOnPaths:!1,stroke:S.globals.stroke.colors[we],strokeLineCap:S.config.stroke.lineCap},Ue=null;S.globals.previousPaths.length>0&&(Ue=p.getPreviousPath(we));for(var Fe=0;Fe<ve.linePathsTo.length;Fe++){var at=p.graphics.renderPaths(y(y({},Be),{},{pathFrom:Ue===null?ve.linePathsFrom[Fe]:Ue,pathTo:ve.linePathsTo[Fe],strokeWidth:Array.isArray(p.strokeWidth)?p.strokeWidth[we]:p.strokeWidth,fill:"none",drawShadow:!1}));te.add(at);var ut=A.fillPath({seriesNumber:we}),yt=p.graphics.renderPaths(y(y({},Be),{},{pathFrom:Ue===null?ve.areaPathsFrom[Fe]:Ue,pathTo:ve.areaPathsTo[Fe],strokeWidth:0,fill:ut,drawShadow:!1}));if(S.config.chart.dropShadow.enabled){var Lt=new L(p.ctx),Gt=S.config.chart.dropShadow;Lt.dropShadow(yt,Object.assign({},Gt,{noUserSpaceOnUse:!0}),we)}te.add(yt)}Ke.forEach(function(an,et){var Pt=new Ce(p.ctx).getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:we,dataPointIndex:et}),qt=p.graphics.drawMarker(fe[et].x,fe[et].y,Pt);qt.attr("rel",et),qt.attr("j",et),qt.attr("index",we),qt.node.setAttribute("default-marker-size",Pt.pSize);var ft=p.graphics.group({class:"apexcharts-series-markers"});ft&&ft.add(qt),ye.add(ft),te.add(ye);var tt=S.config.dataLabels;if(tt.enabled){var Bt=tt.formatter(S.globals.series[we][et],{seriesIndex:we,dataPointIndex:et,w:S});T.plotDataLabelsText({x:fe[et].x,y:fe[et].y,text:Bt,textAnchor:"middle",i:we,j:we,parent:Pe,offsetCorrection:!1,dataLabelsConfig:y({},tt)})}te.add(Pe)}),k.push(te)}),this.drawPolygons({parent:ce}),S.config.xaxis.labels.show){var Me=this.drawXAxisTexts();ce.add(Me)}return k.forEach(function(Ke){ce.add(Ke)}),ce.add(this.yaxisLabels),ce}},{key:"drawPolygons",value:function(m){for(var p=this,S=this.w,A=m.parent,k=new Yn(this.ctx),T=S.globals.yAxisScale[0].result.reverse(),D=T.length,V=[],X=this.size/(D-1),le=0;le<D;le++)V[le]=X*le;V.reverse();var ce=[],fe=[];V.forEach(function(ye,Pe){var Me=F.getPolygonPos(ye,p.dataPointsLen),Ke="";Me.forEach(function(we,Te){if(Pe===0){var te=p.graphics.drawLine(we.x,we.y,0,0,Array.isArray(p.polygons.connectorColors)?p.polygons.connectorColors[Te]:p.polygons.connectorColors);fe.push(te)}Te===0&&p.yaxisLabelsTextsPos.push({x:we.x,y:we.y}),Ke+=we.x+","+we.y+" "}),ce.push(Ke)}),ce.forEach(function(ye,Pe){var Me=p.polygons.strokeColors,Ke=p.polygons.strokeWidth,we=p.graphics.drawPolygon(ye,Array.isArray(Me)?Me[Pe]:Me,Array.isArray(Ke)?Ke[Pe]:Ke,S.globals.radarPolygons.fill.colors[Pe]);A.add(we)}),fe.forEach(function(ye){A.add(ye)}),S.config.yaxis[0].show&&this.yaxisLabelsTextsPos.forEach(function(ye,Pe){var Me=k.drawYAxisTexts(ye.x,ye.y,Pe,T[Pe]);p.yaxisLabels.add(Me)})}},{key:"drawXAxisTexts",value:function(){var m=this,p=this.w,S=p.config.xaxis.labels,A=this.graphics.group({class:"apexcharts-xaxis"}),k=F.getPolygonPos(this.size,this.dataPointsLen);return p.globals.labels.forEach(function(T,D){var V=p.config.xaxis.labels.formatter,X=new Oe(m.ctx);if(k[D]){var le=m.getTextPos(k[D],m.size),ce=V(T,{seriesIndex:-1,dataPointIndex:D,w:p});X.plotDataLabelsText({x:le.newX,y:le.newY,text:ce,textAnchor:le.textAnchor,i:D,j:D,parent:A,className:"apexcharts-xaxis-label",color:Array.isArray(S.style.colors)&&S.style.colors[D]?S.style.colors[D]:"#a8a8a8",dataLabelsConfig:y({textAnchor:le.textAnchor,dropShadow:{enabled:!1}},S),offsetCorrection:!1}).on("click",function(fe){if(typeof p.config.chart.events.xAxisLabelClick=="function"){var ye=Object.assign({},p,{labelIndex:D});p.config.chart.events.xAxisLabelClick(fe,m.ctx,ye)}})}}),A}},{key:"createPaths",value:function(m,p){var S=this,A=[],k=[],T=[],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),X=this.graphics.move(m[0].x,m[0].y);m.forEach(function(le,ce){V+=S.graphics.line(le.x,le.y),X+=S.graphics.line(le.x,le.y),ce===m.length-1&&(V+="Z",X+="Z")}),A.push(V),T.push(X)}return{linePathsFrom:k,linePathsTo:A,areaPathsFrom:D,areaPathsTo:T}}},{key:"getTextPos",value:function(m,p){var S="middle",A=m.x,k=m.y;return Math.abs(m.x)>=10?m.x>0?(S="start",A+=10):m.x<0&&(S="end",A-=10):S="middle",Math.abs(m.y)>=p-10&&(m.y<0?k-=10:m.y>0&&(k+=10)),{textAnchor:S,newX:A,newY:k}}},{key:"getPreviousPath",value:function(m){for(var p=this.w,S=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&&(S=p.globals.previousPaths[A].paths[0].d)}return S}},{key:"getDataPointsPos",value:function(m,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.dataPointsLen;m=m||[],p=p||[];for(var A=[],k=0;k<S;k++){var T={};T.x=m[k]*Math.sin(p[k]),T.y=-m[k]*Math.cos(p[k]),A.push(T)}return A}}]),ke}(),Kn=function(ke){f(p,Xn);var m=c(p);function p(S){var A;s(this,p),(A=m.call(this,S)).ctx=S,A.w=S.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(S){var A=this.w,k=new z(this.ctx),T=k.group({class:"apexcharts-radialbar"});if(A.globals.noData)return T;var D=k.group(),V=this.defaultSize/2,X=A.globals.gridWidth/2,le=this.defaultSize/2.05;A.config.chart.sparkline.enabled||(le=le-A.config.stroke.width-A.config.chart.dropShadow.blur);var ce=A.globals.fill.colors;if(A.config.plotOptions.radialBar.track.show){var fe=this.drawTracks({size:le,centerX:X,centerY:V,colorArr:ce,series:S});D.add(fe)}var ye=this.drawArcs({size:le,centerX:X,centerY:V,colorArr:ce,series:S}),Pe=360;A.config.plotOptions.radialBar.startAngle<0&&(Pe=this.totalAngle);var Me=(360-Pe)/360;if(A.globals.radialSize=le-le*Me,this.radialDataLabels.value.show){var Ke=Math.max(this.radialDataLabels.value.offsetY,this.radialDataLabels.name.offsetY);A.globals.radialSize+=Ke*Me}return D.add(ye.g),A.config.plotOptions.radialBar.hollow.position==="front"&&(ye.g.add(ye.elHollow),ye.dataLabels&&ye.g.add(ye.dataLabels)),T.add(D),T}},{key:"drawTracks",value:function(S){var A=this.w,k=new z(this.ctx),T=k.group({class:"apexcharts-tracks"}),D=new L(this.ctx),V=new ge(this.ctx),X=this.getStrokeWidth(S);S.size=S.size-X/2;for(var le=0;le<S.series.length;le++){var ce=k.group({class:"apexcharts-radialbar-track apexcharts-track"});T.add(ce),ce.attr({rel:le+1}),S.size=S.size-X-this.margin;var fe=A.config.plotOptions.radialBar.track,ye=V.fillPath({seriesNumber:0,size:S.size,fillColors:Array.isArray(fe.background)?fe.background[le]:fe.background,solid:!0}),Pe=this.trackStartAngle,Me=this.trackEndAngle;Math.abs(Me)+Math.abs(Pe)>=360&&(Me=360-Math.abs(this.startAngle)-.1);var Ke=k.drawPath({d:"",stroke:ye,strokeWidth:X*parseInt(fe.strokeWidth,10)/100,fill:"none",strokeOpacity:fe.opacity,classes:"apexcharts-radialbar-area"});if(fe.dropShadow.enabled){var we=fe.dropShadow;D.dropShadow(Ke,we)}ce.add(Ke),Ke.attr("id","apexcharts-radialbarTrack-"+le),this.animatePaths(Ke,{centerX:S.centerX,centerY:S.centerY,endAngle:Me,startAngle:Pe,size:S.size,i:le,totalItems:2,animBeginArr:0,dur:0,isTrack:!0,easing:A.globals.easing})}return T}},{key:"drawArcs",value:function(S){var A=this.w,k=new z(this.ctx),T=new ge(this.ctx),D=new L(this.ctx),V=k.group(),X=this.getStrokeWidth(S);S.size=S.size-X/2;var le=A.config.plotOptions.radialBar.hollow.background,ce=S.size-X*S.series.length-this.margin*S.series.length-X*parseInt(A.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,fe=ce-A.config.plotOptions.radialBar.hollow.margin;A.config.plotOptions.radialBar.hollow.image!==void 0&&(le=this.drawHollowImage(S,V,ce,le));var ye=this.drawHollow({size:fe,centerX:S.centerX,centerY:S.centerY,fill:le||"transparent"});if(A.config.plotOptions.radialBar.hollow.dropShadow.enabled){var Pe=A.config.plotOptions.radialBar.hollow.dropShadow;D.dropShadow(ye,Pe)}var Me=1;!this.radialDataLabels.total.show&&A.globals.series.length>1&&(Me=0);var Ke=null;if(this.radialDataLabels.show){var we=A.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0];Ke=this.renderInnerDataLabels(we,this.radialDataLabels,{hollowSize:ce,centerX:S.centerX,centerY:S.centerY,opacity:Me})}A.config.plotOptions.radialBar.hollow.position==="back"&&(V.add(ye),Ke&&V.add(Ke));var Te=!1;A.config.plotOptions.radialBar.inverseOrder&&(Te=!0);for(var te=Te?S.series.length-1:0;Te?te>=0:te<S.series.length;Te?te--:te++){var ve=k.group({class:"apexcharts-series apexcharts-radial-series",seriesName:F.escapeString(A.globals.seriesNames[te])});V.add(ve),ve.attr({rel:te+1,"data:realIndex":te}),this.ctx.series.addCollapsedClassToSeries(ve,te),S.size=S.size-X-this.margin;var Be=T.fillPath({seriesNumber:te,size:S.size,value:S.series[te]}),Ue=this.startAngle,Fe=void 0,at=F.negToZero(S.series[te]>100?100:S.series[te])/100,ut=Math.round(this.totalAngle*at)+this.startAngle,yt=void 0;A.globals.dataChanged&&(Fe=this.startAngle,yt=Math.round(this.totalAngle*F.negToZero(A.globals.previousPaths[te])/100)+Fe),Math.abs(ut)+Math.abs(Ue)>360&&(ut-=.01),Math.abs(yt)+Math.abs(Fe)>360&&(yt-=.01);var Lt=ut-Ue,Gt=Array.isArray(A.config.stroke.dashArray)?A.config.stroke.dashArray[te]:A.config.stroke.dashArray,an=k.drawPath({d:"",stroke:Be,strokeWidth:X,fill:"none",fillOpacity:A.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+te,strokeDashArray:Gt});if(z.setAttrs(an.node,{"data:angle":Lt,"data:value":S.series[te]}),A.config.chart.dropShadow.enabled){var et=A.config.chart.dropShadow;D.dropShadow(an,et,te)}if(D.setSelectionFilter(an,0,te),this.addListeners(an,this.radialDataLabels),ve.add(an),an.attr({index:0,j:te}),this.barLabels.enabled){var Pt=F.polarToCartesian(S.centerX,S.centerY,S.size,Ue),qt=this.barLabels.formatter(A.globals.seriesNames[te],{seriesIndex:te,w:A}),ft=["apexcharts-radialbar-label"];this.barLabels.onClick||ft.push("apexcharts-no-click");var tt=this.barLabels.useSeriesColors?A.globals.colors[te]:A.config.chart.foreColor;tt||(tt=A.config.chart.foreColor);var Bt=Pt.x+this.barLabels.offsetX,gn=Pt.y+this.barLabels.offsetY,tr=k.drawText({x:Bt,y:gn,text:qt,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:tt,cssClass:ft.join(" ")});tr.on("click",this.onBarLabelClick),tr.attr({rel:te+1}),Ue!==0&&tr.attr({"transform-origin":"".concat(Bt," ").concat(gn),transform:"rotate(".concat(Ue," 0 0)")}),ve.add(tr)}var Dn=0;!this.initialAnim||A.globals.resized||A.globals.dataChanged||(Dn=A.config.chart.animations.speed),A.globals.dataChanged&&(Dn=A.config.chart.animations.dynamicAnimation.speed),this.animDur=Dn/(1.2*S.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(an,{centerX:S.centerX,centerY:S.centerY,endAngle:ut,startAngle:Ue,prevEndAngle:yt,prevStartAngle:Fe,size:S.size,i:te,totalItems:2,animBeginArr:this.animBeginArr,dur:Dn,shouldSetPrevPaths:!0,easing:A.globals.easing})}return{g:V,elHollow:ye,dataLabels:Ke}}},{key:"drawHollow",value:function(S){var A=new z(this.ctx).drawCircle(2*S.size);return A.attr({class:"apexcharts-radialbar-hollow",cx:S.centerX,cy:S.centerY,r:S.size,fill:S.fill}),A}},{key:"drawHollowImage",value:function(S,A,k,T){var D=this.w,V=new ge(this.ctx),X=F.randomId(),le=D.config.plotOptions.radialBar.hollow.image;if(D.config.plotOptions.radialBar.hollow.imageClipped)V.clippedImgArea({width:k,height:k,image:le,patternID:"pattern".concat(D.globals.cuid).concat(X)}),T="url(#pattern".concat(D.globals.cuid).concat(X,")");else{var ce=D.config.plotOptions.radialBar.hollow.imageWidth,fe=D.config.plotOptions.radialBar.hollow.imageHeight;if(ce===void 0&&fe===void 0){var ye=D.globals.dom.Paper.image(le).loaded(function(Me){this.move(S.centerX-Me.width/2+D.config.plotOptions.radialBar.hollow.imageOffsetX,S.centerY-Me.height/2+D.config.plotOptions.radialBar.hollow.imageOffsetY)});A.add(ye)}else{var Pe=D.globals.dom.Paper.image(le).loaded(function(Me){this.move(S.centerX-ce/2+D.config.plotOptions.radialBar.hollow.imageOffsetX,S.centerY-fe/2+D.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(ce,fe)});A.add(Pe)}}return T}},{key:"getStrokeWidth",value:function(S){var A=this.w;return S.size*(100-parseInt(A.config.plotOptions.radialBar.hollow.size,10))/100/(S.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(S){var A=parseInt(S.target.getAttribute("rel"),10)-1,k=this.barLabels.onClick,T=this.w;k&&k(T.globals.seriesNames[A],{w:T,seriesIndex:A})}}]),p}(),jn=function(ke){f(p,un);var m=c(p);function p(){return s(this,p),m.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,A){var k=this.w,T=new z(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=S,this.seriesRangeStart=k.globals.seriesRangeStart,this.seriesRangeEnd=k.globals.seriesRangeEnd,this.barHelpers.initVariables(S);for(var D=T.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),V=0;V<S.length;V++){var X,le,ce,fe,ye=void 0,Pe=void 0,Me=k.globals.comboCharts?A[V]:V,Ke=this.barHelpers.getGroupIndex(Me).columnGroupIndex,we=T.group({class:"apexcharts-series",seriesName:F.escapeString(k.globals.seriesNames[Me]),rel:V+1,"data:realIndex":Me});this.ctx.series.addCollapsedClassToSeries(we,Me),S[V].length>0&&(this.visibleI=this.visibleI+1);var Te=0,te=0,ve=0;this.yRatio.length>1&&(this.yaxisIndex=k.globals.seriesYAxisReverseMap[Me][0],ve=Me);var Be=this.barHelpers.initialPositions();Pe=Be.y,fe=Be.zeroW,ye=Be.x,te=Be.barWidth,Te=Be.barHeight,X=Be.xDivision,le=Be.yDivision,ce=Be.zeroH;for(var Ue=T.group({class:"apexcharts-datalabels","data:realIndex":Me}),Fe=T.group({class:"apexcharts-rangebar-goals-markers"}),at=0;at<k.globals.dataPoints;at++){var ut=this.barHelpers.getStrokeWidth(V,at,Me),yt=this.seriesRangeStart[V][at],Lt=this.seriesRangeEnd[V][at],Gt=null,an=null,et=null,Pt={x:ye,y:Pe,strokeWidth:ut,elSeries:we},qt=this.seriesLen;if(k.config.plotOptions.bar.rangeBarGroupRows&&(qt=1),k.config.series[V].data[at]===void 0)break;if(this.isHorizontal){et=Pe+Te*this.visibleI;var ft=(le-Te*qt)/2;if(k.config.series[V].data[at].x){var tt=this.detectOverlappingBars({i:V,j:at,barYPosition:et,srty:ft,barHeight:Te,yDivision:le,initPositions:Be});Te=tt.barHeight,et=tt.barYPosition}te=(Gt=this.drawRangeBarPaths(y({indexes:{i:V,j:at,realIndex:Me},barHeight:Te,barYPosition:et,zeroW:fe,yDivision:le,y1:yt,y2:Lt},Pt))).barWidth}else{k.globals.isXNumeric&&(ye=(k.globals.seriesX[V][at]-k.globals.minX)/this.xRatio-te/2),an=ye+te*this.visibleI;var Bt=(X-te*qt)/2;if(k.config.series[V].data[at].x){var gn=this.detectOverlappingBars({i:V,j:at,barXPosition:an,srtx:Bt,barWidth:te,xDivision:X,initPositions:Be});te=gn.barWidth,an=gn.barXPosition}Te=(Gt=this.drawRangeColumnPaths(y({indexes:{i:V,j:at,realIndex:Me,translationsIndex:ve},barWidth:te,barXPosition:an,zeroH:ce,xDivision:X},Pt))).barHeight}var tr=this.barHelpers.drawGoalLine({barXPosition:Gt.barXPosition,barYPosition:et,goalX:Gt.goalX,goalY:Gt.goalY,barHeight:Te,barWidth:te});tr&&Fe.add(tr),Pe=Gt.y,ye=Gt.x;var Dn=this.barHelpers.getPathFillColor(S,V,at,Me),er=k.globals.stroke.colors[Me];this.renderSeries({realIndex:Me,pathFill:Dn,lineFill:er,j:at,i:V,x:ye,y:Pe,y1:yt,y2:Lt,pathFrom:Gt.pathFrom,pathTo:Gt.pathTo,strokeWidth:ut,elSeries:we,series:S,barHeight:Te,barWidth:te,barXPosition:an,barYPosition:et,columnGroupIndex:Ke,elDataLabelsWrap:Ue,elGoalsMarkers:Fe,visibleSeries:this.visibleI,type:"rangebar"})}D.add(we)}return D}},{key:"detectOverlappingBars",value:function(S){var A=S.i,k=S.j,T=S.barYPosition,D=S.barXPosition,V=S.srty,X=S.srtx,le=S.barHeight,ce=S.barWidth,fe=S.yDivision,ye=S.xDivision,Pe=S.initPositions,Me=this.w,Ke=[],we=Me.config.series[A].data[k].rangeName,Te=Me.config.series[A].data[k].x,te=Array.isArray(Te)?Te.join(" "):Te,ve=Me.globals.labels.map(function(Ue){return Array.isArray(Ue)?Ue.join(" "):Ue}).indexOf(te),Be=Me.globals.seriesRange[A].findIndex(function(Ue){return Ue.x===te&&Ue.overlaps.length>0});return this.isHorizontal?(T=Me.config.plotOptions.bar.rangeBarGroupRows?V+fe*ve:V+le*this.visibleI+fe*ve,Be>-1&&!Me.config.plotOptions.bar.rangeBarOverlap&&(Ke=Me.globals.seriesRange[A][Be].overlaps).indexOf(we)>-1&&(T=(le=Pe.barHeight/Ke.length)*this.visibleI+fe*(100-parseInt(this.barOptions.barHeight,10))/100/2+le*(this.visibleI+Ke.indexOf(we))+fe*ve)):(ve>-1&&!Me.globals.timescaleLabels.length&&(D=Me.config.plotOptions.bar.rangeBarGroupRows?X+ye*ve:X+ce*this.visibleI+ye*ve),Be>-1&&!Me.config.plotOptions.bar.rangeBarOverlap&&(Ke=Me.globals.seriesRange[A][Be].overlaps).indexOf(we)>-1&&(D=(ce=Pe.barWidth/Ke.length)*this.visibleI+ye*(100-parseInt(this.barOptions.barWidth,10))/100/2+ce*(this.visibleI+Ke.indexOf(we))+ye*ve)),{barYPosition:T,barXPosition:D,barHeight:le,barWidth:ce}}},{key:"drawRangeColumnPaths",value:function(S){var A=S.indexes,k=S.x,T=S.xDivision,D=S.barWidth,V=S.barXPosition,X=S.zeroH,le=this.w,ce=A.i,fe=A.j,ye=A.realIndex,Pe=A.translationsIndex,Me=this.yRatio[Pe],Ke=this.getRangeValue(ye,fe),we=Math.min(Ke.start,Ke.end),Te=Math.max(Ke.start,Ke.end);this.series[ce][fe]===void 0||this.series[ce][fe]===null?we=X:(we=X-we/Me,Te=X-Te/Me);var te=Math.abs(Te-we),ve=this.barHelpers.getColumnPaths({barXPosition:V,barWidth:D,y1:we,y2:Te,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:ye,i:ye,j:fe,w:le});if(le.globals.isXNumeric){var Be=this.getBarXForNumericXAxis({x:k,j:fe,realIndex:ye,barWidth:D});k=Be.x,V=Be.barXPosition}else k+=T;return{pathTo:ve.pathTo,pathFrom:ve.pathFrom,barHeight:te,x:k,y:Ke.start<0&&Ke.end<0?we:Te,goalY:this.barHelpers.getGoalValues("y",null,X,ce,fe,Pe),barXPosition:V}}},{key:"preventBarOverflow",value:function(S){var A=this.w;return S<0&&(S=0),S>A.globals.gridWidth&&(S=A.globals.gridWidth),S}},{key:"drawRangeBarPaths",value:function(S){var A=S.indexes,k=S.y,T=S.y1,D=S.y2,V=S.yDivision,X=S.barHeight,le=S.barYPosition,ce=S.zeroW,fe=this.w,ye=A.realIndex,Pe=A.j,Me=this.preventBarOverflow(ce+T/this.invertedYRatio),Ke=this.preventBarOverflow(ce+D/this.invertedYRatio),we=this.getRangeValue(ye,Pe),Te=Math.abs(Ke-Me),te=this.barHelpers.getBarpaths({barYPosition:le,barHeight:X,x1:Me,x2:Ke,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:ye,realIndex:ye,j:Pe,w:fe});return fe.globals.isXNumeric||(k+=V),{pathTo:te.pathTo,pathFrom:te.pathFrom,barWidth:Te,x:we.start<0&&we.end<0?Me:Ke,goalX:this.barHelpers.getGoalValues("x",ce,null,ye,Pe),y:k}}},{key:"getRangeValue",value:function(S,A){var k=this.w;return{start:k.globals.seriesRangeStart[S][A],end:k.globals.seriesRangeEnd[S][A]}}}]),p}(),De=function(){function ke(m){s(this,ke),this.w=m.w,this.lineCtx=m}return o(ke,[{key:"sameValueSeriesFix",value:function(m,p){var S=this.w;if((S.config.fill.type==="gradient"||S.config.fill.type[m]==="gradient")&&new Q(this.lineCtx.ctx,S).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,S=m.realIndex,A=m.x,k=m.y,T=m.i,D=m.j,V=m.prevY,X=this.w,le=[],ce=[];if(D===0){var fe=this.lineCtx.categoryAxisCorrection+X.config.markers.offsetX;X.globals.isXNumeric&&(fe=(X.globals.seriesX[S][0]-X.globals.minX)/this.lineCtx.xRatio+X.config.markers.offsetX),le.push(fe),ce.push(F.isNumber(p[T][0])?V+X.config.markers.offsetY:null),le.push(A+X.config.markers.offsetX),ce.push(F.isNumber(p[T][D+1])?k+X.config.markers.offsetY:null)}else le.push(A+X.config.markers.offsetX),ce.push(F.isNumber(p[T][D+1])?k+X.config.markers.offsetY:null);return{x:le,y:ce}}},{key:"checkPreviousPaths",value:function(m){for(var p=m.pathFromLine,S=m.pathFromArea,A=m.realIndex,k=this.w,T=0;T<k.globals.previousPaths.length;T++){var D=k.globals.previousPaths[T];(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[T].paths[0].d):D.type==="area"&&(this.lineCtx.appendPathFrom=!1,S=k.globals.previousPaths[T].paths[0].d,k.config.stroke.show&&k.globals.previousPaths[T].paths[1]&&(p=k.globals.previousPaths[T].paths[1].d)))}return{pathFromLine:p,pathFromArea:S}}},{key:"determineFirstPrevY",value:function(m){var p,S,A,k=m.i,T=m.realIndex,D=m.series,V=m.prevY,X=m.lineYPosition,le=m.translationsIndex,ce=this.w,fe=ce.config.chart.stacked&&!ce.globals.comboCharts||ce.config.chart.stacked&&ce.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[T])===null||p===void 0?void 0:p.type)==="bar"||((S=this.w.config.series[T])===null||S===void 0?void 0:S.type)==="column");if(((A=D[k])===null||A===void 0?void 0:A[0])!==void 0)V=(X=fe&&k>0?this.lineCtx.prevSeriesY[k-1][0]:this.lineCtx.zeroY)-D[k][0]/this.lineCtx.yRatio[le]+2*(this.lineCtx.isReversed?D[k][0]/this.lineCtx.yRatio[le]:0);else if(fe&&k>0&&D[k][0]===void 0){for(var ye=k-1;ye>=0;ye--)if(D[ye][0]!==null&&D[ye][0]!==void 0){V=X=this.lineCtx.prevSeriesY[ye][0];break}}return{prevY:V,lineYPosition:X}}}]),ke}(),pe=function(ke){for(var m,p,S,A,k=function(le){for(var ce=[],fe=le[0],ye=le[1],Pe=ce[0]=ze(fe,ye),Me=1,Ke=le.length-1;Me<Ke;Me++)fe=ye,ye=le[Me+1],ce[Me]=.5*(Pe+(Pe=ze(fe,ye)));return ce[Me]=Pe,ce}(ke),T=ke.length-1,D=[],V=0;V<T;V++)S=ze(ke[V],ke[V+1]),Math.abs(S)<1e-6?k[V]=k[V+1]=0:(A=(m=k[V]/S)*m+(p=k[V+1]/S)*p)>9&&(A=3*S/Math.sqrt(A),k[V]=A*m,k[V+1]=A*p);for(var X=0;X<=T;X++)A=(ke[Math.min(T,X+1)][0]-ke[Math.max(0,X-1)][0])/(6*(1+k[X]*k[X])),D.push([A||0,k[X]*A||0]);return D},qe=function(ke){var m=pe(ke),p=ke[1],S=ke[0],A=[],k=m[1],T=m[0];A.push(S,[S[0]+T[0],S[1]+T[1],p[0]-k[0],p[1]-k[1],p[0],p[1]]);for(var D=2,V=m.length;D<V;D++){var X=ke[D],le=m[D];A.push([X[0]-le[0],X[1]-le[1],X[0],X[1]])}return A},Ae=function(ke,m,p){var S=ke.slice(m,p);if(m){if(p-m>1&&S[1].length<6){var A=S[0].length;S[1]=[2*S[0][A-2]-S[0][A-4],2*S[0][A-1]-S[0][A-3]].concat(S[1])}S[0]=S[0].slice(-2)}return S};function ze(ke,m){return(m[1]-ke[1])/(m[0]-ke[0])}var zt=function(){function ke(m,p,S){s(this,ke),this.ctx=m,this.w=m.w,this.xyRatios=p,this.pointsChart=!(this.w.config.chart.type!=="bubble"&&this.w.config.chart.type!=="scatter")||S,this.scatter=new je(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new De(this),this.markers=new Ce(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return o(ke,[{key:"draw",value:function(m,p,S,A){var k,T=this.w,D=new z(this.ctx),V=T.globals.comboCharts?p:T.config.chart.type,X=D.group({class:"apexcharts-".concat(V,"-series apexcharts-plot-series")}),le=new Q(this.ctx,T);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,m=le.getLogSeries(m),this.yRatio=le.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var ce=[],fe=0;fe<m.length;fe++){m=this.lineHelpers.sameValueSeriesFix(fe,m);var ye=T.globals.comboCharts?S[fe]:fe,Pe=this.yRatio.length>1?ye:0;this._initSerieVariables(m,fe,ye);var Me=[],Ke=[],we=[],Te=T.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,ye),T.globals.isXNumeric&&T.globals.seriesX.length>0&&(Te=(T.globals.seriesX[ye][0]-T.globals.minX)/this.xRatio),we.push(Te);var te,ve=Te,Be=void 0,Ue=ve,Fe=this.zeroY,at=this.zeroY;Fe=this.lineHelpers.determineFirstPrevY({i:fe,realIndex:ye,series:m,prevY:Fe,lineYPosition:0,translationsIndex:Pe}).prevY,T.config.stroke.curve==="monotoneCubic"&&m[fe][0]===null?Me.push(null):Me.push(Fe),te=Fe,V==="rangeArea"&&(Be=at=this.lineHelpers.determineFirstPrevY({i:fe,realIndex:ye,series:A,prevY:at,lineYPosition:0,translationsIndex:Pe}).prevY,Ke.push(Me[0]!==null?at:null));var ut=this._calculatePathsFrom({type:V,series:m,i:fe,realIndex:ye,translationsIndex:Pe,prevX:Ue,prevY:Fe,prevY2:at}),yt=[Me[0]],Lt=[Ke[0]],Gt={type:V,series:m,realIndex:ye,translationsIndex:Pe,i:fe,x:Te,y:1,pX:ve,pY:te,pathsFrom:ut,linePaths:[],areaPaths:[],seriesIndex:S,lineYPosition:0,xArrj:we,yArrj:Me,y2Arrj:Ke,seriesRangeEnd:A},an=this._iterateOverDataPoints(y(y({},Gt),{},{iterations:V==="rangeArea"?m[fe].length-1:void 0,isRangeStart:!0}));if(V==="rangeArea"){for(var et=this._calculatePathsFrom({series:A,i:fe,realIndex:ye,prevX:Ue,prevY:at}),Pt=this._iterateOverDataPoints(y(y({},Gt),{},{series:A,xArrj:[Te],yArrj:yt,y2Arrj:Lt,pY:Be,areaPaths:an.areaPaths,pathsFrom:et,iterations:A[fe].length-1,isRangeStart:!1})),qt=an.linePaths.length/2,ft=0;ft<qt;ft++)an.linePaths[ft]=Pt.linePaths[ft+qt]+an.linePaths[ft];an.linePaths.splice(qt),an.pathFromLine=Pt.pathFromLine+an.pathFromLine}else an.pathFromArea+="z";this._handlePaths({type:V,realIndex:ye,i:fe,paths:an}),this.elSeries.add(this.elPointsMain),this.elSeries.add(this.elDataLabelsWrap),ce.push(this.elSeries)}if(((k=T.config.series[0])===null||k===void 0?void 0:k.zIndex)!==void 0&&ce.sort(function(gn,tr){return Number(gn.node.getAttribute("zIndex"))-Number(tr.node.getAttribute("zIndex"))}),T.config.chart.stacked)for(var tt=ce.length-1;tt>=0;tt--)X.add(ce[tt]);else for(var Bt=0;Bt<ce.length;Bt++)X.add(ce[Bt]);return X}},{key:"_initSerieVariables",value:function(m,p,S){var A=this.w,k=new z(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[S]:A.config.stroke.width;var T=0;this.yRatio.length>1&&(this.yaxisIndex=A.globals.seriesYAxisReverseMap[S],T=S),this.isReversed=A.config.yaxis[this.yaxisIndex]&&A.config.yaxis[this.yaxisIndex].reversed,this.zeroY=A.globals.gridHeight-this.baseLineY[T]-(this.isReversed?A.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[T]: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[S].zIndex!==void 0?A.config.series[S].zIndex:S,seriesName:F.escapeString(A.globals.seriesNames[S])}),this.elPointsMain=k.group({class:"apexcharts-series-markers-wrap","data:realIndex":S}),this.elDataLabelsWrap=k.group({class:"apexcharts-datalabels","data:realIndex":S});var D=m[p].length===A.globals.dataPoints;this.elSeries.attr({"data:longestSeries":D,rel:p+1,"data:realIndex":S}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(m){var p,S,A,k,T=m.type,D=m.series,V=m.i,X=m.realIndex,le=m.translationsIndex,ce=m.prevX,fe=m.prevY,ye=m.prevY2,Pe=this.w,Me=new z(this.ctx);if(D[V][0]===null){for(var Ke=0;Ke<D[V].length;Ke++)if(D[V][Ke]!==null){ce=this.xDivision*Ke,fe=this.zeroY-D[V][Ke]/this.yRatio[le],p=Me.move(ce,fe),S=Me.move(ce,this.areaBottomY);break}}else p=Me.move(ce,fe),T==="rangeArea"&&(p=Me.move(ce,ye)+Me.line(ce,fe)),S=Me.move(ce,this.areaBottomY)+Me.line(ce,fe);if(A=Me.move(0,this.zeroY)+Me.line(0,this.zeroY),k=Me.move(0,this.zeroY)+Me.line(0,this.zeroY),Pe.globals.previousPaths.length>0){var we=this.lineHelpers.checkPreviousPaths({pathFromLine:A,pathFromArea:k,realIndex:X});A=we.pathFromLine,k=we.pathFromArea}return{prevX:ce,prevY:fe,linePath:p,areaPath:S,pathFromLine:A,pathFromArea:k}}},{key:"_handlePaths",value:function(m){var p=m.type,S=m.realIndex,A=m.i,k=m.paths,T=this.w,D=new z(this.ctx),V=new ge(this.ctx);this.prevSeriesY.push(k.yArrj),T.globals.seriesXvalues[S]=k.xArrj,T.globals.seriesYvalues[S]=k.yArrj;var X=T.config.forecastDataPoints;if(X.count>0&&p!=="rangeArea"){var le=T.globals.seriesXvalues[S][T.globals.seriesXvalues[S].length-X.count-1],ce=D.drawRect(le,0,T.globals.gridWidth,T.globals.gridHeight,0);T.globals.dom.elForecastMask.appendChild(ce.node);var fe=D.drawRect(0,0,le,T.globals.gridHeight,0);T.globals.dom.elNonForecastMask.appendChild(fe.node)}this.pointsChart||T.globals.delayedElements.push({el:this.elPointsMain.node,index:S});var ye={i:A,realIndex:S,animationDelay:A,initialSpeed:T.config.chart.animations.speed,dataChangeSpeed:T.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(p)};if(p==="area")for(var Pe=V.fillPath({seriesNumber:S}),Me=0;Me<k.areaPaths.length;Me++){var Ke=D.renderPaths(y(y({},ye),{},{pathFrom:k.pathFromArea,pathTo:k.areaPaths[Me],stroke:"none",strokeWidth:0,strokeLineCap:null,fill:Pe}));this.elSeries.add(Ke)}if(T.config.stroke.show&&!this.pointsChart){var we=null;if(p==="line")we=V.fillPath({seriesNumber:S,i:A});else if(T.config.stroke.fill.type==="solid")we=T.globals.stroke.colors[S];else{var Te=T.config.fill;T.config.fill=T.config.stroke.fill,we=V.fillPath({seriesNumber:S,i:A}),T.config.fill=Te}for(var te=0;te<k.linePaths.length;te++){var ve=we;p==="rangeArea"&&(ve=V.fillPath({seriesNumber:S}));var Be=y(y({},ye),{},{pathFrom:k.pathFromLine,pathTo:k.linePaths[te],stroke:we,strokeWidth:this.strokeWidth,strokeLineCap:T.config.stroke.lineCap,fill:p==="rangeArea"?ve:"none"}),Ue=D.renderPaths(Be);if(this.elSeries.add(Ue),Ue.attr("fill-rule","evenodd"),X.count>0&&p!=="rangeArea"){var Fe=D.renderPaths(Be);Fe.node.setAttribute("stroke-dasharray",X.dashArray),X.strokeWidth&&Fe.node.setAttribute("stroke-width",X.strokeWidth),this.elSeries.add(Fe),Fe.attr("clip-path","url(#forecastMask".concat(T.globals.cuid,")")),Ue.attr("clip-path","url(#nonForecastMask".concat(T.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(m){var p,S,A=this,k=m.type,T=m.series,D=m.iterations,V=m.realIndex,X=m.translationsIndex,le=m.i,ce=m.x,fe=m.y,ye=m.pX,Pe=m.pY,Me=m.pathsFrom,Ke=m.linePaths,we=m.areaPaths,Te=m.seriesIndex,te=m.lineYPosition,ve=m.xArrj,Be=m.yArrj,Ue=m.y2Arrj,Fe=m.isRangeStart,at=m.seriesRangeEnd,ut=this.w,yt=new z(this.ctx),Lt=this.yRatio,Gt=Me.prevY,an=Me.linePath,et=Me.areaPath,Pt=Me.pathFromLine,qt=Me.pathFromArea,ft=F.isNumber(ut.globals.minYArr[V])?ut.globals.minYArr[V]:ut.globals.minY;D||(D=ut.globals.dataPoints>1?ut.globals.dataPoints-1:ut.globals.dataPoints);var tt=function($n,ir){return ir-$n/Lt[X]+2*(A.isReversed?$n/Lt[X]:0)},Bt=fe,gn=ut.config.chart.stacked&&!ut.globals.comboCharts||ut.config.chart.stacked&&ut.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[V])===null||p===void 0?void 0:p.type)==="bar"||((S=this.w.config.series[V])===null||S===void 0?void 0:S.type)==="column"),tr=ut.config.stroke.curve;Array.isArray(tr)&&(tr=Array.isArray(Te)?tr[Te[le]]:tr[le]);for(var Dn,er=0,Sr=0;Sr<D;Sr++){var dr=T[le][Sr+1]===void 0||T[le][Sr+1]===null;if(ut.globals.isXNumeric){var kr=ut.globals.seriesX[V][Sr+1];ut.globals.seriesX[V][Sr+1]===void 0&&(kr=ut.globals.seriesX[V][D-1]),ce=(kr-ut.globals.minX)/this.xRatio}else ce+=this.xDivision;gn?le>0&&ut.globals.collapsedSeries.length<ut.config.series.length-1?te=this.prevSeriesY[function($n){for(var ir=$n;ir>0;ir--){if(!(ut.globals.collapsedSeriesIndices.indexOf((Te==null?void 0:Te[ir])||ir)>-1))return ir;ir--}return 0}(le-1)][Sr+1]:te=this.zeroY:te=this.zeroY,dr?fe=tt(ft,te):(fe=tt(T[le][Sr+1],te),k==="rangeArea"&&(Bt=tt(at[le][Sr+1],te))),ve.push(ce),!dr||ut.config.stroke.curve!=="smooth"&&ut.config.stroke.curve!=="monotoneCubic"?(Be.push(fe),Ue.push(Bt)):(Be.push(null),Ue.push(null));var qn=this.lineHelpers.calculatePoints({series:T,x:ce,y:fe,realIndex:V,i:le,j:Sr,prevY:Gt}),Tn=this._createPaths({type:k,series:T,i:le,realIndex:V,j:Sr,x:ce,y:fe,y2:Bt,xArrj:ve,yArrj:Be,y2Arrj:Ue,pX:ye,pY:Pe,pathState:er,segmentStartX:Dn,linePath:an,areaPath:et,linePaths:Ke,areaPaths:we,curve:tr,isRangeStart:Fe});we=Tn.areaPaths,Ke=Tn.linePaths,ye=Tn.pX,Pe=Tn.pY,er=Tn.pathState,Dn=Tn.segmentStartX,et=Tn.areaPath,an=Tn.linePath,!this.appendPathFrom||tr==="monotoneCubic"&&k==="rangeArea"||(Pt+=yt.line(ce,this.zeroY),qt+=yt.line(ce,this.zeroY)),this.handleNullDataPoints(T,qn,le,Sr,V),this._handleMarkersAndLabels({type:k,pointsPos:qn,i:le,j:Sr,realIndex:V,isRangeStart:Fe})}return{yArrj:Be,xArrj:ve,pathFromArea:qt,areaPaths:we,pathFromLine:Pt,linePaths:Ke,linePath:an,areaPath:et}}},{key:"_handleMarkersAndLabels",value:function(m){var p=m.type,S=m.pointsPos,A=m.isRangeStart,k=m.i,T=m.j,D=m.realIndex,V=this.w,X=new Oe(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,T,{realIndex:D,pointsPos:S,zRatio:this.zRatio,elParent:this.elPointsMain});else{V.globals.series[k].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var le=this.markers.plotChartMarkers(S,D,T+1);le!==null&&this.elPointsMain.add(le)}var ce=X.drawDataLabel({type:p,isRangeStart:A,pos:S,i:D,j:T+1});ce!==null&&this.elDataLabelsWrap.add(ce)}},{key:"_createPaths",value:function(m){var p=m.type,S=m.series,A=m.i;m.realIndex;var k,T=m.j,D=m.x,V=m.y,X=m.xArrj,le=m.yArrj,ce=m.y2,fe=m.y2Arrj,ye=m.pX,Pe=m.pY,Me=m.pathState,Ke=m.segmentStartX,we=m.linePath,Te=m.areaPath,te=m.linePaths,ve=m.areaPaths,Be=m.curve,Ue=m.isRangeStart,Fe=new z(this.ctx),at=this.areaBottomY,ut=p==="rangeArea",yt=p==="rangeArea"&&Ue;switch(Be){case"monotoneCubic":var Lt=Ue?le:fe;switch(Me){case 0:if(Lt[T+1]===null)break;Me=1;case 1:if(!(ut?X.length===S[A].length:T===S[A].length-2))break;case 2:var Gt=Ue?X:X.slice().reverse(),an=Ue?Lt:Lt.slice().reverse(),et=(k=an,Gt.map(function(kr,qn){return[kr,k[qn]]}).filter(function(kr){return kr[1]!==null})),Pt=et.length>1?qe(et):et,qt=[];ut&&(yt?ve=et:qt=ve.reverse());var ft=0,tt=0;if(function(kr,qn){for(var Tn=function(cs){var lt=[],Nt=0;return cs.forEach(function(Rn){Rn!==null?Nt++:Nt>0&&(lt.push(Nt),Nt=0)}),Nt>0&<.push(Nt),lt}(kr),$n=[],ir=0,ls=0;ir<Tn.length;ls+=Tn[ir++])$n[ir]=Ae(qn,ls,ls+Tn[ir]);return $n}(an,Pt).forEach(function(kr){ft++;var qn=function(ir){for(var ls="",cs=0;cs<ir.length;cs++){var lt=ir[cs],Nt=lt.length;Nt>4?(ls+="C".concat(lt[0],", ").concat(lt[1]),ls+=", ".concat(lt[2],", ").concat(lt[3]),ls+=", ".concat(lt[4],", ").concat(lt[5])):Nt>2&&(ls+="S".concat(lt[0],", ").concat(lt[1]),ls+=", ".concat(lt[2],", ").concat(lt[3]))}return ls}(kr),Tn=tt,$n=(tt+=kr.length)-1;yt?we=Fe.move(et[Tn][0],et[Tn][1])+qn:ut?we=Fe.move(qt[Tn][0],qt[Tn][1])+Fe.line(et[Tn][0],et[Tn][1])+qn+Fe.line(qt[$n][0],qt[$n][1]):(we=Fe.move(et[Tn][0],et[Tn][1])+qn,Te=we+Fe.line(et[$n][0],at)+Fe.line(et[Tn][0],at)+"z",ve.push(Te)),te.push(we)}),ut&&ft>1&&!yt){var Bt=te.slice(ft).reverse();te.splice(ft),Bt.forEach(function(kr){return te.push(kr)})}Me=0}break;case"smooth":var gn=.35*(D-ye);if(S[A][T]===null)Me=0;else switch(Me){case 0:if(Ke=ye,we=yt?Fe.move(ye,fe[T])+Fe.line(ye,Pe):Fe.move(ye,Pe),Te=Fe.move(ye,Pe),S[A][T+1]===null){te.push(we),ve.push(Te);break}if(Me=1,T<S[A].length-2){var tr=Fe.curve(ye+gn,Pe,D-gn,V,D,V);we+=tr,Te+=tr;break}case 1:if(S[A][T+1]===null)we+=yt?Fe.line(ye,ce):Fe.move(ye,Pe),Te+=Fe.line(ye,at)+Fe.line(Ke,at)+"z",te.push(we),ve.push(Te),Me=-1;else{var Dn=Fe.curve(ye+gn,Pe,D-gn,V,D,V);we+=Dn,Te+=Dn,T>=S[A].length-2&&(yt&&(we+=Fe.curve(D,V,D,V,D,ce)+Fe.move(D,ce)),Te+=Fe.curve(D,V,D,V,D,at)+Fe.line(Ke,at)+"z",te.push(we),ve.push(Te),Me=-1)}}ye=D,Pe=V;break;default:var er=function(kr,qn,Tn){var $n=[];switch(kr){case"stepline":$n=Fe.line(qn,null,"H")+Fe.line(null,Tn,"V");break;case"linestep":$n=Fe.line(null,Tn,"V")+Fe.line(qn,null,"H");break;case"straight":$n=Fe.line(qn,Tn)}return $n};if(S[A][T]===null)Me=0;else switch(Me){case 0:if(Ke=ye,we=yt?Fe.move(ye,fe[T])+Fe.line(ye,Pe):Fe.move(ye,Pe),Te=Fe.move(ye,Pe),S[A][T+1]===null){te.push(we),ve.push(Te);break}if(Me=1,T<S[A].length-2){var Sr=er(Be,D,V);we+=Sr,Te+=Sr;break}case 1:if(S[A][T+1]===null)we+=yt?Fe.line(ye,ce):Fe.move(ye,Pe),Te+=Fe.line(ye,at)+Fe.line(Ke,at)+"z",te.push(we),ve.push(Te),Me=-1;else{var dr=er(Be,D,V);we+=dr,Te+=dr,T>=S[A].length-2&&(yt&&(we+=Fe.line(D,ce)),Te+=Fe.line(D,at)+Fe.line(Ke,at)+"z",te.push(we),ve.push(Te),Me=-1)}}ye=D,Pe=V}return{linePaths:te,areaPaths:ve,pX:ye,pY:Pe,pathState:Me,segmentStartX:Ke,linePath:we,areaPath:Te}}},{key:"handleNullDataPoints",value:function(m,p,S,A,k){var T=this.w;if(m[S][A]===null&&T.config.markers.showNullDataPoints||m[S].length===1){var D=this.strokeWidth-T.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)}}}]),ke}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function ke(D,V,X,le){this.xoffset=D,this.yoffset=V,this.height=le,this.width=X,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(ce){var fe,ye=[],Pe=this.xoffset,Me=this.yoffset,Ke=k(ce)/this.height,we=k(ce)/this.width;if(this.width>=this.height)for(fe=0;fe<ce.length;fe++)ye.push([Pe,Me,Pe+Ke,Me+ce[fe]/Ke]),Me+=ce[fe]/Ke;else for(fe=0;fe<ce.length;fe++)ye.push([Pe,Me,Pe+ce[fe]/we,Me+we]),Pe+=ce[fe]/we;return ye},this.cutArea=function(ce){var fe;if(this.width>=this.height){var ye=ce/this.height,Pe=this.width-ye;fe=new ke(this.xoffset+ye,this.yoffset,Pe,this.height)}else{var Me=ce/this.width,Ke=this.height-Me;fe=new ke(this.xoffset,this.yoffset+Me,this.width,Ke)}return fe}}function m(D,V,X,le,ce){le=le===void 0?0:le,ce=ce===void 0?0:ce;var fe=p(function(ye,Pe){var Me,Ke=[],we=Pe/k(ye);for(Me=0;Me<ye.length;Me++)Ke[Me]=ye[Me]*we;return Ke}(D,V*X),[],new ke(le,ce,V,X),[]);return function(ye){var Pe,Me,Ke=[];for(Pe=0;Pe<ye.length;Pe++)for(Me=0;Me<ye[Pe].length;Me++)Ke.push(ye[Pe][Me]);return Ke}(fe)}function p(D,V,X,le){var ce,fe,ye;if(D.length!==0)return ce=X.shortestEdge(),function(Pe,Me,Ke){var we;if(Pe.length===0)return!0;(we=Pe.slice()).push(Me);var Te=S(Pe,Ke),te=S(we,Ke);return Te>=te}(V,fe=D[0],ce)?(V.push(fe),p(D.slice(1),V,X,le)):(ye=X.cutArea(k(V),le),le.push(X.getCoordinates(V)),p(D,[],ye,le)),le;le.push(X.getCoordinates(V))}function S(D,V){var X=Math.min.apply(Math,D),le=Math.max.apply(Math,D),ce=k(D);return Math.max(Math.pow(V,2)*le/Math.pow(ce,2),Math.pow(ce,2)/(Math.pow(V,2)*X))}function A(D){return D&&D.constructor===Array}function k(D){var V,X=0;for(V=0;V<D.length;V++)X+=D[V];return X}function T(D){var V,X=0;if(A(D[0]))for(V=0;V<D.length;V++)X+=T(D[V]);else X=k(D);return X}return function D(V,X,le,ce,fe){ce=ce===void 0?0:ce,fe=fe===void 0?0:fe;var ye,Pe,Me=[],Ke=[];if(A(V[0])){for(Pe=0;Pe<V.length;Pe++)Me[Pe]=T(V[Pe]);for(ye=m(Me,X,le,ce,fe),Pe=0;Pe<V.length;Pe++)Ke.push(D(V[Pe],ye[Pe][2]-ye[Pe][0],ye[Pe][3]-ye[Pe][1],ye[Pe][0],ye[Pe][1]))}else Ke=m(V,X,le,ce,fe);return Ke}}();var kt,gt,Mt=function(){function ke(m,p){s(this,ke),this.ctx=m,this.w=m.w,this.strokeWidth=this.w.config.stroke.width,this.helpers=new In(m),this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.labels=[]}return o(ke,[{key:"draw",value:function(m){var p=this,S=this.w,A=new z(this.ctx),k=new ge(this.ctx),T=A.group({class:"apexcharts-treemap"});if(S.globals.noData)return T;var D=[];return m.forEach(function(V){var X=V.map(function(le){return Math.abs(le)});D.push(X)}),this.negRange=this.helpers.checkColorRange(),S.config.series.forEach(function(V,X){V.data.forEach(function(le){Array.isArray(p.labels[X])||(p.labels[X]=[]),p.labels[X].push(le.x)})}),window.TreemapSquared.generate(D,S.globals.gridWidth,S.globals.gridHeight).forEach(function(V,X){var le=A.group({class:"apexcharts-series apexcharts-treemap-series",seriesName:F.escapeString(S.globals.seriesNames[X]),rel:X+1,"data:realIndex":X});if(S.config.chart.dropShadow.enabled){var ce=S.config.chart.dropShadow;new L(p.ctx).dropShadow(T,ce,X)}var fe=A.group({class:"apexcharts-data-labels"});V.forEach(function(ye,Pe){var Me=ye[0],Ke=ye[1],we=ye[2],Te=ye[3],te=A.drawRect(Me,Ke,we-Me,Te-Ke,S.config.plotOptions.treemap.borderRadius,"#fff",1,p.strokeWidth,S.config.plotOptions.treemap.useFillColorAsStroke?Be:S.globals.stroke.colors[X]);te.attr({cx:Me,cy:Ke,index:X,i:X,j:Pe,width:we-Me,height:Te-Ke});var ve=p.helpers.getShadeColor(S.config.chart.type,X,Pe,p.negRange),Be=ve.color;S.config.series[X].data[Pe]!==void 0&&S.config.series[X].data[Pe].fillColor&&(Be=S.config.series[X].data[Pe].fillColor);var Ue=k.fillPath({color:Be,seriesNumber:X,dataPointIndex:Pe});te.node.classList.add("apexcharts-treemap-rect"),te.attr({fill:Ue}),p.helpers.addListeners(te);var Fe={x:Me+(we-Me)/2,y:Ke+(Te-Ke)/2,width:0,height:0},at={x:Me,y:Ke,width:we-Me,height:Te-Ke};if(S.config.chart.animations.enabled&&!S.globals.dataChanged){var ut=1;S.globals.resized||(ut=S.config.chart.animations.speed),p.animateTreemap(te,Fe,at,ut)}if(S.globals.dataChanged){var yt=1;p.dynamicAnim.enabled&&S.globals.shouldAnimate&&(yt=p.dynamicAnim.speed,S.globals.previousPaths[X]&&S.globals.previousPaths[X][Pe]&&S.globals.previousPaths[X][Pe].rect&&(Fe=S.globals.previousPaths[X][Pe].rect),p.animateTreemap(te,Fe,at,yt))}var Lt=p.getFontSize(ye),Gt=S.config.dataLabels.formatter(p.labels[X][Pe],{value:S.globals.series[X][Pe],seriesIndex:X,dataPointIndex:Pe,w:S});S.config.plotOptions.treemap.dataLabels.format==="truncate"&&(Lt=parseInt(S.config.dataLabels.style.fontSize,10),Gt=p.truncateLabels(Gt,Lt,Me,Ke,we,Te));var an=null;S.globals.series[X][Pe]&&(an=p.helpers.calculateDataLabels({text:Gt,x:(Me+we)/2,y:(Ke+Te)/2+p.strokeWidth/2+Lt/3,i:X,j:Pe,colorProps:ve,fontSize:Lt,series:m})),S.config.dataLabels.enabled&&an&&p.rotateToFitLabel(an,Lt,Gt,Me,Ke,we,Te),le.add(te),an!==null&&le.add(an)}),le.add(fe),T.add(le)}),T}},{key:"getFontSize",value:function(m){var p=this.w,S,A,k,T,D=function V(X){var le,ce=0;if(Array.isArray(X[0]))for(le=0;le<X.length;le++)ce+=V(X[le]);else for(le=0;le<X.length;le++)ce+=X[le].length;return ce}(this.labels)/function V(X){var le,ce=0;if(Array.isArray(X[0]))for(le=0;le<X.length;le++)ce+=V(X[le]);else for(le=0;le<X.length;le++)ce+=1;return ce}(this.labels);return S=m[2]-m[0],A=m[3]-m[1],k=S*A,T=Math.pow(k,.5),Math.min(T/D,parseInt(p.config.dataLabels.style.fontSize,10))}},{key:"rotateToFitLabel",value:function(m,p,S,A,k,T,D){var V=new z(this.ctx),X=V.getTextRects(S,p);if(X.width+this.w.config.stroke.width+5>T-A&&X.width<=D-k){var le=V.rotateAroundCenter(m.node);m.node.setAttribute("transform","rotate(-90 ".concat(le.x," ").concat(le.y,") translate(").concat(X.height/3,")"))}}},{key:"truncateLabels",value:function(m,p,S,A,k,T){var D=new z(this.ctx),V=D.getTextRects(m,p).width+this.w.config.stroke.width+5>k-S&&T-A>k-S?T-A:k-S,X=D.getTextBasedOnMaxWidth({text:m,maxWidth:V,fontSize:p});return m.length!==X.length&&V/p<5?"":X}},{key:"animateTreemap",value:function(m,p,S,A){var k=new $(this.ctx);k.animateRect(m,{x:p.x,y:p.y,width:p.width,height:p.height},{x:S.x,y:S.y,width:S.width,height:S.height},A,function(){k.animationCompleted(m)})}}]),ke}(),ln=86400,vn=10/ln,Wn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return o(ke,[{key:"calculateTimeScaleTicks",value:function(m,p){var S=this,A=this.w;if(A.globals.allSeriesCollapsed)return A.globals.labels=[],A.globals.timescaleLabels=[],[];var k=new K(this.ctx),T=(p-m)/864e5;this.determineInterval(T),A.globals.disableZoomIn=!1,A.globals.disableZoomOut=!1,T<vn?A.globals.disableZoomIn=!0:T>5e4&&(A.globals.disableZoomOut=!0);var D=k.getTimeUnitsfromTimestamp(m,p,this.utc),V=A.globals.gridWidth/T,X=V/24,le=X/60,ce=le/60,fe=Math.floor(24*T),ye=Math.floor(1440*T),Pe=Math.floor(T*ln),Me=Math.floor(T),Ke=Math.floor(T/30),we=Math.floor(T/365),Te={minMillisecond:D.minMillisecond,minSecond:D.minSecond,minMinute:D.minMinute,minHour:D.minHour,minDate:D.minDate,minMonth:D.minMonth,minYear:D.minYear},te={firstVal:Te,currentMillisecond:Te.minMillisecond,currentSecond:Te.minSecond,currentMinute:Te.minMinute,currentHour:Te.minHour,currentMonthDate:Te.minDate,currentDate:Te.minDate,currentMonth:Te.minMonth,currentYear:Te.minYear,daysWidthOnXAxis:V,hoursWidthOnXAxis:X,minutesWidthOnXAxis:le,secondsWidthOnXAxis:ce,numberOfSeconds:Pe,numberOfMinutes:ye,numberOfHours:fe,numberOfDays:Me,numberOfMonths:Ke,numberOfYears:we};switch(this.tickInterval){case"years":this.generateYearScale(te);break;case"months":case"half_year":this.generateMonthScale(te);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(te);break;case"hours":this.generateHourScale(te);break;case"minutes_fives":case"minutes":this.generateMinuteScale(te);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(te)}var ve=this.timeScaleArray.map(function(Be){var Ue={position:Be.position,unit:Be.unit,year:Be.year,day:Be.day?Be.day:1,hour:Be.hour?Be.hour:0,month:Be.month+1};return Be.unit==="month"?y(y({},Ue),{},{day:1,value:Be.value+1}):Be.unit==="day"||Be.unit==="hour"?y(y({},Ue),{},{value:Be.value}):Be.unit==="minute"?y(y({},Ue),{},{value:Be.value,minute:Be.value}):Be.unit==="second"?y(y({},Ue),{},{value:Be.value,minute:Be.minute,second:Be.second}):Be});return ve.filter(function(Be){var Ue=1,Fe=Math.ceil(A.globals.gridWidth/120),at=Be.value;A.config.xaxis.tickAmount!==void 0&&(Fe=A.config.xaxis.tickAmount),ve.length>Fe&&(Ue=Math.floor(ve.length/Fe));var ut=!1,yt=!1;switch(S.tickInterval){case"years":Be.unit==="year"&&(ut=!0);break;case"half_year":Ue=7,Be.unit==="year"&&(ut=!0);break;case"months":Ue=1,Be.unit==="year"&&(ut=!0);break;case"months_fortnight":Ue=15,Be.unit!=="year"&&Be.unit!=="month"||(ut=!0),at===30&&(yt=!0);break;case"months_days":Ue=10,Be.unit==="month"&&(ut=!0),at===30&&(yt=!0);break;case"week_days":Ue=8,Be.unit==="month"&&(ut=!0);break;case"days":Ue=1,Be.unit==="month"&&(ut=!0);break;case"hours":Be.unit==="day"&&(ut=!0);break;case"minutes_fives":case"seconds_fives":at%5!=0&&(yt=!0);break;case"seconds_tens":at%10!=0&&(yt=!0)}if(S.tickInterval==="hours"||S.tickInterval==="minutes_fives"||S.tickInterval==="seconds_tens"||S.tickInterval==="seconds_fives"){if(!yt)return!0}else if((at%Ue==0||ut)&&!yt)return!0})}},{key:"recalcDimensionsBasedOnFormat",value:function(m,p){var S=this.w,A=this.formatDates(m),k=this.removeOverlappingTS(A);S.globals.timescaleLabels=k.slice(),new it(this.ctx).plotCoords()}},{key:"determineInterval",value:function(m){var p=24*m,S=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 S>15:this.tickInterval="minutes_fives";break;case S>5:this.tickInterval="minutes";break;case S>1:this.tickInterval="seconds_tens";break;case 60*S>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(m){var p=m.firstVal,S=m.currentMonth,A=m.currentYear,k=m.daysWidthOnXAxis,T=m.numberOfYears,D=p.minYear,V=0,X=new K(this.ctx),le="year";if(p.minDate>1||p.minMonth>0){var ce=X.determineRemainingDaysOfYear(p.minYear,p.minMonth,p.minDate);V=(X.determineDaysOfYear(p.minYear)-ce+1)*k,D=p.minYear+1,this.timeScaleArray.push({position:V,value:D,unit:le,year:D,month:F.monthMod(S+1)})}else p.minDate===1&&p.minMonth===0&&this.timeScaleArray.push({position:V,value:D,unit:le,year:A,month:F.monthMod(S+1)});for(var fe=D,ye=V,Pe=0;Pe<T;Pe++)fe++,ye=X.determineDaysOfYear(fe-1)*k+ye,this.timeScaleArray.push({position:ye,value:fe,unit:le,year:fe,month:1})}},{key:"generateMonthScale",value:function(m){var p=m.firstVal,S=m.currentMonthDate,A=m.currentMonth,k=m.currentYear,T=m.daysWidthOnXAxis,D=m.numberOfMonths,V=A,X=0,le=new K(this.ctx),ce="month",fe=0;if(p.minDate>1){X=(le.determineDaysOfMonths(A+1,p.minYear)-S+1)*T,V=F.monthMod(A+1);var ye=k+fe,Pe=F.monthMod(V),Me=V;V===0&&(ce="year",Me=ye,Pe=1,ye+=fe+=1),this.timeScaleArray.push({position:X,value:Me,unit:ce,year:ye,month:Pe})}else this.timeScaleArray.push({position:X,value:V,unit:ce,year:k,month:F.monthMod(A)});for(var Ke=V+1,we=X,Te=0,te=1;Te<D;Te++,te++){(Ke=F.monthMod(Ke))===0?(ce="year",fe+=1):ce="month";var ve=this._getYear(k,Ke,fe);we=le.determineDaysOfMonths(Ke,ve)*T+we;var Be=Ke===0?ve:Ke;this.timeScaleArray.push({position:we,value:Be,unit:ce,year:ve,month:Ke===0?1:Ke}),Ke++}}},{key:"generateDayScale",value:function(m){var p=m.firstVal,S=m.currentMonth,A=m.currentYear,k=m.hoursWidthOnXAxis,T=m.numberOfDays,D=new K(this.ctx),V="day",X=p.minDate+1,le=X,ce=function(te,ve,Be){return te>D.determineDaysOfMonths(ve+1,Be)&&(le=1,V="month",ye=ve+=1),ve},fe=(24-p.minHour)*k,ye=X,Pe=ce(le,S,A);p.minHour===0&&p.minDate===1?(fe=0,ye=F.monthMod(p.minMonth),V="month",le=p.minDate):p.minDate!==1&&p.minHour===0&&p.minMinute===0&&(fe=0,X=p.minDate,ye=X,Pe=ce(le=X,S,A)),this.timeScaleArray.push({position:fe,value:ye,unit:V,year:this._getYear(A,Pe,0),month:F.monthMod(Pe),day:le});for(var Me=fe,Ke=0;Ke<T;Ke++){V="day",Pe=ce(le+=1,Pe,this._getYear(A,Pe,0));var we=this._getYear(A,Pe,0);Me=24*k+Me;var Te=le===1?F.monthMod(Pe):le;this.timeScaleArray.push({position:Me,value:Te,unit:V,year:we,month:F.monthMod(Pe),day:Te})}}},{key:"generateHourScale",value:function(m){var p=m.firstVal,S=m.currentDate,A=m.currentMonth,k=m.currentYear,T=m.minutesWidthOnXAxis,D=m.numberOfHours,V=new K(this.ctx),X="hour",le=function(Ue,Fe){return Ue>V.determineDaysOfMonths(Fe+1,k)&&(Ke=1,Fe+=1),{month:Fe,date:Ke}},ce=function(Ue,Fe){return Ue>V.determineDaysOfMonths(Fe+1,k)?Fe+=1:Fe},fe=60-(p.minMinute+p.minSecond/60),ye=fe*T,Pe=p.minHour+1,Me=Pe;fe===60&&(ye=0,Me=Pe=p.minHour);var Ke=S;Me>=24&&(Me=0,Ke+=1,X="day");var we=le(Ke,A).month;we=ce(Ke,we),this.timeScaleArray.push({position:ye,value:Pe,unit:X,day:Ke,hour:Me,year:k,month:F.monthMod(we)}),Me++;for(var Te=ye,te=0;te<D;te++){X="hour",Me>=24&&(Me=0,X="day",we=le(Ke+=1,we).month,we=ce(Ke,we));var ve=this._getYear(k,we,0);Te=60*T+Te;var Be=Me===0?Ke:Me;this.timeScaleArray.push({position:Te,value:Be,unit:X,hour:Me,day:Ke,year:ve,month:F.monthMod(we)}),Me++}}},{key:"generateMinuteScale",value:function(m){for(var p=m.currentMillisecond,S=m.currentSecond,A=m.currentMinute,k=m.currentHour,T=m.currentDate,D=m.currentMonth,V=m.currentYear,X=m.minutesWidthOnXAxis,le=m.secondsWidthOnXAxis,ce=m.numberOfMinutes,fe=A+1,ye=T,Pe=D,Me=V,Ke=k,we=(60-S-p/1e3)*le,Te=0;Te<ce;Te++)fe>=60&&(fe=0,(Ke+=1)===24&&(Ke=0)),this.timeScaleArray.push({position:we,value:fe,unit:"minute",hour:Ke,minute:fe,day:ye,year:this._getYear(Me,Pe,0),month:F.monthMod(Pe)}),we+=X,fe++}},{key:"generateSecondScale",value:function(m){for(var p=m.currentMillisecond,S=m.currentSecond,A=m.currentMinute,k=m.currentHour,T=m.currentDate,D=m.currentMonth,V=m.currentYear,X=m.secondsWidthOnXAxis,le=m.numberOfSeconds,ce=S+1,fe=A,ye=T,Pe=D,Me=V,Ke=k,we=(1e3-p)/1e3*X,Te=0;Te<le;Te++)ce>=60&&(ce=0,++fe>=60&&(fe=0,++Ke===24&&(Ke=0))),this.timeScaleArray.push({position:we,value:ce,unit:"second",hour:Ke,minute:fe,second:ce,day:ye,year:this._getYear(Me,Pe,0),month:F.monthMod(Pe)}),we+=X,ce++}},{key:"createRawDateString",value:function(m,p){var S=m.year;return m.month===0&&(m.month=1),S+="-"+("0"+m.month.toString()).slice(-2),m.unit==="day"?S+=m.unit==="day"?"-"+("0"+p).slice(-2):"-01":S+="-"+("0"+(m.day?m.day:"1")).slice(-2),m.unit==="hour"?S+=m.unit==="hour"?"T"+("0"+p).slice(-2):"T00":S+="T"+("0"+(m.hour?m.hour:"0")).slice(-2),m.unit==="minute"?S+=":"+("0"+p).slice(-2):S+=":"+(m.minute?("0"+m.minute).slice(-2):"00"),m.unit==="second"?S+=":"+("0"+p).slice(-2):S+=":00",this.utc&&(S+=".000Z"),S}},{key:"formatDates",value:function(m){var p=this,S=this.w;return m.map(function(A){var k=A.value.toString(),T=new K(p.ctx),D=p.createRawDateString(A,k),V=T.getDate(T.parseDate(D));if(p.utc||(V=T.getDate(T.parseDateWithTimezone(D))),S.config.xaxis.labels.format===void 0){var X="dd MMM",le=S.config.xaxis.labels.datetimeFormatter;A.unit==="year"&&(X=le.year),A.unit==="month"&&(X=le.month),A.unit==="day"&&(X=le.day),A.unit==="hour"&&(X=le.hour),A.unit==="minute"&&(X=le.minute),A.unit==="second"&&(X=le.second),k=T.formatDate(V,X)}else k=T.formatDate(V,S.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,S=this,A=new z(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 T=0,D=m.map(function(V,X){if(X>0&&S.w.config.xaxis.labels.hideOverlappingLabels){var le=k?p:A.getTextRects(m[T].value).width,ce=m[T].position;return V.position>ce+le+10?(T=X,V):null}return V});return D=D.filter(function(V){return V!==null})}},{key:"_getYear",value:function(m,p,S){return m+Math.floor(p/12)+S}}]),ke}(),On=function(){function ke(m,p){s(this,ke),this.ctx=p,this.w=p.w,this.el=m}return o(ke,[{key:"setupElements",value:function(){var m=this.w,p=m.globals,S=m.config,A=S.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)&&S.plotOptions.bar.horizontal,p.chartClass=".apexcharts".concat(p.chartID),p.dom.baseEl=this.el,p.dom.elWrap=document.createElement("div"),z.setAttrs(p.dom.elWrap,{id:p.chartClass.substring(1),class:"apexcharts-canvas ".concat(p.chartClass.substring(1))}),this.el.appendChild(p.dom.elWrap),p.dom.Paper=new window.SVG.Doc(p.dom.elWrap),p.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(S.chart.offsetX,", ").concat(S.chart.offsetY,")")}),p.dom.Paper.node.style.background=S.theme.mode!=="dark"||S.chart.background?S.theme.mode!=="light"||S.chart.background?S.chart.background:"#fff":"#424242",this.setSVGDimensions(),p.dom.elLegendForeign=document.createElementNS(p.SVGNS,"foreignObject"),z.setAttrs(p.dom.elLegendForeign,{x:0,y:0,width:p.svgWidth,height:p.svgHeight}),p.dom.elLegendWrap=document.createElement("div"),p.dom.elLegendWrap.classList.add("apexcharts-legend"),p.dom.elLegendWrap.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),p.dom.elLegendForeign.appendChild(p.dom.elLegendWrap),p.dom.Paper.node.appendChild(p.dom.elLegendForeign),p.dom.elGraphical=p.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),p.dom.elDefs=p.dom.Paper.defs(),p.dom.Paper.add(p.dom.elGraphical),p.dom.elGraphical.add(p.dom.elDefs)}},{key:"plotChartType",value:function(m,p){var S=this.w,A=this.ctx,k=S.config,T=S.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",X=null,le=0;T.series.forEach(function(Ue,Fe){var at=m[Fe].type||V;D[at]?(at==="rangeArea"?(D[at].series.push(T.seriesRangeStart[Fe]),D[at].seriesRangeEnd.push(T.seriesRangeEnd[Fe])):D[at].series.push(Ue),D[at].i.push(Fe),at!=="column"&&at!=="bar"||(S.globals.columnSeries=D.column)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(at)?X=at:at==="bar"?(D.column.series.push(Ue),D.column.i.push(Fe)):console.warn("You have specified an unrecognized series type (".concat(at,").")),V!==at&&at!=="scatter"&&le++}),le>0&&(X&&console.warn("Chart or series type ".concat(X," cannot appear with other chart or series types.")),D.column.series.length>0&&k.plotOptions.bar.horizontal&&(le-=D.column.series.length,D.column={series:[],i:[]},S.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),T.comboCharts||(T.comboCharts=le>0);var ce=new zt(A,p),fe=new _n(A,p);A.pie=new Xn(A);var ye=new Kn(A);A.rangeBar=new jn(A,p);var Pe=new zn(A),Me=[];if(T.comboCharts){var Ke,we,Te=new Q(A);if(D.area.series.length>0&&(Ke=Me).push.apply(Ke,N(Te.drawSeriesByGroup(D.area,T.areaGroups,"area",ce))),D.column.series.length>0)if(k.chart.stacked){var te=new yn(A,p);Me.push(te.draw(D.column.series,D.column.i))}else A.bar=new un(A,p),Me.push(A.bar.draw(D.column.series,D.column.i));if(D.rangeArea.series.length>0&&Me.push(ce.draw(D.rangeArea.series,"rangeArea",D.rangeArea.i,D.rangeArea.seriesRangeEnd)),D.line.series.length>0&&(we=Me).push.apply(we,N(Te.drawSeriesByGroup(D.line,T.lineGroups,"line",ce))),D.candlestick.series.length>0&&Me.push(fe.draw(D.candlestick.series,"candlestick",D.candlestick.i)),D.boxPlot.series.length>0&&Me.push(fe.draw(D.boxPlot.series,"boxPlot",D.boxPlot.i)),D.rangeBar.series.length>0&&Me.push(A.rangeBar.draw(D.rangeBar.series,D.rangeBar.i)),D.scatter.series.length>0){var ve=new zt(A,p,!0);Me.push(ve.draw(D.scatter.series,"scatter",D.scatter.i))}if(D.bubble.series.length>0){var Be=new zt(A,p,!0);Me.push(Be.draw(D.bubble.series,"bubble",D.bubble.i))}}else switch(k.chart.type){case"line":Me=ce.draw(T.series,"line");break;case"area":Me=ce.draw(T.series,"area");break;case"bar":k.chart.stacked?Me=new yn(A,p).draw(T.series):(A.bar=new un(A,p),Me=A.bar.draw(T.series));break;case"candlestick":Me=new _n(A,p).draw(T.series,"candlestick");break;case"boxPlot":Me=new _n(A,p).draw(T.series,k.chart.type);break;case"rangeBar":Me=A.rangeBar.draw(T.series);break;case"rangeArea":Me=ce.draw(T.seriesRangeStart,"rangeArea",void 0,T.seriesRangeEnd);break;case"heatmap":Me=new Sn(A,p).draw(T.series);break;case"treemap":Me=new Mt(A,p).draw(T.series);break;case"pie":case"donut":case"polarArea":Me=A.pie.draw(T.series);break;case"radialBar":Me=ye.draw(T.series);break;case"radar":Me=Pe.draw(T.series);break;default:Me=ce.draw(T.series)}return Me}},{key:"setSVGDimensions",value:function(){var m=this.w,p=m.globals,S=m.config;S.chart.width=S.chart.width||"100%",S.chart.height=S.chart.height||"auto",p.svgWidth=S.chart.width,p.svgHeight=S.chart.height;var A=F.getDimensions(this.el),k=S.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(S.chart.width,10)/100):k!=="px"&&k!==""||(p.svgWidth=parseInt(S.chart.width,10));var T=String(S.chart.height).toString().split(/[0-9]+/g).pop();if(p.svgHeight!=="auto"&&p.svgHeight!=="")if(T==="%"){var D=F.getDimensions(this.el.parentNode);p.svgHeight=D[1]*parseInt(S.chart.height,10)/100}else p.svgHeight=parseInt(S.chart.height,10);else p.svgHeight=p.axisCharts?p.svgWidth/1.61:p.svgWidth/1.2;if(p.svgWidth=Math.max(p.svgWidth,0),p.svgHeight=Math.max(p.svgHeight,0),z.setAttrs(p.dom.Paper.node,{width:p.svgWidth,height:p.svgHeight}),T!=="%"){var V=S.chart.sparkline.enabled?0:p.axisCharts?S.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,S=m.translateX;z.setAttrs(m.dom.elGraphical.node,{transform:"translate(".concat(S,", ").concat(p,")")})}},{key:"resizeNonAxisCharts",value:function(){var m=this.w,p=m.globals,S=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&&(S=new hn(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var k=m.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),T=2.05*m.globals.radialSize;if(k&&!m.config.chart.sparkline.enabled&&m.config.plotOptions.radialBar.startAngle!==0){var D=F.getBoundingClientRect(k);T=D.bottom;var V=D.bottom-D.top;T=Math.max(2.05*m.globals.radialSize,V)}var X=Math.ceil(T+p.translateY+S+A);p.dom.elLegendForeign&&p.dom.elLegendForeign.setAttribute("height",X),m.config.chart.height&&String(m.config.chart.height).includes("%")||(p.dom.elWrap.style.height="".concat(X,"px"),z.setAttrs(p.dom.Paper.node,{height:X}),p.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(X,"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[]})},S=new xe,A=this.w.globals;S.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 St(this.ctx).drawXCrosshairs(),m.config.yaxis[0].crosshairs.position==="back"&&new St(this.ctx).drawYCrosshairs(),m.config.xaxis.type==="datetime"&&m.config.xaxis.labels.formatter===void 0){this.ctx.timeScale=new Wn(this.ctx);var S=[];isFinite(m.globals.minX)&&isFinite(m.globals.maxX)&&!m.globals.isBarHorizontal?S=this.ctx.timeScale.calculateTimeScaleTicks(m.globals.minX,m.globals.maxX):m.globals.isBarHorizontal&&(S=this.ctx.timeScale.calculateTimeScaleTicks(m.globals.minY,m.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(S)}p=new Q(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 S=Array.isArray(p.config.chart.brush.targets)?p.config.chart.brush.targets:[p.config.chart.brush.target];S.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){S.forEach(function(T){ApexCharts.getChartByID(T).ctx.updateHelpers._updateOptions({xaxis:{min:k.xaxis.min,max:k.xaxis.max}},!1,!1,!1,!1)})}}}}]),ke}(),$t=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{key:"_updateOptions",value:function(m){var p=this,S=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],T=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(X,le){var ce=X.w;if(ce.globals.shouldAnimate=A,S||(ce.globals.resized=!0,ce.globals.dataChanged=!0,A&&X.series.getPreviousPaths()),m&&P(m)==="object"&&(X.config=new _e(m),m=Q.extendArrayProps(X.config,m,ce),X.w.globals.chartID!==p.ctx.w.globals.chartID&&delete m.series,ce.config=F.extend(ce.config,m),T&&(ce.globals.lastXAxis=m.xaxis?F.clone(m.xaxis):[],ce.globals.lastYAxis=m.yaxis?F.clone(m.yaxis):[],ce.globals.initialConfig=F.extend({},ce.config),ce.globals.initialSeries=F.clone(ce.config.series),m.series))){for(var fe=0;fe<ce.globals.collapsedSeriesIndices.length;fe++){var ye=ce.config.series[ce.globals.collapsedSeriesIndices[fe]];ce.globals.collapsedSeries[fe].data=ce.globals.axisCharts?ye.data.slice():ye}for(var Pe=0;Pe<ce.globals.ancillaryCollapsedSeriesIndices.length;Pe++){var Me=ce.config.series[ce.globals.ancillaryCollapsedSeriesIndices[Pe]];ce.globals.ancillaryCollapsedSeries[Pe].data=ce.globals.axisCharts?Me.data.slice():Me}X.series.emptyCollapsedSeries(ce.config.series)}return X.update(m).then(function(){le===V.length-1&&D(X)})})})}},{key:"_updateSeries",value:function(m,p){var S=this,A=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return new Promise(function(k){var T,D=S.w;return D.globals.shouldAnimate=p,D.globals.dataChanged=!0,p&&S.ctx.series.getPreviousPaths(),D.globals.axisCharts?((T=m.map(function(V,X){return S._extendSeries(V,X)})).length===0&&(T=[{data:[]}]),D.config.series=T):D.config.series=m.slice(),A&&(D.globals.initialConfig.series=F.clone(D.config.series),D.globals.initialSeries=F.clone(D.config.series)),S.ctx.update().then(function(){k(S.ctx)})})}},{key:"_extendSeries",value:function(m,p){var S=this.w,A=S.config.series[p];return y(y({},S.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 S=this.w,A=null,k=".apexcharts-series[data\\:realIndex='".concat(m,"']");return S.globals.axisCharts?A=S.globals.dom.Paper.select("".concat(k," path[j='").concat(p,"'], ").concat(k," circle[j='").concat(p,"'], ").concat(k," rect[j='").concat(p,"']")).members[0]:p===void 0&&(A=S.globals.dom.Paper.select("".concat(k," path[j='").concat(m,"']")).members[0],S.config.chart.type!=="pie"&&S.config.chart.type!=="polarArea"&&S.config.chart.type!=="donut"||this.ctx.pie.pieClicked(m)),A?(new z(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 S=new he(m);m=S.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,S){m.yaxis[S].min=0,m.yaxis[S].max=100}):(m.yaxis.min=0,m.yaxis.max=100)),m}},{key:"revertDefaultAxisMinMax",value:function(m){var p=this,S=this.w,A=S.globals.lastXAxis,k=S.globals.lastYAxis;m&&m.xaxis&&(A=m.xaxis),m&&m.yaxis&&(k=m.yaxis),S.config.xaxis.min=A.min,S.config.xaxis.max=A.max;var T=function(D){k[D]!==void 0&&(S.config.yaxis[D].min=k[D].min,S.config.yaxis[D].max=k[D].max)};S.config.yaxis.map(function(D,V){S.globals.zoomed||k[V]!==void 0?T(V):p.ctx.opts.yaxis[V]!==void 0&&(D.min=p.ctx.opts.yaxis[V].min,D.max=p.ctx.opts.yaxis[V].max)})}}]),ke}();kt=typeof window<"u"?window:void 0,gt=function(ke,m){var p=(this!==void 0?this:ke).SVG=function(te){if(p.supported)return te=new p.Doc(te),p.parser.draw||p.prepare(),te};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(te){return"Svgjs"+le(te)+p.did++},p.create=function(te){var ve=m.createElementNS(this.ns,te);return ve.setAttribute("id",this.eid(te)),ve},p.extend=function(){var te,ve;ve=(te=[].slice.call(arguments)).pop();for(var Be=te.length-1;Be>=0;Be--)if(te[Be])for(var Ue in ve)te[Be].prototype[Ue]=ve[Ue];p.Set&&p.Set.inherit&&p.Set.inherit()},p.invent=function(te){var ve=typeof te.create=="function"?te.create:function(){this.constructor.call(this,p.create(te.create))};return te.inherit&&(ve.prototype=new te.inherit),te.extend&&p.extend(ve,te.extend),te.construct&&p.extend(te.parent||p.Container,te.construct),ve},p.adopt=function(te){return te?te.instance?te.instance:((ve=te.nodeName=="svg"?te.parentNode instanceof ke.SVGElement?new p.Nested:new p.Doc:te.nodeName=="linearGradient"?new p.Gradient("linear"):te.nodeName=="radialGradient"?new p.Gradient("radial"):p[le(te.nodeName)]?new p[le(te.nodeName)]:new p.Element(te)).type=te.nodeName,ve.node=te,te.instance=ve,ve instanceof p.Doc&&ve.namespace().defs(),ve.setData(JSON.parse(te.getAttribute("svgjs:data"))||{}),ve):null;var ve},p.prepare=function(){var te=m.getElementsByTagName("body")[0],ve=(te?new p.Doc(te):p.adopt(m.documentElement).nested()).size(2,0);p.parser={body:te||m.documentElement,draw:ve.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node,poly:ve.polyline().node,path:ve.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(te,ve){for(var Be=te.length,Ue=[],Fe=0;Fe<Be;Fe++)Ue.push(ve(te[Fe]));return Ue},filter:function(te,ve){for(var Be=te.length,Ue=[],Fe=0;Fe<Be;Fe++)ve(te[Fe])&&Ue.push(te[Fe]);return Ue},filterSVGElements:function(te){return this.filter(te,function(ve){return ve instanceof ke.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(te){var ve,Be;this.r=0,this.g=0,this.b=0,te&&(typeof te=="string"?p.regex.isRgb.test(te)?(ve=p.regex.rgb.exec(te.replace(p.regex.whitespace,"")),this.r=parseInt(ve[1]),this.g=parseInt(ve[2]),this.b=parseInt(ve[3])):p.regex.isHex.test(te)&&(ve=p.regex.hex.exec((Be=te).length==4?["#",Be.substring(1,2),Be.substring(1,2),Be.substring(2,3),Be.substring(2,3),Be.substring(3,4),Be.substring(3,4)].join(""):Be),this.r=parseInt(ve[1],16),this.g=parseInt(ve[2],16),this.b=parseInt(ve[3],16)):P(te)==="object"&&(this.r=te.r,this.g=te.g,this.b=te.b))},p.extend(p.Color,{toString:function(){return this.toHex()},toHex:function(){return"#"+ce(this.r)+ce(this.g)+ce(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(te){return this.destination=new p.Color(te),this},at:function(te){return this.destination?(te=te<0?0:te>1?1:te,new p.Color({r:~~(this.r+(this.destination.r-this.r)*te),g:~~(this.g+(this.destination.g-this.g)*te),b:~~(this.b+(this.destination.b-this.b)*te)})):this}}),p.Color.test=function(te){return te+="",p.regex.isHex.test(te)||p.regex.isRgb.test(te)},p.Color.isRgb=function(te){return te&&typeof te.r=="number"&&typeof te.g=="number"&&typeof te.b=="number"},p.Color.isColor=function(te){return p.Color.isRgb(te)||p.Color.test(te)},p.Array=function(te,ve){(te=(te||[]).valueOf()).length==0&&ve&&(te=ve.valueOf()),this.value=this.parse(te)},p.extend(p.Array,{toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(te){return te=te.valueOf(),Array.isArray(te)?te:this.split(te)}}),p.PointArray=function(te,ve){p.Array.call(this,te,ve||[[0,0]])},p.PointArray.prototype=new p.Array,p.PointArray.prototype.constructor=p.PointArray;for(var S={M:function(te,ve,Be){return ve.x=Be.x=te[0],ve.y=Be.y=te[1],["M",ve.x,ve.y]},L:function(te,ve){return ve.x=te[0],ve.y=te[1],["L",te[0],te[1]]},H:function(te,ve){return ve.x=te[0],["H",te[0]]},V:function(te,ve){return ve.y=te[0],["V",te[0]]},C:function(te,ve){return ve.x=te[4],ve.y=te[5],["C",te[0],te[1],te[2],te[3],te[4],te[5]]},Q:function(te,ve){return ve.x=te[2],ve.y=te[3],["Q",te[0],te[1],te[2],te[3]]},S:function(te,ve){return ve.x=te[2],ve.y=te[3],["S",te[0],te[1],te[2],te[3]]},Z:function(te,ve,Be){return ve.x=Be.x,ve.y=Be.y,["Z"]}},A="mlhvqtcsaz".split(""),k=0,T=A.length;k<T;++k)S[A[k]]=function(te){return function(ve,Be,Ue){if(te=="H")ve[0]=ve[0]+Be.x;else if(te=="V")ve[0]=ve[0]+Be.y;else if(te=="A")ve[5]=ve[5]+Be.x,ve[6]=ve[6]+Be.y;else for(var Fe=0,at=ve.length;Fe<at;++Fe)ve[Fe]=ve[Fe]+(Fe%2?Be.y:Be.x);if(S&&typeof S[te]=="function")return S[te](ve,Be,Ue)}}(A[k].toUpperCase());p.PathArray=function(te,ve){p.Array.call(this,te,ve||[["M",0,0]])},p.PathArray.prototype=new p.Array,p.PathArray.prototype.constructor=p.PathArray,p.extend(p.PathArray,{toString:function(){return function(te){for(var ve=0,Be=te.length,Ue="";ve<Be;ve++)Ue+=te[ve][0],te[ve][1]!=null&&(Ue+=te[ve][1],te[ve][2]!=null&&(Ue+=" ",Ue+=te[ve][2],te[ve][3]!=null&&(Ue+=" ",Ue+=te[ve][3],Ue+=" ",Ue+=te[ve][4],te[ve][5]!=null&&(Ue+=" ",Ue+=te[ve][5],Ue+=" ",Ue+=te[ve][6],te[ve][7]!=null&&(Ue+=" ",Ue+=te[ve][7])))));return Ue+" "}(this.value)},move:function(te,ve){var Be=this.bbox();return Be.x,Be.y,this},at:function(te){if(!this.destination)return this;for(var ve=this.value,Be=this.destination.value,Ue=[],Fe=new p.PathArray,at=0,ut=ve.length;at<ut;at++){Ue[at]=[ve[at][0]];for(var yt=1,Lt=ve[at].length;yt<Lt;yt++)Ue[at][yt]=ve[at][yt]+(Be[at][yt]-ve[at][yt])*te;Ue[at][0]==="A"&&(Ue[at][4]=+(Ue[at][4]!=0),Ue[at][5]=+(Ue[at][5]!=0))}return Fe.value=Ue,Fe},parse:function(te){if(te instanceof p.PathArray)return te.valueOf();var ve,Be={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};te=typeof te=="string"?te.replace(p.regex.numbersWithDots,V).replace(p.regex.pathLetters," $& ").replace(p.regex.hyphen,"$1 -").trim().split(p.regex.delimiter):te.reduce(function(Lt,Gt){return[].concat.call(Lt,Gt)},[]);var Ue=[],Fe=new p.Point,at=new p.Point,ut=0,yt=te.length;do p.regex.isPathLetter.test(te[ut])?(ve=te[ut],++ut):ve=="M"?ve="L":ve=="m"&&(ve="l"),Ue.push(S[ve].call(null,te.slice(ut,ut+=Be[ve.toUpperCase()]).map(parseFloat),Fe,at));while(yt>ut);return Ue},bbox:function(){return p.parser.draw||p.prepare(),p.parser.path.setAttribute("d",this.toString()),p.parser.path.getBBox()}}),p.Number=p.invent({create:function(te,ve){this.value=0,this.unit=ve||"",typeof te=="number"?this.value=isNaN(te)?0:isFinite(te)?te:te<0?-34e37:34e37:typeof te=="string"?(ve=te.match(p.regex.numberAndUnit))&&(this.value=parseFloat(ve[1]),ve[5]=="%"?this.value/=100:ve[5]=="s"&&(this.value*=1e3),this.unit=ve[5]):te instanceof p.Number&&(this.value=te.valueOf(),this.unit=te.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(te){return te=new p.Number(te),new p.Number(this+te,this.unit||te.unit)},minus:function(te){return te=new p.Number(te),new p.Number(this-te,this.unit||te.unit)},times:function(te){return te=new p.Number(te),new p.Number(this*te,this.unit||te.unit)},divide:function(te){return te=new p.Number(te),new p.Number(this/te,this.unit||te.unit)},to:function(te){var ve=new p.Number(this);return typeof te=="string"&&(ve.unit=te),ve},morph:function(te){return this.destination=new p.Number(te),te.relative&&(this.destination.value+=this.value),this},at:function(te){return this.destination?new p.Number(this.destination).minus(this).times(te).plus(this):this}}}),p.Element=p.invent({create:function(te){this._stroke=p.defaults.attrs.stroke,this._event=null,this.dom={},(this.node=te)&&(this.type=te.nodeName,this.node.instance=this,this._stroke=te.getAttribute("stroke")||this._stroke)},extend:{x:function(te){return this.attr("x",te)},y:function(te){return this.attr("y",te)},cx:function(te){return te==null?this.x()+this.width()/2:this.x(te-this.width()/2)},cy:function(te){return te==null?this.y()+this.height()/2:this.y(te-this.height()/2)},move:function(te,ve){return this.x(te).y(ve)},center:function(te,ve){return this.cx(te).cy(ve)},width:function(te){return this.attr("width",te)},height:function(te){return this.attr("height",te)},size:function(te,ve){var Be=fe(this,te,ve);return this.width(new p.Number(Be.width)).height(new p.Number(Be.height))},clone:function(te){this.writeDataToDom();var ve=Me(this.node.cloneNode(!0));return te?te.add(ve):this.after(ve),ve},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(te){return this.after(te).remove(),te},addTo:function(te){return te.put(this)},putIn:function(te){return te.add(this)},id:function(te){return this.attr("id",te)},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 te=this.attr("class");return te==null?[]:te.trim().split(p.regex.delimiter)},hasClass:function(te){return this.classes().indexOf(te)!=-1},addClass:function(te){if(!this.hasClass(te)){var ve=this.classes();ve.push(te),this.attr("class",ve.join(" "))}return this},removeClass:function(te){return this.hasClass(te)&&this.attr("class",this.classes().filter(function(ve){return ve!=te}).join(" ")),this},toggleClass:function(te){return this.hasClass(te)?this.removeClass(te):this.addClass(te)},reference:function(te){return p.get(this.attr(te))},parent:function(te){var ve=this;if(!ve.node.parentNode)return null;if(ve=p.adopt(ve.node.parentNode),!te)return ve;for(;ve&&ve.node instanceof ke.SVGElement;){if(typeof te=="string"?ve.matches(te):ve instanceof te)return ve;if(!ve.node.parentNode||ve.node.parentNode.nodeName=="#document")return null;ve=p.adopt(ve.node.parentNode)}},doc:function(){return this instanceof p.Doc?this:this.parent(p.Doc)},parents:function(te){var ve=[],Be=this;do{if(!(Be=Be.parent(te))||!Be.node)break;ve.push(Be)}while(Be.parent);return ve},matches:function(te){return function(ve,Be){return(ve.matches||ve.matchesSelector||ve.msMatchesSelector||ve.mozMatchesSelector||ve.webkitMatchesSelector||ve.oMatchesSelector).call(ve,Be)}(this.node,te)},native:function(){return this.node},svg:function(te){var ve=m.createElementNS("http://www.w3.org/2000/svg","svg");if(!(te&&this instanceof p.Parent))return ve.appendChild(te=m.createElementNS("http://www.w3.org/2000/svg","svg")),this.writeDataToDom(),te.appendChild(this.node.cloneNode(!0)),ve.innerHTML.replace(/^<svg>/,"").replace(/<\/svg>$/,"");ve.innerHTML="<svg>"+te.replace(/\n/,"").replace(/<([\w:-]+)([^<]+?)\/>/g,"<$1$2></$1>")+"</svg>";for(var Be=0,Ue=ve.firstChild.childNodes.length;Be<Ue;Be++)this.node.appendChild(ve.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(te){return this.dom=te,this},is:function(te){return function(ve,Be){return ve instanceof Be}(this,te)}}}),p.easing={"-":function(te){return te},"<>":function(te){return-Math.cos(te*Math.PI)/2+.5},">":function(te){return Math.sin(te*Math.PI/2)},"<":function(te){return 1-Math.cos(te*Math.PI/2)}},p.morph=function(te){return function(ve,Be){return new p.MorphObj(ve,Be).at(te)}},p.Situation=p.invent({create:function(te){this.init=!1,this.reversed=!1,this.reversing=!1,this.duration=new p.Number(te.duration).valueOf(),this.delay=new p.Number(te.delay).valueOf(),this.start=+new Date+this.delay,this.finish=this.start+this.duration,this.ease=te.ease,this.loop=0,this.loops=!1,this.animations={},this.attrs={},this.styles={},this.transforms=[],this.once={}}}),p.FX=p.invent({create:function(te){this._target=te,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(te,ve,Be){P(te)==="object"&&(ve=te.ease,Be=te.delay,te=te.duration);var Ue=new p.Situation({duration:te||1e3,delay:Be||0,ease:p.easing[ve||"-"]||ve});return this.queue(Ue),this},target:function(te){return te&&te instanceof p.Element?(this._target=te,this):this._target},timeToAbsPos:function(te){return(te-this.situation.start)/(this.situation.duration/this._speed)},absPosToTime:function(te){return this.situation.duration/this._speed*te+this.situation.start},startAnimFrame:function(){this.stopAnimFrame(),this.animationFrame=ke.requestAnimationFrame((function(){this.step()}).bind(this))},stopAnimFrame:function(){ke.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(te){return(typeof te=="function"||te instanceof p.Situation)&&this.situations.push(te),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 te,ve=this.situation;if(ve.init)return this;for(var Be in ve.animations){te=this.target()[Be](),Array.isArray(te)||(te=[te]),Array.isArray(ve.animations[Be])||(ve.animations[Be]=[ve.animations[Be]]);for(var Ue=te.length;Ue--;)ve.animations[Be][Ue]instanceof p.Number&&(te[Ue]=new p.Number(te[Ue])),ve.animations[Be][Ue]=te[Ue].morph(ve.animations[Be][Ue])}for(var Be in ve.attrs)ve.attrs[Be]=new p.MorphObj(this.target().attr(Be),ve.attrs[Be]);for(var Be in ve.styles)ve.styles[Be]=new p.MorphObj(this.target().style(Be),ve.styles[Be]);return ve.initialTransformation=this.target().matrixify(),ve.init=!0,this},clearQueue:function(){return this.situations=[],this},clearCurrent:function(){return this.situation=null,this},stop:function(te,ve){var Be=this.active;return this.active=!1,ve&&this.clearQueue(),te&&this.situation&&(!Be&&this.startCurrent(),this.atEnd()),this.stopAnimFrame(),this.clearCurrent()},after:function(te){var ve=this.last();return this.target().on("finished.fx",function Be(Ue){Ue.detail.situation==ve&&(te.call(this,ve),this.off("finished.fx",Be))}),this._callStart()},during:function(te){var ve=this.last(),Be=function(Ue){Ue.detail.situation==ve&&te.call(this,Ue.detail.pos,p.morph(Ue.detail.pos),Ue.detail.eased,ve)};return this.target().off("during.fx",Be).on("during.fx",Be),this.after(function(){this.off("during.fx",Be)}),this._callStart()},afterAll:function(te){var ve=function Be(Ue){te.call(this),this.off("allfinished.fx",Be)};return this.target().off("allfinished.fx",ve).on("allfinished.fx",ve),this._callStart()},last:function(){return this.situations.length?this.situations[this.situations.length-1]:this.situation},add:function(te,ve,Be){return this.last()[Be||"animations"][te]=ve,this._callStart()},step:function(te){var ve,Be,Ue;te||(this.absPos=this.timeToAbsPos(+new Date)),this.situation.loops!==!1?(ve=Math.max(this.absPos,0),Be=Math.floor(ve),this.situation.loops===!0||Be<this.situation.loops?(this.pos=ve-Be,Ue=this.situation.loop,this.situation.loop=Be):(this.absPos=this.situation.loops,this.pos=1,Ue=this.situation.loop-1,this.situation.loop=this.situation.loops),this.situation.reversing&&(this.situation.reversed=this.situation.reversed!=!!((this.situation.loop-Ue)%2))):(this.absPos=Math.min(this.absPos,1),this.pos=this.absPos),this.pos<0&&(this.pos=0),this.situation.reversed&&(this.pos=1-this.pos);var Fe=this.situation.ease(this.pos);for(var at in this.situation.once)at>this.lastPos&&at<=Fe&&(this.situation.once[at].call(this.target(),this.pos,Fe),delete this.situation.once[at]);return this.active&&this.target().fire("during",{pos:this.pos,eased:Fe,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=Fe,this):this},eachAt:function(){var te,ve=this,Be=this.target(),Ue=this.situation;for(var Fe in Ue.animations)te=[].concat(Ue.animations[Fe]).map(function(yt){return typeof yt!="string"&&yt.at?yt.at(Ue.ease(ve.pos),ve.pos):yt}),Be[Fe].apply(Be,te);for(var Fe in Ue.attrs)te=[Fe].concat(Ue.attrs[Fe]).map(function(Lt){return typeof Lt!="string"&&Lt.at?Lt.at(Ue.ease(ve.pos),ve.pos):Lt}),Be.attr.apply(Be,te);for(var Fe in Ue.styles)te=[Fe].concat(Ue.styles[Fe]).map(function(Lt){return typeof Lt!="string"&&Lt.at?Lt.at(Ue.ease(ve.pos),ve.pos):Lt}),Be.style.apply(Be,te);if(Ue.transforms.length){te=Ue.initialTransformation,Fe=0;for(var at=Ue.transforms.length;Fe<at;Fe++){var ut=Ue.transforms[Fe];ut instanceof p.Matrix?te=ut.relative?te.multiply(new p.Matrix().morph(ut).at(Ue.ease(this.pos))):te.morph(ut).at(Ue.ease(this.pos)):(ut.relative||ut.undo(te.extract()),te=te.multiply(ut.at(Ue.ease(this.pos))))}Be.matrix(te)}return this},once:function(te,ve,Be){var Ue=this.last();return Be||(te=Ue.ease(te)),Ue.once[te]=ve,this},_callStart:function(){return setTimeout((function(){this.start()}).bind(this),0),this}},parent:p.Element,construct:{animate:function(te,ve,Be){return(this.fx||(this.fx=new p.FX(this))).animate(te,ve,Be)},delay:function(te){return(this.fx||(this.fx=new p.FX(this))).delay(te)},stop:function(te,ve){return this.fx&&this.fx.stop(te,ve),this},finish:function(){return this.fx&&this.fx.finish(),this}}}),p.MorphObj=p.invent({create:function(te,ve){return p.Color.isColor(ve)?new p.Color(te).morph(ve):p.regex.delimiter.test(te)?p.regex.pathLetters.test(te)?new p.PathArray(te).morph(ve):new p.Array(te).morph(ve):p.regex.numberAndUnit.test(ve)?new p.Number(te).morph(ve):(this.value=te,void(this.destination=ve))},extend:{at:function(te,ve){return ve<1?this.value:this.destination},valueOf:function(){return this.value}}}),p.extend(p.FX,{attr:function(te,ve,Be){if(P(te)==="object")for(var Ue in te)this.attr(Ue,te[Ue]);else this.add(te,ve,"attrs");return this},plot:function(te,ve,Be,Ue){return arguments.length==4?this.plot([te,ve,Be,Ue]):this.add("plot",new(this.target()).morphArray(te))}}),p.Box=p.invent({create:function(te,ve,Be,Ue){if(!(P(te)!=="object"||te instanceof p.Element))return p.Box.call(this,te.left!=null?te.left:te.x,te.top!=null?te.top:te.y,te.width,te.height);var Fe;arguments.length==4&&(this.x=te,this.y=ve,this.width=Be,this.height=Ue),(Fe=this).x==null&&(Fe.x=0,Fe.y=0,Fe.width=0,Fe.height=0),Fe.w=Fe.width,Fe.h=Fe.height,Fe.x2=Fe.x+Fe.width,Fe.y2=Fe.y+Fe.height,Fe.cx=Fe.x+Fe.width/2,Fe.cy=Fe.y+Fe.height/2}}),p.BBox=p.invent({create:function(te){if(p.Box.apply(this,[].slice.call(arguments)),te instanceof p.Element){var ve;try{if(!m.documentElement.contains){for(var Be=te.node;Be.parentNode;)Be=Be.parentNode;if(Be!=m)throw new Error("Element not in the dom")}ve=te.node.getBBox()}catch{if(te instanceof p.Shape){p.parser.draw||p.prepare();var Ue=te.clone(p.parser.draw.instance).show();Ue&&Ue.node&&typeof Ue.node.getBBox=="function"&&(ve=Ue.node.getBBox()),Ue&&typeof Ue.remove=="function"&&Ue.remove()}else ve={x:te.node.clientLeft,y:te.node.clientTop,width:te.node.clientWidth,height:te.node.clientHeight}}p.Box.call(this,ve)}},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(te){var ve=Pe([1,0,0,1,0,0]);te=te===null?ve:te instanceof p.Element?te.matrixify():typeof te=="string"?Pe(te.split(p.regex.delimiter).map(parseFloat)):arguments.length==6?Pe([].slice.call(arguments)):Array.isArray(te)?Pe(te):te&&P(te)==="object"?te:ve;for(var Be=we.length-1;Be>=0;--Be)this[we[Be]]=te[we[Be]]!=null?te[we[Be]]:ve[we[Be]]},extend:{extract:function(){var te=ye(this,0,1);ye(this,1,0);var ve=180/Math.PI*Math.atan2(te.y,te.x)-90;return{x:this.e,y:this.f,transformedX:(this.e*Math.cos(ve*Math.PI/180)+this.f*Math.sin(ve*Math.PI/180))/Math.sqrt(this.a*this.a+this.b*this.b),transformedY:(this.f*Math.cos(ve*Math.PI/180)+this.e*Math.sin(-ve*Math.PI/180))/Math.sqrt(this.c*this.c+this.d*this.d),rotation:ve,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(te){return this.destination=new p.Matrix(te),this},multiply:function(te){return new p.Matrix(this.native().multiply(function(ve){return ve instanceof p.Matrix||(ve=new p.Matrix(ve)),ve}(te).native()))},inverse:function(){return new p.Matrix(this.native().inverse())},translate:function(te,ve){return new p.Matrix(this.native().translate(te||0,ve||0))},native:function(){for(var te=p.parser.native.createSVGMatrix(),ve=we.length-1;ve>=0;ve--)te[we[ve]]=this[we[ve]];return te},toString:function(){return"matrix("+Ke(this.a)+","+Ke(this.b)+","+Ke(this.c)+","+Ke(this.d)+","+Ke(this.e)+","+Ke(this.f)+")"}},parent:p.Element,construct:{ctm:function(){return new p.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof p.Nested){var te=this.rect(1,1),ve=te.node.getScreenCTM();return te.remove(),new p.Matrix(ve)}return new p.Matrix(this.node.getScreenCTM())}}}),p.Point=p.invent({create:function(te,ve){var Be;Be=Array.isArray(te)?{x:te[0],y:te[1]}:P(te)==="object"?{x:te.x,y:te.y}:te!=null?{x:te,y:ve??te}:{x:0,y:0},this.x=Be.x,this.y=Be.y},extend:{clone:function(){return new p.Point(this)},morph:function(te,ve){return this.destination=new p.Point(te,ve),this}}}),p.extend(p.Element,{point:function(te,ve){return new p.Point(te,ve).transform(this.screenCTM().inverse())}}),p.extend(p.Element,{attr:function(te,ve,Be){if(te==null){for(te={},Be=(ve=this.node.attributes).length-1;Be>=0;Be--)te[ve[Be].nodeName]=p.regex.isNumber.test(ve[Be].nodeValue)?parseFloat(ve[Be].nodeValue):ve[Be].nodeValue;return te}if(P(te)==="object")for(var Ue in te)this.attr(Ue,te[Ue]);else if(ve===null)this.node.removeAttribute(te);else{if(ve==null)return(ve=this.node.getAttribute(te))==null?p.defaults.attrs[te]:p.regex.isNumber.test(ve)?parseFloat(ve):ve;te=="stroke-width"?this.attr("stroke",parseFloat(ve)>0?this._stroke:null):te=="stroke"&&(this._stroke=ve),te!="fill"&&te!="stroke"||(p.regex.isImage.test(ve)&&(ve=this.doc().defs().image(ve,0,0)),ve instanceof p.Image&&(ve=this.doc().defs().pattern(0,0,function(){this.add(ve)}))),typeof ve=="number"?ve=new p.Number(ve):p.Color.isColor(ve)?ve=new p.Color(ve):Array.isArray(ve)&&(ve=new p.Array(ve)),te=="leading"?this.leading&&this.leading(ve):typeof Be=="string"?this.node.setAttributeNS(Be,te,ve.toString()):this.node.setAttribute(te,ve.toString()),!this.rebuild||te!="font-size"&&te!="x"||this.rebuild(te,ve)}return this}}),p.extend(p.Element,{transform:function(te,ve){var Be;return P(te)!=="object"?(Be=new p.Matrix(this).extract(),typeof te=="string"?Be[te]:Be):(Be=new p.Matrix(this),ve=!!ve||!!te.relative,te.a!=null&&(Be=ve?Be.multiply(new p.Matrix(te)):new p.Matrix(te)),this.attr("transform",Be))}}),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(te){var ve=te.trim().split("(");return[ve[0],ve[1].split(p.regex.delimiter).map(function(Be){return parseFloat(Be)})]}).reduce(function(te,ve){return ve[0]=="matrix"?te.multiply(Pe(ve[1])):te[ve[0]].apply(te,ve[1])},new p.Matrix)},toParent:function(te){if(this==te)return this;var ve=this.screenCTM(),Be=te.screenCTM().inverse();return this.addTo(te).untransform().transform(Be.multiply(ve)),this},toDoc:function(){return this.toParent(this.doc())}}),p.Transformation=p.invent({create:function(te,ve){if(arguments.length>1&&typeof ve!="boolean")return this.constructor.call(this,[].slice.call(arguments));if(Array.isArray(te))for(var Be=0,Ue=this.arguments.length;Be<Ue;++Be)this[this.arguments[Be]]=te[Be];else if(te&&P(te)==="object")for(Be=0,Ue=this.arguments.length;Be<Ue;++Be)this[this.arguments[Be]]=te[this.arguments[Be]];this.inversed=!1,ve===!0&&(this.inversed=!0)}}),p.Translate=p.invent({parent:p.Matrix,inherit:p.Transformation,create:function(te,ve){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["transformedX","transformedY"],method:"translate"}}),p.extend(p.Element,{style:function(te,ve){if(arguments.length==0)return this.node.style.cssText||"";if(arguments.length<2)if(P(te)==="object")for(var Be in te)this.style(Be,te[Be]);else{if(!p.regex.isCss.test(te))return this.node.style[X(te)];for(te=te.split(/\s*;\s*/).filter(function(Ue){return!!Ue}).map(function(Ue){return Ue.split(/\s*:\s*/)});ve=te.pop();)this.style(ve[0],ve[1])}else this.node.style[X(te)]=ve===null||p.regex.isBlank.test(ve)?"":ve;return this}}),p.Parent=p.invent({create:function(te){this.constructor.call(this,te)},inherit:p.Element,extend:{children:function(){return p.utils.map(p.utils.filterSVGElements(this.node.childNodes),function(te){return p.adopt(te)})},add:function(te,ve){return ve==null?this.node.appendChild(te.node):te.node!=this.node.childNodes[ve]&&this.node.insertBefore(te.node,this.node.childNodes[ve]),this},put:function(te,ve){return this.add(te,ve),te},has:function(te){return this.index(te)>=0},index:function(te){return[].slice.call(this.node.childNodes).indexOf(te.node)},get:function(te){return p.adopt(this.node.childNodes[te])},first:function(){return this.get(0)},last:function(){return this.get(this.node.childNodes.length-1)},each:function(te,ve){for(var Be=this.children(),Ue=0,Fe=Be.length;Ue<Fe;Ue++)Be[Ue]instanceof p.Element&&te.apply(Be[Ue],[Ue,Be]),ve&&Be[Ue]instanceof p.Container&&Be[Ue].each(te,ve);return this},removeElement:function(te){return this.node.removeChild(te.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(te,ve){return ve===0||this instanceof p.Defs||this.node==p.parser.draw||(te=te||(this instanceof p.Doc?this:this.parent(p.Parent)),ve=ve||1/0,this.each(function(){return this instanceof p.Defs?this:this instanceof p.Parent?this.ungroup(te,ve-1):this.toParent(te)}),this.node.firstChild||this.remove()),this},flatten:function(te,ve){return this.ungroup(te,ve)}}),p.Container=p.invent({create:function(te){this.constructor.call(this,te)},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(te){p.Element.prototype[te]=function(ve){return p.on(this.node,te,ve),this}}),p.listeners=[],p.handlerMap=[],p.listenerId=0,p.on=function(te,ve,Be,Ue,Fe){var at=Be.bind(Ue||te.instance||te),ut=(p.handlerMap.indexOf(te)+1||p.handlerMap.push(te))-1,yt=ve.split(".")[0],Lt=ve.split(".")[1]||"*";p.listeners[ut]=p.listeners[ut]||{},p.listeners[ut][yt]=p.listeners[ut][yt]||{},p.listeners[ut][yt][Lt]=p.listeners[ut][yt][Lt]||{},Be._svgjsListenerId||(Be._svgjsListenerId=++p.listenerId),p.listeners[ut][yt][Lt][Be._svgjsListenerId]=at,te.addEventListener(yt,at,Fe||{passive:!1})},p.off=function(te,ve,Be){var Ue=p.handlerMap.indexOf(te),Fe=ve&&ve.split(".")[0],at=ve&&ve.split(".")[1],ut="";if(Ue!=-1)if(Be){if(typeof Be=="function"&&(Be=Be._svgjsListenerId),!Be)return;p.listeners[Ue][Fe]&&p.listeners[Ue][Fe][at||"*"]&&(te.removeEventListener(Fe,p.listeners[Ue][Fe][at||"*"][Be],!1),delete p.listeners[Ue][Fe][at||"*"][Be])}else if(at&&Fe){if(p.listeners[Ue][Fe]&&p.listeners[Ue][Fe][at]){for(var yt in p.listeners[Ue][Fe][at])p.off(te,[Fe,at].join("."),yt);delete p.listeners[Ue][Fe][at]}}else if(at)for(var Lt in p.listeners[Ue])for(var ut in p.listeners[Ue][Lt])at===ut&&p.off(te,[Lt,at].join("."));else if(Fe){if(p.listeners[Ue][Fe]){for(var ut in p.listeners[Ue][Fe])p.off(te,[Fe,ut].join("."));delete p.listeners[Ue][Fe]}}else{for(var Lt in p.listeners[Ue])p.off(te,Lt);delete p.listeners[Ue],delete p.handlerMap[Ue]}},p.extend(p.Element,{on:function(te,ve,Be,Ue){return p.on(this.node,te,ve,Be,Ue),this},off:function(te,ve){return p.off(this.node,te,ve),this},fire:function(te,ve){return te instanceof ke.Event?this.node.dispatchEvent(te):this.node.dispatchEvent(te=new p.CustomEvent(te,{detail:ve,cancelable:!0})),this._event=te,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(te){return te==null?this.transform("x"):this.transform({x:te-this.x()},!0)}},construct:{group:function(){return this.put(new p.G)}}}),p.Doc=p.invent({create:function(te){te&&((te=typeof te=="string"?m.getElementById(te):te).nodeName=="svg"?this.constructor.call(this,te):(this.constructor.call(this,p.create("svg")),te.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 te;return this._defs||((te=this.node.getElementsByTagName("defs")[0])?this._defs=p.adopt(te):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(te){this.writeDataToDom();var ve=this.node,Be=Me(ve.cloneNode(!0));return te?(te.node||te).appendChild(Be.node):ve.parentNode.insertBefore(Be.node,ve.nextSibling),Be}}}),p.extend(p.Element,{}),p.Gradient=p.invent({create:function(te){this.constructor.call(this,p.create(te+"Gradient")),this.type=te},inherit:p.Container,extend:{at:function(te,ve,Be){return this.put(new p.Stop).update(te,ve,Be)},update:function(te){return this.clear(),typeof te=="function"&&te.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()},attr:function(te,ve,Be){return te=="transform"&&(te="gradientTransform"),p.Container.prototype.attr.call(this,te,ve,Be)}},construct:{gradient:function(te,ve){return this.defs().gradient(te,ve)}}}),p.extend(p.Gradient,p.FX,{from:function(te,ve){return(this._target||this).type=="radial"?this.attr({fx:new p.Number(te),fy:new p.Number(ve)}):this.attr({x1:new p.Number(te),y1:new p.Number(ve)})},to:function(te,ve){return(this._target||this).type=="radial"?this.attr({cx:new p.Number(te),cy:new p.Number(ve)}):this.attr({x2:new p.Number(te),y2:new p.Number(ve)})}}),p.extend(p.Defs,{gradient:function(te,ve){return this.put(new p.Gradient(te)).update(ve)}}),p.Stop=p.invent({create:"stop",inherit:p.Element,extend:{update:function(te){return(typeof te=="number"||te instanceof p.Number)&&(te={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),te.opacity!=null&&this.attr("stop-opacity",te.opacity),te.color!=null&&this.attr("stop-color",te.color),te.offset!=null&&this.attr("offset",new p.Number(te.offset)),this}}}),p.Pattern=p.invent({create:"pattern",inherit:p.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(te){return this.clear(),typeof te=="function"&&te.call(this,this),this},toString:function(){return this.fill()},attr:function(te,ve,Be){return te=="transform"&&(te="patternTransform"),p.Container.prototype.attr.call(this,te,ve,Be)}},construct:{pattern:function(te,ve,Be){return this.defs().pattern(te,ve,Be)}}}),p.extend(p.Defs,{pattern:function(te,ve,Be){return this.put(new p.Pattern).update(Be).attr({x:0,y:0,width:te,height:ve,patternUnits:"userSpaceOnUse"})}}),p.Shape=p.invent({create:function(te){this.constructor.call(this,te)},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(te,ve){return this.attr("href",(ve||"")+"#"+te,p.xlink)}},construct:{use:function(te,ve){return this.put(new p.Use).element(te,ve)}}}),p.Rect=p.invent({create:"rect",inherit:p.Shape,construct:{rect:function(te,ve){return this.put(new p.Rect).size(te,ve)}}}),p.Circle=p.invent({create:"circle",inherit:p.Shape,construct:{circle:function(te){return this.put(new p.Circle).rx(new p.Number(te).divide(2)).move(0,0)}}}),p.extend(p.Circle,p.FX,{rx:function(te){return this.attr("r",te)},ry:function(te){return this.rx(te)}}),p.Ellipse=p.invent({create:"ellipse",inherit:p.Shape,construct:{ellipse:function(te,ve){return this.put(new p.Ellipse).size(te,ve).move(0,0)}}}),p.extend(p.Ellipse,p.Rect,p.FX,{rx:function(te){return this.attr("rx",te)},ry:function(te){return this.attr("ry",te)}}),p.extend(p.Circle,p.Ellipse,{x:function(te){return te==null?this.cx()-this.rx():this.cx(te+this.rx())},y:function(te){return te==null?this.cy()-this.ry():this.cy(te+this.ry())},cx:function(te){return te==null?this.attr("cx"):this.attr("cx",te)},cy:function(te){return te==null?this.attr("cy"):this.attr("cy",te)},width:function(te){return te==null?2*this.rx():this.rx(new p.Number(te).divide(2))},height:function(te){return te==null?2*this.ry():this.ry(new p.Number(te).divide(2))},size:function(te,ve){var Be=fe(this,te,ve);return this.rx(new p.Number(Be.width).divide(2)).ry(new p.Number(Be.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(te,ve,Be,Ue){return te==null?this.array():(te=ve!==void 0?{x1:te,y1:ve,x2:Be,y2:Ue}:new p.PointArray(te).toLine(),this.attr(te))},move:function(te,ve){return this.attr(this.array().move(te,ve).toLine())},size:function(te,ve){var Be=fe(this,te,ve);return this.attr(this.array().size(Be.width,Be.height).toLine())}},construct:{line:function(te,ve,Be,Ue){return p.Line.prototype.plot.apply(this.put(new p.Line),te!=null?[te,ve,Be,Ue]:[0,0,0,0])}}}),p.Polyline=p.invent({create:"polyline",inherit:p.Shape,construct:{polyline:function(te){return this.put(new p.Polyline).plot(te||new p.PointArray)}}}),p.Polygon=p.invent({create:"polygon",inherit:p.Shape,construct:{polygon:function(te){return this.put(new p.Polygon).plot(te||new p.PointArray)}}}),p.extend(p.Polyline,p.Polygon,{array:function(){return this._array||(this._array=new p.PointArray(this.attr("points")))},plot:function(te){return te==null?this.array():this.clear().attr("points",typeof te=="string"?te:this._array=new p.PointArray(te))},clear:function(){return delete this._array,this},move:function(te,ve){return this.attr("points",this.array().move(te,ve))},size:function(te,ve){var Be=fe(this,te,ve);return this.attr("points",this.array().size(Be.width,Be.height))}}),p.extend(p.Line,p.Polyline,p.Polygon,{morphArray:p.PointArray,x:function(te){return te==null?this.bbox().x:this.move(te,this.bbox().y)},y:function(te){return te==null?this.bbox().y:this.move(this.bbox().x,te)},width:function(te){var ve=this.bbox();return te==null?ve.width:this.size(te,ve.height)},height:function(te){var ve=this.bbox();return te==null?ve.height:this.size(ve.width,te)}}),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(te){return te==null?this.array():this.clear().attr("d",typeof te=="string"?te:this._array=new p.PathArray(te))},clear:function(){return delete this._array,this}},construct:{path:function(te){return this.put(new p.Path).plot(te||new p.PathArray)}}}),p.Image=p.invent({create:"image",inherit:p.Shape,extend:{load:function(te){if(!te)return this;var ve=this,Be=new ke.Image;return p.on(Be,"load",function(){p.off(Be);var Ue=ve.parent(p.Pattern);Ue!==null&&(ve.width()==0&&ve.height()==0&&ve.size(Be.width,Be.height),Ue&&Ue.width()==0&&Ue.height()==0&&Ue.size(ve.width(),ve.height()),typeof ve._loaded=="function"&&ve._loaded.call(ve,{width:Be.width,height:Be.height,ratio:Be.width/Be.height,url:te}))}),p.on(Be,"error",function(Ue){p.off(Be),typeof ve._error=="function"&&ve._error.call(ve,Ue)}),this.attr("href",Be.src=this.src=te,p.xlink)},loaded:function(te){return this._loaded=te,this},error:function(te){return this._error=te,this}},construct:{image:function(te,ve,Be){return this.put(new p.Image).load(te).size(ve||0,Be||ve||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(te){return te==null?this.attr("x"):this.attr("x",te)},text:function(te){if(te===void 0){te="";for(var ve=this.node.childNodes,Be=0,Ue=ve.length;Be<Ue;++Be)Be!=0&&ve[Be].nodeType!=3&&p.adopt(ve[Be]).dom.newLined==1&&(te+=`
`),te+=ve[Be].textContent;return te}if(this.clear().build(!0),typeof te=="function")te.call(this,this);else{Be=0;for(var Fe=(te=te.split(`
`)).length;Be<Fe;Be++)this.tspan(te[Be]).newLine()}return this.build(!1).rebuild()},size:function(te){return this.attr("font-size",te).rebuild()},leading:function(te){return te==null?this.dom.leading:(this.dom.leading=new p.Number(te),this.rebuild())},lines:function(){var te=(this.textPath&&this.textPath()||this).node,ve=p.utils.map(p.utils.filterSVGElements(te.childNodes),function(Be){return p.adopt(Be)});return new p.Set(ve)},rebuild:function(te){if(typeof te=="boolean"&&(this._rebuild=te),this._rebuild){var ve=this,Be=0,Ue=this.dom.leading*new p.Number(this.attr("font-size"));this.lines().each(function(){this.dom.newLined&&(ve.textPath()||this.attr("x",ve.attr("x")),this.text()==`
`?Be+=Ue:(this.attr("dy",Ue+Be),Be=0))}),this.fire("rebuild")}return this},build:function(te){return this._build=!!te,this},setData:function(te){return this.dom=te,this.dom.leading=new p.Number(te.leading||1.3),this}},construct:{text:function(te){return this.put(new p.Text).text(te)},plain:function(te){return this.put(new p.Text).plain(te)}}}),p.Tspan=p.invent({create:"tspan",inherit:p.Shape,extend:{text:function(te){return te==null?this.node.textContent+(this.dom.newLined?`
`:""):(typeof te=="function"?te.call(this,this):this.plain(te),this)},dx:function(te){return this.attr("dx",te)},dy:function(te){return this.attr("dy",te)},newLine:function(){var te=this.parent(p.Text);return this.dom.newLined=!0,this.dy(te.dom.leading*te.attr("font-size")).attr("x",te.x())}}}),p.extend(p.Text,p.Tspan,{plain:function(te){return this._build===!1&&this.clear(),this.node.appendChild(m.createTextNode(te)),this},tspan:function(te){var ve=(this.textPath&&this.textPath()||this).node,Be=new p.Tspan;return this._build===!1&&this.clear(),ve.appendChild(Be.node),Be.text(te)},clear:function(){for(var te=(this.textPath&&this.textPath()||this).node;te.hasChildNodes();)te.removeChild(te.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 te=this.track();return te?te.array():null},plot:function(te){var ve=this.track(),Be=null;return ve&&(Be=ve.plot(te)),te==null?Be:this},track:function(){var te=this.textPath();if(te)return te.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(te,ve){return ve=="color"?te:te+"-"+ve}};function V(te,ve,Be,Ue){return Be+Ue.replace(p.regex.dots," .")}function X(te){return te.toLowerCase().replace(/-(.)/g,function(ve,Be){return Be.toUpperCase()})}function le(te){return te.charAt(0).toUpperCase()+te.slice(1)}function ce(te){var ve=te.toString(16);return ve.length==1?"0"+ve:ve}function fe(te,ve,Be){if(ve==null||Be==null){var Ue=te.bbox();ve==null?ve=Ue.width/Ue.height*Be:Be==null&&(Be=Ue.height/Ue.width*ve)}return{width:ve,height:Be}}function ye(te,ve,Be){return{x:ve*te.a+Be*te.c+0,y:ve*te.b+Be*te.d+0}}function Pe(te){return{a:te[0],b:te[1],c:te[2],d:te[3],e:te[4],f:te[5]}}function Me(te){for(var ve=te.childNodes.length-1;ve>=0;ve--)te.childNodes[ve]instanceof ke.SVGElement&&Me(te.childNodes[ve]);return p.adopt(te).id(p.eid(te.nodeName))}function Ke(te){return Math.abs(te)>1e-37?te:0}["fill","stroke"].forEach(function(te){var ve={};ve[te]=function(Be){if(Be===void 0)return this;if(typeof Be=="string"||p.Color.isRgb(Be)||Be&&typeof Be.fill=="function")this.attr(te,Be);else for(var Ue=D[te].length-1;Ue>=0;Ue--)Be[D[te][Ue]]!=null&&this.attr(D.prefix(te,D[te][Ue]),Be[D[te][Ue]]);return this},p.extend(p.Element,p.FX,ve)}),p.extend(p.Element,p.FX,{translate:function(te,ve){return this.transform({x:te,y:ve})},matrix:function(te){return this.attr("transform",new p.Matrix(arguments.length==6?[].slice.call(arguments):te))},opacity:function(te){return this.attr("opacity",te)},dx:function(te){return this.x(new p.Number(te).plus(this instanceof p.FX?0:this.x()),!0)},dy:function(te){return this.y(new p.Number(te).plus(this instanceof p.FX?0:this.y()),!0)}}),p.extend(p.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(te){return this.node.getPointAtLength(te)}}),p.Set=p.invent({create:function(te){Array.isArray(te)?this.members=te:this.clear()},extend:{add:function(){for(var te=[].slice.call(arguments),ve=0,Be=te.length;ve<Be;ve++)this.members.push(te[ve]);return this},remove:function(te){var ve=this.index(te);return ve>-1&&this.members.splice(ve,1),this},each:function(te){for(var ve=0,Be=this.members.length;ve<Be;ve++)te.apply(this.members[ve],[ve,this.members]);return this},clear:function(){return this.members=[],this},length:function(){return this.members.length},has:function(te){return this.index(te)>=0},index:function(te){return this.members.indexOf(te)},get:function(te){return this.members[te]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members}},construct:{set:function(te){return new p.Set(te)}}}),p.FX.Set=p.invent({create:function(te){this.set=te}}),p.Set.inherit=function(){var te=[];for(var ve in p.Shape.prototype)typeof p.Shape.prototype[ve]=="function"&&typeof p.Set.prototype[ve]!="function"&&te.push(ve);for(var ve in te.forEach(function(Ue){p.Set.prototype[Ue]=function(){for(var Fe=0,at=this.members.length;Fe<at;Fe++)this.members[Fe]&&typeof this.members[Fe][Ue]=="function"&&this.members[Fe][Ue].apply(this.members[Fe],arguments);return Ue=="animate"?this.fx||(this.fx=new p.FX.Set(this)):this}}),te=[],p.FX.prototype)typeof p.FX.prototype[ve]=="function"&&typeof p.FX.Set.prototype[ve]!="function"&&te.push(ve);te.forEach(function(Be){p.FX.Set.prototype[Be]=function(){for(var Ue=0,Fe=this.set.members.length;Ue<Fe;Ue++)this.set.members[Ue].fx[Be].apply(this.set.members[Ue].fx,arguments);return this}})},p.extend(p.Element,{}),p.extend(p.Element,{remember:function(te,ve){if(P(arguments[0])==="object")for(var Be in te)this.remember(Be,te[Be]);else{if(arguments.length==1)return this.memory()[te];this.memory()[te]=ve}return this},forget:function(){if(arguments.length==0)this._memory={};else for(var te=arguments.length-1;te>=0;te--)delete this.memory()[arguments[te]];return this},memory:function(){return this._memory||(this._memory={})}}),p.get=function(te){var ve=m.getElementById(function(Be){var Ue=(Be||"").toString().match(p.regex.reference);if(Ue)return Ue[1]}(te)||te);return p.adopt(ve)},p.select=function(te,ve){return new p.Set(p.utils.map((ve||m).querySelectorAll(te),function(Be){return p.adopt(Be)}))},p.extend(p.Parent,{select:function(te){return p.select(te,this.node)}});var we="abcdef".split("");if(typeof ke.CustomEvent!="function"){var Te=function(te,ve){ve=ve||{bubbles:!1,cancelable:!1,detail:void 0};var Be=m.createEvent("CustomEvent");return Be.initCustomEvent(te,ve.bubbles,ve.cancelable,ve.detail),Be};Te.prototype=ke.Event.prototype,p.CustomEvent=Te}else p.CustomEvent=ke.CustomEvent;return p},P(e)==="object"?t.exports=kt.document?gt(kt,kt.document):function(ke){return gt(ke,ke.document)}:kt.SVG=gt(kt,kt.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(T,D){return this.add(T,D),!T.attr("in")&&this.autoSetIn&&T.attr("in",this.source),T.attr("result")||T.attr("result",T),T},blend:function(T,D,V){return this.put(new SVG.BlendEffect(T,D,V))},colorMatrix:function(T,D){return this.put(new SVG.ColorMatrixEffect(T,D))},convolveMatrix:function(T){return this.put(new SVG.ConvolveMatrixEffect(T))},componentTransfer:function(T){return this.put(new SVG.ComponentTransferEffect(T))},composite:function(T,D,V){return this.put(new SVG.CompositeEffect(T,D,V))},flood:function(T,D){return this.put(new SVG.FloodEffect(T,D))},offset:function(T,D){return this.put(new SVG.OffsetEffect(T,D))},image:function(T){return this.put(new SVG.ImageEffect(T))},merge:function(){var T=[void 0];for(var D in arguments)T.push(arguments[D]);return this.put(new(SVG.MergeEffect.bind.apply(SVG.MergeEffect,T)))},gaussianBlur:function(T,D){return this.put(new SVG.GaussianBlurEffect(T,D))},morphology:function(T,D){return this.put(new SVG.MorphologyEffect(T,D))},diffuseLighting:function(T,D,V){return this.put(new SVG.DiffuseLightingEffect(T,D,V))},displacementMap:function(T,D,V,X,le){return this.put(new SVG.DisplacementMapEffect(T,D,V,X,le))},specularLighting:function(T,D,V,X){return this.put(new SVG.SpecularLightingEffect(T,D,V,X))},tile:function(){return this.put(new SVG.TileEffect)},turbulence:function(T,D,V,X,le){return this.put(new SVG.TurbulenceEffect(T,D,V,X,le))},toString:function(){return"url(#"+this.attr("id")+")"}}}),SVG.extend(SVG.Defs,{filter:function(T){var D=this.put(new SVG.Filter);return typeof T=="function"&&T.call(D,D),D}}),SVG.extend(SVG.Container,{filter:function(T){return this.defs().filter(T)}}),SVG.extend(SVG.Element,SVG.G,SVG.Nested,{filter:function(T){return this.filterer=T instanceof SVG.Element?T:this.doc().filter(T),this.doc()&&this.filterer.doc()!==this.doc()&&this.doc().defs().add(this.filterer),this.attr("filter",this.filterer),this.filterer},unfilter:function(T){return this.filterer&&T===!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(T){return T==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",T)},result:function(T){return T==null?this.attr("result"):this.attr("result",T)},toString:function(){return this.result()}}}),SVG.ParentEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Parent,extend:{in:function(T){return T==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",T)},result:function(T){return T==null?this.attr("result"):this.attr("result",T)},toString:function(){return this.result()}}});var ke={blend:function(T,D){return this.parent()&&this.parent().blend(this,T,D)},colorMatrix:function(T,D){return this.parent()&&this.parent().colorMatrix(T,D).in(this)},convolveMatrix:function(T){return this.parent()&&this.parent().convolveMatrix(T).in(this)},componentTransfer:function(T){return this.parent()&&this.parent().componentTransfer(T).in(this)},composite:function(T,D){return this.parent()&&this.parent().composite(this,T,D)},flood:function(T,D){return this.parent()&&this.parent().flood(T,D)},offset:function(T,D){return this.parent()&&this.parent().offset(T,D).in(this)},image:function(T){return this.parent()&&this.parent().image(T)},merge:function(){return this.parent()&&this.parent().merge.apply(this.parent(),[this].concat(arguments))},gaussianBlur:function(T,D){return this.parent()&&this.parent().gaussianBlur(T,D).in(this)},morphology:function(T,D){return this.parent()&&this.parent().morphology(T,D).in(this)},diffuseLighting:function(T,D,V){return this.parent()&&this.parent().diffuseLighting(T,D,V).in(this)},displacementMap:function(T,D,V,X){return this.parent()&&this.parent().displacementMap(this,T,D,V,X)},specularLighting:function(T,D,V,X){return this.parent()&&this.parent().specularLighting(T,D,V,X).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(T,D,V,X,le){return this.parent()&&this.parent().turbulence(T,D,V,X,le).in(this)}};SVG.extend(SVG.Effect,ke),SVG.extend(SVG.ParentEffect,ke),SVG.ChildEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(T){this.attr("in",T)}}});var m={blend:function(T,D,V){this.attr({in:T,in2:D,mode:V||"normal"})},colorMatrix:function(T,D){T=="matrix"&&(D=A(D)),this.attr({type:T,values:D===void 0?null:D})},convolveMatrix:function(T){T=A(T),this.attr({order:Math.sqrt(T.split(" ").length),kernelMatrix:T})},composite:function(T,D,V){this.attr({in:T,in2:D,operator:V})},flood:function(T,D){this.attr("flood-color",T),D!=null&&this.attr("flood-opacity",D)},offset:function(T,D){this.attr({dx:T,dy:D})},image:function(T){this.attr("href",T,SVG.xlink)},displacementMap:function(T,D,V,X,le){this.attr({in:T,in2:D,scale:V,xChannelSelector:X,yChannelSelector:le})},gaussianBlur:function(T,D){T!=null||D!=null?this.attr("stdDeviation",function(V){if(!Array.isArray(V))return V;for(var X=0,le=V.length,ce=[];X<le;X++)ce.push(V[X]);return ce.join(" ")}(Array.prototype.slice.call(arguments))):this.attr("stdDeviation","0 0")},morphology:function(T,D){this.attr({operator:T,radius:D})},tile:function(){},turbulence:function(T,D,V,X,le){this.attr({numOctaves:D,seed:V,stitchTiles:X,baseFrequency:T,type:le})}},p={merge:function(){var T;if(arguments[0]instanceof SVG.Set){var D=this;arguments[0].each(function(X){this instanceof SVG.MergeNode?D.put(this):(this instanceof SVG.Effect||this instanceof SVG.ParentEffect)&&D.put(new SVG.MergeNode(this))})}else{T=Array.isArray(arguments[0])?arguments[0]:arguments;for(var V=0;V<T.length;V++)T[V]instanceof SVG.MergeNode?this.put(T[V]):this.put(new SVG.MergeNode(T[V]))}},componentTransfer:function(T){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)),T)for(var D in T.rgb&&(["r","g","b"].forEach((function(V){this[V].attr(T.rgb)}).bind(this)),delete T.rgb),T)this[D].attr(T[D])},diffuseLighting:function(T,D,V){this.attr({surfaceScale:T,diffuseConstant:D,kernelUnitLength:V})},specularLighting:function(T,D,V,X){this.attr({surfaceScale:T,diffuseConstant:D,specularExponent:V,kernelUnitLength:X})}},S={distantLight:function(T,D){this.attr({azimuth:T,elevation:D})},pointLight:function(T,D,V){this.attr({x:T,y:D,z:V})},spotLight:function(T,D,V,X,le,ce){this.attr({x:T,y:D,z:V,pointsAtX:X,pointsAtY:le,pointsAtZ:ce})},mergeNode:function(T){this.attr("in",T)}};function A(T){return Array.isArray(T)&&(T=new SVG.Array(T)),T.toString().replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ")}function k(){var T=function(){};for(var D in typeof arguments[arguments.length-1]=="function"&&(T=arguments[arguments.length-1],Array.prototype.splice.call(arguments,arguments.length-1,1)),arguments)for(var V in arguments[D])T(arguments[D][V],V,arguments[D])}["r","g","b","a"].forEach(function(T){S["Func"+T.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(T,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)),T.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.Effect,extend:{}})}),k(p,function(T,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)),T.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.ParentEffect,extend:{}})}),k(S,function(T,D){var V=D.charAt(0).toUpperCase()+D.slice(1);SVG[V]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+V)),T.apply(this,arguments)},inherit:SVG.ChildEffect,extend:{}})}),SVG.extend(SVG.MergeEffect,{in:function(T){return T instanceof SVG.MergeNode?this.add(T,0):this.add(new SVG.MergeNode(T),0),this}}),SVG.extend(SVG.CompositeEffect,SVG.BlendEffect,SVG.DisplacementMapEffect,{in2:function(T){return T==null?this.parent()&&this.parent().select('[result="'+this.attr("in2")+'"]').get(0)||this.attr("in2"):this.attr("in2",T)}}),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 ke(k,T,D,V,X,le,ce){for(var fe=k.slice(T,D||ce),ye=V.slice(X,le||ce),Pe=0,Me={pos:[0,0],start:[0,0]},Ke={pos:[0,0],start:[0,0]};fe[Pe]=m.call(Me,fe[Pe]),ye[Pe]=m.call(Ke,ye[Pe]),fe[Pe][0]!=ye[Pe][0]||fe[Pe][0]=="M"||fe[Pe][0]=="A"&&(fe[Pe][4]!=ye[Pe][4]||fe[Pe][5]!=ye[Pe][5])?(Array.prototype.splice.apply(fe,[Pe,1].concat(S.call(Me,fe[Pe]))),Array.prototype.splice.apply(ye,[Pe,1].concat(S.call(Ke,ye[Pe])))):(fe[Pe]=p.call(Me,fe[Pe]),ye[Pe]=p.call(Ke,ye[Pe])),!(++Pe==fe.length&&Pe==ye.length);)Pe==fe.length&&fe.push(["C",Me.pos[0],Me.pos[1],Me.pos[0],Me.pos[1],Me.pos[0],Me.pos[1]]),Pe==ye.length&&ye.push(["C",Ke.pos[0],Ke.pos[1],Ke.pos[0],Ke.pos[1],Ke.pos[0],Ke.pos[1]]);return{start:fe,dest:ye}}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 T=k.length;return this.pos=[k[T-2],k[T-1]],"SCQT".indexOf(k[0])!=-1&&(this.reflection=[2*this.pos[0]-k[T-4],2*this.pos[1]-k[T-3]]),k}function S(k){var T=[k];switch(k[0]){case"M":return this.pos=this.start=[k[1],k[2]],T;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":T=function(D,V){var X,le,ce,fe,ye,Pe,Me,Ke,we,Te,te,ve,Be,Ue,Fe,at,ut,yt,Lt,Gt,an,et,Pt,qt,ft,tt,Bt=Math.abs(V[1]),gn=Math.abs(V[2]),tr=V[3]%360,Dn=V[4],er=V[5],Sr=V[6],dr=V[7],kr=new SVG.Point(D),qn=new SVG.Point(Sr,dr),Tn=[];if(Bt===0||gn===0||kr.x===qn.x&&kr.y===qn.y)return[["C",kr.x,kr.y,qn.x,qn.y,qn.x,qn.y]];for(X=new SVG.Point((kr.x-qn.x)/2,(kr.y-qn.y)/2).transform(new SVG.Matrix().rotate(tr)),(le=X.x*X.x/(Bt*Bt)+X.y*X.y/(gn*gn))>1&&(Bt*=le=Math.sqrt(le),gn*=le),ce=new SVG.Matrix().rotate(tr).scale(1/Bt,1/gn).rotate(-tr),kr=kr.transform(ce),qn=qn.transform(ce),fe=[qn.x-kr.x,qn.y-kr.y],Pe=fe[0]*fe[0]+fe[1]*fe[1],ye=Math.sqrt(Pe),fe[0]/=ye,fe[1]/=ye,Me=Pe<4?Math.sqrt(1-Pe/4):0,Dn===er&&(Me*=-1),Ke=new SVG.Point((qn.x+kr.x)/2+Me*-fe[1],(qn.y+kr.y)/2+Me*fe[0]),we=new SVG.Point(kr.x-Ke.x,kr.y-Ke.y),Te=new SVG.Point(qn.x-Ke.x,qn.y-Ke.y),te=Math.acos(we.x/Math.sqrt(we.x*we.x+we.y*we.y)),we.y<0&&(te*=-1),ve=Math.acos(Te.x/Math.sqrt(Te.x*Te.x+Te.y*Te.y)),Te.y<0&&(ve*=-1),er&&te>ve&&(ve+=2*Math.PI),!er&&te<ve&&(ve-=2*Math.PI),Ue=Math.ceil(2*Math.abs(te-ve)/Math.PI),at=[],ut=te,Be=(ve-te)/Ue,Fe=4*Math.tan(Be/4)/3,an=0;an<=Ue;an++)Lt=Math.cos(ut),yt=Math.sin(ut),Gt=new SVG.Point(Ke.x+Lt,Ke.y+yt),at[an]=[new SVG.Point(Gt.x+Fe*yt,Gt.y-Fe*Lt),Gt,new SVG.Point(Gt.x-Fe*yt,Gt.y+Fe*Lt)],ut+=Be;for(at[0][0]=at[0][1].clone(),at[at.length-1][2]=at[at.length-1][1].clone(),ce=new SVG.Matrix().rotate(tr).scale(Bt,gn).rotate(-tr),an=0,et=at.length;an<et;an++)at[an][0]=at[an][0].transform(ce),at[an][1]=at[an][1].transform(ce),at[an][2]=at[an][2].transform(ce);for(an=1,et=at.length;an<et;an++)Pt=(Gt=at[an-1][2]).x,qt=Gt.y,ft=(Gt=at[an][0]).x,tt=Gt.y,Sr=(Gt=at[an][1]).x,dr=Gt.y,Tn.push(["C",Pt,qt,ft,tt,Sr,dr]);return Tn}(this.pos,k),k=T[0]}return k[0]="C",this.pos=[k[5],k[6]],this.reflection=[2*k[5]-k[3],2*k[6]-k[4]],T}function A(k,T){if(T===!1)return!1;for(var D=T,V=k.length;D<V;++D)if(k[D][0]=="M")return D;return!1}SVG.extend(SVG.PathArray,{morph:function(k){for(var T=this.value,D=this.parse(k),V=0,X=0,le=!1,ce=!1;V!==!1||X!==!1;){var fe;le=A(T,V!==!1&&V+1),ce=A(D,X!==!1&&X+1),V===!1&&(V=(fe=new SVG.PathArray(ye.start).bbox()).height==0||fe.width==0?T.push(T[0])-1:T.push(["M",fe.x+fe.width/2,fe.y+fe.height/2])-1),X===!1&&(X=(fe=new SVG.PathArray(ye.dest).bbox()).height==0||fe.width==0?D.push(D[0])-1:D.push(["M",fe.x+fe.width/2,fe.y+fe.height/2])-1);var ye=ke(T,V,le,D,X,ce);T=T.slice(0,V).concat(ye.start,le===!1?[]:T.slice(le)),D=D.slice(0,X).concat(ye.dest,ce===!1?[]:D.slice(ce)),V=le!==!1&&V+ye.start.length,X=ce!==!1&&X+ye.dest.length}return this.value=T,this.destination=new SVG.PathArray,this.destination.value=D,this}})}(),(function(){function ke(m){m.remember("_draggable",this),this.el=m}ke.prototype.init=function(m,p){var S=this;this.constraint=m,this.value=p,this.el.on("mousedown.drag",function(A){S.start(A)}),this.el.on("touchstart.drag",function(A){S.start(A)})},ke.prototype.transformPoint=function(m,p){var S=(m=m||window.event).changedTouches&&m.changedTouches[0]||m;return this.p.x=S.clientX-(p||0),this.p.y=S.clientY,this.p.matrixTransform(this.m)},ke.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},ke.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 S,A=this.getBBox();if(this.el instanceof SVG.Text)switch(S=this.el.node.getComputedTextLength(),this.el.attr("text-anchor")){case"middle":S/=2;break;case"start":S=0}this.startPoints={point:this.transformPoint(m,S),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})}}},ke.prototype.drag=function(m){var p=this.getBBox(),S=this.transformPoint(m),A=this.startPoints.box.x+S.x-this.startPoints.point.x,k=this.startPoints.box.y+S.y-this.startPoints.point.y,T=this.constraint,D=S.x-this.startPoints.point.x,V=S.y-this.startPoints.point.y;if(this.el.fire("dragmove",{event:m,p:S,m:this.m,handler:this}),this.el.event().defaultPrevented)return S;if(typeof T=="function"){var X=T.call(this.el,A,k,this.m);typeof X=="boolean"&&(X={x:X,y:X}),X.x===!0?this.el.x(A):X.x!==!1&&this.el.x(X.x),X.y===!0?this.el.y(k):X.y!==!1&&this.el.y(X.y)}else typeof T=="object"&&(T.minX!=null&&A<T.minX?D=(A=T.minX)-this.startPoints.box.x:T.maxX!=null&&A>T.maxX-p.width&&(D=(A=T.maxX-p.width)-this.startPoints.box.x),T.minY!=null&&k<T.minY?V=(k=T.minY)-this.startPoints.box.y:T.maxY!=null&&k>T.maxY-p.height&&(V=(k=T.maxY-p.height)-this.startPoints.box.y),T.snapToGrid!=null&&(A-=A%T.snapToGrid,k-=k%T.snapToGrid,D-=D%T.snapToGrid,V-=V%T.snapToGrid),this.el instanceof SVG.G?this.el.matrix(this.startPoints.transform).transform({x:D,y:V},!0):this.el.move(A,k));return S},ke.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 S=this.remember("_draggable")||new ke(this);return(m=m===void 0||m)?S.init(p||{},m):(this.off("mousedown.drag"),this.off("touchstart.drag")),this}})}).call(void 0),function(){function ke(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,S,A){var k=typeof p!="string"?p:S[p];return A?k/2:k},this.pointCoords=function(p,S){var A=this.pointsList[p];return{x:this.pointCoord(A[0],S,p==="t"||p==="b"),y:this.pointCoord(A[1],S,p==="r"||p==="l")}}}ke.prototype.init=function(m,p){var S=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 T=["points","pointsExclude"];for(var k in T){var D=this.options[T[k]];typeof D=="string"?D=D.length>0?D.split(/\s*,\s*/i):[]:typeof D=="boolean"&&T[k]==="points"&&(D=D?A:[]),this.options[T[k]]=D}this.options.points=[A,this.options.points].reduce(function(V,X){return V.filter(function(le){return X.indexOf(le)>-1})}),this.options.points=[this.options.points,this.options.pointsExclude].reduce(function(V,X){return V.filter(function(le){return X.indexOf(le)<0})}),this.parent=this.el.parent(),this.nested=this.nested||this.parent.group(),this.nested.matrix(new SVG.Matrix(this.el).translate(S.x,S.y)),this.options.deepSelect&&["line","polyline","polygon"].indexOf(this.el.type)!==-1?this.selectPoints(m):this.selectRect(m),this.observe(),this.cleanup()},ke.prototype.selectPoints=function(m){return this.pointSelection.isSelected=m,this.pointSelection.set||(this.pointSelection.set=this.parent.set(),this.drawPoints()),this},ke.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]})},ke.prototype.drawPoints=function(){for(var m=this,p=this.getPointArray(),S=0,A=p.length;S<A;++S){var k=function(D){return function(V){(V=V||window.event).preventDefault?V.preventDefault():V.returnValue=!1,V.stopPropagation();var X=V.pageX||V.touches[0].pageX,le=V.pageY||V.touches[0].pageY;m.el.fire("point",{x:X,y:le,i:D,event:V})}}(S),T=this.drawPoint(p[S][0],p[S][1]).addClass(this.options.classPoints).addClass(this.options.classPoints+"_point").on("touchstart",k).on("mousedown",k);this.pointSelection.set.add(T)}},ke.prototype.drawPoint=function(m,p){var S=this.options.pointType;switch(S){case"circle":return this.drawCircle(m,p);case"rect":return this.drawRect(m,p);default:if(typeof S=="function")return S.call(this,m,p);throw new Error("Unknown "+S+" point type!")}},ke.prototype.drawCircle=function(m,p){return this.nested.circle(this.options.pointSize).center(m,p)},ke.prototype.drawRect=function(m,p){return this.nested.rect(this.options.pointSize,this.options.pointSize).center(m,p)},ke.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])})},ke.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 T=m.pointCoords(A,p);m.rectSelection.set.get(k+1).center(T.x,T.y)}),this.options.rotationPoint){var S=this.rectSelection.set.length();this.rectSelection.set.get(S-1).center(p.width/2,20)}},ke.prototype.selectRect=function(m){var p=this,S=this.el.bbox();function A(D){return function(V){(V=V||window.event).preventDefault?V.preventDefault():V.returnValue=!1,V.stopPropagation();var X=V.pageX||V.touches[0].pageX,le=V.pageY||V.touches[0].pageY;p.el.fire(D,{x:X,y:le,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(S.width,S.height).addClass(this.options.classRect)),this.options.points.length&&this.rectSelection.set.length()<2&&(this.options.points.map(function(D,V){var X=p.pointCoords(D,S),le=p.drawPoint(X.x,X.y).attr("class",p.options.classPoints+"_"+D).on("mousedown",A(D)).on("touchstart",A(D));p.rectSelection.set.add(le)}),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,X=D.pageY||D.touches[0].pageY;p.el.fire("rot",{x:V,y:X,event:D})},T=this.drawPoint(S.width/2,20).attr("class",this.options.classPoints+"_rot").on("touchstart",k).on("mousedown",k);this.rectSelection.set.add(T)}},ke.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()},ke.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()})},ke.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 ke(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 ke(m){m.remember("_resizeHandler",this),this.el=m,this.parameters={},this.lastUpdateCall=null,this.p=m.doc().node.createSVGPoint()}ke.prototype.transformPoint=function(m,p,S){return this.p.x=m-(this.offset.x-window.pageXOffset),this.p.y=p-(this.offset.y-window.pageYOffset),this.p.matrixTransform(S||this.m)},ke.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}},ke.prototype.init=function(m){var p=this;if(this.stop(),m!=="stop"){for(var S in this.options={},this.el.resize.defaults)this.options[S]=this.el.resize.defaults[S],m[S]!==void 0&&(this.options[S]=m[S]);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()}},ke.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},ke.prototype.resize=function(m){var p=this;this.m=this.el.node.getScreenCTM().inverse(),this.offset={x:window.pageXOffset,y:window.pageYOffset};var S=this._extractPosition(m.detail.event);if(this.parameters={type:this.el.type,p:this.transformPoint(S.x,S.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,T){var D=this.snapToGrid(k,T);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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=this.snapToGrid(k,T,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,T){var D=k+this.parameters.p.x,V=T+this.parameters.p.y,X=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),le=Math.atan2(V-this.parameters.box.y-this.parameters.box.height/2,D-this.parameters.box.x-this.parameters.box.width/2),ce=this.parameters.rotation+180*(le-X)/Math.PI+this.options.snapToAngle/2;this.el.center(this.parameters.box.cx,this.parameters.box.cy).rotate(ce-ce%this.options.snapToAngle,this.parameters.box.cx,this.parameters.box.cy)};break;case"point":this.calc=function(k,T){var D=this.snapToGrid(k,T,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()})},ke.prototype.update=function(m){if(m){var p=this._extractPosition(m),S=this.transformPoint(p.x,p.y),A=S.x-this.parameters.p.x,k=S.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])},ke.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")},ke.prototype.snapToGrid=function(m,p,S,A){var k;return A!==void 0?k=[(S+m)%this.options.snapToGrid,(A+p)%this.options.snapToGrid]:(S=S??3,k=[(this.parameters.box.x+m+(1&S?0:this.parameters.box.width))%this.options.snapToGrid,(this.parameters.box.y+p+(2&S?0:this.parameters.box.height))%this.options.snapToGrid]),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,S,A)},ke.prototype.constraintToBox=function(m,p,S,A){var k,T,D=this.options.constraint||{};return A!==void 0?(k=S,T=A):(k=this.parameters.box.x+(1&S?0:this.parameters.box.width),T=this.parameters.box.y+(2&S?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&&T+p<D.minY&&(p=D.minY-T),D.maxY!==void 0&&T+p>D.maxY&&(p=D.maxY-T),[m,p]},ke.prototype.checkAspectRatio=function(m,p){if(!this.options.saveAspectRatio)return m;var S=m.slice(),A=this.parameters.box.width/this.parameters.box.height,k=this.parameters.box.width+m[0],T=this.parameters.box.height-m[1],D=k/T;return D<A?(S[1]=k/A-this.parameters.box.height,p&&(S[1]=-S[1])):D>A&&(S[0]=this.parameters.box.width-T*A,p&&(S[0]=-S[0])),S},SVG.extend(SVG.Element,{resize:function(m){return(this.remember("_resizeHandler")||new ke(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 Nn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{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 Qt(this.ctx),this.ctx.core=new On(this.ctx.el,this.ctx),this.ctx.config=new _e({}),this.ctx.data=new Ye(this.ctx),this.ctx.grid=new rt(this.ctx),this.ctx.graphics=new z(this.ctx),this.ctx.coreUtils=new Q(this.ctx),this.ctx.crosshairs=new St(this.ctx),this.ctx.events=new bt(this.ctx),this.ctx.exports=new Je(this.ctx),this.ctx.fill=new ge(this.ctx),this.ctx.localization=new xt(this.ctx),this.ctx.options=new q,this.ctx.responsive=new on(this.ctx),this.ctx.series=new $e(this.ctx),this.ctx.theme=new cn(this.ctx),this.ctx.formatters=new re(this.ctx),this.ctx.titleSubtitle=new Vn(this.ctx),this.ctx.legend=new hn(this.ctx),this.ctx.toolbar=new nn(this.ctx),this.ctx.tooltip=new Ht(this.ctx),this.ctx.dimensions=new it(this.ctx),this.ctx.updateHelpers=new $t(this.ctx),this.ctx.zoomPanSelection=new Vt(this.ctx),this.ctx.w.globals.tooltip=new Ht(this.ctx)}}]),ke}(),Fn=function(){function ke(m){s(this,ke),this.ctx=m,this.w=m.w}return o(ke,[{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,S=m.isUpdating,A=this.w.globals.dom.Paper.node;A.parentNode&&A.parentNode.parentNode&&!S&&(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 T=this.w.globals.dom;if(this.ctx.el!==null)for(;this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild);this.killSVG(T.Paper),T.Paper.remove(),T.elWrap=null,T.elGraphical=null,T.elLegendWrap=null,T.elLegendForeign=null,T.baseEl=null,T.elGridRect=null,T.elGridRectMask=null,T.elGridRectBarMask=null,T.elGridRectMarkerMask=null,T.elForecastMask=null,T.elNonForecastMask=null,T.elDefs=null}}]),ke}(),Tt=new WeakMap,pn=function(){function ke(m,p){s(this,ke),this.opts=p,this.ctx=this,this.w=new Se(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 Nn(this).initModules(),this.create=F.bind(this.create,this),this.windowResizeHandler=this._windowResizeHandler.bind(this),this.parentResizeHandler=this._parentResizeCallback.bind(this)}return o(ke,[{key:"render",value:function(){var m=this;return new Promise(function(p,S){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(fe,ye){var Pe=!1;if(fe.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){var Me=fe.getBoundingClientRect();fe.style.display!=="none"&&Me.width!==0||(Pe=!0)}var Ke=new ResizeObserver(function(we){Pe&&ye.call(fe,we),Pe=!0});fe.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(fe.children).forEach(function(we){return Ke.observe(we)}):Ke.observe(fe),Tt.set(ye,Ke)}(m.el.parentNode,m.parentResizeHandler);var k=m.el.getRootNode&&m.el.getRootNode(),T=F.is("ShadowRoot",k),D=m.el.ownerDocument,V=T?k.getElementById("apexcharts-css"):D.getElementById("apexcharts-css");if(!V){var X;(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 le=((X=m.opts.chart)===null||X===void 0?void 0:X.nonce)||m.w.config.chart.nonce;le&&V.setAttribute("nonce",le),T?k.prepend(V):D.head.appendChild(V)}var ce=m.create(m.w.config.series,{});if(!ce)return p(m);m.mount(ce).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(ce)}).catch(function(fe){S(fe)})}else S(new Error("Element not found"))})}},{key:"create",value:function(m,p){var S=this,A=this.w;new Nn(this).initModules();var k=this.w.globals;if(k.noData=!1,k.animationEnded=!1,this.responsive.checkResponsiveConfig(p),A.config.xaxis.convertedCatToNumeric&&new he(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 T=m;m.forEach(function(fe,ye){fe.hidden&&(T=S.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:ye}))});var D=Q.checkComboSeries(T,A.config.chart.type);k.comboCharts=D.comboCharts,k.comboBarCount=D.comboBarCount;var V=T.every(function(fe){return fe.data&&fe.data.length===0});(T.length===0||V&&k.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(T),this.theme.init(),new Ce(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 Q(this).getLargestMarkerSize(),this.dimensions.plotCoords();var X=this.core.xySettings();this.grid.createGridMask();var le=this.core.plotChartType(T,X),ce=new Oe(this);return ce.bringForward(),A.config.dataLabels.background.enabled&&ce.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:le,xyRatios:X,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,S=this,A=S.w;return new Promise(function(k,T){if(S.el===null)return T(new Error("Not enough data to display or target element not found"));(p===null||A.globals.allSeriesCollapsed)&&S.series.handleNoData(),S.grid=new rt(S);var D,V,X=S.grid.drawGrid();if(S.annotations=new W(S),S.annotations.drawImageAnnos(),S.annotations.drawTextAnnos(),A.config.grid.position==="back"&&(X&&A.globals.dom.elGraphical.add(X.el),X!=null&&(D=X.elGridBorders)!==null&&D!==void 0&&D.node&&A.globals.dom.elGraphical.add(X.elGridBorders)),Array.isArray(p.elGraph))for(var le=0;le<p.elGraph.length;le++)A.globals.dom.elGraphical.add(p.elGraph[le]);else A.globals.dom.elGraphical.add(p.elGraph);A.config.grid.position==="front"&&(X&&A.globals.dom.elGraphical.add(X.el),X!=null&&(V=X.elGridBorders)!==null&&V!==void 0&&V.node&&A.globals.dom.elGraphical.add(X.elGridBorders)),A.config.xaxis.crosshairs.position==="front"&&S.crosshairs.drawXCrosshairs(),A.config.yaxis[0].crosshairs.position==="front"&&S.crosshairs.drawYCrosshairs(),A.config.chart.type!=="treemap"&&S.axes.drawAxis(A.config.chart.type,X);var ce=new ht(m.ctx,X),fe=new Ve(m.ctx,X);if(X!==null&&(ce.xAxisLabelCorrections(X.xAxisTickWidth),fe.setYAxisTextAlignments(),A.config.yaxis.map(function(Pe,Me){A.globals.ignoreYAxisIndexes.indexOf(Me)===-1&&fe.yAxisTitleRotate(Me,Pe.opposite)})),S.annotations.drawAxesAnnotations(),!A.globals.noData){if(A.config.tooltip.enabled&&!A.globals.noData&&S.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)&&S.zoomPanSelection.init({xyRatios:p.xyRatios});else{var ye=A.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach(function(Pe){ye[Pe]=!1})}A.config.chart.toolbar.show&&!A.globals.allSeriesCollapsed&&S.toolbar.createToolbar()}A.globals.memory.methodsToExec.length>0&&A.globals.memory.methodsToExec.forEach(function(Pe){Pe.method(Pe.params,!1,Pe.context)}),A.globals.axisCharts||A.globals.noData||S.core.resizeNonAxisCharts(),k(S)})}},{key:"destroy",value:function(){var m,p;window.removeEventListener("resize",this.windowResizeHandler),this.el.parentNode,m=this.parentResizeHandler,(p=Tt.get(m))&&(p.disconnect(),Tt.delete(m));var S=this.w.config.chart.id;S&&Apex._chartInstances.forEach(function(A,k){A.id===F.escapeString(S)&&Apex._chartInstances.splice(k,1)}),new Fn(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(m){var p=this,S=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],T=!(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,X){return p.updateHelpers._extendSeries(V,X)})),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,S,A,k,T)}},{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],S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(m,p,S)}},{key:"appendSeries",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=!(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,S)}},{key:"appendData",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=this;S.w.globals.dataChanged=!0,S.series.getPreviousPaths();for(var A=S.w.config.series.slice(),k=0;k<A.length;k++)if(m[k]!==null&&m[k]!==void 0)for(var T=0;T<m[k].data.length;T++)A[k].data.push(m[k].data[T]);return S.w.config.series=A,p&&(S.w.globals.initialSeries=F.clone(S.w.config.series)),this.update()}},{key:"update",value:function(m){var p=this;return new Promise(function(S,A){new Fn(p.ctx).clear({isUpdating:!0});var k=p.create(p.w.config.series,m);if(!k)return S(p);p.mount(k).then(function(){typeof p.w.config.chart.events.updated=="function"&&p.w.config.chart.events.updated(p,p.w),p.events.fireEvent("updated",[p,p.w]),p.w.globals.isDirty=!0,S(p)}).catch(function(T){A(T)})})}},{key:"getSyncedCharts",value:function(){var m=this.getGroupedCharts(),p=[this];return m.length&&(p=[],m.forEach(function(S){p.push(S)})),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],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;S&&(A=S),A.annotations.addXaxisAnnotationExternal(m,p,A)}},{key:"addYaxisAnnotation",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;S&&(A=S),A.annotations.addYaxisAnnotationExternal(m,p,A)}},{key:"addPointAnnotation",value:function(m){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,A=this;S&&(A=S),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,S=this;p&&(S=p),S.annotations.removeAnnotation(S,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 Je(this.ctx).dataURI(m)}},{key:"exportToCSV",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Je(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 S=Apex._chartInstances.filter(function(A){return A.id===p})[0];return S&&S.chart}}},{key:"initOnLoad",value:function(){for(var m=document.querySelectorAll("[data-apexcharts]"),p=0;p<m.length;p++)new ke(m[p],JSON.parse(m[p].getAttribute("data-options"))).render()}},{key:"exec",value:function(m,p){var S=this.getChartByID(m);if(S){S.w.globals.isExecCalled=!0;var A=null;if(S.publicMethods.indexOf(p)!==-1){for(var k=arguments.length,T=new Array(k>2?k-2:0),D=2;D<k;D++)T[D-2]=arguments[D];A=S[p].apply(S,T)}return A}}},{key:"merge",value:function(m,p){return F.extend(m,p)}}]),ke}();t.exports=pn}(EF,EF.exports)),EF.exports}var Q4e;function nln(){if(Q4e)return _F;Q4e=1,Object.defineProperty(_F,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},e=Object.assign||function(C){for(var N=1;N<arguments.length;N++){var I,P=arguments[N];for(I in P)Object.prototype.hasOwnProperty.call(P,I)&&(C[I]=P[I])}return C},n=function(){function C(N,I){for(var P=0;P<I.length;P++){var M=I[P];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(N,M.key,M)}}return function(N,I,P){return I&&C(N.prototype,I),P&&C(N,P),N}}(),r=tln(),s=u(r),a=xx(),o=u(a),l=TU(),c=u(l);function u(C){return C&&C.__esModule?C:{default:C}}function d(C,N,I){return N in C?Object.defineProperty(C,N,{value:I,enumerable:!0,configurable:!0,writable:!0}):C[N]=I,C}function f(C,N){var I,P={};for(I in C)0<=N.indexOf(I)||Object.prototype.hasOwnProperty.call(C,I)&&(P[I]=C[I]);return P}function x(C,N){if(!(C instanceof N))throw new TypeError("Cannot call a class as a function")}function g(C,N){if(C)return!N||typeof N!="object"&&typeof N!="function"?C:N;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function y(C,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);C.prototype=Object.create(N&&N.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(C,N):C.__proto__=N)}window.ApexCharts=s.default;var v=function(){function C(N){x(this,C);var I=g(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,N));return o.default.createRef?I.chartRef=o.default.createRef():I.setRef=function(P){return I.chartRef=P},I.chart=null,I}return y(C,a.Component),n(C,[{key:"render",value:function(){var N=f(this.props,[]);return o.default.createElement("div",e({ref:o.default.createRef?this.chartRef:this.setRef},N))}},{key:"componentDidMount",value:function(){var N=o.default.createRef?this.chartRef.current:this.chartRef;this.chart=new s.default(N,this.getConfig()),this.chart.render()}},{key:"getConfig",value:function(){var F=this.props,N=F.type,I=F.height,P=F.width,M=F.series,F=F.options;return this.extend(F,{chart:{type:N,height:I,width:P},series:M})}},{key:"isObject",value:function(N){return N&&(N===void 0?"undefined":t(N))==="object"&&!Array.isArray(N)&&N!=null}},{key:"extend",value:function(N,I){var P=this,M=(typeof Object.assign!="function"&&(Object.assign=function(F){if(F==null)throw new TypeError("Cannot convert undefined or null to object");for(var $=Object(F),L=1;L<arguments.length;L++){var z=arguments[L];if(z!=null)for(var Q in z)z.hasOwnProperty(Q)&&($[Q]=z[Q])}return $}),Object.assign({},N));return this.isObject(N)&&this.isObject(I)&&Object.keys(I).forEach(function(F){P.isObject(I[F])&&F in N?M[F]=P.extend(N[F],I[F]):Object.assign(M,d({},F,I[F]))}),M}},{key:"componentDidUpdate",value:function(N){if(!this.chart)return null;var M=this.props,L=M.options,I=M.series,P=M.height,M=M.width,F=JSON.stringify(N.options),$=JSON.stringify(N.series),L=JSON.stringify(L),z=JSON.stringify(I);F===L&&$===z&&P===N.height&&M===N.width||($!==z&&F===L&&P===N.height&&M===N.width?this.chart.updateSeries(I):this.chart.updateOptions(this.getConfig()))}},{key:"componentWillUnmount",value:function(){this.chart&&typeof this.chart.destroy=="function"&&this.chart.destroy()}}]),C}();return(_F.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"},_F}var rln=nln();const zD=Ti(rln),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=g2(),u=(c==null?void 0:c.walletAddress)||"",d=n==="day",{setLatestPnL:f}=h.useContext(Yr);h.useEffect(()=>{const y=async()=>{var N,I,P,M,F,$,L,z,Q,se,ee,K,re,de,G,ie,ae,q,W,ne,oe,he,_e;const C=o==="combined"?n:`perp${n.charAt(0).toUpperCase()+n.slice(1)}`;try{const Se=(await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:u},{headers:{Accept:"*/*","Content-Type":"application/json"}})).data,Ce=Date.now()-90*24*60*60*1e3,je=(Ut,hn=!1)=>{const nn=(Ut==null?void 0:Ut.filter(([Vt])=>Number(Vt)>=Ce))||[];if(hn&&nn.length>0){const Vt=parseFloat(nn[0][1]);return nn.map(([pt,We])=>[pt,(parseFloat(We)-Vt).toString()])}return nn},Oe=Se.find(Ut=>Ut[0]==="allTime"),$e=Se.find(Ut=>Ut[0]==="perpAllTime"),Ye={accountValueHistory:je((N=Oe==null?void 0:Oe[1])==null?void 0:N.accountValueHistory,!1),pnlHistory:je((I=Oe==null?void 0:Oe[1])==null?void 0:I.pnlHistory,!0),vlm:(P=Oe==null?void 0:Oe[1])==null?void 0:P.vlm},Je={accountValueHistory:je((M=$e==null?void 0:$e[1])==null?void 0:M.accountValueHistory,!1),pnlHistory:je((F=$e==null?void 0:$e[1])==null?void 0:F.pnlHistory,!0),vlm:($=$e==null?void 0:$e[1])==null?void 0:$.vlm},ht=[...Se,["threeMonth",Ye],["perpThreeMonth",Je]],rt=((z=(L=ht.find(Ut=>Ut[0]===C))==null?void 0:L[1])==null?void 0:z[s])||[];e(rt);const st=o==="combined"?"day":"perpDay",He=o==="combined"?"week":"perpWeek",Ve=o==="combined"?"month":"perpMonth",bt=o==="combined"?"allTime":"perpAllTime",xt=o==="combined"?"threeMonth":"perpThreeMonth",Qt=((se=(Q=ht.find(Ut=>Ut[0]===st))==null?void 0:Q[1])==null?void 0:se.pnlHistory)||[],St=((K=(ee=ht.find(Ut=>Ut[0]===He))==null?void 0:ee[1])==null?void 0:K.pnlHistory)||[],on=((de=(re=ht.find(Ut=>Ut[0]===Ve))==null?void 0:re[1])==null?void 0:de.pnlHistory)||[],cn=((ie=(G=ht.find(Ut=>Ut[0]===bt))==null?void 0:G[1])==null?void 0:ie.pnlHistory)||[],Vn=((q=(ae=ht.find(Ut=>Ut[0]===xt))==null?void 0:ae[1])==null?void 0:q.pnlHistory)||[],tn=((W=Qt[Qt.length-1])==null?void 0:W[1])??0,fn=((ne=St[St.length-1])==null?void 0:ne[1])??0,rn=((oe=on[on.length-1])==null?void 0:oe[1])??0,nt=((he=Vn[Vn.length-1])==null?void 0:he[1])??0,it=((_e=cn[cn.length-1])==null?void 0:_e[1])??0;f({activeRange:n,day:tn,week:fn,month:rn,threeMonth:nt,all:it})}catch(xe){console.error("Error fetching data:",xe)}};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=>`$${Er(y)}.00`,style:{colors:"#909090",fontSize:"14px",fontWeight:500,fontFamily:"Manrope",letterSpacing:"0.72px"}}},xaxis:{type:"datetime",labels:{style:{colors:"#FFFFFF",fontSize:"12px",fontWeight:500,fontFamily:"Manrope",letterSpacing:"0.72px"},formatter:function(y,v){const C=new Date(v);if(d)return C.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});const N=`'${C.getFullYear().toString().slice(-2)}`;return`${C.toLocaleDateString("en-US",{month:"short",day:"2-digit"}).toUpperCase()} ${N}`}}},tooltip:{custom:function({series:y,seriesIndex:v,dataPointIndex:C,w:N}){var $,L;const I=y[v][C],P=(L=($=N.globals.seriesX)==null?void 0:$[v])==null?void 0:L[C],M=N.globals.seriesNames[v];return`
<div class="p-2 rounded-2xl">
<p class="text-[12px] font-medium text-[#909090]">${P?new Date(P).toLocaleDateString("en-GB",{month:"short",day:"2-digit"}).toUpperCase():"-"}</p>
<div class="text-[14px] font-semibold flex items-center">
<span class="inline-block w-[10px] h-[10px] bg-[#67FFBD] rounded-full mr-1"></span>
<span class="text-[#67FFBD] mr-2">${M}</span>
<span>$${Er(I)}</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(zD,{options:x,series:g,type:"area",height:410})]})]})};var rg={},w7={},Z4e;function IVe(){if(Z4e)return w7;Z4e=1,Object.defineProperty(w7,"__esModule",{value:!0}),w7.parseLengthAndUnit=e,w7.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 w7}var C7={},J4e;function PVe(){if(J4e)return C7;J4e=1,Object.defineProperty(C7,"__esModule",{value:!0}),C7.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 C7.createAnimation=t,C7}var eSe;function iln(){if(eSe)return rg;eSe=1;var t=rg.__assign||function(){return t=Object.assign||function(d){for(var f,x=1,g=arguments.length;x<g;x++){f=arguments[x];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(d[y]=f[y])}return d},t.apply(this,arguments)},e=rg.__createBinding||(Object.create?function(d,f,x,g){g===void 0&&(g=x);var y=Object.getOwnPropertyDescriptor(f,x);(!y||("get"in y?!f.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return f[x]}}),Object.defineProperty(d,g,y)}:function(d,f,x,g){g===void 0&&(g=x),d[g]=f[x]}),n=rg.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=rg.__importStar||function(){var d=function(f){return d=Object.getOwnPropertyNames||function(x){var g=[];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(g[g.length]=y);return g},d(f)};return function(f){if(f&&f.__esModule)return f;var x={};if(f!=null)for(var g=d(f),y=0;y<g.length;y++)g[y]!=="default"&&e(x,f,g[y]);return n(x,f),x}}(),s=rg.__rest||function(d,f){var x={};for(var g in d)Object.prototype.hasOwnProperty.call(d,g)&&f.indexOf(g)<0&&(x[g]=d[g]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var y=0,g=Object.getOwnPropertySymbols(d);y<g.length;y++)f.indexOf(g[y])<0&&Object.prototype.propertyIsEnumerable.call(d,g[y])&&(x[g[y]]=d[g[y]]);return x};Object.defineProperty(rg,"__esModule",{value:!0});var a=r(xx()),o=IVe(),l=PVe(),c=(0,l.createAnimation)("ClipLoader","0% {transform: rotate(0deg) scale(1)} 50% {transform: rotate(180deg) scale(0.8)} 100% {transform: rotate(360deg) scale(1)}","clip");function u(d){var f=d.loading,x=f===void 0?!0:f,g=d.color,y=g===void 0?"#000000":g,v=d.speedMultiplier,C=v===void 0?1:v,N=d.cssOverride,I=N===void 0?{}:N,P=d.size,M=P===void 0?35:P,F=s(d,["loading","color","speedMultiplier","cssOverride","size"]),$=t({background:"transparent !important",width:(0,o.cssValue)(M),height:(0,o.cssValue)(M),borderRadius:"100%",border:"2px solid",borderTopColor:y,borderBottomColor:"transparent",borderLeftColor:y,borderRightColor:y,display:"inline-block",animation:"".concat(c," ").concat(.75/C,"s 0s infinite linear"),animationFillMode:"both"},I);return x?a.createElement("span",t({style:$},F)):null}return rg.default=u,rg}var aln=iln();const f2=Ti(aln),Ug=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),c9=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,pde=({className:t="h-5"})=>i.jsx("div",{className:`w-full bg-gray-700/40 rounded animate-pulse ${t}`}),oln=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 lln({trades:t}){const[e,n]=h.useState(!1),r=h.useMemo(()=>t?oln(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(f2,{color:"#fff",size:20})]}),i.jsxs("div",{className:"mb-4 text-xs text-white",children:[o," – ",l]}),!a&&(!r||r.totalTrades===0)?i.jsx(cln,{}):i.jsx(uln,{stats:r,maxCoinPnl:s,loading:a})]})]})}function cln(){return i.jsxs("div",{className:"w-full h-[60vh] flex flex-col items-center justify-center text-white text-sm",children:[i.jsx(PSt,{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 uln({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(S7,{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:["$",Ug(t.totalPnL-t.totalFees)]}),i.jsx(Eb,{label:"Gross:",value:`$${Ug(t.grossPnL+t.totalFees)}`}),i.jsx(Eb,{label:"Fees:",value:`$${Ug(t.totalFees)}`,red:!0})]})}),i.jsx(S7,{title:"Position Split",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx(Eb,{label:"Long PnL",value:`$${Ug(Math.abs(t.longPnL))}`,green:!0}),i.jsx(Eb,{label:"Short PnL",value:`$${Ug(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(S7,{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(Eb,{label:"Winning:",value:t.wins}),i.jsx(Eb,{label:"Total:",value:t.totalTrades})]})}),i.jsx(S7,{title:"Trade Duration",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xl font-semibold text-white",children:c9(t.avgDur)}),i.jsx(Eb,{label:"Range:",value:`${c9(t.minDur)} – ${c9(t.maxDur)}`}),i.jsx(Eb,{label:"Median:",value:c9(t.medianDur)})]})})]}),i.jsx(fln,{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(hln,{stats:t,loading:n,maxCoinPnl:e}),i.jsx(S7,{title:"Liquidations",loading:n,children:t&&t.liquidations.length>0?i.jsx(dln,{data:t.liquidations}):i.jsx("p",{className:"text-white text-lg text-center font-bold",children:"No liquidations"})})]})]})}function S7({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(pde,{className:"h-10"}):n]})}function dln({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:["$",Ug(Math.abs(e.totalPnL))]}),i.jsx("td",{className:"py-1 text-right",children:e.count})]},e.coin))})]})})}function Eb({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 fln({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(pde,{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:["$",Ug(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: ",c9(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 hln({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(pde,{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:["$",Ug(Math.abs(r.pnl))]})]}),i.jsxs("div",{className:"text-[11px] text-white font-semibold",children:["Fees: $",Ug(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 FVe="https://api.hyperliquid.xyz/info",ese=2e3,OVe=365*24*60*60*1e3*2;async function MVe(t,e){const{data:n}=await ps.post(FVe,{type:"userFillsByTime",user:t,startTime:e,aggregateByTime:!0},{headers:{"Content-Type":"application/json"},timeout:1e4});return n}async function mde(t){let e=Date.now()-OVe;const n=[],r=new Set;for(;;){const s=await MVe(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<ese)break;e=Math.max(...s.map(a=>a.time))+1}return n.sort((s,a)=>s.time-a.time)}async function xde(t){const{data:e}=await ps.post(FVe,{type:"userTwapSliceFills",user:t},{headers:{"Content-Type":"application/json"},timeout:1e4});return e}async function pln(t,e){let n=Date.now()-OVe;const r=[],s=new Set;let a=0;for(;;){const c=await MVe(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>=ese,fills:r.slice(0,10),isComplete:!1}),c.length<ese)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 tSe(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 gde(t){const e=[],n={},r=t.slice().sort((s,a)=>s.time-a.time);for(const s of r)try{const a=s.coin,o=s.dir,l=Math.abs(+s.sz),c=+s.px,u=Math.abs(+s.startPosition),d=+s.builderFee||0,f=+s.fee||0,x=+s.closedPnl||0,g=+s.time,y=s.twapId??null,v=o.startsWith("Open"),C=o.startsWith("Close"),N=o.includes(">"),I=!!s.liquidation;if(v){if(tSe(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 P=n[a]??(n[a]={}),M=(P.total_size||0)+l;P.oids=(P.oids||[]).concat(s.oid),P.entry_price_wma=((P.entry_price_wma||0)*(P.total_size||0)+c*l)/M,P.total_size=M,P.last_fill_time=g,P.transaction_count=(P.transaction_count||0)+1,P.total_fee=(P.total_fee||0)+f,P.has_builder_fee=P.has_builder_fee||d!==0,P.builder_fee=(P.builder_fee||0)+d,P.twapId=y}continue}if(N){const P=n[a];P&&(P.close_size+=l,P.total_pnl+=x,P.total_fee+=f,P.last_fill_time=g,P.close_px=c,P.transaction_count++,P.oids.push(s.oid),P.has_builder_fee=P.has_builder_fee||d!==0,P.builder_fee=(P.builder_fee||0)+d,P.twapId=y,P.isClosed=!0,P.close_time=g,P.duration_hours=(g-P.open_time)/36e5,e.push(P),delete n[a]);const M=Math.max(Math.abs(l)-Math.abs(u),0);M>0&&(n[a]={coin:a,open_time:g,last_fill_time:g,position_side:o.includes("Long")?"Long":"Short",total_size:M,close_size:0,entry_price_wma:c,close_px:c,total_fee:f,total_pnl:0,transaction_count:1,isClosed:!1,isLiquidated:!1,oids:[s.oid],has_builder_fee:d!==0,builder_fee:d,twapId:y});continue}if(C||I){const P=n[a];if(!P)continue;P.close_size+=l,P.total_pnl+=x,P.total_fee+=f,P.last_fill_time=g,P.close_px=c,P.transaction_count++,P.oids.push(s.oid),P.has_builder_fee=P.has_builder_fee||d!==0,P.builder_fee=(P.builder_fee||0)+d,P.twapId=y,I&&(P.isLiquidated=!0,P.liquidation_px_sum=(P.liquidation_px_sum||0)+c,P.liquidationCount=(P.liquidationCount||0)+1),tSe(Math.abs(l),Math.abs(u),1e-6)&&(P.isClosed=!0,P.close_time=g,P.duration_hours=(g-P.open_time)/36e5,e.push(P),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 nI({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 V1(o.current,{cacheBust:!0,backgroundColor:null,useCORS:!1,style:{transform:"scale(1)",transformOrigin:"top left"}}),v=document.createElement("a");v.href=y,v.download="dextrabot.png",document.body.appendChild(v),v.click(),document.body.removeChild(v),dn.success("PNG successfully downloaded!")}catch(y){console.error("Error generating PNG:",y),dn.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((N,I)=>{const P=new FileReader;P.onloadend=()=>N(P.result),P.onerror=I,P.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(za))},[n==null?void 0:n.coin]),i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(y=>({...y,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:o,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,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||za,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:y=>Qi(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?"+":"-",fo(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?`$${fo(Math.abs(n==null?void 0:n.pnl).toFixed(2))}`:fo(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?`$${Er(n==null?void 0:n.entryPrice)}`:Er(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?`$${Er(n==null?void 0:n.markPrice)}`:Er(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:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,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"),dn.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 V1(s.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),u=document.createElement("a");u.href=c,u.download="dextrabot.png",document.body.appendChild(u),u.click(),document.body.removeChild(u),dn.success("PNG successfully downloaded!")}catch(c){console.error("Error generating PNG:",c),dn.error("Failed to download PNG.")}};return i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(c=>({...c,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:s,style:{overflow:"visible",position:"relative"},className:"w-[878px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[870px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[522px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[20px] py-[30px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 relative mt-[30px]",children:[i.jsx("div",{className:`${(n==null?void 0:n.type)=="LONG"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 min-w-[80px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope uppercase tracking-wide`,children:n!=null&&n.type?n==null?void 0:n.type:"--"}),i.jsx("div",{className:`${(n==null?void 0:n.type)=="LONG"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide`,children:n!=null&&n.leverage?(n==null?void 0:n.leverage)==null||isNaN(parseFloat(n==null?void 0:n.leverage))?"--":parseFloat(n==null?void 0:n.leverage).toFixed(2)+"x":"--"})]}),i.jsxs("div",{className:`${n!=null&&n.roe&&(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center`,children:[n!=null&&n.roe&&(n==null?void 0:n.roe)>=0?"+":"-",(n==null?void 0:n.roe)==null||isNaN(parseFloat(n==null?void 0:n.roe))?"":Ms(Math.abs(n==null?void 0:n.roe))+"%"]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-[30px] pt-[18px]",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"UNREALIZED PNL"}),i.jsx("div",{className:`${(n==null?void 0:n.entryPrice)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[32px] font-semibold font-manrope leading-none flex min-w-[180px]`,children:n!=null&&n.entryPrice?`$${Er(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:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,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"),dn.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 xln({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 V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),y=document.createElement("a");y.href=g,y.download="dextrabot.png",document.body.appendChild(y),y.click(),document.body.removeChild(y),dn.success("PNG successfully downloaded!")}catch(g){console.error("Error generating PNG:",g),dn.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,N)=>{const I=new FileReader;I.onloadend=()=>C(I.result),I.onerror=N,I.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(za))},[n==null?void 0:n.coin]),i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(!1),setTimeout(()=>{s(g=>({...g,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,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||za,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:g=>Qi(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?"+":"-","$",fo(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?`$${jy(n==null?void 0:n.entryPrice)}`:jy(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?`$${jy(n==null?void 0:n.markPrice)}`:jy(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:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,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"),dn.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 gln=({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,N]=h.useState(null);h.useContext(Yr);const[I,P]=h.useState({key:null,direction:null});h.useEffect(()=>{function de(G){g.current&&!g.current.contains(G.target)&&setIsDropdownOpen(!1),x.current&&!x.current.contains(G.target)&&f(!1)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[]);const M=de=>`${de.time}_${de.coin}_${de.dir}_${de.px}_${de.sz}`;h.useEffect(()=>{if(!e||e.length===0)return;const de=e.map(ie=>ie.wallet_address.toLowerCase());if(de.length===0)return;let G=!0;return(async()=>{try{const ie=(await Promise.all(de.map(q=>ps.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:q})))).flatMap(q=>q.data??[]);if(!G)return;const ae=new Map;ie.forEach(q=>{const W=M(q);ae.has(W)||ae.set(W,q)}),r(Array.from(ae.values()).sort((q,W)=>W.time-q.time))}catch(ie){console.error("Multi-wallet trade fetch error:",ie)}finally{G&&a(!1)}})(),()=>{G=!1}},[e]),h.useEffect(()=>{const de=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");return de.onopen=()=>{de.send(JSON.stringify({method:"subscribe",subscription:{type:"userFills",user:t,aggregateByTime:!0}}))},de.onmessage=G=>{const ie=JSON.parse(G.data);ie&&ie.data&&Array.isArray(ie.data.fills)&&r(ae=>{const q=[...ae];return ie.data.fills.forEach(W=>{const ne=M(W);q.some(oe=>M(oe)===ne)||q.push(W)}),q.sort((W,ne)=>ne.time-W.time)})},()=>de.close()},[]),h.useEffect(()=>{(async()=>{try{const G=await ps.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=de=>{let G="asc";I.key===de&&(I.direction==="asc"?G="desc":I.direction==="desc"&&(G=null)),P({key:de,direction:G})};let $=[...n];c&&($=$.filter(de=>String(de.oid).includes(c)));const L=$.sort((de,G)=>{if(!I.key||!I.direction)return 0;const ie=(W,ne)=>{switch(ne){case"sz":return parseFloat(W.sz);case"closedPnl":return parseFloat(W.closedPnl||0)-parseFloat(W.fee||0);case"fee":return parseFloat(W.fee);case"tradeValue":return parseFloat(W.px)*parseFloat(W.sz);default:return W[ne]}},ae=ie(de,I.key),q=ie(G,I.key);return ae<q?I.direction==="asc"?-1:1:ae>q?I.direction==="asc"?1:-1:0}),z=de=>{if(I.key===de){if(I.direction==="asc")return i.jsx(i2,{className:"inline ml-2 text-white"});if(I.direction==="desc")return i.jsx(s2,{className:"inline ml-2 text-white"})}return i.jsx(a2,{className:"inline ml-2 text-white"})},se=localStorage.getItem("isDateTradeHistoryFormat")||"date",[ee,K]=h.useState(se);h.useEffect(()=>{localStorage.setItem("isDateTradeHistoryFormat",ee)},[ee]);function re({date:de}){const[G,ie]=h.useState(Uo(de));return h.useEffect(()=>{const ae=setInterval(()=>{ie(Uo(de))},1e3);return()=>clearInterval(ae)},[de]),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(xln,{open:y,setOpen:v,data:C,setShare:()=>{},setTradeInfo:()=>{}}),i.jsx("div",{className:"w-full overflow-x-auto min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] border-collapse rounded-lg pb-24",children:i.jsxs("table",{className:"w-max sm:w-full relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 z-[3] whitespace-nowrap bg-[#161616]",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[13px] font-manrope relative h-[32px] max-h-[32px] text-white",children:[i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("time"),children:["Time ",z("time")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("coin"),children:["Coin ",z("coin")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("dir"),children:["Direction ",z("dir")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("px"),children:["Price ",z("px")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("sz"),children:["Size ",z("sz")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("tradeValue"),children:["Trade Value ",z("tradeValue")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("fee"),children:["Fee (USDC) ",z("fee")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("closedPnl"),children:["Closed PNL ",z("closedPnl")]}),i.jsx("th",{children:i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx(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:de=>u(de.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Order ID"})]})]})]})})]})}),i.jsx("tbody",{children:s?i.jsx("tr",{children:i.jsx("td",{colSpan:"8",className:"text-center p-4",children:"Loading..."})}):L.map((de,G)=>{var ie,ae;return i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",children:[i.jsx("td",{onClick:()=>{K(ee=="time"?"date":"time")},className:"text-left rounded-l-2xl cursor-pointer",children:ee=="time"?i.jsx(re,{date:de.time}):$c(de.time)}),i.jsx("td",{className:"text-left",children:i.jsx("a",{href:`/terminal/${de.coin}`,target:"_blank",rel:"noopener noreferrer",className:"text-white hover:text-gray-400",children:de.coin})}),i.jsx("td",{className:`text-left ${de!=null&&de.liquidation?"text-[#ff787b]":(ie=de.dir)!=null&&ie.includes("Short")?"text-[#ff6b6b]":(ae=de.dir)!=null&&ae.includes("Long")?"text-[#4ae3b5]":"text-white"}`,children:de!=null&&de.liquidation?`Market Liquidation: ${(de==null?void 0:de.dir)=="Sell"?"Sell":(de==null?void 0:de.dir)=="Buy"?"Buy":(de==null?void 0:de.dir)=="Close Short"?"Close Short":(de==null?void 0:de.dir)=="Close Long"?"Close Long":(de==null?void 0:de.dir)=="Open Short"?"Close Short":(de==null?void 0:de.dir)=="Open Long"?"Close Long":"Close "+(de==null?void 0:de.dir)}`:de==null?void 0:de.dir}),i.jsxs("td",{className:"text-left",children:["$",parseFloat(de.px).toFixed(2)]}),i.jsx("td",{className:"text-left",children:Er(parseFloat(de.sz))}),i.jsxs("td",{className:"text-left",children:["$",Er(parseFloat(de.px)*parseFloat(de.sz))]}),i.jsxs("td",{className:"text-left",children:[Er(parseFloat(de.fee)),de.builderFee&&i.jsxs("span",{className:"text-xs",children:["(",Er(parseFloat(de.builderFee))," ","builder fee)"]})]}),i.jsxs("td",{className:`text-left ${parseFloat(de.closedPnl)-parseFloat(de.fee)>0?"text-[#4ae3b5]":parseFloat(de.closedPnl)-parseFloat(de.fee)<0?"text-[#ff6b6b]":"text-white"}`,children:["$",Er(parseFloat(de.closedPnl)-parseFloat(de.fee))]}),i.jsx("td",{className:"rounded-r-2xl ",children:de.oid})]},G)})})]})})]})};var u9={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 bln=u9.exports,nSe;function yln(){return nSe||(nSe=1,function(t,e){(function(){var n,r="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",l="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",u=500,d="__lodash_placeholder__",f=1,x=2,g=4,y=1,v=2,C=1,N=2,I=4,P=8,M=16,F=32,$=64,L=128,z=256,Q=512,se=30,ee="...",K=800,re=16,de=1,G=2,ie=3,ae=1/0,q=9007199254740991,W=17976931348623157e292,ne=NaN,oe=4294967295,he=oe-1,_e=oe>>>1,xe=[["ary",L],["bind",C],["bindKey",N],["curry",P],["curryRight",M],["flip",Q],["partial",F],["partialRight",$],["rearg",z]],Se="[object Arguments]",ge="[object Array]",Ce="[object AsyncFunction]",je="[object Boolean]",Oe="[object Date]",$e="[object DOMException]",Ye="[object Error]",Je="[object Function]",ht="[object GeneratorFunction]",rt="[object Map]",st="[object Number]",He="[object Null]",Ve="[object Object]",bt="[object Promise]",xt="[object Proxy]",Qt="[object RegExp]",St="[object Set]",on="[object String]",cn="[object Symbol]",Vn="[object Undefined]",tn="[object WeakMap]",fn="[object WeakSet]",rn="[object ArrayBuffer]",nt="[object DataView]",it="[object Float32Array]",Ut="[object Float64Array]",hn="[object Int8Array]",nn="[object Int16Array]",Vt="[object Int32Array]",pt="[object Uint8Array]",We="[object Uint8ClampedArray]",It="[object Uint16Array]",Ge="[object Uint32Array]",ct=/\b__p \+= '';/g,vt=/\b(__p \+=) '' \+/g,Ht=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Rt=/&(?:amp|lt|gt|quot|#39);/g,mn=/[&<>"']/g,un=RegExp(Rt.source),yn=RegExp(mn.source),_n=/<%-([\s\S]+?)%>/g,In=/<%([\s\S]+?)%>/g,Sn=/<%=([\s\S]+?)%>/g,Yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xn=/^\w*$/,zn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kn=/[\\^$.*+?()[\]{}|]/g,jn=RegExp(Kn.source),De=/^\s+/,pe=/\s/,qe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ze=/,? & /,zt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,kt=/[()=,{}\[\]\/\s]/,gt=/\\(\\)?/g,Mt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ln=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,Wn=/^0b[01]+$/i,On=/^\[object .+?Constructor\]$/,$t=/^0o[0-7]+$/i,Nn=/^(?:0|[1-9]\d*)$/,Fn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt=/($^)/,pn=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",m="\\u0300-\\u036f",p="\\ufe20-\\ufe2f",S="\\u20d0-\\u20ff",A=m+p+S,k="\\u2700-\\u27bf",T="a-z\\xdf-\\xf6\\xf8-\\xff",D="\\xac\\xb1\\xd7\\xf7",V="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",X="\\u2000-\\u206f",le=" \\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",ce="A-Z\\xc0-\\xd6\\xd8-\\xde",fe="\\ufe0e\\ufe0f",ye=D+V+X+le,Pe="['’]",Me="["+ke+"]",Ke="["+ye+"]",we="["+A+"]",Te="\\d+",te="["+k+"]",ve="["+T+"]",Be="[^"+ke+ye+Te+k+T+ce+"]",Ue="\\ud83c[\\udffb-\\udfff]",Fe="(?:"+we+"|"+Ue+")",at="[^"+ke+"]",ut="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",Lt="["+ce+"]",Gt="\\u200d",an="(?:"+ve+"|"+Be+")",et="(?:"+Lt+"|"+Be+")",Pt="(?:"+Pe+"(?:d|ll|m|re|s|t|ve))?",qt="(?:"+Pe+"(?:D|LL|M|RE|S|T|VE))?",ft=Fe+"?",tt="["+fe+"]?",Bt="(?:"+Gt+"(?:"+[at,ut,yt].join("|")+")"+tt+ft+")*",gn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dn=tt+ft+Bt,er="(?:"+[te,ut,yt].join("|")+")"+Dn,Sr="(?:"+[at+we+"?",we,ut,yt,Me].join("|")+")",dr=RegExp(Pe,"g"),kr=RegExp(we,"g"),qn=RegExp(Ue+"(?="+Ue+")|"+Sr+Dn,"g"),Tn=RegExp([Lt+"?"+ve+"+"+Pt+"(?="+[Ke,Lt,"$"].join("|")+")",et+"+"+qt+"(?="+[Ke,Lt+an,"$"].join("|")+")",Lt+"?"+an+"+"+Pt,Lt+"+"+qt,tr,gn,Te,er].join("|"),"g"),$n=RegExp("["+Gt+ke+A+fe+"]"),ir=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ls=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cs=-1,lt={};lt[it]=lt[Ut]=lt[hn]=lt[nn]=lt[Vt]=lt[pt]=lt[We]=lt[It]=lt[Ge]=!0,lt[Se]=lt[ge]=lt[rn]=lt[je]=lt[nt]=lt[Oe]=lt[Ye]=lt[Je]=lt[rt]=lt[st]=lt[Ve]=lt[Qt]=lt[St]=lt[on]=lt[tn]=!1;var Nt={};Nt[Se]=Nt[ge]=Nt[rn]=Nt[nt]=Nt[je]=Nt[Oe]=Nt[it]=Nt[Ut]=Nt[hn]=Nt[nn]=Nt[Vt]=Nt[rt]=Nt[st]=Nt[Ve]=Nt[Qt]=Nt[St]=Nt[on]=Nt[cn]=Nt[pt]=Nt[We]=Nt[It]=Nt[Ge]=!0,Nt[Ye]=Nt[Je]=Nt[tn]=!1;var Rn={À:"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"},ar={"&":"&","<":"<",">":">",'"':""","'":"'"},Tr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Lr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$r=parseFloat,cr=parseInt,wr=typeof Ru=="object"&&Ru&&Ru.Object===Object&&Ru,ss=typeof self=="object"&&self&&self.Object===Object&&self,mr=wr||ss||Function("return this")(),ts=e&&!e.nodeType&&e,Qs=ts&&!0&&t&&!t.nodeType&&t,Es=Qs&&Qs.exports===ts,br=Es&&wr.process,Zt=function(){try{var Et=Qs&&Qs.require&&Qs.require("util").types;return Et||br&&br.binding&&br.binding("util")}catch{}}(),me=Zt&&Zt.isArrayBuffer,dt=Zt&&Zt.isDate,_t=Zt&&Zt.isMap,At=Zt&&Zt.isRegExp,xn=Zt&&Zt.isSet,Cn=Zt&&Zt.isTypedArray;function fr(Et,Yt,Jt){switch(Jt.length){case 0:return Et.call(Yt);case 1:return Et.call(Yt,Jt[0]);case 2:return Et.call(Yt,Jt[0],Jt[1]);case 3:return Et.call(Yt,Jt[0],Jt[1],Jt[2])}return Et.apply(Yt,Jt)}function _r(Et,Yt,Jt,Pn){for(var xr=-1,Nr=Et==null?0:Et.length;++xr<Nr;){var Ar=Et[xr];Yt(Pn,Ar,Jt(Ar),Et)}return Pn}function pr(Et,Yt){for(var Jt=-1,Pn=Et==null?0:Et.length;++Jt<Pn&&Yt(Et[Jt],Jt,Et)!==!1;);return Et}function hr(Et,Yt){for(var Jt=Et==null?0:Et.length;Jt--&&Yt(Et[Jt],Jt,Et)!==!1;);return Et}function Xr(Et,Yt){for(var Jt=-1,Pn=Et==null?0:Et.length;++Jt<Pn;)if(!Yt(Et[Jt],Jt,Et))return!1;return!0}function is(Et,Yt){for(var Jt=-1,Pn=Et==null?0:Et.length,xr=0,Nr=[];++Jt<Pn;){var Ar=Et[Jt];Yt(Ar,Jt,Et)&&(Nr[xr++]=Ar)}return Nr}function Pr(Et,Yt){var Jt=Et==null?0:Et.length;return!!Jt&&Zn(Et,Yt,0)>-1}function yr(Et,Yt,Jt){for(var Pn=-1,xr=Et==null?0:Et.length;++Pn<xr;)if(Jt(Yt,Et[Pn]))return!0;return!1}function nr(Et,Yt){for(var Jt=-1,Pn=Et==null?0:Et.length,xr=Array(Pn);++Jt<Pn;)xr[Jt]=Yt(Et[Jt],Jt,Et);return xr}function gs(Et,Yt){for(var Jt=-1,Pn=Yt.length,xr=Et.length;++Jt<Pn;)Et[xr+Jt]=Yt[Jt];return Et}function ei(Et,Yt,Jt,Pn){var xr=-1,Nr=Et==null?0:Et.length;for(Pn&&Nr&&(Jt=Et[++xr]);++xr<Nr;)Jt=Yt(Jt,Et[xr],xr,Et);return Jt}function ci(Et,Yt,Jt,Pn){var xr=Et==null?0:Et.length;for(Pn&&xr&&(Jt=Et[--xr]);xr--;)Jt=Yt(Jt,Et[xr],xr,Et);return Jt}function Fr(Et,Yt){for(var Jt=-1,Pn=Et==null?0:Et.length;++Jt<Pn;)if(Yt(Et[Jt],Jt,Et))return!0;return!1}var En=Ls("length");function Bn(Et){return Et.split("")}function mt(Et){return Et.match(zt)||[]}function Kt(Et,Yt,Jt){var Pn;return Jt(Et,function(xr,Nr,Ar){if(Yt(xr,Nr,Ar))return Pn=Nr,!1}),Pn}function sr(Et,Yt,Jt,Pn){for(var xr=Et.length,Nr=Jt+(Pn?1:-1);Pn?Nr--:++Nr<xr;)if(Yt(Et[Nr],Nr,Et))return Nr;return-1}function Zn(Et,Yt,Jt){return Yt===Yt?O(Et,Yt,Jt):sr(Et,Ir,Jt)}function Or(Et,Yt,Jt,Pn){for(var xr=Jt-1,Nr=Et.length;++xr<Nr;)if(Pn(Et[xr],Yt))return xr;return-1}function Ir(Et){return Et!==Et}function ns(Et,Yt){var Jt=Et==null?0:Et.length;return Jt?Vr(Et,Yt)/Jt:ne}function Ls(Et){return function(Yt){return Yt==null?n:Yt[Et]}}function Ot(Et){return function(Yt){return Et==null?n:Et[Yt]}}function lr(Et,Yt,Jt,Pn,xr){return xr(Et,function(Nr,Ar,Ns){Jt=Pn?(Pn=!1,Nr):Yt(Jt,Nr,Ar,Ns)}),Jt}function Qn(Et,Yt){var Jt=Et.length;for(Et.sort(Yt);Jt--;)Et[Jt]=Et[Jt].value;return Et}function Vr(Et,Yt){for(var Jt,Pn=-1,xr=Et.length;++Pn<xr;){var Nr=Yt(Et[Pn]);Nr!==n&&(Jt=Jt===n?Nr:Jt+Nr)}return Jt}function us(Et,Yt){for(var Jt=-1,Pn=Array(Et);++Jt<Et;)Pn[Jt]=Yt(Jt);return Pn}function as(Et,Yt){return nr(Yt,function(Jt){return[Jt,Et[Jt]]})}function xs(Et){return Et&&Et.slice(0,ue(Et)+1).replace(De,"")}function bs(Et){return function(Yt){return Et(Yt)}}function zi(Et,Yt){return nr(Yt,function(Jt){return Et[Jt]})}function zs(Et,Yt){return Et.has(Yt)}function ys(Et,Yt){for(var Jt=-1,Pn=Et.length;++Jt<Pn&&Zn(Yt,Et[Jt],0)>-1;);return Jt}function Ss(Et,Yt){for(var Jt=Et.length;Jt--&&Zn(Yt,Et[Jt],0)>-1;);return Jt}function pc(Et,Yt){for(var Jt=Et.length,Pn=0;Jt--;)Et[Jt]===Yt&&++Pn;return Pn}var ks=Ot(Rn),ka=Ot(ar);function Wu(Et){return"\\"+Lr[Et]}function Sa(Et,Yt){return Et==null?n:Et[Yt]}function Yo(Et){return $n.test(Et)}function qu(Et){return ir.test(Et)}function Ql(Et){for(var Yt,Jt=[];!(Yt=Et.next()).done;)Jt.push(Yt.value);return Jt}function wi(Et){var Yt=-1,Jt=Array(Et.size);return Et.forEach(function(Pn,xr){Jt[++Yt]=[xr,Pn]}),Jt}function Ed(Et,Yt){return function(Jt){return Et(Yt(Jt))}}function wt(Et,Yt){for(var Jt=-1,Pn=Et.length,xr=0,Nr=[];++Jt<Pn;){var Ar=Et[Jt];(Ar===Yt||Ar===d)&&(Et[Jt]=d,Nr[xr++]=Jt)}return Nr}function w(Et){var Yt=-1,Jt=Array(Et.size);return Et.forEach(function(Pn){Jt[++Yt]=Pn}),Jt}function E(Et){var Yt=-1,Jt=Array(Et.size);return Et.forEach(function(Pn){Jt[++Yt]=[Pn,Pn]}),Jt}function O(Et,Yt,Jt){for(var Pn=Jt-1,xr=Et.length;++Pn<xr;)if(Et[Pn]===Yt)return Pn;return-1}function U(Et,Yt,Jt){for(var Pn=Jt+1;Pn--;)if(Et[Pn]===Yt)return Pn;return Pn}function H(Et){return Yo(Et)?Re(Et):En(Et)}function Z(Et){return Yo(Et)?ot(Et):Bn(Et)}function ue(Et){for(var Yt=Et.length;Yt--&&pe.test(Et.charAt(Yt)););return Yt}var Ee=Ot(Tr);function Re(Et){for(var Yt=qn.lastIndex=0;qn.test(Et);)++Yt;return Yt}function ot(Et){return Et.match(qn)||[]}function Ct(Et){return Et.match(Tn)||[]}var Dt=function Et(Yt){Yt=Yt==null?mr:sn.defaults(mr.Object(),Yt,sn.pick(mr,ls));var Jt=Yt.Array,Pn=Yt.Date,xr=Yt.Error,Nr=Yt.Function,Ar=Yt.Math,Ns=Yt.Object,ti=Yt.RegExp,mc=Yt.String,ro=Yt.TypeError,so=Jt.prototype,pa=Nr.prototype,Ta=Ns.prototype,Xo=Yt["__core-js_shared__"],kd=pa.toString,Oi=Ta.hasOwnProperty,Lm=0,W1=function(){var B=/[^.]+$/.exec(Xo&&Xo.keys&&Xo.keys.IE_PROTO||"");return B?"Symbol(src)_1."+B:""}(),z2=Ta.toString,Q5=kd.call(Ns),pI=mr._,mI=ti("^"+kd.call(Oi).replace(Kn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H2=Es?Yt.Buffer:n,Np=Yt.Symbol,V2=Yt.Uint8Array,U8=H2?H2.allocUnsafe:n,Nf=Ed(Ns.getPrototypeOf,Ns),Z5=Ns.create,J5=Ta.propertyIsEnumerable,e6=so.splice,xI=Np?Np.isConcatSpreadable:n,jp=Np?Np.iterator:n,Sx=Np?Np.toStringTag:n,W2=function(){try{var B=Km(Ns,"defineProperty");return B({},"",{}),B}catch{}}(),gI=Yt.clearTimeout!==mr.clearTimeout&&Yt.clearTimeout,Ka=Pn&&Pn.now!==mr.Date.now&&Pn.now,z8=Yt.setTimeout!==mr.setTimeout&&Yt.setTimeout,Nx=Ar.ceil,Dm=Ar.floor,t6=Ns.getOwnPropertySymbols,H8=H2?H2.isBuffer:n,q1=Yt.isFinite,n6=so.join,G1=Ed(Ns.keys,Ns),Qo=Ar.max,xc=Ar.min,Dz=Pn.now,bI=Yt.parseInt,q2=Ar.random,r6=so.reverse,G2=Km(Yt,"DataView"),jx=Km(Yt,"Map"),K2=Km(Yt,"Promise"),Bm=Km(Yt,"Set"),Y2=Km(Yt,"WeakMap"),K1=Km(Ns,"create"),s6=Y2&&new Y2,Y1={},V8=Ym(G2),$m=Ym(jx),yI=Ym(K2),X1=Ym(Bm),uh=Ym(Y2),Um=Np?Np.prototype:n,Gu=Um?Um.valueOf:n,i6=Um?Um.toString:n;function Wt(B){if(Jo(B)&&!_i(B)&&!(B instanceof Ai)){if(B instanceof gc)return B;if(Oi.call(B,"__wrapped__"))return GI(B)}return new gc(B)}var Q1=function(){function B(){}return function(Y){if(!Ho(Y))return{};if(Z5)return Z5(Y);B.prototype=Y;var Ne=new B;return B.prototype=n,Ne}}();function dh(){}function gc(B,Y){this.__wrapped__=B,this.__actions__=[],this.__chain__=!!Y,this.__index__=0,this.__values__=n}Wt.templateSettings={escape:_n,evaluate:In,interpolate:Sn,variable:"",imports:{_:Wt}},Wt.prototype=dh.prototype,Wt.prototype.constructor=Wt,gc.prototype=Q1(dh.prototype),gc.prototype.constructor=gc;function Ai(B){this.__wrapped__=B,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=oe,this.__views__=[]}function a6(){var B=new Ai(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 W8(){if(this.__filtered__){var B=new Ai(this);B.__dir__=-1,B.__filtered__=!0}else B=this.clone(),B.__dir__*=-1;return B}function Z1(){var B=this.__wrapped__.value(),Y=this.__dir__,Ne=_i(B),Ze=Y<0,jt=Ne?B.length:0,en=yA(0,jt,this.__views__),wn=en.start,Ln=en.end,Jn=Ln-wn,Mr=Ze?Ln:wn-1,Rr=this.__iteratees__,Hr=Rr.length,ds=0,Ds=xc(Jn,this.__takeCount__);if(!Ne||!Ze&&jt==Jn&&Ds==Jn)return ab(B,this.__actions__);var ni=[];e:for(;Jn--&&ds<Ds;){Mr+=Y;for(var Li=-1,ri=B[Mr];++Li<Hr;){var Yi=Rr[Li],Ji=Yi.iteratee,Of=Yi.type,Zu=Ji(ri);if(Of==G)ri=Zu;else if(!Zu){if(Of==de)continue e;break e}}ni[ds++]=ri}return ni}Ai.prototype=Q1(dh.prototype),Ai.prototype.constructor=Ai;function hu(B){var Y=-1,Ne=B==null?0:B.length;for(this.clear();++Y<Ne;){var Ze=B[Y];this.set(Ze[0],Ze[1])}}function Ya(){this.__data__=K1?K1(null):{},this.size=0}function Ha(B){var Y=this.has(B)&&delete this.__data__[B];return this.size-=Y?1:0,Y}function zm(B){var Y=this.__data__;if(K1){var Ne=Y[B];return Ne===c?n:Ne}return Oi.call(Y,B)?Y[B]:n}function bc(B){var Y=this.__data__;return K1?Y[B]!==n:Oi.call(Y,B)}function pu(B,Y){var Ne=this.__data__;return this.size+=this.has(B)?0:1,Ne[B]=K1&&Y===n?c:Y,this}hu.prototype.clear=Ya,hu.prototype.delete=Ha,hu.prototype.get=zm,hu.prototype.has=bc,hu.prototype.set=pu;function Vc(B){var Y=-1,Ne=B==null?0:B.length;for(this.clear();++Y<Ne;){var Ze=B[Y];this.set(Ze[0],Ze[1])}}function J1(){this.__data__=[],this.size=0}function mu(B){var Y=this.__data__,Ne=vc(Y,B);if(Ne<0)return!1;var Ze=Y.length-1;return Ne==Ze?Y.pop():e6.call(Y,Ne,1),--this.size,!0}function o6(B){var Y=this.__data__,Ne=vc(Y,B);return Ne<0?n:Y[Ne][1]}function vI(B){return vc(this.__data__,B)>-1}function wI(B,Y){var Ne=this.__data__,Ze=vc(Ne,B);return Ze<0?(++this.size,Ne.push([B,Y])):Ne[Ze][1]=Y,this}Vc.prototype.clear=J1,Vc.prototype.delete=mu,Vc.prototype.get=o6,Vc.prototype.has=vI,Vc.prototype.set=wI;function Td(B){var Y=-1,Ne=B==null?0:B.length;for(this.clear();++Y<Ne;){var Ze=B[Y];this.set(Ze[0],Ze[1])}}function CI(){this.size=0,this.__data__={hash:new hu,map:new(jx||Vc),string:new hu}}function Ap(B){var Y=dv(this,B).delete(B);return this.size-=Y?1:0,Y}function l6(B){return dv(this,B).get(B)}function q8(B){return dv(this,B).has(B)}function SI(B,Y){var Ne=dv(this,B),Ze=Ne.size;return Ne.set(B,Y),this.size+=Ne.size==Ze?0:1,this}Td.prototype.clear=CI,Td.prototype.delete=Ap,Td.prototype.get=l6,Td.prototype.has=q8,Td.prototype.set=SI;function Ax(B){var Y=-1,Ne=B==null?0:B.length;for(this.__data__=new Td;++Y<Ne;)this.add(B[Y])}function Hm(B){return this.__data__.set(B,c),this}function eb(B){return this.__data__.has(B)}Ax.prototype.add=Ax.prototype.push=Hm,Ax.prototype.has=eb;function yc(B){var Y=this.__data__=new Vc(B);this.size=Y.size}function c6(){this.__data__=new Vc,this.size=0}function u6(B){var Y=this.__data__,Ne=Y.delete(B);return this.size=Y.size,Ne}function Id(B){return this.__data__.get(B)}function Pd(B){return this.__data__.has(B)}function _x(B,Y){var Ne=this.__data__;if(Ne instanceof Vc){var Ze=Ne.__data__;if(!jx||Ze.length<s-1)return Ze.push([B,Y]),this.size=++Ne.size,this;Ne=this.__data__=new Td(Ze)}return Ne.set(B,Y),this.size=Ne.size,this}yc.prototype.clear=c6,yc.prototype.delete=u6,yc.prototype.get=Id,yc.prototype.has=Pd,yc.prototype.set=_x;function fh(B,Y){var Ne=_i(B),Ze=!Ne&&Sv(B),jt=!Ne&&!Ze&&xb(B),en=!Ne&&!Ze&&!jt&&tC(B),wn=Ne||Ze||jt||en,Ln=wn?us(B.length,mc):[],Jn=Ln.length;for(var Mr in B)(Y||Oi.call(B,Mr))&&!(wn&&(Mr=="length"||jt&&(Mr=="offset"||Mr=="parent")||en&&(Mr=="buffer"||Mr=="byteLength"||Mr=="byteOffset")||ao(Mr,Jn)))&&Ln.push(Mr);return Ln}function hh(B){var Y=B.length;return Y?B[sb(0,Y-1)]:n}function Ex(B,Y){return R6(Wc(B),_p(Y,0,B.length))}function NI(B){return R6(Wc(B))}function X2(B,Y,Ne){(Ne!==n&&!Lp(B[Y],Ne)||Ne===n&&!(Y in B))&&ph(B,Y,Ne)}function kx(B,Y,Ne){var Ze=B[Y];(!(Oi.call(B,Y)&&Lp(Ze,Ne))||Ne===n&&!(Y in B))&&ph(B,Y,Ne)}function vc(B,Y){for(var Ne=B.length;Ne--;)if(Lp(B[Ne][0],Y))return Ne;return-1}function Ku(B,Y,Ne,Ze){return xh(B,function(jt,en,wn){Y(Ze,jt,Ne(jt),wn)}),Ze}function Xa(B,Y){return B&&Af(Y,Sc(Y),B)}function jf(B,Y){return B&&Af(Y,Ud(Y),B)}function ph(B,Y,Ne){Y=="__proto__"&&W2?W2(B,Y,{configurable:!0,enumerable:!0,value:Ne,writable:!0}):B[Y]=Ne}function d6(B,Y){for(var Ne=-1,Ze=Y.length,jt=Jt(Ze),en=B==null;++Ne<Ze;)jt[Ne]=en?n:aH(B,Y[Ne]);return jt}function _p(B,Y,Ne){return B===B&&(Ne!==n&&(B=B<=Ne?B:Ne),Y!==n&&(B=B>=Y?B:Y)),B}function xu(B,Y,Ne,Ze,jt,en){var wn,Ln=Y&f,Jn=Y&x,Mr=Y&g;if(Ne&&(wn=jt?Ne(B,Ze,jt,en):Ne(B)),wn!==n)return wn;if(!Ho(B))return B;var Rr=_i(B);if(Rr){if(wn=hv(B),!Ln)return Wc(B,wn)}else{var Hr=ec(B),ds=Hr==Je||Hr==ht;if(xb(B))return oA(B,Ln);if(Hr==Ve||Hr==Se||ds&&!jt){if(wn=Jn||ds?{}:tc(B),!Ln)return Jn?$z(B,jf(wn,B)):N6(B,Xa(wn,B))}else{if(!Nt[Hr])return jt?B:{};wn=Uz(B,Hr,Ln)}}en||(en=new yc);var Ds=en.get(B);if(Ds)return Ds;en.set(B,wn),Dfe(B)?B.forEach(function(ri){wn.add(xu(ri,Y,Ne,ri,B,en))}):Rfe(B)&&B.forEach(function(ri,Yi){wn.set(Yi,xu(ri,Y,Ne,Yi,B,en))});var ni=Mr?Jn?uv:cv:Jn?Ud:Sc,Li=Rr?n:ni(B);return pr(Li||B,function(ri,Yi){Li&&(Yi=ri,ri=B[Yi]),kx(wn,Yi,xu(ri,Y,Ne,Yi,B,en))}),wn}function jI(B){var Y=Sc(B);return function(Ne){return Q2(Ne,B,Y)}}function Q2(B,Y,Ne){var Ze=Ne.length;if(B==null)return!Ze;for(B=Ns(B);Ze--;){var jt=Ne[Ze],en=Y[jt],wn=B[jt];if(wn===n&&!(jt in B)||!en(wn))return!1}return!0}function G8(B,Y,Ne){if(typeof B!="function")throw new ro(o);return hb(function(){B.apply(n,Ne)},Y)}function mh(B,Y,Ne,Ze){var jt=-1,en=Pr,wn=!0,Ln=B.length,Jn=[],Mr=Y.length;if(!Ln)return Jn;Ne&&(Y=nr(Y,bs(Ne))),Ze?(en=yr,wn=!1):Y.length>=s&&(en=zs,wn=!1,Y=new Ax(Y));e:for(;++jt<Ln;){var Rr=B[jt],Hr=Ne==null?Rr:Ne(Rr);if(Rr=Ze||Rr!==0?Rr:0,wn&&Hr===Hr){for(var ds=Mr;ds--;)if(Y[ds]===Hr)continue e;Jn.push(Rr)}else en(Y,Hr,Ze)||Jn.push(Rr)}return Jn}var xh=Ld(Yu),AI=Ld(Vm,!0);function Z2(B,Y){var Ne=!0;return xh(B,function(Ze,jt,en){return Ne=!!Y(Ze,jt,en),Ne}),Ne}function Tx(B,Y,Ne){for(var Ze=-1,jt=B.length;++Ze<jt;){var en=B[Ze],wn=Y(en);if(wn!=null&&(Ln===n?wn===wn&&!Ff(wn):Ne(wn,Ln)))var Ln=wn,Jn=en}return Jn}function _I(B,Y,Ne,Ze){var jt=B.length;for(Ne=Ri(Ne),Ne<0&&(Ne=-Ne>jt?0:jt+Ne),Ze=Ze===n||Ze>jt?jt:Ri(Ze),Ze<0&&(Ze+=jt),Ze=Ne>Ze?0:$fe(Ze);Ne<Ze;)B[Ne++]=Y;return B}function K8(B,Y){var Ne=[];return xh(B,function(Ze,jt,en){Y(Ze,jt,en)&&Ne.push(Ze)}),Ne}function ko(B,Y,Ne,Ze,jt){var en=-1,wn=B.length;for(Ne||(Ne=F6),jt||(jt=[]);++en<wn;){var Ln=B[en];Y>0&&Ne(Ln)?Y>1?ko(Ln,Y-1,Ne,Ze,jt):gs(jt,Ln):Ze||(jt[jt.length]=Ln)}return jt}var f6=A6(),J2=A6(!0);function Yu(B,Y){return B&&f6(B,Y,Sc)}function Vm(B,Y){return B&&J2(B,Y,Sc)}function tb(B,Y){return is(Y,function(Ne){return zx(B[Ne])})}function Ep(B,Y){Y=yh(Y,B);for(var Ne=0,Ze=Y.length;B!=null&&Ne<Ze;)B=B[Tf(Y[Ne++])];return Ne&&Ne==Ze?B:n}function h6(B,Y,Ne){var Ze=Y(B);return _i(B)?Ze:gs(Ze,Ne(B))}function Zl(B){return B==null?B===n?Vn:He:Sx&&Sx in Ns(B)?P6(B):wA(B)}function Wm(B,Y){return B>Y}function Fd(B,Y){return B!=null&&Oi.call(B,Y)}function Ix(B,Y){return B!=null&&Y in Ns(B)}function Y8(B,Y,Ne){return B>=xc(Y,Ne)&&B<Qo(Y,Ne)}function p6(B,Y,Ne){for(var Ze=Ne?yr:Pr,jt=B[0].length,en=B.length,wn=en,Ln=Jt(en),Jn=1/0,Mr=[];wn--;){var Rr=B[wn];wn&&Y&&(Rr=nr(Rr,bs(Y))),Jn=xc(Rr.length,Jn),Ln[wn]=!Ne&&(Y||jt>=120&&Rr.length>=120)?new Ax(wn&&Rr):n}Rr=B[0];var Hr=-1,ds=Ln[0];e:for(;++Hr<jt&&Mr.length<Jn;){var Ds=Rr[Hr],ni=Y?Y(Ds):Ds;if(Ds=Ne||Ds!==0?Ds:0,!(ds?zs(ds,ni):Ze(Mr,ni,Ne))){for(wn=en;--wn;){var Li=Ln[wn];if(!(Li?zs(Li,ni):Ze(B[wn],ni,Ne)))continue e}ds&&ds.push(ni),Mr.push(Ds)}}return Mr}function kp(B,Y,Ne,Ze){return Yu(B,function(jt,en,wn){Y(Ze,Ne(jt),en,wn)}),Ze}function Od(B,Y,Ne){Y=yh(Y,B),B=Fl(B,Y);var Ze=B==null?B:B[Tf(Kc(Y))];return Ze==null?n:fr(Ze,B,Ne)}function m6(B){return Jo(B)&&Zl(B)==Se}function EI(B){return Jo(B)&&Zl(B)==rn}function Tp(B){return Jo(B)&&Zl(B)==Oe}function Md(B,Y,Ne,Ze,jt){return B===Y?!0:B==null||Y==null||!Jo(B)&&!Jo(Y)?B!==B&&Y!==Y:x6(B,Y,Ne,Ze,Md,jt)}function x6(B,Y,Ne,Ze,jt,en){var wn=_i(B),Ln=_i(Y),Jn=wn?ge:ec(B),Mr=Ln?ge:ec(Y);Jn=Jn==Se?Ve:Jn,Mr=Mr==Se?Ve:Mr;var Rr=Jn==Ve,Hr=Mr==Ve,ds=Jn==Mr;if(ds&&xb(B)){if(!xb(Y))return!1;wn=!0,Rr=!1}if(ds&&!Rr)return en||(en=new yc),wn||tC(B)?gA(B,Y,Ne,Ze,jt,en):bA(B,Y,Jn,Ne,Ze,jt,en);if(!(Ne&y)){var Ds=Rr&&Oi.call(B,"__wrapped__"),ni=Hr&&Oi.call(Y,"__wrapped__");if(Ds||ni){var Li=Ds?B.value():B,ri=ni?Y.value():Y;return en||(en=new yc),jt(Li,ri,Ne,Ze,en)}}return ds?(en||(en=new yc),BI(B,Y,Ne,Ze,jt,en)):!1}function kI(B){return Jo(B)&&ec(B)==rt}function nb(B,Y,Ne,Ze){var jt=Ne.length,en=jt,wn=!Ze;if(B==null)return!en;for(B=Ns(B);jt--;){var Ln=Ne[jt];if(wn&&Ln[2]?Ln[1]!==B[Ln[0]]:!(Ln[0]in B))return!1}for(;++jt<en;){Ln=Ne[jt];var Jn=Ln[0],Mr=B[Jn],Rr=Ln[1];if(wn&&Ln[2]){if(Mr===n&&!(Jn in B))return!1}else{var Hr=new yc;if(Ze)var ds=Ze(Mr,Rr,Jn,B,Y,Hr);if(!(ds===n?Md(Rr,Mr,y|v,Ze,Hr):ds))return!1}}return!0}function X8(B){if(!Ho(B)||zI(B))return!1;var Y=zx(B)?mI:On;return Y.test(Ym(B))}function ev(B){return Jo(B)&&Zl(B)==Qt}function gh(B){return Jo(B)&&ec(B)==St}function tv(B){return Jo(B)&&oP(B.length)&&!!lt[Zl(B)]}function rb(B){return typeof B=="function"?B:B==null?zd:typeof B=="object"?_i(B)?io(B[0],B[1]):g6(B):Qfe(B)}function Ip(B){if(!Mp(B))return G1(B);var Y=[];for(var Ne in Ns(B))Oi.call(B,Ne)&&Ne!="constructor"&&Y.push(Ne);return Y}function Q8(B){if(!Ho(B))return WI(B);var Y=Mp(B),Ne=[];for(var Ze in B)Ze=="constructor"&&(Y||!Oi.call(B,Ze))||Ne.push(Ze);return Ne}function qm(B,Y){return B<Y}function Z8(B,Y){var Ne=-1,Ze=$d(B)?Jt(B.length):[];return xh(B,function(jt,en,wn){Ze[++Ne]=Y(jt,en,wn)}),Ze}function g6(B){var Y=fv(B);return Y.length==1&&Y[0][2]?O6(Y[0][0],Y[0][1]):function(Ne){return Ne===B||nb(Ne,B,Y)}}function io(B,Y){return vs(B)&&mv(Y)?O6(Tf(B),Y):function(Ne){var Ze=aH(Ne,B);return Ze===n&&Ze===Y?oH(Ne,B):Md(Y,Ze,y|v)}}function Px(B,Y,Ne,Ze,jt){B!==Y&&f6(Y,function(en,wn){if(jt||(jt=new yc),Ho(en))J8(B,Y,wn,Ne,Px,Ze,jt);else{var Ln=Ze?Ze(Ch(B,wn),en,wn+"",B,Y,jt):n;Ln===n&&(Ln=en),X2(B,wn,Ln)}},Ud)}function J8(B,Y,Ne,Ze,jt,en,wn){var Ln=Ch(B,Ne),Jn=Ch(Y,Ne),Mr=wn.get(Jn);if(Mr){X2(B,Ne,Mr);return}var Rr=en?en(Ln,Jn,Ne+"",B,Y,wn):n,Hr=Rr===n;if(Hr){var ds=_i(Jn),Ds=!ds&&xb(Jn),ni=!ds&&!Ds&&tC(Jn);Rr=Jn,ds||Ds||ni?_i(Ln)?Rr=Ln:gl(Ln)?Rr=Wc(Ln):Ds?(Hr=!1,Rr=oA(Jn,!0)):ni?(Hr=!1,Rr=OI(Jn,!0)):Rr=[]:BA(Jn)||Sv(Jn)?(Rr=Ln,Sv(Ln)?Rr=Ufe(Ln):(!Ho(Ln)||zx(Ln))&&(Rr=tc(Jn))):Hr=!1}Hr&&(wn.set(Jn,Rr),jt(Rr,Jn,Ze,en,wn),wn.delete(Jn)),X2(B,Ne,Rr)}function b6(B,Y){var Ne=B.length;if(Ne)return Y+=Y<0?Ne:0,ao(Y,Ne)?B[Y]:n}function nv(B,Y,Ne){Y.length?Y=nr(Y,function(en){return _i(en)?function(wn){return Ep(wn,en.length===1?en[0]:en)}:en}):Y=[zd];var Ze=-1;Y=nr(Y,bs(Ys()));var jt=Z8(B,function(en,wn,Ln){var Jn=nr(Y,function(Mr){return Mr(en)});return{criteria:Jn,index:++Ze,value:en}});return Qn(jt,function(en,wn){return Bz(en,wn,Ne)})}function eA(B,Y){return Gm(B,Y,function(Ne,Ze){return oH(B,Ze)})}function Gm(B,Y,Ne){for(var Ze=-1,jt=Y.length,en={};++Ze<jt;){var wn=Y[Ze],Ln=Ep(B,wn);Ne(Ln,wn)&&Ox(en,yh(wn,B),Ln)}return en}function bo(B){return function(Y){return Ep(Y,B)}}function zo(B,Y,Ne,Ze){var jt=Ze?Or:Zn,en=-1,wn=Y.length,Ln=B;for(B===Y&&(Y=Wc(Y)),Ne&&(Ln=nr(B,bs(Ne)));++en<wn;)for(var Jn=0,Mr=Y[en],Rr=Ne?Ne(Mr):Mr;(Jn=jt(Ln,Rr,Jn,Ze))>-1;)Ln!==B&&e6.call(Ln,Jn,1),e6.call(B,Jn,1);return B}function pl(B,Y){for(var Ne=B?Y.length:0,Ze=Ne-1;Ne--;){var jt=Y[Ne];if(Ne==Ze||jt!==en){var en=jt;ao(jt)?e6.call(B,jt,1):w6(B,jt)}}return B}function sb(B,Y){return B+Dm(q2()*(Y-B+1))}function rv(B,Y,Ne,Ze){for(var jt=-1,en=Qo(Nx((Y-B)/(Ne||1)),0),wn=Jt(en);en--;)wn[Ze?en:++jt]=B,B+=Ne;return wn}function Fx(B,Y){var Ne="";if(!B||Y<1||Y>q)return Ne;do Y%2&&(Ne+=B),Y=Dm(Y/2),Y&&(B+=B);while(Y);return Ne}function Mi(B,Y){return Xu(M6(B,Y,zd),B+"")}function wc(B){return hh(nC(B))}function tA(B,Y){var Ne=nC(B);return R6(Ne,_p(Y,0,Ne.length))}function Ox(B,Y,Ne,Ze){if(!Ho(B))return B;Y=yh(Y,B);for(var jt=-1,en=Y.length,wn=en-1,Ln=B;Ln!=null&&++jt<en;){var Jn=Tf(Y[jt]),Mr=Ne;if(Jn==="__proto__"||Jn==="constructor"||Jn==="prototype")return B;if(jt!=wn){var Rr=Ln[Jn];Mr=Ze?Ze(Rr,Jn,Ln):n,Mr===n&&(Mr=Ho(Rr)?Rr:ao(Y[jt+1])?[]:{})}kx(Ln,Jn,Mr),Ln=Ln[Jn]}return B}var y6=s6?function(B,Y){return s6.set(B,Y),B}:zd,bh=W2?function(B,Y){return W2(B,"toString",{configurable:!0,enumerable:!1,value:cH(Y),writable:!0})}:zd;function Rd(B){return R6(nC(B))}function Cc(B,Y,Ne){var Ze=-1,jt=B.length;Y<0&&(Y=-Y>jt?0:jt+Y),Ne=Ne>jt?jt:Ne,Ne<0&&(Ne+=jt),jt=Y>Ne?0:Ne-Y>>>0,Y>>>=0;for(var en=Jt(jt);++Ze<jt;)en[Ze]=B[Ze+Y];return en}function nA(B,Y){var Ne;return xh(B,function(Ze,jt,en){return Ne=Y(Ze,jt,en),!Ne}),!!Ne}function ib(B,Y,Ne){var Ze=0,jt=B==null?Ze:B.length;if(typeof Y=="number"&&Y===Y&&jt<=_e){for(;Ze<jt;){var en=Ze+jt>>>1,wn=B[en];wn!==null&&!Ff(wn)&&(Ne?wn<=Y:wn<Y)?Ze=en+1:jt=en}return jt}return v6(B,Y,zd,Ne)}function v6(B,Y,Ne,Ze){var jt=0,en=B==null?0:B.length;if(en===0)return 0;Y=Ne(Y);for(var wn=Y!==Y,Ln=Y===null,Jn=Ff(Y),Mr=Y===n;jt<en;){var Rr=Dm((jt+en)/2),Hr=Ne(B[Rr]),ds=Hr!==n,Ds=Hr===null,ni=Hr===Hr,Li=Ff(Hr);if(wn)var ri=Ze||ni;else Mr?ri=ni&&(Ze||ds):Ln?ri=ni&&ds&&(Ze||!Ds):Jn?ri=ni&&ds&&!Ds&&(Ze||!Li):Ds||Li?ri=!1:ri=Ze?Hr<=Y:Hr<Y;ri?jt=Rr+1:en=Rr}return xc(en,he)}function rA(B,Y){for(var Ne=-1,Ze=B.length,jt=0,en=[];++Ne<Ze;){var wn=B[Ne],Ln=Y?Y(wn):wn;if(!Ne||!Lp(Ln,Jn)){var Jn=Ln;en[jt++]=wn===0?0:wn}}return en}function sA(B){return typeof B=="number"?B:Ff(B)?ne:+B}function gu(B){if(typeof B=="string")return B;if(_i(B))return nr(B,gu)+"";if(Ff(B))return i6?i6.call(B):"";var Y=B+"";return Y=="0"&&1/B==-1/0?"-0":Y}function Pp(B,Y,Ne){var Ze=-1,jt=Pr,en=B.length,wn=!0,Ln=[],Jn=Ln;if(Ne)wn=!1,jt=yr;else if(en>=s){var Mr=Y?null:DI(B);if(Mr)return w(Mr);wn=!1,jt=zs,Jn=new Ax}else Jn=Y?[]:Ln;e:for(;++Ze<en;){var Rr=B[Ze],Hr=Y?Y(Rr):Rr;if(Rr=Ne||Rr!==0?Rr:0,wn&&Hr===Hr){for(var ds=Jn.length;ds--;)if(Jn[ds]===Hr)continue e;Y&&Jn.push(Hr),Ln.push(Rr)}else jt(Jn,Hr,Ne)||(Jn!==Ln&&Jn.push(Hr),Ln.push(Rr))}return Ln}function w6(B,Y){return Y=yh(Y,B),B=Fl(B,Y),B==null||delete B[Tf(Kc(Y))]}function iA(B,Y,Ne,Ze){return Ox(B,Y,Ne(Ep(B,Y)),Ze)}function sv(B,Y,Ne,Ze){for(var jt=B.length,en=Ze?jt:-1;(Ze?en--:++en<jt)&&Y(B[en],en,B););return Ne?Cc(B,Ze?0:en,Ze?en+1:jt):Cc(B,Ze?en+1:0,Ze?jt:en)}function ab(B,Y){var Ne=B;return Ne instanceof Ai&&(Ne=Ne.value()),ei(Y,function(Ze,jt){return jt.func.apply(jt.thisArg,gs([Ze],jt.args))},Ne)}function C6(B,Y,Ne){var Ze=B.length;if(Ze<2)return Ze?Pp(B[0]):[];for(var jt=-1,en=Jt(Ze);++jt<Ze;)for(var wn=B[jt],Ln=-1;++Ln<Ze;)Ln!=jt&&(en[jt]=mh(en[jt]||wn,B[Ln],Y,Ne));return Pp(ko(en,1),Y,Ne)}function iv(B,Y,Ne){for(var Ze=-1,jt=B.length,en=Y.length,wn={};++Ze<jt;){var Ln=Ze<en?Y[Ze]:n;Ne(wn,B[Ze],Ln)}return wn}function ob(B){return gl(B)?B:[]}function S6(B){return typeof B=="function"?B:zd}function yh(B,Y){return _i(B)?B:vs(B,Y)?[B]:NA(Ia(B))}var TI=Mi;function Fp(B,Y,Ne){var Ze=B.length;return Ne=Ne===n?Ze:Ne,!Y&&Ne>=Ze?B:Cc(B,Y,Ne)}var aA=gI||function(B){return mr.clearTimeout(B)};function oA(B,Y){if(Y)return B.slice();var Ne=B.length,Ze=U8?U8(Ne):new B.constructor(Ne);return B.copy(Ze),Ze}function av(B){var Y=new B.constructor(B.byteLength);return new V2(Y).set(new V2(B)),Y}function II(B,Y){var Ne=Y?av(B.buffer):B.buffer;return new B.constructor(Ne,B.byteOffset,B.byteLength)}function PI(B){var Y=new B.constructor(B.source,ln.exec(B));return Y.lastIndex=B.lastIndex,Y}function FI(B){return Gu?Ns(Gu.call(B)):{}}function OI(B,Y){var Ne=Y?av(B.buffer):B.buffer;return new B.constructor(Ne,B.byteOffset,B.length)}function lA(B,Y){if(B!==Y){var Ne=B!==n,Ze=B===null,jt=B===B,en=Ff(B),wn=Y!==n,Ln=Y===null,Jn=Y===Y,Mr=Ff(Y);if(!Ln&&!Mr&&!en&&B>Y||en&&wn&&Jn&&!Ln&&!Mr||Ze&&wn&&Jn||!Ne&&Jn||!jt)return 1;if(!Ze&&!en&&!Mr&&B<Y||Mr&&Ne&&jt&&!Ze&&!en||Ln&&Ne&&jt||!wn&&jt||!Jn)return-1}return 0}function Bz(B,Y,Ne){for(var Ze=-1,jt=B.criteria,en=Y.criteria,wn=jt.length,Ln=Ne.length;++Ze<wn;){var Jn=lA(jt[Ze],en[Ze]);if(Jn){if(Ze>=Ln)return Jn;var Mr=Ne[Ze];return Jn*(Mr=="desc"?-1:1)}}return B.index-Y.index}function MI(B,Y,Ne,Ze){for(var jt=-1,en=B.length,wn=Ne.length,Ln=-1,Jn=Y.length,Mr=Qo(en-wn,0),Rr=Jt(Jn+Mr),Hr=!Ze;++Ln<Jn;)Rr[Ln]=Y[Ln];for(;++jt<wn;)(Hr||jt<en)&&(Rr[Ne[jt]]=B[jt]);for(;Mr--;)Rr[Ln++]=B[jt++];return Rr}function cA(B,Y,Ne,Ze){for(var jt=-1,en=B.length,wn=-1,Ln=Ne.length,Jn=-1,Mr=Y.length,Rr=Qo(en-Ln,0),Hr=Jt(Rr+Mr),ds=!Ze;++jt<Rr;)Hr[jt]=B[jt];for(var Ds=jt;++Jn<Mr;)Hr[Ds+Jn]=Y[Jn];for(;++wn<Ln;)(ds||jt<en)&&(Hr[Ds+Ne[wn]]=B[jt++]);return Hr}function Wc(B,Y){var Ne=-1,Ze=B.length;for(Y||(Y=Jt(Ze));++Ne<Ze;)Y[Ne]=B[Ne];return Y}function Af(B,Y,Ne,Ze){var jt=!Ne;Ne||(Ne={});for(var en=-1,wn=Y.length;++en<wn;){var Ln=Y[en],Jn=Ze?Ze(Ne[Ln],B[Ln],Ln,Ne,B):n;Jn===n&&(Jn=B[Ln]),jt?ph(Ne,Ln,Jn):kx(Ne,Ln,Jn)}return Ne}function N6(B,Y){return Af(B,_f(B),Y)}function $z(B,Y){return Af(B,$I(B),Y)}function j6(B,Y){return function(Ne,Ze){var jt=_i(Ne)?_r:Ku,en=Y?Y():{};return jt(Ne,B,Ys(Ze,2),en)}}function lb(B){return Mi(function(Y,Ne){var Ze=-1,jt=Ne.length,en=jt>1?Ne[jt-1]:n,wn=jt>2?Ne[2]:n;for(en=B.length>3&&typeof en=="function"?(jt--,en):n,wn&&Gc(Ne[0],Ne[1],wn)&&(en=jt<3?n:en,jt=1),Y=Ns(Y);++Ze<jt;){var Ln=Ne[Ze];Ln&&B(Y,Ln,Ze,en)}return Y})}function Ld(B,Y){return function(Ne,Ze){if(Ne==null)return Ne;if(!$d(Ne))return B(Ne,Ze);for(var jt=Ne.length,en=Y?jt:-1,wn=Ns(Ne);(Y?en--:++en<jt)&&Ze(wn[en],en,wn)!==!1;);return Ne}}function A6(B){return function(Y,Ne,Ze){for(var jt=-1,en=Ns(Y),wn=Ze(Y),Ln=wn.length;Ln--;){var Jn=wn[B?Ln:++jt];if(Ne(en[Jn],Jn,en)===!1)break}return Y}}function _6(B,Y,Ne){var Ze=Y&C,jt=cb(B);function en(){var wn=this&&this!==mr&&this instanceof en?jt:B;return wn.apply(Ze?Ne:this,arguments)}return en}function uA(B){return function(Y){Y=Ia(Y);var Ne=Yo(Y)?Z(Y):n,Ze=Ne?Ne[0]:Y.charAt(0),jt=Ne?Fp(Ne,1).join(""):Y.slice(1);return Ze[B]()+jt}}function Mx(B){return function(Y){return ei(Yfe(Kfe(Y).replace(dr,"")),B,"")}}function cb(B){return function(){var Y=arguments;switch(Y.length){case 0:return new B;case 1:return new B(Y[0]);case 2:return new B(Y[0],Y[1]);case 3:return new B(Y[0],Y[1],Y[2]);case 4:return new B(Y[0],Y[1],Y[2],Y[3]);case 5:return new B(Y[0],Y[1],Y[2],Y[3],Y[4]);case 6:return new B(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);case 7:return new B(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5],Y[6])}var Ne=Q1(B.prototype),Ze=B.apply(Ne,Y);return Ho(Ze)?Ze:Ne}}function dA(B,Y,Ne){var Ze=cb(B);function jt(){for(var en=arguments.length,wn=Jt(en),Ln=en,Jn=Op(jt);Ln--;)wn[Ln]=arguments[Ln];var Mr=en<3&&wn[0]!==Jn&&wn[en-1]!==Jn?[]:wt(wn,Jn);if(en-=Mr.length,en<Ne)return qc(B,Y,ub,jt.placeholder,n,wn,Mr,n,n,Ne-en);var Rr=this&&this!==mr&&this instanceof jt?Ze:B;return fr(Rr,this,wn)}return jt}function Rx(B){return function(Y,Ne,Ze){var jt=Ns(Y);if(!$d(Y)){var en=Ys(Ne,3);Y=Sc(Y),Ne=function(Ln){return en(jt[Ln],Ln,jt)}}var wn=B(Y,Ne,Ze);return wn>-1?jt[en?Y[wn]:wn]:n}}function E6(B){return wh(function(Y){var Ne=Y.length,Ze=Ne,jt=gc.prototype.thru;for(B&&Y.reverse();Ze--;){var en=Y[Ze];if(typeof en!="function")throw new ro(o);if(jt&&!wn&&db(en)=="wrapper")var wn=new gc([],!0)}for(Ze=wn?Ze:Ne;++Ze<Ne;){en=Y[Ze];var Ln=db(en),Jn=Ln=="wrapper"?I6(en):n;Jn&&pv(Jn[0])&&Jn[1]==(L|P|F|z)&&!Jn[4].length&&Jn[9]==1?wn=wn[db(Jn[0])].apply(wn,Jn[3]):wn=en.length==1&&pv(en)?wn[Ln]():wn.thru(en)}return function(){var Mr=arguments,Rr=Mr[0];if(wn&&Mr.length==1&&_i(Rr))return wn.plant(Rr).value();for(var Hr=0,ds=Ne?Y[Hr].apply(this,Mr):Rr;++Hr<Ne;)ds=Y[Hr].call(this,ds);return ds}})}function ub(B,Y,Ne,Ze,jt,en,wn,Ln,Jn,Mr){var Rr=Y&L,Hr=Y&C,ds=Y&N,Ds=Y&(P|M),ni=Y&Q,Li=ds?n:cb(B);function ri(){for(var Yi=arguments.length,Ji=Jt(Yi),Of=Yi;Of--;)Ji[Of]=arguments[Of];if(Ds)var Zu=Op(ri),Mf=pc(Ji,Zu);if(Ze&&(Ji=MI(Ji,Ze,jt,Ds)),en&&(Ji=cA(Ji,en,wn,Ds)),Yi-=Mf,Ds&&Yi<Mr){var bl=wt(Ji,Zu);return qc(B,Y,ub,ri.placeholder,Ne,Ji,bl,Ln,Jn,Mr-Yi)}var Dp=Hr?Ne:this,Vx=ds?Dp[B]:B;return Yi=Ji.length,Ln?Ji=Ef(Ji,Ln):ni&&Yi>1&&Ji.reverse(),Rr&&Jn<Yi&&(Ji.length=Jn),this&&this!==mr&&this instanceof ri&&(Vx=Li||cb(Vx)),Vx.apply(Dp,Ji)}return ri}function RI(B,Y){return function(Ne,Ze){return kp(Ne,B,Y(Ze),{})}}function ov(B,Y){return function(Ne,Ze){var jt;if(Ne===n&&Ze===n)return Y;if(Ne!==n&&(jt=Ne),Ze!==n){if(jt===n)return Ze;typeof Ne=="string"||typeof Ze=="string"?(Ne=gu(Ne),Ze=gu(Ze)):(Ne=sA(Ne),Ze=sA(Ze)),jt=B(Ne,Ze)}return jt}}function k6(B){return wh(function(Y){return Y=nr(Y,bs(Ys())),Mi(function(Ne){var Ze=this;return B(Y,function(jt){return fr(jt,Ze,Ne)})})})}function lv(B,Y){Y=Y===n?" ":gu(Y);var Ne=Y.length;if(Ne<2)return Ne?Fx(Y,B):Y;var Ze=Fx(Y,Nx(B/H(Y)));return Yo(Y)?Fp(Z(Ze),0,B).join(""):Ze.slice(0,B)}function LI(B,Y,Ne,Ze){var jt=Y&C,en=cb(B);function wn(){for(var Ln=-1,Jn=arguments.length,Mr=-1,Rr=Ze.length,Hr=Jt(Rr+Jn),ds=this&&this!==mr&&this instanceof wn?en:B;++Mr<Rr;)Hr[Mr]=Ze[Mr];for(;Jn--;)Hr[Mr++]=arguments[++Ln];return fr(ds,jt?Ne:this,Hr)}return wn}function fA(B){return function(Y,Ne,Ze){return Ze&&typeof Ze!="number"&&Gc(Y,Ne,Ze)&&(Ne=Ze=n),Y=Hx(Y),Ne===n?(Ne=Y,Y=0):Ne=Hx(Ne),Ze=Ze===n?Y<Ne?1:-1:Hx(Ze),rv(Y,Ne,Ze,B)}}function T6(B){return function(Y,Ne){return typeof Y=="string"&&typeof Ne=="string"||(Y=Sh(Y),Ne=Sh(Ne)),B(Y,Ne)}}function qc(B,Y,Ne,Ze,jt,en,wn,Ln,Jn,Mr){var Rr=Y&P,Hr=Rr?wn:n,ds=Rr?n:wn,Ds=Rr?en:n,ni=Rr?n:en;Y|=Rr?F:$,Y&=~(Rr?$:F),Y&I||(Y&=-4);var Li=[B,Y,jt,Ds,Hr,ni,ds,Ln,Jn,Mr],ri=Ne.apply(n,Li);return pv(B)&&CA(ri,Li),ri.placeholder=Ze,SA(ri,B,Y)}function Jl(B){var Y=Ar[B];return function(Ne,Ze){if(Ne=Sh(Ne),Ze=Ze==null?0:xc(Ri(Ze),292),Ze&&q1(Ne)){var jt=(Ia(Ne)+"e").split("e"),en=Y(jt[0]+"e"+(+jt[1]+Ze));return jt=(Ia(en)+"e").split("e"),+(jt[0]+"e"+(+jt[1]-Ze))}return Y(Ne)}}var DI=Bm&&1/w(new Bm([,-0]))[1]==ae?function(B){return new Bm(B)}:fH;function hA(B){return function(Y){var Ne=ec(Y);return Ne==rt?wi(Y):Ne==St?E(Y):as(Y,B(Y))}}function vh(B,Y,Ne,Ze,jt,en,wn,Ln){var Jn=Y&N;if(!Jn&&typeof B!="function")throw new ro(o);var Mr=Ze?Ze.length:0;if(Mr||(Y&=-97,Ze=jt=n),wn=wn===n?wn:Qo(Ri(wn),0),Ln=Ln===n?Ln:Ri(Ln),Mr-=jt?jt.length:0,Y&$){var Rr=Ze,Hr=jt;Ze=jt=n}var ds=Jn?n:I6(B),Ds=[B,Y,Ne,Ze,jt,Rr,Hr,en,wn,Ln];if(ds&&VI(Ds,ds),B=Ds[0],Y=Ds[1],Ne=Ds[2],Ze=Ds[3],jt=Ds[4],Ln=Ds[9]=Ds[9]===n?Jn?0:B.length:Qo(Ds[9]-Mr,0),!Ln&&Y&(P|M)&&(Y&=-25),!Y||Y==C)var ni=_6(B,Y,Ne);else Y==P||Y==M?ni=dA(B,Y,Ln):(Y==F||Y==(C|F))&&!jt.length?ni=LI(B,Y,Ne,Ze):ni=ub.apply(n,Ds);var Li=ds?y6:CA;return SA(Li(ni,Ds),B,Y)}function pA(B,Y,Ne,Ze){return B===n||Lp(B,Ta[Ne])&&!Oi.call(Ze,Ne)?Y:B}function mA(B,Y,Ne,Ze,jt,en){return Ho(B)&&Ho(Y)&&(en.set(Y,B),Px(B,Y,n,mA,en),en.delete(Y)),B}function xA(B){return BA(B)?n:B}function gA(B,Y,Ne,Ze,jt,en){var wn=Ne&y,Ln=B.length,Jn=Y.length;if(Ln!=Jn&&!(wn&&Jn>Ln))return!1;var Mr=en.get(B),Rr=en.get(Y);if(Mr&&Rr)return Mr==Y&&Rr==B;var Hr=-1,ds=!0,Ds=Ne&v?new Ax:n;for(en.set(B,Y),en.set(Y,B);++Hr<Ln;){var ni=B[Hr],Li=Y[Hr];if(Ze)var ri=wn?Ze(Li,ni,Hr,Y,B,en):Ze(ni,Li,Hr,B,Y,en);if(ri!==n){if(ri)continue;ds=!1;break}if(Ds){if(!Fr(Y,function(Yi,Ji){if(!zs(Ds,Ji)&&(ni===Yi||jt(ni,Yi,Ne,Ze,en)))return Ds.push(Ji)})){ds=!1;break}}else if(!(ni===Li||jt(ni,Li,Ne,Ze,en))){ds=!1;break}}return en.delete(B),en.delete(Y),ds}function bA(B,Y,Ne,Ze,jt,en,wn){switch(Ne){case nt:if(B.byteLength!=Y.byteLength||B.byteOffset!=Y.byteOffset)return!1;B=B.buffer,Y=Y.buffer;case rn:return!(B.byteLength!=Y.byteLength||!en(new V2(B),new V2(Y)));case je:case Oe:case st:return Lp(+B,+Y);case Ye:return B.name==Y.name&&B.message==Y.message;case Qt:case on:return B==Y+"";case rt:var Ln=wi;case St:var Jn=Ze&y;if(Ln||(Ln=w),B.size!=Y.size&&!Jn)return!1;var Mr=wn.get(B);if(Mr)return Mr==Y;Ze|=v,wn.set(B,Y);var Rr=gA(Ln(B),Ln(Y),Ze,jt,en,wn);return wn.delete(B),Rr;case cn:if(Gu)return Gu.call(B)==Gu.call(Y)}return!1}function BI(B,Y,Ne,Ze,jt,en){var wn=Ne&y,Ln=cv(B),Jn=Ln.length,Mr=cv(Y),Rr=Mr.length;if(Jn!=Rr&&!wn)return!1;for(var Hr=Jn;Hr--;){var ds=Ln[Hr];if(!(wn?ds in Y:Oi.call(Y,ds)))return!1}var Ds=en.get(B),ni=en.get(Y);if(Ds&&ni)return Ds==Y&&ni==B;var Li=!0;en.set(B,Y),en.set(Y,B);for(var ri=wn;++Hr<Jn;){ds=Ln[Hr];var Yi=B[ds],Ji=Y[ds];if(Ze)var Of=wn?Ze(Ji,Yi,ds,Y,B,en):Ze(Yi,Ji,ds,B,Y,en);if(!(Of===n?Yi===Ji||jt(Yi,Ji,Ne,Ze,en):Of)){Li=!1;break}ri||(ri=ds=="constructor")}if(Li&&!ri){var Zu=B.constructor,Mf=Y.constructor;Zu!=Mf&&"constructor"in B&&"constructor"in Y&&!(typeof Zu=="function"&&Zu instanceof Zu&&typeof Mf=="function"&&Mf instanceof Mf)&&(Li=!1)}return en.delete(B),en.delete(Y),Li}function wh(B){return Xu(M6(B,n,D6),B+"")}function cv(B){return h6(B,Sc,_f)}function uv(B){return h6(B,Ud,$I)}var I6=s6?function(B){return s6.get(B)}:fH;function db(B){for(var Y=B.name+"",Ne=Y1[Y],Ze=Oi.call(Y1,Y)?Ne.length:0;Ze--;){var jt=Ne[Ze],en=jt.func;if(en==null||en==B)return jt.name}return Y}function Op(B){var Y=Oi.call(Wt,"placeholder")?Wt:B;return Y.placeholder}function Ys(){var B=Wt.iteratee||uH;return B=B===uH?rb:B,arguments.length?B(arguments[0],arguments[1]):B}function dv(B,Y){var Ne=B.__data__;return fb(Y)?Ne[typeof Y=="string"?"string":"hash"]:Ne.map}function fv(B){for(var Y=Sc(B),Ne=Y.length;Ne--;){var Ze=Y[Ne],jt=B[Ze];Y[Ne]=[Ze,jt,mv(jt)]}return Y}function Km(B,Y){var Ne=Sa(B,Y);return X8(Ne)?Ne:n}function P6(B){var Y=Oi.call(B,Sx),Ne=B[Sx];try{B[Sx]=n;var Ze=!0}catch{}var jt=z2.call(B);return Ze&&(Y?B[Sx]=Ne:delete B[Sx]),jt}var _f=t6?function(B){return B==null?[]:(B=Ns(B),is(t6(B),function(Y){return J5.call(B,Y)}))}:hH,$I=t6?function(B){for(var Y=[];B;)gs(Y,_f(B)),B=Nf(B);return Y}:hH,ec=Zl;(G2&&ec(new G2(new ArrayBuffer(1)))!=nt||jx&&ec(new jx)!=rt||K2&&ec(K2.resolve())!=bt||Bm&&ec(new Bm)!=St||Y2&&ec(new Y2)!=tn)&&(ec=function(B){var Y=Zl(B),Ne=Y==Ve?B.constructor:n,Ze=Ne?Ym(Ne):"";if(Ze)switch(Ze){case V8:return nt;case $m:return rt;case yI:return bt;case X1:return St;case uh:return tn}return Y});function yA(B,Y,Ne){for(var Ze=-1,jt=Ne.length;++Ze<jt;){var en=Ne[Ze],wn=en.size;switch(en.type){case"drop":B+=wn;break;case"dropRight":Y-=wn;break;case"take":Y=xc(Y,B+wn);break;case"takeRight":B=Qo(B,Y-wn);break}}return{start:B,end:Y}}function UI(B){var Y=B.match(Ae);return Y?Y[1].split(ze):[]}function vA(B,Y,Ne){Y=yh(Y,B);for(var Ze=-1,jt=Y.length,en=!1;++Ze<jt;){var wn=Tf(Y[Ze]);if(!(en=B!=null&&Ne(B,wn)))break;B=B[wn]}return en||++Ze!=jt?en:(jt=B==null?0:B.length,!!jt&&oP(jt)&&ao(wn,jt)&&(_i(B)||Sv(B)))}function hv(B){var Y=B.length,Ne=new B.constructor(Y);return Y&&typeof B[0]=="string"&&Oi.call(B,"index")&&(Ne.index=B.index,Ne.input=B.input),Ne}function tc(B){return typeof B.constructor=="function"&&!Mp(B)?Q1(Nf(B)):{}}function Uz(B,Y,Ne){var Ze=B.constructor;switch(Y){case rn:return av(B);case je:case Oe:return new Ze(+B);case nt:return II(B,Ne);case it:case Ut:case hn:case nn:case Vt:case pt:case We:case It:case Ge:return OI(B,Ne);case rt:return new Ze;case st:case on:return new Ze(B);case Qt:return PI(B);case St:return new Ze;case cn:return FI(B)}}function zz(B,Y){var Ne=Y.length;if(!Ne)return B;var Ze=Ne-1;return Y[Ze]=(Ne>1?"& ":"")+Y[Ze],Y=Y.join(Ne>2?", ":" "),B.replace(qe,`{
/* [wrapped with `+Y+`] */
`)}function F6(B){return _i(B)||Sv(B)||!!(xI&&B&&B[xI])}function ao(B,Y){var Ne=typeof B;return Y=Y??q,!!Y&&(Ne=="number"||Ne!="symbol"&&Nn.test(B))&&B>-1&&B%1==0&&B<Y}function Gc(B,Y,Ne){if(!Ho(Ne))return!1;var Ze=typeof Y;return(Ze=="number"?$d(Ne)&&ao(Y,Ne.length):Ze=="string"&&Y in Ne)?Lp(Ne[Y],B):!1}function vs(B,Y){if(_i(B))return!1;var Ne=typeof B;return Ne=="number"||Ne=="symbol"||Ne=="boolean"||B==null||Ff(B)?!0:Xn.test(B)||!Yn.test(B)||Y!=null&&B in Ns(Y)}function fb(B){var Y=typeof B;return Y=="string"||Y=="number"||Y=="symbol"||Y=="boolean"?B!=="__proto__":B===null}function pv(B){var Y=db(B),Ne=Wt[Y];if(typeof Ne!="function"||!(Y in Ai.prototype))return!1;if(B===Ne)return!0;var Ze=I6(Ne);return!!Ze&&B===Ze[0]}function zI(B){return!!W1&&W1 in B}var Hz=Xo?zx:pH;function Mp(B){var Y=B&&B.constructor,Ne=typeof Y=="function"&&Y.prototype||Ta;return B===Ne}function mv(B){return B===B&&!Ho(B)}function O6(B,Y){return function(Ne){return Ne==null?!1:Ne[B]===Y&&(Y!==n||B in Ns(Ne))}}function HI(B){var Y=Qr(B,function(Ze){return Ne.size===u&&Ne.clear(),Ze}),Ne=Y.cache;return Y}function VI(B,Y){var Ne=B[1],Ze=Y[1],jt=Ne|Ze,en=jt<(C|N|L),wn=Ze==L&&Ne==P||Ze==L&&Ne==z&&B[7].length<=Y[8]||Ze==(L|z)&&Y[7].length<=Y[8]&&Ne==P;if(!(en||wn))return B;Ze&C&&(B[2]=Y[2],jt|=Ne&C?0:I);var Ln=Y[3];if(Ln){var Jn=B[3];B[3]=Jn?MI(Jn,Ln,Y[4]):Ln,B[4]=Jn?wt(B[3],d):Y[4]}return Ln=Y[5],Ln&&(Jn=B[5],B[5]=Jn?cA(Jn,Ln,Y[6]):Ln,B[6]=Jn?wt(B[5],d):Y[6]),Ln=Y[7],Ln&&(B[7]=Ln),Ze&L&&(B[8]=B[8]==null?Y[8]:xc(B[8],Y[8])),B[9]==null&&(B[9]=Y[9]),B[0]=Y[0],B[1]=jt,B}function WI(B){var Y=[];if(B!=null)for(var Ne in Ns(B))Y.push(Ne);return Y}function wA(B){return z2.call(B)}function M6(B,Y,Ne){return Y=Qo(Y===n?B.length-1:Y,0),function(){for(var Ze=arguments,jt=-1,en=Qo(Ze.length-Y,0),wn=Jt(en);++jt<en;)wn[jt]=Ze[Y+jt];jt=-1;for(var Ln=Jt(Y+1);++jt<Y;)Ln[jt]=Ze[jt];return Ln[Y]=Ne(wn),fr(B,this,Ln)}}function Fl(B,Y){return Y.length<2?B:Ep(B,Cc(Y,0,-1))}function Ef(B,Y){for(var Ne=B.length,Ze=xc(Y.length,Ne),jt=Wc(B);Ze--;){var en=Y[Ze];B[Ze]=ao(en,Ne)?jt[en]:n}return B}function Ch(B,Y){if(!(Y==="constructor"&&typeof B[Y]=="function")&&Y!="__proto__")return B[Y]}var CA=kf(y6),hb=z8||function(B,Y){return mr.setTimeout(B,Y)},Xu=kf(bh);function SA(B,Y,Ne){var Ze=Y+"";return Xu(B,zz(Ze,qI(UI(Ze),Ne)))}function kf(B){var Y=0,Ne=0;return function(){var Ze=Dz(),jt=re-(Ze-Ne);if(Ne=Ze,jt>0){if(++Y>=K)return arguments[0]}else Y=0;return B.apply(n,arguments)}}function R6(B,Y){var Ne=-1,Ze=B.length,jt=Ze-1;for(Y=Y===n?Ze:Y;++Ne<Y;){var en=sb(Ne,jt),wn=B[en];B[en]=B[Ne],B[Ne]=wn}return B.length=Y,B}var NA=HI(function(B){var Y=[];return B.charCodeAt(0)===46&&Y.push(""),B.replace(zn,function(Ne,Ze,jt,en){Y.push(jt?en.replace(gt,"$1"):Ze||Ne)}),Y});function Tf(B){if(typeof B=="string"||Ff(B))return B;var Y=B+"";return Y=="0"&&1/B==-1/0?"-0":Y}function Ym(B){if(B!=null){try{return kd.call(B)}catch{}try{return B+""}catch{}}return""}function qI(B,Y){return pr(xe,function(Ne){var Ze="_."+Ne[0];Y&Ne[1]&&!Pr(B,Ze)&&B.push(Ze)}),B.sort()}function GI(B){if(B instanceof Ai)return B.clone();var Y=new gc(B.__wrapped__,B.__chain__);return Y.__actions__=Wc(B.__actions__),Y.__index__=B.__index__,Y.__values__=B.__values__,Y}function L6(B,Y,Ne){(Ne?Gc(B,Y,Ne):Y===n)?Y=1:Y=Qo(Ri(Y),0);var Ze=B==null?0:B.length;if(!Ze||Y<1)return[];for(var jt=0,en=0,wn=Jt(Nx(Ze/Y));jt<Ze;)wn[en++]=Cc(B,jt,jt+=Y);return wn}function jA(B){for(var Y=-1,Ne=B==null?0:B.length,Ze=0,jt=[];++Y<Ne;){var en=B[Y];en&&(jt[Ze++]=en)}return jt}function Dd(){var B=arguments.length;if(!B)return[];for(var Y=Jt(B-1),Ne=arguments[0],Ze=B;Ze--;)Y[Ze-1]=arguments[Ze];return gs(_i(Ne)?Wc(Ne):[Ne],ko(Y,1))}var Zi=Mi(function(B,Y){return gl(B)?mh(B,ko(Y,1,gl,!0)):[]}),Ol=Mi(function(B,Y){var Ne=Kc(Y);return gl(Ne)&&(Ne=n),gl(B)?mh(B,ko(Y,1,gl,!0),Ys(Ne,2)):[]}),Zo=Mi(function(B,Y){var Ne=Kc(Y);return gl(Ne)&&(Ne=n),gl(B)?mh(B,ko(Y,1,gl,!0),n,Ne):[]});function nc(B,Y,Ne){var Ze=B==null?0:B.length;return Ze?(Y=Ne||Y===n?1:Ri(Y),Cc(B,Y<0?0:Y,Ze)):[]}function Qu(B,Y,Ne){var Ze=B==null?0:B.length;return Ze?(Y=Ne||Y===n?1:Ri(Y),Y=Ze-Y,Cc(B,0,Y<0?0:Y)):[]}function pb(B,Y){return B&&B.length?sv(B,Ys(Y,3),!0,!0):[]}function ml(B,Y){return B&&B.length?sv(B,Ys(Y,3),!0):[]}function xv(B,Y,Ne,Ze){var jt=B==null?0:B.length;return jt?(Ne&&typeof Ne!="number"&&Gc(B,Y,Ne)&&(Ne=0,Ze=jt),_I(B,Y,Ne,Ze)):[]}function Xm(B,Y,Ne){var Ze=B==null?0:B.length;if(!Ze)return-1;var jt=Ne==null?0:Ri(Ne);return jt<0&&(jt=Qo(Ze+jt,0)),sr(B,Ys(Y,3),jt)}function gv(B,Y,Ne){var Ze=B==null?0:B.length;if(!Ze)return-1;var jt=Ze-1;return Ne!==n&&(jt=Ri(Ne),jt=Ne<0?Qo(Ze+jt,0):xc(jt,Ze-1)),sr(B,Ys(Y,3),jt,!0)}function D6(B){var Y=B==null?0:B.length;return Y?ko(B,1):[]}function bv(B){var Y=B==null?0:B.length;return Y?ko(B,ae):[]}function bu(B,Y){var Ne=B==null?0:B.length;return Ne?(Y=Y===n?1:Ri(Y),ko(B,Y)):[]}function AA(B){for(var Y=-1,Ne=B==null?0:B.length,Ze={};++Y<Ne;){var jt=B[Y];Ze[jt[0]]=jt[1]}return Ze}function Lx(B){return B&&B.length?B[0]:n}function Rp(B,Y,Ne){var Ze=B==null?0:B.length;if(!Ze)return-1;var jt=Ne==null?0:Ri(Ne);return jt<0&&(jt=Qo(Ze+jt,0)),Zn(B,Y,jt)}function B6(B){var Y=B==null?0:B.length;return Y?Cc(B,0,-1):[]}var _A=Mi(function(B){var Y=nr(B,ob);return Y.length&&Y[0]===B[0]?p6(Y):[]}),Qm=Mi(function(B){var Y=Kc(B),Ne=nr(B,ob);return Y===Kc(Ne)?Y=n:Ne.pop(),Ne.length&&Ne[0]===B[0]?p6(Ne,Ys(Y,2)):[]}),$6=Mi(function(B){var Y=Kc(B),Ne=nr(B,ob);return Y=typeof Y=="function"?Y:n,Y&&Ne.pop(),Ne.length&&Ne[0]===B[0]?p6(Ne,n,Y):[]});function Zm(B,Y){return B==null?"":n6.call(B,Y)}function Kc(B){var Y=B==null?0:B.length;return Y?B[Y-1]:n}function yv(B,Y,Ne){var Ze=B==null?0:B.length;if(!Ze)return-1;var jt=Ze;return Ne!==n&&(jt=Ri(Ne),jt=jt<0?Qo(Ze+jt,0):xc(jt,Ze-1)),Y===Y?U(B,Y,jt):sr(B,Ir,jt,!0)}function EA(B,Y){return B&&B.length?b6(B,Ri(Y)):n}var U6=Mi(vv);function vv(B,Y){return B&&B.length&&Y&&Y.length?zo(B,Y):B}function Yc(B,Y,Ne){return B&&B.length&&Y&&Y.length?zo(B,Y,Ys(Ne,2)):B}function Jm(B,Y,Ne){return B&&B.length&&Y&&Y.length?zo(B,Y,n,Ne):B}var If=wh(function(B,Y){var Ne=B==null?0:B.length,Ze=d6(B,Y);return pl(B,nr(Y,function(jt){return ao(jt,Ne)?+jt:jt}).sort(lA)),Ze});function yu(B,Y){var Ne=[];if(!(B&&B.length))return Ne;var Ze=-1,jt=[],en=B.length;for(Y=Ys(Y,3);++Ze<en;){var wn=B[Ze];Y(wn,Ze,B)&&(Ne.push(wn),jt.push(Ze))}return pl(B,jt),Ne}function z6(B){return B==null?B:r6.call(B)}function kA(B,Y,Ne){var Ze=B==null?0:B.length;return Ze?(Ne&&typeof Ne!="number"&&Gc(B,Y,Ne)?(Y=0,Ne=Ze):(Y=Y==null?0:Ri(Y),Ne=Ne===n?Ze:Ri(Ne)),Cc(B,Y,Ne)):[]}function TA(B,Y){return ib(B,Y)}function Vz(B,Y,Ne){return v6(B,Y,Ys(Ne,2))}function e0(B,Y){var Ne=B==null?0:B.length;if(Ne){var Ze=ib(B,Y);if(Ze<Ne&&Lp(B[Ze],Y))return Ze}return-1}function KI(B,Y){return ib(B,Y,!0)}function IA(B,Y,Ne){return v6(B,Y,Ys(Ne,2),!0)}function Dx(B,Y){var Ne=B==null?0:B.length;if(Ne){var Ze=ib(B,Y,!0)-1;if(Lp(B[Ze],Y))return Ze}return-1}function PA(B){return B&&B.length?rA(B):[]}function Bx(B,Y){return B&&B.length?rA(B,Ys(Y,2)):[]}function YI(B){var Y=B==null?0:B.length;return Y?Cc(B,1,Y):[]}function XI(B,Y,Ne){return B&&B.length?(Y=Ne||Y===n?1:Ri(Y),Cc(B,0,Y<0?0:Y)):[]}function FA(B,Y,Ne){var Ze=B==null?0:B.length;return Ze?(Y=Ne||Y===n?1:Ri(Y),Y=Ze-Y,Cc(B,Y<0?0:Y,Ze)):[]}function H6(B,Y){return B&&B.length?sv(B,Ys(Y,3),!1,!0):[]}function Wz(B,Y){return B&&B.length?sv(B,Ys(Y,3)):[]}var qz=Mi(function(B){return Pp(ko(B,1,gl,!0))}),QI=Mi(function(B){var Y=Kc(B);return gl(Y)&&(Y=n),Pp(ko(B,1,gl,!0),Ys(Y,2))}),ZI=Mi(function(B){var Y=Kc(B);return Y=typeof Y=="function"?Y:n,Pp(ko(B,1,gl,!0),n,Y)});function $x(B){return B&&B.length?Pp(B):[]}function Gz(B,Y){return B&&B.length?Pp(B,Ys(Y,2)):[]}function mb(B,Y){return Y=typeof Y=="function"?Y:n,B&&B.length?Pp(B,n,Y):[]}function V6(B){if(!(B&&B.length))return[];var Y=0;return B=is(B,function(Ne){if(gl(Ne))return Y=Qo(Ne.length,Y),!0}),us(Y,function(Ne){return nr(B,Ls(Ne))})}function yo(B,Y){if(!(B&&B.length))return[];var Ne=V6(B);return Y==null?Ne:nr(Ne,function(Ze){return fr(Y,n,Ze)})}var Kz=Mi(function(B,Y){return gl(B)?mh(B,Y):[]}),JI=Mi(function(B){return C6(is(B,gl))}),Yz=Mi(function(B){var Y=Kc(B);return gl(Y)&&(Y=n),C6(is(B,gl),Ys(Y,2))}),Xz=Mi(function(B){var Y=Kc(B);return Y=typeof Y=="function"?Y:n,C6(is(B,gl),n,Y)}),eP=Mi(V6);function tP(B,Y){return iv(B||[],Y||[],kx)}function Qz(B,Y){return iv(B||[],Y||[],Ox)}var Bd=Mi(function(B){var Y=B.length,Ne=Y>1?B[Y-1]:n;return Ne=typeof Ne=="function"?(B.pop(),Ne):n,yo(B,Ne)});function W6(B){var Y=Wt(B);return Y.__chain__=!0,Y}function Zz(B,Y){return Y(B),B}function Pf(B,Y){return Y(B)}var q6=wh(function(B){var Y=B.length,Ne=Y?B[0]:0,Ze=this.__wrapped__,jt=function(en){return d6(en,B)};return Y>1||this.__actions__.length||!(Ze instanceof Ai)||!ao(Ne)?this.thru(jt):(Ze=Ze.slice(Ne,+Ne+(Y?1:0)),Ze.__actions__.push({func:Pf,args:[jt],thisArg:n}),new gc(Ze,this.__chain__).thru(function(en){return Y&&!en.length&&en.push(n),en}))});function Ux(){return W6(this)}function G6(){return new gc(this.value(),this.__chain__)}function OA(){this.__values__===n&&(this.__values__=Bfe(this.value()));var B=this.__index__>=this.__values__.length,Y=B?n:this.__values__[this.__index__++];return{done:B,value:Y}}function MA(){return this}function Jz(B){for(var Y,Ne=this;Ne instanceof dh;){var Ze=GI(Ne);Ze.__index__=0,Ze.__values__=n,Y?jt.__wrapped__=Ze:Y=Ze;var jt=Ze;Ne=Ne.__wrapped__}return jt.__wrapped__=B,Y}function RA(){var B=this.__wrapped__;if(B instanceof Ai){var Y=B;return this.__actions__.length&&(Y=new Ai(this)),Y=Y.reverse(),Y.__actions__.push({func:Pf,args:[z6],thisArg:n}),new gc(Y,this.__chain__)}return this.thru(z6)}function eH(){return ab(this.__wrapped__,this.__actions__)}var nP=j6(function(B,Y,Ne){Oi.call(B,Ne)?++B[Ne]:ph(B,Ne,1)});function rP(B,Y,Ne){var Ze=_i(B)?Xr:Z2;return Ne&&Gc(B,Y,Ne)&&(Y=n),Ze(B,Ys(Y,3))}function K6(B,Y){var Ne=_i(B)?is:K8;return Ne(B,Ys(Y,3))}var Y6=Rx(Xm),sP=Rx(gv);function LA(B,Y){return ko(J6(B,Y),1)}function iP(B,Y){return ko(J6(B,Y),ae)}function DA(B,Y,Ne){return Ne=Ne===n?1:Ri(Ne),ko(J6(B,Y),Ne)}function wv(B,Y){var Ne=_i(B)?pr:xh;return Ne(B,Ys(Y,3))}function X6(B,Y){var Ne=_i(B)?hr:AI;return Ne(B,Ys(Y,3))}var Q6=j6(function(B,Y,Ne){Oi.call(B,Ne)?B[Ne].push(Y):ph(B,Ne,[Y])});function aP(B,Y,Ne,Ze){B=$d(B)?B:nC(B),Ne=Ne&&!Ze?Ri(Ne):0;var jt=B.length;return Ne<0&&(Ne=Qo(jt+Ne,0)),lP(B)?Ne<=jt&&B.indexOf(Y,Ne)>-1:!!jt&&Zn(B,Y,Ne)>-1}var tH=Mi(function(B,Y,Ne){var Ze=-1,jt=typeof Y=="function",en=$d(B)?Jt(B.length):[];return xh(B,function(wn){en[++Ze]=jt?fr(Y,wn,Ne):Od(wn,Y,Ne)}),en}),Z6=j6(function(B,Y,Ne){ph(B,Ne,Y)});function J6(B,Y){var Ne=_i(B)?nr:Z8;return Ne(B,Ys(Y,3))}function Cv(B,Y,Ne,Ze){return B==null?[]:(_i(Y)||(Y=Y==null?[]:[Y]),Ne=Ze?n:Ne,_i(Ne)||(Ne=Ne==null?[]:[Ne]),nv(B,Y,Ne))}var nH=j6(function(B,Y,Ne){B[Ne?0:1].push(Y)},function(){return[[],[]]});function eC(B,Y,Ne){var Ze=_i(B)?ei:lr,jt=arguments.length<3;return Ze(B,Ys(Y,4),Ne,jt,xh)}function _(B,Y,Ne){var Ze=_i(B)?ci:lr,jt=arguments.length<3;return Ze(B,Ys(Y,4),Ne,jt,AI)}function R(B,Y){var Ne=_i(B)?is:K8;return Ne(B,Fs(Ys(Y,3)))}function J(B){var Y=_i(B)?hh:wc;return Y(B)}function be(B,Y,Ne){(Ne?Gc(B,Y,Ne):Y===n)?Y=1:Y=Ri(Y);var Ze=_i(B)?Ex:tA;return Ze(B,Y)}function Le(B){var Y=_i(B)?NI:Rd;return Y(B)}function Qe(B){if(B==null)return 0;if($d(B))return lP(B)?H(B):B.length;var Y=ec(B);return Y==rt||Y==St?B.size:Ip(B).length}function Ft(B,Y,Ne){var Ze=_i(B)?Fr:nA;return Ne&&Gc(B,Y,Ne)&&(Y=n),Ze(B,Ys(Y,3))}var bn=Mi(function(B,Y){if(B==null)return[];var Ne=Y.length;return Ne>1&&Gc(B,Y[0],Y[1])?Y=[]:Ne>2&&Gc(Y[0],Y[1],Y[2])&&(Y=[Y[0]]),nv(B,ko(Y,1),[])}),Mn=Ka||function(){return mr.Date.now()};function ur(B,Y){if(typeof Y!="function")throw new ro(o);return B=Ri(B),function(){if(--B<1)return Y.apply(this,arguments)}}function zr(B,Y,Ne){return Y=Ne?n:Y,Y=B&&Y==null?B.length:Y,vh(B,L,n,n,n,n,Y)}function Wr(B,Y){var Ne;if(typeof Y!="function")throw new ro(o);return B=Ri(B),function(){return--B>0&&(Ne=Y.apply(this,arguments)),B<=1&&(Y=n),Ne}}var Ur=Mi(function(B,Y,Ne){var Ze=C;if(Ne.length){var jt=wt(Ne,Op(Ur));Ze|=F}return vh(B,Ze,Y,Ne,jt)}),hs=Mi(function(B,Y,Ne){var Ze=C|N;if(Ne.length){var jt=wt(Ne,Op(hs));Ze|=F}return vh(Y,Ze,B,Ne,jt)});function js(B,Y,Ne){Y=Ne?n:Y;var Ze=vh(B,P,n,n,n,n,n,Y);return Ze.placeholder=js.placeholder,Ze}function Ps(B,Y,Ne){Y=Ne?n:Y;var Ze=vh(B,M,n,n,n,n,n,Y);return Ze.placeholder=Ps.placeholder,Ze}function To(B,Y,Ne){var Ze,jt,en,wn,Ln,Jn,Mr=0,Rr=!1,Hr=!1,ds=!0;if(typeof B!="function")throw new ro(o);Y=Sh(Y)||0,Ho(Ne)&&(Rr=!!Ne.leading,Hr="maxWait"in Ne,en=Hr?Qo(Sh(Ne.maxWait)||0,Y):en,ds="trailing"in Ne?!!Ne.trailing:ds);function Ds(bl){var Dp=Ze,Vx=jt;return Ze=jt=n,Mr=bl,wn=B.apply(Vx,Dp),wn}function ni(bl){return Mr=bl,Ln=hb(Yi,Y),Rr?Ds(bl):wn}function Li(bl){var Dp=bl-Jn,Vx=bl-Mr,Zfe=Y-Dp;return Hr?xc(Zfe,en-Vx):Zfe}function ri(bl){var Dp=bl-Jn,Vx=bl-Mr;return Jn===n||Dp>=Y||Dp<0||Hr&&Vx>=en}function Yi(){var bl=Mn();if(ri(bl))return Ji(bl);Ln=hb(Yi,Li(bl))}function Ji(bl){return Ln=n,ds&&Ze?Ds(bl):(Ze=jt=n,wn)}function Of(){Ln!==n&&aA(Ln),Mr=0,Ze=Jn=jt=Ln=n}function Zu(){return Ln===n?wn:Ji(Mn())}function Mf(){var bl=Mn(),Dp=ri(bl);if(Ze=arguments,jt=this,Jn=bl,Dp){if(Ln===n)return ni(Jn);if(Hr)return aA(Ln),Ln=hb(Yi,Y),Ds(Jn)}return Ln===n&&(Ln=hb(Yi,Y)),wn}return Mf.cancel=Of,Mf.flush=Zu,Mf}var rr=Mi(function(B,Y){return G8(B,1,Y)}),Hn=Mi(function(B,Y,Ne){return G8(B,Sh(Y)||0,Ne)});function or(B){return vh(B,Q)}function Qr(B,Y){if(typeof B!="function"||Y!=null&&typeof Y!="function")throw new ro(o);var Ne=function(){var Ze=arguments,jt=Y?Y.apply(this,Ze):Ze[0],en=Ne.cache;if(en.has(jt))return en.get(jt);var wn=B.apply(this,Ze);return Ne.cache=en.set(jt,wn)||en,wn};return Ne.cache=new(Qr.Cache||Td),Ne}Qr.Cache=Td;function Fs(B){if(typeof B!="function")throw new ro(o);return function(){var Y=arguments;switch(Y.length){case 0:return!B.call(this);case 1:return!B.call(this,Y[0]);case 2:return!B.call(this,Y[0],Y[1]);case 3:return!B.call(this,Y[0],Y[1],Y[2])}return!B.apply(this,Y)}}function qs(B){return Wr(2,B)}var Gs=TI(function(B,Y){Y=Y.length==1&&_i(Y[0])?nr(Y[0],bs(Ys())):nr(ko(Y,1),bs(Ys()));var Ne=Y.length;return Mi(function(Ze){for(var jt=-1,en=xc(Ze.length,Ne);++jt<en;)Ze[jt]=Y[jt].call(this,Ze[jt]);return fr(B,this,Ze)})}),Js=Mi(function(B,Y){var Ne=wt(Y,Op(Js));return vh(B,F,n,Y,Ne)}),xl=Mi(function(B,Y){var Ne=wt(Y,Op(xl));return vh(B,$,n,Y,Ne)}),ua=wh(function(B,Y){return vh(B,z,n,n,n,Y)});function t0(B,Y){if(typeof B!="function")throw new ro(o);return Y=Y===n?Y:Ri(Y),Mi(B,Y)}function rH(B,Y){if(typeof B!="function")throw new ro(o);return Y=Y==null?0:Qo(Ri(Y),0),Mi(function(Ne){var Ze=Ne[Y],jt=Fp(Ne,0,Y);return Ze&&gs(jt,Ze),fr(B,this,jt)})}function PKe(B,Y,Ne){var Ze=!0,jt=!0;if(typeof B!="function")throw new ro(o);return Ho(Ne)&&(Ze="leading"in Ne?!!Ne.leading:Ze,jt="trailing"in Ne?!!Ne.trailing:jt),To(B,Y,{leading:Ze,maxWait:Y,trailing:jt})}function FKe(B){return zr(B,1)}function OKe(B,Y){return Js(S6(Y),B)}function MKe(){if(!arguments.length)return[];var B=arguments[0];return _i(B)?B:[B]}function RKe(B){return xu(B,g)}function LKe(B,Y){return Y=typeof Y=="function"?Y:n,xu(B,g,Y)}function DKe(B){return xu(B,f|g)}function BKe(B,Y){return Y=typeof Y=="function"?Y:n,xu(B,f|g,Y)}function $Ke(B,Y){return Y==null||Q2(B,Y,Sc(Y))}function Lp(B,Y){return B===Y||B!==B&&Y!==Y}var UKe=T6(Wm),zKe=T6(function(B,Y){return B>=Y}),Sv=m6(function(){return arguments}())?m6:function(B){return Jo(B)&&Oi.call(B,"callee")&&!J5.call(B,"callee")},_i=Jt.isArray,HKe=me?bs(me):EI;function $d(B){return B!=null&&oP(B.length)&&!zx(B)}function gl(B){return Jo(B)&&$d(B)}function VKe(B){return B===!0||B===!1||Jo(B)&&Zl(B)==je}var xb=H8||pH,WKe=dt?bs(dt):Tp;function qKe(B){return Jo(B)&&B.nodeType===1&&!BA(B)}function GKe(B){if(B==null)return!0;if($d(B)&&(_i(B)||typeof B=="string"||typeof B.splice=="function"||xb(B)||tC(B)||Sv(B)))return!B.length;var Y=ec(B);if(Y==rt||Y==St)return!B.size;if(Mp(B))return!Ip(B).length;for(var Ne in B)if(Oi.call(B,Ne))return!1;return!0}function KKe(B,Y){return Md(B,Y)}function YKe(B,Y,Ne){Ne=typeof Ne=="function"?Ne:n;var Ze=Ne?Ne(B,Y):n;return Ze===n?Md(B,Y,n,Ne):!!Ze}function sH(B){if(!Jo(B))return!1;var Y=Zl(B);return Y==Ye||Y==$e||typeof B.message=="string"&&typeof B.name=="string"&&!BA(B)}function XKe(B){return typeof B=="number"&&q1(B)}function zx(B){if(!Ho(B))return!1;var Y=Zl(B);return Y==Je||Y==ht||Y==Ce||Y==xt}function Mfe(B){return typeof B=="number"&&B==Ri(B)}function oP(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=q}function Ho(B){var Y=typeof B;return B!=null&&(Y=="object"||Y=="function")}function Jo(B){return B!=null&&typeof B=="object"}var Rfe=_t?bs(_t):kI;function QKe(B,Y){return B===Y||nb(B,Y,fv(Y))}function ZKe(B,Y,Ne){return Ne=typeof Ne=="function"?Ne:n,nb(B,Y,fv(Y),Ne)}function JKe(B){return Lfe(B)&&B!=+B}function eYe(B){if(Hz(B))throw new xr(a);return X8(B)}function tYe(B){return B===null}function nYe(B){return B==null}function Lfe(B){return typeof B=="number"||Jo(B)&&Zl(B)==st}function BA(B){if(!Jo(B)||Zl(B)!=Ve)return!1;var Y=Nf(B);if(Y===null)return!0;var Ne=Oi.call(Y,"constructor")&&Y.constructor;return typeof Ne=="function"&&Ne instanceof Ne&&kd.call(Ne)==Q5}var iH=At?bs(At):ev;function rYe(B){return Mfe(B)&&B>=-9007199254740991&&B<=q}var Dfe=xn?bs(xn):gh;function lP(B){return typeof B=="string"||!_i(B)&&Jo(B)&&Zl(B)==on}function Ff(B){return typeof B=="symbol"||Jo(B)&&Zl(B)==cn}var tC=Cn?bs(Cn):tv;function sYe(B){return B===n}function iYe(B){return Jo(B)&&ec(B)==tn}function aYe(B){return Jo(B)&&Zl(B)==fn}var oYe=T6(qm),lYe=T6(function(B,Y){return B<=Y});function Bfe(B){if(!B)return[];if($d(B))return lP(B)?Z(B):Wc(B);if(jp&&B[jp])return Ql(B[jp]());var Y=ec(B),Ne=Y==rt?wi:Y==St?w:nC;return Ne(B)}function Hx(B){if(!B)return B===0?B:0;if(B=Sh(B),B===ae||B===-1/0){var Y=B<0?-1:1;return Y*W}return B===B?B:0}function Ri(B){var Y=Hx(B),Ne=Y%1;return Y===Y?Ne?Y-Ne:Y:0}function $fe(B){return B?_p(Ri(B),0,oe):0}function Sh(B){if(typeof B=="number")return B;if(Ff(B))return ne;if(Ho(B)){var Y=typeof B.valueOf=="function"?B.valueOf():B;B=Ho(Y)?Y+"":Y}if(typeof B!="string")return B===0?B:+B;B=xs(B);var Ne=Wn.test(B);return Ne||$t.test(B)?cr(B.slice(2),Ne?2:8):vn.test(B)?ne:+B}function Ufe(B){return Af(B,Ud(B))}function cYe(B){return B?_p(Ri(B),-9007199254740991,q):B===0?B:0}function Ia(B){return B==null?"":gu(B)}var uYe=lb(function(B,Y){if(Mp(Y)||$d(Y)){Af(Y,Sc(Y),B);return}for(var Ne in Y)Oi.call(Y,Ne)&&kx(B,Ne,Y[Ne])}),zfe=lb(function(B,Y){Af(Y,Ud(Y),B)}),cP=lb(function(B,Y,Ne,Ze){Af(Y,Ud(Y),B,Ze)}),dYe=lb(function(B,Y,Ne,Ze){Af(Y,Sc(Y),B,Ze)}),fYe=wh(d6);function hYe(B,Y){var Ne=Q1(B);return Y==null?Ne:Xa(Ne,Y)}var pYe=Mi(function(B,Y){B=Ns(B);var Ne=-1,Ze=Y.length,jt=Ze>2?Y[2]:n;for(jt&&Gc(Y[0],Y[1],jt)&&(Ze=1);++Ne<Ze;)for(var en=Y[Ne],wn=Ud(en),Ln=-1,Jn=wn.length;++Ln<Jn;){var Mr=wn[Ln],Rr=B[Mr];(Rr===n||Lp(Rr,Ta[Mr])&&!Oi.call(B,Mr))&&(B[Mr]=en[Mr])}return B}),mYe=Mi(function(B){return B.push(n,mA),fr(Hfe,n,B)});function xYe(B,Y){return Kt(B,Ys(Y,3),Yu)}function gYe(B,Y){return Kt(B,Ys(Y,3),Vm)}function bYe(B,Y){return B==null?B:f6(B,Ys(Y,3),Ud)}function yYe(B,Y){return B==null?B:J2(B,Ys(Y,3),Ud)}function vYe(B,Y){return B&&Yu(B,Ys(Y,3))}function wYe(B,Y){return B&&Vm(B,Ys(Y,3))}function CYe(B){return B==null?[]:tb(B,Sc(B))}function SYe(B){return B==null?[]:tb(B,Ud(B))}function aH(B,Y,Ne){var Ze=B==null?n:Ep(B,Y);return Ze===n?Ne:Ze}function NYe(B,Y){return B!=null&&vA(B,Y,Fd)}function oH(B,Y){return B!=null&&vA(B,Y,Ix)}var jYe=RI(function(B,Y,Ne){Y!=null&&typeof Y.toString!="function"&&(Y=z2.call(Y)),B[Y]=Ne},cH(zd)),AYe=RI(function(B,Y,Ne){Y!=null&&typeof Y.toString!="function"&&(Y=z2.call(Y)),Oi.call(B,Y)?B[Y].push(Ne):B[Y]=[Ne]},Ys),_Ye=Mi(Od);function Sc(B){return $d(B)?fh(B):Ip(B)}function Ud(B){return $d(B)?fh(B,!0):Q8(B)}function EYe(B,Y){var Ne={};return Y=Ys(Y,3),Yu(B,function(Ze,jt,en){ph(Ne,Y(Ze,jt,en),Ze)}),Ne}function kYe(B,Y){var Ne={};return Y=Ys(Y,3),Yu(B,function(Ze,jt,en){ph(Ne,jt,Y(Ze,jt,en))}),Ne}var TYe=lb(function(B,Y,Ne){Px(B,Y,Ne)}),Hfe=lb(function(B,Y,Ne,Ze){Px(B,Y,Ne,Ze)}),IYe=wh(function(B,Y){var Ne={};if(B==null)return Ne;var Ze=!1;Y=nr(Y,function(en){return en=yh(en,B),Ze||(Ze=en.length>1),en}),Af(B,uv(B),Ne),Ze&&(Ne=xu(Ne,f|x|g,xA));for(var jt=Y.length;jt--;)w6(Ne,Y[jt]);return Ne});function PYe(B,Y){return Vfe(B,Fs(Ys(Y)))}var FYe=wh(function(B,Y){return B==null?{}:eA(B,Y)});function Vfe(B,Y){if(B==null)return{};var Ne=nr(uv(B),function(Ze){return[Ze]});return Y=Ys(Y),Gm(B,Ne,function(Ze,jt){return Y(Ze,jt[0])})}function OYe(B,Y,Ne){Y=yh(Y,B);var Ze=-1,jt=Y.length;for(jt||(jt=1,B=n);++Ze<jt;){var en=B==null?n:B[Tf(Y[Ze])];en===n&&(Ze=jt,en=Ne),B=zx(en)?en.call(B):en}return B}function MYe(B,Y,Ne){return B==null?B:Ox(B,Y,Ne)}function RYe(B,Y,Ne,Ze){return Ze=typeof Ze=="function"?Ze:n,B==null?B:Ox(B,Y,Ne,Ze)}var Wfe=hA(Sc),qfe=hA(Ud);function LYe(B,Y,Ne){var Ze=_i(B),jt=Ze||xb(B)||tC(B);if(Y=Ys(Y,4),Ne==null){var en=B&&B.constructor;jt?Ne=Ze?new en:[]:Ho(B)?Ne=zx(en)?Q1(Nf(B)):{}:Ne={}}return(jt?pr:Yu)(B,function(wn,Ln,Jn){return Y(Ne,wn,Ln,Jn)}),Ne}function DYe(B,Y){return B==null?!0:w6(B,Y)}function BYe(B,Y,Ne){return B==null?B:iA(B,Y,S6(Ne))}function $Ye(B,Y,Ne,Ze){return Ze=typeof Ze=="function"?Ze:n,B==null?B:iA(B,Y,S6(Ne),Ze)}function nC(B){return B==null?[]:zi(B,Sc(B))}function UYe(B){return B==null?[]:zi(B,Ud(B))}function zYe(B,Y,Ne){return Ne===n&&(Ne=Y,Y=n),Ne!==n&&(Ne=Sh(Ne),Ne=Ne===Ne?Ne:0),Y!==n&&(Y=Sh(Y),Y=Y===Y?Y:0),_p(Sh(B),Y,Ne)}function HYe(B,Y,Ne){return Y=Hx(Y),Ne===n?(Ne=Y,Y=0):Ne=Hx(Ne),B=Sh(B),Y8(B,Y,Ne)}function VYe(B,Y,Ne){if(Ne&&typeof Ne!="boolean"&&Gc(B,Y,Ne)&&(Y=Ne=n),Ne===n&&(typeof Y=="boolean"?(Ne=Y,Y=n):typeof B=="boolean"&&(Ne=B,B=n)),B===n&&Y===n?(B=0,Y=1):(B=Hx(B),Y===n?(Y=B,B=0):Y=Hx(Y)),B>Y){var Ze=B;B=Y,Y=Ze}if(Ne||B%1||Y%1){var jt=q2();return xc(B+jt*(Y-B+$r("1e-"+((jt+"").length-1))),Y)}return sb(B,Y)}var WYe=Mx(function(B,Y,Ne){return Y=Y.toLowerCase(),B+(Ne?Gfe(Y):Y)});function Gfe(B){return lH(Ia(B).toLowerCase())}function Kfe(B){return B=Ia(B),B&&B.replace(Fn,ks).replace(kr,"")}function qYe(B,Y,Ne){B=Ia(B),Y=gu(Y);var Ze=B.length;Ne=Ne===n?Ze:_p(Ri(Ne),0,Ze);var jt=Ne;return Ne-=Y.length,Ne>=0&&B.slice(Ne,jt)==Y}function GYe(B){return B=Ia(B),B&&yn.test(B)?B.replace(mn,ka):B}function KYe(B){return B=Ia(B),B&&jn.test(B)?B.replace(Kn,"\\$&"):B}var YYe=Mx(function(B,Y,Ne){return B+(Ne?"-":"")+Y.toLowerCase()}),XYe=Mx(function(B,Y,Ne){return B+(Ne?" ":"")+Y.toLowerCase()}),QYe=uA("toLowerCase");function ZYe(B,Y,Ne){B=Ia(B),Y=Ri(Y);var Ze=Y?H(B):0;if(!Y||Ze>=Y)return B;var jt=(Y-Ze)/2;return lv(Dm(jt),Ne)+B+lv(Nx(jt),Ne)}function JYe(B,Y,Ne){B=Ia(B),Y=Ri(Y);var Ze=Y?H(B):0;return Y&&Ze<Y?B+lv(Y-Ze,Ne):B}function eXe(B,Y,Ne){B=Ia(B),Y=Ri(Y);var Ze=Y?H(B):0;return Y&&Ze<Y?lv(Y-Ze,Ne)+B:B}function tXe(B,Y,Ne){return Ne||Y==null?Y=0:Y&&(Y=+Y),bI(Ia(B).replace(De,""),Y||0)}function nXe(B,Y,Ne){return(Ne?Gc(B,Y,Ne):Y===n)?Y=1:Y=Ri(Y),Fx(Ia(B),Y)}function rXe(){var B=arguments,Y=Ia(B[0]);return B.length<3?Y:Y.replace(B[1],B[2])}var sXe=Mx(function(B,Y,Ne){return B+(Ne?"_":"")+Y.toLowerCase()});function iXe(B,Y,Ne){return Ne&&typeof Ne!="number"&&Gc(B,Y,Ne)&&(Y=Ne=n),Ne=Ne===n?oe:Ne>>>0,Ne?(B=Ia(B),B&&(typeof Y=="string"||Y!=null&&!iH(Y))&&(Y=gu(Y),!Y&&Yo(B))?Fp(Z(B),0,Ne):B.split(Y,Ne)):[]}var aXe=Mx(function(B,Y,Ne){return B+(Ne?" ":"")+lH(Y)});function oXe(B,Y,Ne){return B=Ia(B),Ne=Ne==null?0:_p(Ri(Ne),0,B.length),Y=gu(Y),B.slice(Ne,Ne+Y.length)==Y}function lXe(B,Y,Ne){var Ze=Wt.templateSettings;Ne&&Gc(B,Y,Ne)&&(Y=n),B=Ia(B),Y=cP({},Y,Ze,pA);var jt=cP({},Y.imports,Ze.imports,pA),en=Sc(jt),wn=zi(jt,en),Ln,Jn,Mr=0,Rr=Y.interpolate||Tt,Hr="__p += '",ds=ti((Y.escape||Tt).source+"|"+Rr.source+"|"+(Rr===Sn?Mt:Tt).source+"|"+(Y.evaluate||Tt).source+"|$","g"),Ds="//# sourceURL="+(Oi.call(Y,"sourceURL")?(Y.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cs+"]")+`
`;B.replace(ds,function(ri,Yi,Ji,Of,Zu,Mf){return Ji||(Ji=Of),Hr+=B.slice(Mr,Mf).replace(pn,Wu),Yi&&(Ln=!0,Hr+=`' +
__e(`+Yi+`) +
'`),Zu&&(Jn=!0,Hr+=`';
`+Zu+`;
__p += '`),Ji&&(Hr+=`' +
((__t = (`+Ji+`)) == null ? '' : __t) +
'`),Mr=Mf+ri.length,ri}),Hr+=`';
`;var ni=Oi.call(Y,"variable")&&Y.variable;if(!ni)Hr=`with (obj) {
`+Hr+`
}
`;else if(kt.test(ni))throw new xr(l);Hr=(Jn?Hr.replace(ct,""):Hr).replace(vt,"$1").replace(Ht,"$1;"),Hr="function("+(ni||"obj")+`) {
`+(ni?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(Ln?", __e = _.escape":"")+(Jn?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Hr+`return __p
}`;var Li=Xfe(function(){return Nr(en,Ds+"return "+Hr).apply(n,wn)});if(Li.source=Hr,sH(Li))throw Li;return Li}function cXe(B){return Ia(B).toLowerCase()}function uXe(B){return Ia(B).toUpperCase()}function dXe(B,Y,Ne){if(B=Ia(B),B&&(Ne||Y===n))return xs(B);if(!B||!(Y=gu(Y)))return B;var Ze=Z(B),jt=Z(Y),en=ys(Ze,jt),wn=Ss(Ze,jt)+1;return Fp(Ze,en,wn).join("")}function fXe(B,Y,Ne){if(B=Ia(B),B&&(Ne||Y===n))return B.slice(0,ue(B)+1);if(!B||!(Y=gu(Y)))return B;var Ze=Z(B),jt=Ss(Ze,Z(Y))+1;return Fp(Ze,0,jt).join("")}function hXe(B,Y,Ne){if(B=Ia(B),B&&(Ne||Y===n))return B.replace(De,"");if(!B||!(Y=gu(Y)))return B;var Ze=Z(B),jt=ys(Ze,Z(Y));return Fp(Ze,jt).join("")}function pXe(B,Y){var Ne=se,Ze=ee;if(Ho(Y)){var jt="separator"in Y?Y.separator:jt;Ne="length"in Y?Ri(Y.length):Ne,Ze="omission"in Y?gu(Y.omission):Ze}B=Ia(B);var en=B.length;if(Yo(B)){var wn=Z(B);en=wn.length}if(Ne>=en)return B;var Ln=Ne-H(Ze);if(Ln<1)return Ze;var Jn=wn?Fp(wn,0,Ln).join(""):B.slice(0,Ln);if(jt===n)return Jn+Ze;if(wn&&(Ln+=Jn.length-Ln),iH(jt)){if(B.slice(Ln).search(jt)){var Mr,Rr=Jn;for(jt.global||(jt=ti(jt.source,Ia(ln.exec(jt))+"g")),jt.lastIndex=0;Mr=jt.exec(Rr);)var Hr=Mr.index;Jn=Jn.slice(0,Hr===n?Ln:Hr)}}else if(B.indexOf(gu(jt),Ln)!=Ln){var ds=Jn.lastIndexOf(jt);ds>-1&&(Jn=Jn.slice(0,ds))}return Jn+Ze}function mXe(B){return B=Ia(B),B&&un.test(B)?B.replace(Rt,Ee):B}var xXe=Mx(function(B,Y,Ne){return B+(Ne?" ":"")+Y.toUpperCase()}),lH=uA("toUpperCase");function Yfe(B,Y,Ne){return B=Ia(B),Y=Ne?n:Y,Y===n?qu(B)?Ct(B):mt(B):B.match(Y)||[]}var Xfe=Mi(function(B,Y){try{return fr(B,n,Y)}catch(Ne){return sH(Ne)?Ne:new xr(Ne)}}),gXe=wh(function(B,Y){return pr(Y,function(Ne){Ne=Tf(Ne),ph(B,Ne,Ur(B[Ne],B))}),B});function bXe(B){var Y=B==null?0:B.length,Ne=Ys();return B=Y?nr(B,function(Ze){if(typeof Ze[1]!="function")throw new ro(o);return[Ne(Ze[0]),Ze[1]]}):[],Mi(function(Ze){for(var jt=-1;++jt<Y;){var en=B[jt];if(fr(en[0],this,Ze))return fr(en[1],this,Ze)}})}function yXe(B){return jI(xu(B,f))}function cH(B){return function(){return B}}function vXe(B,Y){return B==null||B!==B?Y:B}var wXe=E6(),CXe=E6(!0);function zd(B){return B}function uH(B){return rb(typeof B=="function"?B:xu(B,f))}function SXe(B){return g6(xu(B,f))}function NXe(B,Y){return io(B,xu(Y,f))}var jXe=Mi(function(B,Y){return function(Ne){return Od(Ne,B,Y)}}),AXe=Mi(function(B,Y){return function(Ne){return Od(B,Ne,Y)}});function dH(B,Y,Ne){var Ze=Sc(Y),jt=tb(Y,Ze);Ne==null&&!(Ho(Y)&&(jt.length||!Ze.length))&&(Ne=Y,Y=B,B=this,jt=tb(Y,Sc(Y)));var en=!(Ho(Ne)&&"chain"in Ne)||!!Ne.chain,wn=zx(B);return pr(jt,function(Ln){var Jn=Y[Ln];B[Ln]=Jn,wn&&(B.prototype[Ln]=function(){var Mr=this.__chain__;if(en||Mr){var Rr=B(this.__wrapped__),Hr=Rr.__actions__=Wc(this.__actions__);return Hr.push({func:Jn,args:arguments,thisArg:B}),Rr.__chain__=Mr,Rr}return Jn.apply(B,gs([this.value()],arguments))})}),B}function _Xe(){return mr._===this&&(mr._=pI),this}function fH(){}function EXe(B){return B=Ri(B),Mi(function(Y){return b6(Y,B)})}var kXe=k6(nr),TXe=k6(Xr),IXe=k6(Fr);function Qfe(B){return vs(B)?Ls(Tf(B)):bo(B)}function PXe(B){return function(Y){return B==null?n:Ep(B,Y)}}var FXe=fA(),OXe=fA(!0);function hH(){return[]}function pH(){return!1}function MXe(){return{}}function RXe(){return""}function LXe(){return!0}function DXe(B,Y){if(B=Ri(B),B<1||B>q)return[];var Ne=oe,Ze=xc(B,oe);Y=Ys(Y),B-=oe;for(var jt=us(Ze,Y);++Ne<B;)Y(Ne);return jt}function BXe(B){return _i(B)?nr(B,Tf):Ff(B)?[B]:Wc(NA(Ia(B)))}function $Xe(B){var Y=++Lm;return Ia(B)+Y}var UXe=ov(function(B,Y){return B+Y},0),zXe=Jl("ceil"),HXe=ov(function(B,Y){return B/Y},1),VXe=Jl("floor");function WXe(B){return B&&B.length?Tx(B,zd,Wm):n}function qXe(B,Y){return B&&B.length?Tx(B,Ys(Y,2),Wm):n}function GXe(B){return ns(B,zd)}function KXe(B,Y){return ns(B,Ys(Y,2))}function YXe(B){return B&&B.length?Tx(B,zd,qm):n}function XXe(B,Y){return B&&B.length?Tx(B,Ys(Y,2),qm):n}var QXe=ov(function(B,Y){return B*Y},1),ZXe=Jl("round"),JXe=ov(function(B,Y){return B-Y},0);function eQe(B){return B&&B.length?Vr(B,zd):0}function tQe(B,Y){return B&&B.length?Vr(B,Ys(Y,2)):0}return Wt.after=ur,Wt.ary=zr,Wt.assign=uYe,Wt.assignIn=zfe,Wt.assignInWith=cP,Wt.assignWith=dYe,Wt.at=fYe,Wt.before=Wr,Wt.bind=Ur,Wt.bindAll=gXe,Wt.bindKey=hs,Wt.castArray=MKe,Wt.chain=W6,Wt.chunk=L6,Wt.compact=jA,Wt.concat=Dd,Wt.cond=bXe,Wt.conforms=yXe,Wt.constant=cH,Wt.countBy=nP,Wt.create=hYe,Wt.curry=js,Wt.curryRight=Ps,Wt.debounce=To,Wt.defaults=pYe,Wt.defaultsDeep=mYe,Wt.defer=rr,Wt.delay=Hn,Wt.difference=Zi,Wt.differenceBy=Ol,Wt.differenceWith=Zo,Wt.drop=nc,Wt.dropRight=Qu,Wt.dropRightWhile=pb,Wt.dropWhile=ml,Wt.fill=xv,Wt.filter=K6,Wt.flatMap=LA,Wt.flatMapDeep=iP,Wt.flatMapDepth=DA,Wt.flatten=D6,Wt.flattenDeep=bv,Wt.flattenDepth=bu,Wt.flip=or,Wt.flow=wXe,Wt.flowRight=CXe,Wt.fromPairs=AA,Wt.functions=CYe,Wt.functionsIn=SYe,Wt.groupBy=Q6,Wt.initial=B6,Wt.intersection=_A,Wt.intersectionBy=Qm,Wt.intersectionWith=$6,Wt.invert=jYe,Wt.invertBy=AYe,Wt.invokeMap=tH,Wt.iteratee=uH,Wt.keyBy=Z6,Wt.keys=Sc,Wt.keysIn=Ud,Wt.map=J6,Wt.mapKeys=EYe,Wt.mapValues=kYe,Wt.matches=SXe,Wt.matchesProperty=NXe,Wt.memoize=Qr,Wt.merge=TYe,Wt.mergeWith=Hfe,Wt.method=jXe,Wt.methodOf=AXe,Wt.mixin=dH,Wt.negate=Fs,Wt.nthArg=EXe,Wt.omit=IYe,Wt.omitBy=PYe,Wt.once=qs,Wt.orderBy=Cv,Wt.over=kXe,Wt.overArgs=Gs,Wt.overEvery=TXe,Wt.overSome=IXe,Wt.partial=Js,Wt.partialRight=xl,Wt.partition=nH,Wt.pick=FYe,Wt.pickBy=Vfe,Wt.property=Qfe,Wt.propertyOf=PXe,Wt.pull=U6,Wt.pullAll=vv,Wt.pullAllBy=Yc,Wt.pullAllWith=Jm,Wt.pullAt=If,Wt.range=FXe,Wt.rangeRight=OXe,Wt.rearg=ua,Wt.reject=R,Wt.remove=yu,Wt.rest=t0,Wt.reverse=z6,Wt.sampleSize=be,Wt.set=MYe,Wt.setWith=RYe,Wt.shuffle=Le,Wt.slice=kA,Wt.sortBy=bn,Wt.sortedUniq=PA,Wt.sortedUniqBy=Bx,Wt.split=iXe,Wt.spread=rH,Wt.tail=YI,Wt.take=XI,Wt.takeRight=FA,Wt.takeRightWhile=H6,Wt.takeWhile=Wz,Wt.tap=Zz,Wt.throttle=PKe,Wt.thru=Pf,Wt.toArray=Bfe,Wt.toPairs=Wfe,Wt.toPairsIn=qfe,Wt.toPath=BXe,Wt.toPlainObject=Ufe,Wt.transform=LYe,Wt.unary=FKe,Wt.union=qz,Wt.unionBy=QI,Wt.unionWith=ZI,Wt.uniq=$x,Wt.uniqBy=Gz,Wt.uniqWith=mb,Wt.unset=DYe,Wt.unzip=V6,Wt.unzipWith=yo,Wt.update=BYe,Wt.updateWith=$Ye,Wt.values=nC,Wt.valuesIn=UYe,Wt.without=Kz,Wt.words=Yfe,Wt.wrap=OKe,Wt.xor=JI,Wt.xorBy=Yz,Wt.xorWith=Xz,Wt.zip=eP,Wt.zipObject=tP,Wt.zipObjectDeep=Qz,Wt.zipWith=Bd,Wt.entries=Wfe,Wt.entriesIn=qfe,Wt.extend=zfe,Wt.extendWith=cP,dH(Wt,Wt),Wt.add=UXe,Wt.attempt=Xfe,Wt.camelCase=WYe,Wt.capitalize=Gfe,Wt.ceil=zXe,Wt.clamp=zYe,Wt.clone=RKe,Wt.cloneDeep=DKe,Wt.cloneDeepWith=BKe,Wt.cloneWith=LKe,Wt.conformsTo=$Ke,Wt.deburr=Kfe,Wt.defaultTo=vXe,Wt.divide=HXe,Wt.endsWith=qYe,Wt.eq=Lp,Wt.escape=GYe,Wt.escapeRegExp=KYe,Wt.every=rP,Wt.find=Y6,Wt.findIndex=Xm,Wt.findKey=xYe,Wt.findLast=sP,Wt.findLastIndex=gv,Wt.findLastKey=gYe,Wt.floor=VXe,Wt.forEach=wv,Wt.forEachRight=X6,Wt.forIn=bYe,Wt.forInRight=yYe,Wt.forOwn=vYe,Wt.forOwnRight=wYe,Wt.get=aH,Wt.gt=UKe,Wt.gte=zKe,Wt.has=NYe,Wt.hasIn=oH,Wt.head=Lx,Wt.identity=zd,Wt.includes=aP,Wt.indexOf=Rp,Wt.inRange=HYe,Wt.invoke=_Ye,Wt.isArguments=Sv,Wt.isArray=_i,Wt.isArrayBuffer=HKe,Wt.isArrayLike=$d,Wt.isArrayLikeObject=gl,Wt.isBoolean=VKe,Wt.isBuffer=xb,Wt.isDate=WKe,Wt.isElement=qKe,Wt.isEmpty=GKe,Wt.isEqual=KKe,Wt.isEqualWith=YKe,Wt.isError=sH,Wt.isFinite=XKe,Wt.isFunction=zx,Wt.isInteger=Mfe,Wt.isLength=oP,Wt.isMap=Rfe,Wt.isMatch=QKe,Wt.isMatchWith=ZKe,Wt.isNaN=JKe,Wt.isNative=eYe,Wt.isNil=nYe,Wt.isNull=tYe,Wt.isNumber=Lfe,Wt.isObject=Ho,Wt.isObjectLike=Jo,Wt.isPlainObject=BA,Wt.isRegExp=iH,Wt.isSafeInteger=rYe,Wt.isSet=Dfe,Wt.isString=lP,Wt.isSymbol=Ff,Wt.isTypedArray=tC,Wt.isUndefined=sYe,Wt.isWeakMap=iYe,Wt.isWeakSet=aYe,Wt.join=Zm,Wt.kebabCase=YYe,Wt.last=Kc,Wt.lastIndexOf=yv,Wt.lowerCase=XYe,Wt.lowerFirst=QYe,Wt.lt=oYe,Wt.lte=lYe,Wt.max=WXe,Wt.maxBy=qXe,Wt.mean=GXe,Wt.meanBy=KXe,Wt.min=YXe,Wt.minBy=XXe,Wt.stubArray=hH,Wt.stubFalse=pH,Wt.stubObject=MXe,Wt.stubString=RXe,Wt.stubTrue=LXe,Wt.multiply=QXe,Wt.nth=EA,Wt.noConflict=_Xe,Wt.noop=fH,Wt.now=Mn,Wt.pad=ZYe,Wt.padEnd=JYe,Wt.padStart=eXe,Wt.parseInt=tXe,Wt.random=VYe,Wt.reduce=eC,Wt.reduceRight=_,Wt.repeat=nXe,Wt.replace=rXe,Wt.result=OYe,Wt.round=ZXe,Wt.runInContext=Et,Wt.sample=J,Wt.size=Qe,Wt.snakeCase=sXe,Wt.some=Ft,Wt.sortedIndex=TA,Wt.sortedIndexBy=Vz,Wt.sortedIndexOf=e0,Wt.sortedLastIndex=KI,Wt.sortedLastIndexBy=IA,Wt.sortedLastIndexOf=Dx,Wt.startCase=aXe,Wt.startsWith=oXe,Wt.subtract=JXe,Wt.sum=eQe,Wt.sumBy=tQe,Wt.template=lXe,Wt.times=DXe,Wt.toFinite=Hx,Wt.toInteger=Ri,Wt.toLength=$fe,Wt.toLower=cXe,Wt.toNumber=Sh,Wt.toSafeInteger=cYe,Wt.toString=Ia,Wt.toUpper=uXe,Wt.trim=dXe,Wt.trimEnd=fXe,Wt.trimStart=hXe,Wt.truncate=pXe,Wt.unescape=mXe,Wt.uniqueId=$Xe,Wt.upperCase=xXe,Wt.upperFirst=lH,Wt.each=wv,Wt.eachRight=X6,Wt.first=Lx,dH(Wt,function(){var B={};return Yu(Wt,function(Y,Ne){Oi.call(Wt.prototype,Ne)||(B[Ne]=Y)}),B}(),{chain:!1}),Wt.VERSION=r,pr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(B){Wt[B].placeholder=Wt}),pr(["drop","take"],function(B,Y){Ai.prototype[B]=function(Ne){Ne=Ne===n?1:Qo(Ri(Ne),0);var Ze=this.__filtered__&&!Y?new Ai(this):this.clone();return Ze.__filtered__?Ze.__takeCount__=xc(Ne,Ze.__takeCount__):Ze.__views__.push({size:xc(Ne,oe),type:B+(Ze.__dir__<0?"Right":"")}),Ze},Ai.prototype[B+"Right"]=function(Ne){return this.reverse()[B](Ne).reverse()}}),pr(["filter","map","takeWhile"],function(B,Y){var Ne=Y+1,Ze=Ne==de||Ne==ie;Ai.prototype[B]=function(jt){var en=this.clone();return en.__iteratees__.push({iteratee:Ys(jt,3),type:Ne}),en.__filtered__=en.__filtered__||Ze,en}}),pr(["head","last"],function(B,Y){var Ne="take"+(Y?"Right":"");Ai.prototype[B]=function(){return this[Ne](1).value()[0]}}),pr(["initial","tail"],function(B,Y){var Ne="drop"+(Y?"":"Right");Ai.prototype[B]=function(){return this.__filtered__?new Ai(this):this[Ne](1)}}),Ai.prototype.compact=function(){return this.filter(zd)},Ai.prototype.find=function(B){return this.filter(B).head()},Ai.prototype.findLast=function(B){return this.reverse().find(B)},Ai.prototype.invokeMap=Mi(function(B,Y){return typeof B=="function"?new Ai(this):this.map(function(Ne){return Od(Ne,B,Y)})}),Ai.prototype.reject=function(B){return this.filter(Fs(Ys(B)))},Ai.prototype.slice=function(B,Y){B=Ri(B);var Ne=this;return Ne.__filtered__&&(B>0||Y<0)?new Ai(Ne):(B<0?Ne=Ne.takeRight(-B):B&&(Ne=Ne.drop(B)),Y!==n&&(Y=Ri(Y),Ne=Y<0?Ne.dropRight(-Y):Ne.take(Y-B)),Ne)},Ai.prototype.takeRightWhile=function(B){return this.reverse().takeWhile(B).reverse()},Ai.prototype.toArray=function(){return this.take(oe)},Yu(Ai.prototype,function(B,Y){var Ne=/^(?:filter|find|map|reject)|While$/.test(Y),Ze=/^(?:head|last)$/.test(Y),jt=Wt[Ze?"take"+(Y=="last"?"Right":""):Y],en=Ze||/^find/.test(Y);jt&&(Wt.prototype[Y]=function(){var wn=this.__wrapped__,Ln=Ze?[1]:arguments,Jn=wn instanceof Ai,Mr=Ln[0],Rr=Jn||_i(wn),Hr=function(Yi){var Ji=jt.apply(Wt,gs([Yi],Ln));return Ze&&ds?Ji[0]:Ji};Rr&&Ne&&typeof Mr=="function"&&Mr.length!=1&&(Jn=Rr=!1);var ds=this.__chain__,Ds=!!this.__actions__.length,ni=en&&!ds,Li=Jn&&!Ds;if(!en&&Rr){wn=Li?wn:new Ai(this);var ri=B.apply(wn,Ln);return ri.__actions__.push({func:Pf,args:[Hr],thisArg:n}),new gc(ri,ds)}return ni&&Li?B.apply(this,Ln):(ri=this.thru(Hr),ni?Ze?ri.value()[0]:ri.value():ri)})}),pr(["pop","push","shift","sort","splice","unshift"],function(B){var Y=so[B],Ne=/^(?:push|sort|unshift)$/.test(B)?"tap":"thru",Ze=/^(?:pop|shift)$/.test(B);Wt.prototype[B]=function(){var jt=arguments;if(Ze&&!this.__chain__){var en=this.value();return Y.apply(_i(en)?en:[],jt)}return this[Ne](function(wn){return Y.apply(_i(wn)?wn:[],jt)})}}),Yu(Ai.prototype,function(B,Y){var Ne=Wt[Y];if(Ne){var Ze=Ne.name+"";Oi.call(Y1,Ze)||(Y1[Ze]=[]),Y1[Ze].push({name:Y,func:Ne})}}),Y1[ub(n,N).name]=[{name:"wrapper",func:n}],Ai.prototype.clone=a6,Ai.prototype.reverse=W8,Ai.prototype.value=Z1,Wt.prototype.at=q6,Wt.prototype.chain=Ux,Wt.prototype.commit=G6,Wt.prototype.next=OA,Wt.prototype.plant=Jz,Wt.prototype.reverse=RA,Wt.prototype.toJSON=Wt.prototype.valueOf=Wt.prototype.value=eH,Wt.prototype.first=Wt.prototype.head,jp&&(Wt.prototype[jp]=MA),Wt},sn=Dt();Qs?((Qs.exports=sn)._=sn,ts._=sn):mr._=sn}).call(bln)}(u9,u9.exports)),u9.exports}var vln=yln();const rSe=Ti(vln),wln=({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(N=>{var I,P;return typeof N=="string"?N.toLowerCase():((P=(I=N==null?void 0:N.wallet_address)==null?void 0:I.toLowerCase)==null?void 0:P.call(I))||""}).filter(Boolean);h.useEffect(()=>{(async()=>{a(!0);const N=e&&e.length?c(e):[t];if(!N[0]){r([]),a(!1);return}const I=Date.now()-30*24*60*60*1e3;try{const M=(await Promise.all(N.map(F=>ps.post("https://api-ui.hyperliquid.xyz/info",{type:"userNonFundingLedgerUpdates",user:F,startTime:I})))).flatMap(F=>F.data||[]).sort((F,$)=>$.time-F.time);r(M)}catch(P){console.error("Error fetching transaction data:",P)}finally{a(!1)}})()},[t,JSON.stringify(e)]);const u=C=>{let N="asc";o.key===C&&(o.direction==="asc"?N="desc":o.direction==="desc"&&(N=null)),l({key:C,direction:N})},d=[...n].sort((C,N)=>{if(!o.key||!o.direction)return 0;const I=rSe.get(C,o.key),P=rSe.get(N,o.key);return I<P?o.direction==="asc"?-1:1:I>P?o.direction==="asc"?1:-1:0}),f=C=>{if(o.key===C){if(o.direction==="asc")return i.jsx(i2,{className:"inline ml-2 text-white"});if(o.direction==="desc")return i.jsx(s2,{className:"inline ml-2 text-white"})}return i.jsx(a2,{className:"inline ml-2 text-white"})},x=localStorage.getItem("isDateDepositWithdrawFormat")||"date",[g,y]=h.useState(x);h.useEffect(()=>{localStorage.setItem("isDateDepositWithdrawFormat",g)},[g]);const v=({date:C})=>{const[N,I]=h.useState(Uo(C));return h.useEffect(()=>{const P=setInterval(()=>I(Uo(C)),1e3);return()=>clearInterval(P)},[C]),i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:N.dateTime})};return i.jsx("div",{className:"relative w-full text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:i.jsx("div",{className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full mt-1 mb-3 bg-[#161616] rounded-lg pb-24",children:i.jsxs("table",{className:"w-full table-auto relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 bg-[#161616]",children:i.jsxs("tr",{className:"text-[#9b9b9b] text-left",children:[i.jsxs("th",{onClick:()=>u("time"),className:"cursor-pointer",children:["Time ",f("time")]}),i.jsxs("th",{onClick:()=>u("delta.type"),className:"cursor-pointer",children:["Type ",f("delta.type")]}),i.jsxs("th",{onClick:()=>u("asset"),className:"cursor-pointer",children:["Asset ",f("asset")]}),i.jsxs("th",{onClick:()=>u("delta.usdc"),className:"cursor-pointer",children:["Amount ",f("delta.usdc")]}),i.jsx("th",{children:"Transaction"})]})}),i.jsx("tbody",{children:s?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-4",children:"Loading…"})}):d.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-4",children:"No transactions available"})}):d.map((C,N)=>i.jsxs("tr",{className:"bg-[#1b1b1b] hover:bg-[#222222] h-[32px] text-white",children:[i.jsx("td",{className:"cursor-pointer",onClick:()=>y(g==="time"?"date":"time"),children:g==="time"?i.jsx(v,{date:C.time}):$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:["$",Er(+C.delta.usdc)]}),i.jsx("td",{className:"break-all",children:XB(C.hash)})]},N))})]})})})};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)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tse.apply(null,arguments)}function sSe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nse(t,e){return nse=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nse(t,e)}function Cln(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,nse(t,e)}var iSe=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Sln(t,e){return!!(t===e||iSe(t)&&iSe(e))}function Nln(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!Sln(t[n],e[n]))return!1;return!0}function QX(t,e){e===void 0&&(e=Nln);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 jln=typeof performance=="object"&&typeof performance.now=="function",aSe=jln?function(){return performance.now()}:function(){return Date.now()};function oSe(t){cancelAnimationFrame(t.id)}function Aln(t,e){var n=aSe();function r(){aSe()-n>=e?t.call(null):s.id=requestAnimationFrame(r)}var s={id:requestAnimationFrame(r)};return s}var ZX=-1;function lSe(t){if(t===void 0&&(t=!1),ZX===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),ZX=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return ZX}var EC=null;function cSe(t){if(t===void 0&&(t=!1),EC===null||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),s=r.style;return s.width="100px",s.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?EC="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?EC="negative":EC="positive-ascending"),document.body.removeChild(e),EC}return EC}var _ln=150,Eln=function(e,n){return e};function kln(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){Cln(x,f);function x(y){var v;return v=f.call(this,y)||this,v._instanceProps=c(v.props,sSe(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:sSe(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=QX(function(C,N,I,P){return v.props.onItemsRendered({overscanStartIndex:C,overscanStopIndex:N,visibleStartIndex:I,visibleStopIndex:P})}),v._callOnScroll=void 0,v._callOnScroll=QX(function(C,N,I){return v.props.onScroll({scrollDirection:C,scrollOffset:N,scrollUpdateWasRequested:I})}),v._getItemStyle=void 0,v._getItemStyle=function(C){var N=v.props,I=N.direction,P=N.itemSize,M=N.layout,F=v._getItemStyleCache(u&&P,u&&M,u&&I),$;if(F.hasOwnProperty(C))$=F[C];else{var L=n(v.props,C,v._instanceProps),z=s(v.props,C,v._instanceProps),Q=I==="horizontal"||M==="horizontal",se=I==="rtl",ee=Q?L:0;F[C]=$={position:"absolute",left:se?void 0:ee,right:se?ee:void 0,top:Q?0:L,height:Q?"100%":z,width:Q?z:"100%"}}return $},v._getItemStyleCache=void 0,v._getItemStyleCache=QX(function(C,N,I){return{}}),v._onScrollHorizontal=function(C){var N=C.currentTarget,I=N.clientWidth,P=N.scrollLeft,M=N.scrollWidth;v.setState(function(F){if(F.scrollOffset===P)return null;var $=v.props.direction,L=P;if($==="rtl")switch(cSe()){case"negative":L=-P;break;case"positive-descending":L=M-I-P;break}return L=Math.max(0,Math.min(L,M-I)),{isScrolling:!0,scrollDirection:F.scrollOffset<L?"forward":"backward",scrollOffset:L,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(C){var N=C.currentTarget,I=N.clientHeight,P=N.scrollHeight,M=N.scrollTop;v.setState(function(F){if(F.scrollOffset===M)return null;var $=Math.max(0,Math.min(M,P-I));return{isScrolling:!0,scrollDirection:F.scrollOffset<$?"forward":"backward",scrollOffset:$,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(C){var N=v.props.outerRef;v._outerRef=C,typeof N=="function"?N(C):N!=null&&typeof N=="object"&&N.hasOwnProperty("current")&&(N.current=C)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&oSe(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=Aln(v._resetIsScrolling,_ln)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}x.getDerivedStateFromProps=function(v,C){return Tln(v,C),d(v),null};var g=x.prototype;return g.scrollTo=function(v){v=Math.max(0,v),this.setState(function(C){return C.scrollOffset===v?null:{scrollDirection:C.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(v,C){C===void 0&&(C="auto");var N=this.props,I=N.itemCount,P=N.layout,M=this.state.scrollOffset;v=Math.max(0,Math.min(v,I-1));var F=0;if(this._outerRef){var $=this._outerRef;P==="vertical"?F=$.scrollWidth>$.clientWidth?lSe():0:F=$.scrollHeight>$.clientHeight?lSe():0}this.scrollTo(a(this.props,v,C,M,this._instanceProps,F))},g.componentDidMount=function(){var v=this.props,C=v.direction,N=v.initialScrollOffset,I=v.layout;if(typeof N=="number"&&this._outerRef!=null){var P=this._outerRef;C==="horizontal"||I==="horizontal"?P.scrollLeft=N:P.scrollTop=N}this._callPropsCallbacks()},g.componentDidUpdate=function(){var v=this.props,C=v.direction,N=v.layout,I=this.state,P=I.scrollOffset,M=I.scrollUpdateWasRequested;if(M&&this._outerRef!=null){var F=this._outerRef;if(C==="horizontal"||N==="horizontal")if(C==="rtl")switch(cSe()){case"negative":F.scrollLeft=-P;break;case"positive-ascending":F.scrollLeft=P;break;default:var $=F.clientWidth,L=F.scrollWidth;F.scrollLeft=L-$-P;break}else F.scrollLeft=P;else F.scrollTop=P}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&oSe(this._resetIsScrollingTimeoutId)},g.render=function(){var v=this.props,C=v.children,N=v.className,I=v.direction,P=v.height,M=v.innerRef,F=v.innerElementType,$=v.innerTagName,L=v.itemCount,z=v.itemData,Q=v.itemKey,se=Q===void 0?Eln:Q,ee=v.layout,K=v.outerElementType,re=v.outerTagName,de=v.style,G=v.useIsScrolling,ie=v.width,ae=this.state.isScrolling,q=I==="horizontal"||ee==="horizontal",W=q?this._onScrollHorizontal:this._onScrollVertical,ne=this._getRangeToRender(),oe=ne[0],he=ne[1],_e=[];if(L>0)for(var xe=oe;xe<=he;xe++)_e.push(h.createElement(C,{data:z,key:se(xe,z),index:xe,isScrolling:G?ae:void 0,style:this._getItemStyle(xe)}));var Se=r(this.props,this._instanceProps);return h.createElement(K||re||"div",{className:N,onScroll:W,ref:this._outerRefSetter,style:tse({position:"relative",height:P,width:ie,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:I},de)},h.createElement(F||$||"div",{children:_e,ref:M,style:{height:q?"100%":Se,pointerEvents:ae?"none":void 0,width:q?Se:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var C=this._getRangeToRender(),N=C[0],I=C[1],P=C[2],M=C[3];this._callOnItemsRendered(N,I,P,M)}}if(typeof this.props.onScroll=="function"){var F=this.state,$=F.scrollDirection,L=F.scrollOffset,z=F.scrollUpdateWasRequested;this._callOnScroll($,L,z)}},g._getRangeToRender=function(){var v=this.props,C=v.itemCount,N=v.overscanCount,I=this.state,P=I.isScrolling,M=I.scrollDirection,F=I.scrollOffset;if(C===0)return[0,0,0,0];var $=o(this.props,F,this._instanceProps),L=l(this.props,$,F,this._instanceProps),z=!P||M==="backward"?Math.max(1,N):1,Q=!P||M==="forward"?Math.max(1,N):1;return[Math.max(0,$-z),Math.max(0,Math.min(C-1,L+Q)),$,L]},x}(h.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var Tln=function(e,n){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,n.instance},Iln=kln({getItemOffset:function(e,n){var r=e.itemSize;return n*r},getItemSize:function(e,n){var r=e.itemSize;return r},getEstimatedTotalSize:function(e){var n=e.itemCount,r=e.itemSize;return r*n},getOffsetForIndexAndAlignment:function(e,n,r,s,a,o){var l=e.direction,c=e.height,u=e.itemCount,d=e.itemSize,f=e.layout,x=e.width,g=l==="horizontal"||f==="horizontal",y=g?x:c,v=Math.max(0,u*d-y),C=Math.min(v,n*d),N=Math.max(0,n*d-y+d+o);switch(r==="smart"&&(s>=N-y&&s<=C+y?r="auto":r="center"),r){case"start":return C;case"end":return N;case"center":{var I=Math.round(N+(C-N)/2);return I<Math.ceil(y/2)?0:I>v+Math.floor(y/2)?v:I}case"auto":default:return s>=N&&s<=C?s:s<N?N:C}},getStartIndexForOffset:function(e,n){var r=e.itemCount,s=e.itemSize;return Math.max(0,Math.min(r-1,Math.floor(n/s)))},getStopIndexForStartIndex:function(e,n,r){var s=e.direction,a=e.height,o=e.itemCount,l=e.itemSize,c=e.layout,u=e.width,d=s==="horizontal"||c==="horizontal",f=n*l,x=d?u:a,g=Math.ceil((x+r-f)/l);return Math.max(0,Math.min(o-1,n+g-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}}),yM={exports:{}},Pln=yM.exports,uSe;function Fln(){return uSe||(uSe=1,function(t,e){(function(n,r){t.exports=r()})(Pln,function(){var n=1e3,r=6e4,s=36e5,a="millisecond",o="second",l="minute",c="hour",u="day",d="week",f="month",x="quarter",g="year",y="date",v="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,I={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(de){var G=["th","st","nd","rd"],ie=de%100;return"["+de+(G[(ie-20)%10]||G[ie]||G[0])+"]"}},P=function(de,G,ie){var ae=String(de);return!ae||ae.length>=G?de:""+Array(G+1-ae.length).join(ie)+de},M={s:P,z:function(de){var G=-de.utcOffset(),ie=Math.abs(G),ae=Math.floor(ie/60),q=ie%60;return(G<=0?"+":"-")+P(ae,2,"0")+":"+P(q,2,"0")},m:function de(G,ie){if(G.date()<ie.date())return-de(ie,G);var ae=12*(ie.year()-G.year())+(ie.month()-G.month()),q=G.clone().add(ae,f),W=ie-q<0,ne=G.clone().add(ae+(W?-1:1),f);return+(-(ae+(ie-q)/(W?q-ne:ne-q))||0)},a:function(de){return de<0?Math.ceil(de)||0:Math.floor(de)},p:function(de){return{M:f,y:g,w:d,d:u,D:y,h:c,m:l,s:o,ms:a,Q:x}[de]||String(de||"").toLowerCase().replace(/s$/,"")},u:function(de){return de===void 0}},F="en",$={};$[F]=I;var L="$isDayjsObject",z=function(de){return de instanceof K||!(!de||!de[L])},Q=function de(G,ie,ae){var q;if(!G)return F;if(typeof G=="string"){var W=G.toLowerCase();$[W]&&(q=W),ie&&($[W]=ie,q=W);var ne=G.split("-");if(!q&&ne.length>1)return de(ne[0])}else{var oe=G.name;$[oe]=G,q=oe}return!ae&&q&&(F=q),q||!ae&&F},se=function(de,G){if(z(de))return de.clone();var ie=typeof G=="object"?G:{};return ie.date=de,ie.args=arguments,new K(ie)},ee=M;ee.l=Q,ee.i=z,ee.w=function(de,G){return se(de,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var K=function(){function de(ie){this.$L=Q(ie.locale,null,!0),this.parse(ie),this.$x=this.$x||ie.x||{},this[L]=!0}var G=de.prototype;return G.parse=function(ie){this.$d=function(ae){var q=ae.date,W=ae.utc;if(q===null)return new Date(NaN);if(ee.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var ne=q.match(C);if(ne){var oe=ne[2]-1||0,he=(ne[7]||"0").substring(0,3);return W?new Date(Date.UTC(ne[1],oe,ne[3]||1,ne[4]||0,ne[5]||0,ne[6]||0,he)):new Date(ne[1],oe,ne[3]||1,ne[4]||0,ne[5]||0,ne[6]||0,he)}}return new Date(q)}(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 ee},G.isValid=function(){return this.$d.toString()!==v},G.isSame=function(ie,ae){var q=se(ie);return this.startOf(ae)<=q&&q<=this.endOf(ae)},G.isAfter=function(ie,ae){return se(ie)<this.startOf(ae)},G.isBefore=function(ie,ae){return this.endOf(ae)<se(ie)},G.$g=function(ie,ae,q){return ee.u(ie)?this[ae]:this.set(q,ie)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(ie,ae){var q=this,W=!!ee.u(ae)||ae,ne=ee.p(ie),oe=function(Oe,$e){var Ye=ee.w(q.$u?Date.UTC(q.$y,$e,Oe):new Date(q.$y,$e,Oe),q);return W?Ye:Ye.endOf(u)},he=function(Oe,$e){return ee.w(q.toDate()[Oe].apply(q.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice($e)),q)},_e=this.$W,xe=this.$M,Se=this.$D,ge="set"+(this.$u?"UTC":"");switch(ne){case g:return W?oe(1,0):oe(31,11);case f:return W?oe(1,xe):oe(0,xe+1);case d:var Ce=this.$locale().weekStart||0,je=(_e<Ce?_e+7:_e)-Ce;return oe(W?Se-je:Se+(6-je),xe);case u:case y:return he(ge+"Hours",0);case c:return he(ge+"Minutes",1);case l:return he(ge+"Seconds",2);case o:return he(ge+"Milliseconds",3);default:return this.clone()}},G.endOf=function(ie){return this.startOf(ie,!1)},G.$set=function(ie,ae){var q,W=ee.p(ie),ne="set"+(this.$u?"UTC":""),oe=(q={},q[u]=ne+"Date",q[y]=ne+"Date",q[f]=ne+"Month",q[g]=ne+"FullYear",q[c]=ne+"Hours",q[l]=ne+"Minutes",q[o]=ne+"Seconds",q[a]=ne+"Milliseconds",q)[W],he=W===u?this.$D+(ae-this.$W):ae;if(W===f||W===g){var _e=this.clone().set(y,1);_e.$d[oe](he),_e.init(),this.$d=_e.set(y,Math.min(this.$D,_e.daysInMonth())).$d}else oe&&this.$d[oe](he);return this.init(),this},G.set=function(ie,ae){return this.clone().$set(ie,ae)},G.get=function(ie){return this[ee.p(ie)]()},G.add=function(ie,ae){var q,W=this;ie=Number(ie);var ne=ee.p(ae),oe=function(xe){var Se=se(W);return ee.w(Se.date(Se.date()+Math.round(xe*ie)),W)};if(ne===f)return this.set(f,this.$M+ie);if(ne===g)return this.set(g,this.$y+ie);if(ne===u)return oe(1);if(ne===d)return oe(7);var he=(q={},q[l]=r,q[c]=s,q[o]=n,q)[ne]||1,_e=this.$d.getTime()+ie*he;return ee.w(_e,this)},G.subtract=function(ie,ae){return this.add(-1*ie,ae)},G.format=function(ie){var ae=this,q=this.$locale();if(!this.isValid())return q.invalidDate||v;var W=ie||"YYYY-MM-DDTHH:mm:ssZ",ne=ee.z(this),oe=this.$H,he=this.$m,_e=this.$M,xe=q.weekdays,Se=q.months,ge=q.meridiem,Ce=function($e,Ye,Je,ht){return $e&&($e[Ye]||$e(ae,W))||Je[Ye].slice(0,ht)},je=function($e){return ee.s(oe%12||12,$e,"0")},Oe=ge||function($e,Ye,Je){var ht=$e<12?"AM":"PM";return Je?ht.toLowerCase():ht};return W.replace(N,function($e,Ye){return Ye||function(Je){switch(Je){case"YY":return String(ae.$y).slice(-2);case"YYYY":return ee.s(ae.$y,4,"0");case"M":return _e+1;case"MM":return ee.s(_e+1,2,"0");case"MMM":return Ce(q.monthsShort,_e,Se,3);case"MMMM":return Ce(Se,_e);case"D":return ae.$D;case"DD":return ee.s(ae.$D,2,"0");case"d":return String(ae.$W);case"dd":return Ce(q.weekdaysMin,ae.$W,xe,2);case"ddd":return Ce(q.weekdaysShort,ae.$W,xe,3);case"dddd":return xe[ae.$W];case"H":return String(oe);case"HH":return ee.s(oe,2,"0");case"h":return je(1);case"hh":return je(2);case"a":return Oe(oe,he,!0);case"A":return Oe(oe,he,!1);case"m":return String(he);case"mm":return ee.s(he,2,"0");case"s":return String(ae.$s);case"ss":return ee.s(ae.$s,2,"0");case"SSS":return ee.s(ae.$ms,3,"0");case"Z":return ne}return null}($e)||ne.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(ie,ae,q){var W,ne=this,oe=ee.p(ae),he=se(ie),_e=(he.utcOffset()-this.utcOffset())*r,xe=this-he,Se=function(){return ee.m(ne,he)};switch(oe){case g:W=Se()/12;break;case f:W=Se();break;case x:W=Se()/3;break;case d:W=(xe-_e)/6048e5;break;case u:W=(xe-_e)/864e5;break;case c:W=xe/s;break;case l:W=xe/r;break;case o:W=xe/n;break;default:W=xe}return q?W:ee.a(W)},G.daysInMonth=function(){return this.endOf(f).$D},G.$locale=function(){return $[this.$L]},G.locale=function(ie,ae){if(!ie)return this.$L;var q=this.clone(),W=Q(ie,ae,!0);return W&&(q.$L=W),q},G.clone=function(){return ee.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()},de}(),re=K.prototype;return se.prototype=re,[["$ms",a],["$s",o],["$m",l],["$H",c],["$W",u],["$M",f],["$y",g],["$D",y]].forEach(function(de){re[de[1]]=function(G){return this.$g(G,de[0],de[1])}}),se.extend=function(de,G){return de.$i||(de(G,K,se),de.$i=!0),se},se.locale=Q,se.isDayjs=z,se.unix=function(de){return se(1e3*de)},se.en=$[F],se.Ls=$,se.p={},se})}(yM)),yM.exports}var Oln=Fln();const JX=Ti(Oln),Mln=Ie.forwardRef(function({style:e,...n},r){const s=e&&e.pointerEvents==="none"?{...e,pointerEvents:"auto"}:e;return i.jsx("div",{ref:r,style:s,...n})}),zu=({data:t,columns:e,tableClassName:n,theadClassName:r,tbodyClassName:s,rowClassName:a,cellClassName:o,rowHeight:l=36,listHeight:c=500,rowKey:u,onVisibleRows:d,onRowClick:f,loading:x=!1,skeletonRowCount:g=10,skeletonRenderer:y,emptyState:v=null,loadingState:C=null})=>{const[N,I]=h.useState({key:null,direction:null}),[P,M]=h.useState({}),[F,$]=h.useState(null),[L,z]=h.useState(null),[Q,se]=h.useState({top:0,left:0}),ee=h.useRef(null),K=h.useRef(null);h.useEffect(()=>{function rt(st){ee.current&&!ee.current.contains(st.target)&&($(null),z(null))}return document.addEventListener("mousedown",rt),()=>document.removeEventListener("mousedown",rt)},[]),h.useEffect(()=>{F&&(L==null?void 0:L.filterType)==="text"&&setTimeout(()=>{var rt;return(rt=K.current)==null?void 0:rt.focus()},0)},[F,L]);function re(rt,st,He){return rt.filter(Ve=>st.every(bt=>{const xt=He[bt.key];if(!bt.filterType||!xt)return!0;const Qt=Ve[bt.key];if(xt.filterType==="text"){const St=xt.value||"";return Qt==null?void 0:Qt.toString().toLowerCase().includes(St.toLowerCase())}if(xt.filterType==="select")return!xt.values||xt.values.length===0?!0:xt.values.includes(Qt);if(xt.filterType==="dateRange"){if(!Qt)return!1;const St=JX(Qt);return!(xt.start&&St.isBefore(JX(xt.start))||xt.end&&St.isAfter(JX(xt.end)))}if(xt.filterType==="numberRange"){const St=parseFloat(xt.min),on=parseFloat(xt.max),cn=parseFloat(Qt);return!(!isNaN(St)&&cn<St||!isNaN(on)&&cn>on)}return!0}))}function de(rt,st){if(!st.key||!st.direction)return rt;const He=e.find(Ve=>Ve.key===st.key);return He?[...rt].sort((Ve,bt)=>{const xt=He.sortValue?He.sortValue(Ve):Ve[st.key],Qt=He.sortValue?He.sortValue(bt):bt[st.key],St=xt==null||xt==="-",on=Qt==null||Qt==="-";return St&&on?0:St?1:on?-1:typeof xt=="number"&&typeof Qt=="number"?st.direction==="asc"?xt-Qt:Qt-xt:typeof xt=="string"&&typeof Qt=="string"?st.direction==="asc"?xt.localeCompare(Qt):Qt.localeCompare(xt):xt<Qt?st.direction==="asc"?-1:1:xt>Qt?st.direction==="asc"?1:-1:0}):rt}function G(rt){I(st=>st.key===rt?st.direction==="asc"?{key:rt,direction:"desc"}:st.direction==="desc"?{key:null,direction:null}:{key:rt,direction:"asc"}:{key:rt,direction:"asc"})}function ie(rt){if(N.key===rt){if(N.direction==="asc")return i.jsx(i2,{className:"inline ml-1"});if(N.direction==="desc")return i.jsx(s2,{className:"inline ml-1"})}return i.jsx(a2,{className:"inline ml-1"})}function ae(rt,st){M(He=>{const Ve=He[rt]||{};return{...He,[rt]:{...Ve,...st}}})}function q(rt){M(st=>{const He={...st};return delete He[rt],He})}function W(rt,st){const He=rt.currentTarget.getBoundingClientRect(),Ve=He.left+He.width/2-192/2+window.scrollX,bt=He.bottom+window.scrollY;if(se({top:bt,left:Ve}),F===st.key)$(null),z(null);else{$(st.key);const xt=P[st.key]||{};z({filterType:st.filterType,value:xt.value||"",values:xt.values||[],start:xt.start||"",end:xt.end||"",min:xt.min||"",max:xt.max||""})}}function ne(rt){L&&ae(rt,L),$(null),z(null)}function oe(rt){if(!L)return null;const st=L.filterType;return Qse.createPortal(i.jsxs("div",{ref:ee,style:{position:"absolute",top:Q.top,left:Q.left,zIndex:9999},children:[st==="text"&&i.jsxs("div",{className:"bg-black/10 border border-gray-400 text-white p-2 font-inter font-semibold shadow-xl w-48 rounded-2xl backdrop-blur-lg",children:[i.jsx("input",{ref:K,type:"text",value:L.value,onChange:He=>z(Ve=>({...Ve,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:()=>{q(rt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ne(rt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),st==="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:[(rt.options||[]).map(He=>{const Ve=L.values,bt=Ve.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:bt,onChange:()=>{z(bt?xt=>({...xt,values:Ve.filter(Qt=>Qt!==He)}):xt=>({...xt,values:[...Ve,He]}))}}),He]},He)}),i.jsxs("div",{className:"flex justify-between mt-2",children:[i.jsx("button",{onClick:()=>{q(rt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ne(rt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),st==="dateRange"&&i.jsxs("div",{className:"bg-black/10 border border-gray-400 text-white p-2 font-inter font-semibold shadow-xl w-52 rounded-2xl backdrop-blur-lg",children:[i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"Start"}),i.jsx("input",{type:"date",className:"p-1 mb-2 border border-gray-600 bg-gray-700 text-white rounded w-full h-6 text-xs",value:L.start,onChange:He=>z(Ve=>({...Ve,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:L.end,onChange:He=>z(Ve=>({...Ve,end:He.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{q(rt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ne(rt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),st==="numberRange"&&i.jsxs("div",{className:"bg-black/10 border-2 border-gray-700 text-white p-2 font-inter font-semibold shadow-xl w-48 rounded-2xl backdrop-blur-lg",children:[i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"Min"}),i.jsx("input",{type:"number",step:"any",className:"p-1 mb-2 border border-gray-600 bg-gray-700 text-white rounded w-full h-6",value:L.min,onChange:He=>z(Ve=>({...Ve,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:L.max,onChange:He=>z(Ve=>({...Ve,max:He.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{q(rt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ne(rt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]})]}),document.body)}const he=Array.isArray(t)?t:[],_e=x?[]:de(re(he,e,P),N),xe=e.map(rt=>rt.width||"minmax(0, 100%)").join(" "),Se=e.map((rt,st)=>typeof rt.skeletonWidth=="number"?rt.skeletonWidth:60+st*23%80),ge=Object.keys(P).length>0,Ce=!x&&_e.length===0;function je({w:rt}){return i.jsx("span",{className:"block h-[14px] rounded bg-[#242424] animate-pulse",style:{width:rt}})}function Oe({index:rt,style:st}){return i.jsx("div",{style:{...st,display:"grid",gridTemplateColumns:xe,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({},rt)||"":a||""}`,children:e.map((He,Ve)=>i.jsx("div",{className:`px-4 ${typeof o=="function"?o(He,{},rt)||"":o||""}`,children:y?y({column:He,index:rt,width:Se[Ve]}):i.jsx(je,{w:Se[Ve]})},`sk-${He.key}-${Ve}`))})}function $e({index:rt,style:st}){if(rt<0||rt>=_e.length)return null;const He=_e[rt];return i.jsx("div",{onClick:()=>f&&f(He),style:{...st,display:"grid",gridTemplateColumns:xe,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,rt)||"":a||""}`,children:e.map(Ve=>{const bt=Ve.render?Ve.render(He[Ve.key],He,rt):He[Ve.key];return i.jsx("div",{className:`px-4 overflow-hidden whitespace-nowrap ${typeof o=="function"?o(Ve,He,rt)||"":o||""}`,children:bt},Ve.key)})})}const Ye=x?g:_e.length,Je=x?void 0:u?rt=>u(_e[rt]):void 0,ht=rt=>rt.headerTooltip?i.jsx(Us,{content:rt.headerTooltip,align:rt.headerTooltipAlign||"center",children:i.jsx("span",{className:"inline-flex underline decoration-dotted underline-offset-2 cursor-help pointer-events-auto",children:rt.label})}):rt.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:xe},children:e.map(rt=>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&&rt.sortable&&G(rt.key),children:[ht(rt),rt.sortable&&i.jsx("span",{className:"ml-1",children:ie(rt.key)}),rt.filterType&&i.jsx("span",{className:"ml-2 cursor-pointer",onClick:st=>{st.stopPropagation(),x||W(st,rt)},children:i.jsx(FSt,{className:"w-3 h-3"})}),F===rt.key&&oe(rt)]},rt.key))}),x&&C?i.jsx("div",{className:`${s||""} min-w-max`,children:typeof C=="function"?C({hasFilters:ge}):C}):Ce?i.jsx("div",{className:`${s||""} min-w-max text-xs text-center text-[#9B9B9B]`,children:typeof v=="function"?v({hasFilters:ge}):v}):i.jsx(Iln,{className:`${s||""} min-w-max`,height:c,itemCount:Ye,itemSize:l,itemKey:Je,innerElementType:Mln,width:"100%",onItemsRendered:({visibleStartIndex:rt,visibleStopIndex:st})=>!x&&d&&d(_e.slice(rt,st+1)),children:x?Oe:$e})]})})})},kF=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),Rln=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,Lln=(t,e,n,r)=>{const s=t*e/n;return r/s*100};function Dln({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,N]=h.useState(!0),I=h.useRef(new Set),P=h.useRef(new Set),{isReferralCodeName:M}=h.useContext(Yr),F=h.useCallback(q=>{const W=q==null?void 0:q.toLowerCase();return W?(r==null?void 0:r.length)>0?r.some(ne=>{var oe;return((oe=ne.wallet_address)==null?void 0:oe.toLowerCase())===W}):(n==null?void 0:n.toLowerCase())===W:!1},[r,n]),$=h.useMemo(()=>r&&r.length?y:Array.isArray(t)?t:[],[r,y,t]),L=h.useCallback(async q=>{const W=localStorage.getItem("hyperAddress"),ne=localStorage.getItem("hyperToken");if(!(!W||!ne||q.length===0))try{const{data:oe}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:W,token:ne,position_oids:q},{headers:{"Content-Type":"application/json"}});if(oe&&oe.success){const he=parseFloat(oe.leverage);f(_e=>{const xe=new Map(_e);return q.forEach(Se=>xe.set(String(Se),he)),xe})}}catch(oe){console.error("leverage fetch error:",oe)}},[]),z=h.useCallback(async q=>{const W=localStorage.getItem("hyperAddress"),ne=localStorage.getItem("hyperToken");if(!(!W||!ne||q.length===0))try{const{data:oe}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_position_details_with_oids/",{address:W,token:ne,position_oids:q},{headers:{"Content-Type":"application/json"}});oe&&oe.success&&g(he=>{const _e=new Map(he);return oe.data.forEach(xe=>_e.set(String(xe.oid),xe)),_e})}catch(oe){console.error("source details fetch error:",oe)}},[]),Q=h.useMemo(()=>(r??[]).map(q=>{var W;return(W=q.wallet_address)==null?void 0:W.toLowerCase()}).sort().join(","),[r]);h.useEffect(()=>{if(Q===""){N(!1),v([]);return}let q=!1;return N(!0),a(!1),I.current.clear(),P.current.clear(),f(new Map),g(new Map),u(new Map),(async()=>{try{const W=Q.split(","),ne=(await Promise.all(W.map(async he=>{const[_e,xe]=await Promise.all([mde(he),xde(he)]),Se=[..._e,...xe.map(({fill:ge,twapId:Ce})=>({...ge,twapId:Ce}))];return gde(Se).closed_positions||[]}))).flat();if(q)return;const oe=ne.sort((he,_e)=>(_e.close_time||0)-(he.close_time||0));v(oe),l(null)}catch(W){console.error("multi-wallet completed-trades fetch:",W)}finally{q||N(!1)}})(),()=>{q=!0}},[Q]);const se=h.useCallback(q=>{const W=new Set,ne=new Set;q.forEach(oe=>{((e==null?void 0:e.some(_e=>F(_e.wallet_address)))||!1)&&oe.has_builder_fee&&(oe.oids||[]).forEach(_e=>{I.current.has(_e)||W.add(_e),P.current.has(_e)||ne.add(_e)})}),W.size>0&&(W.forEach(oe=>I.current.add(oe)),L([...W])),ne.size>0&&(ne.forEach(oe=>P.current.add(oe)),z([...ne]))},[e,F,L,z]);function ee({date:q}){const[W,ne]=h.useState(Uo(q));return h.useEffect(()=>{const oe=setInterval(()=>{ne(Uo(q))},1e3);return()=>clearInterval(oe)},[q]),i.jsx("span",{className:"text-white text-sm font-bold font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:W.dateTime})}const K=q=>u(W=>new Map(W).set(q,!W.get(q))),re=(q,W)=>c.get(W)?i.jsx(ee,{date:q}):$c(q),de=h.useMemo(()=>[...new Set($.map(q=>q.coin))],[$]),G=h.useMemo(()=>$.map(q=>({...q,uid:q.trade_id||q.oid||`${q.open_time}_${q.close_time}`,liqStatus:q.isLiquidated?"Liquidated":"Not Liquidated"})).sort((q,W)=>(W.close_time||0)-(q.close_time||0)),[$]),ie=async q=>{var Se;const W=localStorage.getItem("hyperAddress"),ne=localStorage.getItem("hyperToken"),oe=q.oids??[];let he=q.leverage??q.positionDistribution??0;if(W&&ne&&oe.length>0)try{he=((Se=(await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:W,token:ne,position_oids:oe},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:Se.leverage)??he}catch(ge){console.error("Leverage fetch failed:",ge)}const _e=Lln(q.entry_price_wma,q.total_size,he,q.total_pnl),xe=ge=>Math.abs(ge)<1?ge.toFixed(4):ge.toFixed(2);l({coin:q.coin,type:q.position_side,leverage:he,roe:xe(_e),entryPrice:q.entry_price_wma,markPrice:q.close_px,positionDistribution:q.total_size,pnl:q.total_pnl-q.total_fee,closePx:q.close_px,referral:M??"--"}),a(!0)},ae=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,filterType:"text",render:(q,W)=>i.jsxs("a",{href:`/terminal/${W.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/${W.coin}.svg`,alt:W.coin,className:"w-5 h-5 mr-2",loading:"lazy",onError:Qi}),W.coin]})},{key:"source_tag",label:"Source Tag",sortable:!0,filterType:"text",render:(q,W)=>{const ne=x.get(W.oids&&String(W.oids[0]));return ne?i.jsx("a",{href:`/wallet-details/${ne.copy_trader_wallet}`,className:"text-white hover:text-white",children:ne.source_tag||"--"}):"--"}},{key:"position_side",label:"Direction",sortable:!0,filterType:"text",render:(q,W)=>{const oe={Sell:"Sell",Buy:"Buy","Close Short":"Short","Close Long":"Long","Open Short":"Short","Open Long":"Long"}[q]??q??"--",he=["buy","long"].includes(oe.toLowerCase()),_e=["sell","short"].includes(oe.toLowerCase()),xe=(()=>{if(!(((e==null?void 0:e.some(Ce=>F(Ce.wallet_address)))||!1)&&W.has_builder_fee))return"";const ge=d.get(W.oids&&String(W.oids[0]));return ge?` - ${ge}x`:""})();return i.jsxs("div",{className:`h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5 ${he?"text-[#67ffbd] bg-[#67ffbd]/20":_e?"text-[#ff787b] bg-[#ff797c]/20":"text-white"}`,children:[i.jsx(Os,{className:`w-3 h-3 ${he?"fill-[#67ffbd] rotate-180":_e?"fill-[#ff787b]":""}`}),i.jsxs("span",{className:"text-[11px] font-semibold uppercase",children:[oe,xe," "]})]})}},{key:"total_size",label:"Size",sortable:!0,filterType:"numberRange",render:kF},{key:"entry_price_wma",label:"Entry Price",sortable:!0,filterType:"numberRange",render:kF},{key:"close_px",label:"Close Price",sortable:!0,filterType:"numberRange",render:kF},{key:"total_pnl",label:"PnL",sortable:!0,filterType:"numberRange",sortValue:q=>q.total_pnl-q.total_fee,render:(q,W)=>{const ne=(e==null?void 0:e.some(oe=>F(oe.wallet_address)))||!1;return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:W.total_pnl-W.total_fee>0?"text-[#4ae3b5]":W.total_pnl-W.total_fee<0?"text-[#ff6b6b]":"text-white",children:["$",kF(Math.abs(W.total_pnl-W.total_fee))]}),ne&&W.has_builder_fee&&i.jsx("img",{src:jm,alt:"share",className:"w-4 h-4 cursor-pointer",onClick:oe=>{oe.stopPropagation(),ie(W)}})]})}},{key:"total_fee",label:"Fee (USDC)",sortable:!0,filterType:"numberRange",width:"240px",render:(q,W)=>i.jsxs("span",{children:[Er(parseFloat(W.total_fee))," ",W.builder_fee?i.jsxs("span",{className:"text-xs",children:["(",Er(parseFloat(W.builder_fee))," builder fee)"]}):""]})},{key:"duration_hours",label:"Duration",sortable:!0,filterType:"numberRange",render:Rln},{key:"open_time",label:"Opened",sortable:!0,filterType:"dateRange",render:(q,W)=>i.jsx("div",{onClick:()=>K(W.uid),className:"cursor-pointer",children:re(W.open_time,W.uid)}),width:"200px"},{key:"close_time",label:"Closed",sortable:!0,filterType:"dateRange",render:(q,W)=>i.jsx("div",{onClick:()=>K(W.uid),className:"cursor-pointer",children:re(W.close_time,W.uid)}),width:"200px"}],[de,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:ae,tableClassName:"min-w-full border-separate border-spacing-y-1",theadClassName:"sticky top-0 bg-[#161616]",rowClassName:"bg-[#1b1b1b] hover:bg-[#222222] text-white",rowKey:q=>q.uid,onVisibleRows:se}),s&&i.jsx(nI,{open:s,setOpen:a,data:o,setShare:()=>{},setTradeInfo:()=>{},pnlTitle:"REALIZED PNL"})]})}const Bln=({data:t,setData:e,wallet:n,coinNameData:r})=>{var q;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),N=localStorage.getItem("isDateTwapFillsFormat")||"date",[I,P]=h.useState(N);h.useEffect(()=>{localStorage.setItem("isDateTwapFillsFormat",I)},[I]);const M="-time",[F,$]=h.useState(M),L=W=>{const ne=r.find(oe=>oe.label===W);return ne?ne.value.toUpperCase():W==null?void 0:W.toUpperCase()},z=t==null?void 0:t.filter(W=>d?L(W.coin).includes(d.toUpperCase()):!0).filter(W=>{var ne,oe;return x?(oe=(ne=W==null?void 0:W.oid)==null?void 0:ne.toString())==null?void 0:oe.includes(x):!0}),Q=W=>z==null?void 0:z.sort((ne,oe)=>{const he=ne.coin?ne.coin.toUpperCase():"",_e=oe.coin?oe.coin.toUpperCase():"",xe=je=>parseFloat(je.closedPnl||0)-parseFloat(je.fee||0),Se=(je="")=>{const Oe=je.toLowerCase(),$e=Oe.includes("long")||Oe==="buy",Ye=Oe.includes("short")||Oe==="sell";return $e&&!Ye?3:$e&&Ye?2:Ye&&!$e?1:0},ge=parseFloat(ne.sz)*parseFloat(ne.px),Ce=parseFloat(oe.sz)*parseFloat(oe.px);return W==="-price"?oe.px-ne.px:W==="price"?ne.px-oe.px:W==="-size"?oe.sz-ne.sz:W==="size"?ne.sz-oe.sz:W==="-fee"?oe.fee-ne.fee:W==="fee"?ne.fee-oe.fee:W==="-closedPnl"?xe(oe)-xe(ne):W==="closedPnl"?xe(ne)-xe(oe):W==="-oid"?oe.oid-ne.oid:W==="oid"?ne.oid-oe.oid:W==="-coin"?he<_e?-1:he>_e?1:0:W==="coin"?he>_e?-1:he<_e?1:0:W==="-time"?new Date(oe.time)-new Date(ne.time):W==="time"?new Date(ne.time)-new Date(oe.time):W==="-dir"?Se(oe.dir)-Se(ne.dir):W==="dir"?Se(ne.dir)-Se(oe.dir):W==="-tradeValue"?Ce-ge:W==="tradeValue"?ge-Ce:0});h.useEffect(()=>{(async()=>{try{a(!0);const ne=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"userTwapSliceFills",user:n}),he=((ne==null?void 0:ne.data)||[]).map(_e=>({..._e.fill,twapId:_e.twapId||null}));e(he==null?void 0:he.sort((_e,xe)=>xe.time-_e.time))}catch(ne){console.error("Error fetching twap data:",ne)}finally{a(!1)}})()},[n]),h.useEffect(()=>{function W(ne){y.current&&!y.current.contains(ne.target)&&l(!1),v.current&&!v.current.contains(ne.target)&&u(!1)}return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[]);const se=h.useRef(null),ee=()=>{se.current&&(se.current.scrollLeft-=200)},K=()=>{se.current&&(se.current.scrollLeft+=200)},re=()=>{se.current&&(se.current.scrollTop+=200)},de=()=>{se.current&&(se.current.scrollTop-=200)},G=W=>W>=640&&W<1024?5:W>=1024&&W<1240?8:W>=1240&&W<1540||W>=1540?9:4;function ie({date:W}){const[ne,oe]=h.useState(Uo(W));return h.useEffect(()=>{const he=setInterval(()=>{oe(Uo(W))},1e3);return()=>clearInterval(he)},[W]),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:ne.dateTime})}const ae={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 justify-start items-center gap-2 hidden lg:flex",children:[i.jsx("button",{onClick: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(zl,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:K,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(zl,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:de,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(zl,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:re,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(zl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:se,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(dSe,{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:W=>f(W.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(dSe,{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(N7,{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(N7,{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(N7,{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(N7,{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(N7,{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:W=>g(W.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||Q(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(Ba,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:Kl,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."})})]})]})})})})}):(q=Q(F))==null?void 0:q.map((W,ne)=>{var oe,he,_e,xe,Se,ge;return i.jsxs(Ie.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:()=>{P(I=="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:I=="time"?i.jsx(ie,{date:W.time}):$c(W.time)})}),i.jsx("td",{className:"text-left cursor-pointer",children:i.jsx("div",{onClick:()=>{var Ce;window.open(`/terminal/${((Ce=r==null?void 0:r.find(je=>je.label===W.coin))==null?void 0:Ce.value)||W.coin}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-4 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${((oe=r==null?void 0:r.find(Ce=>Ce.label===W.coin))==null?void 0:oe.value)||ae[W.coin]||((he=W.coin)==null?void 0:he.split("/")[0])}.svg`||za,alt:W==null?void 0:W.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Ce=>Qi(Ce)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const Ce=r.find(je=>je.label===W.coin);return Ce?Ce.value:W.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 ${W!=null&&W.liquidation?"text-white":(_e=W.dir)!=null&&_e.includes("Short")||(xe=W.dir)!=null&&xe.includes("Sell")?"text-[#ff6b6b]":(Se=W.dir)!=null&&Se.includes("Long")||(ge=W.dir)!=null&&ge.includes("Buy")?"text-[#4ae3b5]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:W!=null&&W.liquidation?"Liquidation":W.dir?W.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:W.px!=null&&!isNaN(parseFloat(W.px))?`$${parseFloat(W.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:W.sz!=null&&!isNaN(parseFloat(W.sz))?Er(parseFloat(W.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:W.px!=null&&W.sz!=null&&!isNaN(parseFloat(W.px))&&!isNaN(parseFloat(W.sz))?i.jsxs(i.Fragment,{children:["$",Er(parseFloat(W.px)*parseFloat(W.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:W.fee!=null&&!isNaN(parseFloat(W.fee))?Er(parseFloat(W.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(W.closedPnl)-parseFloat(W.fee)>0?"text-[#4ae3b5]":parseFloat(W.closedPnl)-parseFloat(W.fee)<0?"text-[#ff6b6b]":"text-white"} text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]`,children:W.closedPnl!=null&&W.fee!=null&&!isNaN(parseFloat(W.closedPnl))&&!isNaN(parseFloat(W.fee))?i.jsxs(i.Fragment,{children:["$",Er(Math.abs(parseFloat(W.closedPnl)-parseFloat(W.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:W!=null&&W.oid?W==null?void 0:W.oid:"--"})})})]},ne),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},ne)})})]})})]})},N7=({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})}),dSe=({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})}),kC="https://api-ui.hyperliquid.xyz/info",$ln="wss://api.hyperliquid.xyz/ws",RVe=({initialAddress:t="",wallets:e})=>{var Es,br,Zt;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),[N,I]=h.useState("positions"),P=h.useRef(null),M=Ao(),F=h.useRef(t),$=h.useRef(null),L=h.useRef(null),[z,Q]=h.useState({});h.useState(!1),h.useState("");const[se,ee]=h.useState(null),{getTrackedWatchList:K,hyperToken:re,copyTradeWatchList:de,getCopyTradeWatchList:G,setTelegramChatId:ie,setSubscriberRole:ae,setSubsExpireDay:q,setMushboomerETH:W,setMushboomerSOL:ne,setIsReferralCode:oe,isReferralCodeName:he,setIsReferralCodeName:_e,setIsWhitelist:xe,setHyperToken:Se,setHyperAddress:ge,setSignModalOpen:Ce,latestPnL:je}=h.useContext(Yr),{isConnected:Oe,address:$e}=es();h.useState(!1),h.useState(!1),h.useState(null),h.useState("");const[Ye,Je]=h.useState(!1);h.useState(!1);const[ht,rt]=h.useState({}),[st,He]=h.useState(!1),[Ve,bt]=h.useState([]),[xt,Qt]=h.useState(null);xt||je.activeRange;const St=Xl(),on=St.pathname.includes("/wallet-management");h.useEffect(()=>{Qt(null)},[je.activeRange]);const cn=[{label:"@10",value:"GMEOW"},{label:"@112",value:"MEOW"},{label:"@115",value:"HOLD"},{label:"@117",value:"BERA"},{label:"@12",value:"XULIAN"},{label:"@123",value:"FARM"},{label:"@131",value:"ORA"},{label:"@132",value:"LIQD"},{label:"@134",value:"STAR"},{label:"@135",value:"SENT"},{label:"@136",value:"SOLV"},{label:"@16",value:"CZ"},{label:"@18",value:"ANSEM"},{label:"@21",value:"KOBE"},{label:"@22",value:"HAPPY"},{label:"@25",value:"BIGBEN"},{label:"@3",value:"MANLET"},{label:"@30",value:"FARMED"},{label:"@31",value:"GPT"},{label:"@32",value:"PURRPS"},{label:"@33",value:"BID"},{label:"@34",value:"HODL"},{label:"@1",value:"HFUN"},{label:"@100",value:"UP"},{label:"@101",value:"NIGGO"},{label:"@102",value:"HOP"},{label:"@103",value:"LUCKY"},{label:"@104",value:"COPE"},{label:"@105",value:"HPYH"},{label:"@106",value:"YAP"},{label:"@107",value:"HYPE"},{label:"@108",value:"CHEF"},{label:"@109",value:"WOW"},{label:"@11",value:"PEPE"},{label:"@110",value:"STEEL"},{label:"@111",value:"RETARD"},{label:"@113",value:"NEIRO"},{label:"@114",value:"PEAR"},{label:"@116",value:"MUNCH"},{label:"@118",value:"GENESY"},{label:"@119",value:"BUBZ"},{label:"@120",value:"PICKL"},{label:"@121",value:"SHEEP"},{label:"@122",value:"LAUNCH"},{label:"@124",value:"FLASK"},{label:"@125",value:"VAULT"},{label:"@126",value:"CAT"},{label:"@127",value:"HYENA"},{label:"@128",value:"DEPIN"},{label:"@129",value:"MON"},{label:"@13",value:"RUG"},{label:"@130",value:"BEATS"},{label:"@133",value:"H"},{label:"@137",value:"FLY"},{label:"@138",value:"TIME"},{label:"@139",value:"SOVRN"},{label:"@14",value:"ILIENS"},{label:"@15",value:"FUCKY"},{label:"@17",value:"BAGS"},{label:"@19",value:"TATE"},{label:"@2",value:"LICK"},{label:"@20",value:"PUMP"},{label:"@23",value:"SCHIZO"},{label:"@24",value:"SELL"},{label:"@26",value:"CATNIP"},{label:"@27",value:"HBOOST"},{label:"@28",value:"SUCKY"},{label:"@29",value:"GUP"},{label:"@35",value:"VEGAS"},{label:"@37",value:"VAPOR"},{label:"@38",value:"PANDA"},{label:"@39",value:"PILL"},{label:"@40",value:"ADHD"},{label:"@41",value:"FUN"},{label:"@42",value:"LADY"},{label:"@46",value:"DROP"},{label:"@47",value:"MBAPPE"},{label:"@48",value:"TEST"},{label:"@49",value:"RAGE"},{label:"@5",value:"SIX"},{label:"@50",value:"FRAC"},{label:"@51",value:"ATEHUN"},{label:"@52",value:"COZY"},{label:"@53",value:"ARI"},{label:"@54",value:"WASH"},{label:"@55",value:"ANT"},{label:"@59",value:"CATBAL"},{label:"@60",value:"TJIF"},{label:"@61",value:"GUESS"},{label:"@62",value:"MAXI"},{label:"@63",value:"NMTD"},{label:"@66",value:"RISE"},{label:"@67",value:"CINDY"},{label:"@70",value:"FRIED"},{label:"@73",value:"RANK"},{label:"@74",value:"OMNIX"},{label:"@75",value:"RIP"},{label:"@76",value:"G"},{label:"@77",value:"BOZO"},{label:"@78",value:"SPH"},{label:"@82",value:"BUSSY"},{label:"@83",value:"FATCAT"},{label:"@84",value:"SHREK"},{label:"@85",value:"PIP"},{label:"@86",value:"LQNA"},{label:"@87",value:"NASDAQ"},{label:"@88",value:"YEETI"},{label:"@9",value:"TRUMP"},{label:"@90",value:"FEIT"},{label:"@92",value:"VIZN"},{label:"@93",value:"STRICT"},{label:"@94",value:"AUTIST"},{label:"@96",value:"HGOD"},{label:"@97",value:"LIQUID"},{label:"@36",value:"ASI"},{label:"@4",value:"JEFF"},{label:"@43",value:"MOG"},{label:"@44",value:"HPEPE"},{label:"@45",value:"JEET"},{label:"@57",value:"RICH"},{label:"@58",value:"LORA"},{label:"@6",value:"WAGMI"},{label:"@65",value:"PIGEON"},{label:"@64",value:"HPUMP"},{label:"@69",value:"STACK"},{label:"@7",value:"CAPPY"},{label:"@72",value:"NOCEX"},{label:"@79",value:"SHOE"},{label:"@80",value:"MONAD"},{label:"@81",value:"HOPE"},{label:"@89",value:"SYLVI"},{label:"@91",value:"FRUDO"},{label:"@95",value:"MAGA"},{label:"@99",value:"EARTH"},{label:"@56",value:"NFT"},{label:"@8",value:"POINTS"},{label:"@68",value:"CHINA"},{label:"@141",value:"GOD"}];function Vn(me,dt){const _t=dt.map(({fill:At,twapId:xn})=>({...At,twapId:xn}));return[...me,..._t]}const tn=(me,dt)=>{const _t=Vt(dt,me);o.current={...o.current,[me]:_t},a(Object.values(o.current).flat()),d(!1)};h.useEffect(()=>{t&&(async()=>{const me=await mde(t),dt=await xde(t),_t=Vn(me,dt),{closed_positions:At}=gde(_t);ee(At)})()},[t]);const fn=(e??[]).map(me=>{var dt;return(dt=me.wallet_address)==null?void 0:dt.toLowerCase()}).filter(Boolean),rn=h.useMemo(()=>[...new Set(fn)].sort().join("|"),[fn.join("|")]);h.useEffect(()=>{if(!e||e.length===0)return;const me=e.map(_t=>_t.wallet_address.toLowerCase());if(me.length===0)return;let dt=!0;return c(!0),d(!0),(async()=>{try{const _t=await Promise.all(me.map(async _r=>{const[pr,hr]=await Promise.all([ps.post(kC,{aggregateByTime:!0,type:"userFills",user:_r}),ps.post(kC,{type:"clearinghouseState",user:_r})]);return{addr:_r,fills:pr.data??[],state:hr.data}}));if(!dt)return;const At=_t.flatMap(_r=>_r.fills),xn=Ut(At);r(xn);const Cn=_t.flatMap(_r=>{var pr;return(pr=_r.state)!=null&&pr.assetPositions?_r.state.assetPositions.map(hr=>({...hr,_wallet:_r.addr})):[]}),fr=Vt({assetPositions:Cn});a(fr),nt(me)}catch(_t){console.error("Multi-wallet fetch error:",_t)}finally{dt&&c(!1)}})(),()=>{dt=!1}},[rn]),h.useEffect(()=>(t&&(F.current=t,it(t)),()=>{P.current&&(P.current.close(),P.current=null),$.current&&(clearTimeout($.current),$.current=null),L.current&&(clearInterval(L.current),L.current=null)}),[t]),h.useEffect(()=>{const me=async()=>{var dt;document.visibilityState==="visible"&&(((dt=P.current)==null?void 0:dt.readyState)!==WebSocket.OPEN&&nt(F.current.split("|")),F.current.split("|").forEach(_t=>{ps.post(kC,{type:"clearinghouseState",user:_t}).then(At=>tn(_t,At.data))}))};return document.addEventListener("visibilitychange",me),()=>document.removeEventListener("visibilitychange",me)},[]),h.useEffect(()=>{const me=localStorage.getItem("favoriteAddresses");me&&Q(JSON.parse(me))},[]);const nt=me=>{var _t;const dt=Array.isArray(me)?me:[me];o.current={},a([]),!(((_t=P.current)==null?void 0:_t.readyState)===WebSocket.OPEN&&F.current===$e)&&(L.current&&(clearInterval(L.current),L.current=null),$.current&&(clearTimeout($.current),$.current=null),P.current&&(P.current.close(),P.current=null),F.current=dt.join("|"),P.current=new WebSocket($ln),P.current.onopen=()=>{console.log("WebSocket Connected"),C(!0);const At=[];dt.forEach(xn=>{At.push({method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:xn}},{method:"subscribe",subscription:{type:"user",user:xn}},{method:"subscribe",subscription:{type:"webData2",user:xn}},{method:"subscribe",subscription:{type:"userTwapSliceFills",user:xn}})}),At.forEach(xn=>{P.current.send(JSON.stringify(xn))}),L.current=setInterval(()=>{var xn;if(((xn=P.current)==null?void 0:xn.readyState)===WebSocket.OPEN){const Cn={id:99,method:"ping"};P.current.send(JSON.stringify(Cn))}},3e4)},P.current.onclose=At=>{C(!1),L.current&&(clearInterval(L.current),L.current=null),At.code!==1e3&&($.current||($.current=setTimeout(()=>{$.current=null,F.current===$e&&nt([$e])},5e3)))},P.current.onerror=At=>{console.error("WebSocket Error:",At),C(!1)},P.current.onmessage=At=>{var xn,Cn,fr,_r;try{const pr=JSON.parse(At.data);if(pr.method==="pong"||pr.result==="success")return;if(pr.channel==="userFills"&&((xn=pr.data)!=null&&xn.fills)&&F.current.toLowerCase()===pr.data.user.toLowerCase()&&r(hr=>{const Xr=hr.flatMap(nr=>nr.fills),is=new Map;Xr.forEach(nr=>{is.set(nr.hash,!0)});const Pr=pr.data.fills.filter(nr=>!is.has(nr.hash));if(Pr.length===0)return hr;const yr=[...Pr,...Xr];return Ut(yr)}),pr.channel==="webData2"&&((Cn=pr.data)!=null&&Cn.clearinghouseState)&&(y(pr.data.clearinghouseState),tn(pr.data.user.toLowerCase(),pr.data.clearinghouseState)),pr.channel==="user"&&((fr=pr.data)!=null&&fr.fills&&r(hr=>{const Xr=hr.flatMap(nr=>nr.fills),is=new Map;Xr.forEach(nr=>{is.set(nr.hash,!0)});const Pr=pr.data.fills.filter(nr=>!is.has(nr.hash));if(Pr.length===0)return hr;const yr=[...Pr,...Xr];return Ut(yr)}),(_r=pr.data)!=null&&_r.state)){y(pr.data.state);const hr=Vt(pr.data.state);a(hr)}if(pr.channel==="userTwapSliceFills"){const hr=pr==null?void 0:pr.data;if(!Ve||Ve.length===0||!hr||hr.length===0)return;const Xr=hr==null?void 0:hr.map(Pr=>({...Pr.fill,twapId:Pr.twapId||null})),is=[...Ve];Xr.forEach(Pr=>{const yr=is==null?void 0:is.findIndex(nr=>nr.oid===Pr.oid);yr!==-1?is[yr]={...is[yr],...Pr}:is.unshift(Pr)}),bt(is)}}catch(pr){console.error("Error processing WebSocket message:",pr),console.error("Raw message that caused error:",At.data)}})},it=async me=>{const[dt,_t]=await Promise.all([ps.post(kC,{aggregateByTime:!0,type:"userFills",user:me}),ps.post(kC,{type:"clearinghouseState",user:me})]);if(_t.data&&tn(me.toLowerCase(),_t.data),!me){dn.error("Please enter a wallet address");return}if(!me.match(/^0x[a-fA-F0-9]{40}$/)){dn.error("Please enter a valid Ethereum address");return}c(!0),d(!0);try{me!==t&&M(`/wallet-details/${me}`),nt(me);const At=await ps.post(kC,{aggregateByTime:!0,type:"userFills",user:me});if(At.data&&Array.isArray(At.data)){const xn=Ut(At.data);r(xn),x(1)}else console.error("Invalid response format:",At.data)}catch(At){console.error("Error fetching data:",At)}finally{c(!1)}},Ut=me=>{const dt=[...me].sort((At,xn)=>xn.time-At.time),_t=new Map;return dt.forEach(At=>{var Cn;const xn=At.oid;if(!_t.has(xn)){const fr=dt.filter(yr=>yr.oid===At.oid),_r=fr.reduce((yr,nr)=>yr+parseFloat(nr.sz),0),pr=fr.map(yr=>parseFloat(yr.startPosition));let hr;pr.includes(0)?hr=0:pr.every(yr=>yr>0)?hr=Math.max(...pr):pr.every(yr=>yr<0)?hr=Math.min(...pr):hr=fr.reduce((yr,nr)=>yr+parseFloat(nr.startPosition),0);const Xr=fr.reduce((yr,nr)=>yr+parseFloat(nr.sz)*parseFloat(nr.px),0),is=fr.reduce((yr,nr)=>yr+parseFloat(nr.closedPnl||0),0),Pr=((Cn=fr.find(yr=>yr.dir==="Long > Short"||yr.dir==="Short > Long"))==null?void 0:Cn.dir)||"";_t.set(xn,{oid:At.oid,asset:At.coin,direction:Pr==""?At.dir:Pr,fills:fr,totalSize:_r,totalStartPositions:hr,totalValue:Xr,pnl:is,latestFill:At.time,isLiquidation:!!At.liquidation})}}),Array.from(_t.values()).sort((At,xn)=>xn.latestFill-At.latestFill)},hn=me=>{const dt=new Date(me),_t=dt.toLocaleString("en-US",{month:"short"}),At=dt.getDate(),xn=dt.getFullYear(),Cn=dt.getHours().toString().padStart(2,"0"),fr=dt.getMinutes().toString().padStart(2,"0"),_r=dt.getHours()>=12?" PM":" AM";return`${_t} ${At}, ${xn}, ${Cn}:${fr} ${_r}`},nn=n,Vt=(me,dt="")=>{if(!(me!=null&&me.assetPositions))return[];const _t=new Map;return n.forEach(At=>{At.fills.forEach(xn=>{let Cn="";xn.dir.includes("Open")?Cn=xn.dir.includes("Long")?"Long":"Short":xn.side==="B"?Cn="Long":xn.side==="S"&&(Cn="Short");const fr=`${xn.coin}-${Cn}`;(!_t.has(fr)||xn.time<_t.get(fr))&&_t.set(fr,xn.time)})}),me.assetPositions.filter(At=>{if(!At.position||!At.position.szi)return!1;const xn=parseFloat(At.position.szi);return!isNaN(xn)&&xn!==0}).map(At=>{const xn=At._wallet||dt||(t==null?void 0:t.toLowerCase()),Cn=At.position,fr=parseFloat(Cn.szi),_r=parseFloat(Cn.entryPx),pr=parseFloat(Cn.positionValue),hr=parseFloat(Cn.unrealizedPnl),Xr=parseFloat(Cn.returnOnEquity)*100,is=parseFloat(Cn.marginUsed),Pr=Cn.leverage.value,yr=Cn.leverage.type,nr=parseFloat(Cn.cumFunding.sinceOpen),gs=fr>0?"Long":"Short",ei=_t.get(`${Cn.coin}-${gs}`);return{wallet:xn,asset:Cn.coin,type:gs,size:fr,entryPrice:_r.toFixed(4),currentPrice:(pr/Math.abs(fr)).toFixed(4),leverage:Pr,marginMode:yr,positionValue:pr.toFixed(2),marginUsed:is.toFixed(2),unrealizedPnl:hr.toFixed(2),roe:Xr.toFixed(2),funding:nr.toFixed(4),startTime:ei?hn(ei):"N/A",liquidationPrice:Cn.liquidationPx?parseFloat(Cn.liquidationPx).toFixed(2):"N/A"}})};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(K(),G())},[]);const pt=h.useRef(null),We=()=>{pt.current&&(pt.current.scrollLeft-=200)},It=()=>{pt.current&&(pt.current.scrollLeft+=200)},Ge=()=>{pt.current&&(pt.current.scrollTop+=200)},ct=()=>{pt.current&&(pt.current.scrollTop-=200)};h.useRef(null);const vt=h.useRef(null),Ht=()=>{vt.current&&(vt.current.scrollLeft-=200)},Rt=()=>{vt.current&&(vt.current.scrollLeft+=200)},mn=()=>{vt.current&&(vt.current.scrollTop+=200)},un=()=>{vt.current&&(vt.current.scrollTop-=200)};h.useRef(null),h.useEffect(()=>{(async()=>{var At,xn;const dt=window.localStorage.getItem("hyperToken"),_t=window.localStorage.getItem("hyperAddress");if(!(!dt||!_t))try{const Cn=await vi(_t.toLowerCase(),dt);Cn!=null&&Cn.success?(ie(Cn==null?void 0:Cn.telegram_chat_id),ae(Cn==null?void 0:Cn.subscriber_role),q(Cn==null?void 0:Cn.subs_expire_day),W((At=Cn==null?void 0:Cn.mushboomer_counts)==null?void 0:At.eth),ne((xn=Cn==null?void 0:Cn.mushboomer_counts)==null?void 0:xn.sol),oe(Cn==null?void 0:Cn.referral_code),_e(Cn==null?void 0:Cn.refcode),xe(Cn==null?void 0:Cn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Se(""),ge(""))}catch(Cn){console.error("Token verification error:",Cn),console.error(Cn.message||"An unknown error occurred.")}})()},[]);const yn=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Liquidation"],_n="-latestFill",[In,Sn]=h.useState(_n),[Yn,Xn]=h.useState([]),[zn,Kn]=h.useState(""),[jn,De]=h.useState(""),[pe,qe]=h.useState(""),[Ae,ze]=h.useState(!1),[zt,kt]=h.useState(!1),[gt,Mt]=h.useState(!1),[ln,vn]=h.useState(!1),Wn=h.useRef(null),On=h.useRef(null),$t=h.useRef(null),Nn=h.useRef(null),Fn=me=>{Xn(dt=>dt.includes(me)?dt.filter(_t=>_t!==me):[...dt,me])};h.useEffect(()=>{function me(dt){Wn.current&&!Wn.current.contains(dt.target)&&ze(!1),On.current&&!On.current.contains(dt.target)&&kt(!1),$t.current&&!$t.current.contains(dt.target)&&Mt(!1),Nn.current&&!Nn.current.contains(dt.target)&&vn(!1)}return document.addEventListener("mousedown",me),()=>document.removeEventListener("mousedown",me)},[]);const Tt=nn.map(me=>{let dt=me.isLiquidation?"Liquidation":me.totalStartPositions==0?"Open Position":me.direction!="Short > Long"&&me.direction!="Long > Short"?(me==null?void 0:me.totalSize)-Math.abs(me==null?void 0:me.totalStartPositions)==0&&(me.direction=="Close Long"||me.direction=="Close Short")?"Position Closed":me.direction=="Open Short"||me.direction=="Open Long"?"Increase":me.direction=="Close Long"||me.direction=="Close Short"?"Decrease":me.direction=="Sell"||me.direction=="Buy"?"Spot":"Changed Position":me.direction=="Short > Long"||me.direction=="Long > Short"?"Changed Position":"Open Position";return{...me,computedType:dt}}),pn=me=>{const dt=cn.find(_t=>_t.label===me);return dt?dt.value.toUpperCase():me==null?void 0:me.toUpperCase()},ke=Tt.filter(me=>Yn.length?Yn.includes(me.computedType):!0).filter(me=>{var dt,_t;return zn?(_t=(dt=me==null?void 0:me.oid)==null?void 0:dt.toString())==null?void 0:_t.includes(zn):!0}).filter(me=>jn?pn(me.asset).includes(jn.toUpperCase()):!0),m=me=>ke==null?void 0:ke.sort((dt,_t)=>{var is,Pr,yr,nr;const At=dt.totalSize?dt.totalValue/dt.totalSize:0,xn=_t.totalSize?_t.totalValue/_t.totalSize:0,Cn=gs=>{const ei=cn.find(ci=>ci.label===gs);return ei?ei.value.toUpperCase():gs==null?void 0:gs.toUpperCase()},fr=Cn(dt.asset),_r=Cn(_t.asset),pr=gs=>{if(!gs)return"";const ei=gs.toLowerCase();return ei.includes("short")?"Short":ei.includes("long")?"Long":ei==="buy"?"Buy":ei==="sell"?"Sell":gs},hr=pr(dt.direction),Xr=pr(_t.direction);if(me==="-totalSize")return _t.totalSize-dt.totalSize;if(me==="totalSize")return dt.totalSize-_t.totalSize;if(me==="-pnl")return _t.pnl-dt.pnl;if(me==="pnl")return dt.pnl-_t.pnl;if(me==="-fills")return(((is=_t.fills)==null?void 0:is.length)||0)-(((Pr=dt.fills)==null?void 0:Pr.length)||0);if(me==="fills")return(((yr=dt.fills)==null?void 0:yr.length)||0)-(((nr=_t.fills)==null?void 0:nr.length)||0);if(me==="-latestFill")return new Date(_t.latestFill)-new Date(dt.latestFill);if(me==="latestFill")return new Date(dt.latestFill)-new Date(_t.latestFill);if(me==="-avgPrice")return xn-At;if(me==="avgPrice")return At-xn;if(me==="-oid")return _t.oid-dt.oid;if(me==="oid")return dt.oid-_t.oid;if(me==="direction"){const gs={Short:1,Sell:2,Long:3,Buy:4};return(gs[hr]||99)-(gs[Xr]||99)}else if(me==="-direction"){const gs={Long:1,Buy:2,Short:3,Sell:4};return(gs[hr]||99)-(gs[Xr]||99)}else{if(me==="-coin")return fr<_r?-1:fr>_r?1:0;if(me==="coin")return fr>_r?-1:fr<_r?1:0}return 0}),p=m(In).filter(me=>(me.totalStartPositions==0?"Open Position":me.direction!="Short > Long"&&me.direction!="Long > Short"?(me==null?void 0:me.totalSize)-Math.abs(me==null?void 0:me.totalStartPositions)==0&&(me.direction=="Close Long"||me.direction=="Close Short")?"Position Closed":me.direction=="Open Short"||me.direction=="Open Long"?"Increase":me.direction=="Close Long"||me.direction=="Close Short"?"Decrease":me.direction=="Sell"||me.direction=="Buy"?"Spot":"Changed Position":me.direction=="Short > Long"||me.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),S={};p.forEach(me=>{var At;const dt=me==null?void 0:me.asset,_t=new Date(me==null?void 0:me.latestFill).getTime();if(!S[dt])S[dt]=me;else{const xn=new Date((At=S[dt])==null?void 0:At.latestFill).getTime();_t>xn&&(S[dt]=me)}});const A=Object.values(S),[k,T]=h.useState([]),D=s==null?void 0:s.filter(me=>{var dt;return pe?(dt=me.asset)==null?void 0:dt.toLowerCase().includes(pe.toLowerCase()):!0}).map(me=>{const dt=A.find(At=>(At==null?void 0:At.asset)===(me==null?void 0:me.asset)),_t=k.find(At=>At.coin===me.asset&&(At.wallet||"").toLowerCase()===(me.wallet||"").toLowerCase());return{...me,latestFill:(dt==null?void 0:dt.latestFill)||null,tagName:(_t==null?void 0:_t.tag)||null,tagWallet:(_t==null?void 0:_t.cp_wallet)||null}}),V="-unrealizedPnl",[X,le]=h.useState(V),ce=me=>D==null?void 0:D.sort((dt,_t)=>{const At=dt.tagName?dt.tagName.toUpperCase():"",xn=_t.tagName?_t.tagName.toUpperCase():"",Cn=dt.asset?dt.asset.toUpperCase():"",fr=_t.asset?_t.asset.toUpperCase():"",_r=dt.type==="Long"?1:0,pr=_t.type==="Long"?1:0,hr=dt.type==="Short"?1:0,Xr=_t.type==="Short"?1:0;return me==="-unrealizedPnl"?_t.unrealizedPnl-dt.unrealizedPnl:me==="unrealizedPnl"?dt.unrealizedPnl-_t.unrealizedPnl:me==="-roe"?_t.roe-dt.roe:me==="roe"?dt.roe-_t.roe:me==="-size"?_t.size-dt.size:me==="size"?dt.size-_t.size:me==="-entryPrice"?_t.entryPrice-dt.entryPrice:me==="entryPrice"?dt.entryPrice-_t.entryPrice:me==="-currentPrice"?_t.currentPrice-dt.currentPrice:me==="currentPrice"?dt.currentPrice-_t.currentPrice:me==="-leverage"?_t.leverage-dt.leverage:me==="leverage"?dt.leverage-_t.leverage:me==="-positionValue"?_t.positionValue-dt.positionValue:me==="positionValue"?dt.positionValue-_t.positionValue:me==="-marginUsed"?_t.marginUsed-dt.marginUsed:me==="marginUsed"?dt.marginUsed-_t.marginUsed:me==="funding"?_t.funding-dt.funding:me==="-funding"?dt.funding-_t.funding:me==="-liquidationPrice"?_t.liquidationPrice-dt.liquidationPrice:me==="liquidationPrice"?dt.liquidationPrice-_t.liquidationPrice:me==="-entryTime"?new Date(_t.latestFill)-new Date(dt.latestFill):me==="entryTime"?new Date(dt.latestFill)-new Date(_t.latestFill):me==="-source_tag"?At<xn?-1:At>xn?1:0:me==="source_tag"?At>xn?-1:At<xn?1:0:me==="-type_leverage"?_r!==pr?pr-_r:_t.leverage-dt.leverage:me==="type_leverage"?hr!==Xr?Xr-hr:_t.leverage-dt.leverage:me==="-asset"?Cn<fr?-1:Cn>fr?1:0:me==="asset"?Cn>fr?-1:Cn<fr?1:0:0}),[fe,ye]=h.useState([]),[Pe,Me]=h.useState(!0),[Ke,we]=h.useState(null),[Te,te]=h.useState([]),[ve,Be]=h.useState(!0),[Ue,Fe]=h.useState(null),[at,ut]=h.useState([]),[yt,Lt]=h.useState(!0),[Gt,an]=h.useState(null);async function et(){try{Me(!0);const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();ye(dt.results)}catch(me){console.error("Error resetting filters:",me),we(me.message)}finally{Me(!1)}}async function Pt(){try{Be(!0);const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();te(dt.results)}catch(me){console.error("Error resetting filters:",me),Fe(me.message)}finally{Be(!1)}}async function qt(){try{Lt(!0);const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();ut(dt.results)}catch(me){console.error("Error resetting filters:",me),an(me.message)}finally{Lt(!1)}}h.useEffect(()=>{et(),Pt(),qt()},[]),h.useState("7D"),h.useState("7D"),s.length,s.filter(me=>me.unrealizedPnl>=0).length;const[ft,tt]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0});((Es=ce(X))==null?void 0:Es.reduce((me,dt)=>me+((dt==null?void 0:dt.leverage)||0),0))/(((br=ce(X))==null?void 0:br.length)||1),(Zt=ce(X))==null||Zt.reduce((me,dt)=>{const _t=parseFloat(dt==null?void 0:dt.funding)||0;return me+_t},0);const tr=localStorage.getItem("isDateOpenPositionsFormat")||"date",[Dn,er]=h.useState(tr);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",Dn)},[Dn]);const dr=localStorage.getItem("isDateFillsFormat")||"date",[kr,qn]=h.useState(dr);h.useEffect(()=>{localStorage.setItem("isDateFillsFormat",kr)},[kr]);function Tn({date:me}){const[dt,_t]=h.useState(Uo(me));return h.useEffect(()=>{const At=setInterval(()=>{_t(Uo(me))},1e3);return()=>clearInterval(At)},[me]),i.jsx("span",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:dt.dateTime})}const[$n,ir]=h.useState([]),ls=async()=>{try{const me=window.localStorage.getItem("hyperToken");if(!me){Ce(!0);return}const dt="https://dextrabothypev2.nftinit.io/api/wallet/list",_t=window.localStorage.getItem("hyperAddress"),xn=await(await fetch(dt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:$e?$e.toLowerCase():_t,token:me,balance:"false"})})).json();xn!=null&&xn.success?(ir(xn.data||[]),Lr(xn.data)):console.log(xn.error_message)}catch(me){console.error("Error fetching generate wallet list:",me)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&ls()},[re]);const[cs,lt]=h.useState([]),[Nt,Rn]=h.useState(!0),[ar,Tr]=h.useState(!1);h.useEffect(()=>{D&&D.length>0&&($r(),$n.length>0&&Nt&&Lr())},[D]);const Lr=()=>{cs.length!==0&&(cr(cs),Nt&&Rn(!1))};h.useEffect(()=>{const me=window.localStorage.getItem("hyperToken");cs.length&&me&&cr(cs)},[cs]);const $r=()=>{const me=window.localStorage.getItem("hyperToken");let dt=!1;const _t=[...cs];D.forEach(At=>{var _r;const xn=At.asset,Cn=(_r=At.wallet||t)==null?void 0:_r.toLowerCase();_t.some(pr=>pr.coin===xn&&(pr.wallet||"").toLowerCase()===Cn)||(_t.push({coin:xn,wallet:Cn}),dt=!0)}),dt&&(lt(_t),$n.some(xn=>xn.wallet_address===(t==null?void 0:t.toLowerCase()))&&me&&cr(_t))},cr=async me=>{if(!ar)try{Tr(!0);const dt=window.localStorage.getItem("hyperToken"),_t="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!dt||!me){Tr(!1);return}dt||Ce(!0);const At=window.localStorage.getItem("hyperAddress"),Cn=await(await fetch(_t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:$e?$e.toLowerCase():At,token:dt,positions:me})})).json();Cn.success?T(Cn==null?void 0:Cn.data):(console.log(Cn.error_message),dn.error(Cn.error_message))}catch(dt){console.error("Error tag request",dt),dn.error(dt.message)}finally{Tr(!1)}},wr=(e==null?void 0:e.length)>1||$n.some(me=>me.wallet_address===(t==null?void 0:t.toLowerCase())),ss=async(me,dt,_t,At,xn)=>{if(!me||!_t||!At||!xn){console.error("Close order called with invalid parameters"),dn.error("Close order called with invalid parameters");return}const Cn=`${At}_${_t}_${xn}`;try{rt(is=>({...is,[Cn]:!0}));const fr=window.localStorage.getItem("hyperToken"),_r="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_new/";if(!fr){Ce(!0),rt(is=>({...is,[Cn]:!1}));return}const pr=window.localStorage.getItem("hyperAddress"),hr=await fetch(_r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:$e?$e.toLowerCase():pr,token:fr,coin:_t,wallet_id:me.toString(),leverage:At,size:xn})});if(!hr.ok)throw new Error(`Server responded with status ${hr.status}`);const Xr=await hr.json();Xr.success?(rt(is=>({...is,[Cn]:!1})),dn.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"}})):Xr.status=="ok"?(rt(is=>({...is,[Cn]:!1})),dn.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!"),dn.error("Something went wrong!"),rt(is=>({...is,[Cn]:!1})))}catch{console.error("Something went wrong!"),dn.error("Something went wrong!"),rt(_r=>({..._r,[Cn]:!1}))}},mr=async(me=[])=>{if(me.length!==0){He(!0);try{await Promise.all(me.map(dt=>ts(dt)))}finally{He(!1)}}},ts=async me=>{if((D==null?void 0:D.length)===0){dn.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(!me){console.error("Close order called with invalid parameters"),dn.error("Close order called with invalid parameters");return}try{He(!0);const dt=window.localStorage.getItem("hyperToken"),_t="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!dt){Ce(!0),He(!1);return}const At=window.localStorage.getItem("hyperAddress"),xn=await fetch(_t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:$e?$e.toLowerCase():At,token:dt,wallet_id:me.toString()})});if(!xn.ok)throw new Error(`Server responded with status ${xn.status}`);const Cn=await xn.json();Cn.status=="ok"?(He(!1),dn.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"}})):Cn.success?(He(!1),dn.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."),dn.error("Close order operation failed."),He(!1))}catch(dt){throw console.error("Something went wrong!"),dn.error("Something went wrong!"),He(!1),dt}},Qs={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(nI,{open:Ye,setOpen:Je,data:ft,setTradeInfo:tt}),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:()=>I("positions"),className:`${N==="positions"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsxs("div",{className:"flex items-center text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none min-w-max",children:[i.jsx("span",{className:"mr-2",children:"Open Positions"}),i.jsx("span",{className:"flex w-[22px] h-[22px] px-3 justify-center items-center gap-[2px] flex-shrink-0 rounded-md bg-[rgba(103,255,189,0.16)] text-[14px] font-semibold font-manrope",children:s.length})]})}),i.jsx("div",{onClick:()=>I("fills"),className:`${N==="fills"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:"text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Fills"})}),i.jsx("div",{onClick:()=>I("trade-history"),className:`${N==="trade-history"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Trade History"})}),i.jsx("div",{onClick:()=>I("twap-history"),className:`${N==="twap-history"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} ${St.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:()=>I("completed-trades"),className:`${N==="completed-trades"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Completed Trades"})}),i.jsx("div",{onClick:()=>I("deposit-withdraw"),className:`${N==="deposit-withdraw"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Deposits & Withdrawals"})}),!on&&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:klt,className:"w-[19px] h-[18px]"}),i.jsx("div",{className:"text-[#C1C1C1] text-[13px] font-semibold font-manrope leading-[8px] hover:text-[#67FFBD]",children:"HypurrScan"})]})]}),N==="fills"?i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 justify-start items-center gap-2 hidden lg:flex",children:[i.jsx("button",{onClick: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(zl,{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(zl,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:un,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(zl,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:mn,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(zl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:vt,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:In,setSortOption:Sn,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>Mt(!gt),className:`${jn?"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 ${jn?"text-blue-500":"text-white"}`})}),gt&&i.jsxs("div",{ref:$t,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:()=>De(""),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:jn,onChange:me=>De(me.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(eQ,{className:"pl-4 min-w-[120px] max-w-[120px] sm:min-w-[144px] sm:max-w-[144px] px-1",title:"Direction",sortKey:"direction",sortOption:In,setSortOption:Sn}),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:()=>ze(!Ae),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"}`})}),Ae&&i.jsxs("div",{ref:Wn,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:()=>Xn([]),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),yn.map(me=>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(me),onChange:()=>Fn(me),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(me)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Yn.includes(me)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),me]},me))]})]})}),i.jsx(Vd,{className:"min-w-[80px] max-w-[80px] px-1",title:"Size",sortKey:"totalSize",sortOption:In,setSortOption:Sn}),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:In,setSortOption:Sn}),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:In,setSortOption:Sn}),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:In,setSortOption:Sn}),i.jsx(Vd,{className:"min-w-[200px] max-w-[200px] px-1",title:"Latest Fill",sortKey:"latestFill",sortOption:In,setSortOption:Sn}),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:In,setSortOption:Sn,isFilterIcon:!0}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>kt(!zt),className:`${zn?"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 ${zn?"text-blue-500":"text-white"}`})}),zt&&i.jsxs("div",{ref:On,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:()=>Kn(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"number",value:zn,onChange:me=>Kn(me.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(In).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:Kl,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(In).map((me,dt)=>{var At,xn,Cn,fr,_r,pr;const _t=me.totalValue/me.totalSize;return(At=me==null?void 0:me.direction)==null||At.includes("Long"),i.jsxs(Ie.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 hr;window.open(`/terminal/${((hr=cn.find(Xr=>Xr.label===me.asset))==null?void 0:hr.value)||me.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/${((xn=cn.find(hr=>hr.label===me.asset))==null?void 0:xn.value)||Qs[me.asset]||((Cn=me.asset)==null?void 0:Cn.split("/")[0])}.svg`||za,alt:me==null?void 0:me.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:hr=>Qi(hr)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const hr=cn.find(Xr=>Xr.label===me.asset);return hr?hr.value:me.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:`${(fr=me.direction)!=null&&fr.includes("Long")?me.direction==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":me.direction==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":me.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:(_r=me.direction)!=null&&_r.includes("Long")?me.direction==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):me.direction==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):me.direction=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:me.direction=="Sell"?"Sell":me.direction=="Buy"?"Buy":me.direction=="Close Short"?"Short":me.direction=="Close Long"?"Long":me.direction=="Open Short"?"Short":me.direction=="Open Long"?"Long":me.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:`${me!=null&&me.isLiquidation?"text-[#ff787b]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] min-w-max`,children:me!=null&&me.isLiquidation?`Market Liquidation: ${me.direction=="Sell"?"Sell":me.direction=="Buy"?"Buy":me.direction=="Close Short"?"Close Short":me.direction=="Close Long"?"Close Long":me.direction=="Open Short"?"Close Short":me.direction=="Open Long"?"Close Long":"Close "+me.direction} `:me.totalStartPositions==0?"Open Position":me.direction!="Short > Long"&&me.direction!="Long > Short"?(me==null?void 0:me.totalSize)-Math.abs(me==null?void 0:me.totalStartPositions)==0&&(me.direction=="Close Long"||me.direction=="Close Short")?"Position Closed":me.direction=="Open Short"||me.direction=="Open Long"?"Increase":me.direction=="Close Long"||me.direction=="Close Short"?"Decrease":me.direction=="Sell"||me.direction=="Buy"?"Spot":"Changed Position":me.direction=="Short > Long"||me.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:fo(me.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:_t?`$${zv(_t)}`:zv(_t)})})}),i.jsx("td",{children:i.jsx("div",{className:`${me.pnl,""} px-1 flex justify-end gap-2 font-manrope min-w-max`,children:i.jsx("div",{className:`${me.pnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:me.pnl?`$${zv(Math.abs(me.pnl))}`:zv(Math.abs(me.pnl))})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:[(pr=me==null?void 0:me.fills)==null?void 0:pr.length," Fills"]})})}),i.jsx("td",{children:i.jsx("div",{onClick:()=>{qn(kr=="time"?"date":"time")},className:"px-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx("div",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]",children:kr=="time"?i.jsx(Tn,{date:me.latestFill}):$c(me.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:me==null?void 0:me.oid})})})]},dt),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},dt)})})]})})]}):N==="positions"?i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 hidden lg:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick: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(zl,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:It,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(zl,{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(zl,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),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(zl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:pt,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:X,setSortOption:le,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>vn(!ln),className:`${pe?"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 ${pe?"text-blue-500":"text-white"}`})}),ln&&i.jsxs("div",{ref:Nn,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:()=>qe(""),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:pe,onChange:me=>qe(me.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),wr&&i.jsx(eQ,{className:"min-w-[130px] sm:min-w-[130px] px-1",title:"Source Tag",sortKey:"source_tag",sortOption:X,setSortOption:le}),i.jsx(eQ,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Liq. Price",sortKey:"liquidationPrice",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:X,setSortOption:le}),i.jsx(Vd,{className:`${wr?"pr-0":"pr-8"} min-w-[185px] sm:min-w-[185px] pl-1`,title:"Entry Time",sortKey:"entryTime",sortOption:X,setSortOption:le}),wr&&i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[150px] pl-1 pr-5",children:i.jsx("div",{className:"flex items-center justify-end w-full gap-1 min-w-max",children:i.jsx("div",{className:"flex items-center justify-end group",children:i.jsxs("div",{onClick:me=>{if(me.preventDefault(),st)return;const _t=(e!=null&&e.length?e.map(At=>At.wallet_address.toLowerCase()):[t==null?void 0:t.toLowerCase()]).map(At=>{var xn;return(xn=$n.find(Cn=>Cn.wallet_address===At))==null?void 0:xn.wallet_id}).filter(Boolean);mr(_t)},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:xae,alt:"",className:"w-4 h-4"})}),st?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(Ba,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:Kl,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((me,dt)=>{var _t,At,xn,Cn,fr;return i.jsxs(Ie.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/${me==null?void 0:me.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/${Qs[me.asset]||((_t=me.asset)==null?void 0:_t.split("/")[0])}.svg`||za,alt:me==null?void 0:me.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:_r=>Qi(_r)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:me.asset})]})})}),wr&&i.jsx("td",{children:i.jsx("div",{onClick:_r=>{_r.preventDefault(),me!=null&&me.tagWallet&&(me==null?void 0:me.tagWallet)!=null&&window.open(`/wallet-details/${me==null?void 0:me.tagWallet}`,"_blank")},className:`${me!=null&&me.tagWallet&&(me==null?void 0:me.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:[(me==null?void 0:me.tagName)==null||(me==null?void 0:me.tagName)==""?"--":((At=me==null?void 0:me.tagName)==null?void 0:At.length)>10?((xn=me==null?void 0:me.tagName)==null?void 0:xn.slice(0,10))+"...":me==null?void 0:me.tagName,(me==null?void 0:me.tagName)&&(me==null?void 0:me.tagName.length)>10&&i.jsx("span",{children:i.jsx(Ma,{content:`${me==null?void 0:me.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:`${me.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:me.type==="Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[me.type," - ",me==null?void 0:me.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:fo(Math.abs(me.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:me.positionValue?`$${fo(me.positionValue)}`:fo(me.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:me.entryPrice?`$${Er(me.entryPrice)}`:Er(me.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:me.currentPrice?`$${Er(me.currentPrice)}`:Er(me.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{tt(_r=>({..._r,coin:me.asset,type:me.type,leverage:me.leverage,roe:me.roe,entryPrice:me.entryPrice,markPrice:me.currentPrice,pnl:me.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?he:null})),Je(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${me.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[me.unrealizedPnl?`$${fo(Math.abs(me.unrealizedPnl))}`:fo(Math.abs(me.unrealizedPnl)),` (${fo(Math.abs(me==null?void 0:me.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:me.liquidationPrice!=null&&me.liquidationPrice!==""&&!isNaN(me.liquidationPrice)?`$${fo(me.liquidationPrice)}`:fo(me.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:[me.marginUsed?`$${fo(me.marginUsed)}`:fo(me.marginUsed)," (",((Cn=me==null?void 0:me.marginMode)==null?void 0:Cn.charAt(0).toUpperCase())+((fr=me==null?void 0:me.marginMode)==null?void 0:fr.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:`${me.funding<=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:me.funding?`$${zv(Math.abs(me.funding))}`:zv(Math.abs(me.funding))})})}),i.jsx("td",{className:`${wr?"":"pr-8 sm:rounded-r-2xl"}`,children:i.jsx("div",{onClick:()=>{er(Dn=="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:me!=null&&me.latestFill?Dn=="time"?i.jsx(Tn,{date:me==null?void 0:me.latestFill}):$c(me==null?void 0:me.latestFill):i.jsx("span",{className:"text-[#979797]",children:"--"})})})}),wr&&i.jsx("td",{className:"pr-5 sm:rounded-r-2xl",children:i.jsx("div",{className:"pl-1 flex flex-col items-end gap-2 font-manrope",children:ht[`${me==null?void 0:me.leverage}_${me==null?void 0:me.asset}_${me==null?void 0:me.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 _r=$n.find(Xr=>{var is;return Xr.wallet_address===((is=me.wallet||t)==null?void 0:is.toLowerCase())}),pr=_r==null?void 0:_r.wallet_id,hr=_r==null?void 0:_r.wallet_address;pr&&ss(pr,hr,me==null?void 0:me.asset,me==null?void 0:me.leverage,me==null?void 0:me.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"}})})]},dt)})})]})})]}):N==="twap-history"&&St.pathname.startsWith("/wallet-details")?i.jsx(Bln,{data:Ve,setData:bt,wallet:t,coinNameData:cn}):N==="trade-history"?i.jsx(gln,{wallet:t,wallets:e}):N==="completed-trades"?i.jsx(Dln,{trades:se,generatedWallets:$n,wallet:t,wallets:e}):N==="deposit-withdraw"?i.jsx(wln,{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})}),eQ=({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 tQ({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=()=>{ps.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getwalletreportsdetail/",{wallet_address:t}).then(I=>{s(I.data.report_count||0);const P=I.data.report_detail.reduce((M,F)=>(M[F.report_type_id]=(M[F.report_type_id]||0)+1,M),{});c(P)})};h.useEffect(()=>{v()},[t]),h.useEffect(()=>{const I=P=>{P.key==="Escape"&&n(!1)};return e&&window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[e]);const C=()=>{a.length||ps.get("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getreporttypes/").then(I=>{var P;return o(((P=I.data)==null?void 0:P.data)||[])})},N=()=>{if(!u){y("Please select a report type");return}const I=localStorage.getItem("hyperAddress"),P=localStorage.getItem("hyperToken");ps.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/walletreport/",{address:I,token:P,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:I=>I.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(EOe,{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(I=>i.jsxs("button",{onClick:()=>{d(I.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===I.id?"bg-white text-[#161616]":"bg-[#1f1f1f] border border-[#353535]"}`,children:[I.name,i.jsx("span",{className:"bg-[#FFC940] text-[#30260E] text-13px font-bold rounded-[6px] px-2",children:l[I.id]||0})]},I.id))}),i.jsx("label",{className:"block text-xs mb-1",children:"Comment (Optional)"}),i.jsx("textarea",{value:f,onChange:I=>x(I.target.value),placeholder:"Describe the behavior or issue you're reporting...",className:"w-full h-24 rounded-lg bg-[#111] border border-[#2d2d2d] p-3 text-sm outline-none placeholder-[#555] resize-none mb-6"}),g&&i.jsx("p",{className:"text-red-500 text-xs font-semibold mb-4 text-center",children:g}),i.jsx("div",{className:"w-full flex justify-center",children:i.jsx("button",{onClick:N,className:"flex bg-[#1f1f1f] w-[128px] h-[32px] px-[16px] py-[12px] justify-center items-center gap-[10px] shrink-0 rounded-[12px] border border-[#353535] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-white hover:text-[#161616]",disabled:!localStorage.getItem("hyperAddress"),children:"Report"})})]})})]})}const fSe="https://api-ui.hyperliquid.xyz/info",Uln="wss://api.hyperliquid.xyz/ws",zln=({initialAddress:t=""})=>{var Es,br,Zt;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=Ao(),N=h.useRef(t),I=h.useRef(null),P=h.useRef(null),M=h.useRef(null),[F,$]=h.useState({}),[L,z]=h.useState(!1),[Q,se]=h.useState(""),[ee,K]=h.useState(null),{trackedWatchList:re,getTrackedWatchList:de,hyperToken:G,copyTradeWatchList:ie,getCopyTradeWatchList:ae,setTelegramChatId:q,setSubscriberRole:W,setSubsExpireDay:ne,setMushboomerETH:oe,setMushboomerSOL:he,setIsReferralCode:_e,isReferralCodeName:xe,setIsReferralCodeName:Se,setIsWhitelist:ge,setHyperToken:Ce,setHyperAddress:je,setSignModalOpen:Oe,latestPnL:$e}=h.useContext(Yr),{isConnected:Ye,address:Je}=es(),[ht,rt]=h.useState(!1),[st,He]=h.useState(!1),[Ve,bt]=h.useState(null),[xt,Qt]=h.useState(null),[St,on]=h.useState(""),[cn,Vn]=h.useState(!1),[tn,fn]=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),rn=tn||$e.activeRange;h.useEffect(()=>{fn(null)},[$e.activeRange]);const nt=[{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 it(me,dt){const _t=dt.map(({fill:At,twapId:xn})=>({...At,twapId:xn}));return[...me,..._t]}h.useEffect(()=>{t&&(async()=>{const me=await mde(t),dt=await xde(t),_t=it(me,dt),{closed_positions:At}=gde(_t);K(At)})()},[t]),h.useEffect(()=>(t&&(N.current=t,nn(t),Ge(t)),()=>{v.current&&(v.current.close(),v.current=null),I.current&&(clearTimeout(I.current),I.current=null),P.current&&(clearInterval(P.current),P.current=null),M.current&&(clearInterval(M.current),M.current=null)}),[t]),h.useEffect(()=>{const me=localStorage.getItem("favoriteAddresses");me&&$(JSON.parse(me))},[]),h.useCallback(()=>{if(F[e]){const me={...F};delete me[e],$(me),localStorage.setItem("favoriteAddresses",JSON.stringify(me))}else z(!0),se("")},[e,F]),h.useCallback(()=>{if(!Q.trim())return;const me={...F,[e]:{name:Q,address:e}};$(me),localStorage.setItem("favoriteAddresses",JSON.stringify(me)),z(!1)},[Q,e,F]),h.useCallback(me=>{me&&(n(me),nn(me),C(`/wallet-details/${me}`))},[]);const Ut=me=>{var dt;((dt=v.current)==null?void 0:dt.readyState)===WebSocket.OPEN&&N.current===me||(P.current&&(clearInterval(P.current),P.current=null),I.current&&(clearTimeout(I.current),I.current=null),v.current&&(v.current.close(),v.current=null),N.current=me,v.current=new WebSocket(Uln),v.current.onopen=()=>{console.log("WebSocket Connected"),y(!0),[{method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:me}},{method:"subscribe",subscription:{type:"user",user:me}}].forEach(At=>{v.current.send(JSON.stringify(At))}),P.current=setInterval(()=>{var At;if(((At=v.current)==null?void 0:At.readyState)===WebSocket.OPEN){const xn={id:99,method:"ping"};v.current.send(JSON.stringify(xn))}},3e4)},v.current.onclose=_t=>{y(!1),P.current&&(clearInterval(P.current),P.current=null),_t.code!==1e3&&(I.current||(I.current=setTimeout(()=>{I.current=null,N.current===me&&Ut(me)},5e3)))},v.current.onerror=_t=>{console.error("WebSocket Error:",_t),y(!1)},v.current.onmessage=_t=>{var At,xn,Cn;try{const fr=JSON.parse(_t.data);if(fr.method==="pong"||fr.result==="success")return;if(fr.channel==="userFills"&&((At=fr.data)!=null&&At.fills)&&N.current.toLowerCase()===fr.data.user.toLowerCase()&&(s(_r=>{const pr=_r.flatMap(Pr=>Pr.fills),hr=new Map;pr.forEach(Pr=>{hr.set(Pr.hash,!0)});const Xr=fr.data.fills.filter(Pr=>!hr.has(Pr.hash));if(Xr.length===0)return _r;const is=[...Xr,...pr];return Vt(is)}),M.current||Ge(N.current)),fr.channel==="user"&&((xn=fr.data)!=null&&xn.fills&&s(_r=>{const pr=_r.flatMap(Pr=>Pr.fills),hr=new Map;pr.forEach(Pr=>{hr.set(Pr.hash,!0)});const Xr=fr.data.fills.filter(Pr=>!hr.has(Pr.hash));if(Xr.length===0)return _r;const is=[...Xr,...pr];return Vt(is)}),(Cn=fr.data)!=null&&Cn.state)){x(fr.data.state);const _r=It(fr.data.state);o(_r)}}catch(fr){console.error("Error processing WebSocket message:",fr),console.error("Raw message that caused error:",_t.data)}})},hn=async me=>{try{rt(!0);const dt=await ps.post(fSe,{type:"clearinghouseState",user:me});if(dt.data){x(dt.data);const _t=It(dt.data);o(_t),rt(!1),_t.length>0&&!M.current?Ge(me):_t.length===0&&M.current&&(clearInterval(M.current),M.current=null)}}catch(dt){console.error("Error fetching user state:",dt),rt(!1)}},nn=async me=>{if(!me){dn.error("Please enter a wallet address");return}if(!me.match(/^0x[a-fA-F0-9]{40}$/)){dn.error("Please enter a valid Ethereum address");return}c(!0);try{me!==t&&C(`/wallet-details/${me}`),Ut(me);const[dt]=await Promise.all([ps.post(fSe,{aggregateByTime:!0,type:"userFills",user:me}),hn(me)]);if(dt.data&&Array.isArray(dt.data)){const _t=Vt(dt.data);s(_t),d(1)}else console.error("Invalid response format:",dt.data)}catch(dt){console.error("Error fetching data:",dt)}finally{c(!1)}},Vt=me=>{const dt=[...me].sort((At,xn)=>xn.time-At.time),_t=new Map;return dt.forEach(At=>{var Cn;const xn=At.oid;if(!_t.has(xn)){const fr=dt.filter(yr=>yr.oid===At.oid),_r=fr.reduce((yr,nr)=>yr+parseFloat(nr.sz),0),pr=fr.map(yr=>parseFloat(yr.startPosition));let hr;pr.includes(0)?hr=0:pr.every(yr=>yr>0)?hr=Math.max(...pr):pr.every(yr=>yr<0)?hr=Math.min(...pr):hr=fr.reduce((yr,nr)=>yr+parseFloat(nr.startPosition),0);const Xr=fr.reduce((yr,nr)=>yr+parseFloat(nr.sz)*parseFloat(nr.px),0),is=fr.reduce((yr,nr)=>yr+parseFloat(nr.closedPnl||0),0),Pr=((Cn=fr.find(yr=>yr.dir==="Long > Short"||yr.dir==="Short > Long"))==null?void 0:Cn.dir)||"";_t.set(xn,{oid:At.oid,asset:At.coin,direction:Pr==""?At.dir:Pr,fills:fr,totalSize:_r,totalStartPositions:hr,totalValue:Xr,pnl:is,latestFill:At.time})}}),Array.from(_t.values()).sort((At,xn)=>xn.latestFill-At.latestFill)},pt=me=>{const dt=new Date(me),_t=dt.toLocaleString("en-US",{month:"short"}),At=dt.getDate(),xn=dt.getFullYear(),Cn=dt.getHours().toString().padStart(2,"0"),fr=dt.getMinutes().toString().padStart(2,"0"),_r=dt.getHours()>=12?" PM":" AM";return`${_t} ${At}, ${xn}, ${Cn}:${fr} ${_r}`},We=r,It=me=>{if(!(me!=null&&me.assetPositions))return[];const dt=new Map;return r.forEach(_t=>{_t.fills.forEach(At=>{let xn="";At.dir.includes("Open")?xn=At.dir.includes("Long")?"Long":"Short":At.side==="B"?xn="Long":At.side==="S"&&(xn="Short");const Cn=`${At.coin}-${xn}`;(!dt.has(Cn)||At.time<dt.get(Cn))&&dt.set(Cn,At.time)})}),me.assetPositions.filter(_t=>{if(!_t.position||!_t.position.szi)return!1;const At=parseFloat(_t.position.szi);return!isNaN(At)&&At!==0}).map(_t=>{const At=_t.position,xn=parseFloat(At.szi),Cn=parseFloat(At.entryPx),fr=parseFloat(At.positionValue),_r=parseFloat(At.unrealizedPnl),pr=parseFloat(At.returnOnEquity)*100,hr=parseFloat(At.marginUsed),Xr=At.leverage.value,is=At.leverage.type,Pr=parseFloat(At.cumFunding.sinceOpen),yr=xn>0?"Long":"Short",nr=dt.get(`${At.coin}-${yr}`);return{asset:At.coin,type:yr,size:xn,entryPrice:Cn.toFixed(4),currentPrice:(fr/Math.abs(xn)).toFixed(4),leverage:Xr,marginMode:is,positionValue:fr.toFixed(2),marginUsed:hr.toFixed(2),unrealizedPnl:_r.toFixed(2),roe:pr.toFixed(2),funding:Pr.toFixed(4),startTime:nr?pt(nr):"N/A",liquidationPrice:At.liquidationPx?parseFloat(At.liquidationPx).toFixed(2):"N/A"}})},Ge=me=>{M.current&&(clearInterval(M.current),M.current=null),M.current=setInterval(()=>{hn(me)},7e3)},ct=me=>me>=1e6?`${(me/1e6).toFixed(2)}M`:me>=1e3?`${(me/1e3).toFixed(2)}K`:me.toFixed(2);h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(de(),ae())},[]);const vt=h.useRef(null),Ht=()=>{vt.current&&(vt.current.scrollLeft-=200)},Rt=()=>{vt.current&&(vt.current.scrollLeft+=200)};h.useEffect(()=>{(async()=>{var At,xn;const dt=window.localStorage.getItem("hyperToken"),_t=window.localStorage.getItem("hyperAddress");if(!(!dt||!_t))try{const Cn=await vi(_t.toLowerCase(),dt);Cn!=null&&Cn.success?(q(Cn==null?void 0:Cn.telegram_chat_id),W(Cn==null?void 0:Cn.subscriber_role),ne(Cn==null?void 0:Cn.subs_expire_day),oe((At=Cn==null?void 0:Cn.mushboomer_counts)==null?void 0:At.eth),he((xn=Cn==null?void 0:Cn.mushboomer_counts)==null?void 0:xn.sol),_e(Cn==null?void 0:Cn.referral_code),Se(Cn==null?void 0:Cn.refcode),ge(Cn==null?void 0:Cn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Ce(""),je(""))}catch(Cn){console.error("Token verification error:",Cn),console.error(Cn.message||"An unknown error occurred.")}})()},[]);const mn=async({walletAddress:me,isFollow:dt,isScalper:_t})=>{try{on(me);const At=window.localStorage.getItem("hyperToken"),xn=window.localStorage.getItem("hyperAddress");if(!At){Oe(!0);return}const Cn=dt?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",fr=dt?{address:Je?Je.toLowerCase():xn,token:At,follow_address:me.toLowerCase()}:{address:Je?Je.toLowerCase():xn,token:At},_r=await fetch(Cn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(fr)});if(!_r.ok)throw new Error(`Server responded with status ${_r.status}`);const pr=await _r.json();pr.success?(bt(Array.isArray(pr==null?void 0:pr.data)?[...pr.data].sort((hr,Xr)=>new Date(Xr.created_at||0)-new Date(hr.created_at||0)):pr==null?void 0:pr.data),Qt(_t),He(!0)):(console.log(pr.error_message),dn.error(pr.error_message))}catch(At){console.error("Error in like function:",At),dn.error(At.message||"Something went wrong!")}},un="-latestFill",[yn,_n]=h.useState(un),[In,Sn]=h.useState([]),[Yn,Xn]=h.useState(""),[zn,Kn]=h.useState(""),[jn,De]=h.useState(""),[pe,qe]=h.useState(!1),[Ae,ze]=h.useState(!1),[zt,kt]=h.useState(!1),[gt,Mt]=h.useState(!1),ln=h.useRef(null),vn=h.useRef(null),Wn=h.useRef(null),On=h.useRef(null);h.useEffect(()=>{function me(dt){ln.current&&!ln.current.contains(dt.target)&&qe(!1),vn.current&&!vn.current.contains(dt.target)&&ze(!1),Wn.current&&!Wn.current.contains(dt.target)&&kt(!1),On.current&&!On.current.contains(dt.target)&&Mt(!1)}return document.addEventListener("mousedown",me),()=>document.removeEventListener("mousedown",me)},[]);const $t=We.map(me=>{let dt=me.totalStartPositions==0?"Open Position":me.direction!="Short > Long"&&me.direction!="Long > Short"?(me==null?void 0:me.totalSize)-Math.abs(me==null?void 0:me.totalStartPositions)==0&&(me.direction=="Close Long"||me.direction=="Close Short")?"Position Closed":me.direction=="Open Short"||me.direction=="Open Long"?"Increase":me.direction=="Close Long"||me.direction=="Close Short"?"Decrease":me.direction=="Sell"||me.direction=="Buy"?"Spot":"Changed Position":me.direction=="Short > Long"||me.direction=="Long > Short"?"Changed Position":"Open Position";return{...me,computedType:dt}}),Nn=me=>{const dt=nt.find(_t=>_t.label===me);return dt?dt.value.toUpperCase():me==null?void 0:me.toUpperCase()},Fn=$t.filter(me=>In.length?In.includes(me.computedType):!0).filter(me=>{var dt,_t;return Yn?(_t=(dt=me==null?void 0:me.oid)==null?void 0:dt.toString())==null?void 0:_t.includes(Yn):!0}).filter(me=>zn?Nn(me.asset).includes(zn.toUpperCase()):!0),pn=(me=>Fn==null?void 0:Fn.sort((dt,_t)=>{var is,Pr,yr,nr;const At=dt.totalSize?dt.totalValue/dt.totalSize:0,xn=_t.totalSize?_t.totalValue/_t.totalSize:0,Cn=gs=>{const ei=nt.find(ci=>ci.label===gs);return ei?ei.value.toUpperCase():gs==null?void 0:gs.toUpperCase()},fr=Cn(dt.asset),_r=Cn(_t.asset),pr=gs=>{if(!gs)return"";const ei=gs.toLowerCase();return ei.includes("short")?"Short":ei.includes("long")?"Long":ei==="buy"?"Buy":ei==="sell"?"Sell":gs},hr=pr(dt.direction),Xr=pr(_t.direction);if(me==="-totalSize")return _t.totalSize-dt.totalSize;if(me==="totalSize")return dt.totalSize-_t.totalSize;if(me==="-pnl")return _t.pnl-dt.pnl;if(me==="pnl")return dt.pnl-_t.pnl;if(me==="-fills")return(((is=_t.fills)==null?void 0:is.length)||0)-(((Pr=dt.fills)==null?void 0:Pr.length)||0);if(me==="fills")return(((yr=dt.fills)==null?void 0:yr.length)||0)-(((nr=_t.fills)==null?void 0:nr.length)||0);if(me==="-latestFill")return new Date(_t.latestFill)-new Date(dt.latestFill);if(me==="latestFill")return new Date(dt.latestFill)-new Date(_t.latestFill);if(me==="-avgPrice")return xn-At;if(me==="avgPrice")return At-xn;if(me==="-oid")return _t.oid-dt.oid;if(me==="oid")return dt.oid-_t.oid;if(me==="direction"){const gs={Short:1,Sell:2,Long:3,Buy:4};return(gs[hr]||99)-(gs[Xr]||99)}else if(me==="-direction"){const gs={Long:1,Buy:2,Short:3,Sell:4};return(gs[hr]||99)-(gs[Xr]||99)}else{if(me==="-coin")return fr<_r?-1:fr>_r?1:0;if(me==="coin")return fr>_r?-1:fr<_r?1:0}return 0}))(yn).filter(me=>(me.totalStartPositions==0?"Open Position":me.direction!="Short > Long"&&me.direction!="Long > Short"?(me==null?void 0:me.totalSize)-Math.abs(me==null?void 0:me.totalStartPositions)==0&&(me.direction=="Close Long"||me.direction=="Close Short")?"Position Closed":me.direction=="Open Short"||me.direction=="Open Long"?"Increase":me.direction=="Close Long"||me.direction=="Close Short"?"Decrease":me.direction=="Sell"||me.direction=="Buy"?"Spot":"Changed Position":me.direction=="Short > Long"||me.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),ke={};pn.forEach(me=>{var At;const dt=me==null?void 0:me.asset,_t=new Date(me==null?void 0:me.latestFill).getTime();if(!ke[dt])ke[dt]=me;else{const xn=new Date((At=ke[dt])==null?void 0:At.latestFill).getTime();_t>xn&&(ke[dt]=me)}});const m=Object.values(ke),[p,S]=h.useState([]),A=a==null?void 0:a.filter(me=>{var dt;return jn?(dt=me.asset)==null?void 0:dt.toLowerCase().includes(jn.toLowerCase()):!0}).map(me=>{const dt=m.find(At=>(At==null?void 0:At.asset)===(me==null?void 0:me.asset)),_t=p.find(At=>(At==null?void 0:At.coin)===(me==null?void 0:me.asset));return{...me,latestFill:(dt==null?void 0:dt.latestFill)||null,tagName:(_t==null?void 0:_t.tag)||null,tagWallet:(_t==null?void 0:_t.cp_wallet)||null}}),k="-unrealizedPnl",[T,D]=h.useState(k),V=me=>A==null?void 0:A.sort((dt,_t)=>{const At=dt.tagName?dt.tagName.toUpperCase():"",xn=_t.tagName?_t.tagName.toUpperCase():"",Cn=dt.asset?dt.asset.toUpperCase():"",fr=_t.asset?_t.asset.toUpperCase():"",_r=dt.type==="Long"?1:0,pr=_t.type==="Long"?1:0,hr=dt.type==="Short"?1:0,Xr=_t.type==="Short"?1:0;return me==="-unrealizedPnl"?_t.unrealizedPnl-dt.unrealizedPnl:me==="unrealizedPnl"?dt.unrealizedPnl-_t.unrealizedPnl:me==="-roe"?_t.roe-dt.roe:me==="roe"?dt.roe-_t.roe:me==="-size"?_t.size-dt.size:me==="size"?dt.size-_t.size:me==="-entryPrice"?_t.entryPrice-dt.entryPrice:me==="entryPrice"?dt.entryPrice-_t.entryPrice:me==="-currentPrice"?_t.currentPrice-dt.currentPrice:me==="currentPrice"?dt.currentPrice-_t.currentPrice:me==="-leverage"?_t.leverage-dt.leverage:me==="leverage"?dt.leverage-_t.leverage:me==="-positionValue"?_t.positionValue-dt.positionValue:me==="positionValue"?dt.positionValue-_t.positionValue:me==="-marginUsed"?_t.marginUsed-dt.marginUsed:me==="marginUsed"?dt.marginUsed-_t.marginUsed:me==="funding"?_t.funding-dt.funding:me==="-funding"?dt.funding-_t.funding:me==="-liquidationPrice"?_t.liquidationPrice-dt.liquidationPrice:me==="liquidationPrice"?dt.liquidationPrice-_t.liquidationPrice:me==="-entryTime"?new Date(_t.latestFill)-new Date(dt.latestFill):me==="entryTime"?new Date(dt.latestFill)-new Date(_t.latestFill):me==="-source_tag"?At<xn?-1:At>xn?1:0:me==="source_tag"?At>xn?-1:At<xn?1:0:me==="-type_leverage"?_r!==pr?pr-_r:_t.leverage-dt.leverage:me==="type_leverage"?hr!==Xr?Xr-hr:_t.leverage-dt.leverage:me==="-asset"?Cn<fr?-1:Cn>fr?1:0:me==="asset"?Cn>fr?-1:Cn<fr?1:0:0}),[X,le]=h.useState([]),[ce,fe]=h.useState([]),[ye,Pe]=h.useState([]),[Me,Ke]=h.useState([]),[we,Te]=h.useState([]);async function te(){try{const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();le(dt.results)}catch(me){console.error("Error resetting filters:",me)}}async function ve(){try{const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();fe(dt.results)}catch(me){console.error("Error resetting filters:",me)}}async function Be(){try{const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();Pe(dt.results)}catch(me){console.error("Error resetting filters:",me)}}async function Ue(){try{const me=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(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();Ke(dt.results)}catch(me){console.error("Error resetting filters:",me)}}async function Fe(){try{const me=await fetch(`https://dextradata.nftinit.io/api/hyper/wallet/details/?user_token=${t}`);if(!me.ok)throw new Error(`HTTP error! status: ${me.status}`);const dt=await me.json();Te(dt)}catch(me){console.error("Error pnlSharpeRateData:",me)}}h.useEffect(()=>{te(),ve(),Be(),Ue(),Fe()},[]);const[at,ut]=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"),[yt,Lt]=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"),[Gt,an]=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"),et=at==="1D"?X:at==="7D"?ce:at==="30D"?ye:Me,Pt=yt==="1D"?X:yt==="7D"?ce:yt==="30D"?ye:Me,qt=a.length,ft=a.filter(me=>me.unrealizedPnl>=0).length,tt=qt>0?ft/qt*100:0,[Bt,gn]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),Dn=((Es=V(T))==null?void 0:Es.reduce((me,dt)=>me+((dt==null?void 0:dt.leverage)||0),0))/(((br=V(T))==null?void 0:br.length)||1),er=(Zt=V(T))==null?void 0:Zt.reduce((me,dt)=>{const _t=parseFloat(dt==null?void 0:dt.funding)||0;return me+_t},0),dr=localStorage.getItem("isDateOpenPositionsFormat")||"date",[kr,qn]=h.useState(dr);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",kr)},[kr]);const $n=localStorage.getItem("isDateFillsFormat")||"date",[ir,ls]=h.useState($n);h.useEffect(()=>{localStorage.setItem("isDateFillsFormat",ir)},[ir]);const[cs,lt]=h.useState([]),Nt=async()=>{try{const me=window.localStorage.getItem("hyperToken");if(!me){Oe(!0);return}const dt="https://dextrabothypev2.nftinit.io/api/wallet/list",_t=window.localStorage.getItem("hyperAddress"),xn=await(await fetch(dt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Je?Je.toLowerCase():_t,token:me,balance:"false"})})).json();xn!=null&&xn.success?(lt(xn.data||[]),mr(xn.data)):console.log(xn.error_message)}catch(me){console.error("Error fetching generate wallet list:",me)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&Nt()},[G]);const Rn=cs==null?void 0:cs.find(me=>(me==null?void 0:me.wallet_address)===(t==null?void 0:t.toLowerCase())),ar=ie==null?void 0:ie.find(me=>(me==null?void 0:me.wallet_address)===(t==null?void 0:t.toLowerCase())),[Tr,Lr]=h.useState([]),[$r,cr]=h.useState(!0),[wr,ss]=h.useState(!1);h.useEffect(()=>{A&&A.length>0&&(ts(),cs.length>0&&$r&&mr())},[A]);const mr=me=>{const dt=[...Tr];dt.length>0&&((me==null?void 0:me.some(At=>(At==null?void 0:At.wallet_address)===(t==null?void 0:t.toLowerCase())))?Qs(dt):$r&&(Qs(dt),cr(!1)))},ts=()=>{const me=window.localStorage.getItem("hyperToken");let dt=!1;const _t=[...Tr];A==null||A.forEach(At=>{const xn=At.asset;(_t==null?void 0:_t.some(fr=>fr.coin===xn))||(_t==null||_t.push({coin:xn,wallet:t}),dt=!0)}),dt&&(Lr(_t),cs!=null&&cs.some(xn=>(xn==null?void 0:xn.wallet_address)===(t==null?void 0:t.toLowerCase()))&&me&&Qs(_t))},Qs=async me=>{if(!wr)try{ss(!0);const dt=window.localStorage.getItem("hyperToken"),_t="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!dt||!me){ss(!1);return}dt||Oe(!0);const At=window.localStorage.getItem("hyperAddress"),Cn=await(await fetch(_t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Je?Je.toLowerCase():At,token:dt,positions:me})})).json();Cn.success?S(Cn==null?void 0:Cn.data):(console.log(Cn.error_message),dn.error(Cn.error_message))}catch(dt){console.error("Error tag request",dt),dn.error(dt.message)}finally{ss(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(SVe,{}),i.jsx(U5,{open:st,setOpen:He,copyTradeData:Ve,copyTradeWallet:St,setCopyTradeWallet:on,isScalper:xt,setCopyTradeData:bt}),i.jsx(mln,{open:cn,setOpen:Vn,data:Bt,setTradeInfo:gn}),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(W$e,{wallet:t,className:"w-10 h-10 rounded-full"}),i.jsxs("div",{className:`${cs.some(me=>(me==null?void 0:me.wallet_address)==(t==null?void 0:t.toLowerCase()))?"bg-[#67ffbd]/20 rounded-xl p-[7px]":""} flex justify-start items-center gap-1 ml-1`,children:[i.jsx("div",{className:"flex flex-col items-start justify-center gap-1",children:i.jsx("div",{className:`${cs.some(me=>(me==null?void 0:me.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:me=>{me.stopPropagation(),navigator.clipboard.writeText(t),dn.success("Successfully copied.")},className:"cursor-pointer",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M12 9.675V12.825C12 15.45 10.95 16.5 8.325 16.5H5.175C2.55 16.5 1.5 15.45 1.5 12.825V9.675C1.5 7.05 2.55 6 5.175 6H8.325C10.95 6 12 7.05 12 9.675Z",stroke:`${cs.some(me=>(me==null?void 0:me.wallet_address)==(t==null?void 0:t.toLowerCase()))?"#67FFBD":"#909090"}`,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M16.5 5.175V8.325C16.5 10.95 15.45 12 12.825 12H12V9.675C12 7.05 10.95 6 8.325 6H6V5.175C6 2.55 7.05 1.5 9.675 1.5H12.825C15.45 1.5 16.5 2.55 16.5 5.175Z",stroke:`${cs.some(me=>(me==null?void 0:me.wallet_address)==(t==null?void 0:t.toLowerCase()))?"#67FFBD":"#909090"}`,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),i.jsxs("div",{className:`${cs.some(me=>(me==null?void 0:me.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:[Rn&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:Rn.wallet_name.length>13?Rn.wallet_name.slice(0,13)+"...":Rn.wallet_name}),Rn&&Rn.wallet_name.length>13&&i.jsx("span",{className:"",children:i.jsx(Ma,{content:`${Rn==null?void 0:Rn.wallet_name}`,positionTop:!1,alignRight:!1})})]}),i.jsxs("div",{className:`${ie.some(me=>me.wallet_address===t)?Rn?"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:[ar&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:(ar==null?void 0:ar.tag.length)>13?(ar==null?void 0:ar.tag.slice(0,13))+"...":ar==null?void 0:ar.tag}),ar&&ar.tag.length>13&&i.jsx("span",{className:"",children:i.jsx(Ma,{content:`${ar==null?void 0:ar.tag}`,positionTop:!1,alignRight:!1})})]})]}),i.jsx($5,{walletAddress:t,children:i.jsx("div",{className:`${re.some(me=>me.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:re.some(me=>me.wallet_address===t)?i.jsx("img",{src:j5,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:me=>{var At;me.preventDefault();const dt=ie==null?void 0:ie.some(xn=>xn.wallet_address===t),_t=(ce==null?void 0:ce.length)>0?(At=ce[0])==null?void 0:At.is_scalper:!1;mn({walletAddress:t,isFollow:dt,isScalper:_t})},className:`${ie.some(me=>me.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(me=>me.wallet_address===t)?"Edit Copy Trade":"Copy Trade"})}),i.jsx("div",{className:"sm:hidden h-6 flex justify-end",children:G&&i.jsx(tQ,{walletAddress:t})})]}),i.jsx(lln,{traderWallet:t,trades:ee})]}),i.jsxs("div",{className:"absolute right-0 flex justify-end",children:[G&&i.jsx(tQ,{walletAddress:t}),i.jsx("div",{className:"absolute right-0 hidden sm:flex",children:G&&i.jsx(tQ,{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:vt,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?Er(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:()=>{gn(me=>({...me,coin:"--",type:f?parseFloat(f.marginSummary.totalNtlPos)===0?"NEUTRAL":a.reduce((dt,_t)=>dt+(_t.type==="Long"?parseFloat(_t.positionValue):-parseFloat(_t.positionValue)),0)>0?"LONG":"SHORT":"--",leverage:Dn&&Dn!=0?`${parseFloat(Dn).toFixed(2)}x`:"--",roe:Pt.length>0?Pt.map(dt=>dt==null?void 0:dt.margin_roi).join(", "):"--",entryPrice:f?a.reduce((dt,_t)=>dt+parseFloat(_t.unrealizedPnl||0),0):"-",markPrice:qt>0?`${ft} / ${qt} (${ft/qt*100===0||ft/qt*100===100?ft/qt*100:(ft/qt*100).toFixed(2)}%)`:"--",positionDistribution:f?`${isNaN(a.reduce((dt,_t)=>_t.type==="Long"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((dt,_t)=>_t.type==="Long"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((dt,_t)=>_t.type==="Long"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((dt,_t)=>_t.type==="Long"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((dt,_t)=>_t.type==="Long"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}% / ${isNaN(a.reduce((dt,_t)=>_t.type==="Short"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((dt,_t)=>_t.type==="Short"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((dt,_t)=>_t.type==="Short"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((dt,_t)=>_t.type==="Short"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((dt,_t)=>_t.type==="Short"?dt+parseFloat(_t.positionValue):dt,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}%`:"-",referral:window.localStorage.getItem("hyperToken")?xe:null})),Vn(!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:Rlt,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((me,dt)=>me+parseFloat(dt.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]`,children:["$",f?Er(Math.abs(a.reduce((me,dt)=>me+parseFloat(dt.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:ft})," ","/ ",qt," (",tt==0?"0":tt!=0&&tt!=100?tt.toFixed(2):tt,"%)"]})]})})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4 relative",children:[i.jsxs("div",{className:"flex justify-end items-center gap-1 w-auto absolute right-1.5 top-1.5 bg-[#272727] rounded-2xl",children:[i.jsx("div",{onClick:()=>{ut("1D"),localStorage.setItem("discover_period",0)},className:`${at==="1D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"1D"})}),i.jsx("div",{onClick:()=>{ut("7D"),localStorage.setItem("discover_period",1)},className:`${at==="7D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"7D"})}),i.jsx("div",{onClick:()=>{ut("30D"),localStorage.setItem("discover_period",2)},className:`${at==="30D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})}),i.jsx("div",{onClick:()=>{ut("90D"),localStorage.setItem("discover_period",3)},className:`${at==="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"})})]}),(et==null?void 0:et.length)>0?et==null?void 0:et.map((me,dt)=>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:(me==null?void 0:me.win_complated_rate)==null||isNaN(parseFloat(me==null?void 0:me.win_complated_rate))?"--":(me==null?void 0:me.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:(me==null?void 0:me.rtx_count)==null||isNaN(parseFloat(me==null?void 0:me.rtx_count))?"--":Ms(me==null?void 0:me.rtx_count)})]})]},dt)):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:()=>{fn("day"),Lt("1D"),localStorage.setItem("discover_period",0)},className:`${rn==="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:()=>{fn("week"),Lt("7D"),localStorage.setItem("discover_period",1)},className:`${rn==="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:()=>{fn("month"),Lt("30D"),localStorage.setItem("discover_period",2)},className:`${rn==="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:()=>{fn("threeMonth"),Lt("90D"),localStorage.setItem("discover_period",3)},className:`${rn==="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:()=>{fn("allTime"),Lt("90D"),localStorage.setItem("discover_period",4)},className:`${rn==="allTime"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"All"})})]}),i.jsxs("div",{className:`${!(Pt!=null&&Pt.length)>0?"space-y-1.5 sm:space-y-3.5 lg:space-y-1.5 xl:space-y-3.5":"space-y-4 sm:space-y-6 lg:space-y-4 xl:space-y-6"} flex flex-col justify-center items-start mt-4 sm:mt-0 lg:mt-4 xl:mt-0`,children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"PnL"}),$e?i.jsx("div",{className:`${$e.day===0||$e.week===0||$e.month===0||$e.threeMonth===0||$e.all===0?"text-white":rn==="day"?$e.day>0?"text-[#67FFBD]":$e.day<0?"text-[#FF7173]":"text-white":rn==="week"?$e.week>0?"text-[#67FFBD]":$e.week<0?"text-[#FF7173]":"text-white":rn==="month"?$e.month>0?"text-[#67FFBD]":$e.month<0?"text-[#FF7173]":"text-white":rn==="threeMonth"?$e.threeMonth>0?"text-[#67FFBD]":$e.threeMonth<0?"text-[#FF7173]":"text-white":rn==="allTime"?$e.all>0?"text-[#67FFBD]":$e.all<0?"text-[#FF7173]":"text-white":"text-white"} text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:(()=>{const me={day:$e.day,week:$e.week,month:$e.month,threeMonth:$e.threeMonth,allTime:$e.all}[rn];return`$${Ms(Math.abs(me))}`})()}):i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})]}),!(Pt!=null&&Pt.length)>0&&i.jsx("div",{className:"w-36 h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"ROE"}),(Pt==null?void 0:Pt.length)>0?Pt==null?void 0:Pt.map((me,dt)=>i.jsx("div",{className:`${(me==null?void 0:me.margin_roi)==null||isNaN(parseFloat(me==null?void 0:me.margin_roi))||(me==null?void 0:me.margin_roi)==0?"text-white":(me==null?void 0:me.margin_roi)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:(me==null?void 0:me.margin_roi)==null||isNaN(parseFloat(me==null?void 0:me.margin_roi))?"--":Ms(Math.abs(me==null?void 0:me.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((me,dt)=>me+(dt.type==="Long"?parseFloat(dt.positionValue):-parseFloat(dt.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((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,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((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,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((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2):"-","%"]}),i.jsxs("span",{className:"text-[#FF7173]",children:[f?isNaN(a.reduce((me,dt)=>dt.type==="Short"?me+parseFloat(dt.positionValue):me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((me,dt)=>dt.type==="Short"?me+parseFloat(dt.positionValue):me,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((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,0)):"-"}),i.jsx("span",{className:"text-[#ff787b]",children:f?ct(a.reduce((me,dt)=>dt.type==="Short"?me+parseFloat(dt.positionValue):me,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((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((me,dt)=>dt.type==="Long"?me+parseFloat(dt.positionValue):me,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((me,dt)=>dt.type==="Short"?me+parseFloat(dt.positionValue):me,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((me,dt)=>dt.type==="Short"?me+parseFloat(dt.positionValue):me,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:Dn&&Dn!=0?`${parseFloat(Dn).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:`${er<=0?"text-[#67FFBD]":"text-[#FF7173]"} text-sm font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:er&&er!=0?`$${zv(Math.abs(er))}`:"--"})]})})]}),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:()=>{an("7D"),localStorage.setItem("discover_period",1)},className:`${Gt==="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:()=>{an("30D"),localStorage.setItem("discover_period",2)},className:`${Gt==="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:()=>{an("90D"),localStorage.setItem("discover_period",3)},className:`${Gt==="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"})})]}),we?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(Vs,{className:"text-[#7C7C7C] w-3 min-w-3 min-h-3 h-3"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:"Sharpe_tooltip",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[80px] min-w-[80px] leading-[16px] -mb-12"})})]})})]}),i.jsx("div",{className:`${(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_sharpe:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_sharpe:we==null?void 0:we.portfolio_perp_3month_sharpe)>=1&&(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_sharpe:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_sharpe:we==null?void 0:we.portfolio_perp_3month_sharpe)<=2?"text-[#E5BB18]":(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_sharp:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_sharpe:we==null?void 0:we.portfolio_perp_3month_sharpe)>2?"text-[#1DE6A3]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Gt==="7D"?(we==null?void 0:we.portfolio_perp_week_sharpe)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_week_sharpe))?"--":Er(we==null?void 0:we.portfolio_perp_week_sharpe):Gt==="30D"?(we==null?void 0:we.portfolio_perp_month_sharpe)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_month_sharpe))?"--":Er(we==null?void 0:we.portfolio_perp_month_sharpe):(we==null?void 0:we.portfolio_perp_3month_sharpe)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_3month_sharpe))?"--":Er(we==null?void 0:we.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:`${(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_growth_rate:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_growth_rate:we==null?void 0:we.portfolio_perp_3month_growth_rate)==0?"text-white":(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_growth_rate:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_growth_rate:we==null?void 0:we.portfolio_perp_3month_growth_rate)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Gt==="7D"?(we==null?void 0:we.portfolio_perp_week_growth_rate)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_week_growth_rate))?"--":Ms(we==null?void 0:we.portfolio_perp_week_growth_rate)+"%":Gt==="30D"?(we==null?void 0:we.portfolio_perp_month_growth_rate)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_month_growth_rate))?"--":Ms(we==null?void 0:we.portfolio_perp_month_growth_rate)+"%":(we==null?void 0:we.portfolio_perp_3month_growth_rate)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_3month_growth_rate))?"--":Ms(we==null?void 0:we.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:`${(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_dd:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_dd:we==null?void 0:we.portfolio_perp_3month_dd)==0?"text-white":(Gt==="7D"?we==null?void 0:we.portfolio_perp_week_dd:Gt==="30D"?we==null?void 0:we.portfolio_perp_month_dd:we==null?void 0:we.portfolio_perp_3month_dd)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Gt==="7D"?(we==null?void 0:we.portfolio_perp_week_dd)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_week_dd))?"--":Ms(Math.abs(we==null?void 0:we.portfolio_perp_week_dd))+"%":Gt==="30D"?(we==null?void 0:we.portfolio_perp_month_dd)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_month_dd))?"--":Ms(Math.abs(we==null?void 0:we.portfolio_perp_month_dd))+"%":(we==null?void 0:we.portfolio_perp_3month_dd)==null||isNaN(parseFloat(we==null?void 0:we.portfolio_perp_3month_dd))?"--":Ms(Math.abs(we==null?void 0:we.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(zl,{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(zl,{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(RVe,{initialAddress:t})]})]})},Hln=()=>{const t=g2(),e=(t==null?void 0:t.walletAddress.toLowerCase())||"";return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(zln,{initialAddress:e})})]})},Vln=({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?Qse.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 Wln(){const{signModalOpen:t,setSignModalOpen:e,signIn:n,hyperToken:r,walletLogin:s}=h.useContext(Yr),{isConnected:a}=es(),{openConnectModal:o}=B5(),l=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches,c=()=>{window.localStorage.getItem("hyperToken")&&r?s():(n(1),e(!1))};return i.jsx(Vln,{isOpen:t,onClose:()=>e(!1),children:i.jsxs("div",{className:"flex flex-col items-center gap-8 w-[400px] bg-[#252525] rounded-3xl py-4 relative pointer-events-auto",children:[i.jsx("span",{onClick:()=>e(!1),className:"absolute top-2 right-2 w-9 h-9 rounded-full flex items-center justify-center hover:bg-[#7535FE] cursor-pointer",children:i.jsx("img",{src:Ua,alt:"close",className:"p-1"})}),i.jsx("img",{src:Ki,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($E,{}):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($E,{})})}):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 _l=()=>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:ylt,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"]})]})]})]}),qln=({data:t,loading:e,error:n,trackerData:r,isRequest:s,setIsRequest:a})=>{var ge;const{trackedWatchList:o,getTrackedWatchList:l,setSignModalOpen:c}=h.useContext(Yr),{isConnected:u,address:d}=es(),[f,x]=h.useState(!1),[g,y]=h.useState(null),[v,C]=h.useState(null),[N,I]=h.useState(""),[P,M]=h.useState([]),[F,$]=h.useState(!1),[L,z]=h.useState({}),Q="-tag",[se,ee]=h.useState(Q),K=Ce=>r.sort((je,Oe)=>{const $e=P.find(bt=>bt.wallet_address===je.wallet_address)||{},Ye=P.find(bt=>bt.wallet_address===Oe.wallet_address)||{},Je=$e.data?$e.data.reduce((bt,xt)=>bt+parseFloat(xt.unrealizedPnl||0),0):$e.unrealizedPnl||0,ht=Ye.data?Ye.data.reduce((bt,xt)=>bt+parseFloat(xt.unrealizedPnl||0),0):Ye.unrealizedPnl||0,rt=je.tag?je.tag.toUpperCase():"",st=Oe.tag?Oe.tag.toUpperCase():"",He=je.wallet_address?je.wallet_address.toLowerCase():"",Ve=Oe.wallet_address?Oe.wallet_address.toLowerCase():"";return Ce==="tag"?rt<st?-1:rt>st?1:0:Ce==="-tag"?rt>st?-1:rt<st?1:0:Ce==="-wallet_address"?He<Ve?-1:He>Ve?1:0:Ce==="wallet_address"?He>Ve?-1:He<Ve?1:0:Ce==="perp_equity"?($e.perp_equity||0)-(Ye.perp_equity||0):Ce==="-perp_equity"?(Ye.perp_equity||0)-($e.perp_equity||0):Ce==="margin_usage"?($e.margin_usage||0)-(Ye.margin_usage||0):Ce==="-margin_usage"?(Ye.margin_usage||0)-($e.margin_usage||0):Ce==="unrealizedPnl"?Je-ht:Ce==="-unrealizedPnl"?ht-Je:Ce==="-expire_date"?new Date(Oe.expire_date)-new Date(je.expire_date):Ce==="expire_date"?new Date(je.expire_date)-new Date(Oe.expire_date):0}),re=async({walletAddress:Ce,isFollow:je,isScalper:Oe})=>{try{I(Ce);const $e=window.localStorage.getItem("hyperToken"),Ye=window.localStorage.getItem("hyperAddress");if(!$e){c(!0);return}const Je=je?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",ht=je?{address:d?d.toLowerCase():Ye,token:$e,follow_address:Ce.toLowerCase()}:{address:d?d.toLowerCase():Ye,token:$e},rt=await fetch(Je,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ht)});if(!rt.ok)throw new _l(`Server responded with status ${rt.status}`);const st=await rt.json();st.success?(y(Array.isArray(st==null?void 0:st.data)?[...st.data].sort((He,Ve)=>new Date(Ve.created_at||0)-new Date(He.created_at||0)):st==null?void 0:st.data),C(Oe),x(!0)):(console.log(st.error_message),dn.error(st.error_message))}catch($e){console.error("Error in like function:",$e),dn.error($e.message||"Something went wrong!")}},de=Ce=>Ce!=null&&Ce.assetPositions?Ce.assetPositions.filter(je=>{if(!je.position||!je.position.szi)return!1;const Oe=parseFloat(je.position.szi);return!isNaN(Oe)&&Oe!==0}).map(je=>{const Oe=je.position,$e=parseFloat(Oe.szi),Ye=parseFloat(Oe.entryPx),Je=parseFloat(Oe.positionValue),ht=parseFloat(Oe.unrealizedPnl),rt=parseFloat(Oe.returnOnEquity)*100,st=parseFloat(Oe.marginUsed),He=Oe.leverage.value,Ve=parseFloat(Oe.cumFunding.sinceOpen),bt=$e>0?"Long":"Short";return{asset:Oe.coin,type:bt,size:Math.abs($e),entryPrice:Ye.toFixed(2),currentPrice:(Je/Math.abs($e)).toFixed(2),leverage:He,positionValue:Je.toFixed(2),marginUsed:st.toFixed(2),unrealizedPnl:ht.toFixed(2),roe:rt.toFixed(2),funding:Ve.toFixed(4),liquidationPrice:Oe.liquidationPx?parseFloat(Oe.liquidationPx).toFixed(2):"N/A"}}):[],G=async Ce=>{try{const Oe=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:Ce});if(Oe.data){const $e=de(Oe.data);M(Ye=>{var Je,ht,rt,st;return[...Ye,{wallet_address:Ce,perp_equity:(ht=(Je=Oe==null?void 0:Oe.data)==null?void 0:Je.marginSummary)==null?void 0:ht.accountValue,margin_usage:parseFloat((rt=Oe==null?void 0:Oe.data)==null?void 0:rt.marginSummary.totalMarginUsed)/parseFloat((st=Oe==null?void 0:Oe.data)==null?void 0:st.marginSummary.accountValue),data:$e}]})}}catch(je){console.error("Error fetching user state from HyperState:",je)}},ie=async Ce=>{try{const je=window.localStorage.getItem("hyperToken"),Oe="https://dextrabothypev2.nftinit.io/api/hyper/tracker/getclearinghousestate/",$e=window.localStorage.getItem("hyperAddress"),Ye=await fetch(Oe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():$e,token:je,follow_address:Ce})});if(Ye.ok){const Je=await Ye.json();if(Je.success){const ht=de(Je==null?void 0:Je.data);M(rt=>{var st;return[...rt,{wallet_address:Ce,perp_equity:(st=Je==null?void 0:Je.data.marginSummary)==null?void 0:st.accountValue,margin_usage:parseFloat(Je==null?void 0:Je.data.marginSummary.totalMarginUsed)/parseFloat(Je==null?void 0:Je.data.marginSummary.accountValue),data:ht}]})}}else if(Ye.status===500)console.warn(`Received 500 error for ${Ce}, retrying with getUserHyperState`),await G(Ce);else throw new _l(`Request failed with status ${Ye.status}`)}catch(je){console.error("Error fetching user state:",je)}},ae=h.useRef(!1);h.useEffect(()=>{!e&&s&&!ae.current&&(ae.current=!0,(async()=>{for(let je=0;je<r.length;je++){const Oe=r[je];ie(Oe==null?void 0:Oe.wallet_address.toLowerCase()).catch($e=>{console.error(`Error fetching user state for wallet ${Oe.wallet_address}:`,$e)}),await new Promise($e=>setTimeout($e,500))}})())},[s,e,r]);const q=async(Ce,je)=>{try{const Oe=window.localStorage.getItem("hyperToken"),$e="https://dextrabothypev2.nftinit.io/api/hyper/tracker/extend_tracker_expiry/";if(!Oe||!Ce||!je)return;z(rt=>({...rt,[je]:!0}));const Ye=window.localStorage.getItem("hyperAddress"),Je=await fetch($e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d==null?void 0:d.toLowerCase():Ye,token:Oe,tracker_id:Ce})});if(!Je.ok)throw new _l(`Failed to unlike: ${Je.status} ${Je.statusText}`);const ht=await Je.json();ht.success?(z(rt=>({...rt,[je]:!1})),l(),dn.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"}})):(dn.error(ht.error_message),z(rt=>({...rt,[je]:!1})))}catch(Oe){dn.error(Oe.message||"Something went wrong!"),z($e=>({...$e,[je]:!1}))}},W=h.useRef(null),ne=()=>{W.current&&(W.current.scrollLeft-=100)},oe=()=>{W.current&&(W.current.scrollLeft+=100)},he=()=>{W.current&&(W.current.scrollTop+=200)},_e=()=>{W.current&&(W.current.scrollTop-=200)},xe=Ce=>{const je=new Date(Ce),Oe=new Date,$e=new Date(je.getFullYear(),je.getMonth(),je.getDate()),Ye=new Date(Oe.getFullYear(),Oe.getMonth(),Oe.getDate());return($e-Ye)/(1e3*60*60*24)<=3},Se=Ce=>Ce>=640&&Ce<1024?5:Ce>=1024&&Ce<1240?6:Ce>=1240&&Ce<1540||Ce>=1540?7:3;return i.jsxs(i.Fragment,{children:[i.jsx(U5,{open:f,setOpen:x,copyTradeData:g,copyTradeWallet:N,setCopyTradeWallet:I,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:ne,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(eo,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:oe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:_e,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(eo,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:he,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(eo,{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:W,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:se,setSortOption:ee,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:se,setSortOption:ee,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:se,setSortOption:ee,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:se,setSortOption:ee,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:se,setSortOption:ee,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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(lo,{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:se,setSortOption:ee,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:Se(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(Ba,{})})})}):n&&!r?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Se(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(_l,{})})})}):(r==null?void 0:r.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Se(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:Kl,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."]})]})]})]})})})})}):(ge=K(se))==null?void 0:ge.map((Ce,je)=>{var $e,Ye;const Oe=P.find(Je=>Je.wallet_address===Ce.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:Je=>{Je.preventDefault();const ht=t==null?void 0:t.some(rt=>rt.wallet_address===(Ce==null?void 0:Ce.wallet_address));re({walletAddress:Ce==null?void 0:Ce.wallet_address,isFollow:ht,isScalper:Ce==null?void 0:Ce.is_scalper})},className:`${t!=null&&t.some(Je=>Je.wallet_address===(Ce==null?void 0:Ce.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($5,{walletAddress:Ce==null?void 0:Ce.wallet_address,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:o.some(Je=>Je.wallet_address===(Ce==null?void 0:Ce.wallet_address))?i.jsx("img",{src:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,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(na,{info1:Ce!=null&&Ce.tag?(Ce==null?void 0:Ce.tag.length)>=13?(Ce==null?void 0:Ce.tag).slice(0,13)+"...":Ce==null?void 0:Ce.tag:"--",info1_Color:"text-white",rowTwo:!1}),(Ce==null?void 0:Ce.tag)&&(Ce==null?void 0:Ce.tag.length)>=13&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ma,{content:`${Ce==null?void 0:Ce.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/${Ce==null?void 0:Ce.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:Ki,alt:"dextra",className:"w-4 h-4 sm:w-8 sm:h-8",loading:"lazy",onError:Je=>{Je.target.onerror=null,Je.target.src="https://app.dextrabot.com/dextrabotIcon.png"}})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(na,{info1:`${(Ce==null?void 0:Ce.wallet_address).slice(0,5)+"..."+(Ce==null?void 0:Ce.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Je=>{Je.stopPropagation(),navigator.clipboard.writeText(Ce==null?void 0:Ce.wallet_address),dn.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:_o,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"pr-1",children:F?i.jsx(l0,{info:"Loading...",textColor:"text-white"}):Oe?i.jsx(l0,{info:(Oe==null?void 0:Oe.perp_equity)!=0?`$${Er(Oe==null?void 0:Oe.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"}):Oe?i.jsx(l0,{info:isNaN(Oe==null?void 0:Oe.margin_usage)?"0%":`${((Oe==null?void 0:Oe.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"}):Oe?i.jsx(l0,{info:(Oe==null?void 0:Oe.data)!=0?`$${Er(Math.abs(($e=Oe==null?void 0:Oe.data)==null?void 0:$e.reduce((Je,ht)=>Je+parseFloat(ht.unrealizedPnl||0),0)))}`:"$0",textColor:`${((Ye=Oe==null?void 0:Oe.data)==null?void 0:Ye.reduce((Je,ht)=>Je+parseFloat(ht.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:[xe(Ce==null?void 0:Ce.expire_date)&&i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative min-w-max",children:[i.jsx("img",{src:sct,alt:"",className:"w-[14px] min-w-[14px] min-h-[14px] h-[14px]"}),i.jsx("span",{className:"",children:i.jsx(lo,{content:`This tracker will expire on ${M3(Ce==null?void 0:Ce.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:Ce!=null&&Ce.expire_date?M3(Ce==null?void 0:Ce.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:xe(Ce==null?void 0:Ce.expire_date)&&(L[Ce==null?void 0:Ce.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:()=>{q(Ce==null?void 0:Ce.id,Ce==null?void 0:Ce.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:ict,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})}),pz=()=>{const{isConnected:t}=es(),{openConnectModal:e}=B5(),{walletLogin:n,signIn:r}=h.useContext(Yr),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:Ki,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($E,{}):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($E,{}):"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"})]})]})},Gln=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1);es();const{hyperToken:s,copyTradeWatchList:a,getCopyTradeWatchList:o,trackedWatchList:l,setTrackedWatchList:c,getTrackedWatchList:u,trackedWatchListLoading:d,trackedWatchListError:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setMushboomerSOL:C,setIsReferralCode:N,setIsReferralCodeName:I,setIsWhitelist:P,setHyperToken:M,setHyperAddress:F}=h.useContext(Yr);return h.useEffect(()=>{!n&&window.localStorage.getItem("hyperToken")&&(o(),u(),e(!0),r(!0))},[n,s]),h.useEffect(()=>{(async()=>{var Q,se;const L=window.localStorage.getItem("hyperToken"),z=window.localStorage.getItem("hyperAddress");if(!(!L||!z))try{const ee=await vi(z,L);ee!=null&&ee.success?(x(ee==null?void 0:ee.telegram_chat_id),g(ee==null?void 0:ee.subscriber_role),y(ee==null?void 0:ee.subs_expire_day),v((Q=ee==null?void 0:ee.mushboomer_counts)==null?void 0:Q.eth),C((se=ee==null?void 0:ee.mushboomer_counts)==null?void 0:se.sol),N(ee==null?void 0:ee.referral_code),I(ee==null?void 0:ee.refcode),P(ee==null?void 0:ee.whitelist),M(L),F(z)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),M(""),F(""))}catch(ee){console.error("Token verification error:",ee),console.error(ee.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(qln,{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(pz,{})})})})]})},Kln=()=>{h.useRef([]);const t=h.useRef(null),{isConnected:e,address:n}=es(),{setSignModalOpen:r,trackedWatchList:s,hyperToken:a}=h.useContext(Yr),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(L){const z={};return L.forEach(se=>{const{oid:ee,px:K,dir:re,side:de,crossed:G,feeToken:ie,listen_user:ae,cloid:q,coin:W,subs_address:ne,sz:oe,closedPnl:he,fee:_e,time:xe,startPosition:Se,insert_date:ge,hash:Ce}=se;z[ee]||(z[ee]={oid:ee,px:K,dir:re,side:de,crossed:G,feeToken:ie,listen_user:ae,cloid:q,coin:W,subs_address:ne,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:xe,earliestStartPosition:Se,insertDate:ge,hashes:[],hasZeroStartPosition:!1}),parseFloat(Se)===0&&(z[ee].hasZeroStartPosition=!0),z[ee].hasZeroStartPosition?z[ee].totalStartPositions=0:z[ee].totalStartPositions+=parseFloat(Se),z[ee].totalSize+=parseFloat(oe),z[ee].totalClosedPnl+=parseFloat(he),z[ee].totalFee+=parseFloat(_e),new Date(xe)>new Date(z[ee].closestTime)&&(z[ee].closestTime=xe),new Date(xe)>new Date(z[ee].insertDate)&&(z[ee].insertDate=ge),new Date(xe)<new Date(z[ee].closestTime)&&(z[ee].earliestStartPosition=Se),z[ee].hashes.push(Ce)}),Object.keys(z).map(se=>({oid:se,...z[se]}))}async function C(){const L=window.localStorage.getItem("hyperToken");try{c(!0);const z="https://dextrabothypev2.nftinit.io/api/hyper/feed/",Q=window.localStorage.getItem("hyperAddress");L||r(!0);const se=await fetch(z,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Q,token:L,offset:0})});if(!se.ok)throw new Error(`Server responded with status ${se.status}`);const ee=await se.json();if(ee.success){const K=v(ee==null?void 0:ee.data);y(K)}else console.log(ee.error_message)}catch(z){console.log("Error :>> ",z),c(!1)}finally{c(!1)}}h.useEffect(()=>{C()},[window.localStorage.getItem("hyperToken")]);function N(L,z){const Q={};return L.forEach(se=>{Q[se.oid]={...se}}),z.forEach(se=>{const{oid:ee,px:K,dir:re,side:de,crossed:G,feeToken:ie,listen_user:ae,cloid:q,coin:W,subs_address:ne,sz:oe,closedPnl:he,fee:_e,time:xe,startPosition:Se,insert_date:ge,hash:Ce}=se;Q[ee]||(Q[ee]={oid:ee,px:K,dir:re,side:de,crossed:G,feeToken:ie,listen_user:ae,cloid:q,coin:W,subs_address:ne,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:xe,earliestStartPosition:Se,insertDate:ge,hashes:[],hasZeroStartPosition:!1}),parseFloat(Se)===0&&(Q[ee].hasZeroStartPosition=!0),Q[ee].hasZeroStartPosition?Q[ee].totalStartPositions=0:Q[ee].totalStartPositions+=parseFloat(Se),Q[ee].totalSize+=parseFloat(oe),Q[ee].totalClosedPnl+=parseFloat(he),Q[ee].totalFee+=parseFloat(_e),new Date(xe)>new Date(Q[ee].closestTime)&&(Q[ee].closestTime=xe),new Date(xe)>new Date(Q[ee].insertDate)&&(Q[ee].insertDate=ge),new Date(xe)<new Date(Q[ee].closestTime)&&(Q[ee].earliestStartPosition=Se),Q[ee].hashes.push(Ce)}),Object.values(Q).sort((se,ee)=>new Date(ee.closestTime)-new Date(se.closestTime))}const I=h.useRef(!1),P=h.useRef(n),M=h.useRef(s);h.useEffect(()=>{P.current=n},[n]),h.useEffect(()=>{o.current=a},[a]),h.useEffect(()=>{M.current=s},[s]);const F="hyper_get_message";h.useEffect(()=>{if(!a||I.current)return;const L=Dy("https://dextrabothypesocketv2.nftinit.io/");return t.current=L,I.current=!0,t.current.on("connect",()=>{console.log("Socket connected");const z=()=>{var ee;const Q=(ee=P.current)==null?void 0:ee.toLowerCase(),se=o.current;Q&&se?L.emit("subscribe",{login:Q,token:se}):setTimeout(z,300)};z()}),t.current.on(F,function(z){if(z){const Q=Array.isArray(z)?z:[z];y(se=>{const ee=N([],Q);let K=se.filter(G=>Q.some(ie=>ie.oid===G.oid)),re=[];K.length>0?re=N(ee,K):re=ee;const de=se.filter(G=>!Q.some(ie=>ie.oid===G.oid));return[...re,...de]})}}),t.current.io.on("reconnect_attempt",z=>{console.log("reconnect_attempt",z)}),t.current.io.on("reconnect",z=>{console.log("reconnect",z),t.current.emit("room",F)}),t.current.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),t.current.io.on("reconnect_error",z=>{console.log("reconnect_error",z)}),t.current.io.on("error",z=>{console.log("error",z)}),t.current.on("disconnect",()=>{console.log("Socket disconnected"),I.current=!1}),()=>{t.current.disconnect(),console.log("Socket cleanup on unmount")}},[a]);function $({date:L}){const[z,Q]=h.useState(Uo(L));return h.useEffect(()=>{const se=setInterval(()=>{Q(Uo(L))},1e3);return()=>clearInterval(se)},[L]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:z.dateTime})}return i.jsx("div",{className:"flex flex-col items-start justify-start mt-4 overflow-scroll max-h-full",children:!g||g.length==0?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] min-w-[880px] max-w-[700px] justify-center items-center text-center mt-44",children:l?i.jsx(Ba,{}):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:Kl,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"The activities of the favorited wallets will be displayed on this page."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Feed page includes the activities occur after a wallet is favorited."," "]})})]})]})})})}):i.jsx("ul",{className:"flex flex-col items-start justify-start gap-1",children:Array.isArray(g)&&g.slice(0,250).map(L=>{var z,Q,se,ee,K,re,de;return i.jsx("li",{children:i.jsxs("div",{className:"flex justify-start items-start gap-[11px]",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start h-full",children:[i.jsx("div",{className:`${(z=L==null?void 0:L.dir)!=null&&z.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?"bg-[#67ffbd]/20":(L==null?void 0:L.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(L==null?void 0:L.dir)=="Buy"?"bg-[#67ffbd]/20":"bg-[#ff797c]/20"} flex justify-center items-center w-6 h-6 rounded-full`,children:i.jsx("div",{className:"w-3 h-3 relative",children:(Q=L==null?void 0:L.dir)!=null&&Q.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"flex justify-center w-6",children:i.jsx("div",{className:"w-[1px] min-h-[123px] h-full border border-[#242424]"})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[6px] min-w-[640px] w-full h-[138px] min-h-[138px] rounded-[18px] border border-[#232323] p-2",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full px-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full",children:i.jsx("img",{src:Ki,alt:"",className:"w-8 h-8"})}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] ",children:[i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${L==null?void 0:L.listen_user}`,"_blank")},className:"flex justify-start items-center gap-1.5 cursor-pointer",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-none",children:(L==null?void 0:L.listen_user)&&((se=L==null?void 0:L.listen_user)==null?void 0:se.slice(0,5))+"..."+((ee=L==null?void 0:L.listen_user)==null?void 0:ee.slice(-4))}),i.jsx("img",{onClick:G=>{G.stopPropagation(),navigator.clipboard.writeText(L==null?void 0:L.listen_user),dn.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:_o,alt:"",className:"cursor-pointer"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:[i.jsxs("span",{className:"text-white text-[11px] font-normal font-['Manrope'] leading-[13px] tracking-tight min-w-max ml-[1px]",children:["Order ID:"," ",i.jsx("span",{className:"text-[#a5a5a5]",children:(L==null?void 0:L.oid)&&(L==null?void 0:L.oid)})]}),i.jsx("span",{onClick:G=>{G.stopPropagation(),navigator.clipboard.writeText(L==null?void 0:L.oid),dn.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:_o,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})]})]})]}),i.jsxs("div",{className:"flex flex-col items-end justify-start gap-[2px] w-full pl-2 pt-2",children:[i.jsx("div",{onClick:()=>{x(f=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:f=="time"?i.jsx($,{date:L==null?void 0:L.closestTime}):$c(L==null?void 0:L.closestTime)}),i.jsxs("div",{className:"flex justify-start items-center gap-2 -m-[2px]",children:[i.jsxs("div",{children:[i.jsxs("span",{className:"text-[#9b9b9b] text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:["opened a new"," ",(L==null?void 0:L.dir)=="Sell"?"spot sell":(L==null?void 0:L.dir)=="Buy"?"spot buy":(K=L==null?void 0:L.dir)==null?void 0:K.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[L==null?void 0:L.coin,"/",L==null?void 0:L.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${L==null?void 0:L.coin}.svg`||za,alt:L==null?void 0:L.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:G=>Qi(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/${L==null?void 0:L.coin}.svg`||za,alt:L==null?void 0:L.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:G=>Qi(G)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[L==null?void 0:L.coin,"/",L==null?void 0:L.feeToken]})]})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide",children:"Direction"}),i.jsx("div",{className:"flex justify-start items-center",children:i.jsxs("div",{className:`${(re=L==null?void 0:L.dir)!=null&&re.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(L==null?void 0:L.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(L==null?void 0:L.dir)=="Buy"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex min-w-max`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:(de=L==null?void 0:L.dir)!=null&&de.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:(L==null?void 0:L.dir)=="Sell"?"Sell":(L==null?void 0:L.dir)=="Buy"?"Buy":(L==null?void 0:L.dir)=="Close Short"?"Short":(L==null?void 0:L.dir)=="Close Long"?"Long":(L==null?void 0:L.dir)=="Open Short"?"Short":(L==null?void 0:L.dir)=="Open Long"?"Long":L==null?void 0:L.dir})]})})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"Type",value:(L==null?void 0:L.totalStartPositions)==0?"Open Position":(L==null?void 0:L.dir)!="Short > Long"&&(L==null?void 0:L.dir)!="Long > Short"?(L==null?void 0:L.totalSize)-Math.abs(L==null?void 0:L.totalStartPositions)==0&&((L==null?void 0:L.dir)=="Close Long"||(L==null?void 0:L.dir)=="Close Short")?"Position Closed":(L==null?void 0:L.dir)=="Open Short"||(L==null?void 0:L.dir)=="Open Long"?"Increase":(L==null?void 0:L.dir)=="Close Long"||(L==null?void 0:L.dir)=="Close Short"?"Decrease":(L==null?void 0:L.dir)=="Sell"||(L==null?void 0:L.dir)=="Buy"?"Spot":"Changed Position":(L==null?void 0:L.dir)=="Short > Long"||(L==null?void 0:L.dir)=="Long > Short"?"Changed Position":"Open Position",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"Price",value:Er(L==null?void 0:L.px),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"Size",value:Er(L==null?void 0:L.totalSize),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"PnL",value:L!=null&&L.totalClosedPnl?`$${Er(Math.abs(L==null?void 0:L.totalClosedPnl))}`:Er(Math.abs(L==null?void 0:L.totalClosedPnl)),color:`${(L==null?void 0:L.totalClosedPnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"Fee",value:L!=null&&L.totalFee?`$${Er(Math.abs(L==null?void 0:L.totalFee))}`:Er(Math.abs(L==null?void 0:L.totalFee)),color:`${(L==null?void 0:L.totalFee)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(TC,{title:"Margin Mode",value:L!=null&&L.crossed?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})]})]})},L.oid)})})})},TC=({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})})]}),Yln="https://dextrabothypesocketv2.nftinit.io/";function Xln(){var Q,se;const{isConnected:t,address:e}=es(),{setSignModalOpen:n,trackedWatchList:r,hyperToken:s}=h.useContext(Yr),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:ee}){const[K,re]=h.useState(Uo(ee));return h.useEffect(()=>{const de=setInterval(()=>re(Uo(ee)),1e3);return()=>clearInterval(de)},[ee]),i.jsx("span",{className:"text-[11px] text-[#a5a5a5] font-normal",children:K.dateTime})}h.useEffect(()=>{localStorage.setItem("isDateTrackedWalletsFormat",x)},[x]);function N(ee){const K={};return ee.forEach(re=>{const{oid:de,px:G,dir:ie,side:ae,crossed:q,feeToken:W,listen_user:ne,cloid:oe,coin:he,subs_address:_e,sz:xe,closedPnl:Se,fee:ge,time:Ce,startPosition:je,insert_date:Oe,hash:$e}=re;K[de]||(K[de]={oid:de,px:G,dir:ie,side:ae,crossed:q,feeToken:W,listen_user:ne,cloid:oe,coin:he,subs_address:_e,totalSize:0,totalClosedPnl:0,totalFee:0,earliestStartPosition:je,hasZeroStartPosition:!1,closestTime:Ce,insertDate:Oe,hashes:[]}),parseFloat(je)===0&&(K[de].hasZeroStartPosition=!0),K[de].totalSize+=parseFloat(xe),K[de].totalClosedPnl+=parseFloat(Se),K[de].totalFee+=parseFloat(ge),new Date(Ce)>new Date(K[de].closestTime)&&(K[de].closestTime=Ce),new Date(Ce)>new Date(K[de].insertDate)&&(K[de].insertDate=Oe),K[de].hashes.push($e)}),Object.keys(K).map(re=>({oid:re,...K[re]}))}async function I(){const ee=window.localStorage.getItem("hyperToken");try{u(!0),ee||n(!0);const K=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/feed/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e.toLowerCase(),token:ee,offset:0})});if(!K.ok)throw new Error(`Server responded with status ${K.status}`);const re=await K.json();if(re.success){const de=N(re==null?void 0:re.data);l(de)}}catch(K){console.log("Error :>> ",K)}finally{u(!1)}}function P(ee,K){const re={};return ee.forEach(de=>{re[de.oid]={...de}}),K.forEach(de=>{const{oid:G,px:ie,dir:ae,side:q,crossed:W,feeToken:ne,listen_user:oe,cloid:he,coin:_e,subs_address:xe,sz:Se,closedPnl:ge,fee:Ce,time:je,startPosition:Oe,insert_date:$e,hash:Ye}=de;re[G]||(re[G]={oid:G,px:ie,dir:ae,side:q,crossed:W,feeToken:ne,listen_user:oe,cloid:he,coin:_e,subs_address:xe,totalSize:0,totalClosedPnl:0,totalFee:0,hasZeroStartPosition:!1,earliestStartPosition:Oe,closestTime:je,insertDate:$e,hashes:[]}),parseFloat(Oe)===0&&(re[G].hasZeroStartPosition=!0),re[G].totalSize+=parseFloat(Se),re[G].totalClosedPnl+=parseFloat(ge),re[G].totalFee+=parseFloat(Ce),new Date(je)>new Date(re[G].closestTime)&&(re[G].closestTime=je),new Date(je)>new Date(re[G].insertDate)&&(re[G].insertDate=$e),re[G].hashes.push(Ye)}),Object.values(re).sort((de,G)=>new Date(G.closestTime)-new Date(de.closestTime))}h.useEffect(()=>{I()},[window.localStorage.getItem("hyperToken")]),h.useEffect(()=>{a.current=Dy(Yln);const ee=window.localStorage.getItem("hyperToken");return a.current.on("connect",()=>{r==null||r.map(K=>K.wallet_address),a.current.emit("subscribe",{login:e.toLowerCase(),token:ee})}),a.current.on("hyper_get_message",K=>{if(K){const re=Array.isArray(K)?K:[K];l(de=>{const G=P([],re);let ie=de.filter(W=>re.some(ne=>ne.oid===W.oid)),ae=[];ie.length>0?ae=P(G,ie):ae=G;const q=de.filter(W=>!re.some(ne=>ne.oid===W.oid));return[...ae,...q]})}}),()=>{a.current.disconnect()}},[s]);const M=ee=>ee?ee.includes("Long")?ee==="Short > Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":ee==="Long > Short"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#67ffbd]/20 text-[#67ffbd]":ee==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]",F=ee=>ee?ee.includes("Long")?ee==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):ee==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):ee==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#767676] w-3 h-3"}),$=ee=>{const K=ee==null?void 0:ee.hasZeroStartPosition,re=ee.dir==="Close Short"||ee.dir==="Close Long"||ee.dir==="Short > Long"||ee.dir==="Long > Short";return K||re?{text:"Closed",icon:YM}:{text:"Open",icon:XM}},L=ee=>v(ee),z=()=>v(null);return i.jsxs("div",{className:"flex flex-col w-full pb-2",children:[!o||o.length===0?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-full sm:w-[75%] max-w-[700px] justify-center items-center text-center mt-44",children:c?i.jsx(Ba,{}):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:Kl,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(ee=>($(ee),i.jsxs("div",{className:"border-2 border-[#232323] rounded-xl p-3 flex items-start gap-3 cursor-pointer",onClick:()=>L(ee),children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Ki,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:[ee!=null&&ee.listen_user?ee.listen_user.slice(0,5)+"..."+ee.listen_user.slice(-4):"-",i.jsx("img",{src:_o,alt:"",className:"w-4 h-4 cursor-pointer",onClick:K=>{K.stopPropagation(),navigator.clipboard.writeText((ee==null?void 0:ee.listen_user)||""),dn.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(ee==null?void 0:ee.closestTime)}),i.jsx(C,{date:ee==null?void 0:ee.closestTime})]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",ee!=null&&ee.totalSize?Er(ee==null?void 0:ee.totalSize):"-"]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",ee!=null&&ee.px?"$"+Er(ee==null?void 0:ee.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/${ee==null?void 0:ee.coin}.svg`||za,alt:ee==null?void 0:ee.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:K=>Qi(K)})}),i.jsxs("div",{className:"text-[13px] text-white font-bold font-manrope leading-[13px] tracking-tight",children:[ee==null?void 0:ee.coin,"/",ee==null?void 0:ee.feeToken]})]}),i.jsxs("div",{className:`${M(ee==null?void 0:ee.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(ee==null?void 0:ee.dir)}),i.jsx("div",{className:"text-[11px] font-semibold",children:(ee==null?void 0:ee.dir)||"-"})]})]})]})]},ee.oid)))}),y&&i.jsx(yp,{isOpen:!!y,onClose:()=>z(),children:i.jsxs("div",{className:"flex flex-col gap-4 p-2",children:[i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Ki,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:_o,alt:"",className:"w-4 h-4 cursor-pointer",onClick:ee=>{ee.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:`${M(y==null?void 0:y.dir)} h-5 pl-2 pr-2 py-1 rounded-md flex items-center gap-1`,children:[i.jsx("div",{className:"w-3 h-3",children:F(y==null?void 0:y.dir)}),i.jsx("div",{className:"text-[11px] font-semibold",children:(y==null?void 0:y.dir)||"-"})]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",y!=null&&y.px?"$"+Er(y==null?void 0:y.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",y!=null&&y.totalSize?Er(y==null?void 0:y.totalSize):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",y!=null&&y.totalClosedPnl?"$"+Er(Math.abs(y==null?void 0:y.totalClosedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",y!=null&&y.totalFee?"$"+Er(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`||za,onError:ee=>Qi(ee),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:"})," ",(Q=y==null?void 0:y.hashes)!=null&&Q.length?((se=y==null?void 0:y.hashes)==null?void 0:se.length)+" fill(s)":"0"]})]})]})})]})}const Qln=({open:t,setOpen:e,handleTelegramClick:n})=>(h.useContext(Yr),es(),B5(),i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-8",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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"})})]})})})})})]})),Zln=({open:t,setOpen:e,setIsfilterModal:n,handleTelegramClick:r})=>{const[s,a]=h.useState(!1),o=()=>{a(!1),n(!1),e(!1)};return i.jsxs(Ca,{open:t,onClose:o,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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(p$e,{className:"w-4 h-4 text-black"})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:lct,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"})})]})})})})})]})},Jln=({open:t,setOpen:e,handleTelegramClick:n})=>{const{setSignModalOpen:r}=h.useContext(Yr),{address:s}=es(),[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),[N,I]=h.useState(""),[P,M]=h.useState(!1),[F]=h.useState(["Open Position","Increase","Decrease","Changed Position","Position Closed","Twaps"]),[$,L]=h.useState([]),[z,Q]=h.useState(!1),se=async()=>{var ge;const xe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!xe){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():Se,token:xe})})).json();if(je.success){const Oe=(je==null?void 0:je.data)||[],$e=u?((ge=u==null?void 0:u.message_filters)==null?void 0:ge.source)||[]:[],Ye=[...Oe].sort((Je,ht)=>{const rt=$e==null?void 0:$e.includes(Je.wallet_address),st=$e==null?void 0:$e.includes(ht.wallet_address);return Number(st)-Number(rt)});o(Ye),await ee(Ye)}else I((je==null?void 0:je.error_message)||"Failed to fetch source wallets"),console.error("API Error:",je==null?void 0:je.error_message)}catch(Ce){console.error("Fetch Error:",Ce),I("Failed to fetch source wallets")}finally{setTimeout(()=>{x(!1)},200)}},ee=async xe=>{var Ce;const Se=window.localStorage.getItem("hyperToken"),ge=window.localStorage.getItem("hyperAddress");if(!Se){r(!0);return}try{y(!0);const Oe=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():ge,token:Se})})).json();if(Oe.success){const $e=Oe==null?void 0:Oe.filters;if(d($e),$e===null){const Ye=xe==null?void 0:xe.map(Je=>`${Je.wallet_address}::${Je.tag}`);c(Ye),L([...F])}else{const Ye=((Ce=$e==null?void 0:$e.message_filters)==null?void 0:Ce.source)||[],Je=[...xe].sort((ht,rt)=>{const st=Ye==null?void 0:Ye.includes(ht.wallet_address),He=Ye==null?void 0:Ye.includes(rt.wallet_address);return Number(He)-Number(st)});o(Je)}}else I((Oe==null?void 0:Oe.error_message)||"Failed to fetch filter info"),console.error("API telegram filter info error:",Oe==null?void 0:Oe.error_message)}catch(je){console.error("Fetch Error:",je),I("Failed to fetch filter info")}finally{y(!1)}},K=async()=>{const xe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!xe){r(!0);return}const ge=[...new Set(l==null?void 0:l.map($e=>$e.split("::")[0]))];let Ce={};ge.length>0&&(Ce.source=ge);const je=$.filter($e=>!$e.includes("Spot"));je.length>0&&(Ce.type=je),ge.length===0&&$.length===0&&(Ce={});const Oe={address:s?s==null?void 0:s.toLowerCase():Se,token:xe,filters:Ce};try{C(!0);const $e=await fetch("https://dextrabothypev2.nftinit.io/api/subscriber/telegram_filter_save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Oe)}),Ye=await $e.json();$e.ok&&Ye.success?(d(Ye.filters),he(Ye.filters),M(!0),dn.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"}})):(I((Ye==null?void 0:Ye.error_message)||"Failed to save filter"),console.error("API telegram filter save error:",Ye==null?void 0:Ye.error_message))}catch($e){console.error("Fetch Error:",$e),I("Failed to save filter")}finally{C(!1)}};h.useEffect(()=>{a.length>0&&u&&he(u)},[a,u]),h.useEffect(()=>{t&&se()},[t]);const re=xe=>{const{value:Se,checked:ge}=xe.target;if(Se==="all"){const Ce=a.map(je=>`${je.wallet_address}::${je.tag}`);c(ge?Ce:[])}else c(Ce=>ge?[...Ce,Se]:Ce.filter(je=>je!==Se))},de=a==null?void 0:a.map(xe=>`${xe.wallet_address}::${xe.tag}`),G=a.length>0&&(de==null?void 0:de.every(xe=>l==null?void 0:l.includes(xe))),ie=xe=>{const{value:Se,checked:ge}=xe.target;if(Se==="all")if(ge){const Ce=F==null?void 0:F.filter(je=>!(je!=null&&je.includes("Spot")));L(Ce)}else L([]);else L(Ce=>ge?[...Ce,Se]:Ce.filter(je=>je!==Se))},q=(F==null?void 0:F.filter(xe=>!xe.includes("Spot"))).length,ne=$.filter(xe=>!xe.includes("Spot")).length,oe=ne===q&&q>0,he=xe=>{const Se=xe==null?void 0:xe.message_filters;if(Se&&(Array.isArray(Se.type)&&L(Se.type.filter(ge=>!ge.includes("Spot"))),Array.isArray(Se.source))){const ge=a.filter(Ce=>{var je;return(je=Se.source)==null?void 0:je.includes(Ce.wallet_address)}).map(Ce=>`${Ce.wallet_address}::${Ce.tag}`);c(ge)}},_e=()=>{e(!1),Q(!1),o([]),L([]),c([])};return i.jsxs(i.Fragment,{children:[i.jsx(Zln,{open:P,setOpen:M,handleTelegramClick:n,setIsfilterModal:e}),i.jsxs(Ca,{open:t,onClose:_e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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:()=>_e(),className:`${l.length===0&&$.length===0?"hover:bg-[rgba(103,255,189,0.16)]":"hover:bg-[#787070]"} cursor-pointer absolute top-2 right-2 sm:top-8 sm:right-6 w-9 h-9 rounded-full flex justify-center items-center `,children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"flex justify-start items-center gap-3 w-full px-6 sm:px-10",children:i.jsx("div",{className:"text-white text-[21px] font-semibold font-['Manrope']",children:"Telegram Notifications"})}),i.jsxs("div",{className:"w-full pl-6 sm:pl-8 pr-2",children:[i.jsx("div",{className:"flex justify-between items-center mb-2 pr-6 max-w-[244px] sm:max-w-full",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 pl-2",children:[i.jsx("span",{className:"text-white text-xs sm:text-sm font-manrope font-semibold leading-[8px]",children:"Source Wallet"}),i.jsx("span",{className:"text-[10px] sm:text-sm text-white font-semibold",children:(l==null?void 0:l.length)>0?`(${l==null?void 0:l.length} of ${a==null?void 0:a.length} selected)`:""})]})}),i.jsx("div",{className:"relative max-w-[244px] sm:max-w-full",children:i.jsx("div",{className:"w-full bg-transparent rounded-md mt-[2px] transition-all duration-200",children:i.jsx("div",{className:"max-h-[186px] overflow-y-auto scrollbar-custom-scrollbar-dark pr-0 sm:pr-[17px]",children:f?i.jsx("div",{className:"flex w-full h-full justify-center items-center min-h-[160px]",children:i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 w-[32px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-10 h-10 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]})}):i.jsxs(i.Fragment,{children:[(a==null?void 0:a.length)>0?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"flex sticky top-0 z-10 bg-[#242424] justify-between items-center gap-2 cursor-pointer text-white font-semibold pt-1 pb-2 px-2 text-[13px] font-manrope leading-[8px]",children:[i.jsx("span",{className:`${G?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:G,onChange:re,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((xe,Se)=>{var je,Oe,$e,Ye,Je;const ge=`${xe==null?void 0:xe.wallet_address}::${xe==null?void 0:xe.tag}`,Ce=l==null?void 0:l.includes(ge);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:`${Ce?"text-white":"text-[#7C7C7C]"} text-[13px] font-semibold min-w-[88px]`,children:((je=xe.wallet_address)==null?void 0:je.slice(0,5))+"..."+((Oe=xe.wallet_address)==null?void 0:Oe.slice(-4))}),i.jsx("span",{className:`${Ce?"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:(($e=xe.tag)==null?void 0:$e.length)>10?`${(Ye=xe==null?void 0:xe.tag)==null?void 0:Ye.slice(0,10)}...`:`${xe==null?void 0:xe.tag}`}),i.jsx("span",{className:`${Ce?"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:((Je=xe.tag)==null?void 0:Je.length)>24?`${xe==null?void 0:xe.tag.slice(0,24)}...`:`${xe==null?void 0:xe.tag}`})]}),i.jsx("input",{type:"checkbox",value:`${xe==null?void 0:xe.wallet_address}::${xe==null?void 0:xe.tag}`,checked:Ce,onChange:re,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${Ce?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${Ce?"translate-x-[14px]":"translate-x-0"}`})})]},Se)})]})})})})]}),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:ne>0?`(${ne} of ${q} selected)`:""})]})}),i.jsx("div",{className:"relative max-w-[244px] sm:max-w-full",children:i.jsx("div",{className:"w-full rounded-md mt-[2px] transition-all duration-200",children:i.jsxs("div",{className:"max-h-[296px] overflow-y-auto scrollbar-custom-scrollbar-dark",children:[i.jsxs("label",{className:"flex sticky top-0 z-10 justify-between items-center gap-2 cursor-pointer text-white font-semibold py-1 px-2 text-[13px] font-manrope leading-[8px]",children:[i.jsx("span",{className:`${oe?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:oe,onChange:ie,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${oe?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${oe?"translate-x-[14px]":"translate-x-0"}`})})]}),i.jsx("div",{className:"h-[1px] w-full bg-[#353535] my-1"}),F==null?void 0:F.map((xe,Se)=>{const ge=$==null?void 0:$.includes(xe);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:`${ge?"text-white":"text-[#7C7C7C]"}`,children:xe}),i.jsx("input",{type:"checkbox",value:xe,checked:ge,onChange:ie,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${ge?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${ge?"translate-x-[14px]":"translate-x-0"}`})})]},Se)})]})})})]}),i.jsx("div",{onClick:xe=>{if(xe.preventDefault(),!f&&!g&&!v)if((l==null?void 0:l.length)===0||($==null?void 0:$.length)===0){dn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Select at least one wallet or type."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"350px",minWidth:"350px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}else K()},className:`${!f&&!g&&!v&&(l==null?void 0:l.length)>0&&($==null?void 0:$.length)>0?"cursor-pointer bg-[rgba(103,255,189,0.16)] text-[#67FFBD] hover:bg-[rgba(103,255,189,0.26)]":"cursor-pointer bg-[#787070] text-[#A6A6A6] border border-[#787070]"} w-full max-w-[230px] sm:max-w-[341px] mr-2 sm:mr-0 sm:ml-2 h-8 px-6 py-3 rounded-[10px] flex justify-center items-center gap-2.5`,children:i.jsx("div",{className:"pointer-events-none text-[13px] font-semibold font-['Inter'] leading-[8px]",children:f||g||v?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[32px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):"Next"})}),N&&i.jsx("p",{className:"mt-2 text-sm text-red-500",children:N})]})})})})]})]})},ecn=({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(Yr);es();const y=async()=>{var C,N;let v="";try{const I=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!I){a(!0);return}if(P&&I){const M=await vi(P,I);if(!M.success){console.error("Account check failed:",M.message);return}if(o(M==null?void 0:M.telegram_chat_id),l(M==null?void 0:M.subscriber_role),d((C=M==null?void 0:M.mushboomer_counts)==null?void 0:C.eth),x((N=M==null?void 0:M.mushboomer_counts)==null?void 0:N.sol),c(M==null?void 0:M.referral_code),u(M==null?void 0:M.refcode),f(M==null?void 0:M.whitelist),M.telegram_chat_id==null||M.telegram_chat_id==""||M.telegram_chat_id=="0"){const F=await $wt(P,I);if(!F.success){console.error("Telegram-ID kunne ikke hentes:",M.message),dn.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"),dn.error("Failed to generate Telegram URL"))}catch(I){console.error("Error during Telegram handling:",I),dn.error(I.message)}};return i.jsxs(i.Fragment,{children:[i.jsx(Qln,{open:e,setOpen:n,handleTelegramClick:y}),i.jsx(Jln,{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 tcn(t){var Vn,tn,fn,rn,nt,it,Ut,hn,nn,Vt,pt,We,It,Ge,ct,vt,Ht,Rt,mn,un,yn,_n,In,Sn,Yn,Xn,zn,Kn,jn,De,pe,qe,Ae,ze,zt,kt,gt,Mt,ln,vn,Wn,On;const[e,n]=h.useState(!1),r=h.useRef(null),{isConnected:s,address:a}=es(),[o,l]=h.useState([]);h.useEffect(()=>{var Nn,Fn;const $t=(Nn=t.advancedFilters)==null?void 0:Nn.coinFeed;if($t&&((Fn=t.dataCoin)==null?void 0:Fn.length)>0){const Tt=$t.map(pn=>t.dataCoin.find(ke=>ke.value===pn)).filter(Boolean);t.setSelectedCoins(Tt)}},[t.dataCoin]);const c=$t=>{if(!$t)return;const Fn=Array.isArray($t)?$t:[$t],Tt=t.selectedCoins||[],pn=[...Tt,...Fn.filter(m=>!Tt.some(p=>p.value===m.value))],ke=pn.map(m=>m.value);ke.join(","),t.setSelectedCoins(pn),t.setAdvancedFilters(m=>({...m,coinFeed:ke}))},[u,d]=h.useState(!1),[f,x]=h.useState(!1),[g,y]=h.useState(!1),[v,C]=h.useState(!1),[N,I]=h.useState(!1),[P,M]=h.useState(!1),F=()=>{d($t=>!$t)},$=()=>{x($t=>!$t)},L=()=>{y($t=>!$t)},z=()=>{C($t=>!$t)},Q=()=>{I($t=>!$t)},se=()=>{M($t=>!$t)},ee=$t=>{const{value:Nn,checked:Fn}=$t.target;t.setAdvancedFilters(Tt=>{let pn=[...Tt.positionFeed];return Nn==="all"?pn=Fn?[...je]:[]:Fn?pn.push(Nn):pn=pn.filter(ke=>ke!==Nn),localStorage.setItem("positionFeed",JSON.stringify(pn)),{...Tt,positionFeed:pn}})},K=()=>{localStorage.setItem("positionFeed",JSON.stringify([])),t.setAdvancedFilters($t=>({...$t,positionFeed:[]}))},re=$t=>{const{value:Nn,checked:Fn}=$t.target;t.setAdvancedFilters(Tt=>{let pn=[...Tt.typeFeed];return Nn==="all"?pn=Fn?[...Ye]:[]:Fn?pn.push(Nn):pn=pn.filter(ke=>ke!==Nn),{...Tt,typeFeed:pn}})},de=()=>{t.setAdvancedFilters($t=>({...$t,typeFeed:[]}))},G=$t=>{const{value:Nn,checked:Fn}=$t.target;t.setAdvancedFilters(Tt=>{let pn=[...Tt.dexMarket];return Nn==="all"?pn=Fn?[...Je]:[]:Fn?pn.push(Nn):pn=pn.filter(ke=>ke!==Nn),{...Tt,dexMarket:pn}})},ie=()=>{t.setAdvancedFilters($t=>({...$t,dexMarket:[]}))},ae=()=>{t.setSearchTagSellect([])},q=((Vn=t.selectTradeWalletData)==null?void 0:Vn.length)>0?o:t.walletTags,W=$t=>{const{value:Nn,checked:Fn}=$t.target;t.setSearchTagSellect(Tt=>{let pn=[...Tt];return Nn==="all"?pn=Fn?q==null?void 0:q.map(ke=>ke.tag):[]:Fn?pn==null||pn.push(Nn):pn=pn==null?void 0:pn.filter(ke=>ke!==Nn),pn})},ne=$t=>{t.setAdvancedFilters(Nn=>({...Nn,directionFeed:$t})),M(!1)},oe=()=>{t.setAdvancedFilters($t=>({...$t,directionFeed:""})),M(!1)},he=()=>{t.setSelectTradeWalletData([])},[_e,xe]=h.useState(!1),Se=async $t=>{const{value:Nn,checked:Fn}=$t.target;let Tt;t.setSelectTradeWalletData(pn=>{var ke;return Nn==="all"?Tt=Fn?(ke=t.tradeWalletData)==null?void 0:ke.map(m=>m.wallet):[]:(Tt=Fn?[...pn,Nn]:pn==null?void 0:pn.filter(m=>m!==Nn),!Fn&&pn.includes("all")&&(Tt=Tt==null?void 0:Tt.filter(m=>m!=="all"))),Tt}),t.setSearchTagSellect([]),setTimeout(async()=>{var pn;if((Tt==null?void 0:Tt.length)!==0)try{xe(!0);const ke=window.localStorage.getItem("hyperToken");if(!ke){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:ke,trader_wallets:Tt})});if(!p.ok)throw new Error(`Server responded with status ${p.status}`);const S=await p.json();if(S.success){const A=(pn=S==null?void 0:S.data)==null?void 0:pn.map(k=>({tag:k==null?void 0:k.tag,wallet:k==null?void 0:k.wallet_address}));l(A),xe(!1)}else console.log(S.error_message),xe(!1)}catch(ke){console.log("Error :>> ",ke),xe(!1)}},0)},ge={control:($t,{isFocused:Nn})=>{var Fn,Tt,pn,ke;return{...$t,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",minWidth:"244px",maxWidth:"244px",border:((Tt=(Fn=t.advancedFilters)==null?void 0:Fn.coinFeed)==null?void 0:Tt.length)>0?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:((ke=(pn=t.advancedFilters)==null?void 0:pn.coinFeed)==null?void 0:ke.length)>0?"1px solid #8d67ff":"none"}}},menu:$t=>({...$t,backgroundColor:"#353535",maxWidth:"244px"}),menuList:$t=>({...$t,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:$t=>({...$t,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:$t=>({...$t,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:($t,{data:Nn,isDisabled:Fn,isFocused:Tt,isSelected:pn})=>{const ke=yi(Nn.color);return{...$t,fontSize:"14px",fontWeight:"600",backgroundColor:Fn?void 0:pn?Nn.color:Tt?ke.alpha(.1).css():void 0,color:"white",cursor:Fn?"not-allowed":"pointer",":active":{...$t[":active"],backgroundColor:Fn?void 0:pn?Nn.color:ke.alpha(.9).css()}}},multiValue:($t,{data:Nn})=>{const Fn=yi(Nn.color);return{...$t,backgroundColor:Fn.alpha(.4).css()}},multiValueLabel:($t,{data:Nn})=>({...$t,color:"white"}),multiValueRemove:($t,{data:Nn})=>({...$t,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:$t=>({...$t,color:"white"}),valueContainer:$t=>({...$t,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},Ce=($t,Nn)=>{var Tt;const Fn=(Tt=Nn.selectedCoins)==null?void 0:Tt.filter(pn=>pn.value!==$t.value);Fn.map(pn=>pn.value).join(","),Nn.setSelectedCoins(Fn),Nn.setAdvancedFilters(pn=>({...pn,coinFeed:Fn==null?void 0:Fn.map(ke=>ke.value)}))};h.useEffect(()=>{const $t=Nn=>{r.current&&!r.current.contains(Nn.target)&&n(!1)};return document.addEventListener("mousedown",$t),()=>{document.removeEventListener("mousedown",$t)}},[]);const je=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],Oe=(tn=t.advancedFilters.positionFeed)==null?void 0:tn.length,$e=je.length,Ye=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Twaps"],Je=["HyperLiquid","Lighter"],ht=(fn=t.advancedFilters.typeFeed)==null?void 0:fn.length,rt=Ye.length,st=(rn=t.advancedFilters.dexMarket)==null?void 0:rn.length,He=Je.length,Ve=(nt=t.searchTagSellect)==null?void 0:nt.length,bt=q==null?void 0:q.length,xt=(it=t.selectTradeWalletData)==null?void 0:it.length,Qt=(Ut=t.tradeWalletData)==null?void 0:Ut.length,St=["Long","Short"],on=({src:$t,alt:Nn})=>{const[Fn,Tt]=Ie.useState(!1);return Fn?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:$t,alt:Nn,className:"rounded-full w-4 h-4 min-w-4 min-h-4 mr-1",loading:"lazy",onError:()=>Tt(!0)})},cn=$t=>{const{data:Nn,innerRef:Fn,innerProps:Tt,selectProps:pn}=$t,ke=pn.styles.option({},$t);return i.jsxs("div",{ref:Fn,...Tt,style:ke,className:"flex items-center p-2",children:[i.jsx(on,{src:Nn.icon,alt:Nn.label}),Nn.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:`${st>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:L,children:[i.jsx("span",{className:`${st>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:st>0?`${st} 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:((nn=(hn=t.advancedFilters)==null?void 0:hn.dexMarket)==null?void 0:nn.length)===Je.length,onChange:G,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((pt=(Vt=t.advancedFilters)==null?void 0:Vt.dexMarket)==null?void 0:pt.length)===Je.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((It=(We=t.advancedFilters)==null?void 0:We.dexMarket)==null?void 0:It.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(($t,Nn)=>{var Fn,Tt,pn,ke,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:$t,checked:(Tt=(Fn=t.advancedFilters)==null?void 0:Fn.dexMarket)==null?void 0:Tt.includes($t),onChange:G,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(ke=(pn=t.advancedFilters)==null?void 0:pn.dexMarket)!=null&&ke.includes($t)?"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($t))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),$t==="HyperLiquid"?i.jsx("img",{src:P1,alt:"hyper",className:"w-4 h-4 rounded-sm"}):$t==="Lighter"?i.jsx(yf,{className:"w-4 h-4 text-[#fff]"}):null,$t]},Nn)})]})})]})]}),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:he,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:`${xt>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:Q,children:[i.jsx("span",{className:`${xt>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:xt>0?`${xt} of ${Qt} selected`:"Select Wallet"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${N?"rotate-180":""}`})]}),N&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsxs("div",{className:"max-h-40 overflow-y-auto scrollbar-custom-scrollbar-dark",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((Ge=t.selectTradeWalletData)==null?void 0:Ge.length)===((ct=t.tradeWalletData)==null?void 0:ct.length),onChange:Se,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((vt=t.selectTradeWalletData)==null?void 0:vt.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)===((mn=t.tradeWalletData)==null?void 0:mn.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..."'}):(un=t.tradeWalletData)==null?void 0:un.map(($t,Nn)=>{var Fn,Tt,pn,ke,m,p,S;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:$t==null?void 0:$t.wallet,checked:(Fn=t.selectTradeWalletData)==null?void 0:Fn.includes($t==null?void 0:$t.wallet),onChange:Se,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Tt=t.selectTradeWalletData)!=null&&Tt.includes($t==null?void 0:$t.wallet)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((pn=t.selectTradeWalletData)==null?void 0:pn.includes($t==null?void 0:$t.wallet))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),((ke=$t==null?void 0:$t.wallet)==null?void 0:ke.slice(0,5))+"..."+((m=$t==null?void 0:$t.wallet)==null?void 0:m.slice(-4)),` (${((p=$t==null?void 0:$t.name)==null?void 0:p.length)>10?((S=$t==null?void 0:$t.name)==null?void 0:S.slice(0,10))+"...":$t==null?void 0:$t.name})`]},Nn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Source Wallet"}),i.jsx("div",{onClick:ae,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${Ve>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:z,children:[i.jsx("span",{className:`${Ve>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:Ve>0?`${Ve} of ${bt} 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:_e?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:((yn=t.searchTagSellect)==null?void 0:yn.length)===(q==null?void 0:q.length),onChange:W,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((_n=t.searchTagSellect)==null?void 0:_n.length)===(q==null?void 0:q.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((In=t.searchTagSellect)==null?void 0:In.length)===(q==null?void 0:q.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]"}),q==null?void 0:q.map(($t,Nn)=>{var Fn,Tt,pn,ke,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:$t==null?void 0:$t.tag,checked:(Fn=t.searchTagSellect)==null?void 0:Fn.includes($t==null?void 0:$t.tag),onChange:W,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Tt=t.searchTagSellect)!=null&&Tt.includes($t==null?void 0:$t.tag)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((pn=t.searchTagSellect)==null?void 0:pn.includes($t==null?void 0:$t.tag))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),($t==null?void 0:$t.wallet)&&((ke=$t==null?void 0:$t.wallet)==null?void 0:ke.slice(0,5))+"..."+((m=$t==null?void 0:$t.wallet)==null?void 0:m.slice(-4))," ",$t!=null&&$t.tag&&($t==null?void 0:$t.tag.length)>10?`(${(p=$t==null?void 0:$t.tag)==null?void 0:p.slice(0,10)}...)`:`(${$t==null?void 0:$t.tag})`]},Nn)})]})})]})]}),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($t=>({...$t,coinFeed:""}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear Coins"})})]}),i.jsx("div",{className:"float-left w-full",ref:r,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:"text-[#646464] absolute left-[6px] top-[6px] z-10"}),i.jsx(hl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter($t=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(Nn=>Nn.value===$t.value)),components:{Option:cn},styles:ge,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&&((Sn=t.selectedCoins)==null?void 0:Sn.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((Yn=t.selectedCoins)==null?void 0:Yn.map($t=>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(on,{src:$t==null?void 0:$t.icon,alt:$t==null?void 0:$t.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:$t.label}),i.jsx("div",{onClick:Nn=>{Nn.stopPropagation(),Ce($t,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},$t.value)))}),i.jsx("div",{className:`${((Xn=t.selectedCoins)==null?void 0:Xn.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[244px]`,children:t.selectedCoins&&((zn=t.selectedCoins)==null?void 0:zn.map($t=>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(on,{src:$t==null?void 0:$t.icon,alt:$t==null?void 0:$t.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:$t.label}),i.jsx("div",{onClick:()=>Ce($t,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},$t.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:de,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${ht>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:`${ht>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:ht>0?`${ht} of ${rt} 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:((jn=(Kn=t.advancedFilters)==null?void 0:Kn.typeFeed)==null?void 0:jn.length)===Ye.length,onChange:re,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((pe=(De=t.advancedFilters)==null?void 0:De.typeFeed)==null?void 0:pe.length)===Ye.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Ae=(qe=t.advancedFilters)==null?void 0:qe.typeFeed)==null?void 0:Ae.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(($t,Nn)=>{var Fn,Tt,pn,ke,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:$t,checked:(Tt=(Fn=t.advancedFilters)==null?void 0:Fn.typeFeed)==null?void 0:Tt.includes($t),onChange:re,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(ke=(pn=t.advancedFilters)==null?void 0:pn.typeFeed)!=null&&ke.includes($t)?"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($t))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),$t]},Nn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Follower Wallet Status"}),i.jsx("div",{onClick:K,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${Oe>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:`${Oe>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:Oe>0?`${Oe} of ${$e} 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:((zt=(ze=t.advancedFilters)==null?void 0:ze.positionFeed)==null?void 0:zt.length)===(je==null?void 0:je.length),onChange:ee,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((gt=(kt=t.advancedFilters)==null?void 0:kt.positionFeed)==null?void 0:gt.length)===(je==null?void 0:je.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((ln=(Mt=t.advancedFilters)==null?void 0:Mt.positionFeed)==null?void 0:ln.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(($t,Nn)=>{var Fn,Tt,pn,ke,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:$t,checked:(Tt=(Fn=t.advancedFilters)==null?void 0:Fn.positionFeed)==null?void 0:Tt.includes($t),onChange:ee,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(ke=(pn=t.advancedFilters)==null?void 0:pn.positionFeed)!=null&&ke.includes($t)?"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($t))&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),$t==="Other"?"System Message":$t]},Nn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Direction"}),i.jsx("div",{onClick:oe,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${(vn=t.advancedFilters)!=null&&vn.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:se,children:[i.jsx("span",{className:`${(Wn=t.advancedFilters)!=null&&Wn.directionFeed?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:((On=t.advancedFilters)==null?void 0:On.directionFeed)||"Select Direction"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${P?"rotate-180":""}`})]}),P&&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:St==null?void 0:St.map(($t,Nn)=>i.jsx("div",{onClick:()=>ne($t),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:$t},Nn))})})]})]})]})}const ncn=({advancedFilters:t,setAdvancedFilters:e,getFeedClearData:n,getFeedData:r,dataCoin:s,selectedCoins:a,setSelectedCoins:o,isLoadingCoin:l,setIsLoadingCoin:c,walletTagData:u,walletTags:d,searchWalletSellect:f,setSearchWalletSellect:x,walletTagLoading:g,tradeWalletData:y,selectTradeWalletData:v,setSelectTradeWalletData:C,searchTagSellect:N,setSearchTagSellect:I,isWalletLoading:P})=>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(tcn,{advancedFilters:t,setAdvancedFilters:e,dataCoin:s,selectedCoins:a,setSelectedCoins:o,isLoadingCoin:l,setIsLoadingCoin:c,walletTagData:u,searchWalletSellect:f,setSearchWalletSellect:x,walletTagLoading:g,tradeWalletData:y,selectTradeWalletData:v,setSelectTradeWalletData:C,searchTagSellect:N,setSearchTagSellect:I,walletTags:d,isWalletLoading:P})})}),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 rcn={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 rcn[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 _w(t){var e=scn(t);return"".concat(e.value).concat(e.unit)}var rse=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},HD=function(){return HD=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},HD.apply(this,arguments)},icn=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=rse("BeatLoader","50% {transform: scale(0.75);opacity: 0.2} 100% {transform: scale(1);opacity: 1}","beat");function LVe(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=icn(t,["loading","color","speedMultiplier","cssOverride","size","margin"]),y=HD({display:"inherit"},c),v=function(C){return{display:"inline-block",backgroundColor:s,width:_w(d),height:_w(d),margin:_w(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",HD({style:y},g),h.createElement("span",{style:v(1)}),h.createElement("span",{style:v(2)}),h.createElement("span",{style:v(3)})):null}var VD=function(){return VD=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},VD.apply(this,arguments)},ocn=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},hSe=[rse("PuffLoader","0% {transform: scale(0)} 100% {transform: scale(1.0)}","puff-1"),rse("PuffLoader","0% {opacity: 1} 100% {opacity: 0}","puff-2")];function DVe(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=ocn(t,["loading","color","speedMultiplier","cssOverride","size"]),x=VD({display:"inherit",position:"relative",width:_w(d),height:_w(d)},c),g=function(y){return{position:"absolute",height:_w(d),width:_w(d),border:"thick solid ".concat(s),borderRadius:"50%",opacity:"1",top:"0",left:"0",animationFillMode:"both",animation:"".concat(hSe[0],", ").concat(hSe[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",VD({style:x},f),h.createElement("span",{style:g(1)}),h.createElement("span",{style:g(2)})):null}function lcn({feedData:t}){var l,c;const[e,n]=h.useState(null);function r({date:u}){const[d,f]=h.useState(Uo(u));return h.useEffect(()=>{const x=setInterval(()=>{f(Uo(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(DVe,{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:Ki,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:P1,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:_o,alt:"",className:"w-4 h-4 cursor-pointer",onClick:N=>{N.stopPropagation(),navigator.clipboard.writeText((u==null?void 0:u.listen_user)||""),dn.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?Er(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?"$"+Er(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`||za,onError:N=>Qi(N),alt:"",className:"w-5 h-5"}),i.jsxs("div",{className:"text-[13px] text-white font-bold",children:[u==null?void 0:u.coin,"/",(u==null?void 0:u.feeToken)||"USDC"]}),i.jsxs("div",{className:`${o(u==null?void 0:u.dir)==="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":o(u==null?void 0:u.dir)==="Short"?"bg-[#ff797c]/20 text-[#ff797c]":(u==null?void 0:u.dir)==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":(u==null?void 0:u.dir)==="Sell"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]"} h-5 pl-2 pr-2 py-1 rounded-md flex items-center gap-1 w-max`,children:[i.jsx("div",{className:"w-3 h-3",children:(f=u==null?void 0:u.dir)!=null&&f.includes("Long")?(u==null?void 0:u.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold",children:[(u==null?void 0:u.dir)||"-"," ",u!=null&&u.leverage?`${u.leverage}x`:""]})]})]})]})]}),i.jsx("div",{className:`${u!=null&&u.success?"bg-[#67ffbd]/20 border-[#67ffbd]/25":"bg-[#ff797c]/20 border-[#ff797c]/25"} flex justify-start items-center h-8 max-h-8 rounded-bl-[18px] rounded-br-[18px] border-t w-full py-1.5`,children:i.jsxs("div",{className:"text-white text-sm font-manrope leading-none flex justify-start items-center px-2 gap-2",children:[u!=null&&u.success?i.jsx("img",{src:YM,alt:""}):i.jsx("img",{src:XM,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:Ki,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:_o,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?YM:XM,alt:"",className:"w-4 h-4"}),"Status: ",e!=null&&e.success?"Success":"Failed"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Order ID:"})," ",(e==null?void 0:e.oid)||"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Type:"})," ",(e==null?void 0:e.fill_direction_type)||"-"]}),i.jsxs("div",{className:"flex items-center gap-1 text-white",children:["Direction:",i.jsxs("div",{className:`${o(e==null?void 0:e.dir)==="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":o(e==null?void 0:e.dir)==="Short"?"bg-[#ff797c]/20 text-[#ff797c]":(e==null?void 0:e.dir)==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":(e==null?void 0:e.dir)==="Sell"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]"} h-5 pl-1 pr-1.5 py-1 rounded-md flex items-center gap-1`,children:[i.jsx("div",{className:"w-3 h-3",children:(l=e==null?void 0:e.dir)!=null&&l.includes("Long")?(e==null?void 0:e.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold",children:[(e==null?void 0:e.dir)||"-"," ",e!=null&&e.leverage?`${e.leverage}x`:""]})]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",e!=null&&e.px?"$"+Er(e==null?void 0:e.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",e!=null&&e.sz?Er(e==null?void 0:e.sz):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Entry Price:"})," ",e!=null&&e.markPrice?"$"+Er(e==null?void 0:e.markPrice):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",e!=null&&e.closedPnl?"$"+Er(Math.abs(e==null?void 0:e.closedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",e!=null&&e.fee?"$"+Er(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`||za,onError:u=>Qi(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 ccn=()=>{var rn;const{isConnected:t,address:e}=es(),{setSignModalOpen:n,copyTradeWatchList:r,hyperToken:s}=h.useContext(Yr),[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,N]=h.useState(!0),[I,P]=h.useState([]),[M,F]=h.useState(!0),[$,L]=h.useState([]),[z,Q]=h.useState([]),[se,ee]=h.useState([]),[K,re]=h.useState([]),[de,G]=h.useState([]),[ie,ae]=h.useState(!1),[q,W]=h.useState([]),[ne,oe]=h.useState([]),_e=localStorage.getItem("isDateCopyTradeFormat")||"date",[xe,Se]=h.useState(_e),[ge,Ce]=h.useState(!1);h.useEffect(()=>{localStorage.setItem("isDateCopyTradeFormat",xe)},[xe]),h.useEffect(()=>{(async()=>{var it,Ut;try{const nn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),Vt=()=>yi.random().hex(),pt=(Ut=(it=nn.coins)==null?void 0:it.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()}));P(pt),F(!1)}catch(hn){console.error("Data extraction error:",hn),F(!1)}})()},[]);const[je,Oe]=h.useState({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:"",dexMarket:[]});h.useEffect(()=>{const nt=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],it=localStorage.getItem("positionFeed"),Ut=it&&Array.isArray(JSON.parse(it))?JSON.parse(it):nt;Oe(hn=>({...hn,positionFeed:Ut}))},[]);const $e=h.useRef(je);h.useEffect(()=>{$e.current=je},[je]);const Ye=async(nt=!1)=>{var Ut,hn,nn;g(0),v(!0),N(!0);const it=window.localStorage.getItem("hyperToken");try{o(!0),c(!0);const Vt=window.localStorage.getItem("hyperAddress");if(!it){n(!0);return}const pt={};(q==null?void 0:q.length)>0&&(pt.copy_trader=q),(se==null?void 0:se.length)>0&&(pt.trader=se),(ne==null?void 0:ne.length)>0&&(pt.tag=ne),((Ut=je==null?void 0:je.coinFeed)==null?void 0:Ut.length)>0&&(pt.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(_n=>_n.trim()):je.coinFeed);const We=localStorage.getItem("positionFeed"),It=nt?We&&JSON.parse(We)||["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"]:je.positionFeed;(It==null?void 0:It.length)>0&&(It==null?void 0:It.length)<6&&(pt.position=It),((hn=je==null?void 0:je.typeFeed)==null?void 0:hn.length)>0&&((nn=je==null?void 0:je.typeFeed)==null?void 0:nn.length)<7&&(pt.type=je.typeFeed),je!=null&&je.directionFeed&&(pt.direction=je.directionFeed),je!=null&&je.statusFeed&&(je.statusFeed==="On"?pt.status=!0:je.statusFeed==="Off"?pt.status=!1:je.statusFeed==="All"&&delete pt.status);const Ge=((je==null?void 0:je.dexMarket)||[]).map(_n=>_n.toLowerCase()),ct=Ge.includes("hyperliquid"),vt=Ge.includes("lighter"),Ht=[];ct&&!vt?Ht.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):vt&&!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(_n=>fetch(_n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:it,offset:0,...Object.keys(pt).length&&{filters:pt}})}))),un=(await Promise.all(Rt.map(_n=>_n.json()))).filter(_n=>_n.success&&Array.isArray(_n.data)).flatMap(_n=>_n.data).sort((_n,In)=>new Date(In.time)-new Date(_n.time));d(un),g(_n=>_n+50),un.length<50&&N(!1);const yn=un.map(_n=>({wallet:_n.trader_wallet,name:_n.wallet_name}));Q(_n=>{const In=new Map(_n.map(Sn=>[Sn.wallet,Sn.name]));return yn.forEach(Sn=>{In.has(Sn.wallet)||In.set(Sn.wallet,Sn.name)}),Array.from(In,([Sn,Yn])=>({wallet:Sn,name:Yn}))})}catch(Vt){console.log("Error :>> ",Vt)}finally{o(!1),c(!1),v(!1)}},Je=async()=>{const nt=window.localStorage.getItem("hyperToken");try{ae(!0);const it="https://dextrabothypev2.nftinit.io/api/hyper/trade/feed/tag_list/",Ut=window.localStorage.getItem("hyperAddress");if(!nt){n(!0);return}const hn=await fetch(it,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Ut,token:nt})});if(!hn.ok)throw new Error(`Server responded with status ${hn.status}`);const nn=await hn.json();if(nn.success){re(nn==null?void 0:nn.data);const Vt=nn==null?void 0:nn.data.map(pt=>pt.tag?{tag:pt.tag,wallet:pt.wallet_address}:null).filter(pt=>pt!==null);G(Vt)}else console.log(nn.error_message)}catch(it){console.log("Error :>> ",it)}finally{ae(!1)}};h.useEffect(()=>{Ye(!0),Je()},[s]);const ht=async()=>{g(0),v(!0),N(!0);const nt=window.localStorage.getItem("hyperToken");try{o(!0);const it=window.localStorage.getItem("hyperAddress");if(!nt){n(!0);return}const Ut=((je==null?void 0:je.dexMarket)||[]).map(Ge=>Ge.toLowerCase()),hn=Ut.includes("hyperliquid"),nn=Ut.includes("lighter"),Vt=[];hn&&!nn?Vt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):nn&&!hn?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 pt=await Promise.all(Vt.map(Ge=>fetch(Ge,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():it,token:nt,offset:0})}))),It=(await Promise.all(pt.map(Ge=>Ge.json()))).filter(Ge=>Ge.success&&Array.isArray(Ge.data)).flatMap(Ge=>Ge.data).sort((Ge,ct)=>new Date(ct.time)-new Date(Ge.time));d(It),g(Ge=>Ge+50),It.length<50&&N(!1),localStorage.setItem("positionFeed",JSON.stringify([])),Oe({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:[],dexMarket:[]}),L([]),W([]),ee([]),oe([])}catch(it){console.log("Error :>> ",it)}finally{o(!1),v(!1)}},rt=async()=>{var it,Ut,hn,nn,Vt;if(y)return;v(!0);const nt=window.localStorage.getItem("hyperToken");try{const pt=window.localStorage.getItem("hyperAddress");if(!nt){n(!0);return}const We={};(q==null?void 0:q.length)>0&&(We.copy_trader=q),(se==null?void 0:se.length)>0&&(We.trader=se),(ne==null?void 0:ne.length)>0&&(We.tag=ne),je!=null&&je.coinFeed&&((it=je==null?void 0:je.coinFeed)==null?void 0:it.length)>0&&(We.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(yn=>yn.trim()):je.coinFeed),((Ut=je==null?void 0:je.positionFeed)==null?void 0:Ut.length)>0&&((hn=je==null?void 0:je.positionFeed)==null?void 0:hn.length)<6&&(We.position=je.positionFeed),((nn=je==null?void 0:je.typeFeed)==null?void 0:nn.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 It=((je==null?void 0:je.dexMarket)||[]).map(yn=>yn.toLowerCase()),Ge=It.includes("hyperliquid"),ct=It.includes("lighter"),vt=[];Ge&&!ct?vt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):ct&&!Ge?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 Ht=await Promise.all(vt.map(yn=>fetch(yn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():pt,token:nt,offset:x,...Object.keys(We).length&&{filters:We}})}))),mn=(await Promise.all(Ht.map(yn=>yn.json()))).filter(yn=>yn.success&&Array.isArray(yn.data)).flatMap(yn=>yn.data).sort((yn,_n)=>new Date(_n.time)-new Date(yn.time));d(yn=>[...yn,...mn].sort((In,Sn)=>new Date(Sn.time)-new Date(In.time))),g(yn=>yn+50),mn.length<50&&N(!1);const un=mn.map(yn=>({wallet:yn.trader_wallet,name:yn.wallet_name}));Q(yn=>{const _n=new Set(yn.map(Sn=>Sn.wallet)),In=[...yn];return un.forEach(Sn=>{_n.has(Sn.wallet)||(_n.add(Sn.wallet),In.push(Sn))}),In})}catch(pt){console.log("Error :>> ",pt)}finally{v(!1)}},st=(nt,it)=>{let Ut;return function(...hn){clearTimeout(Ut),Ut=setTimeout(()=>{nt.apply(this,hn)},it)}},He=()=>{const nt=f.current;nt.scrollTop+nt.clientHeight>=nt.scrollHeight-10&&C&&!y&&rt()};h.useEffect(()=>{const nt=st(He,300),it=f.current;return it.addEventListener("scroll",nt),()=>{it.removeEventListener("scroll",nt)}},[x,C,y]);const Ve=h.useRef(null),bt=h.useRef(!1),xt=h.useRef(e),Qt=h.useRef(r),St=h.useRef(s);h.useEffect(()=>{xt.current=e},[e]),h.useEffect(()=>{Qt.current=r},[r]),h.useEffect(()=>{St.current=s},[s]);const on="hyper_get_trade_message";h.useEffect(()=>{if(!s||bt.current)return;const nt=Dy("https://dextrabothypesocketv2.nftinit.io/");return Ve.current=nt,bt.current=!0,nt.on("connect",()=>{console.log("Socket connected");const it=()=>{var nn;const Ut=(nn=xt.current)==null?void 0:nn.toLowerCase(),hn=St.current;Ut&&hn?nt.emit("subscribe",{login:Ut,token:hn}):setTimeout(it,300)};it()}),nt.on(on,function(it){var It;const Ut=$e.current,hn=(It=(Ut==null?void 0:Ut.dexMarket)||[])==null?void 0:It.map(Ge=>Ge.toLowerCase()),nn=hn.includes("hyperliquid"),Vt=hn.includes("lighter"),We=(Array.isArray(it)?it:[it]).filter(Ge=>Ge!=null&&Ge.target_platform?nn&&!Vt?Ge.target_platform==="hyper":Vt&&!nn?Ge.target_platform==="lighter":!0:!1);d(Ge=>{const ct=[...We,...Ge],vt=$e.current;return ct==null?void 0:ct.filter(Rt=>{var mn,un,yn,_n,In,Sn,Yn,Xn,zn;if(!Rt||(q==null?void 0:q.length)>0&&!(q!=null&&q.includes((mn=Rt==null?void 0:Rt.listen_user)==null?void 0:mn.toLowerCase()))||(se==null?void 0:se.length)>0&&!(se!=null&&se.includes((un=Rt==null?void 0:Rt.trader_wallet)==null?void 0:un.toLowerCase()))||(ne==null?void 0:ne.length)>0&&!(ne!=null&&ne.includes(Rt==null?void 0:Rt.tag))||((yn=vt.coinFeed)==null?void 0:yn.length)>0&&!((_n=vt.coinFeed)!=null&&_n.includes(Rt==null?void 0:Rt.coin)))return!1;if(((In=vt==null?void 0:vt.typeFeed)==null?void 0:In.length)>0){const jn=((Sn=vt==null?void 0:vt.typeFeed)==null?void 0:Sn.includes("Twaps"))&&(Rt==null?void 0:Rt.is_twap)===!0,De=(Rt==null?void 0:Rt.fill_direction_type)&&((Yn=vt==null?void 0:vt.typeFeed)==null?void 0:Yn.includes(Rt==null?void 0:Rt.fill_direction_type));if(!(jn||De))return!1}if(((Xn=vt==null?void 0:vt.positionFeed)==null?void 0:Xn.length)>0){const Kn=Vn(Rt);if(!((zn=vt==null?void 0:vt.positionFeed)!=null&&zn.includes(Kn)))return!1}else return!0;return!(vt!=null&&vt.directionFeed&&cn(Rt)!==(vt==null?void 0:vt.directionFeed))})})}),nt.io.on("reconnect_attempt",it=>{console.log("reconnect_attempt",it)}),nt.io.on("reconnect",it=>{console.log("reconnect",it),nt.emit("room",on)}),nt.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),nt.io.on("reconnect_error",it=>{console.log("reconnect_error",it)}),nt.io.on("error",it=>{console.log("error",it)}),nt.on("disconnect",()=>{console.log("Socket disconnected"),bt.current=!1}),()=>{nt.disconnect(),console.log("Socket cleanup on unmount")}},[s]);const cn=nt=>nt!=null&&nt.dir?["Sell","Close Short","Open Short"].includes(nt==null?void 0:nt.dir)?"Short":["Buy","Close Long","Open Long"].includes(nt==null?void 0:nt.dir)?"Long":(nt==null?void 0:nt.dir)||"--":"--",Vn=nt=>{var hn,nn;const it=(nn=(hn=nt.message)==null?void 0:hn.split("-")[0])==null?void 0:nn.trim();if(!it)return"Other";const Ut=/^Position Changed \(/;return it==="Close Position"?"Position Closed":it==="Position Increase"?"Increase":it==="Position Decreased"?"Decrease":Ut.test(it)?"Changed Position":it==="Open Position"?"Open Position":"Other"};function tn({date:nt}){const[it,Ut]=h.useState(Uo(nt));return h.useEffect(()=>{const hn=setInterval(()=>{Ut(Uo(nt))},1e3);return()=>clearInterval(hn)},[nt]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:it.dateTime})}const fn={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:()=>Ce(!ge),children:ge?"Hide Filters":"Show Filters"})}),i.jsx("div",{className:`${ge?"block":"hidden"} lg:block mx-auto`,children:i.jsx(ncn,{advancedFilters:je,setAdvancedFilters:Oe,getFeedData:Ye,getFeedClearData:ht,dataCoin:I,selectedCoins:$,setSelectedCoins:L,isLoadingCoin:M,setIsLoadingCoin:F,walletTagData:K,walletTags:de,searchWalletSellect:q,setSearchWalletSellect:W,walletTagLoading:ie,tradeWalletData:z,selectTradeWalletData:se,setSelectTradeWalletData:ee,searchTagSellect:ne,setSearchTagSellect:oe,isWalletLoading:l})}),i.jsx(lcn,{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(Ba,{}):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:Kl,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&&((rn=u==null?void 0:u.map)==null?void 0:rn.call(u,(nt,it)=>{var Ut,hn,nn,Vt,pt,We,It,Ge,ct,vt,Ht,Rt,mn,un,yn,_n;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=nt==null?void 0:nt.dir)!=null&&Ut.includes("Long")?(nt==null?void 0:nt.dir)==="Short > Long"?"bg-[#67ffbd]/20":(nt==null?void 0:nt.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(nt==null?void 0:nt.dir)=="Buy"?"bg-[#67ffbd]/20":"bg-[#ff797c]/20"} flex justify-center items-center w-6 h-6 rounded-full`,children:i.jsx("div",{className:"w-3 h-3 relative",children:(hn=nt==null?void 0:nt.dir)!=null&&hn.includes("Long")?(nt==null?void 0:nt.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(nt==null?void 0:nt.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(nt==null?void 0:nt.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"flex justify-center w-6",children:i.jsx("div",{className:"w-[1px] min-h-[163px] h-full border border-[#242424]"})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[6px] w-full min-w-max h-[176px] min-h-[176px] rounded-[18px] border border-[#232323]",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full px-3 py-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full relative",children:i.jsx("img",{src:Ki,alt:"",className:"w-8 h-8"})}),(nt==null?void 0:nt.target_platform)==="hyper"?i.jsxs("div",{className:"flex justify-start items-center gap-2 min-w-max",children:[i.jsx("img",{src:P1,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"})]}):(nt==null?void 0:nt.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/${nt==null?void 0:nt.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:(nt==null?void 0:nt.listen_user)&&((nn=nt==null?void 0:nt.listen_user)==null?void 0:nn.slice(0,5))+"..."+((Vt=nt==null?void 0:nt.listen_user)==null?void 0:Vt.slice(-4))}),i.jsx("img",{onClick:In=>{In.stopPropagation(),navigator.clipboard.writeText(nt==null?void 0:nt.listen_user),dn.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:_o,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:(nt==null?void 0:nt.oid)&&(nt==null?void 0:nt.oid)})]}),i.jsx("span",{onClick:In=>{In.stopPropagation(),navigator.clipboard.writeText(nt==null?void 0:nt.oid),dn.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:_o,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:()=>{Se(xe=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:xe=="time"?i.jsx(tn,{date:nt==null?void 0:nt.time}):$c(nt==null?void 0:nt.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"," ",(nt==null?void 0:nt.dir)=="Sell"?"spot sell":(nt==null?void 0:nt.dir)=="Buy"?"spot buy":(pt=nt==null?void 0:nt.dir)==null?void 0:pt.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[nt==null?void 0:nt.coin,"/",(nt==null?void 0:nt.feeToken)==null?"USDC":nt==null?void 0:nt.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${fn[nt==null?void 0:nt.coin]||((We=nt==null?void 0:nt.coin)==null?void 0:We.split("/")[0])}.svg`||za,alt:nt==null?void 0:nt.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:In=>Qi(In)})})]})]})]}),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/${fn[nt==null?void 0:nt.coin]||((It=nt==null?void 0:nt.coin)==null?void 0:It.split("/")[0])}.svg`||za,alt:nt==null?void 0:nt.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:In=>Qi(In)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[nt==null?void 0:nt.coin,"/",(nt==null?void 0:nt.feeToken)==null?"USDC":nt==null?void 0:nt.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:`${(Ge=nt==null?void 0:nt.dir)!=null&&Ge.includes("Long")?(nt==null?void 0:nt.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(nt==null?void 0:nt.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(nt==null?void 0:nt.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=nt==null?void 0:nt.dir)!=null&&ct.includes("Long")?(nt==null?void 0:nt.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(nt==null?void 0:nt.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(nt==null?void 0:nt.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:[(nt==null?void 0:nt.dir)=="Sell"?"Sell":(nt==null?void 0:nt.dir)=="Buy"?"Buy":(nt==null?void 0:nt.dir)=="Close Short"?"Short":(nt==null?void 0:nt.dir)=="Close Long"?"Long":(nt==null?void 0:nt.dir)=="Open Short"?"Short":(nt==null?void 0:nt.dir)=="Open Long"?"Long":nt!=null&&nt.dir?nt==null?void 0:nt.dir:"--",nt!=null&&nt.leverage?" - "+(nt==null?void 0:nt.leverage)+"x":""]})]})})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Type",value:nt!=null&&nt.fill_direction_type?nt!=null&&nt.is_twap?`${nt==null?void 0:nt.fill_direction_type} - Twap`:nt==null?void 0:nt.fill_direction_type:"--",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Price",value:Er(nt==null?void 0:nt.px),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Size",value:Er(nt==null?void 0:nt.sz),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Entry Price",value:nt!=null&&nt.markPrice?`$${Er(nt==null?void 0:nt.markPrice)}`:Er(nt==null?void 0:nt.markPrice),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"PnL",value:nt!=null&&nt.closedPnl?`$${Er(Math.abs(nt==null?void 0:nt.closedPnl))}`:Er(Math.abs(nt==null?void 0:nt.closedPnl)),color:`${(nt==null?void 0:nt.closedPnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Fee",value:nt!=null&&nt.fee?`$${Er(Math.abs(nt==null?void 0:nt.fee))}`:Er(Math.abs(nt==null?void 0:nt.fee)),color:"text-[#ff787b]"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Margin Mode",value:(nt==null?void 0:nt.is_cross)==null||nt!=null&&nt.is_cross?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})}),i.jsx("div",{className:`${nt!=null&&nt.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:[nt!=null&&nt.success?i.jsx("img",{src:YM,alt:""}):i.jsx("img",{src:XM,alt:""}),i.jsx("div",{className:`${nt!=null&&nt.success?"text-[#67ffbd]":"text-[#ff787b]"} text-xs font-semibold font-manrope leading-3 tracking-tight`,children:nt!=null&&nt.success?"Status:":"System Message:"}),i.jsxs("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-1",children:[nt!=null&&nt.message&&((vt=nt==null?void 0:nt.message)==null?void 0:vt.length)>100?`${(Ht=nt==null?void 0:nt.message)==null?void 0:Ht.slice(0,100)}...`:nt==null?void 0:nt.message," ","on"]}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${nt==null?void 0:nt.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:nt!=null&&nt.wallet_name?nt==null?void 0:nt.wallet_name:nt!=null&&nt.trader_wallet?((Rt=nt==null?void 0:nt.trader_wallet)==null?void 0:Rt.slice(0,5))+"..."+((mn=nt==null?void 0:nt.trader_wallet)==null?void 0:mn.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/${nt==null?void 0:nt.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:nt!=null&&nt.tag?nt==null?void 0:nt.tag:nt!=null&&nt.listen_user?((un=nt==null?void 0:nt.listen_user)==null?void 0:un.slice(0,5))+"..."+((yn=nt==null?void 0:nt.listen_user)==null?void 0:yn.slice(-4)):"--"})}),(nt==null?void 0:nt.message)&&((_n=nt==null?void 0:nt.message)==null?void 0:_n.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"})})]})})]})]})},it)}))})})]})},Tv=({title:t,value:e,color:n})=>i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1 min-w-max",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide min-w-max",children:t}),i.jsx("div",{className:"flex justify-start items-center min-w-max",children:i.jsx("div",{className:`${n} text-sm font-semibold font-manrope leading-[13px] tracking-tight min-w-max`,children:e})})]}),ucn=({isMenu:t,setIsMenu:e,handleMenuChange:n})=>{const{trackedWatchList:r,getTrackedWatchList:s,copyTradeWatchList:a,getCopyTradeWatchList:o}=h.useContext(Yr);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(pSe,{title:"My Activities",isMenu:t,setIsMenu:e,handleMenuChange:n,lengthInfo:a?a.length:0}),i.jsx(pSe,{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(ecn,{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(Kln,{})}),i.jsx("div",{className:"block lg:hidden",children:i.jsx(Xln,{})})]}):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(ccn,{})}):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."})})]})})},pSe=({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})})]}),dcn=()=>{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(Yr),f=Xl(),[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 I,P;const C=window.localStorage.getItem("hyperToken"),N=window.localStorage.getItem("hyperAddress");if(!(!C||!N))try{const M=await vi(N.toLowerCase(),C);M!=null&&M.success?(t(M==null?void 0:M.telegram_chat_id),e(M==null?void 0:M.subscriber_role),n(M==null?void 0:M.subs_expire_day),r((I=M==null?void 0:M.mushboomer_counts)==null?void 0:I.eth),s((P=M==null?void 0:M.mushboomer_counts)==null?void 0:P.sol),o(M==null?void 0:M.referral_code),l(M==null?void 0:M.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(M){console.error("Token verification error:",M),console.error(M.message||"An unknown error occurred.")}})()},[]),x?i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(ucn,{isMenu:x,setIsMenu:g,handleMenuChange:y})})})]}):null},fcn=({open:t,setOpen:e,handleEnterCode:n,inputValue:r,isEnterLoading:s})=>i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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:Ki,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]})})]})})})})})]}),hcn=({handleEnterCode:t,handleChange:e,error:n,handleGenerateCode:r,handleGenerateChange:s,generateError:a,generateData:o,userReferansCode:l,setInputValue:c,inputValue:u,setGenerateValue:d,generateValue:f,setIsMenu:x,isMenu:g,setGenerateCode:y,generateCode:v,setIsGenerateLoading:C,isGenerateLoading:N,setIsEnterLoading:I,isEnterLoading:P,divRef:M,isEnterModal:F,setIsEnterModal:$})=>{const{mushboomerETH:L,mushboomerSOL:z,isReferralCode:Q,isWhitelist:se}=h.useContext(Yr),ee=v?`https://app.dextrabot.com/referral/${v}`:"";return i.jsxs(i.Fragment,{children:[!l&&i.jsx(fcn,{open:F,setOpen:$,handleEnterCode:t,inputValue:u,isEnterLoading:P}),i.jsxs("div",{ref:M,className:"flex flex-col justify-start items-start gap-[30px] h-max relative bg-[#232323] rounded-2xl overflow-hidden pt-[18px] px-[18px] w-max mx-auto lg:mx-0",children:[i.jsx("div",{className:"text-white text-2xl font-semibold font-manrope leading-[8px]",children:"Referrals"}),i.jsxs("div",{className:"flex flex-col justify-start items-start",children:[i.jsxs("div",{className:"flex justify-start items-center w-full gap-[8px] pt-[2px]",children:[i.jsx("div",{onClick:()=>x("Enter Code"),className:`${g=="Enter Code"?"text-white":"text-[#8b8b8b]"} w-[136px] h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer`,children:"Enter Code"}),i.jsx("div",{onClick:()=>x("Create Code"),className:`${g=="Create Code"?"text-white":"text-[#8b8b8b]"} w-[136px] h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer min-w-max`,children:"Create Code"})]}),i.jsxs("div",{className:"flex justify-start items-center w-full",children:[i.jsx("div",{className:`${g=="Enter Code"?"bg-white":"bg-[#8b8b8b]"} w-[143px] h-0.5 `}),i.jsx("div",{className:`${g=="Create Code"?"bg-white":"bg-[#8b8b8b]"} w-[143px] h-0.5 `})]})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-2 w-full",children:[i.jsxs("div",{className:`${l&&g=="Enter Code"||g=="Create Code"&&v||!(se||L>0||z>0)||g=="Claim"?"hidden":""} flex justify-start items-center gap-[4px] has-tooltip relative`,children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:g=="Enter Code"?"Referral Code":"Set your Referral Code"}),i.jsx(Vs,{className:"text-[#7C7C7C]"}),i.jsx("span",{className:`${g=="Enter Code"?"ml-44":"ml-32"}`,children:i.jsx(Ma,{content:"Valid characters: '_', '-', 0-9, A-Z, 4-10 length",positionTop:!0,alignRight:!1})})]}),g=="Enter Code"?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:u,onChange:e,placeholder:"Code",className:`${u!=null&&u!=null&&u!=""?"border border-[#8d67ff]":""} ${l?"hidden":""} py-[4px] bg-[#1b1b1b] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-[286px] min-w-[286px] px-4 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[38px]`}),i.jsx("div",{className:`${!l&&n?"block":"hidden"} w-[286px] h-8 px-3 py-2 bg-[#3b2626] rounded-md justify-start items-center gap-2.5 inline-flex`,children:i.jsx("div",{className:"text-[#ff787b] text-xs font-semibold font-manrope leading-none",children:n&&n})}),P?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:jlt,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"})})}):se||L>0||z>0?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:f,onChange:s,placeholder:"Code",className:`${f!=null&&f!=null&&f!=""?"border border-[#8d67ff]":""} ${v?"hidden":""} py-[4px] bg-[#1b1b1b] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-[286px] min-w-[286px] px-4 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[38px]`,disabled:!!v}),i.jsx("div",{className:`${!v&&a?"block":"hidden"} w-[286px] h-8 px-3 py-2 bg-[#3b2626] rounded-md justify-start items-center gap-2.5 inline-flex`,children:i.jsx("div",{className:"text-[#ff787b] text-xs font-semibold font-manrope leading-none",children:a&&a})}),N?i.jsxs("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:[i.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:`${v?"block":"hidden"} w-full h-8 px-3 py-2 rounded-md justify-start items-center gap-2.5 inline-flex mt-[40px] mb-[60px]`,children:i.jsxs("div",{className:"text-white text-base font-semibold font-manrope leading-[8px] flex flex-col items-center justify-center gap-[18px] w-full",children:[i.jsx("img",{src:Alt,alt:""}),v&&`'${v}' created successfully!`]})}),i.jsx("div",{onClick:()=>{r()},className:`${v?"hidden":""} w-[286px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex mt-2 cursor-pointer`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Create Code"})})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center w-[286px] gap-4 px-4 text-white",children:[i.jsx("span",{className:"text-center mb-5 font-bold underline",children:"You need to have at least 1 Mushboomer ETH or 1 Mushboomer SOL, or have entered a referral code to be able to copy trade."}),i.jsx("div",{onClick:()=>{window.open("https://blur.io/collection/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Eth"})}),i.jsx("div",{onClick:()=>{window.open("https://www.tensor.trade/trade/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Sol"})}),i.jsx("div",{onClick:()=>{x("Enter Code")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Referral Code"})})]})]}),i.jsx("div",{className:`${v&&g=="Create Code"||l&&g=="Enter Code"||g=="Claim"?"hidden":"block"} w-[286px] h-px bg-[#3e3e3e] -mt-[14px]`}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[25px] -mt-[14px] bg-[#393939] -mx-[18px] px-4 py-4 h-full w-[328px] border-t border-dashed border-neutral-500",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[10px]",children:[i.jsx("div",{className:"text-[#cfcfcf] text-[13px] font-semibold font-manrope leading-[8px]",children:"Your Referral Code"}),i.jsxs("div",{onClick:K=>{K.preventDefault(),v&&(navigator.clipboard.writeText(v||""),dn.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:KM,alt:"",className:"text-white w-[18px] h-[18px]"}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[21px]",children:v||"You haven't created a referral code yet"})]})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[10px]",children:[i.jsx("div",{className:"text-[#cfcfcf] text-[13px] font-semibold font-manrope leading-[8px]",children:"Your Referral URL"}),i.jsxs("div",{onClick:K=>{K.preventDefault(),(v||o)&&(navigator.clipboard.writeText(v?`https://app.dextrabot.com/referral/${v}`:o&&o),dn.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:KM,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?ee.slice(0,36)+"...":o?o.slice(0,30)+"...":i.jsx("span",{className:"text-white",children:"-"})})]})]})]})]})]})},IC=({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(fz,{sortKey:e,state:n,className:""})]})})};function pcn({open:t,setOpen:e}){return i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:mae,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 de,G,ie,ae;const{isConnected:d,address:f}=es(),{setSignModalOpen:x,hyperToken:g}=h.useContext(Yr),[y,v]=h.useState(!1),[C,N]=h.useState(!1),[I,P]=h.useState(!1),M=h.useMemo(()=>{var W;const q=new Map;return(W=t==null?void 0:t.claim_lists)==null||W.forEach(ne=>{var he;const oe=((he=ne==null?void 0:ne.subscriber_address)==null?void 0:he.toLowerCase())||"";if(!q.has(oe))q.set(oe,{...ne,total_ref_claimable:parseFloat(ne==null?void 0:ne.total_ref_claimable)||0});else{const _e=q.get(oe);q.set(oe,{..._e,total_ref_claimable:(_e==null?void 0:_e.total_ref_claimable)+(parseFloat(ne==null?void 0:ne.total_ref_claimable)||0)})}}),Array.from(q.values())},[t]),F="-total_ref_claimable",[$,L]=h.useState(F),z=q=>M==null?void 0:M.sort((W,ne)=>{const oe=W.subscriber_address?W.subscriber_address.toLowerCase():"",he=ne.subscriber_address?ne.subscriber_address.toLowerCase():"";return q==="-level"?ne.level-W.level:q==="level"?W.level-ne.level:q==="-subscriber_address"?oe<he?-1:oe>he?1:0:q==="subscriber_address"?oe>he?-1:oe<he?1:0:q==="-total_ref_claimable"?ne.total_ref_claimable-W.total_ref_claimable:q==="total_ref_claimable"?W.total_ref_claimable-ne.total_ref_claimable:q==="-last_active_date"?new Date(ne.last_active_date)-new Date(W.last_active_date):q==="last_active_date"?new Date(W.last_active_date)-new Date(ne.last_active_date):0}),Q="-created_at",[se,ee]=h.useState(Q),K=q=>{var W;return(W=a.claim_lists)==null?void 0:W.sort((ne,oe)=>{const he=ne.address?ne.address.toLowerCase():"",_e=oe.address?oe.address.toLowerCase():"";return q==="-level"?oe.level-ne.level:q==="level"?ne.level-oe.level:q==="-address"?he<_e?-1:he>_e?1:0:q==="address"?he>_e?-1:he<_e?1:0:q==="-created_at"?new Date(oe.created_at)-new Date(ne.created_at):q==="created_at"?new Date(ne.created_at)-new Date(oe.created_at):0})},re=async()=>{try{v(!0);const q=window.localStorage.getItem("hyperToken"),W="https://dextrabothypev2.nftinit.io/api/subscriber/claim/request/";if(!q){x(!0),v(!1);return}const ne=window.localStorage.getItem("hyperAddress"),he=await(await fetch(W,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():ne,token:q})})).json();he.success?(s(),P(!0)):(console.log(he.error_message),N(he.error_message),dn.error(he.error_message))}catch(q){console.error("Error in like function:",q),N(q.message||"An unknown error occurred.")}finally{v(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(pcn,{open:I,setOpen:P}),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?`$${Er(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?`$${Er(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?`$${Er(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?`$${Er(t==null?void 0:t.total_claimable_fee)}`:"--"})]}),i.jsx("div",{onClick:q=>{q.preventDefault(),g?y||((t==null?void 0:t.total_claimable_fee)<50?dn.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&&re()):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(IC,{title:"Referred Wallet",sortKey:"subscriber_address",sortOption:$,setSortOption:L,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(IC,{title:"Level",sortKey:"level",sortOption:$,setSortOption:L,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 min-w-[110px] sm:min-w-[110px] rounded-tr-2xl pl-1 pr-4",children:i.jsx(IC,{title:"Earnings",sortKey:"total_ref_claimable",sortOption:$,setSortOption:L,isFilterIcon:!1})})]})}),i.jsx("tbody",{children:!t||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[45%] w-max",children:i.jsx(Ba,{})})})}):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(_l,{})})})}):(t==null?void 0:t.length)==0||((de=t==null?void 0:t.claim_lists)==null?void 0:de.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:Kl,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=z($))==null?void 0:G.map((q,W)=>i.jsxs("tr",{className:`${W%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${W%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(na,{info1:`${(q==null?void 0:q.subscriber_address).slice(0,5)+"..."+(q==null?void 0:q.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:q!=null&&q.level?`L${q==null?void 0:q.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:q!=null&&q.total_ref_claimable?`$${Er(q==null?void 0:q.total_ref_claimable)}`:"--"})})})]},W))})]}):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(IC,{title:"Referred Wallet",sortKey:"address",sortOption:se,setSortOption:ee,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(IC,{title:"Level",sortKey:"level",sortOption:se,setSortOption:ee,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(IC,{title:"Join Date",sortKey:"created_at",sortOption:se,setSortOption:ee,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(Ba,{})})})}):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(_l,{})})})}):(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:Kl,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No referral yet."}),i.jsxs("div",{className:"flex flex-col items-center justify-start text-center -mt-1",children:[i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"Share your referral link and watch your referrals appear"}),i.jsx("br",{}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide -mt-5",children:[" ","here as users start trading."]})]})]})]})})})})}):(ae=K(se))==null?void 0:ae.map((q,W)=>i.jsxs("tr",{className:`${W%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${W%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(na,{info1:`${(q==null?void 0:q.address).slice(0,5)+"..."+(q==null?void 0:q.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:q!=null&&q.level?`L${q==null?void 0:q.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:q!=null&&q.created_at?sht(q==null?void 0:q.created_at):"--"})})})]},W))})]})})]})]})},xcn=({open:t,setOpen:e})=>i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:k_e,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"})})})]})]})})})})})]}),gcn=()=>{const{isConnected:t,address:e}=es(),{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(Yr),[y,v]=h.useState("Enter Code"),[C,N]=h.useState("Earnings"),I=g2(),P=(I==null?void 0:I.code)||"",[M,F]=h.useState(""),[$,L]=h.useState(""),[z,Q]=h.useState(null),[se,ee]=h.useState(""),[K,re]=h.useState(""),[de,G]=h.useState(""),[ie,ae]=h.useState(""),[q,W]=h.useState(!1),[ne,oe]=h.useState(!1),[he,_e]=h.useState([]),[xe,Se]=h.useState(!1),[ge,Ce]=h.useState(!1),[je,Oe]=h.useState(!1),[$e,Ye]=h.useState([]),[Je,ht]=h.useState(!1),[rt,st]=h.useState(!1),[He,Ve]=h.useState(!1),bt=h.useRef(null),[xt,Qt]=h.useState(0);h.useEffect(()=>{P&&(F(P),Oe(!0))},[P]);const St=Ut=>{let hn=Ut.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(hn)&&(F(hn),L(""))},on=Ut=>{let hn=Ut.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(hn)&&(ee(hn),re(""))},cn=async()=>{var Ut,hn;try{const nn=window.localStorage.getItem("hyperToken"),Vt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/info/";if(!nn){n(!0);return}const pt=window.localStorage.getItem("hyperAddress"),It=await(await fetch(Vt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():pt,token:nn})})).json();It.success?(Q((Ut=It==null?void 0:It.data)==null?void 0:Ut.referrer_code),ae((hn=It==null?void 0:It.data)==null?void 0:hn.my_refcode)):console.log(It.error_message)}catch(nn){console.error("Error referans request:",nn)}};h.useEffect(()=>{cn(),nt(),it()},[r]);const Vn=async Ut=>{try{W(!0);const hn=window.localStorage.getItem("hyperToken"),nn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/set/";hn||(n(!0),W(!1));const Vt=window.localStorage.getItem("hyperAddress"),We=await(await fetch(nn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:hn,refcode:Ut})})).json();We.success?(Q(Ut),W(!1),Oe(!1),dn.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&&Ve(!0)):(console.log(We.error_message),L(We.error_message),je&&dn.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"}}),W(!1))}catch(hn){console.error("Error in like function:",hn),L(hn.message),je&&dn.error(hn.message),W(!1)}},tn=async Ut=>{try{oe(!0);const hn=window.localStorage.getItem("hyperToken"),nn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/generate/";hn||(n(!0),oe(!1));const Vt=window.localStorage.getItem("hyperAddress"),We=await(await fetch(nn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Vt,token:hn,refcode:Ut})})).json();We.success?(G(`https://app.dextrabot.com/referral/${We==null?void 0:We.refcode}`),ae(We==null?void 0:We.refcode),oe(!1)):(console.log(We.error_message),oe(!1),re(We.error_message))}catch(hn){console.error("Error in like function:",hn),re(hn.message),oe(!1)}},fn=()=>{M.length<4?(L("You must enter at least 4 characters!"),je&&dn.error("This refcode is wrong")):(L(""),Vn(M))},rn=()=>{se.length<4?re(ie?"You have a generated code, you cannot generate it again.":"You must enter at least 4 characters!"):(re(""),tn(se))};h.useEffect(()=>{(async()=>{var Vt,pt;const hn=window.localStorage.getItem("hyperToken"),nn=window.localStorage.getItem("hyperAddress");if(!(!hn||!nn))try{const We=await vi(nn.toLowerCase(),hn);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((pt=We==null?void 0:We.mushboomer_counts)==null?void 0:pt.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.")}})()},[z]);const nt=async()=>{try{Se(!0);const Ut=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/claims/";if(!Ut){n(!0),Se(!1);return}const nn=window.localStorage.getItem("hyperAddress"),pt=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():nn,token:Ut})})).json();pt.success?(_e(pt==null?void 0:pt.data),Se(!1)):(console.log(pt.error_message),Ce(pt.error_message),Se(!1))}catch(Ut){console.error("Error in like function:",Ut),Ce(Ut.message),Se(!1)}},it=async()=>{try{ht(!0);const Ut=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/usage/";if(!Ut){n(!0),ht(!1);return}const nn=window.localStorage.getItem("hyperAddress"),pt=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():nn,token:Ut})})).json();pt.success?(Ye(pt==null?void 0:pt.data),ht(!1)):(console.log(pt.error_message),st(pt.error_message),ht(!1))}catch(Ut){console.error("Error in like function:",Ut),st(Ut.message),ht(!1)}};return h.useEffect(()=>{const Ut=()=>{bt.current&&Qt(bt.current.clientHeight)},hn=new ResizeObserver(Ut);return bt.current&&hn.observe(bt.current),()=>{hn.disconnect()}},[]),i.jsxs(i.Fragment,{children:[i.jsx(xcn,{open:He,setOpen:Ve}),i.jsx(Ga,{children:i.jsxs(no,{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(hcn,{handleEnterCode:fn,handleChange:St,error:$,handleGenerateCode:rn,handleGenerateChange:on,generateError:K,generateData:de,userReferansCode:z,setInputValue:F,setGenerateValue:ee,inputValue:M,generateValue:se,setIsMenu:v,isMenu:y,setGenerateCode:ae,generateCode:ie,setIsGenerateLoading:oe,isGenerateLoading:ne,setIsEnterLoading:W,isEnterLoading:q,divRef:bt,isEnterModal:je,setIsEnterModal:Oe}),i.jsx(mcn,{data:he,dataLoading:xe,dataError:ge,height:xt,handleRefTable:nt,dataUsage:$e,dataUsageLoading:Je,dataUsageError:rt,setIsOnTableTab:N,isOnTableTab:C})]}),i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 bg-[#232323] rounded-2xl mb-10 p-4",children:[i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/refferal","_blank"),className:"flex justify-center items-center w-max gap-1.5 rounded-[10px] cursor-pointer",children:[i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-[18px] tracking-tight w-full sm:max-w-[500px] mb-2",children:"See the full Referral System with Bonuses Details"}),i.jsx("img",{src:jm,alt:"Dextrabot - Referral",className:"w-3 h-3 mb-2"})]}),i.jsx("img",{src:Nlt,alt:"",className:"text-center text-xs w-[900px] h-max sm:h-[450px] mb-10 lg:mb-0"})]})]})})})]})};function bde({open:t,setOpen:e,data:n,walletData:r,withdrawableUsdc:s,setWithdrawableUsdc:a,modalWalletId:o,setModalWalletId:l}){const{setSignModalOpen:c}=h.useContext(Yr),{isConnected:u,address:d}=es(),[f,x]=h.useState(""),[g,y]=h.useState(!1),[v,C]=h.useState("");h.useEffect(()=>{const P=n.find(M=>M.wallet_address===r);P&&a(P==null?void 0:P.withdrawableUsdc)},[n]);const N=async()=>{var P,M,F,$,L,z;try{y(!0);const Q=window.localStorage.getItem("hyperToken"),se="https://dextrabothypev2.nftinit.io/api/wallet/request-withdraw";Q||(c(!0),y(!1)),C("");const ee=window.localStorage.getItem("hyperAddress"),re=await(await fetch(se,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():ee,token:Q,wallet_id:o??null,amount:f??0,destination:d?d.toLowerCase():ee})})).json();re.success?(((M=(P=re==null?void 0:re.result)==null?void 0:P.result)==null?void 0:M.status)=="err"?(y(!1),C(($=(F=re==null?void 0:re.result)==null?void 0:F.result)==null?void 0:$.response)):((z=(L=re==null?void 0:re.result)==null?void 0:L.result)==null?void 0:z.status)=="ok"&&(y(!1),x(""),dn.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(re.error_message),y(!1),C("The transaction failed, please try again."))}catch(Q){console.error("Error widthdraw amount:",Q),y(!1),C(Q.message)}},I=P=>{x(P.target.value)};return i.jsx(i.Fragment,{children:i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[440px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),x(""),a(null),C("")},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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:P=>{P.stopPropagation(),navigator.clipboard.writeText(d),dn.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:_o,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:P=>{let M=P.target.value;M.includes("-")?M=M.replace("-",""):(M===""||parseFloat(M)>=0)&&I({...P,target:{...P.target,value:M}})},type:"number",name:"widthdrawAmount",placeholder:"Amount",min:0,max:s,className:`shadow-sm py-0.5 bg-[#303030] block sm:text-sm font-semibold font-manrope leading-none rounded-md w-36 min-w-36 pl-2 pr-7 ${f!=null&&f!==""?"border border-[#C5C5C5]":""} outline-[#404040] placeholder:text-[#7F7F7F] h-8 w-[305px]`}),i.jsx("p",{className:`${f!=null&&f!==""?"text-white":"text-[#7F7F7F]"} absolute right-1.5 top-1`,children:"$"})]}),i.jsx("button",{onClick:()=>x(s),className:"bg-[#505050] text-white text-xs px-[11px] py-0.5 rounded-md cursor-pointer hover:bg-[#606060] h-8 focus:outline-none focus:ring-0 border-none",children:"Max"})]}),i.jsx("span",{className:"text-white",children:s!=0&&!isNaN(s)?`$${Er(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:P=>{P.preventDefault(),f!=null&&f!==""?g||N():dn.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 yde({open:t,setOpen:e,walletAddress:n}){return i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2.5",children:[i.jsx("div",{className:"pt-4",children:i.jsx(Oie,{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),dn.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:_o,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 vde=({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(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[490px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),a(!1),l(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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"})})]})]})})})})})]})})},wde=({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:M3(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:["$",Er(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:["$",Er(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:["$",Er(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:["$",Er(t.withdrawableUsdc)??0]})]})]}):null,bcn=({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(Yr),{isConnected:u,address:d}=es(),f=5,[x,g]=h.useState(null),[y,v]=h.useState(null),[C,N]=h.useState(!1),[I,P]=h.useState(null),[M,F]=h.useState(!1),[$,L]=h.useState("");h.useState({});const[z,Q]=h.useState({}),[se,ee]=h.useState(!1),[K,re]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[de,G]=h.useState(!1),[ie,ae]=h.useState(!1),q="-perpEquity",[W,ne]=h.useState(q),oe=Ve=>t.sort((bt,xt)=>{if(bt.version===3&&xt.version!==3)return-1;if(xt.version===3&&bt.version!==3)return 1;const Qt=bt.wallet_name?bt.wallet_name.toUpperCase():"",St=xt.wallet_name?xt.wallet_name.toUpperCase():"",on=bt.wallet_address?bt.wallet_address.toLowerCase():"",cn=xt.wallet_address?xt.wallet_address.toLowerCase():"";return Ve==="wallet_name"?Qt<St?-1:Qt>St?1:0:Ve==="-wallet_name"?Qt>St?-1:Qt<St?1:0:Ve==="-wallet_address"?on<cn?-1:on>cn?1:0:Ve==="wallet_address"?on>cn?-1:on<cn?1:0:Ve==="-wallet_created_data"?new Date(xt.wallet_created_data)-new Date(bt.wallet_created_data):Ve==="wallet_created_data"?new Date(bt.wallet_created_data)-new Date(xt.wallet_created_data):Ve==="-perpEquity"?xt.perpEquity-bt.perpEquity:Ve==="perpEquity"?bt.perpEquity-xt.perpEquity:Ve==="-unrealizedPnl"?xt.unrealizedPnl-bt.unrealizedPnl:Ve==="unrealizedPnl"?bt.unrealizedPnl-xt.unrealizedPnl:Ve==="-marginUsed"?xt.marginUsed-bt.marginUsed:Ve==="marginUsed"?bt.marginUsed-xt.marginUsed:Ve==="-withdrawableUsdc"?xt.withdrawableUsdc-bt.withdrawableUsdc:Ve==="withdrawableUsdc"?bt.withdrawableUsdc-xt.withdrawableUsdc:0}),he=async(Ve,bt,xt)=>{if(!Ve||!bt||!xt){console.error("Delete order called with invalid parameters"),dn.error("Delete order called with invalid parameters");return}const Qt=`${Ve}_${bt}`;try{Q(fn=>({...fn,[Qt]:!0}));const St=window.localStorage.getItem("hyperToken"),on="https://dextrabothypev2.nftinit.io/api/wallet/delete";if(!St){c(!0),Q(fn=>({...fn,[Qt]:!1}));return}const cn=window.localStorage.getItem("hyperAddress"),Vn=await fetch(on,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():cn,token:St,wallet_id:Ve.toString()})});if(!Vn.ok)throw new _l(`Server responded with status ${Vn.status}`);const tn=await Vn.json();tn.success?(l(),re({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),G(!1),ae(!1),ee(!1),Q(fn=>({...fn,[Qt]:!1})),dn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:xt.slice(0,5)+"..."+xt.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(tn.error_message),dn.error(tn.error_message),Q(fn=>({...fn,[Qt]:!1})))}catch(St){console.error("Error deleting wallet:",St),dn.error(St.message),Q(on=>({...on,[Qt]:!1}))}},_e=h.useRef(null),xe=()=>{_e.current&&(_e.current.scrollLeft-=100)},Se=()=>{_e.current&&(_e.current.scrollLeft+=100)},ge=()=>{_e.current&&(_e.current.scrollTop+=200)},Ce=()=>{_e.current&&(_e.current.scrollTop-=200)},je=Ve=>Ve>=640&&Ve<1024?4:Ve>=1024&&Ve<1240?7:Ve>=1240&&Ve<1540||Ve>=1540?8:3,[Oe,$e]=h.useState(null),[Ye,Je]=h.useState(!1),[ht,rt]=h.useState(!1);h.useEffect(()=>{const Ve=()=>{rt(window.innerWidth<640)};return window.addEventListener("resize",Ve),Ve(),()=>window.removeEventListener("resize",Ve)},[]);const st=Ve=>{ht&&($e(Ve),Je(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(bde,{open:C,setOpen:N,data:t,walletData:x,withdrawableUsdc:I,setWithdrawableUsdc:P,modalWalletId:y,setModalWalletId:v}),i.jsx(yde,{open:M,setOpen:F,walletAddress:$}),i.jsx(vde,{open:se,setOpen:ee,handleDeleteWallet:he,deleteWalleInfo:K,confirmClosePositions:de,setConfirmClosePositions:G,confirmWithdrawEquity:ie,setConfirmWithdrawEquity:ae}),i.jsx(yp,{isOpen:Ye,onClose:()=>Je(!1),children:i.jsx(wde,{rowData:Oe})}),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:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{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(eo,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:Ce,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),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(eo,{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:_e,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:W,setSortOption:ne,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:W,setSortOption:ne,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:W,setSortOption:ne,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:W,setSortOption:ne,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:W,setSortOption:ne,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:W,setSortOption:ne,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:W,setSortOption:ne,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(Ba,{})})})}):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(_l,{})})})}):(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:Kl,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=oe(W))==null?void 0:He.map((Ve,bt)=>{const xt=!isNaN(Ve==null?void 0:Ve.perpEquity)&&!isNaN(Ve==null?void 0:Ve.marginUsed)?(Ve==null?void 0:Ve.perpEquity)-(Ve==null?void 0:Ve.marginUsed):0,Qt=ht?{onClick:()=>st(Ve),className:"cursor-pointer"}:{};return i.jsxs("tr",{...Qt,className:`${bt%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${bt%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:(Ve==null?void 0:Ve.version)==3?i.jsx(Us,{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:(Ve==null?void 0:Ve.wallet_name.length)>=12?(Ve==null?void 0:Ve.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(Ve==null?void 0:Ve.wallet_name)+"(API-AGENT) Wallet"}),(Ve==null?void 0:Ve.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Ve==null?void 0:Ve.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(Vs,{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:(Ve==null?void 0:Ve.wallet_name.length)>=12?(Ve==null?void 0:Ve.wallet_name).slice(0,12)+"...":Ve==null?void 0:Ve.wallet_name}),(Ve==null?void 0:Ve.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Ve==null?void 0:Ve.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${bt%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/${Ve==null?void 0:Ve.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:Ki,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(na,{info1:`${(Ve==null?void 0:Ve.wallet_address).slice(0,5)+"..."+(Ve==null?void 0:Ve.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:St=>{St.stopPropagation(),navigator.clipboard.writeText(Ve==null?void 0:Ve.wallet_address),dn.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:_o,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:(Ve==null?void 0:Ve.wallet_created_data)&&M3(Ve==null?void 0:Ve.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...":(Ve==null?void 0:Ve.perpEquity)!=0&&!isNaN(Ve==null?void 0:Ve.perpEquity)?`$${Er(Ve==null?void 0:Ve.perpEquity)}`:"$0"})})}),i.jsx("td",{children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${(Ve==null?void 0:Ve.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..."}):(Ve==null?void 0:Ve.unrealizedPnl)!=0&&!isNaN(Ve==null?void 0:Ve.unrealizedPnl)?`$${Er(Math.abs(Ve==null?void 0:Ve.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..."}):(Ve==null?void 0:Ve.marginUsed)!=0&&!isNaN(Ve==null?void 0:Ve.marginUsed)?`$${Er(Ve==null?void 0:Ve.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&&xt<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(xt)?"$0":`$${Er(Math.abs(xt))}`})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 pr-3",children:[(Ve==null?void 0:Ve.version)===3?i.jsx(Us,{content:"Deposits are not available for API wallets. Please fund your login wallet on Hyperliquid to start trading.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}):i.jsxs("div",{onClick:()=>{F(!0),L(Ve==null?void 0:Ve.wallet_address)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Deposit"})]}),(Ve==null?void 0:Ve.version)===3?i.jsx(Us,{content:"Withdrawals cannot be made with API wallets. Use your login wallet on Hyperliquid for withdrawals.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}):i.jsxs("div",{onClick:()=>{P(Ve==null?void 0:Ve.withdrawableUsdc),N(!0),g(Ve==null?void 0:Ve.wallet_address),v(Ve==null?void 0:Ve.wallet_id)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Withdraw"})]}),z[`${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..."})]}):(Ve==null?void 0:Ve.version)===3?i.jsx(Us,{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:()=>{re({wallet:Ve==null?void 0:Ve.wallet_address,walletId:Ve==null?void 0:Ve.wallet_id,walletName:Ve==null?void 0:Ve.wallet_name.toLowerCase(),unrealizedPnL:Ve==null?void 0:Ve.unrealizedPnl,perpEquity:Ve==null?void 0:Ve.perpEquity}),ee(!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"})})]})})]},bt)})})]})})]}),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 BVe({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 V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),g=document.createElement("a");g.href=x,g.download="dextrabot.png",document.body.appendChild(g),g.click(),document.body.removeChild(g),dn.success("PNG successfully downloaded!")}catch(x){console.error("Error generating PNG:",x),dn.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 N=new FileReader;N.onloadend=()=>v(N.result),N.onerror=C,N.readAsDataURL(y)})}catch(g){throw console.error("Image conversion failed:",g),g}finally{d(!1)}};return 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(za))},[n==null?void 0:n.coin]),i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(!1),setTimeout(()=>{s(x=>({...x,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,pnl:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:Wj,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||za,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:x=>Qi(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?"+":"-",fo(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?`$${fo(Math.abs(n==null?void 0:n.pnl))}`:fo(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?`$${jy(n==null?void 0:n.entryPrice)}`:jy(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?`$${jy(n==null?void 0:n.markPrice)}`:jy(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:Hj,alt:"",className:"h-full"}):i.jsx("img",{src:Vj,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"),dn.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 ycn=({data:t})=>{const{isConnected:e,address:n}=es(),{setSignModalOpen:r,hyperToken:s,isReferralCodeName:a}=h.useContext(Yr),[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,N]=h.useState(!1),[I,P]=h.useState(!1),[M,F]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),$="-unrealizedPnl",[L,z]=h.useState($),[Q,se]=h.useState([]),[ee,K]=h.useState(!1);h.useEffect(()=>{if(t.length===0||ee)return;const he=t.reduce((_e,xe)=>parseFloat(xe.perpEquity||0)>parseFloat(_e.perpEquity||0)?xe:_e);he.wallet_address&&l(he.wallet_address)},[t,ee]);const re=(he,_e,xe)=>{const Se=he==null?void 0:he.filter(ge=>ge&&ge.walletAddress&&ge.asset).filter(ge=>{var Ce,je;return xe?(je=(Ce=ge==null?void 0:ge.asset)==null?void 0:Ce.toString())==null?void 0:je.toUpperCase().includes(xe.toUpperCase()):!0});return Se==null?void 0:Se.sort((ge,Ce)=>{const je=ge.wallet_name?ge.wallet_name.toUpperCase():"",Oe=Ce.wallet_name?Ce.wallet_name.toUpperCase():"",$e=ge.tag?ge.tag.toUpperCase():"",Ye=Ce.tag?Ce.tag.toUpperCase():"",Je=ge.asset?ge.asset.toUpperCase():"",ht=Ce.asset?Ce.asset.toUpperCase():"",rt=ge.type==="Long"?1:0,st=Ce.type==="Long"?1:0,He=ge.type==="Short"?1:0,Ve=Ce.type==="Short"?1:0;return _e==="wallet_name"?je<Oe?-1:je>Oe?1:0:_e==="-wallet_name"?je>Oe?-1:je<Oe?1:0:_e==="-unrealizedPnl"?Ce.unrealizedPnl-ge.unrealizedPnl:_e==="unrealizedPnl"?ge.unrealizedPnl-Ce.unrealizedPnl:_e==="-roe"?Ce.roe-ge.roe:_e==="roe"?ge.roe-Ce.roe:_e==="-size"?Ce.size-ge.size:_e==="size"?ge.size-Ce.size:_e==="-entryPrice"?Ce.entryPrice-ge.entryPrice:_e==="entryPrice"?ge.entryPrice-Ce.entryPrice:_e==="-currentPrice"?Ce.currentPrice-ge.currentPrice:_e==="currentPrice"?ge.currentPrice-Ce.currentPrice:_e==="-leverage"?Ce.leverage-ge.leverage:_e==="leverage"?ge.leverage-Ce.leverage:_e==="-positionValue"?Ce.positionValue-ge.positionValue:_e==="positionValue"?ge.positionValue-Ce.positionValue:_e==="-marginUsed"?Ce.marginUsed-ge.marginUsed:_e==="marginUsed"?ge.marginUsed-Ce.marginUsed:_e==="funding"?Ce.funding-ge.funding:_e==="-funding"?ge.funding-Ce.funding:_e==="-liquidationPrice"?Ce.liquidationPrice-ge.liquidationPrice:_e==="liquidationPrice"?ge.liquidationPrice-Ce.liquidationPrice:_e==="-tag"?$e<Ye?-1:$e>Ye?1:0:_e==="tag"?$e>Ye?-1:$e<Ye?1:0:_e==="-coin"?Je<ht?-1:Je>ht?1:0:_e==="coin"?Je>ht?-1:Je<ht?1:0:_e==="-type_leverage"?rt!==st?st-rt:Ce.leverage-ge.leverage:_e==="type_leverage"?He!==Ve?Ve-He:Ce.leverage-ge.leverage:0})},de=async he=>{if(he===""&&Q.filter(_e=>_e!==void 0).length===0||he===""&&re(Q,L,d).length===0||re(Q,L,d).length===0){dn.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(he===""&&(t==null?void 0:t.length)>0){const _e=re(Q,L,d),xe=[...new Set(_e.map(Se=>Se.wallet_id))];if(xe.length===0){dn.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(xe.map(ge=>G(ge,!1))),dn.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(Se){console.error("Error closing all orders:",Se)}finally{u(!1)}return}await G(he)},G=async(he,_e=!0)=>{if(Q.filter(xe=>xe!==void 0).length===0){dn.success("There are no open positions to closes.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(!he){console.error("Close order called with invalid parameters"),dn.error("Close order called with invalid parameters");return}try{u(!0);const xe=window.localStorage.getItem("hyperToken"),Se="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!xe){r(!0),u(!1);return}const ge=window.localStorage.getItem("hyperAddress"),Ce=await fetch(Se,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():ge,token:xe,wallet_id:he.toString()})});if(!Ce.ok)throw new Error(`Server responded with status ${Ce.status}`);const je=await Ce.json();je.status=="ok"?(u(!1),_e&&dn.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),_e&&dn.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."),dn.error("Close order operation failed."),u(!1))}catch(xe){throw console.error("Something went wrong!"),dn.error("Something went wrong!"),u(!1),xe}},[ie,ae]=h.useState(!1);h.useEffect(()=>{const he=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&ae(!0)};he();const _e=setInterval(()=>{he()},1e3*60*30);return()=>{clearInterval(_e)}},[]);const q=async he=>{try{const _e=window.localStorage.getItem("hyperToken"),xe="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!_e){r(!0);return}const Se=he==null?void 0:he.filter(Oe=>Oe&&Oe.walletAddress&&Oe.asset).map(Oe=>({wallet:Oe.walletAddress,coin:Oe.asset})),ge=window.localStorage.getItem("hyperAddress"),je=await(await fetch(xe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():ge,token:_e,positions:Se})})).json();je.success?se(Oe=>Oe.map($e=>{const Ye=je==null?void 0:je.data.find(Je=>(Je==null?void 0:Je.wallet)===($e==null?void 0:$e.walletAddress)&&(Je==null?void 0:Je.coin)===($e==null?void 0:$e.asset));return{...$e,tag:Ye==null?void 0:Ye.tag,tagWallet:Ye==null?void 0:Ye.cp_wallet}})):(console.log(je.error_message),dn.error(je.error_message))}catch(_e){console.error("Error tag request",_e),dn.error(_e.message)}},W=h.useRef(Q==null?void 0:Q.filter(he=>(he==null?void 0:he.walletAddress)&&(he==null?void 0:he.asset)).length),ne=h.useRef(),oe=h.useRef(!0);return h.useEffect(()=>{const he=Q==null?void 0:Q.filter(xe=>xe!==void 0&&(xe==null?void 0:xe.walletAddress)&&(xe==null?void 0:xe.asset)),_e=he==null?void 0:he.length;if(_e>0&&_e>W.current){const xe=o===""?Q:Q.filter(Se=>(Se==null?void 0:Se.wallet_id)==o);oe.current?(q(xe),oe.current=!1):(ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{q(xe)},5e3))}W.current=_e},[Q]),h.useEffect(()=>{if((Q==null?void 0:Q.filter(he=>he!==void 0&&(he==null?void 0:he.walletAddress)&&(he==null?void 0:he.asset)).length)>0){const he=o==""?Q:Q==null?void 0:Q.filter(_e=>(_e==null?void 0:_e.wallet_id)==o);(he==null?void 0:he.length)>0&&q(he)}},[o]),h.useEffect(()=>{function he(_e){y.current&&!y.current.contains(_e.target)&&setIsDropdownOpen(!1),v.current&&!v.current.contains(_e.target)&&g(!1)}return document.addEventListener("mousedown",he),()=>document.removeEventListener("mousedown",he)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(BVe,{open:C,setOpen:N,data:M,setShare:P,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:he=>{he.preventDefault(),c||de(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:xae,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:he=>{l(he.target.value),K(!0)},value:o,children:[i.jsx("option",{value:"",children:"All"}),t==null?void 0:t.map(he=>i.jsx("option",{value:he==null?void 0:he.wallet_address,children:`${he==null?void 0:he.wallet_name} - (${(he==null?void 0:he.wallet_address.slice(0,5))+"..."+(he==null?void 0:he.wallet_address.slice(-4))})`},he==null?void 0:he.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:he=>{he.stopPropagation(),localStorage.setItem("walletManagementInfo",`${Date.now()}`),ae(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute -top-0.5 -right-1.5 w-7 h-7 rounded-full p-0.5 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("img",{src:Elt,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(RVe,{initialAddress:o,wallets:o===""?t:void 0})})]})]})]})})},vcn=({initialAddress:t="",wallets:e,positions:n,setPositions:r,isWalletIndex:s,posLoading:a,setPosLoading:o,setGenerateWalletData:l})=>{var nt;const{getTrackedWatchList:c,hyperToken:u,copyTradeWatchList:d,getCopyTradeWatchList:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setMushboomerSOL:C,setIsReferralCode:N,isReferralCodeName:I,setIsReferralCodeName:P,setIsWhitelist:M,setHyperToken:F,setHyperAddress:$,setSignModalOpen:L,latestPnL:z}=h.useContext(Yr),{address:Q}=es(),[se,ee]=h.useState(!1);h.useState({}),h.useState(!1),h.useEffect(()=>{if(!(s!=null&&s.index))return;const it=new WebSocket("wss://mainnet.zklighter.elliot.ai/stream");let Ut;it.onopen=()=>{console.log("Lighter WebSocket connected"),it.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`})),Ut=setInterval(()=>{it.readyState===WebSocket.OPEN&&it.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`}))},5e3)},it.onmessage=nn=>{const Vt=JSON.parse(nn==null?void 0:nn.data);if(Vt!=null&&Vt.positions&&Object.keys(Vt.positions).length>0){const pt=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=pt.reduce((ct,vt)=>ct+vt.unrealizedPnl,0),It=pt.reduce((ct,vt)=>{const Ht=vt.leverage>0?vt.leverage:1,Rt=vt.positionValue/Ht;return ct+(isFinite(Rt)?Rt:0)},0),Ge=Number(Vt.available_balance??0);l(ct=>ct==null?void 0:ct.map(vt=>{var Ht;return((Ht=vt.wallet_address)==null?void 0:Ht.toLowerCase())===(t==null?void 0:t.toLowerCase())?{...vt,unrealizedPnl:We.toFixed(6),withdrawableUsdc:Ge.toFixed(6),marginUsed:It.toFixed(6),positions:pt}:vt})),r(pt),(xe==null?void 0:xe.length)>0&&o(!1)}else r([]),a&&o(!1)},it.onclose=nn=>{console.log("🔌 ZkLighter WebSocket disconnected",nn.code,nn.reason),clearInterval(Ut)},it.onerror=nn=>{console.error("❌ ZkLighter WS error:",nn),clearInterval(Ut)};const hn=()=>{it.readyState===WebSocket.OPEN&&it.send(JSON.stringify({type:"unsubscribe",channel:`account_all/${s.index}`})),clearInterval(Ut),it.close()};return window.addEventListener("beforeunload",hn),()=>{hn(),window.removeEventListener("beforeunload",hn)}},[s]);const K=h.useRef(null),re=()=>{K.current&&(K.current.scrollLeft-=200)},de=()=>{K.current&&(K.current.scrollLeft+=200)},G=()=>{K.current&&(K.current.scrollTop+=200)},ie=()=>{K.current&&(K.current.scrollTop-=200)};h.useEffect(()=>{(async()=>{var nn,Vt;const Ut=window.localStorage.getItem("hyperToken"),hn=window.localStorage.getItem("hyperAddress");if(!(!Ut||!hn))try{const pt=await vi(hn.toLowerCase(),Ut);pt!=null&&pt.success?(x(pt==null?void 0:pt.telegram_chat_id),g(pt==null?void 0:pt.subscriber_role),y(pt==null?void 0:pt.subs_expire_day),v((nn=pt==null?void 0:pt.mushboomer_counts)==null?void 0:nn.eth),C((Vt=pt==null?void 0:pt.mushboomer_counts)==null?void 0:Vt.sol),N(pt==null?void 0:pt.referral_code),P(pt==null?void 0:pt.refcode),M(pt==null?void 0:pt.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),F(""),$(""))}catch(pt){console.error("Token verification error:",pt),console.error(pt.message||"An unknown error occurred.")}})()},[]);const[ae,q]=h.useState(""),[W,ne]=h.useState(!1),oe=h.useRef(null);h.useEffect(()=>{function it(Ut){oe.current&&!oe.current.contains(Ut.target)&&ne(!1)}return document.addEventListener("mousedown",it),()=>document.removeEventListener("mousedown",it)},[]);const[he,_e]=h.useState([]),xe=n==null?void 0:n.filter(it=>{var Ut;return ae?(Ut=it.asset)==null?void 0:Ut.toLowerCase().includes(ae.toLowerCase()):!0}).map(it=>{const Ut=he.find(hn=>hn.coin===it.asset&&(hn.wallet||"").toLowerCase()===(it.wallet||"").toLowerCase());return{...it,tagName:(Ut==null?void 0:Ut.tag)||null,tagWallet:(Ut==null?void 0:Ut.cp_wallet)||null}}),Se="-unrealizedPnl",[ge,Ce]=h.useState(Se),je=it=>{const pt=xe==null?void 0:xe.map(We=>{const It=We!=null&&We.positionValue&&(We!=null&&We.leverage)?We.unrealizedPnl*We.leverage*100/We.positionValue:0,Ge=.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*Ge)):ct=We.entryPrice*(We.leverage/(We.leverage-1+We.leverage*Ge));const vt=ct*5.05,Ht=We.leverage?We.positionValue/We.leverage:0,Rt=We.positionValue*1e-4*(We.sign??-1);return{...We,roe:It,liquidationPrice:vt,marginUsed:Ht,funding:Rt}});return pt==null?void 0:pt.sort((We,It)=>{const Ge=We.tagName?We.tagName.toUpperCase():"",ct=It.tagName?It.tagName.toUpperCase():"",vt=We.asset?We.asset.toUpperCase():"",Ht=It.asset?It.asset.toUpperCase():"",Rt=We.type==="Long"?1:0,mn=It.type==="Long"?1:0,un=We.type==="Short"?1:0,yn=It.type==="Short"?1:0;return it==="-unrealizedPnl"?It.unrealizedPnl-We.unrealizedPnl:it==="unrealizedPnl"?We.unrealizedPnl-It.unrealizedPnl:it==="-roe"?It.roe-We.roe:it==="roe"?We.roe-It.roe:it==="-size"?It.size-We.size:it==="size"?We.size-It.size:it==="-entryPrice"?It.entryPrice-We.entryPrice:it==="entryPrice"?We.entryPrice-It.entryPrice:it==="-currentPrice"?It.currentPrice-We.currentPrice:it==="currentPrice"?We.currentPrice-It.currentPrice:it==="-leverage"?It.leverage-We.leverage:it==="leverage"?We.leverage-It.leverage:it==="-positionValue"?It.positionValue-We.positionValue:it==="positionValue"?We.positionValue-It.positionValue:it==="-marginUsed"?It.marginUsed-We.marginUsed:it==="marginUsed"?We.marginUsed-It.marginUsed:it==="-funding"?It.funding-We.funding:it==="funding"?We.funding-It.funding:it==="-liquidationPrice"?It.liquidationPrice-We.liquidationPrice:it==="liquidationPrice"?We.liquidationPrice-It.liquidationPrice:it==="-entryTime"?new Date(It.latestFill)-new Date(We.latestFill):it==="entryTime"?new Date(We.latestFill)-new Date(It.latestFill):it==="-source_tag"?Ge<ct?-1:Ge>ct?1:0:it==="source_tag"?Ge>ct?-1:Ge<ct?1:0:it==="-type_leverage"?Rt!==mn?mn-Rt:It.leverage-We.leverage:it==="type_leverage"?un!==yn?yn-un:It.leverage-We.leverage:it==="-asset"?vt<Ht?-1:vt>Ht?1:0:it==="asset"?vt>Ht?-1:vt<Ht?1:0:0})};n.length,n.filter(it=>it.unrealizedPnl>=0).length;const[Oe,$e]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),Je=localStorage.getItem("isDateOpenPositionsLighterFormat")||"date",[ht,rt]=h.useState(Je);h.useEffect(()=>{localStorage.setItem("isDateOpenPositionsLighterFormat",ht)},[ht]);const[st,He]=h.useState([]),Ve=async()=>{try{const it=window.localStorage.getItem("hyperToken");if(!it){L(!0);return}const Ut="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",hn=window.localStorage.getItem("hyperAddress"),Vt=await(await fetch(Ut,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Q?Q.toLowerCase():hn,token:it,balance:"false"})})).json();Vt!=null&&Vt.success?(He(Vt.data||[]),Vn(Vt.data)):console.log(Vt.error_message)}catch(it){console.error("Error fetching generate wallet list:",it)}};h.useEffect(()=>{window.localStorage.getItem("hyperToken")&&Ve()},[u]);const[bt,xt]=h.useState([]),[Qt,St]=h.useState(!0),[on,cn]=h.useState(!1);h.useEffect(()=>{xe&&xe.length>0&&(tn(),st.length>0&&Qt&&Vn())},[xe]);const Vn=()=>{bt.length!==0&&(fn(bt),Qt&&St(!1))};h.useEffect(()=>{const it=window.localStorage.getItem("hyperToken");bt.length&&it&&fn(bt)},[bt]);const tn=()=>{const it=window.localStorage.getItem("hyperToken");let Ut=!1;const hn=[...bt];xe.forEach(nn=>{var It;const Vt=nn.asset,pt=(It=nn.wallet||t)==null?void 0:It.toLowerCase();hn.some(Ge=>Ge.coin===Vt&&(Ge.wallet||"").toLowerCase()===pt)||(hn.push({coin:Vt,wallet:pt}),Ut=!0)}),Ut&&(xt(hn),st.some(Vt=>Vt.wallet_address===(t==null?void 0:t.toLowerCase()))&&it&&fn(hn))},fn=async it=>{if(!on)try{cn(!0);const Ut=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Ut||!it){cn(!1);return}Ut||L(!0);const nn=window.localStorage.getItem("hyperAddress"),pt=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Q?Q.toLowerCase():nn,token:Ut,positions:it})})).json();pt.success?_e(pt==null?void 0:pt.data):(console.log(pt.error_message),dn.error(pt.error_message))}catch(Ut){console.error("Error tag request",Ut),dn.error(Ut.message)}finally{cn(!1)}};(e==null?void 0:e.length)>1||st.some(it=>it.wallet_address===(t==null?void 0:t.toLowerCase()));const rn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(nI,{open:se,setOpen:ee,data:Oe,setTradeInfo:$e}),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:re,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(zl,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:de,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(zl,{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(zl,{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(zl,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:K,className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] border-collapse rounded-lg pb-24",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky bg-[#161616] left-0 h-10 pl-2 sm:pl-6 min-w-[130px] sm:min-w-[145px] z-[8]",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 relative",children:[i.jsx(hi,{title:"Coin",sortKey:"asset",sortOption:ge,setSortOption:Ce,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>ne(!W),className:`${ae?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(xd,{className:`w-4 h-4 ${ae?"text-blue-500":"text-white"}`})}),W&&i.jsxs("div",{ref:oe,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>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:ae,onChange:it=>q(it.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(wcn,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:ge,setSortOption:Ce}),i.jsx(Iv,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:ge,setSortOption:Ce})]})}),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(Ba,{})})})})}):(xe==null?void 0:xe.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:Kl,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."]})]})]})]})})})})}):(nt=je(ge))==null?void 0:nt.map((it,Ut)=>{var It;const hn=it!=null&&it.positionValue&&(it!=null&&it.leverage)?(it==null?void 0:it.unrealizedPnl)*(it==null?void 0:it.leverage)*100/(it==null?void 0:it.positionValue):0,nn=.004+6e-4*it.leverage;it.entryPrice*(it.leverage/(it.sign===1?it.leverage+1-it.leverage*nn:it.leverage-1+it.leverage*nn));const Vt=it!=null&&it.leverage?(it==null?void 0:it.positionValue)/(it==null?void 0:it.leverage):0,We=(it==null?void 0:it.positionValue)*1e-4*(it==null?void 0:it.sign);return i.jsxs(Ie.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/${it==null?void 0:it.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/${rn[it.asset]||((It=it.asset)==null?void 0:It.split("/")[0])}.svg`||za,alt:it==null?void 0:it.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Ge=>Qi(Ge)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:it.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:`${it.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:it.type==="Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[it.type," - ",it==null?void 0:it.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:fo(Math.abs(it.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:it.positionValue?`$${fo(it.positionValue)}`:fo(it.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:it.entryPrice?`$${Er(it.entryPrice)}`:Er(it.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:it.currentPrice?`$${Er(it.currentPrice)}`:Er(it.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{$e(Ge=>({...Ge,coin:it.asset,type:it.type,leverage:it.leverage,roe:hn,entryPrice:it.entryPrice,markPrice:it.currentPrice,pnl:it.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?I:null})),ee(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${it.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[it.unrealizedPnl?`$${fo(Math.abs(it.unrealizedPnl))}`:fo(Math.abs(it.unrealizedPnl)),` (${fo(Math.abs(hn.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?`$${fo(Vt)}`:fo(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)})})]})})]})]})},Iv=({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})}),wcn=({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})}),Ccn=({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(vcn,{initialAddress:t,wallets:e,positions:c,setPositions:u,isWalletIndex:n,posLoading:r,setPosLoading:s,setGenerateWalletData:a}):""]})},Scn=({data:t,isWalletIndex:e,fetchAllIndex:n,setGenerateWalletData:r})=>{const{isConnected:s,address:a}=es(),{setSignModalOpen:o,hyperToken:l,isReferralCodeName:c}=h.useContext(Yr),[u,d]=h.useState(""),[f,x]=h.useState(!0);h.useState({});const[g,y]=h.useState(!1),[v,C]=h.useState(""),[N,I]=h.useState(!1),P=h.useRef(null),M=h.useRef(null),[F,$]=h.useState(!1),[L,z]=h.useState(!1),[Q,se]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),ee="-unrealizedPnl",[K,re]=h.useState(ee),[de,G]=h.useState([]),[ie,ae]=h.useState(!1);h.useEffect(()=>{if(t.length===0||ie)return;const Ce=t.reduce((je,Oe)=>parseFloat(Oe.perpEquity||0)>parseFloat(je.perpEquity||0)?Oe:je);Ce.wallet_address&&d(Ce.wallet_address)},[t,ie]);const q=(Ce,je,Oe)=>{const $e=Ce==null?void 0:Ce.filter(Ye=>Ye&&Ye.walletAddress&&Ye.asset).filter(Ye=>{var Je,ht;return Oe?(ht=(Je=Ye==null?void 0:Ye.asset)==null?void 0:Je.toString())==null?void 0:ht.toUpperCase().includes(Oe.toUpperCase()):!0});return $e==null?void 0:$e.sort((Ye,Je)=>{const ht=Ye.wallet_name?Ye.wallet_name.toUpperCase():"",rt=Je.wallet_name?Je.wallet_name.toUpperCase():"",st=Ye.tag?Ye.tag.toUpperCase():"",He=Je.tag?Je.tag.toUpperCase():"",Ve=Ye.asset?Ye.asset.toUpperCase():"",bt=Je.asset?Je.asset.toUpperCase():"",xt=Ye.type==="Long"?1:0,Qt=Je.type==="Long"?1:0,St=Ye.type==="Short"?1:0,on=Je.type==="Short"?1:0;return je==="wallet_name"?ht<rt?-1:ht>rt?1:0:je==="-wallet_name"?ht>rt?-1:ht<rt?1:0:je==="-unrealizedPnl"?Je.unrealizedPnl-Ye.unrealizedPnl:je==="unrealizedPnl"?Ye.unrealizedPnl-Je.unrealizedPnl:je==="-roe"?Je.roe-Ye.roe:je==="roe"?Ye.roe-Je.roe:je==="-size"?Je.size-Ye.size:je==="size"?Ye.size-Je.size:je==="-entryPrice"?Je.entryPrice-Ye.entryPrice:je==="entryPrice"?Ye.entryPrice-Je.entryPrice:je==="-currentPrice"?Je.currentPrice-Ye.currentPrice:je==="currentPrice"?Ye.currentPrice-Je.currentPrice:je==="-leverage"?Je.leverage-Ye.leverage:je==="leverage"?Ye.leverage-Je.leverage:je==="-positionValue"?Je.positionValue-Ye.positionValue:je==="positionValue"?Ye.positionValue-Je.positionValue:je==="-marginUsed"?Je.marginUsed-Ye.marginUsed:je==="marginUsed"?Ye.marginUsed-Je.marginUsed:je==="funding"?Je.funding-Ye.funding:je==="-funding"?Ye.funding-Je.funding:je==="-liquidationPrice"?Je.liquidationPrice-Ye.liquidationPrice:je==="liquidationPrice"?Ye.liquidationPrice-Je.liquidationPrice:je==="-tag"?st<He?-1:st>He?1:0:je==="tag"?st>He?-1:st<He?1:0:je==="-coin"?Ve<bt?-1:Ve>bt?1:0:je==="coin"?Ve>bt?-1:Ve<bt?1:0:je==="-type_leverage"?xt!==Qt?Qt-xt:Je.leverage-Ye.leverage:je==="type_leverage"?St!==on?on-St:Je.leverage-Ye.leverage:0})},W=async Ce=>{if(Ce===""&&de.filter(je=>je!==void 0).length===0||Ce===""&&q(de,K,v).length===0||q(de,K,v).length===0){dn.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(Ce===""&&(t==null?void 0:t.length)>0){const je=q(de,K,v),Oe=[...new Set(je.map($e=>$e.wallet_id))];if(Oe.length===0){dn.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(Oe.map(Ye=>ne(Ye,!1))),dn.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($e){console.error("Error closing all orders:",$e)}finally{y(!1)}return}await ne(Ce)},ne=async(Ce,je=!0)=>{if(de.filter(Oe=>Oe!==void 0).length===0){dn.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(!Ce){console.error("Close order called with invalid parameters"),dn.error("Close order called with invalid parameters");return}try{y(!0);const Oe=window.localStorage.getItem("hyperToken"),$e="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!Oe){o(!0),y(!1);return}const Ye=window.localStorage.getItem("hyperAddress"),Je=await fetch($e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Ye,token:Oe,wallet_id:Ce.toString()})});if(!Je.ok)throw new Error(`Server responded with status ${Je.status}`);const ht=await Je.json();ht.status=="ok"?(y(!1),je&&dn.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"}})):ht.success?(y(!1),je&&dn.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."),dn.error("Close order operation failed."),y(!1))}catch(Oe){throw console.error("Something went wrong!"),dn.error("Something went wrong!"),y(!1),Oe}},[oe,he]=h.useState(!1);h.useEffect(()=>{const Ce=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&he(!0)};Ce();const je=setInterval(()=>{Ce()},1e3*60*30);return()=>{clearInterval(je)}},[]);const _e=async Ce=>{try{const je=window.localStorage.getItem("hyperToken"),Oe="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!je){o(!0);return}const $e=Ce==null?void 0:Ce.filter(rt=>rt&&rt.walletAddress&&rt.asset).map(rt=>({wallet:rt.walletAddress,coin:rt.asset})),Ye=window.localStorage.getItem("hyperAddress"),ht=await(await fetch(Oe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Ye,token:je,positions:$e})})).json();ht.success?G(rt=>rt.map(st=>{const He=ht==null?void 0:ht.data.find(Ve=>(Ve==null?void 0:Ve.wallet)===(st==null?void 0:st.walletAddress)&&(Ve==null?void 0:Ve.coin)===(st==null?void 0:st.asset));return{...st,tag:He==null?void 0:He.tag,tagWallet:He==null?void 0:He.cp_wallet}})):(console.log(ht.error_message),dn.error(ht.error_message))}catch(je){console.error("Error tag request",je),dn.error(je.message)}},xe=h.useRef(de==null?void 0:de.filter(Ce=>(Ce==null?void 0:Ce.walletAddress)&&(Ce==null?void 0:Ce.asset)).length),Se=h.useRef(),ge=h.useRef(!0);return h.useEffect(()=>{const Ce=de==null?void 0:de.filter(Oe=>Oe!==void 0&&(Oe==null?void 0:Oe.walletAddress)&&(Oe==null?void 0:Oe.asset)),je=Ce==null?void 0:Ce.length;if(je>0&&je>xe.current){const Oe=u===""?de:de.filter($e=>($e==null?void 0:$e.wallet_id)==u);ge.current?(_e(Oe),ge.current=!1):(Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{_e(Oe)},5e3))}xe.current=je},[de]),h.useEffect(()=>{if((de==null?void 0:de.filter(Ce=>Ce!==void 0&&(Ce==null?void 0:Ce.walletAddress)&&(Ce==null?void 0:Ce.asset)).length)>0){const Ce=u==""?de:de==null?void 0:de.filter(je=>(je==null?void 0:je.wallet_id)==u);(Ce==null?void 0:Ce.length)>0&&_e(Ce)}},[u]),h.useEffect(()=>{function Ce(je){P.current&&!P.current.contains(je.target)&&setIsDropdownOpen(!1),M.current&&!M.current.contains(je.target)&&I(!1)}return document.addEventListener("mousedown",Ce),()=>document.removeEventListener("mousedown",Ce)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(BVe,{open:F,setOpen:$,data:Q,setShare:z,setTradeInfo:se}),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:Ce=>{Ce.preventDefault(),g||W(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:xae,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:Ce=>{d(Ce.target.value),ae(!0),n(Ce.target.value),x(!0),r(je=>je==null?void 0:je.map(Oe=>({...Oe,unrealizedPnl:0,marginUsed:0})))},value:u,children:t==null?void 0:t.map(Ce=>i.jsx("option",{value:Ce==null?void 0:Ce.wallet_address,children:`${Ce==null?void 0:Ce.wallet_name} - (${(Ce==null?void 0:Ce.wallet_address).slice(0,5)+"..."+(Ce==null?void 0:Ce.wallet_address).slice(-4)})`},Ce==null?void 0:Ce.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(Ccn,{initialAddress:u,wallets:u===""?t:void 0,isWalletIndex:e,posLoading:f,setPosLoading:x,setGenerateWalletData:r})})]})]})]})})},Ncn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var st;h.useState(!1);const{setSignModalOpen:l}=h.useContext(Yr),{isConnected:c,address:u}=es(),d=5,[f,x]=h.useState(null),[g,y]=h.useState(null),[v,C]=h.useState(!1),[N,I]=h.useState(null),[P,M]=h.useState(!1),[F,$]=h.useState("");h.useState({});const[L,z]=h.useState({}),[Q,se]=h.useState(!1),[ee,K]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[re,de]=h.useState(!1),[G,ie]=h.useState(!1),ae="-perpEquity",[q,W]=h.useState(ae),ne=He=>t.sort((Ve,bt)=>{if(Ve.version===3&&bt.version!==3)return-1;if(bt.version===3&&Ve.version!==3)return 1;const xt=Ve.wallet_name?Ve.wallet_name.toUpperCase():"",Qt=bt.wallet_name?bt.wallet_name.toUpperCase():"",St=Ve.wallet_address?Ve.wallet_address.toLowerCase():"",on=bt.wallet_address?bt.wallet_address.toLowerCase():"";return He==="wallet_name"?xt<Qt?-1:xt>Qt?1:0:He==="-wallet_name"?xt>Qt?-1:xt<Qt?1:0:He==="-wallet_address"?St<on?-1:St>on?1:0:He==="wallet_address"?St>on?-1:St<on?1:0:He==="-wallet_created_data"?new Date(bt.wallet_created_data)-new Date(Ve.wallet_created_data):He==="wallet_created_data"?new Date(Ve.wallet_created_data)-new Date(bt.wallet_created_data):He==="-perpEquity"?bt.perpEquity-Ve.perpEquity:He==="perpEquity"?Ve.perpEquity-bt.perpEquity:He==="-unrealizedPnl"?bt.unrealizedPnl-Ve.unrealizedPnl:He==="unrealizedPnl"?Ve.unrealizedPnl-bt.unrealizedPnl:He==="-marginUsed"?bt.marginUsed-Ve.marginUsed:He==="marginUsed"?Ve.marginUsed-bt.marginUsed:He==="-withdrawableUsdc"?bt.withdrawableUsdc-Ve.withdrawableUsdc:He==="withdrawableUsdc"?Ve.withdrawableUsdc-bt.withdrawableUsdc:0}),oe=async(He,Ve,bt)=>{if(!He||!Ve||!bt){console.error("Delete order called with invalid parameters"),dn.error("Delete order called with invalid parameters");return}const xt=`${He}_${Ve}`;try{z(tn=>({...tn,[xt]:!0}));const Qt=window.localStorage.getItem("hyperToken"),St="https://dextrabothypev2.nftinit.io/api/wallet/delete-lighter";if(!Qt){l(!0),z(tn=>({...tn,[xt]:!1}));return}const on=window.localStorage.getItem("hyperAddress"),cn=await fetch(St,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():on,token:Qt,wallet_id:He})});if(!cn.ok)throw new _l(`Server responded with status ${cn.status}`);const Vn=await cn.json();Vn.success?(o(),K({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),de(!1),ie(!1),se(!1),z(tn=>({...tn,[xt]:!1})),dn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:bt.slice(0,5)+"..."+bt.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(Vn.error_message),dn.error(Vn.error_message),z(tn=>({...tn,[xt]:!1})))}catch(Qt){console.error("Error deleting wallet:",Qt),dn.error(Qt.message),z(St=>({...St,[xt]:!1}))}},he=h.useRef(null),_e=()=>{he.current&&(he.current.scrollLeft-=100)},xe=()=>{he.current&&(he.current.scrollLeft+=100)},Se=()=>{he.current&&(he.current.scrollTop+=200)},ge=()=>{he.current&&(he.current.scrollTop-=200)},Ce=He=>He>=640&&He<1024?4:He>=1024&&He<1240?7:He>=1240&&He<1540||He>=1540?8:3,[je,Oe]=h.useState(null),[$e,Ye]=h.useState(!1),[Je,ht]=h.useState(!1);h.useEffect(()=>{const He=()=>{ht(window.innerWidth<640)};return window.addEventListener("resize",He),He(),()=>window.removeEventListener("resize",He)},[]);const rt=He=>{Je&&(Oe(He),Ye(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(bde,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:N,setWithdrawableUsdc:I,modalWalletId:g,setModalWalletId:y}),i.jsx(yde,{open:P,setOpen:M,walletAddress:F}),i.jsx(vde,{open:Q,setOpen:se,handleDeleteWallet:oe,deleteWalleInfo:ee,confirmClosePositions:re,setConfirmClosePositions:de,confirmWithdrawEquity:G,setConfirmWithdrawEquity:ie}),i.jsx(yp,{isOpen:$e,onClose:()=>Ye(!1),children:i.jsx(wde,{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:_e,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(eo,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{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(eo,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),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(eo,{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:he,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:q,setSortOption:W,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:q,setSortOption:W,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:q,setSortOption:W,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:Ce(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(Ba,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Ce(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(_l,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Ce(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:Kl,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."]})]})]})]})})})})}):(st=ne(q))==null?void 0:st.map((He,Ve)=>{!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 bt=Je?{onClick:()=>rt(He),className:"cursor-pointer"}:{};return i.jsxs("tr",{...bt,className:`${Ve%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${Ve%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(Us,{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(Ma,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(Vs,{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(Ma,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${Ve%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:Ki,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(na,{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:xt=>{xt.stopPropagation(),navigator.clipboard.writeText(He==null?void 0:He.wallet_address),dn.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:_o,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)&&M3(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(Us,{content:"Deposits are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}),i.jsx(Us,{content:"Withdrawals are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}),L[`${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(Us,{content:"API wallets cannot be deleted here. To remove this wallet, please delete it from the Hyperliquid API page.",children:i.jsx("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Delete"})})}):i.jsx("div",{onClick:()=>{K({wallet: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}),se(!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"})})]})})]},Ve)})})]})})]}),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"})})]})]})]})},jcn=({lighterWalletList:t})=>{const{isConnected:e,address:n}=es(),{setSignModalOpen:r,hyperToken:s}=h.useContext(Yr),[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([]),[N,I]=h.useState(()=>parseInt(localStorage.getItem("walletManagementLighterPage"))||1),P=5,[M,F]=h.useState(!1),[$,L]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?z():(r(!0),o([]),window.localStorage.setItem("walletManagementLighterPage",1))},[e,s]);const z=async()=>{var K;try{c(!0);const re=window.localStorage.getItem("hyperToken");if(!re){r(!0);return}const de="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",G=window.localStorage.getItem("hyperAddress"),ae=await(await fetch(de,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():G,token:re})})).json();if(ae.success){t(),C(ae.data||[]),F(!0);const q=parseInt(localStorage.getItem("walletManagementLighterPage"))||1,W=Math.max(Math.ceil(((ae==null?void 0:ae.data)||[]).length/P),1),ne=Math.min(q,W);I(ne),localStorage.setItem("walletManagementLighterPage",ne),se(ne,ae.data||[]);const oe=(ne-1)*P,he=(K=ae.data)==null?void 0:K[oe];he&&Q(he==null?void 0:he.wallet_address)}else console.log(ae.error_message),c(!1),d(ae.error_message)}catch(re){console.error("Error fetching lighter wallet list:",re),c(!1),d(re.message)}},Q=async K=>{try{const de=`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${Ic(K)}`,ie=await(await fetch(de,{method:"GET",headers:{accept:"application/json"}})).json();if(ie.sub_accounts&&ie.sub_accounts.length>0){const ae=ie.sub_accounts[0],q=(ae==null?void 0:ae.collateral)??ae.collateral??"",W=(ae==null?void 0:ae.margin_used)??"",ne=(ae==null?void 0:ae.available_balance)??"",oe=(ae==null?void 0:ae.unrealized_pnl)??"",he=(ae==null?void 0:ae.positions)??[];o(_e=>_e==null?void 0:_e.map(xe=>xe.wallet_address.toLowerCase()===K.toLowerCase()?{...xe,perpEquity:q,unrealizedPnl:oe,withdrawableUsdc:ne,marginUsed:W,positions:he}:xe)),y(ae),L(!0),c(!1),x(!1)}}catch(re){console.error("Error fetching lighter index:",re)}};h.useEffect(()=>{const K=()=>{const re=parseInt(localStorage.getItem("walletManagementLighterPage"))||1;re!==N&&M&&$&&(I(re),se(re,v))};return window.addEventListener("storage",K),()=>{window.removeEventListener("storage",K)}},[N,v,M,$]);const se=(K,re)=>{if(!re||re.length===0){c(!1);return}c(!0);const de=(K-1)*P,G=de+P,ie=re.slice(de,G);o(ie)},ee=K=>{K<1||K>Math.ceil(v.length/P)||(c(!0),I(K),localStorage.setItem("walletManagementLighterPage",K),se(K,v))};return i.jsxs(i.Fragment,{children:[i.jsx(Ncn,{data:a,loading:l,error:u,handlePageChange:ee,handleListRequest:z,currentPage:N,allWallets:v}),i.jsx(Scn,{data:a,setGenerateWalletData:o,isWalletIndex:g,fetchAllIndex:Q})]})},Acn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var st;h.useState(!1);const{setSignModalOpen:l}=h.useContext(Yr),{isConnected:c,address:u}=es(),d=5,[f,x]=h.useState(null),[g,y]=h.useState(null),[v,C]=h.useState(!1),[N,I]=h.useState(null),[P,M]=h.useState(!1),[F,$]=h.useState("");h.useState({});const[L,z]=h.useState({}),[Q,se]=h.useState(!1),[ee,K]=h.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[re,de]=h.useState(!1),[G,ie]=h.useState(!1),ae="-perpEquity",[q,W]=h.useState(ae),ne=He=>t.sort((Ve,bt)=>{if(Ve.version===3&&bt.version!==3)return-1;if(bt.version===3&&Ve.version!==3)return 1;const xt=Ve.wallet_name?Ve.wallet_name.toUpperCase():"",Qt=bt.wallet_name?bt.wallet_name.toUpperCase():"",St=Ve.wallet_address?Ve.wallet_address.toLowerCase():"",on=bt.wallet_address?bt.wallet_address.toLowerCase():"";return He==="wallet_name"?xt<Qt?-1:xt>Qt?1:0:He==="-wallet_name"?xt>Qt?-1:xt<Qt?1:0:He==="-wallet_address"?St<on?-1:St>on?1:0:He==="wallet_address"?St>on?-1:St<on?1:0:He==="-wallet_created_data"?new Date(bt.wallet_created_data)-new Date(Ve.wallet_created_data):He==="wallet_created_data"?new Date(Ve.wallet_created_data)-new Date(bt.wallet_created_data):He==="-perpEquity"?bt.perpEquity-Ve.perpEquity:He==="perpEquity"?Ve.perpEquity-bt.perpEquity:He==="-unrealizedPnl"?bt.unrealizedPnl-Ve.unrealizedPnl:He==="unrealizedPnl"?Ve.unrealizedPnl-bt.unrealizedPnl:He==="-marginUsed"?bt.marginUsed-Ve.marginUsed:He==="marginUsed"?Ve.marginUsed-bt.marginUsed:He==="-withdrawableUsdc"?bt.withdrawableUsdc-Ve.withdrawableUsdc:He==="withdrawableUsdc"?Ve.withdrawableUsdc-bt.withdrawableUsdc:0}),oe=async(He,Ve,bt)=>{if(!He||!Ve||!bt){console.error("Delete order called with invalid parameters"),dn.error("Delete order called with invalid parameters");return}const xt=`${He}_${Ve}`;try{z(tn=>({...tn,[xt]:!0}));const Qt=window.localStorage.getItem("hyperToken"),St="https://dextrabothypev2.nftinit.io/api/wallet/delete-extended";if(!Qt){l(!0),z(tn=>({...tn,[xt]:!1}));return}const on=window.localStorage.getItem("hyperAddress"),cn=await fetch(St,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():on,token:Qt,wallet_id:He})});if(!cn.ok)throw new _l(`Server responded with status ${cn.status}`);const Vn=await cn.json();Vn.success?(o(),K({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),de(!1),ie(!1),se(!1),z(tn=>({...tn,[xt]:!1})),dn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:bt.slice(0,5)+"..."+bt.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(Vn.error_message),dn.error(Vn.error_message),z(tn=>({...tn,[xt]:!1})))}catch(Qt){console.error("Error deleting wallet:",Qt),dn.error(Qt.message),z(St=>({...St,[xt]:!1}))}},he=h.useRef(null),_e=()=>{he.current&&(he.current.scrollLeft-=100)},xe=()=>{he.current&&(he.current.scrollLeft+=100)},Se=()=>{he.current&&(he.current.scrollTop+=200)},ge=()=>{he.current&&(he.current.scrollTop-=200)},Ce=He=>He>=640&&He<1024?4:He>=1024&&He<1240?7:He>=1240&&He<1540||He>=1540?8:3,[je,Oe]=h.useState(null),[$e,Ye]=h.useState(!1),[Je,ht]=h.useState(!1);h.useEffect(()=>{const He=()=>{ht(window.innerWidth<640)};return window.addEventListener("resize",He),He(),()=>window.removeEventListener("resize",He)},[]);const rt=He=>{Je&&(Oe(He),Ye(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(bde,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:N,setWithdrawableUsdc:I,modalWalletId:g,setModalWalletId:y}),i.jsx(yde,{open:P,setOpen:M,walletAddress:F}),i.jsx(vde,{open:Q,setOpen:se,handleDeleteWallet:oe,deleteWalleInfo:ee,confirmClosePositions:re,setConfirmClosePositions:de,confirmWithdrawEquity:G,setConfirmWithdrawEquity:ie}),i.jsx(yp,{isOpen:$e,onClose:()=>Ye(!1),children:i.jsx(wde,{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:_e,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(eo,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{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(eo,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),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(eo,{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:he,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:q,setSortOption:W,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:q,setSortOption:W,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:q,setSortOption:W,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:Ce(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(Ba,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Ce(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(_l,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Ce(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:Kl,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."]})]})]})]})})})})}):(st=ne(q))==null?void 0:st.map((He,Ve)=>{!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 bt=Je?{onClick:()=>rt(He),className:"cursor-pointer"}:{};return i.jsxs("tr",{...bt,className:`${Ve%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${Ve%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(Us,{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(Ma,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(Vs,{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(Ma,{content:`${He==null?void 0:He.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${Ve%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:Ki,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(na,{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:xt=>{xt.stopPropagation(),navigator.clipboard.writeText(He==null?void 0:He.wallet_address),dn.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:_o,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)&&M3(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(Us,{content:"Deposits are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}),i.jsx(Us,{content:"Withdrawals are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}),L[`${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(Us,{content:"API wallets cannot be deleted here. To remove this wallet, please delete it from the Hyperliquid API page.",children:i.jsx("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Delete"})})}):i.jsx("div",{onClick:()=>{K({wallet: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}),se(!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"})})]})})]},Ve)})})]})})]}),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"})})]})]})]})},mSe=({fetchAllWalletList:t})=>{const{isConnected:e,address:n}=es(),{setSignModalOpen:r,hyperToken:s}=h.useContext(Yr),[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,N]=h.useState(!1),[I,P]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?M():(r(!0),o([]),window.localStorage.setItem("walletManagementExtendedPage",1))},[e,s]);const M=async()=>{var L,z;try{c(!0);const Q=window.localStorage.getItem("hyperToken");if(!Q){r(!0);return}const se="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",ee=window.localStorage.getItem("hyperAddress"),re=await(await fetch(se,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():ee,token:Q})})).json();if(re.success&&((L=re==null?void 0:re.data)==null?void 0:L.length)>0){t(),x(re.data||[]),N(!0);const de=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1,G=Math.max(Math.ceil(((re==null?void 0:re.data)||[]).length/v),1),ie=Math.min(de,G);y(ie),localStorage.setItem("walletManagementExtendedPage",ie),F(ie,re.data||[]);const ae=(ie-1)*v,q=(z=re.data)==null?void 0:z[ae];c(!1)}else console.log(re.error_message),c(!1),d(re.error_message),o([])}catch(Q){console.error("Error fetching lighter wallet list:",Q),c(!1),d(Q.message)}};h.useEffect(()=>{const L=()=>{const z=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1;z!==g&&C&&I&&(y(z),F(z,f))};return window.addEventListener("storage",L),()=>{window.removeEventListener("storage",L)}},[g,f,C,I]);const F=(L,z)=>{if(!z||z.length===0){c(!1);return}c(!0);const Q=(L-1)*v,se=Q+v,ee=z.slice(Q,se);o(ee)},$=L=>{L<1||L>Math.ceil(f.length/v)||(c(!0),y(L),localStorage.setItem("walletManagementExtendedPage",L),F(L,f))};return i.jsx(i.Fragment,{children:i.jsx(Acn,{data:a,loading:l,error:u,handlePageChange:$,handleListRequest:M,currentPage:g,allWallets:f})})},_cn=({handleListRequest:t,handlePageChange:e,isGenWalletModal:n,setIsGenWalletModal:r})=>{const{setSignModalOpen:s}=h.useContext(Yr);return i.jsxs(i.Fragment,{children:[i.jsx(P5,{open:n,setOpen:r,handleListRequest:t,handlePageChange:e}),i.jsx("div",{className:"flex justify-center items-center w-max h-max",children:i.jsxs("div",{onClick:a=>{a.preventDefault(),window.localStorage.getItem("hyperToken")?r(!0):s(!0)},className:"h-8 pl-2 pr-2 sm:pl-2 sm:pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer my-2",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Add Account"})]})})]})},Ecn=({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:P1,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))})})]})},kcn=({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(_cn,{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(nQ,{title:"HYPER",label:"HYPERLIQUID",walletLength:s,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(nQ,{title:"LIGHTER",label:"LIGHTER",walletLength:a,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(nQ,{title:"EXTENDED",label:"EXTENDED",walletLength:o,handleSelectMenuChange:d,isSelectMenu:t})]}),i.jsx("div",{className:"flex lg:hidden items-center justify-start",children:i.jsx(Ecn,{value:t,onChange:d,allWallets:s,lighterWallet:a,extendedWallet:o,pacificaWallet:l})})]})]})},nQ=({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:P1,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"}) `]}),Tcn="wss://api.hyperliquid.xyz/ws",Icn=()=>{const t=Xl(),{isConnected:e,address:n}=es(),{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(Yr),v=h.useRef(null),C=h.useRef(null),N=h.useRef(null),[I,P]=h.useState([]),[M,F]=h.useState(!1),[$,L]=h.useState(null),[z,Q]=h.useState(!0),[se,ee]=h.useState("null");h.useEffect(()=>{const rt=t.hash;if(rt){const st=rt.split("#").filter(Boolean);st[0]==="hyperliquid"?(ee("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")):st[0]==="lighter"?(ee("LIGHTER"),localStorage.setItem("isWalletSelectMenu","LIGHTER")):st[0]==="extended"?(ee("EXTENDED"),localStorage.setItem("isWalletSelectMenu","EXTENDED")):st[0]==="pacifica"?(ee("PACIFICA"),localStorage.setItem("isWalletSelectMenu","PACIFICA")):(window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),ee("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER"))}else window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),ee("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")},[t.hash]);const[K,re]=h.useState([]),[de,G]=h.useState([]),[ie,ae]=h.useState([]),[q,W]=h.useState([]),[ne,oe]=h.useState(()=>parseInt(localStorage.getItem("walletManagementPage"))||1),he=5,[_e,xe]=h.useState(!1);h.useEffect(()=>{window.localStorage.getItem("hyperToken")?(Se(),ge(),Ce()):(r(!0),P([]),window.localStorage.setItem("walletManagementPage",1))},[e,s]);const Se=async()=>{try{F(!0);const rt=window.localStorage.getItem("hyperToken");if(!rt){r(!0);return}const st="https://dextrabothypev2.nftinit.io/api/wallet/list",He=window.localStorage.getItem("hyperAddress"),bt=await(await fetch(st,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:rt,balance:"false"})})).json();if(bt.success){W(bt.data||[]),xe(!0);const xt=parseInt(localStorage.getItem("walletManagementPage"))||1,Qt=Math.max(Math.ceil(((bt==null?void 0:bt.data)||[]).length/he),1),St=Math.min(xt,Qt);oe(St),localStorage.setItem("walletManagementPage",St),Je(St,bt.data||[])}else console.log(bt.error_message),F(!1),L(bt.error_message)}catch(rt){console.error("Error fetching wallet list:",rt),F(!1),L(rt.message)}},ge=async()=>{try{F(!0);const rt=window.localStorage.getItem("hyperToken");if(!rt){r(!0);return}const st="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",He=window.localStorage.getItem("hyperAddress"),bt=await(await fetch(st,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:rt})})).json();bt.success&&re(bt.data||[])}catch(rt){console.error("Error fetching wallet list:",rt)}},Ce=async()=>{try{F(!0);const rt=window.localStorage.getItem("hyperToken");if(!rt){r(!0);return}const st="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",He=window.localStorage.getItem("hyperAddress"),bt=await(await fetch(st,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():He,token:rt})})).json();bt.success&&G(bt.data||[])}catch(rt){console.error("Error fetching wallet list:",rt)}},je=rt=>rt!=null&&rt.assetPositions?rt.assetPositions.filter(st=>{if(!st.position||!st.position.szi)return!1;const He=parseFloat(st.position.szi);return!isNaN(He)&&He!==0}).map(st=>{const He=st.position,Ve=parseFloat(He.szi),bt=parseFloat(He.entryPx),xt=parseFloat(He.positionValue),Qt=parseFloat(He.unrealizedPnl),St=parseFloat(He.returnOnEquity)*100,on=parseFloat(He.marginUsed),cn=He.leverage.value,Vn=He.leverage.type,tn=parseFloat(He.cumFunding.sinceOpen),fn=Ve>0?"Long":"Short";return{asset:He.coin,type:fn,size:Ve,entryPrice:bt.toFixed(4),currentPrice:(xt/Math.abs(Ve)).toFixed(4),leverage:cn,leverageType:Vn,positionValue:xt.toFixed(2),marginUsed:on.toFixed(2),unrealizedPnl:Qt.toFixed(2),roe:St.toFixed(2),funding:tn.toFixed(4),liquidationPrice:He.liquidationPx?parseFloat(He.liquidationPx).toFixed(2):"N/A"}}):[],Oe=()=>{v.current&&(console.log("Closing WebSocket connection..."),v.current.readyState===WebSocket.OPEN&&v.current.send(JSON.stringify({method:"unsubscribe",subscription:{type:"webData2"}})),v.current.close(),v.current=null),N.current&&(clearInterval(N.current),N.current=null),C.current&&(clearTimeout(C.current),C.current=null)},$e=rt=>{v.current=new WebSocket(Tcn),v.current.onopen=()=>{console.log("WebSocket Connected"),rt.forEach(st=>{let He={method:"subscribe",subscription:{type:"webData2",user:st==null?void 0:st.wallet_address}};v.current.send(JSON.stringify(He))}),N.current=setInterval(()=>{var st;if(((st=v.current)==null?void 0:st.readyState)===WebSocket.OPEN){const He={id:99,method:"ping"};v.current.send(JSON.stringify(He))}},3e4)},v.current.onclose=st=>{console.log("WebSocket Disconnected",st.code,st.reason),N.current&&(clearInterval(N.current),N.current=null),st.code!==1e3&&(C.current||(C.current=setTimeout(()=>{C.current=null,$e(rt)},5e3)))},v.current.onerror=st=>{console.error("WebSocket Error:",st)},v.current.onmessage=st=>{try{const He=JSON.parse(st.data);if(He.method==="pong")return;if(He.result==="success"){console.log("Successfully subscribed to channel");return}He.channel==="webData2"&&Ye(He)}catch(He){console.error("Error processing WebSocket message:",He),console.error("Raw message that caused error:",st.data),Q(!1)}}},Ye=rt=>{P(st=>{let He=!1;const Ve=st.map(bt=>{var xt,Qt,St,on,cn,Vn,tn,fn,rn,nt,it,Ut,hn;if((bt==null?void 0:bt.wallet_address.toLowerCase())===((xt=rt==null?void 0:rt.data)==null?void 0:xt.user.toLowerCase())){const nn=(on=(St=(Qt=rt==null?void 0:rt.data)==null?void 0:Qt.clearinghouseState)==null?void 0:St.assetPositions)==null?void 0:on.reduce((We,It)=>{var Ge;return We+(parseFloat((Ge=It==null?void 0:It.position)==null?void 0:Ge.unrealizedPnl)||0)},0),Vt=je((cn=rt==null?void 0:rt.data)==null?void 0:cn.clearinghouseState),pt={...bt,perpEquity:(fn=(tn=(Vn=rt==null?void 0:rt.data)==null?void 0:Vn.clearinghouseState)==null?void 0:tn.marginSummary)==null?void 0:fn.accountValue,unrealizedPnl:nn,withdrawableUsdc:(nt=(rn=rt==null?void 0:rt.data)==null?void 0:rn.clearinghouseState)==null?void 0:nt.withdrawable,marginUsed:(hn=(Ut=(it=rt==null?void 0:rt.data)==null?void 0:it.clearinghouseState)==null?void 0:Ut.marginSummary)==null?void 0:hn.totalMarginUsed,positions:Vt};if(JSON.stringify(bt)!==JSON.stringify(pt))return He=!0,pt}return bt});return He?Ve:st}),setTimeout(()=>{F(!1),Q(!1)},3e3)};h.useEffect(()=>{const rt=()=>{const st=parseInt(localStorage.getItem("walletManagementPage"))||1;st!==ne&&_e&&(Oe(),oe(st),Je(st,q))};return window.addEventListener("storage",rt),()=>{window.removeEventListener("storage",rt)}},[ne,q,_e]);const Je=(rt,st)=>{if(!st||st.length===0){F(!1);return}F(!0);const He=(rt-1)*he,Ve=He+he,bt=st.slice(He,Ve);P(bt),Oe(),$e(bt)},ht=rt=>{rt<1||rt>Math.ceil(q.length/he)||(F(!0),oe(rt),localStorage.setItem("walletManagementPage",rt),Je(rt,q))};return h.useEffect(()=>()=>{Oe()},[t.pathname]),h.useEffect(()=>{(async()=>{var Ve,bt;const st=window.localStorage.getItem("hyperToken"),He=window.localStorage.getItem("hyperAddress");if(!(!st||!He))try{const xt=await vi(He.toLowerCase(),st);xt!=null&&xt.success?(a(xt==null?void 0:xt.telegram_chat_id),o(xt==null?void 0:xt.subscriber_role),l(xt==null?void 0:xt.subs_expire_day),c((Ve=xt==null?void 0:xt.mushboomer_counts)==null?void 0:Ve.eth),u((bt=xt==null?void 0:xt.mushboomer_counts)==null?void 0:bt.sol),d(xt==null?void 0:xt.referral_code),f(xt==null?void 0:xt.refcode),x(xt==null?void 0:xt.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""))}catch(xt){console.error("Token verification error:",xt),console.error(xt.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(kcn,{handlePageChange:ht,handleListRequest:Se,isSelectMenu:se,setIsSelectMenu:ee,allWallets:q,lighterWallet:K,extendedWallet:de,pacificaWallet:ie}),se==="HYPER"?i.jsxs(i.Fragment,{children:[i.jsx(bcn,{data:I,loading:M,error:$,socketLoading:z,handlePageChange:ht,handleListRequest:Se,currentPage:ne,allWallets:q}),i.jsx(ycn,{data:I,loading:M,error:$,socketLoading:z,handlePageChange:ht,currentPage:ne,allWallets:q})]}):se==="LIGHTER"?i.jsx(i.Fragment,{children:i.jsx(jcn,{lighterWalletList:ge})}):se==="EXTENDED"?i.jsx(i.Fragment,{children:i.jsx(mSe,{fetchAllWalletList:Ce})}):i.jsx(i.Fragment,{children:i.jsx(mSe,{fetchAllWalletList:Ce})})]})})]})};function Pcn({open:t,setOpen:e,copyTradeDelete:n,isDeleteWallet:r}){return i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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 $Ve=({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(Yr),{address:v}=es(),[C,N]=h.useState(!1),[I,P]=h.useState(!1),[M,F]=h.useState(""),[$,L]=h.useState(""),[z,Q]=h.useState(""),se=async()=>{var ie,ae;const de=window.localStorage.getItem("hyperToken"),G=window.localStorage.getItem("hyperAddress");if(!(!de||!G))try{setLoadingCheckAccount(!0);const q=await vi(G.toLowerCase(),de);q!=null&&q.success?(a(q==null?void 0:q.telegram_chat_id),o(q==null?void 0:q.subscriber_role),l(q==null?void 0:q.subs_expire_day),c((ie=q==null?void 0:q.mushboomer_counts)==null?void 0:ie.eth),u((ae=q==null?void 0:q.mushboomer_counts)==null?void 0:ae.sol),d(q==null?void 0:q.referral_code),f(q==null?void 0:q.refcode),x(q==null?void 0:q.whitelist),g(de),y(G),Q(q==null?void 0:q.farming_tools),setLoadingCheckAccount(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""),setLoadingCheckAccount(!1))}catch(q){console.error("Token verification error:",q),console.error(q.message||"An unknown error occurred."),setLoadingCheckAccount(!1)}},ee=async()=>new kl(window.ethereum).eth.getAccounts(G=>G),K=async(de="farming",G=24,ie=5e3)=>{G<=0||(await new Promise(ae=>setTimeout(ae,ie)),await se(),de==="farming"&&!z?K(de,G-1,ie):n())},re=async()=>{L("");const de=window.localStorage.getItem("hyperToken"),G=window.localStorage.getItem("hyperAddress");if(!de||!v){s(!0);return}P(!0),N(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(q){console.error("Failed to switch network",q),N(!1);return}const ie=new kl(window.ethereum);var ae=await ee();if(ae.length>0?ae=ae[0]:ae=void 0,ae){const W={from:ae,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await ie.eth.sendTransaction(W).then(ne=>{console.log("txHash :>> ",ne),N(!1),F(ne.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:de,payment_tx:ne.transactionHash,payment_role:r==="bots_extra_slot"?"bots_extra_slot":"farming_tools"})}),se(),K(r)}).catch(ne=>{console.log(ne),ne.code===-32003||ne.message.includes("insufficient funds")?L("Insufficient funds."):ne.message==="MetaMask Tx Signature: User denied transaction signature."&&P(!1)})}else await ie.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:I,setOpen:P,transactionHash:M,transactionLoading:C,paymentPresaleRole:z,errorFunds:$,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[51] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>e(!1)}),i.jsx("div",{className:"relative w-[380px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#404040] max-h-[97dvh] overflow-y-auto p-5",children:i.jsxs("div",{className:"flex flex-col w-full gap-8 py-6",children:[i.jsx("div",{className:"mx-auto",children:i.jsx("img",{src:qj,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:()=>{re()},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"})]})})]})]})},Fcn=({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(Yr),{isConnected:N,address:I}=es(),[P,M]=h.useState(!1),[F,$]=h.useState(null),[L,z]=h.useState(""),[Q,se]=h.useState(""),[ee,K]=h.useState([]),[re,de]=h.useState(!1),[G,ie]=h.useState({}),[ae,q]=h.useState({}),[W,ne]=h.useState([]),[oe,he]=h.useState([]),[_e,xe]=h.useState(null),[Se,ge]=h.useState(!1),[Ce,je]=h.useState(!1),[Oe,$e]=h.useState(!1),[Ye,Je]=h.useState([]),ht=h.useRef(null),[rt,st]=h.useState([]),He=h.useRef(!1);h.useEffect(()=>{const We={};n==null||n.forEach(It=>{const Ge=`${It==null?void 0:It.wm_address}_${It==null?void 0:It.wallet_address}_${It==null?void 0:It.wallet_id}`;We[Ge]=It==null?void 0:It.copy_trait_mode}),ie(We),!He.current&&(n==null?void 0:n.length)>0&&(bt(),He.current=!0)},[n]),h.useEffect(()=>{if((n==null?void 0:n.length)>0){const We=[...n];(W==null?void 0:W.length)>0&&W.forEach(It=>{var Ge;((Ge=It.openPositionCoinList)==null?void 0:Ge.length)>0&&It.generated_wallet_public&&!We.some(ct=>ct.wallet_address.toLowerCase()===It.generated_wallet_public.toLowerCase())&&We.push({wallet_address:It.generated_wallet_public})}),he(It=>{const Ge=It.map(vt=>vt.wallet_address).sort().join(","),ct=We.map(vt=>vt.wallet_address).sort().join(",");return Ge!==ct?We:It})}},[n,W]);const Ve=async(We,It,Ge,ct,vt)=>{const Ht=`${We}_${It}_${vt}`;try{const Rt=window.localStorage.getItem("hyperToken"),mn="https://dextrabothypev2.nftinit.io/api/test_app/following/status/";Rt||C(!0),q(In=>({...In,[Ht]:!0}));const un=window.localStorage.getItem("hyperAddress"),_n=await(await fetch(mn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:I?I.toLowerCase():un,token:Rt,follow_address:It==null?void 0:It.toLowerCase(),copy_trait_mode:Ge,target_platform:ct,wallet_id:vt})})).json();_n.success?(ie(In=>({...In,[Ht]:Ge})),f()):(console.log(_n.error_message),dn.error(_n.error_message))}catch(Rt){console.error("Error status mode:",Rt),dn.error(Rt.message||"Something went wrong!")}finally{q(Rt=>({...Rt,[Ht]:!1}))}},bt=async()=>{try{const We=window.localStorage.getItem("hyperToken"),It=window.localStorage.getItem("hyperAddress"),Ge="https://dextrabothypev2.nftinit.io/api/wallet/generated_wallet_summary";We||C(!0);const ct=await fetch(Ge,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:I?I.toLowerCase():It,token:We})});if(!ct.ok)throw new _l(`Server responded with status ${ct.status}`);const vt=await ct.json();vt.success?ne(vt.data):(console.log(vt.error_message),dn.error(vt.error_message))}catch(We){console.error("Error in like function:",We),dn.error(We.message||"Something went wrong!")}},xt="tag",[Qt,St]=h.useState(xt),on=(We,It,Ge,ct)=>We!=null&&We.length?[...We].sort((vt,Ht)=>{var vn,Wn,On,$t;if(!G||Object.keys(G).length===0)return 0;const Rt=`${vt.wm_address}_${vt.wallet_address}_${vt.wallet_id}`,mn=`${Ht.wm_address}_${Ht.wallet_address}_${Ht.wallet_id}`;if(G!=null&&G[Rt]&&!(G!=null&&G[mn]))return-1;if(!(G!=null&&G[Rt])&&(G!=null&&G[mn]))return 1;const un=Ge.find(Nn=>Nn.wallet_address===vt.wallet_address)||{},yn=Ge.find(Nn=>Nn.wallet_address===Ht.wallet_address)||{},_n=Ge.find(Nn=>{var Fn,Tt;return((Fn=Nn.wallet_address)==null?void 0:Fn.toLowerCase())===((Tt=vt==null?void 0:vt.wm_address)==null?void 0:Tt.toLowerCase())})||{},In=Ge.find(Nn=>{var Fn,Tt;return((Fn=Nn.wallet_address)==null?void 0:Fn.toLowerCase())===((Tt=Ht==null?void 0:Ht.wm_address)==null?void 0:Tt.toLowerCase())})||{},Sn=un.data?un.data.reduce((Nn,Fn)=>Nn+parseFloat(Fn.unrealizedPnl||0),0):0,Yn=yn.data?yn.data.reduce((Nn,Fn)=>Nn+parseFloat(Fn.unrealizedPnl||0),0):0,Xn=ct==null?void 0:ct.find(Nn=>{var Fn,Tt,pn,ke;return((Fn=Nn==null?void 0:Nn.generated_wallet_public)==null?void 0:Fn.toLowerCase())===((Tt=vt==null?void 0:vt.wm_address)==null?void 0:Tt.toLowerCase())&&((pn=Nn==null?void 0:Nn.copy_trader_wallet)==null?void 0:pn.toLowerCase())===((ke=vt==null?void 0:vt.wallet_address)==null?void 0:ke.toLowerCase())}),zn=ct==null?void 0:ct.find(Nn=>{var Fn,Tt,pn,ke;return((Fn=Nn==null?void 0:Nn.generated_wallet_public)==null?void 0:Fn.toLowerCase())===((Tt=Ht==null?void 0:Ht.wm_address)==null?void 0:Tt.toLowerCase())&&((pn=Nn==null?void 0:Nn.copy_trader_wallet)==null?void 0:pn.toLowerCase())===((ke=Ht==null?void 0:Ht.wallet_address)==null?void 0:ke.toLowerCase())}),Kn=Xn?Xn.total_pnl:0,jn=zn?zn.total_pnl:0,De=Xn&&((vn=Xn.openPositionCoinList)==null?void 0:vn.length)>0&&((Wn=_n.data)==null?void 0:Wn.length)>0?Xn.openPositionCoinList.reduce((Nn,Fn)=>{const Tt=_n.data.find(pn=>pn.asset===Fn);return Tt!=null&&Tt.unrealizedPnl?Nn+parseFloat(Tt.unrealizedPnl):Nn},0):0,pe=zn&&((On=zn.openPositionCoinList)==null?void 0:On.length)>0&&(($t=In.data)==null?void 0:$t.length)>0?zn.openPositionCoinList.reduce((Nn,Fn)=>{const Tt=In.data.find(pn=>pn.asset===Fn);return Tt!=null&&Tt.unrealizedPnl?Nn+parseFloat(Tt.unrealizedPnl):Nn},0):0,qe=vt.tag?vt.tag.toUpperCase():"",Ae=Ht.tag?Ht.tag.toUpperCase():"",ze=vt.wm_name?vt.wm_name.toUpperCase():"",zt=Ht.wm_name?Ht.wm_name.toUpperCase():"",kt=vt.wallet_address?vt.wallet_address.toLowerCase():"",gt=Ht.wallet_address?Ht.wallet_address.toLowerCase():"",Mt=vt.wm_address?vt.wm_address.toLowerCase():"",ln=Ht.wm_address?Ht.wm_address.toLowerCase():"";return It==="tag"?qe<Ae?-1:qe>Ae?1:0:It==="-tag"?qe>Ae?-1:qe<Ae?1:0:It==="-wallet_address"?kt<gt?-1:kt>gt?1:0:It==="wallet_address"?kt>gt?-1:kt<gt?1:0:It==="-wm_address"?Mt<ln?-1:Mt>ln?1:0:It==="wm_address"?Mt>ln?-1:Mt<ln?1:0:It==="perp_equity"?(un.perp_equity||0)-(yn.perp_equity||0):It==="-perp_equity"?(yn.perp_equity||0)-(un.perp_equity||0):It==="margin_usage"?(un.margin_usage||0)-(yn.margin_usage||0):It==="-margin_usage"?(yn.margin_usage||0)-(un.margin_usage||0):It==="unrealizedPnl"?Sn-Yn:It==="-unrealizedPnl"?Yn-Sn:It==="-wm_name"?ze<zt?-1:ze>zt?1:0:It==="wm_name"?ze>zt?-1:ze<zt?1:0:It==="total_pnl"?Kn-jn:It==="-total_pnl"?jn-Kn:It==="totalUnrealizedPnl"?De-pe:It==="-totalUnrealizedPnl"?pe-De:It==="-created_at"?new Date(Ht.created_at)-new Date(vt.created_at):It==="created_at"?new Date(vt.created_at)-new Date(Ht.created_at):0}):[];h.useEffect(()=>{if(!(n!=null&&n.length))return;const We=n.filter(It=>!!(!(Ye!=null&&Ye.length)||Ye.includes("HyperLiquid")&&It.target_platform==="hyper"||Ye.includes("Lighter")&&It.target_platform==="lighter"));st(on(We,Qt,ee,W))},[Qt,n,Ye]);const cn=async(We,It)=>{try{z(We),se(It);const Ge=window.localStorage.getItem("hyperToken"),ct=window.localStorage.getItem("hyperAddress"),vt="https://dextrabothypev2.nftinit.io/api/test_app/following/info/";Ge||C(!0);const Ht=await fetch(vt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:I?I.toLowerCase():ct,token:Ge,follow_address:We.toLowerCase()})});if(!Ht.ok)throw new _l(`Server responded with status ${Ht.status}`);const Rt=await Ht.json();Rt.success?($(Array.isArray(Rt==null?void 0:Rt.data)?[...Rt.data].sort((mn,un)=>new Date(un.created_at||0)-new Date(mn.created_at||0)):Rt==null?void 0:Rt.data),M(!0)):(console.log(Rt.error_message),dn.error(Rt.error_message))}catch(Ge){console.error("Error in like function:",Ge),dn.error(Ge.message||"Something went wrong!")}},Vn=We=>We!=null&&We.assetPositions?We.assetPositions.filter(It=>{if(!It.position||!It.position.szi)return!1;const Ge=parseFloat(It.position.szi);return!isNaN(Ge)&&Ge!==0}).map(It=>{const Ge=It.position,ct=parseFloat(Ge.szi),vt=parseFloat(Ge.entryPx),Ht=parseFloat(Ge.positionValue),Rt=parseFloat(Ge.unrealizedPnl),mn=parseFloat(Ge.returnOnEquity)*100,un=parseFloat(Ge.marginUsed),yn=Ge.leverage.value,_n=parseFloat(Ge.cumFunding.sinceOpen),In=ct>0?"Long":"Short";return{asset:Ge.coin,type:In,size:Math.abs(ct),entryPrice:vt.toFixed(2),currentPrice:(Ht/Math.abs(ct)).toFixed(2),leverage:yn,positionValue:Ht.toFixed(2),marginUsed:un.toFixed(2),unrealizedPnl:Rt.toFixed(2),roe:mn.toFixed(2),funding:_n.toFixed(4),liquidationPrice:Ge.liquidationPx?parseFloat(Ge.liquidationPx).toFixed(2):"N/A"}}):[],tn=async We=>{try{const Ge=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:We});if(Ge.data){const ct=Vn(Ge.data);K(vt=>{var Ht,Rt,mn,un;return[...vt,{wallet_address:We,perp_equity:(Rt=(Ht=Ge==null?void 0:Ge.data)==null?void 0:Ht.marginSummary)==null?void 0:Rt.accountValue,margin_usage:parseFloat((mn=Ge==null?void 0:Ge.data)==null?void 0:mn.marginSummary.totalMarginUsed)/parseFloat((un=Ge==null?void 0:Ge.data)==null?void 0:un.marginSummary.accountValue),data:ct}]})}}catch(It){console.error("Error fetching user state from HyperState:",It)}},fn=async We=>{try{const It=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress"),vt=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/trade/getclearinghousestate/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:I?I.toLowerCase():Ge,token:It,follow_address:We.toLowerCase()})});if(vt.ok){const Ht=await vt.json();if(Ht.success){const Rt=Vn(Ht==null?void 0:Ht.data);K(mn=>{var un;return[...mn,{wallet_address:We,perp_equity:(un=Ht==null?void 0:Ht.data.marginSummary)==null?void 0:un.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(vt.status===500)console.warn(`Received 500 error for ${We}, retrying with getUserHyperState`),await tn(We);else throw new _l(`Request failed with status ${vt.status}`)}catch(It){console.error("Error fetching user state:",It)}},rn=h.useRef(new Set);h.useEffect(()=>{!t&&r&&(oe==null?void 0:oe.length)>0&&(async()=>{var Ge;const It=new Set;for(let ct=0;ct<oe.length;ct++){const vt=oe[ct],Ht=(Ge=vt==null?void 0:vt.wallet_address)==null?void 0:Ge.toLowerCase();if(!(!Ht||rn.current.has(Ht))){It.add(Ht),rn.current.add(Ht);try{await fn(Ht)}catch(Rt){console.error(`Error fetching user state for wallet ${Ht}:`,Rt)}await new Promise(Rt=>setTimeout(Rt,500))}}})()},[r,t,oe]),h.useEffect(()=>{P||f()},[P]);const nt=h.useRef(null),it=()=>{nt.current&&(nt.current.scrollLeft-=100)},Ut=()=>{nt.current&&(nt.current.scrollLeft+=100)},hn=()=>{nt.current&&(nt.current.scrollTop+=200)},nn=()=>{nt.current&&(nt.current.scrollTop-=200)},Vt=["HyperLiquid","Lighter"],pt=We=>{Je(It=>It.includes(We)?It.filter(Ge=>Ge!==We):[...It,We])};return h.useEffect(()=>{function We(It){ht.current&&!ht.current.contains(It.target)&&$e(!1)}return document.addEventListener("mousedown",We),()=>document.removeEventListener("mousedown",We)},[]),i.jsxs(i.Fragment,{children:[i.jsx(U5,{open:P,setOpen:M,copyTradeData:F,copyTradeWallet:L,setCopyTradeWallet:z,setCopyTradeData:$,sourcePage:Q}),i.jsx(Pcn,{open:o,setOpen:l,copyTradeDelete:s,isDeleteWallet:c}),Se&&_a.createPortal(i.jsx(aue,{open:Se,setOpen:ge,oldSlotCount:_e,checkAccountTrade:f,tradeMarket:"copyTrade"}),document.body),Ce&&_a.createPortal(i.jsx($Ve,{open:Ce,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:it,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{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(eo,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:nn,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(eo,{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(eo,{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:nt,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:()=>{$e(!Oe)},className:`${Ye.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 ${Ye.length>0?"text-blue-500":"text-white"}`})}),Oe&&i.jsxs("div",{ref:ht,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:()=>Je(""),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:Ye.includes(We),onChange:()=>pt(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 ${Ye.includes(We)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Ye.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:Qt,setSortOption:St,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:Qt,setSortOption:St,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:Qt,setSortOption:St,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:Qt,setSortOption:St,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] pl-1",children:i.jsx(hi,{title:"Follower PnL",sortKey:"total_pnl",sortOption:Qt,setSortOption:St,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] pl-1",children:i.jsx(hi,{title:"Follower uPnL",sortKey:"totalUnrealizedPnl",sortOption:Qt,setSortOption:St,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:Qt,setSortOption:St,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:Qt,setSortOption:St,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:Qt,setSortOption:St,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:Qt,setSortOption:St,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(Ba,{})})})}):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(_l,{})})})}):(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:Kl,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."]})]})]})]})})})})}):rt==null?void 0:rt.map((We,It)=>{var un,yn,_n,In,Sn;const Ge=ee.find(Yn=>Yn.wallet_address===We.wallet_address),ct=ee.find(Yn=>Yn.wallet_address===(We==null?void 0:We.wm_address)),vt=W==null?void 0:W.find(Yn=>{var Xn,zn,Kn,jn;return((Xn=Yn==null?void 0:Yn.generated_wallet_public)==null?void 0:Xn.toLowerCase())===((zn=We==null?void 0:We.wm_address)==null?void 0:zn.toLowerCase())&&((Kn=Yn==null?void 0:Yn.copy_trader_wallet)==null?void 0:Kn.toLowerCase())===((jn=We==null?void 0:We.wallet_address)==null?void 0:jn.toLowerCase())}),Ht=vt?vt.total_pnl:null;let Rt=0;vt&&((un=vt==null?void 0:vt.openPositionCoinList)==null?void 0:un.length)>0&&((yn=ct==null?void 0:ct.data)==null?void 0:yn.length)>0&&((_n=vt==null?void 0:vt.openPositionCoinList)==null||_n.forEach(Yn=>{var zn;const Xn=(zn=ct==null?void 0:ct.data)==null?void 0:zn.find(Kn=>{var jn;return((jn=Kn==null?void 0:Kn.asset)==null?void 0:jn.toLowerCase().trim())===(Yn==null?void 0:Yn.toLowerCase().trim())});Xn&&(Xn!=null&&Xn.unrealizedPnl)&&(Rt+=parseFloat(Xn==null?void 0:Xn.unrealizedPnl))}));const mn=`${We.follower_wallet}_${We.wallet_address}_${We.wallet_id}`;return i.jsxs("tr",{className:`${It%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${It%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),Xn=`${We==null?void 0:We.wm_address}_${We==null?void 0:We.wallet_address}_${We==null?void 0:We.wallet_id}`,zn=d===0&&!G[Xn]&&!Yn,Kn=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(Fo,{checked:!!G[Xn],onChange:()=>{if(!Kn&&(We==null?void 0:We.target_platform)==="lighter"){je(!0);return}if(zn&&(We==null?void 0:We.target_platform)==="lighter"){xe(y),ge(!0);return}Ve(We==null?void 0:We.wm_address,We.wallet_address,!G[Xn],We==null?void 0:We.target_platform,We==null?void 0:We.wallet_id)},disabled:ae[Xn],className:`${G[Xn]?"bg-[#1DE674]":"bg-[#353535]"} ${ae[Xn]?"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[Xn]?"translate-x-1.5 bg-white":"-translate-x-[1px] bg-[#D5D5D5]"} inline-block size-[14px] -mt-[3px] rounded-full shadow-lg transition`})}),!Kn&&(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"}):zn&&(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"})]}),ae[Xn]?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[Xn]?"On":"Off"]})})()}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} sm:sticky left-[95px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-0.5 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{onClick:()=>{cn(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($5,{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:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${It%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(Us,{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(Us,{content:"Hyperliquid",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:P1,alt:"",className:"w-4 h-4 text-[#fff]"})})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(Us,{content:"Dextrabot",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:Ki,alt:"",className:"w-4 h-4 text-[#fff]"})})})})})})}),i.jsx("td",{scope:"row",className:`${It%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(na,{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(Ma,{content:`${We==null?void 0:We.wm_name}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${It%2===0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{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(na,{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),dn.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:_o,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{scope:"row",className:`${It%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(na,{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(Ma,{content:`${We==null?void 0:We.tag}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${It%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(na,{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),dn.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:_o,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{children:i.jsx(Fh,{info:Ht!==null?`$${Er(Math.abs(Ht))}`:"--",textColor:`${Ht>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:i.jsx(Fh,{info:vt?`$${Er(Math.abs(Rt))}`:"--",textColor:`${Rt>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:re?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):Ge?i.jsx(Fh,{info:(Ge==null?void 0:Ge.perp_equity)!=0?`$${Er(Ge==null?void 0:Ge.perp_equity)}`:"$0",textColor:"text-white"}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:re?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):Ge?i.jsx(Fh,{info:isNaN(Ge==null?void 0:Ge.margin_usage)?"0%":`${((Ge==null?void 0:Ge.margin_usage)*100).toFixed(2)}%`,textColor:"text-white"}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:re?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):Ge?i.jsx(Fh,{info:(Ge==null?void 0:Ge.data)!=0?`$${Er(Math.abs((In=Ge==null?void 0:Ge.data)==null?void 0:In.reduce((Yn,Xn)=>Yn+parseFloat(Xn.unrealizedPnl||0),0)))}`:"$0",textColor:`${((Sn=Ge==null?void 0:Ge.data)==null?void 0:Sn.reduce((Yn,Xn)=>Yn+parseFloat(Xn.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)&&M3(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[mn]?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"})})})})]},It)})})]})})]})]})]})},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})}),Ocn=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1),{isConnected:s,address:a}=es(),{copyTradeWatchList:o,getCopyTradeWatchList:l,trackedWatchList:c,getTrackedWatchList:u,copyWatchListLoading:d,copyWatchListError:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setIsWhitelist:C,setMushboomerSOL:N,setIsReferralCode:I,setIsReferralCodeName:P,setHyperToken:M,setHyperAddress:F,hyperToken:$}=h.useContext(Yr),[L,z]=h.useState({}),[Q,se]=h.useState(!1),[ee,K]=h.useState({followerWallet:"",sourceWallet:"",platform:"",id:null}),[re,de]=h.useState(0),[G,ie]=h.useState([]),[ae,q]=h.useState(""),[W,ne]=h.useState(0);h.useEffect(()=>{$&&(l(),u(),e(!0),r(!0))},[$]);const oe=async()=>{var ge,Ce,je,Oe;const xe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!(!xe||!Se))try{const $e=await vi(Se.toLowerCase(),xe);$e!=null&&$e.success?(x($e==null?void 0:$e.telegram_chat_id),g($e==null?void 0:$e.subscriber_role),y($e==null?void 0:$e.subs_expire_day),v((ge=$e==null?void 0:$e.mushboomer_counts)==null?void 0:ge.eth),N((Ce=$e==null?void 0:$e.mushboomer_counts)==null?void 0:Ce.sol),I($e==null?void 0:$e.referral_code),P($e==null?void 0:$e.refcode),C($e==null?void 0:$e.whitelist),de((je=$e==null?void 0:$e.copy_trade_slots_info)==null?void 0:je.total_slot_count),ie($e==null?void 0:$e.copy_trade_slots_wallets),q($e==null?void 0:$e.farming_tools),ne((Oe=$e==null?void 0:$e.copy_trade_slots_info)==null?void 0:Oe.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),M(""),F(""))}catch($e){console.error("Token verification error:",$e)}};h.useEffect(()=>{oe()},[]);const he=async(xe,Se,ge,Ce)=>{const je=`${xe}_${Se}_${Ce}`;try{const Oe=window.localStorage.getItem("hyperToken"),$e="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/";if(!Oe||!Se||!ge||!Ce||!xe)throw new Error("Required information is missing. Please log in or connect your wallet.");z(rt=>({...rt,[je]:!0}));const Ye=window.localStorage.getItem("hyperAddress"),Je=await fetch($e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Ye,token:Oe,follow_address:Se.toLowerCase(),target_platform:ge,wallet_id:Ce})});if(!Je.ok)throw new Error(`Failed to unlike: ${Je.status} ${Je.statusText}`);const ht=await Je.json();ht.success?(z(rt=>({...rt,[je]:!1})),l(),se(!1),K({followerWallet:"",sourceWallet:"",platform:"",id:null}),oe(),dn.success(`${Se==null?void 0:Se.slice(0,5)}...${Se==null?void 0:Se.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"}})):(dn.error(ht.error_message),z(rt=>({...rt,[je]:!1})),se(!1))}catch(Oe){dn.error(Oe.message||"Something went wrong!"),z($e=>({...$e,[je]:!1})),se(!1)}},_e=!!window.localStorage.getItem("hyperToken");return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsx(no,{children:_e?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:_e?i.jsx(Fcn,{loading:d,error:f,trackerData:o,isRequest:t,handleCopyDelete:he,deleteLoading:L,isDeleteModalOpen:Q,setIsDeleteModalOpen:se,isDeleteWallet:ee,setIsDeleteWallet:K,slotTotalCount:re,checkSlotAccount:oe,slotCountWallets:G,subsRole:ae,slotCount:W}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(pz,{})})})})]})},Mcn=({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,N)=>{const I=parseFloat(C[x])||0,P=parseFloat(N[x])||0;return I<P?y==="asc"?-1:1:I>P?y==="asc"?1:-1:0});a(v),l({key:x,direction:y})},f=x=>o.key!==x?i.jsx(a2,{className:"inline ml-2 text-white"}):o.direction==="asc"?i.jsx(i2,{className:"inline ml-2 text-white"}):i.jsx(s2,{className:"inline ml-2 text-white"});return i.jsx("div",{className:"overflow-x-auto mobile-scroll-indicator",children:i.jsxs("table",{className:"w-full text-white min-w-[900px]",children:[i.jsx("thead",{className:"text-left",children:i.jsxs("tr",{children:[i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer flex items-center text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("ranking"),children:["# ",f("ranking")]}),i.jsx("th",{className:"px-3 sm:px-6 py-3 sm:py-4 text-gray-300 font-semibold text-xs sm:text-sm",children:"Wallet"}),i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("overall_point_result"),children:[i.jsx("span",{className:"hidden sm:inline",children:"XP"}),i.jsx("span",{className:"sm:hidden",children:"Points"})," ",f("overall_point_result")]}),i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("referral_xp"),children:[i.jsx("span",{className:"hidden sm:inline",children:"Referral XP"}),i.jsx("span",{className:"sm:hidden",children:"Ref XP"})," ",f("referral_xp")]})]})}),i.jsx("tbody",{children:s.slice((n-1)*r,n*r).map((x,g)=>{const y=(n-1)*r+g,v=y%2===0?"bg-[#1b1b1b]":"bg-[#1f1f1f]",C=x.owner?"bg-[#162720] ring-1 ring-emerald-400/30":"";return i.jsxs("tr",{className:`${v} ${C} group text-white transition-colors hover:bg-[#222222]`,children:[i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsx("span",{className:"text-sm sm:text-lg font-bold",children:x.ranking||"Unranked"})}),i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx("span",{className:"font-mono text-xs sm:text-sm",children:XB(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:Er(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:Er(x.referral_xp??x.calculated_xp??0)})})]},y)})})]})})},Rcn=({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 N="asc";c.key===C&&c.direction==="asc"&&(N="desc");const I=[...s].sort((P,M)=>{const F=parseFloat(P[C])||0,$=parseFloat(M[C])||0;return F<$?N==="asc"?-1:1:F>$?N==="asc"?1:-1:0});a(I),u({key:C,direction:N})},f=C=>c.key!==C?i.jsx(a2,{className:"inline ml-2 text-white"}):c.direction==="asc"?i.jsx(i2,{className:"inline ml-2 text-white"}):i.jsx(s2,{className:"inline ml-2 text-white"});return i.jsx("div",{className:"mx-auto w-full sm:w-4/6 overflow-x-auto shadow-lg mt-[24px] h-[100vh] overflow-auto rounded-xl bg-[#161616]",children:i.jsxs("table",{className:"table-fixed min-w-full text-white border-separate border-spacing-y-2 rounded-xl",children:[i.jsx("thead",{className:"text-left sticky -top-1 z-10",children:i.jsxs("tr",{className:"text-white font-manrope text-[14px] font-semibold leading-[13px] tracking-[0.26px] bg-[#161616]",children:[i.jsxs("th",{className:"px-4 py-3 cursor-pointer flex items-center",onClick:()=>d("ranked"),children:["# ",f("ranked")]}),i.jsx("th",{className:"px-4 py-3",children:"Wallet"}),i.jsxs("th",{className:"flex items-center px-4 py-3",children:[i.jsx("span",{className:"text-[#67FFBD] [text-shadow:0px_0px_8px_rgba(103,255,189,0.48)] font-manrope text-[14px] not-italic font-semibold leading-[32px] tracking-[0.56px]",children:"Booster"}),i.jsx("img",{src:Tlt,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:Ilt,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:ame,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:ome,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:Er(e.daily_point_result)}),i.jsx("td",{className:"px-4 py-3 font-semibold rounded-br-2xl rounded-tr-2xl text-right",children:Er(e.total_pnl)})]}):(o||l)&&(!e||Object.keys(e).length===0)?i.jsxs("tr",{className:"text-white font-manrope text-[14px] font-bold leading-[13px] tracking-[0.28px] bg-[#2D2D2D]",children:[i.jsx("td",{className:"h-[inherit] rounded-l-2xl p-0",children:i.jsx("div",{className:"bg-[#525252] min-w-[48px] w-fit px-2 h-12 flex items-center justify-center text-white font-bold text-[18px] first:rounded-tl-2xl first:rounded-bl-2xl font-manrope",children:"Unranked"})}),i.jsx("td",{className:"px-4 py-3 font-bold text-[#67FFBD]",children:"You"}),i.jsx("td",{className:"px-4 py-3 text-[#FFF] font-semibold",children:"-"}),i.jsx("td",{className:"px-4 py-3 font-bold flex items-center gap-2",children:"-"}),i.jsx("td",{className:"px-4 py-3 font-semibold rounded-br-2xl rounded-tr-2xl text-right",children:"-"})]}):null,s.slice((n-1)*r,n*r).map((C,N)=>{const I=(n-1)*r+N,P=I%2===0?"bg-[#1b1b1b]":"bg-[#1f1f1f]",M=C.owner?"bg-[#162720] ring-1 ring-emerald-400/30":"";return i.jsxs("tr",{className:`text-white h-[50px] font-manrope text-[14px] font-bold leading-[13px] tracking-[0.28px] ${P} ${M} group hover:bg-[#222222]`,children:[i.jsx("td",{className:"h-[inherit] rounded-l-2xl p-0",children:i.jsx("div",{className:`min-w-[48px] w-fit px-2 h-full flex items-center justify-center text-black font-bold text-[18px] first:rounded-tl-2xl first:rounded-bl-2xl ${C.ranked===1?"bg-[#67FFBD]":C.ranked===2?"bg-[#D65AFF]":C.ranked===3?"bg-[#36C9FF]":"bg-[#2D2D2D] text-white"}`,children:C.ranked||"Unranked"})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("div",{className:"flex justify-left items-center gap-2 cursor-pointer",children:i.jsx("span",{className:"w-[75px]",children:XB(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:ame,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:ome,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:Er(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:Er(C.total_pnl)})]},I)})]})]})})},Lcn="/assets/bg_-D6bvhHQD.png",Dcn=({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"})})})]}),Bcn=({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"})})})]}),$cn=()=>{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,N]=h.useState(1),I=25,P=h.useRef(null),M=h.useRef(null),{isConnected:F,address:$}=es(),{openConnectModal:L}=B5(),{walletLogin:z,signIn:Q,hyperToken:se,hyperAddress:ee,setSignInConnectButtonOpen:K,isReferralCodeName:re}=h.useContext(Yr),de=()=>{F?window.localStorage.getItem("hyperToken")&&se?z():Q(1):(L(),K(!0))},G=re||window.localStorage.getItem("refcode")||"",ie=G?`https://app.dextrabot.com/referral/${G}`:"",ae=()=>{if(!ee||!se){de();return}f(!0)},q=()=>{if(!ee||!se){de();return}g(!0)},W=Ve=>{Ve&&(navigator.clipboard.writeText(Ve),dn.success("Copied to clipboard"))},ne=async()=>{var Ve;if(P.current)try{(Ve=document==null?void 0:document.fonts)!=null&&Ve.ready&&await document.fonts.ready;const bt=await V1(P.current,{cacheBust:!0,backgroundColor:"#040707",pixelRatio:2}),xt=document.createElement("a");xt.href=bt,xt.download="dextrabot-leaderboard-rank.png",document.body.appendChild(xt),xt.click(),document.body.removeChild(xt),dn.success("Image downloaded")}catch(bt){console.error("Share card download error",bt),dn.error("Failed to download image")}};h.useCallback(()=>{ps.get("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/").then(bt=>{const xt=(bt.data.data||[]).map(Qt=>({ranking:Qt.rank_position,out_subscriber_address:Qt.address,overall_pos_value:Qt.total_volume,calculated_xp:Qt.total_xp,overall_point_result:Qt.total_xp,referral_xp:Qt.ref_bf_xp,refCode:Qt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Qt.owner}));e(xt)}).catch(bt=>{console.error("Error fetching volume data:",bt)})},[]),h.useEffect(()=>{const Ve="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",bt=xt=>(xt||[]).map(Qt=>({ranking:Qt.rank_position,out_subscriber_address:Qt.address,overall_pos_value:Qt.total_volume,calculated_xp:Qt.total_xp,overall_point_result:Qt.total_xp,referral_xp:Qt.ref_bf_xp,refCode:Qt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Qt.owner}));ps.get(Ve).then(xt=>{const Qt=bt(xt.data.data);e(Qt),r(Qt)}).catch(xt=>{console.error("Error fetching leaderboard data:",xt),e([]),r([])})},[]);const oe=h.useCallback(()=>{M.current&&M.current.abort();const Ve=ee||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),bt=se||typeof window<"u"&&window.localStorage.getItem("hyperToken");if(Ve&&bt){v(!0);const xt="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",Qt=new AbortController;M.current=Qt,ps.post(xt,{address:Ve,token:bt},{headers:{"Content-Type":"application/json"},signal:Qt.signal}).then(St=>{if(!Qt.signal.aborted){if(St.data.ownerRank)a(St.data.ownerRank);else if(St.data.data){const on=St.data.data.find(cn=>{var Vn;return((Vn=cn.address)==null?void 0:Vn.toLowerCase())===(Ve==null?void 0:Ve.toLowerCase())});a(on?{ranking:on.rank_position,rank_position:on.rank_position,overall_pos_value:on.total_volume,total_volume:on.total_volume,calculated_xp:on.total_xp,total_xp:on.total_xp,overall_point_result:on.total_xp,referral_xp:on.ref_bf_xp,refCode:on.refCode}:null)}else a(null);v(!1)}}).catch(St=>{St.name!=="CanceledError"&&!Qt.signal.aborted&&(console.error("API Error (Volume):",St),v(!1))})}else a(null),v(!1)},[ee,se]),he=h.useCallback(()=>{const Ve=ee||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),bt=se||typeof window<"u"&&window.localStorage.getItem("hyperToken");Ve&&bt?ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",{address:Ve,token:bt},{headers:{"Content-Type":"application/json"}}).then(xt=>{if(xt.data.ownerRanks)l(xt.data.ownerRanks[0]);else if(xt.data.ownerRank)l(xt.data.ownerRank);else if(xt.data.data){const Qt=xt.data.data.find(St=>{var on;return((on=St.address)==null?void 0:on.toLowerCase())===(Ve==null?void 0:Ve.toLowerCase())});l(Qt?{ranked:Qt.rank_position,rank_position:Qt.rank_position,subscriber_address:Qt.address,total_pnl:Qt.total_xp,daily_point_result:Qt.daily_point_result||0,mushInfo:Qt.mushInfo||{eth:0,sol:0}}:null)}else l(null)}).catch(xt=>console.error("API Error (PnL):",xt)):l(null)},[ee,se]);h.useEffect(()=>{oe(),c==="pnl"&&he();const Ve=()=>{oe(),c==="pnl"&&he()};return window.addEventListener("localStorageUpdated",Ve),()=>{window.removeEventListener("localStorageUpdated",Ve),M.current&&M.current.abort()}},[ee,se,c,oe,he]);const _e=h.useMemo(()=>c==="volume"?s:o,[c,s,o]),xe=h.useMemo(()=>(_e==null?void 0:_e.ranking)??"--",[_e==null?void 0:_e.ranking]),Se=h.useMemo(()=>(_e==null?void 0:_e.overall_pos_value)??(_e==null?void 0:_e.total_volume)??0,[_e==null?void 0:_e.overall_pos_value,_e==null?void 0:_e.total_volume]),ge=h.useMemo(()=>(_e==null?void 0:_e.calculated_xp)??(_e==null?void 0:_e.total_xp)??0,[_e==null?void 0:_e.calculated_xp,_e==null?void 0:_e.total_xp]),Ce=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]),Oe=h.useMemo(()=>s?s.rank_position??s.ranking??"Unranked":"Unranked",[s]),$e=h.useMemo(()=>c==="volume"?t:n,[c,t,n]),Ye=h.useMemo(()=>Math.ceil($e.length/I),[$e.length,I]),Je=$e.length;h.useEffect(()=>{N(1)},[c]);const ht=h.useCallback(Ve=>{Ve>=1&&Ve<=Ye&&(N(Ve),window.scrollTo({top:0,behavior:"smooth"}))},[Ye]),rt=_e?`Here’s my @Dextrabot rank #${xe}. Volume (All Time): $${Er(Se)} · XP: ${Er(ge)}. Farming points and stacking profit at the same time.`:"Here’s my @Dextrabot rank. Farming points and stacking profit at the same time.",st=ie||"https://app.dextrabot.com/leaderboard",He=`https://x.com/intent/post?text=${encodeURIComponent(rt)}&url=${encodeURIComponent(st)}`;return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(${Lcn})`}}),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:ee&&se?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:XB(ee)})]}):i.jsx("button",{onClick:de,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&&ee&&se?"...":ee&&se&&s?Er(Ce):"0"}),i.jsx(Dcn,{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&&ee&&se?"...":ee&&se&&s?Er(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&&ee&&se?"...":ee&&se&&s?Oe:"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:q,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(Bcn,{className:"w-3 h-3"})]})]}),i.jsx("button",{onClick:ae,className:"flex items-center justify-center text-black px-4 py-2 rounded-2xl font-semibold transition-colors text-sm h-10 w-full sm:w-20 bg-[#1DE674]",children:"Invite"})]})]})}),i.jsxs("div",{className:"mb-8 sm:mb-12",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 sm:gap-6 mt-12 sm:mt-16 mb-0",children:[i.jsx("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold text-white",children:"Leaderboard"}),$e.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(Vs,{className:"text-white hidden sm:block"}),i.jsx("span",{className:"text-white",children:Je}),i.jsx("span",{className:"text-white",children:"wallets found"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>ht(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(Ye,1)]}),i.jsx("button",{onClick:()=>ht(C+1),disabled:C===Ye||Ye===0,className:`${C===Ye||Ye===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===Ye||Ye===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(Mcn,{volumeLeaderboardData:t,userData:s,currentPage:C,rowsPerPage:I}):c==="pnl"?i.jsx(Rcn,{pnlLeaderboardData:n,userData:o,currentPage:C,rowsPerPage:I}):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:()=>W(G),children:i.jsx("img",{src:KM,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:()=>W(ie),children:i.jsx("img",{src:KM,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:P,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:qj,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:(_e==null?void 0:_e.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:["$",Er((_e==null?void 0:_e.overall_pos_value)??(_e==null?void 0:_e.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:Er((_e==null?void 0:_e.calculated_xp)??(_e==null?void 0:_e.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"})})]})]}),!_e&&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:ne,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:!_e,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 Ucn({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 zcn=h.forwardRef(Ucn);function Hcn({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 Vcn=h.forwardRef(Hcn);function Wcn({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 qcn=h.forwardRef(Wcn);function Gcn({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 W9=h.forwardRef(Gcn);function Kcn({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 Ycn=h.forwardRef(Kcn);function Xcn({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 rQ=h.forwardRef(Xcn);function Qcn({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 Zcn=h.forwardRef(Qcn);function Jcn({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 UVe=h.forwardRef(Jcn);function eun({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 tun=h.forwardRef(eun);function nun({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 Cde=h.forwardRef(nun),xSe=[{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 run(...t){return t.filter(Boolean).join(" ")}const Sde=({scrollToFeatures:t,scrollToHowItWorks:e,scrollToFAQ:n})=>i.jsxs(J7e,{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(LB,{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:Glt,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(Tie,{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(qcn,{"aria-hidden":"true",className:"block size-6 group-data-[open]:hidden"}),i.jsx(Cde,{"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:xSe.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:run(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(Iie,{className:"sm:hidden",children:i.jsx("div",{className:"space-y-1 px-2 pb-3 pt-2",children:xSe.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(zy,{className:"text-white"}),i.jsx("input",{type:"text",value:t,onChange:n=>e(n.target.value),placeholder:"Track and Analyze Wallet",className:"flex bg-transparent outline-none border-none text-[#cfcfcf] placeholder-[#636363] text-lg font-normal font-['Manrope'] leading-[21px] pr-10 w-full sm:w-[424px]"}),i.jsx("div",{onClick:n=>{if(n.preventDefault(),!t)dn.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{dn.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:qlt,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:Llt,alt:"Copy trade Hyperliquid wallets with Dextrabot platform and customizable risk settings",className:"w-full h-auto max-w-[728px] mx-auto"})})})})]})})})})},iun=()=>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(j7,{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:Dlt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 left-0"}),i.jsx(j7,{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:$lt,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(j7,{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:Ult,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-[20px] w-[294px] h-[204px]"}),i.jsx(j7,{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:Blt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 -left-1"})]})]}),i.jsx(j7,{title:"Analyze Wallet",description:"Track performance metrics, open positions, and trading patterns",icon:zlt,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"})]})]})}),j7=({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(sQ,{title:"Discover",description:"Find profitable wallets using our advanced filters",icon:Hlt,altInfo:"Discover profitable Hyperliquid wallets using Dextrabot's advanced filtering system"}),i.jsx(sQ,{title:"Analyze",description:"Examine detailed metrics and trading patterns",icon:Vlt,altInfo:"Examine detailed PnL metrics and win rate statistics for Hyperliquid trading strategies"}),i.jsx(sQ,{title:"Copy Trade",description:"Set your risk parameters and start automating",icon:Wlt,altInfo:"Set custom take profit and stop loss parameters for automated copy trading on Hyperliquid"})]})]})}),sQ=({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]"})]}),gSe=({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"})}),oun=()=>{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(J7e,{as:"div",className:"my-4 first:pt-0 last:pb-0 rounded-2xl bg-[#161616]",children:i.jsxs("dt",{children:[i.jsxs(Tie,{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(gSe,{"aria-hidden":"true",className:"size-6 group-data-[open]:hidden"}),i.jsx(gSe,{"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(Iie,{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))})]})})},lun=({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"})})})]}),cun=({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"})})})]}),uun=({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"})}),Nde=()=>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(cun,{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(uun,{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(lun,{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."]})]}),dun=()=>{const t=h.useRef(null),e=h.useRef(null),n=h.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(Sde,{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(iun,{})}),i.jsx("div",{ref:e,children:i.jsx(aun,{})}),i.jsx("div",{ref:n,children:i.jsx(oun,{})}),i.jsx(Nde,{})]})]})};var sg={},bSe;function fun(){if(bSe)return sg;bSe=1;var t=sg.__assign||function(){return t=Object.assign||function(d){for(var f,x=1,g=arguments.length;x<g;x++){f=arguments[x];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(d[y]=f[y])}return d},t.apply(this,arguments)},e=sg.__createBinding||(Object.create?function(d,f,x,g){g===void 0&&(g=x);var y=Object.getOwnPropertyDescriptor(f,x);(!y||("get"in y?!f.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return f[x]}}),Object.defineProperty(d,g,y)}:function(d,f,x,g){g===void 0&&(g=x),d[g]=f[x]}),n=sg.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=sg.__importStar||function(){var d=function(f){return d=Object.getOwnPropertyNames||function(x){var g=[];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(g[g.length]=y);return g},d(f)};return function(f){if(f&&f.__esModule)return f;var x={};if(f!=null)for(var g=d(f),y=0;y<g.length;y++)g[y]!=="default"&&e(x,f,g[y]);return n(x,f),x}}(),s=sg.__rest||function(d,f){var x={};for(var g in d)Object.prototype.hasOwnProperty.call(d,g)&&f.indexOf(g)<0&&(x[g]=d[g]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var y=0,g=Object.getOwnPropertySymbols(d);y<g.length;y++)f.indexOf(g[y])<0&&Object.prototype.propertyIsEnumerable.call(d,g[y])&&(x[g[y]]=d[g[y]]);return x};Object.defineProperty(sg,"__esModule",{value:!0});var a=r(xx()),o=IVe(),l=PVe(),c=[(0,l.createAnimation)("PacmanLoader","0% {transform: rotate(0deg)} 50% {transform: rotate(-44deg)}","pacman-1"),(0,l.createAnimation)("PacmanLoader","0% {transform: rotate(0deg)} 50% {transform: rotate(44deg)}","pacman-2")];function u(d){var f=d.loading,x=f===void 0?!0:f,g=d.color,y=g===void 0?"#000000":g,v=d.speedMultiplier,C=v===void 0?1:v,N=d.cssOverride,I=N===void 0?{}:N,P=d.size,M=P===void 0?25:P,F=d.margin,$=F===void 0?2:F,L=s(d,["loading","color","speedMultiplier","cssOverride","size","margin"]),z=(0,o.parseLengthAndUnit)(M),Q=z.value,se=z.unit,ee=t({display:"inherit",position:"relative",fontSize:0,height:"".concat(Q*2).concat(se),width:"".concat(Q*2).concat(se)},I),K=(0,l.createAnimation)("PacmanLoader",`75% {opacity: 0.7}
100% {transform: translate(`.concat("".concat(-4*Q).concat(se),", ").concat("".concat(-Q/4).concat(se),")}"),"ball"),re=function(W){return{width:"".concat(Q/3).concat(se),height:"".concat(Q/3).concat(se),backgroundColor:y,margin:(0,o.cssValue)($),borderRadius:"100%",transform:"translate(0, ".concat("".concat(-Q/4).concat(se),")"),position:"absolute",top:"".concat(Q).concat(se),left:"".concat(Q*4).concat(se),animation:"".concat(K," ").concat(1/C,"s ").concat(W*.25,"s infinite linear"),animationFillMode:"both"}},de="".concat((0,o.cssValue)(M)," solid transparent"),G="".concat((0,o.cssValue)(M)," solid ").concat(y),ie=function(W){return{width:0,height:0,borderRight:de,borderTop:W===0?de:G,borderLeft:G,borderBottom:W===0?G:de,borderRadius:(0,o.cssValue)(M),position:"absolute",animation:"".concat(c[W]," ").concat(.8/C,"s infinite ease-in-out"),animationFillMode:"both"}},ae=ie(0),q=ie(1);return x?a.createElement("span",t({style:ee},L),a.createElement("span",{style:ae}),a.createElement("span",{style:q}),a.createElement("span",{style:re(2)}),a.createElement("span",{style:re(3)}),a.createElement("span",{style:re(4)}),a.createElement("span",{style:re(5)})):null}return sg.default=u,sg}var hun=fun();const pun=Ti(hun),mun=()=>{const{setHyperToken:t,setHyperAddress:e}=h.useContext(Yr),[n]=MAe(),r=Ao(),s=n.get("temp_mobile_password");return h.useEffect(()=>{s?(async()=>{try{const o=await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/sign_mobile_complete/",{temp_mobile_password:s},{headers:{"Content-Type":"application/json"}}),{token:l,address:c}=o.data;setTimeout(()=>{window.localStorage.setItem("hyperToken",l),window.localStorage.setItem("hyperAddress",c),e(c),t(l),dn.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{dn.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:Ki,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(pun,{color:"#46eda1",size:30})]})},xun=()=>i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(Sde,{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(Nde,{})]})]}),gun=()=>{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(Ga,{children:i.jsxs(no,{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(Sde,{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(Nde,{})]})]})},TF=(t,e=2)=>Number(t).toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:e}),iQ=(t,e=2)=>Number(t).toLocaleString("en-US",{maximumFractionDigits:e}),ySe=t=>`${(t*100).toFixed(2)}%`,aQ=t=>Math.floor((Date.now()-t)/864e5);function bun(){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,N]=h.useState(""),[I,P]=h.useState("tvl"),[M,F]=h.useState("desc"),[$,L]=h.useState(20),[z,Q]=h.useState(1),se=ne=>(ne.summary.name||"").trim()==="Hyperliquidity Provider (HLP)",ee=()=>{r(!0),ps.get("https://stats-data.hyperliquid.xyz/Mainnet/vaults").then(ne=>e(Array.isArray(ne.data)?ne.data:[])).finally(()=>r(!1))};h.useEffect(()=>ee(),[]);const K=(ne,oe)=>{var _e;const he=(_e=ne.pnls)==null?void 0:_e.find(([xe])=>xe===oe);return he?parseFloat(he[1].slice(-1)[0]||0):0},re=h.useMemo(()=>{if(!t.length)return null;const ne=t.reduce((he,_e)=>he+ +_e.summary.tvl,0),oe=t.reduce((he,_e)=>he+(_e.apr||0),0)/t.length;return{total:t.length,active:t.filter(he=>!he.summary.isClosed).length,tvl:ne,avgApr:oe,profitable:t.filter(he=>K(he,"allTime")>0).length}},[t]),de=h.useMemo(()=>t.filter(ne=>{const oe=+ne.summary.tvl,he=ne.apr||0,_e=K(ne,"month"),xe=K(ne,"allTime"),Se=aQ(ne.summary.createTimeMillis),ge=(ne.summary.name||"").toLowerCase()+(ne.summary.vaultAddress||"").toLowerCase();return!(s&&oe<+s||o&&he*100<+o||c&&_e<+c||d&&xe<+d||x&&Se<+x||!y&&ne.summary.isClosed||C&&!ge.includes(C.toLowerCase()))}),[t,s,o,c,d,x,y,C]),G=(ne,oe)=>{var he;switch(oe){case"name":return((he=ne.summary.name)==null?void 0:he.toLowerCase())||"";case"apr":return ne.apr||0;case"tvl":return+ne.summary.tvl;case"p30":return K(ne,"month");case"pAll":return K(ne,"allTime");case"days":return aQ(ne.summary.createTimeMillis);default:return 0}},ie=h.useMemo(()=>[...de].sort((ne,oe)=>{const he=G(ne,I),_e=G(oe,I);return he===_e?0:M==="asc"?he>_e?1:-1:he<_e?1:-1}),[de,I,M]),ae=Math.max(1,Math.ceil(ie.length/$)),q=ie.slice((z-1)*$,z*$),W=(ne,oe)=>i.jsx("th",{onClick:()=>P(ne)||F(I===ne?M==="asc"?"desc":"asc":"desc"),className:`px-3 py-2 cursor-pointer whitespace-nowrap ${I===ne?"text-[#67FFBD]":""}`,children:oe},ne);return n?i.jsx("div",{className:"flex justify-center items-center w-full py-10",children:i.jsx(DVe,{color:"#ffffff",size:40})}):i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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:()=>{ee(),Q(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"}),re&&i.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-5 gap-4 mb-8 text-center",children:[["Total Vaults",iQ(re.total,0)],["Active Vaults",iQ(re.active,0)],["Total TVL",TF(re.tvl,0)],["Average APR",ySe(re.avgApr)],["Profitable Vaults",iQ(re.profitable,0)]].map(([ne,oe])=>i.jsxs("div",{className:"bg-[#1c1c1c] rounded-lg p-4",children:[i.jsx("p",{className:"text-sm text-gray-400 mb-1",children:ne}),i.jsx("p",{className:"text-xl font-semibold text-white",children:oe})]},ne))}),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(([ne,oe,he])=>i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-sm text-gray-300 mb-1",children:ne}),i.jsx("input",{type:"number",value:oe===0?"":oe,placeholder:"0",onChange:_e=>he(_e.target.value===""?"":+_e.target.value),className:"bg-[#303030] text-white rounded px-3 py-2 outline-none"})]},ne)),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:ne=>N(ne.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:ne=>v(ne.target.checked),className:"mr-2"}),"Show Closed Vaults"]}),i.jsx("button",{onClick:()=>{a(""),l(""),u(""),f(""),g(""),v(!1),N("")},className:"bg-[#303030] text-white px-3 py-1 text-sm font-bold rounded",children:"Reset"})]})]}),i.jsx("div",{className:"rounded-lg overflow-auto border border-[#303030]",children:i.jsxs("table",{className:"min-w-full text-sm text-gray-200 border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"bg-[#161616]",children:i.jsxs("tr",{children:[W("name","Vault"),W("tvl","TVL"),W("apr","APR"),W("p30","30d PNL"),W("pAll","All-Time PNL"),W("days","Days")]})}),i.jsx("tbody",{children:q.map((ne,oe)=>{const he=+ne.summary.tvl,_e=ne.apr||0,xe=K(ne,"month"),Se=K(ne,"allTime"),ge=aQ(ne.summary.createTimeMillis),Ce=ne.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/${Ce}`,target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#67FFBD] font-bold text-white",children:ne.summary.name||"Unnamed"}),i.jsx("a",{href:`/wallet-details/${Ce}`,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Ki,className:"w-4 h-4"})}),se(ne)&&i.jsx("span",{className:"text-[#FF7173] ml-1",children:"(Protocol Vault)"})]}),i.jsx("td",{className:"px-3 py-2",children:TF(he)}),i.jsx("td",{className:"px-3 py-2",children:ySe(_e)}),i.jsx("td",{className:`px-3 py-2 ${xe>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:TF(xe)}),i.jsx("td",{className:`px-3 py-2 ${Se>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:TF(Se)}),i.jsx("td",{className:"px-3 py-2",children:ge})]},Ce)})})]})}),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:ne=>{L(+ne.target.value),Q(1)},className:"bg-[#303030] ml-2 px-2 py-1 rounded text-sm font-bold",children:[10,20,30,40,50,100].map(ne=>i.jsx("option",{children:ne},ne))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>Q(ne=>Math.max(1,ne-1)),disabled:z===1,className:"px-2 py-1 bg-[#1c1c1c] rounded disabled:opacity-40",children:"‹"}),i.jsxs("span",{className:"text-sm",children:[z,"/",ae]}),i.jsx("button",{onClick:()=>Q(ne=>Math.min(ae,ne+1)),disabled:z===ae,className:"px-2 py-1 bg-[#1c1c1c] rounded disabled:opacity-40",children:"›"})]})]})]})]})}const Oh=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s})=>{const a=()=>{r(n===`-${e}`?e:`-${e}`)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>a(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope cursor-pointer`,children:[i.jsx("div",{className:`${n.includes(e)?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(fz,{sortKey:e,state:n,className:""})]})})},yun=({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(kb,{title:"Total Notional",value:n!=null&&n.total_notional?n==null?void 0:n.total_notional:"--",info:`${n!=null&&n.ticker_count?n==null?void 0:n.ticker_count:"--"} tickers`,icon:cme,period:e}),i.jsx(kb,{title:"Long Positions",value:n!=null&&n.long_exposure?n==null?void 0:n.long_exposure:"--",info:"Long exposure",icon:wJ,period:e}),i.jsx(kb,{title:"Short Positions",value:n!=null&&n.short_exposure?n==null?void 0:n.short_exposure:"--",info:"Short exposure",icon:CJ,period:e}),i.jsx(kb,{title:"Global Bias",value:n!=null&&n.global_bias?n==null?void 0:n.global_bias:"--",info:`L/S: ${n!=null&&n.long_ratio_percent?n==null?void 0:n.long_ratio_percent:"--"}%`,icon:4,period:e})]},r)):i.jsxs(i.Fragment,{children:[i.jsx(kb,{title:"Total Notional",value:"--",info:"--",icon:cme,period:e}),i.jsx(kb,{title:"Long Positions",value:"--",info:"Long exposure",icon:wJ,period:e}),i.jsx(kb,{title:"Short Positions",value:"--",info:"Short exposure",icon:CJ,period:e}),i.jsx(kb,{title:"Global Bias",value:"--",info:"L/S: --",icon:4,period:e})]})}),kb=({title:t,value:e,info:n,icon:r,period:s})=>i.jsxs("div",{style:{background:"linear-gradient(180deg, #000000 0%, #1C1C1C 100%)"},className:"h-20 lg:h-28 bg-[#1c1c1c] rounded-2xl p-2 lg:p-6 min-w-max relative overflow-hidden",children:[i.jsxs("div",{className:"flex justify-start items-start w-full h-full gap-2",children:[i.jsx("div",{className:"w-8 h-11 lg:w-12 lg:h-11 bg-[#1e1e1e] rounded-md border-[0.50px] border-[#313131] flex justify-center items-center",children:r===4?i.jsx(zBt,{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:`$${z7(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`})]}),sse=({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"})]})})]}),vun=({data:t,loading:e,error:n,period:r,periods:s,handlePeriodChange:a})=>{var se,ee;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=K=>{var de;const re=(de=t.data)==null?void 0:de.filter(G=>{var ae,q,W,ne,oe;if(u!=="All"&&G.majority_side!==u)return!1;const ie=(ae=x==null?void 0:x.trim())==null?void 0:ae.toLowerCase();return!(ie!==""&&!((W=(q=G==null?void 0:G.asset)==null?void 0:q.toLowerCase())!=null&&W.includes(ie)||(oe=(ne=G==null?void 0:G.coin_name)==null?void 0:ne.toLowerCase())!=null&&oe.includes(ie)))});return re==null?void 0:re.sort((G,ie)=>{const ae=G.asset?G.asset.toUpperCase():"",q=ie.asset?ie.asset.toUpperCase():"",W=G.majority_side==="LONG"?1:0,ne=ie.majority_side==="LONG"?1:0,oe=G.majority_side==="SHORT"?1:0,he=ie.majority_side==="SHORT"?1:0,_e=G.maj_side_pnl==="Profit"?1:0,xe=ie.maj_side_pnl==="Profit"?1:0,Se=G.maj_side_pnl==="Loss"?1:0,ge=ie.maj_side_pnl==="Loss"?1:0,Ce=Je=>{if(!Je||typeof Je!="string"||!Je.includes("/"))return 0;const[ht,rt]=Je.split("/").map(st=>Number(st.trim()));return rt!==0?ht/rt:0},je=Ce(G.traders_l_s),Oe=Ce(ie.traders_l_s),$e=Je=>{var st,He;const ht=parseFloat((st=Je==null?void 0:Je.asset_change24h)==null?void 0:st.markPx),rt=parseFloat((He=Je==null?void 0:Je.asset_change24h)==null?void 0:He.prevDayPx);return!ht||!rt||isNaN(ht)||isNaN(rt)||rt===0?-1/0:(ht-rt)/rt*100},Ye=Je=>{var rt;const ht=parseFloat((rt=Je==null?void 0:Je.asset_change24h)==null?void 0:rt.markPx);return isNaN(ht)?0:ht};return K==="asset"?ae<q?-1:ae>q?1:0:K==="-asset"?ae>q?-1:ae<q?1:0:K==="-total_notional"?ie.total_notional-G.total_notional:K==="total_notional"?G.total_notional-ie.total_notional:K==="-price"?Ye(ie)-Ye(G):K==="price"?Ye(G)-Ye(ie):K==="-long_notional"?ie.long_notional-G.long_notional:K==="long_notional"?G.long_notional-ie.long_notional:K==="-short_notional"?ie.short_notional-G.short_notional:K==="short_notional"?G.short_notional-ie.short_notional:K==="-total_long_pnl"?ie.total_long_pnl-G.total_long_pnl:K==="total_long_pnl"?G.total_long_pnl-ie.total_long_pnl:K==="-total_short_pnl"?ie.total_short_pnl-G.total_short_pnl:K==="total_short_pnl"?G.total_short_pnl-ie.total_short_pnl:K==="-majority_side"?ne-W:K==="majority_side"?he-oe:K==="-l_s_ratio"?ie.l_s_ratio-G.l_s_ratio:K==="l_s_ratio"?G.l_s_ratio-ie.l_s_ratio:K==="-long_ratio"?ie.long_ratio-G.long_ratio:K==="long_ratio"?G.long_ratio-ie.long_ratio:K==="-short_ratio"?ie.short_ratio-G.short_ratio:K==="short_ratio"?G.short_ratio-ie.short_ratio:K==="-maj_side_notional"?ie.maj_side_notional-G.maj_side_notional:K==="maj_side_notional"?G.maj_side_notional-ie.maj_side_notional:K==="-maj_side_pnl"?xe-_e:K==="maj_side_pnl"?ge-Se:K==="-traders_l_s"?Oe-je:K==="traders_l_s"?je-Oe:K==="-open_interest"?ie.open_interest-G.open_interest:K==="open_interest"?G.open_interest-ie.open_interest:K==="-change_24h"?$e(ie)-$e(G):K==="change_24h"?$e(G)-$e(ie):0})},C=h.useRef(null),N=()=>{C.current&&(C.current.scrollLeft-=100)},I=()=>{C.current&&(C.current.scrollLeft+=100)},P=()=>{C.current&&(C.current.scrollTop+=200)},M=()=>{C.current&&(C.current.scrollTop-=200)},F=K=>{var re;K.key==="Escape"&&(g(""),(re=y.current)==null||re.blur())},$=({coin:K,price:re,prevPricesRef:de})=>{const[G,ie]=h.useState("text-white");return h.useEffect(()=>{if(!K||re==null||isNaN(re))return;const ae=parseFloat(re),q=de.current[K]??0;ae>q?ie("text-[#1DE6A3]"):ae<q&&ie("text-[#FF7173]"),de.current[K]=ae;const W=setTimeout(()=>{ie("text-white")},800);return()=>clearTimeout(W)},[re,K]),i.jsx(ig,{info:re==null||isNaN(re)?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"})}):`$${re>=1e3?d3(re):re}`,textColor:G})},L={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},z=()=>i.jsx("div",{className:"flex items-center justify-end w-[96px]",children:i.jsx("div",{className:"w-[96px] max-w-[96px] h-[20px] rounded skeleton-ticker-text short"})}),Q=K=>K>=376&&K<500?4:K>=500&&K<640?5:K>=640&&K<768?6:K>=768&&K<1024?7:K>=1024&&K<1280?9:K>=1280&&K<1540?11:K>=1540&&K<1700||K>=1700?12:3;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[10px] sm:gap-[13px] text-white bg-[#161616] w-full h-full font-manrope",children:[i.jsx("div",{className:"flex justify-between sm:justify-start items-center gap-6 w-full sm:w-max",children:i.jsxs("div",{className:"flex flex-row sm:flex-col justify-between items-center sm:items-start sm:justify-start gap-2 font-manrope max-w-full w-max sm:w-full bg-[#161616] pl-2 sm:pl-0 pt-1 pr-2 sm:pr-0",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-sm sm:text-lg font-medium font-manrope leading-[21px]",children:"Ticker"})})]})}),i.jsx(yun,{data:t.topbox,period:r}),i.jsxs("div",{className:"flex justify-start items-center gap-2 w-full h-max px-2 sm:px-0",children:[i.jsxs("div",{className:"flex justify-start items-center gap-0.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx("input",{ref:y,type:"text",value:x,onChange:K=>g(K.target.value),onKeyDown:F,className:"bg-[#222222] rounded text-white py-1 pl-2 pr-4 w-40 text-sm outline-none placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Search Coin"}),i.jsx("div",{onClick:()=>g(""),className:"text-[#aaa] hover:text-white outline-none focus:outline-none focus:ring-0 border-none w-4 h-[26px] bg-[#222222] hover:bg-[#333333] rounded flex justify-center items-center cursor-pointer",children:i.jsx("img",{src:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(oQ,{title:"All",set_click:()=>d("All"),tableSortButton:u}),i.jsx(oQ,{title:"LONG",set_click:()=>d("LONG"),tableSortButton:u}),i.jsx(oQ,{title:"SHORT",set_click:()=>d("SHORT"),tableSortButton:u})]})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute -top-6 right-4 z-10 hidden sm:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:N,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),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 block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:M,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:P,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(eo,{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:Q(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(Ba,{})})})}):n&&!t.data?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Q(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(_l,{})})})}):((se=t.data)==null?void 0:se.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:Q(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(hVe,{})})})}):(ee=v(l))==null?void 0:ee.map((K,re)=>{var de,G,ie,ae,q,W,ne,oe,he,_e,xe,Se,ge,Ce,je,Oe,$e,Ye;return i.jsx(Ie.Fragment,{children:i.jsxs("tr",{className:`${re%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",onClick:()=>{window.open(`/terminal/${K==null?void 0:K.asset}`,"_blank")},className:`${re%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222] cursor-pointer`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2.5 pl-2 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${L[K==null?void 0:K.asset]||((de=K==null?void 0:K.asset)==null?void 0:de.split("/")[0])}.svg`||dummyImage,alt:K==null?void 0:K.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5 bg-gray-700",loading:"lazy",onError:Je=>wm(Je)}),i.jsx(ig,{info:K!=null&&K.asset?K==null?void 0:K.asset:"--",textColor:"text-white"}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src: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:`${K.majority_side=="LONG"?"text-[#67ffbd] bg-[#67ffbd]/20":K.majority_side=="SHORT"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:K.majority_side=="LONG"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):K.majority_side=="SHORT"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:K.majority_side?K.majority_side:"--"})]})})}),i.jsx("td",{className:"px-1",children:i.jsx($,{coin:K==null?void 0:K.asset,price:(G=K==null?void 0:K.asset_change24h)==null?void 0:G.markPx,prevPricesRef:f})}),i.jsx("td",{className:"px-1",children:i.jsx(wun,{info:((ie=K==null?void 0:K.asset_change24h)==null?void 0:ie.markPx)-((ae=K==null?void 0:K.asset_change24h)==null?void 0:ae.prevDayPx)?((q=K==null?void 0:K.asset_change24h)==null?void 0:q.markPx)-((W=K==null?void 0:K.asset_change24h)==null?void 0:W.prevDayPx)>0?"+"+Math.abs(parseFloat(((ne=K==null?void 0:K.asset_change24h)==null?void 0:ne.markPx)-((oe=K==null?void 0:K.asset_change24h)==null?void 0:oe.prevDayPx)).toFixed(5)):"-"+Math.abs(parseFloat(((he=K==null?void 0:K.asset_change24h)==null?void 0:he.markPx)-((_e=K==null?void 0:K.asset_change24h)==null?void 0:_e.prevDayPx)).toFixed(5)):z(),info_2:(((xe=K==null?void 0:K.asset_change24h)==null?void 0:xe.markPx)-((Se=K==null?void 0:K.asset_change24h)==null?void 0:Se.prevDayPx))/((ge=K==null?void 0:K.asset_change24h)==null?void 0:ge.prevDayPx)*100,color_1:`${((Ce=K==null?void 0:K.asset_change24h)==null?void 0:Ce.markPx)-((je=K==null?void 0:K.asset_change24h)==null?void 0:je.prevDayPx)>=0?"text-[#1DE6A3]":"text-[#FF7173]"}`,color_2:`${(((Oe=K==null?void 0:K.asset_change24h)==null?void 0:Oe.markPx)-(($e=K==null?void 0:K.asset_change24h)==null?void 0:$e.prevDayPx))/((Ye=K==null?void 0:K.asset_change24h)==null?void 0:Ye.prevDayPx)*100>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_long_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_long_pnl))?"--":`$${ad(Math.abs(K==null?void 0:K.total_long_pnl))}`,textColor:`${(K==null?void 0:K.total_long_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_long_pnl))||(K==null?void 0:K.total_long_pnl)==0?"text-white":(K==null?void 0:K.total_long_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_short_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_short_pnl))?"--":`$${ad(Math.abs(K==null?void 0:K.total_short_pnl))}`,textColor:`${(K==null?void 0:K.total_short_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_short_pnl))||(K==null?void 0:K.total_short_pnl)==0?"text-white":(K==null?void 0:K.total_short_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.long_notional)==null||isNaN(parseFloat(K==null?void 0:K.long_notional))?"--":`$${ad(K==null?void 0:K.long_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.short_notional)==null||isNaN(parseFloat(K==null?void 0:K.short_notional))?"--":`$${ad(K==null?void 0:K.short_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_notional)==null||isNaN(parseFloat(K==null?void 0:K.total_notional))?"--":`$${ad(K==null?void 0:K.total_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"",children:i.jsx("div",{className:"flex justify-end w-full",children:i.jsx("div",{className:"flex justify-end w-full max-w-[150px]",children:i.jsx(sse,{data_1:K!=null&&K.long_ratio?parseFloat(K==null?void 0:K.long_ratio).toFixed(2):0,data_2:K!=null&&K.short_ratio?parseFloat(K==null?void 0:K.short_ratio).toFixed(2):0,margin:"false"})})})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:K!=null&&K.traders_l_s?K==null?void 0:K.traders_l_s:"--",textColor:"text-white"})}),i.jsx("td",{className:"pr-4",children:i.jsx(ig,{info:(K==null?void 0:K.open_interest)==null||isNaN(parseFloat(K==null?void 0:K.open_interest))?"--":`$${ad(K==null?void 0:K.open_interest)}`,textColor:"text-white"})})]})},re)})})]})})]})]})})},ig=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-sm font-semibold font-manrope leading-none flex items-center justify-start px-1 gap-0.5`,children:t})}),wun=({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})}),oQ=({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}),Cun=()=>{es();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(Yr),[f,x]=h.useState([]),[g,y]=h.useState(!1),[v,C]=h.useState(null),N=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90}],I=parseInt(localStorage.getItem("ticker_period")),P=!isNaN(I)&&N[I]?N[I].value:N[1].value,[M,F]=h.useState(P),$=z=>{F(Number(z)),localStorage.setItem("ticker_period",N.findIndex(Q=>Q.value===Number(z)).toFixed(0))},L=async()=>{try{y(!0);const Q=await fetch("https://dextradata.nftinit.io/api/hyper/analytics_v2/",{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!Q.ok)throw new Error("Network response was not ok");const se=await Q.json();se!=null&&se.success?(x(se),y(!1)):(y(!1),C(se==null?void 0:se.error_message),console.error("Error fetching analytics data:",se==null?void 0:se.error_message))}catch(z){setError(z.message),y(!1),console.error("Error fetching analytics data:",z)}finally{y(!1)}};return h.useEffect(()=>{L()},[]),h.useEffect(()=>{const z=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");z.onopen=()=>{z.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}}))},z.onmessage=ee=>{var re;const K=JSON.parse(ee==null?void 0:ee.data);if(K.channel==="webData2"){const de=K.data,G=de.assetCtxs,ie=(re=de.meta)==null?void 0:re.universe;if(Array.isArray(G)&&Array.isArray(ie)){const ae=G.map((q,W)=>{var ne;return{...q,name:((ne=ie[W])==null?void 0:ne.name)??null}});x(q=>{if(!q||!Array.isArray(q.data))return q;const W=q.data.map(ne=>{const oe=ae.find(he=>he.name===ne.asset);return oe?{...ne,asset_change24h:oe}:ne});return{...q,data:W}})}else console.error("missing assetCtxs or universe:",{assetCtxs:G,universe:ie})}};const Q=()=>{z.readyState===WebSocket.OPEN&&z.send(JSON.stringify({method:"unsubscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}})),z.close()},se=()=>{Q(),window.removeEventListener("beforeunload",Q)};return window.addEventListener("beforeunload",Q),se},[]),h.useEffect(()=>{(async()=>{var ee,K;const Q=window.localStorage.getItem("hyperToken"),se=window.localStorage.getItem("hyperAddress");if(!(!Q||!se))try{const re=await vi(se.toLowerCase(),Q);re!=null&&re.success?(t(re==null?void 0:re.telegram_chat_id),e(re==null?void 0:re.subscriber_role),n(re==null?void 0:re.subs_expire_day),r((ee=re==null?void 0:re.mushboomer_counts)==null?void 0:ee.eth),a((K=re==null?void 0:re.mushboomer_counts)==null?void 0:K.sol),o(re==null?void 0:re.referral_code),l(re==null?void 0:re.refcode),s(re==null?void 0:re.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(re){console.error("Token verification error:",re)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsx(no,{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(vun,{data:f,loading:g,error:v,period:M,periods:N,handlePeriodChange:$})})})]})},jde=h.createContext({});function Ade(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const _de=typeof window<"u",zVe=_de?h.useLayoutEffect:h.useEffect,mz=h.createContext(null),IF=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Sun(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 Nun=40;function HVe(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=IF.reduce((P,M)=>(P[M]=Sun(a),P),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const P=Bc.useManualTiming?s.timestamp:performance.now();n=!1,Bc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(P-s.timestamp,Nun),1)),s.timestamp=P,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:IF.reduce((P,M)=>{const F=o[M];return P[M]=($,L=!1,z=!1)=>(n||C(),F.schedule($,L,z)),P},{}),cancel:P=>{for(let M=0;M<IF.length;M++)o[IF[M]].cancel(P)},state:s,steps:o}}const{schedule:$o,cancel:h2,state:tu,steps:lQ}=HVe(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0);let vM;function jun(){vM=void 0}const cf={now:()=>(vM===void 0&&cf.set(tu.isProcessing||Bc.useManualTiming?tu.timestamp:performance.now()),vM),set:t=>{vM=t,queueMicrotask(jun)}},VVe=t=>e=>typeof e=="string"&&e.startsWith(t),Ede=VVe("--"),Aun=VVe("var(--"),kde=t=>Aun(t)?_un.test(t.split("/*")[0].trim()):!1,_un=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,M8={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Nk={...M8,transform:t=>Dc(0,1,t)},PF={...M8,default:1},q9=t=>Math.round(t*1e5)/1e5,Tde=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Eun(t){return t==null}const kun=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ide=(t,e)=>n=>!!(typeof n=="string"&&kun.test(n)&&n.startsWith(t)||e&&!Eun(n)&&Object.prototype.hasOwnProperty.call(n,e)),WVe=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(Tde);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Tun=t=>Dc(0,255,t),cQ={...M8,transform:t=>Math.round(Tun(t))},Ew={test:Ide("rgb","red"),parse:WVe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+cQ.transform(t)+", "+cQ.transform(e)+", "+cQ.transform(n)+", "+q9(Nk.transform(r))+")"};function Iun(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 ise={test:Ide("#"),parse:Iun,transform:Ew.transform},rI=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),$b=rI("deg"),ex=rI("%"),fi=rI("px"),Pun=rI("vh"),Fun=rI("vw"),vSe={...ex,parse:t=>ex.parse(t)/100,transform:t=>ex.transform(t*100)},d4={test:Ide("hsl","hue"),parse:WVe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ex.transform(q9(e))+", "+ex.transform(q9(n))+", "+q9(Nk.transform(r))+")"},Ul={test:t=>Ew.test(t)||ise.test(t)||d4.test(t),parse:t=>Ew.test(t)?Ew.parse(t):d4.test(t)?d4.parse(t):ise.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ew.transform(t):d4.transform(t),getAnimatableNone:t=>{const e=Ul.parse(t);return e.alpha=0,Ul.transform(e)}},Oun=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Mun(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Tde))==null?void 0:e.length)||0)+(((n=t.match(Oun))==null?void 0:n.length)||0)>0}const qVe="number",GVe="color",Run="var",Lun="var(",wSe="${}",Dun=/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 jk(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(Dun,c=>(Ul.test(c)?(r.color.push(a),s.push(GVe),n.push(Ul.parse(c))):c.startsWith(Lun)?(r.var.push(a),s.push(Run),n.push(c)):(r.number.push(a),s.push(qVe),n.push(parseFloat(c))),++a,wSe)).split(wSe);return{values:n,split:l,indexes:r,types:s}}function KVe(t){return jk(t).values}function YVe(t){const{split:e,types:n}=jk(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===qVe?a+=q9(s[o]):l===GVe?a+=Ul.transform(s[o]):a+=s[o]}return a}}const Bun=t=>typeof t=="number"?0:Ul.test(t)?Ul.getAnimatableNone(t):t;function $un(t){const e=KVe(t);return YVe(t)(e.map(Bun))}const p2={test:Mun,parse:KVe,createTransformer:YVe,getAnimatableNone:$un};function uQ(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 Uun({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=uQ(c,l,t+1/3),a=uQ(c,l,t),o=uQ(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function WD(t,e){return n=>n>0?e:t}const Go=(t,e,n)=>t+(e-t)*n,dQ=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},zun=[ise,Ew,d4],Hun=t=>zun.find(e=>e.test(t));function CSe(t){const e=Hun(t);if(!e)return!1;let n=e.parse(t);return e===d4&&(n=Uun(n)),n}const SSe=(t,e)=>{const n=CSe(t),r=CSe(e);if(!n||!r)return WD(t,e);const s={...n};return a=>(s.red=dQ(n.red,r.red,a),s.green=dQ(n.green,r.green,a),s.blue=dQ(n.blue,r.blue,a),s.alpha=Go(n.alpha,r.alpha,a),Ew.transform(s))},ase=new Set(["none","hidden"]);function Vun(t,e){return ase.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Wun(t,e){return n=>Go(t,e,n)}function Pde(t){return typeof t=="number"?Wun:typeof t=="string"?kde(t)?WD:Ul.test(t)?SSe:Kun:Array.isArray(t)?XVe:typeof t=="object"?Ul.test(t)?SSe:qun:WD}function XVe(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>Pde(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function qun(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=Pde(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function Gun(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 Kun=(t,e)=>{const n=p2.createTransformer(e),r=jk(t),s=jk(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?ase.has(t)&&!s.values.length||ase.has(e)&&!r.values.length?Vun(t,e):vx(XVe(Gun(r,s),s.values),n):WD(t,e)};function QVe(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Go(t,e,n):Pde(t)(t,e)}const Yun=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>$o.update(e,n),stop:()=>h2(e),now:()=>tu.isProcessing?tu.timestamp:cf.now()}},ZVe=(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)})`},qD=2e4;function Fde(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<qD;)e+=n,r=t.next(e);return e>=qD?1/0:e}function Xun(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Fde(r),qD);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:ll(s)}}const Qun=5;function JVe(t,e,n){const r=Math.max(e-Qun,0);return UB(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},NSe=.001;function Zun({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,ll(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=ose(u,o),y=Math.exp(-f);return NSe-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=ose(Math.pow(u,2),o);return(-s(u)+NSe>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=edn(s,a,l);if(t=ql(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 Jun=12;function edn(t,e,n){let r=n;for(let s=1;s<Jun;s++)r=r-t(r)/e(r);return r}function ose(t,e){return t*Math.sqrt(1-e*e)}const tdn=["duration","bounce"],ndn=["stiffness","damping","mass"];function jSe(t,e){return e.some(n=>t[n]!==void 0)}function rdn(t){let e={velocity:il.velocity,stiffness:il.stiffness,damping:il.damping,mass:il.mass,isResolvedFromDuration:!1,...t};if(!jSe(t,ndn)&&jSe(t,tdn))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=Zun(t);e={...e,...n,mass:il.mass},e.isResolvedFromDuration=!0}return e}function GD(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}=rdn({...n,velocity:-ll(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,N=ll(Math.sqrt(c/d)),I=Math.abs(C)<5;r||(r=I?il.restSpeed.granular:il.restSpeed.default),s||(s=I?il.restDelta.granular:il.restDelta.default);let P;if(v<1){const F=ose(N,v);P=$=>{const L=Math.exp(-v*N*$);return o-L*((y+v*N*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)P=F=>o-Math.exp(-N*F)*(C+(y+N*C)*F);else{const F=N*Math.sqrt(v*v-1);P=$=>{const L=Math.exp(-v*N*$),z=Math.min(F*$,300);return o-L*((y+v*N*C)*Math.sinh(z)+F*C*Math.cosh(z))/F}}const M={calculatedDuration:g&&f||null,next:F=>{const $=P(F);if(g)l.done=F>=f;else{let L=F===0?y:0;v<1&&(L=F===0?ql(y):JVe(P,F,$));const z=Math.abs(L)<=r,Q=Math.abs(o-$)<=s;l.done=z&&Q}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(Fde(M),qD),$=ZVe(L=>M.next(F*L).value,F,30);return F+"ms "+$},toTransition:()=>{}};return M}GD.applyToOptions=t=>{const e=Xun(t,100,GD);return t.ease=e.ease,t.duration=ql(e.duration),t.type="keyframes",t};function lse({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=t[0],x={done:!1,value:f},g=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let v=n*e;const C=f+v,N=o===void 0?C:o(C);N!==C&&(v=N-f);const I=z=>-v*Math.exp(-z/r),P=z=>N+I(z),M=z=>{const Q=I(z),se=P(z);x.done=Math.abs(Q)<=u,x.value=x.done?N:se};let F,$;const L=z=>{g(x.value)&&(F=z,$=GD({keyframes:[x.value,y(x.value)],velocity:JVe(P,z,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return L(0),{calculatedDuration:null,next:z=>{let Q=!1;return!$&&F===void 0&&(Q=!0,M(z),L(z)),F!==void 0&&z>=F?$.next(z-F):(!Q&&M(z),x)}}}function sdn(t,e,n){const r=[],s=n||Bc.mix||QVe,a=t.length-1;for(let o=0;o<a;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||dl:e;l=vx(c,l)}r.push(l)}return r}function idn(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(QS(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=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=sx(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=sx(0,e,r);t.push(Go(n,1,s))}}function odn(t){const e=[0];return adn(e,t.length-1),e}function ldn(t,e){return t.map(n=>n*e)}function cdn(t,e){return t.map(()=>e||Vie).splice(0,t.length-1)}function G9({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=l9e(r)?r.map(zM):zM(r),a={done:!1,value:e[0]},o=ldn(n&&n.length===e.length?n:odn(e),t),l=idn(o,e,{ease:Array.isArray(s)?s:cdn(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const udn=t=>t!==null;function Ode(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(udn),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const ddn={decay:lse,inertia:lse,tween:G9,keyframes:G9,spring:GD};function eWe(t){typeof t.type=="string"&&(t.type=ddn[t.type])}class Mde{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 fdn=t=>t/100;class Rde extends Mde{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;eWe(e);const{type:n=G9,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||G9;c!==G9&&typeof l[0]!="number"&&(this.mixKeyframes=vx(fdn,QVe(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=Fde(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:x,repeatDelay:g,type:y,onUpdate:v,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const N=this.currentTime-u*(this.playbackSpeed>=0?1:-1),I=this.playbackSpeed>=0?N<0:N>s;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let P=this.currentTime,M=r;if(f){const z=Math.min(this.currentTime,s)/l;let Q=Math.floor(z),se=z%1;!se&&z>=1&&(se=1),se===1&&Q--,Q=Math.min(Q,f+1),!!(Q%2)&&(x==="reverse"?(se=1-se,g&&(se-=g/l)):x==="mirror"&&(M=o)),P=Dc(0,1,se)*l}const F=I?{done:!1,value:d[0]}:M.next(P);a&&(F.value=a(F.value));let{done:$}=F;!I&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return L&&y!==lse&&(F.value=Ode(d,this.options,C,this.speed)),v&&v(F.value),L&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return ll(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ll(e)}get time(){return ll(this.currentTime)}set time(e){var n;e=ql(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=ll(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=Yun,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 hdn(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const kw=t=>t*180/Math.PI,cse=t=>{const e=kw(Math.atan2(t[1],t[0]));return use(e)},pdn={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=>kw(Math.atan(t[1])),skewY:t=>kw(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},use=t=>(t=t%360,t<0&&(t+=360),t),ASe=cse,_Se=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ESe=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:_Se,scaleY:ESe,scale:t=>(_Se(t)+ESe(t))/2,rotateX:t=>use(kw(Math.atan2(t[6],t[5]))),rotateY:t=>use(kw(Math.atan2(-t[2],t[0]))),rotateZ:ASe,rotate:ASe,skewX:t=>kw(Math.atan(t[4])),skewY:t=>kw(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function dse(t){return t.includes("scale")?1:0}function fse(t,e){if(!t||t==="none")return dse(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=pdn,s=l}if(!s)return dse(e);const a=r[e],o=s[1].split(",").map(gdn);return typeof a=="function"?a(o):o[a]}const xdn=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return fse(n,e)};function gdn(t){return parseFloat(t.trim())}const R8=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],L8=new Set(R8),kSe=t=>t===M8||t===fi,bdn=new Set(["x","y","z"]),ydn=R8.filter(t=>!bdn.has(t));function vdn(t){const e=[];return ydn.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const k3={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})=>fse(e,"x"),y:(t,{transform:e})=>fse(e,"y")};k3.translateX=k3.x;k3.translateY=k3.y;const T3=new Set;let hse=!1,pse=!1,mse=!1;function tWe(){if(pse){const t=Array.from(T3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=vdn(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)})}pse=!1,hse=!1,T3.forEach(t=>t.complete(mse)),T3.clear()}function nWe(){T3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(pse=!0)})}function wdn(){mse=!0,nWe(),tWe(),mse=!1}class Lde{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?(T3.add(this),hse||(hse=!0,$o.read(nWe),$o.resolveKeyframes(tWe))):(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])}hdn(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),T3.delete(this)}cancel(){this.state==="scheduled"&&(T3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Cdn=t=>t.startsWith("--");function Sdn(t,e,n){Cdn(e)?t.style.setProperty(e,n):t.style[e]=n}const Ndn=Rj(()=>window.ScrollTimeline!==void 0),jdn={};function Adn(t,e){const n=Rj(t);return()=>jdn[e]??n()}const rWe=Adn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),d9=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,TSe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:d9([0,.65,.55,1]),circOut:d9([.55,0,1,.45]),backIn:d9([.31,.01,.66,-.59]),backOut:d9([.33,1.53,.69,.99])};function sWe(t,e){if(t)return typeof t=="function"?rWe()?ZVe(t,e):"ease-out":Wie(t)?d9(t):Array.isArray(t)?t.map(n=>sWe(n,e)||TSe.easeOut):TSe[t]}function _dn(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=sWe(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 iWe(t){return typeof t=="function"&&"applyToOptions"in t}function Edn({type:t,...e}){return iWe(t)&&rWe()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class kdn extends Mde{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,QS(typeof e.type!="string");const u=Edn(e);this.animation=_dn(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=Ode(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):Sdn(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return ll(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ll(e)}get time(){return ll(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=ql(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&&Ndn()?(this.animation.timeline=e,dl):n(this)}}const aWe={anticipate:$ie,backInOut:Bie,circInOut:Hie};function Tdn(t){return t in aWe}function Idn(t){typeof t.ease=="string"&&Tdn(t.ease)&&(t.ease=aWe[t.ease])}const ISe=10;class Pdn extends kdn{constructor(e){Idn(e),eWe(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 Rde({...o,autoplay:!1}),c=ql(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-ISe).value,l.sample(c).value,ISe),l.stop()}}const PSe=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(p2.test(t)||t==="0")&&!t.startsWith("url("));function Fdn(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 Odn(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=PSe(s,e),l=PSe(a,e);return!o||!l?!1:Fdn(t)||(n==="spring"||iWe(n))&&r}function xse(t){t.duration=0,t.type="keyframes"}const Mdn=new Set(["opacity","clipPath","filter","transform"]),Rdn=Rj(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Ldn(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 Rdn()&&n&&Mdn.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const Ddn=40;class Bdn extends Mde{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)||Lde;this.keyframeResolver=new g(l,(v,C,N)=>this.onKeyframesResolved(v,C,x,!N),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=cf.now(),Odn(e,a,o,l)||((Bc.instantAnimations||!c)&&(d==null||d(Ode(e,r,n))),e[0]=e[e.length-1],xse(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Ddn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&Ldn(x)?new Pdn({...x,element:x.motionValue.owner.current}):new Rde(x);g.finished.then(()=>this.notifyFinished()).catch(dl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),wdn()),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 $dn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Udn(t){const e=$dn.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function oWe(t,e,n=1){const[r,s]=Udn(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return DB(o)?parseFloat(o):o}return kde(s)?oWe(s,e,n+1):s}function Dde(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const lWe=new Set(["width","height","top","left","right","bottom",...R8]),zdn={test:t=>t==="auto",parse:t=>t},cWe=t=>e=>e.test(t),uWe=[M8,fi,ex,$b,Fun,Pun,zdn],FSe=t=>uWe.find(cWe(t));function Hdn(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$B(t):!0}const Vdn=new Set(["brightness","contrast","saturate","opacity"]);function Wdn(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Tde)||[];if(!r)return t;const s=n.replace(r,"");let a=Vdn.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const qdn=/\b([a-z-]*)\(.*?\)/gu,gse={...p2,getAnimatableNone:t=>{const e=t.match(qdn);return e?e.map(Wdn).join(" "):t}},OSe={...M8,transform:Math.round},Gdn={rotate:$b,rotateX:$b,rotateY:$b,rotateZ:$b,scale:PF,scaleX:PF,scaleY:PF,scaleZ:PF,skew:$b,skewX:$b,skewY:$b,distance:fi,translateX:fi,translateY:fi,translateZ:fi,x:fi,y:fi,z:fi,perspective:fi,transformPerspective:fi,opacity:Nk,originX:vSe,originY:vSe,originZ:fi},Bde={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,...Gdn,zIndex:OSe,fillOpacity:Nk,strokeOpacity:Nk,numOctaves:OSe},Kdn={...Bde,color:Ul,backgroundColor:Ul,outlineColor:Ul,fill:Ul,stroke:Ul,borderColor:Ul,borderTopColor:Ul,borderRightColor:Ul,borderBottomColor:Ul,borderLeftColor:Ul,filter:gse,WebkitFilter:gse},dWe=t=>Kdn[t];function fWe(t,e){let n=dWe(t);return n!==gse&&(n=p2),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ydn=new Set(["auto","none","0"]);function Xdn(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!Ydn.has(a)&&jk(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=fWe(n,s)}class Qdn extends Lde{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(),kde(u))){const d=oWe(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!lWe.has(r)||e.length!==2)return;const[s,a]=e,o=FSe(s),l=FSe(a);if(o!==l)if(kSe(o)&&kSe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else k3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||Hdn(e[s]))&&r.push(s);r.length&&Xdn(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=k3[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]=k3[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 Zdn(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 hWe=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function pWe(t){return BB(t)&&"offsetHeight"in t}const MSe=30,Jdn=t=>!isNaN(parseFloat(t));class efn{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=Jdn(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 Lj);const r=this.events[e].add(n);return e==="change"?()=>{r(),$o.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>MSe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,MSe);return UB(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 bj(t,e){return new efn(t,e)}const{schedule:$de,cancel:b4n}=HVe(queueMicrotask,!1),Vp={x:!1,y:!1};function mWe(){return Vp.x||Vp.y}function tfn(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 xWe(t,e){const n=Zdn(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function RSe(t){return!(t.pointerType==="touch"||mWe())}function nfn(t,e,n={}){const[r,s,a]=xWe(t,n),o=l=>{if(!RSe(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{RSe(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const gWe=(t,e)=>e?t===e?!0:gWe(t,e.parentElement):!1,Ude=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,rfn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function sfn(t){return rfn.has(t.tagName)||t.tabIndex!==-1}const wM=new WeakSet;function LSe(t){return e=>{e.key==="Enter"&&t(e)}}function fQ(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const ifn=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=LSe(()=>{if(wM.has(n))return;fQ(n,"down");const s=LSe(()=>{fQ(n,"up")}),a=()=>fQ(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 DSe(t){return Ude(t)&&!mWe()}function afn(t,e,n={}){const[r,s,a]=xWe(t,n),o=l=>{const c=l.currentTarget;if(!DSe(l))return;wM.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),wM.has(c)&&wM.delete(c),DSe(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||gWe(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),pWe(l)&&(l.addEventListener("focus",u=>ifn(u,s)),!sfn(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function bWe(t){return BB(t)&&"ownerSVGElement"in t}function ofn(t){return bWe(t)&&t.tagName==="svg"}const $u=t=>!!(t&&t.getVelocity),lfn=[...uWe,Ul,p2],cfn=t=>lfn.find(cWe(t)),zde=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function BSe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ufn(...t){return e=>{let n=!1;const r=t.map(s=>{const a=BSe(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():BSe(t[s],null)}}}}function dfn(...t){return h.useCallback(ufn(...t),t)}class ffn extends h.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=pWe(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 hfn({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(zde),c=dfn(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(ffn,{isPresent:e,childRef:a,sizeRef:o,children:h.cloneElement(t,{ref:c})})}const pfn=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:a,mode:o,anchorX:l,root:c})=>{const u=Ade(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(hfn,{isPresent:n,anchorX:l,root:c,children:t})),i.jsx(mz.Provider,{value:x,children:t})};function mfn(){return new Map}function yWe(t=!0){const e=h.useContext(mz);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 FF=t=>t.key||"";function $Se(t){const e=[];return h.Children.forEach(t,n=>{h.isValidElement(n)&&e.push(n)}),e}const sI=({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]=yWe(o),f=h.useMemo(()=>$Se(t),[t]),x=o&&!u?[]:f.map(FF),g=h.useRef(!0),y=h.useRef(f),v=Ade(()=>new Map),[C,N]=h.useState(f),[I,P]=h.useState(f);zVe(()=>{g.current=!1,y.current=f;for(let $=0;$<I.length;$++){const L=FF(I[$]);x.includes(L)?v.delete(L):v.get(L)!==!0&&v.set(L,!1)}},[I,x.length,x.join("-")]);const M=[];if(f!==C){let $=[...f];for(let L=0;L<I.length;L++){const z=I[L],Q=FF(z);x.includes(Q)||($.splice(L,0,z),M.push(z))}return a==="wait"&&M.length&&($=M),P($Se($)),N(f),null}const{forceRender:F}=h.useContext(jde);return i.jsx(i.Fragment,{children:I.map($=>{const L=FF($),z=o&&!u?!1:f===I||x.includes(L),Q=()=>{if(v.has(L))v.set(L,!0);else return;let se=!0;v.forEach(ee=>{ee||(se=!1)}),se&&(F==null||F(),P(y.current),o&&(d==null||d()),r&&r())};return i.jsx(pfn,{isPresent:z,initial:!g.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:c,onExitComplete:z?void 0:Q,anchorX:l,children:$},L)})})},vWe=h.createContext({strict:!1}),USe={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"]},yj={};for(const t in USe)yj[t]={isEnabled:e=>USe[t].some(n=>!!e[n])};function xfn(t){for(const e in t)yj[e]={...yj[e],...t[e]}}const gfn=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 KD(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||gfn.has(t)}let wWe=t=>!KD(t);function bfn(t){typeof t=="function"&&(wWe=e=>e.startsWith("on")?!KD(e):t(e))}try{bfn(require("@emotion/is-prop-valid").default)}catch{}function yfn(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(wWe(s)||n===!0&&KD(s)||!e&&!KD(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const xz=h.createContext({});function gz(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ak(t){return typeof t=="string"||Array.isArray(t)}const Hde=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Vde=["initial",...Hde];function bz(t){return gz(t.animate)||Vde.some(e=>Ak(t[e]))}function CWe(t){return!!(bz(t)||t.variants)}function vfn(t,e){if(bz(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Ak(n)?n:void 0,animate:Ak(r)?r:void 0}}return t.inherit!==!1?e:{}}function wfn(t){const{initial:e,animate:n}=vfn(t,h.useContext(xz));return h.useMemo(()=>({initial:e,animate:n}),[zSe(e),zSe(n)])}function zSe(t){return Array.isArray(t)?t.join(" "):t}const _k={};function Cfn(t){for(const e in t)_k[e]=t[e],Ede(e)&&(_k[e].isCSSVariable=!0)}function SWe(t,{layout:e,layoutId:n}){return L8.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!_k[t]||t==="opacity")}const Sfn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Nfn=R8.length;function jfn(t,e,n){let r="",s=!0;for(let a=0;a<Nfn;a++){const o=R8[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=hWe(l,Bde[o]);if(!c){s=!1;const d=Sfn[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Wde(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(L8.has(c)){o=!0;continue}else if(Ede(c)){s[c]=u;continue}else{const d=hWe(u,Bde[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=jfn(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 qde=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function NWe(t,e,n){for(const r in e)!$u(e[r])&&!SWe(r,n)&&(t[r]=e[r])}function Afn({transformTemplate:t},e){return h.useMemo(()=>{const n=qde();return Wde(n,e,t),Object.assign({},n.vars,n.style)},[e])}function _fn(t,e){const n=t.style||{},r={};return NWe(r,n,t),Object.assign(r,Afn(t,e)),r}function Efn(t,e){const n={},r=_fn(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 kfn={offset:"stroke-dashoffset",array:"stroke-dasharray"},Tfn={offset:"strokeDashoffset",array:"strokeDasharray"};function Ifn(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?kfn:Tfn;t[a.offset]=fi.transform(-r);const o=fi.transform(e),l=fi.transform(n);t[a.array]=`${o} ${l}`}function jWe(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(Wde(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&&Ifn(f,s,a,o,!1)}const AWe=()=>({...qde(),attrs:{}}),_We=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Pfn(t,e,n,r){const s=h.useMemo(()=>{const a=AWe();return jWe(a,e,_We(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};NWe(a,t.style,t),s.style={...a,...s.style}}return s}const Ffn=["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 Gde(t){return typeof t!="string"||t.includes("-")?!1:!!(Ffn.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ofn(t,e,n,{latestValues:r},s,a=!1){const l=(Gde(t)?Pfn:Efn)(e,r,s,t),c=yfn(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 HSe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Kde(t,e,n,r){if(typeof e=="function"){const[s,a]=HSe(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]=HSe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function CM(t){return $u(t)?t.get():t}function Mfn({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:Rfn(n,r,s,t),renderState:e()}}function Rfn(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=CM(a[x]);let{initial:o,animate:l}=t;const c=bz(t),u=CWe(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"&&!gz(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=Kde(t,x[g]);if(y){const{transitionEnd:v,transition:C,...N}=y;for(const I in N){let P=N[I];if(Array.isArray(P)){const M=d?P.length-1:0;P=P[M]}P!==null&&(s[I]=P)}for(const I in v)s[I]=v[I]}}}return s}const EWe=t=>(e,n)=>{const r=h.useContext(xz),s=h.useContext(mz),a=()=>Mfn(t,e,r,s);return n?a():Ade(a)};function Yde(t,e,n){var a;const{style:r}=t,s={};for(const o in r)($u(r[o])||e.style&&$u(e.style[o])||SWe(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const Lfn=EWe({scrapeMotionValuesFromProps:Yde,createRenderState:qde});function kWe(t,e,n){const r=Yde(t,e,n);for(const s in t)if($u(t[s])||$u(e[s])){const a=R8.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const Dfn=EWe({scrapeMotionValuesFromProps:kWe,createRenderState:AWe}),Bfn=Symbol.for("motionComponentSymbol");function f4(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function $fn(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):f4(n)&&(n.current=r))},[e])}const Xde=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ufn="framerAppearId",TWe="data-"+Xde(Ufn),IWe=h.createContext({});function zfn(t,e,n,r,s){var v,C;const{visualElement:a}=h.useContext(xz),o=h.useContext(vWe),l=h.useContext(mz),c=h.useContext(zde).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(IWe);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&Hfn(u.current,n,s,f);const x=h.useRef(!1);h.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[TWe],y=h.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return zVe(()=>{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 N;(N=window.MotionHandoffMarkAsComplete)==null||N.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function Hfn(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:PWe(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&f4(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function PWe(t){if(t)return t.options.allowProjection!==!1?t.projection:PWe(t.parent)}function hQ(t,{forwardMotionProps:e=!1}={},n,r){n&&xfn(n);const s=Gde(t)?Dfn:Lfn;function a(l,c){let u;const d={...h.useContext(zde),...l,layoutId:Vfn(l)},{isStatic:f}=d,x=wfn(l),g=s(l,f);if(!f&&_de){Wfn();const y=qfn(d);u=y.MeasureLayout,x.visualElement=zfn(t,g,d,r,y.ProjectionNode)}return i.jsxs(xz.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,Ofn(t,l,$fn(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[Bfn]=t,o}function Vfn({layoutId:t}){const e=h.useContext(jde).id;return e&&t!==void 0?e+"-"+t:t}function Wfn(t,e){h.useContext(vWe).strict}function qfn(t){const{drag:e,layout:n}=yj;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 Gfn(t,e){if(typeof Proxy>"u")return hQ;const n=new Map,r=(a,o)=>hQ(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,hQ(o,void 0,t,e)),n.get(o))})}function FWe({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Kfn({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Yfn(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 pQ(t){return t===void 0||t===1}function bse({scale:t,scaleX:e,scaleY:n}){return!pQ(t)||!pQ(e)||!pQ(n)}function Xv(t){return bse(t)||OWe(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function OWe(t){return VSe(t.x)||VSe(t.y)}function VSe(t){return t&&t!=="0%"}function YD(t,e,n){const r=t-n,s=e*r;return n+s}function WSe(t,e,n,r,s){return s!==void 0&&(t=YD(t,s,r)),YD(t,n,r)+e}function yse(t,e=0,n=1,r,s){t.min=WSe(t.min,e,n,r,s),t.max=WSe(t.max,e,n,r,s)}function MWe(t,{x:e,y:n}){yse(t.x,e.translate,e.scale,e.originPoint),yse(t.y,n.translate,n.scale,n.originPoint)}const qSe=.999999999999,GSe=1.0000000000001;function Xfn(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&&p4(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,MWe(t,o)),r&&Xv(a.latestValues)&&p4(t,a.latestValues))}e.x<GSe&&e.x>qSe&&(e.x=1),e.y<GSe&&e.y>qSe&&(e.y=1)}function h4(t,e){t.min=t.min+e,t.max=t.max+e}function KSe(t,e,n,r,s=.5){const a=Go(t.min,t.max,s);yse(t,e,n,a,r)}function p4(t,e){KSe(t.x,e.x,e.scaleX,e.scale,e.originX),KSe(t.y,e.y,e.scaleY,e.scale,e.originY)}function RWe(t,e){return FWe(Yfn(t.getBoundingClientRect(),e))}function Qfn(t,e,n){const r=RWe(t,n),{scroll:s}=e;return s&&(h4(r.x,s.offset.x),h4(r.y,s.offset.y)),r}const YSe=()=>({translate:0,scale:1,origin:0,originPoint:0}),m4=()=>({x:YSe(),y:YSe()}),XSe=()=>({min:0,max:0}),vl=()=>({x:XSe(),y:XSe()}),vse={current:null},LWe={current:!1};function Zfn(){if(LWe.current=!0,!!_de)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>vse.current=t.matches;t.addEventListener("change",e),e()}else vse.current=!1}const Jfn=new WeakMap;function ehn(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,bj(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,bj(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const QSe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class thn{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=Lde,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,$o.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=bz(n),this.isVariantNode=CWe(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,Jfn.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)),LWe.current||Zfn(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:vse.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),h2(this.notifyUpdate),h2(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=L8.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&$o.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 yj){const n=yj[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<QSe.length;r++){const s=QSe[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=ehn(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=bj(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"&&(DB(r)||$B(r))?r=parseFloat(r):!cfn(r)&&p2.test(n)&&(r=fWe(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=Kde(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 Lj),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){$de.render(this.render)}}class DWe extends thn{constructor(){super(...arguments),this.KeyframeResolver=Qdn}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$u(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function BWe(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 nhn(t){return window.getComputedStyle(t)}class rhn extends DWe{constructor(){super(...arguments),this.type="html",this.renderInstance=BWe}readValueFromInstance(e,n){var r;if(L8.has(n))return(r=this.projection)!=null&&r.isProjecting?dse(n):xdn(e,n);{const s=nhn(e),a=(Ede(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return RWe(e,n)}build(e,n,r){Wde(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Yde(e,n,r)}}const $We=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){BWe(t,e,void 0,r);for(const s in e.attrs)t.setAttribute($We.has(s)?s:Xde(s),e.attrs[s])}class ihn extends DWe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(L8.has(n)){const r=dWe(n);return r&&r.default||0}return n=$We.has(n)?n:Xde(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return kWe(e,n,r)}build(e,n,r){jWe(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){shn(e,n,r,s)}mount(e){this.isSVGTag=_We(e.tagName),super.mount(e)}}const ahn=(t,e)=>Gde(t)?new ihn(e):new rhn(e,{allowProjection:t!==h.Fragment});function z4(t,e,n){const r=t.getProps();return Kde(r,e,n!==void 0?n:r.custom,t)}const wse=t=>Array.isArray(t);function ohn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,bj(n))}function lhn(t){return wse(t)?t[t.length-1]||0:t}function chn(t,e){const n=z4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=lhn(a[o]);ohn(t,o,l)}}function uhn(t){return!!($u(t)&&t.add)}function Cse(t,e){const n=t.getValue("willChange");if(uhn(n))return n.add(e);if(!n&&Bc.WillChange){const r=new Bc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function UWe(t){return t.props[TWe]}const dhn=t=>t!==null;function fhn(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(dhn),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const hhn={type:"spring",stiffness:500,damping:25,restSpeed:10},phn=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),mhn={type:"keyframes",duration:.8},xhn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ghn=(t,{keyframes:e})=>e.length>2?mhn:L8.has(t)?t.startsWith("scale")?phn(e[1]):hhn:xhn;function bhn({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 Qde=(t,e,n,r={},s,a)=>o=>{const l=Dde(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ql(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};bhn(l)||Object.assign(d,ghn(t,d)),d.duration&&(d.duration=ql(d.duration)),d.repeatDelay&&(d.repeatDelay=ql(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(xse(d),d.delay===0&&(f=!0)),(Bc.instantAnimations||Bc.skipAnimations)&&(f=!0,xse(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=fhn(d.keyframes,l);if(x!==void 0){$o.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new Rde(d):new Bdn(d)};function yhn({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function zWe(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&&yhn(u,d))continue;const g={delay:n,...Dde(a||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(x)&&x===y&&!g.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const N=UWe(t);if(N){const I=window.MotionHandoffAnimation(N,d,$o);I!==null&&(g.startTime=I,v=!0)}}Cse(t,d),f.start(Qde(d,f,x,t.shouldReduceMotion&&lWe.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{$o.update(()=>{o&&chn(t,o)})}),c}function HWe(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 Sse(t,e,n={}){var c;const r=z4(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(zWe(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return vhn(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 vhn(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(Sse(c,e,{...o,delay:n+(typeof r=="function"?0:r)+HWe(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function whn(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>Sse(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=Sse(t,e,n);else{const s=typeof e=="function"?z4(t,e,n.custom):e;r=Promise.all(zWe(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function VWe(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 Chn=Vde.length;function WWe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?WWe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Chn;n++){const r=Vde[n],s=t.props[r];(Ak(s)||s===!1)&&(e[r]=s)}return e}const Shn=[...Hde].reverse(),Nhn=Hde.length;function jhn(t){return e=>Promise.all(e.map(({animation:n,options:r})=>whn(t,n,r)))}function Ahn(t){let e=jhn(t),n=ZSe(),r=!0;const s=c=>(u,d)=>{var x;const f=z4(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=WWe(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<Nhn;C++){const N=Shn[C],I=n[N],P=u[N]!==void 0?u[N]:d[N],M=Ak(P),F=N===c?I.isActive:null;F===!1&&(y=C);let $=P===d[N]&&P!==u[N]&&M;if($&&r&&t.manuallyAnimateOnMount&&($=!1),I.protectedKeys={...g},!I.isActive&&F===null||!P&&!I.prevProp||gz(P)||typeof P=="boolean")continue;const L=_hn(I.prevProp,P);let z=L||N===c&&I.isActive&&!$&&M||C>y&&M,Q=!1;const se=Array.isArray(P)?P:[P];let ee=se.reduce(s(N),{});F===!1&&(ee={});const{prevResolvedValues:K={}}=I,re={...K,...ee},de=ae=>{z=!0,x.has(ae)&&(Q=!0,x.delete(ae)),I.needsAnimating[ae]=!0;const q=t.getValue(ae);q&&(q.liveStyle=!1)};for(const ae in re){const q=ee[ae],W=K[ae];if(g.hasOwnProperty(ae))continue;let ne=!1;wse(q)&&wse(W)?ne=!VWe(q,W):ne=q!==W,ne?q!=null?de(ae):x.add(ae):q!==void 0&&x.has(ae)?de(ae):I.protectedKeys[ae]=!0}I.prevProp=P,I.prevResolvedValues=ee,I.isActive&&(g={...g,...ee}),r&&t.blockInitialAnimation&&(z=!1);const G=$&&L;z&&(!G||Q)&&f.push(...se.map(ae=>{const q={type:N};if(typeof ae=="string"&&r&&!G&&t.manuallyAnimateOnMount&&t.parent){const{parent:W}=t,ne=z4(W,ae);if(W.enteringChildren&&ne){const{delayChildren:oe}=ne.transition||{};q.delay=HWe(W.enteringChildren,t,oe)}}return{animation:ae,options:q}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const N=z4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);N&&N.transition&&(C.transition=N.transition)}x.forEach(N=>{const I=t.getBaseTarget(N),P=t.getValue(N);P&&(P.liveStyle=!0),C[N]=I??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=ZSe()}}}function _hn(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!VWe(e,t):!1}function Pv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ZSe(){return{animate:Pv(!0),whileInView:Pv(),whileHover:Pv(),whileTap:Pv(),whileDrag:Pv(),whileFocus:Pv(),exit:Pv()}}class D2{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Ehn extends D2{constructor(e){super(e),e.animationState||(e.animationState=Ahn(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();gz(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 khn=0;class Thn extends D2{constructor(){super(...arguments),this.id=khn++}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 Ihn={animation:{Feature:Ehn},exit:{Feature:Thn}};function Ek(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function iI(t){return{point:{x:t.pageX,y:t.pageY}}}const Phn=t=>e=>Ude(e)&&t(e,iI(e));function K9(t,e,n,r){return Ek(t,e,Phn(n),r)}const qWe=1e-4,Fhn=1-qWe,Ohn=1+qWe,GWe=.01,Mhn=0-GWe,Rhn=0+GWe;function gd(t){return t.max-t.min}function Lhn(t,e,n){return Math.abs(t-e)<=n}function JSe(t,e,n,r=.5){t.origin=r,t.originPoint=Go(e.min,e.max,t.origin),t.scale=gd(n)/gd(e),t.translate=Go(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Fhn&&t.scale<=Ohn||isNaN(t.scale))&&(t.scale=1),(t.translate>=Mhn&&t.translate<=Rhn||isNaN(t.translate))&&(t.translate=0)}function Y9(t,e,n,r){JSe(t.x,e.x,n.x,r?r.originX:void 0),JSe(t.y,e.y,n.y,r?r.originY:void 0)}function eNe(t,e,n){t.min=n.min+e.min,t.max=t.min+gd(e)}function Dhn(t,e,n){eNe(t.x,e.x,n.x),eNe(t.y,e.y,n.y)}function tNe(t,e,n){t.min=e.min-n.min,t.max=t.min+gd(e)}function X9(t,e,n){tNe(t.x,e.x,n.x),tNe(t.y,e.y,n.y)}function $h(t){return[t("x"),t("y")]}const KWe=({current:t})=>t?t.ownerDocument.defaultView:null,nNe=(t,e)=>Math.abs(t-e);function Bhn(t,e){const n=nNe(t.x,e.x),r=nNe(t.y,e.y);return Math.sqrt(n**2+r**2)}class YWe{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=xQ(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=Bhn(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:N,onMove:I}=this.handlers;g||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),I&&I(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=mQ(g,this.transformPagePoint),$o.update(this.updatePoint,!0)},this.handlePointerUp=(x,g)=>{this.end();const{onEnd:y,onSessionEnd:v,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=xQ(x.type==="pointercancel"?this.lastMoveEventInfo:mQ(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,N),v&&v(x,N)},!Ude(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=iI(e),c=mQ(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=tu;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,xQ(c,this.history)),this.removeListeners=vx(K9(this.contextWindow,"pointermove",this.handlePointerMove),K9(this.contextWindow,"pointerup",this.handlePointerUp),K9(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),h2(this.updatePoint)}}function mQ(t,e){return e?{point:e(t.point)}:t}function rNe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function xQ({point:t},e){return{point:t,delta:rNe(t,XWe(e)),offset:rNe(t,$hn(e)),velocity:Uhn(e,.1)}}function $hn(t){return t[0]}function XWe(t){return t[t.length-1]}function Uhn(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=XWe(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>ql(e)));)n--;if(!r)return{x:0,y:0};const a=ll(s.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(s.x-r.x)/a,y:(s.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function zhn(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 sNe(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 Hhn(t,{top:e,left:n,bottom:r,right:s}){return{x:sNe(t.x,n,s),y:sNe(t.y,e,r)}}function iNe(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 Vhn(t,e){return{x:iNe(t.x,e.x),y:iNe(t.y,e.y)}}function Whn(t,e){let n=.5;const r=gd(t),s=gd(e);return s>r?n=sx(e.min,e.max-r,t.min):r>s&&(n=sx(t.min,t.max-s,e.min)),Dc(0,1,n)}function qhn(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 Nse=.35;function Ghn(t=Nse){return t===!1?t=0:t===!0&&(t=Nse),{x:aNe(t,"left","right"),y:aNe(t,"top","bottom")}}function aNe(t,e,n){return{min:oNe(t,e),max:oNe(t,n)}}function oNe(t,e){return typeof t=="number"?t:t[e]||0}const Khn=new WeakMap;class Yhn{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(iI(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=tfn(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),$h(N=>{let I=this.getAxisMotionValue(N).get()||0;if(ex.test(I)){const{projection:P}=this.visualElement;if(P&&P.layout){const M=P.layout.layoutBox[N];M&&(I=gd(M)*(parseFloat(I)/100))}}this.originPoint[N]=I}),v&&$o.postRender(()=>v(f,x)),Cse(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},l=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x;const{dragPropagation:g,dragDirectionLock:y,onDirectionLock:v,onDrag:C}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:N}=x;if(y&&this.currentDirection===null){this.currentDirection=Xhn(N),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),C&&C(f,x)},c=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x,this.stop(f,x),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>$h(f=>{var x;return this.getAnimationState(f)==="paused"&&((x=this.getAxisMotionValue(f).animation)==null?void 0:x.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new YWe(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:KWe(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&&$o.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||!OF(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=zhn(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&&f4(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Hhn(r.layoutBox,e):this.constraints=!1,this.elastic=Ghn(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&$h(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=qhn(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!f4(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=Qfn(r,s.root,this.visualElement.getTransformPagePoint());let o=Vhn(s.layout.layoutBox,a);if(n){const l=n(Kfn(o));this.hasMutatedConstraints=!!l,l&&(o=FWe(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(!OF(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 Cse(this.visualElement,e),r.start(Qde(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(!OF(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(!f4(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]=Whn({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(!OF(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;Khn.set(this.visualElement,this);const e=this.visualElement.current,n=K9(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();f4(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()),$o.read(r);const o=Ek(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=Nse,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function OF(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Xhn(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Qhn extends D2{constructor(e){super(e),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new Yhn(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}unmount(){this.removeGroupControls(),this.removeListeners()}}const lNe=t=>(e,n)=>{t&&$o.postRender(()=>t(e,n))};class Zhn extends D2{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(e){this.session=new YWe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:KWe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:lNe(e),onStart:lNe(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&$o.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=K9(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 SM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function cNe(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const A7={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(fi.test(t))t=parseFloat(t);else return t;const n=cNe(t,e.target.x),r=cNe(t,e.target.y);return`${n}% ${r}%`}},Jhn={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=p2.parse(t);if(s.length>5)return r;const a=p2.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=Go(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),a(s)}};let gQ=!1;class epn extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;Cfn(tpn),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),gQ&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),SM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,gQ=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||$o.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),$de.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;gQ=!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 QWe(t){const[e,n]=yWe(),r=h.useContext(jde);return i.jsx(epn,{...t,layoutGroup:r,switchLayoutGroup:h.useContext(IWe),isPresent:e,safeToRemove:n})}const tpn={borderRadius:{...A7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:A7,borderTopRightRadius:A7,borderBottomLeftRadius:A7,borderBottomRightRadius:A7,boxShadow:Jhn};function npn(t,e,n){const r=$u(t)?t:bj(t);return r.start(Qde("",r,e,n)),r.animation}const rpn=(t,e)=>t.depth-e.depth;class spn{constructor(){this.children=[],this.isDirty=!1}add(e){iT(this.children,e),this.isDirty=!0}remove(e){aT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(rpn),this.isDirty=!1,this.children.forEach(e)}}function ipn(t,e){const n=cf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(h2(r),t(a-e))};return $o.setup(r,!0),()=>h2(r)}const ZWe=["TopLeft","TopRight","BottomLeft","BottomRight"],apn=ZWe.length,uNe=t=>typeof t=="string"?parseFloat(t):t,dNe=t=>typeof t=="number"||fi.test(t);function opn(t,e,n,r,s,a){s?(t.opacity=Go(0,n.opacity??1,lpn(r)),t.opacityExit=Go(e.opacity??1,0,cpn(r))):a&&(t.opacity=Go(e.opacity??1,n.opacity??1,r));for(let o=0;o<apn;o++){const l=`border${ZWe[o]}Radius`;let c=fNe(e,l),u=fNe(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||dNe(c)===dNe(u)?(t[l]=Math.max(Go(uNe(c),uNe(u),r),0),(ex.test(u)||ex.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Go(e.rotate||0,n.rotate||0,r))}function fNe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const lpn=JWe(0,.5,zie),cpn=JWe(.5,.95,dl);function JWe(t,e,n){return r=>r<t?0:r>e?1:n(sx(t,e,r))}function hNe(t,e){t.min=e.min,t.max=e.max}function Mh(t,e){hNe(t.x,e.x),hNe(t.y,e.y)}function pNe(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function mNe(t,e,n,r,s){return t-=e,t=YD(t,1/n,r),s!==void 0&&(t=YD(t,1/s,r)),t}function upn(t,e=0,n=1,r=.5,s,a=t,o=t){if(ex.test(e)&&(e=parseFloat(e),e=Go(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=Go(a.min,a.max,r);t===a&&(l-=e),t.min=mNe(t.min,e,n,l,s),t.max=mNe(t.max,e,n,l,s)}function xNe(t,e,[n,r,s],a,o){upn(t,e[n],e[r],e[s],e.scale,a,o)}const dpn=["x","scaleX","originX"],fpn=["y","scaleY","originY"];function gNe(t,e,n,r){xNe(t.x,e,dpn,n?n.x:void 0,r?r.x:void 0),xNe(t.y,e,fpn,n?n.y:void 0,r?r.y:void 0)}function bNe(t){return t.translate===0&&t.scale===1}function eqe(t){return bNe(t.x)&&bNe(t.y)}function yNe(t,e){return t.min===e.min&&t.max===e.max}function hpn(t,e){return yNe(t.x,e.x)&&yNe(t.y,e.y)}function vNe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function tqe(t,e){return vNe(t.x,e.x)&&vNe(t.y,e.y)}function wNe(t){return gd(t.x)/gd(t.y)}function CNe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ppn{constructor(){this.members=[]}add(e){iT(this.members,e),e.scheduleRender()}remove(e){if(aT(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 bQ=["","X","Y","Z"],xpn=1e3;let gpn=0;function yQ(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function nqe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=UWe(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",$o,!(s||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&nqe(r)}function rqe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=gpn++,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(vpn),this.nodes.forEach(Npn),this.nodes.forEach(jpn),this.nodes.forEach(wpn)},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 Lj),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=bWe(o)&&!ofn(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;$o.read(()=>{f=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,d&&d(),d=ipn(x,250),SM.hasAnimatedSinceResize&&(SM.hasAnimatedSinceResize=!1,this.nodes.forEach(jNe)))})}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()||Tpn,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),N=!this.targetLayout||!tqe(this.targetLayout,g),I=!f&&x;if(this.options.layoutRoot||this.resumeFrom||I||f&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const P={...Dde(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P),this.setAnimationOrigin(d,I)}else f||jNe(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),h2(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Apn),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&&nqe(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(SNe);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(NNe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Spn),this.nodes.forEach(bpn),this.nodes.forEach(ypn)):this.nodes.forEach(NNe),this.clearAllSnapshots();const l=cf.now();tu.delta=Dc(0,1e3/60,l-tu.timestamp),tu.timestamp=l,tu.isProcessing=!0,lQ.update.process(tu),lQ.preRender.process(tu),lQ.render.process(tu),tu.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,$de.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Cpn),this.sharedNodes.forEach(_pn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,$o.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){$o.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=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&&!eqe(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Xv(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),Ipn(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(Ppn))){const{scroll:d}=this.root;d&&(h4(l.x,d.offset.x),h4(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=vl();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),h4(l.x,f.offset.x),h4(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=vl();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&&p4(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Xv(d.latestValues)&&p4(c,d.latestValues)}return Xv(this.latestValues)&&p4(c,this.latestValues),c}removeTransform(o){const l=vl();Mh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Xv(u.latestValues))continue;bse(u.latestValues)&&u.updateSnapshot();const d=vl(),f=u.measurePageBox();Mh(d,f),gNe(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Xv(this.latestValues)&&gNe(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=vl(),this.relativeTargetOrigin=vl(),X9(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=vl(),this.targetWithTransforms=vl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Dhn(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mh(this.target,this.layout.layoutBox),MWe(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=vl(),this.relativeTargetOrigin=vl(),X9(this.relativeTargetOrigin,this.target,g.target),Mh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||bse(this.parent.latestValues)||OWe(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;Xfn(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():(pNe(this.prevProjectionDelta.x,this.projectionDelta.x),pNe(this.prevProjectionDelta.y,this.projectionDelta.y)),Y9(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!CNe(this.projectionDelta.x,this.prevProjectionDelta.x)||!CNe(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=m4(),this.projectionDelta=m4(),this.projectionDeltaWithTransform=m4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=m4();(!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(),N=!C||C.members.length<=1,I=!!(v&&!N&&this.options.crossfade===!0&&!this.path.some(kpn));this.animationProgress=0;let P;this.mixTargetDelta=M=>{const F=M/1e3;ANe(f.x,o.x,F),ANe(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(X9(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Epn(this.relativeTarget,this.relativeTargetOrigin,x,F),P&&hpn(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=vl()),Mh(P,this.relativeTarget)),v&&(this.animationValues=d,opn(d,u,this.latestValues,F,I,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(h2(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$o.update(()=>{SM.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=bj(0)),this.currentAnimation=npn(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(xpn),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&&sqe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||vl();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),p4(l,d),Y9(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new ppn),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&&yQ("z",o,u,this.animationValues);for(let d=0;d<bQ.length;d++)yQ(`rotate${bQ[d]}`,o,u,this.animationValues),yQ(`skew${bQ[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=CM(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=CM(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Xv(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=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 _k){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:N}=_k[y],I=f==="none"?d[y]:v(d[y],u);if(C){const P=C.length;for(let M=0;M<P;M++)o[C[M]]=I}else N?this.options.visualElement.renderState.vars[y]=I:o[y]=I}this.options.layoutId&&(o.pointerEvents=u===this?CM(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(SNe),this.root.sharedNodes.clear()}}}function bpn(t){t.updateLayout()}function ypn(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}):sqe(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=m4();Y9(l,r,e.layoutBox);const c=m4();o?Y9(c,t.applyTransform(s,!0),e.measuredBox):Y9(c,r,e.layoutBox);const u=!eqe(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();X9(y,e.layoutBox,x.layoutBox);const v=vl();X9(v,r,g.layoutBox),tqe(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 vpn(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 wpn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Cpn(t){t.clearSnapshot()}function SNe(t){t.clearMeasurements()}function NNe(t){t.isLayoutDirty=!1}function Spn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function jNe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Npn(t){t.resolveTargetDelta()}function jpn(t){t.calcProjection()}function Apn(t){t.resetSkewAndRotation()}function _pn(t){t.removeLeadSnapshot()}function ANe(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 _Ne(t,e,n,r){t.min=Go(e.min,n.min,r),t.max=Go(e.max,n.max,r)}function Epn(t,e,n,r){_Ne(t.x,e.x,n.x,r),_Ne(t.y,e.y,n.y,r)}function kpn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Tpn={duration:.45,ease:[.4,0,.1,1]},ENe=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),kNe=ENe("applewebkit/")&&!ENe("chrome/")?Math.round:dl;function TNe(t){t.min=kNe(t.min),t.max=kNe(t.max)}function Ipn(t){TNe(t.x),TNe(t.y)}function sqe(t,e,n){return t==="position"||t==="preserve-aspect"&&!Lhn(wNe(e),wNe(n),.2)}function Ppn(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Fpn=rqe({attachResizeListener:(t,e)=>Ek(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),vQ={current:void 0},iqe=rqe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!vQ.current){const t=new Fpn({});t.mount(window),t.setOptions({layoutScroll:!0}),vQ.current=t}return vQ.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Opn={pan:{Feature:Zhn},drag:{Feature:Qhn,ProjectionNode:iqe,MeasureLayout:QWe}};function INe(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&&$o.postRender(()=>a(e,iI(e)))}class Mpn extends D2{mount(){const{current:e}=this.node;e&&(this.unmount=nfn(e,(n,r)=>(INe(this.node,r,"Start"),s=>INe(this.node,s,"End"))))}unmount(){}}class Rpn extends D2{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vx(Ek(this.node.current,"focus",()=>this.onFocus()),Ek(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function PNe(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&&$o.postRender(()=>a(e,iI(e)))}class Lpn extends D2{mount(){const{current:e}=this.node;e&&(this.unmount=afn(e,(n,r)=>(PNe(this.node,r,"Start"),(s,{success:a})=>PNe(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const jse=new WeakMap,wQ=new WeakMap,Dpn=t=>{const e=jse.get(t.target);e&&e(t)},Bpn=t=>{t.forEach(Dpn)};function $pn({root:t,...e}){const n=t||document;wQ.has(n)||wQ.set(n,{});const r=wQ.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Bpn,{root:t,...e})),r[s]}function Upn(t,e,n){const r=$pn(e);return jse.set(t,n),r.observe(t),()=>{jse.delete(t),r.unobserve(t)}}const zpn={some:0,all:1};class Hpn extends D2{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:a}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:zpn[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 Upn(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(Vpn(e,n))&&this.startObserver()}unmount(){}}function Vpn({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Wpn={inView:{Feature:Hpn},tap:{Feature:Lpn},focus:{Feature:Rpn},hover:{Feature:Mpn}},qpn={layout:{ProjectionNode:iqe,MeasureLayout:QWe}},Gpn={...Ihn,...Wpn,...Opn,...qpn},ho=Gfn(Gpn,ahn);function Zde({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),[N,I]=h.useState(0),[P,M]=h.useState(320),[F,$]=h.useState("vol"),[L,z]=h.useState("desc"),[Q,se]=h.useState("all"),[ee,K]=h.useState(()=>{try{const st=localStorage.getItem("favCoins");return st?new Set(JSON.parse(st)):new Set}catch{return new Set}}),re=h.useRef(null),de=h.useRef(null),G=150,ie={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},ae=st=>{var Ve;const He=(Ve=st==null?void 0:st.split("/")[0])==null?void 0:Ve.replace("-USD","").replace("/USD","");return ie[He]||He},q=st=>st==null||isNaN(st)?"--":Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:2}).format(Number(st)),W=(st,He=6)=>st==null||isNaN(st)?"--":Number(st).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:He}),ne=st=>{const He=new Set(ee);He.has(st)?He.delete(st):He.add(st),K(He),localStorage.setItem("favCoins",JSON.stringify([...He]))},oe=st=>{F===st?z(He=>He==="asc"?"desc":"asc"):($(st),z("desc"))},he=h.useMemo(()=>((t==null?void 0:t.map(He=>{const Ve=He.rawSymbol||He.symbol||He.coin||He.ticker||"";let bt=He.symbol||He.coin||He.ticker||Ve,xt=He.builder||He.dex||"";if(He.kind==="hip3"){const it=Ve.indexOf(":");!xt&&it>=0&&(xt=Ve.slice(0,it),bt=Ve.slice(it+1))}const Qt=He.lastPrice??He.last??He.markPrice??null,St=He.change24hPct??He.chg24??null,on=He.volume??He.vol??He.dayNtlVlm??null,cn=He.fundingRate??He.funding??null,Vn=He.openInterest??He.oi??null,tn=He.openInterestUsd??He.oiUsd??(Vn!=null&&Qt!=null?Number(Vn)*Number(Qt):null),fn=He.leverage!=null?He.leverage:He.lev!=null?He.lev:null,rn=He.kind||(xt?"hip3":"perp"),nt=He.coin||bt.replace(/-USDH$/,"").replace(/-USDC$/,"").replace(/-USD$/,"").replace(/\/USD$/,"");return{kind:rn,builder:xt,dex:He.dex||"",symbol:bt,rawSymbol:Ve,last:Qt,chg24:St,vol:on,funding:cn,openInterest:tn,leverage:fn!=null&&isFinite(fn)?Math.floor(fn):null,coinForChange:nt}}))??[]).filter(He=>He.symbol),[t]),_e=h.useMemo(()=>{const st=new Map;for(const He of he){const Ve=He.symbol.replace("-USD","").replace("/USD","");st.set(Ve,He)}return st},[he]),xe=h.useMemo(()=>{if(a!=="pair")return[];const st=he.filter(on=>on.kind!=="hip3"),He=st.map(on=>on.symbol.replace("-USD","").replace("/USD","")),Ve=Array.from(new Set(He)),bt=Array.isArray(o)?new Set(o):null;let xt=Array.isArray(l)&&l.length?l:st.slice().sort((on,cn)=>Number(cn.vol||0)-Number(on.vol||0)).slice(0,30).map(on=>on.symbol.replace("-USD","").replace("/USD",""));xt=xt.filter(on=>Ve.includes(on));const Qt=[],St=new Set;for(let on=0;on<xt.length;on++){const cn=xt[on];for(let Vn=0;Vn<Ve.length;Vn++){const tn=Ve[Vn];if(!cn||!tn||cn===tn)continue;const fn=`${cn}/${tn}`;if(St.has(fn)||bt&&!bt.has(fn))continue;St.add(fn);const rn=_e.get(cn),nt=_e.get(tn),it=rn&&nt&&Number(rn.last)>0&&Number(nt.last)>0?Number(rn.last)/Number(nt.last):null,Ut=rn&&nt?Math.min(Number(rn.vol||0),Number(nt.vol||0)):null;if(Qt.push({kind:"pair",builder:"",dex:"",symbol:fn,rawSymbol:fn,last:it,chg24:null,vol:Ut,funding:null,openInterest:null,leverage:null,coinForChange:fn}),Qt.length>=300)return Qt}}return Qt},[a,he,o,l,_e]),Se=h.useMemo(()=>he.some(st=>st.kind==="hip3"),[he]);h.useEffect(()=>{a==="pair"&&($("vol"),z("desc"),se("perps"))},[a]),h.useEffect(()=>{!Se&&Q==="hip3"&&se("all")},[Se,Q]),h.useEffect(()=>{a==="pair"&&($("vol"),z("desc"),se("perps"))},[a]);const ge=h.useMemo(()=>{const st=g.trim().toLowerCase();let Ve=a==="pair"?xe.slice():he.slice();a!=="pair"&&(Q==="perps"?Ve=Ve.filter(xt=>xt.kind!=="hip3"):Q==="hip3"&&(Ve=Ve.filter(xt=>xt.kind==="hip3"))),st&&(Ve=Ve.filter(xt=>xt.symbol.toLowerCase().includes(st)));const bt=xt=>xt==null||isNaN(Number(xt))?NaN:Number(xt);return Ve.sort((xt,Qt)=>{const St=ee.has(xt.symbol)?1:0,on=ee.has(Qt.symbol)?1:0;if(St!==on)return on-St;const cn=bt(xt[F]),Vn=bt(Qt[F]),tn=isNaN(cn),fn=isNaN(Vn);return tn&&fn?xt.symbol.localeCompare(Qt.symbol):tn?1:fn?-1:cn===Vn?xt.symbol.localeCompare(Qt.symbol):L==="asc"?cn-Vn:Vn-cn}),Ve},[a,he,xe,g,ee,F,L,Q]),Ce=()=>{const st=de.current;if(!st)return;const He=st.getBoundingClientRect(),Ve=getComputedStyle(st),bt=parseFloat(Ve.paddingLeft)||0,xt=document.documentElement.clientWidth,Qt=16,on=Math.min(740,xt-Qt*2);let cn=He.left+bt;cn+on>xt-Qt&&(cn=xt-Qt-on),cn<Qt&&(cn=Qt),M(on),I(cn),C(He.bottom+8)},je=()=>{Ce(),d(!0),requestAnimationFrame(()=>x(!0))},Oe=()=>{x(!1),setTimeout(()=>d(!1),G)};h.useEffect(()=>{const st=Ve=>Ve.key==="Escape"&&u&&Oe(),He=Ve=>{var bt;return u&&!((bt=re.current)!=null&&bt.contains(Ve.target))&&Oe()};return document.addEventListener("keydown",st),document.addEventListener("mousedown",He),document.addEventListener("touchstart",He,{passive:!0}),()=>{document.removeEventListener("keydown",st),document.removeEventListener("mousedown",He),document.removeEventListener("touchstart",He)}},[u]),h.useLayoutEffect(()=>{if(!u)return;Ce();const st=()=>Ce(),He=()=>Ce();return window.addEventListener("scroll",st,!0),window.addEventListener("resize",He),()=>{window.removeEventListener("scroll",st,!0),window.removeEventListener("resize",He)}},[u]);const $e=e&&e.length>8?"min-w-[120px]":e&&e.length>6?"min-w-[108px]":"min-w-[96px]",Ye=st=>{st.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>")},Je=({active:st,dir:He})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 ml-1 ${st?"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"})}),ht=h.useMemo(()=>a!=="pair"?e||"Select":e||"Select Pair",[a,e]),rt=({children:st})=>i.jsx("span",{className:"tabular-nums whitespace-nowrap",children:st});return i.jsxs("div",{className:`relative ${$e} z-[30]`,ref:re,children:[i.jsx("div",{ref:de,className:" text-white px-1 py-2 rounded cursor-pointer text-[14px] font-medium font-['Inter'] select-none leading-none",onClick:()=>u?Oe():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:ht}),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 st=he.find(He=>a==="pair"?He.symbol===e:He.rawSymbol===e||He.symbol===e||He.coinForChange===e);return st&&st.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:Oe}),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:N,width:P,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"&&Se&&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(([st,He])=>i.jsx("button",{className:`px-2 py-1 rounded-md font-bold ${Q===st?"bg-[#262626] text-white":"text-[#8a8a8a]"}`,onClick:()=>se(st),children:He},st))}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:g,onChange:st=>y(st.target.value),placeholder:a==="pair"?"Search pairs (e.g., BTC/ETH)":"Search markets...",className:"w-full pr-8 py-1.5 pl-2.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-[12px] font-medium placeholder:text-[#535353] focus:outline-none leading-none",autoFocus:!0}),i.jsx("div",{className:"absolute right-2 top-1 pointer-events-none",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-5 h-5 text-[#646464]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7",strokeWidth:"1.5"}),i.jsx("path",{d:"M20 20L17 17",strokeWidth:"1.5"})]})})]})]}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:i.jsxs("table",{className:"w-full text-[12px] font-inter table-fixed",children:[i.jsxs("colgroup",{children:[i.jsx("col",{className:"w-[44px]"}),i.jsx("col",{className:"w-[220px]"}),i.jsx("col",{className:"w-[80px]"}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("col",{className:"w-[160px]"}),i.jsx("col",{}),i.jsx("col",{}),i.jsx("col",{})]})]}),i.jsx("thead",{className:"sticky top-0 bg-[#141414] border-b border-[#1f1f1f] text-[#9B9B9B]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left align-middle"}),i.jsx("th",{className:"text-left align-middle",children:a==="pair"?"Pair":"Symbol"}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("last"),children:["Last Price",i.jsx("span",{className:"ml-1",children:i.jsx(Je,{active:F==="last",dir:F==="last"?L:"desc"})})]})}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("chg24"),children:["24h Change",i.jsx("span",{className:"ml-1",children:i.jsx(Je,{active:F==="chg24",dir:F==="chg24"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("vol"),children:["Vol",i.jsx("span",{className:"ml-1",children:i.jsx(Je,{active:F==="vol",dir:F==="vol"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("funding"),children:["Funding",i.jsx("span",{className:"ml-1",children:i.jsx(Je,{active:F==="funding",dir:F==="funding"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("openInterest"),children:["Open Int.",i.jsx("span",{className:"ml-1",children:i.jsx(Je,{active:F==="openInterest",dir:F==="openInterest"?L:"desc"})})]})})]})]})}),i.jsx("tbody",{className:"divide-y divide-[#1f1f1f]",children:r?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-4 text-[#888888]",colSpan:a==="pair"?3:7,children:"Loading..."})}):ge.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"})}):ge.map(st=>{const He=ee.has(st.symbol),Ve=a==="pair"&&st.symbol.includes("/"),[bt,xt]=Ve?st.symbol.split("/"):[null,null],Qt=`${st.kind||"perp"}:${st.builder||""}:${st.rawSymbol||st.symbol}`;return i.jsxs("tr",{className:"hover:bg-[#1b1b1b]/70 cursor-pointer",onClick:()=>{const St=a==="pair"?st.symbol:st.kind==="hip3"&&st.rawSymbol?st.rawSymbol:st.coinForChange;n(St),Oe()},children:[i.jsx("td",{className:"align-middle",children:i.jsx("button",{onClick:St=>{St.stopPropagation(),ne(st.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:Ve?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:`${s}/${bt}.svg`,alt:bt,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Ye}),i.jsx("span",{className:"text-[#8a8a8a] text-xs",children:"/"}),i.jsx("img",{src:`${s}/${xt}.svg`,alt:xt,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Ye})]}):i.jsx("img",{src:st.kind==="hip3"?`${s}/${st.builder}:${st.symbol.replace(/-USDC$/,"").replace(/-USDH$/,"")}.svg`:`${s}/${ae(st.symbol)}.svg`,alt:st.symbol,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Ye})}),i.jsx("span",{className:"font-semibold text-white",children:a==="pair"||st.kind==="hip3"?st.symbol:st.symbol.replace(/-USD$/,"").replace(/\/USD$/,"")}),a!=="pair"&&i.jsxs("span",{className:"ml-1 inline-flex items-center gap-1",children:[st.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:[st.leverage,"x"]}),st.kind==="hip3"&&st.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:st.builder})]})]})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(rt,{children:st.last==null||st.last===0?"--":W(st.last)})}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"text-right font-medium align-middle",children:i.jsx(rt,{children:st.chg24==null||isNaN(Number(st.chg24))||st.last==null||st.last===0?"--":(()=>{const St=Number(st.chg24),on=Number(st.last),cn=on/(1+St/100||1),Vn=on-cn,tn=Math.abs(Vn);let fn;tn>=1e3?fn=0:tn>=100?fn=2:fn=4;const rn=Vn>=0?"+":"-",nt=tn.toLocaleString(void 0,{minimumFractionDigits:fn,maximumFractionDigits:fn}),it=`${St>0?"+":""}${St.toFixed(2)}%`,Ut=St>0?"#67FFBD":"#FF7173";return i.jsx("span",{style:{color:Ut},children:`${rn}${nt} / ${it}`})})()})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(rt,{children:q(st.vol)})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(rt,{children:st.funding==null||isNaN(Number(st.funding))?"--":(Number(st.funding)*100).toFixed(4)+"%"})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(rt,{children:st.openInterest==null||isNaN(Number(st.openInterest))?"--":"$"+q(st.openInterest)})})]})]},Qt)})})]})})]})})]})}let MF=null;function Kpn(){return typeof window>"u"?null:(MF||(MF=new Audio("/success.mp3"),MF.volume=.9),MF)}function Ypn(){const t=Kpn();if(t)try{t.currentTime=0;const e=t.play();e&&typeof e.then=="function"&&e.catch(function(){})}catch{}}function Xpn(){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 Ase=null;function Qpn(t){typeof t=="object"&&!Array.isArray(t)?Ase=t:Ase=null}async function Zpn(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 FNe(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 ONe(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 CQ(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 Jde(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 Jpn(t){return Jde(t).some(e=>{const n=String(e.status||e.s||"").toLowerCase();return n.includes("placed")||n.includes("resting")})}function emn(t){return Jde(t).some(n=>{const r=String(n.status||n.s||"").toLowerCase();return r.includes("filled")||r.includes("success")||!!n.filled})}function RF(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 vj({baseUrl:t="https://api.hyperliquid.xyz",address:e,signer:n,vaultAddress:r=null,dex:s="",defaultSlippage:a=.08,isMainnet:o=!0,signatureChainIdHex:l="0xa4b1",getPK:c=()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,dextraApiBase:u="https://dextrabothypev2.nftinit.io",builderAddress:d="0x49ae63056b3a0be0b166813ee687309ab653c07c",getAuth:f,defaultFromStart:x="website",defaultAppType:g="terminal",defaultLeverage:y=null,getLeverage:v,feeTtlMs:C=12e4}={}){if(!e)throw new Error("address is required for info calls");if(!n||typeof n.sign!="function")throw new Error("signer with sign(action, nonce) is required for exchange actions");let N=null;const I={"Content-Type":"application/json"},P=6,M=o?"Mainnet":"Testnet",F=async(Ge,ct)=>{const vt=t+Ge,Ht=await fetch(vt,{method:"POST",headers:I,body:JSON.stringify(ct)});if(!Ht.ok)throw new Error(`HTTP ${Ht.status} on ${Ge}`);return Ht.json()},$=(Ge,ct)=>{if(!Ge||typeof Ge!="object")return NaN;const vt=String(ct||"").trim();if(!vt)return NaN;const Ht=vt.toUpperCase();if(Ge[vt]!=null){const un=Number(Ge[vt]);if(Number.isFinite(un))return un}if(Ge[Ht]!=null){const un=Number(Ge[Ht]);if(Number.isFinite(un))return un}const Rt=Ht.indexOf("-");if(Rt>0){const un=Ht.slice(0,Rt);if(Ht.slice(Rt+1)==="PERP"&&Ge[un]!=null){const _n=Number(Ge[un]);if(Number.isFinite(_n))return _n}}const mn=Object.keys(Ge).find(un=>String(un).toUpperCase()===Ht);if(mn){const un=Number(Ge[mn]);if(Number.isFinite(un))return un}return NaN},L={allMids:async()=>F("/info",{type:"allMids",dex:s}),openOrders:async(Ge=e)=>F("/info",{type:"openOrders",user:Ge,dex:s}),frontendOpenOrders:async(Ge=e)=>F("/info",{type:"frontendOpenOrders",user:Ge,dex:s}),clearinghouseState:async(Ge=e)=>F("/info",{type:"clearinghouseState",user:Ge,dex:s}),meta:async()=>{if(N)return N;const Ge=await F("/info",{type:"allPerpMetas"});return N=Ge,Ge},metaAndAssetCtxs:async()=>F("/info",{type:"metaAndAssetCtxs",dex:s}),twapHistory:async(Ge=e)=>F("/info",{type:"twapHistory",user:Ge,dex:s}),userTwapSliceFills:async(Ge=e)=>F("/info",{type:"userTwapSliceFills",user:Ge,dex:s}),userTwapSliceFillsByTime:async({user:Ge=e,startTime:ct,endTime:vt,aggregateByTime:Ht}={})=>{const Rt={type:"userTwapSliceFillsByTime",user:Ge,startTime:ct,dex:s};return vt!=null&&(Rt.endTime=vt),Ht!=null&&(Rt.aggregateByTime=!!Ht),F("/info",Rt)}};async function z(Ge){const ct=await Q(),vt=String(Ge).toUpperCase();for(let Ht=0;Ht<ct.length;Ht++){const Rt=ct[Ht];if(Array.isArray(Rt.universe)){const mn=Rt.universe.findIndex(un=>un.name.toUpperCase()===vt);if(mn!==-1){let un;return Ht===0?un=mn:un=1e5+Ht*1e4+mn,{entry:Rt.universe[mn],index:un,block:Rt}}}}throw new Error(`Unknown perp symbol: ${Ge}`)}const Q=async()=>{if(N)return N;const Ge=await L.meta();return N=Ge,Ge},se=async Ge=>(await z(Ge)).index,ee=async Ge=>(await z(Ge)).entry.szDecimals,K=Ge=>{const[ct,vt=""]=String(Ge).split(".");if(!vt)return ct;const Ht=vt.replace(/0+$/,"");return Ht.length?`${ct}.${Ht}`:ct},re=async(Ge,ct)=>{const vt=await ee(Ge),Ht=Math.max(0,P-Number(vt)),Rt=Math.abs(Number(ct));if(!(Rt>0)||!Number.isFinite(Rt))return Ht;const mn=Rt>=1?Math.floor(Math.log10(Rt))+1:0,un=Math.max(0,5-mn);return Math.min(Ht,un)},de=async(Ge,ct)=>{const vt=await re(Ge,ct);return Number((1/10**vt).toFixed(vt))},G=async(Ge,ct,vt)=>{const Ht=await re(Ge,ct),Rt=10**-Ht,mn=Number(ct),un=vt?Math.floor(mn/Rt)*Rt:Math.ceil(mn/Rt)*Rt;return K(Number(un).toFixed(Ht))},ie=async(Ge,ct)=>{if(ct==null||!Number.isFinite(Number(ct)))throw new Error("price required");const vt=await re(Ge,ct),Ht=Number(ct),Rt=vt===0?Math.round(Ht):Math.round(Ht*10**vt)/10**vt;return K(Rt.toFixed(vt))},ae=async(Ge,ct)=>{if(ct==null||!Number.isFinite(Number(ct)))throw new Error("size required");const vt=await ee(Ge);return K(Number(ct).toFixed(Number(vt)))},q=async(Ge,ct,vt,Ht=a)=>{let Rt=vt;if(Rt==null){let un=$(Ase,Ge);if(!Number.isFinite(un)){const yn=await L.allMids();un=$(yn,Ge)}if(Rt=un,!Number.isFinite(Rt))throw new Error(`Mid price not available for ${Ge}`)}const mn=ct?Rt*(1+Ht):Rt*(1-Ht);return G(Ge,mn,ct)},W=new Set(["usdSend","spotSend","usdClassTransfer","withdraw3","cDeposit","cWithdraw","approveBuilderFee"]),ne=()=>({name:"HyperliquidSignTransaction",version:"1",chainId:parseInt(l,16),verifyingContract:"0x0000000000000000000000000000000000000000"}),oe=(Ge,ct)=>{switch(Ge.type){case"usdSend":return{primaryType:"HyperliquidTransaction:UsdSend",types:{"HyperliquidTransaction:UsdSend":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},message:{hyperliquidChain:M,destination:String(Ge.destination).toLowerCase(),amount:String(Ge.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:M,destination:String(Ge.destination).toLowerCase(),token:Ge.token,amount:String(Ge.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:M,amount:String(Ge.amount),toPerp:!!Ge.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:M,destination:String(Ge.destination).toLowerCase(),amount:String(Ge.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:M,wei:String(Ge.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:M,wei:String(Ge.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:M,maxFeeRate:Ge.maxFeeRate.endsWith("%")?Ge.maxFeeRate:`${Ge.maxFeeRate}%`,builder:Ge.builder.toLowerCase(),nonce:ct}};default:return null}},he=Ge=>{const ct=lu.from(Ge),vt=ct.v>=27?ct.v:ct.v+27;return{r:ct.r,s:ct.s,v:vt}},_e=async(Ge,ct)=>{const vt=oe(Ge,ct);if(!vt)throw new Error("Unsupported typed action");const Ht=ne(),Rt=Object.assign({},vt.types,{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}]}),mn=(c()||"").trim();if(mn){const _n=await new cle(mn).signTypedData(Ht,vt.types,vt.message);return he(_n)}const un=Xpn();if(un){await Zpn(un,l);let yn=await un.request({method:"eth_accounts"});(!yn||!yn.length)&&(yn=await un.request({method:"eth_requestAccounts"}));const _n=yn[0];if(!_n)throw new Error("No connected account in wallet");if(String(_n).toLowerCase()!==String(e).toLowerCase())throw new Error(`Connected wallet ${_n} does not match HL address ${e}.`);const In={domain:Ht,types:Rt,primaryType:vt.primaryType,message:vt.message},Sn=await un.request({method:"eth_signTypedData_v4",params:[_n,JSON.stringify(In)]});return he(Sn)}throw new Error("No signer for typed action")};let xe={ts:0,fee:null};async function Se(Ge=!1){const ct=Date.now();if(!Ge&&xe.fee!=null&&ct-xe.ts<C)return{builder_fee:xe.fee};const{address:vt,token:Ht}=ONe(f);if(!vt||!Ht)return{builder_fee:null};const Rt=u+"/api/subscriber/check_account/",mn=await FNe(Rt,{address:vt,token:Ht}),un=(mn==null?void 0:mn.builder_fee)!=null?Number(mn.builder_fee):null;return xe={ts:ct,fee:un},{builder_fee:un}}async function ge(Ge){if(Ge.type!=="order")return Ge;const{builder_fee:ct}=await Se();return ct==null?Ge:{...Ge,builder:{b:d,f:Number(ct)}}}function Ce(Ge){return Ge!=null&&Ge.fromStart?Ge.fromStart:CQ(["dextra_from_start","from_start"])||x||null}function je(Ge){return Ge!=null&&Ge.appType?Ge.appType:CQ(["dextra_app_type","app_type"])||g||null}async function Oe(Ge,ct){if((ct==null?void 0:ct.leverage)!=null)return Number(ct.leverage);if(typeof v=="function"){const Ht=await v(Ge);if(Ht!=null)return Number(Ht)}const vt=CQ([`leverage:${Ge}`,`${Ge}_leverage`,"dextra_leverage","hl_leverage","leverage"])||y;return vt!=null?Number(vt):null}async function $e(Ge){const ct=await L.clearinghouseState(e),vt=((ct==null?void 0:ct.assetPositions)||[]).find(Rt=>{var mn,un;return((un=(mn=Rt==null?void 0:Rt.position)==null?void 0:mn.coin)==null?void 0:un.toUpperCase())===String(Ge).toUpperCase()});if(!vt)return null;const Ht=Number(vt.position.szi||0);return{side:Ht>=0?"long":"short",size:Math.abs(Ht)}}async function Ye({symbol:Ge,isBuy:ct,usePosSide:vt,size:Ht,price:Rt,telemetry:mn,oid:un}){var jn;if(!un&&un!==0)return;const{address:yn,token:_n}=ONe(f);if(!yn||!_n)return;const In=typeof window<"u"?window.localStorage.getItem("hl:wallet_id"):null,Sn=Ge?await Oe(Ge,mn):null,Yn=vt&&((jn=await $e(Ge))==null?void 0:jn.side)||(ct?"long":"short"),{builder_fee:Xn}=await Se(),zn={address:yn,token:_n,order_params:{coin:String(Ge),wallet_id:In!=null?Number(In):null,leverage:Sn!=null?Number(Sn):null,size:Ht!=null?Number(Ht):null,from_start:Ce(mn),app_type:je(mn),price:Rt!=null?Number(Rt):null,fee_amount:Xn!=null?Number(Xn):null,side:String(Yn),oid:Number(un)}},Kn=u+"/api/hyper/order_save/";try{await FNe(Kn,zn)}catch{}}async function Je(Ge,ct){const vt=ct??Date.now(),Ht=Ge.type==="order"?await ge(Ge):Ge,Rt=W.has(Ht.type)?await _e(Ht,vt):await n.sign(Ht,vt),mn={action:Ht,nonce:vt,signature:Rt,...r?{vaultAddress:r}:{}};return F("/exchange",mn)}async function ht(Ge,ct){var un;const vt=await Je(Ge),Ht=Jde(vt),Rt=emn(vt)||Jpn(vt)||(vt==null?void 0:vt.status)==="ok"||((un=vt==null?void 0:vt.response)==null?void 0:un.status)==="ok";let mn=null;return Rt&&(Ypn(),mn=RF(vt),mn==null&&Ht&&Ht.length&&(mn=RF(Ht))),await Ye({symbol:ct.symbol,isBuy:ct.isBuy,usePosSide:!!ct.usePosSide,size:ct.size,price:ct.price,telemetry:ct.telemetry,oid:mn}),vt}const rt=async({symbol:Ge,isBuy:ct,size:vt,price:Ht,tif:Rt="Gtc",reduceOnly:mn=!1,cloid:un,builder:yn,telemetry:_n}={})=>{const In=await se(Ge),Sn=await ae(Ge,vt),Yn=await G(Ge,Ht,!!ct),zn={type:"order",orders:[{a:In,b:!!ct,p:Yn,s:Sn,r:!!mn,t:{limit:{tif:Rt}},...un?{c:un}:{}}],grouping:"na",...yn?{builder:yn}:{}};return ht(zn,{symbol:Ge,isBuy:ct,size:Sn,price:Yn,telemetry:_n,usePosSide:!1})},st=async({symbol:Ge,isBuy:ct,size:vt,price:Ht,tif:Rt="Gtc",reduceOnly:mn=!1,tpPrice:un=null,slPrice:yn=null,triggerSlippage:_n=.08,cloid:In,builder:Sn,telemetry:Yn}={})=>{const Xn=await se(Ge),zn=await ae(Ge,vt),Kn=[],jn=await G(Ge,Ht,!!ct);Kn.push({a:Xn,b:!!ct,p:jn,s:zn,r:!!mn,t:{limit:{tif:Rt}},...In?{c:In}:{}});const De=!ct;if(yn!=null&&yn!==""&&Number(yn)>0){const qe=await ie(Ge,yn),Ae=await q(Ge,De,Number(qe),_n);Kn.push({a:Xn,b:De,p:Ae,s:zn,r:!0,t:{trigger:{isMarket:!0,triggerPx:qe,tpsl:"sl"}}})}if(un!=null&&un!==""&&Number(un)>0){const qe=await ie(Ge,un),Ae=await q(Ge,De,Number(qe),_n);Kn.push({a:Xn,b:De,p:Ae,s:zn,r:!0,t:{trigger:{isMarket:!0,triggerPx:qe,tpsl:"tp"}}})}const pe={type:"order",orders:Kn,grouping:Kn.length>1?"normalTpsl":"na",...Sn?{builder:Sn}:{}};return ht(pe,{symbol:Ge,isBuy:ct,size:zn,price:jn,telemetry:Yn,usePosSide:!1})},He=async({symbol:Ge,tpPrice:ct=null,slPrice:vt=null,size:Ht=null,useLimitPx:Rt=!1,triggerSlippage:mn=.1,telemetry:un}={})=>{const yn=await $e(Ge);if(!yn)throw new Error(`No open position for ${Ge}`);const _n=await se(Ge),In=await ae(Ge,Ht??yn.size),Sn=yn.side==="short",Yn=[];let Xn=null;if(vt!=null&&Number(vt)>0){const Kn=await ie(Ge,vt),jn=Rt?Kn:await q(Ge,Sn,Number(Kn),mn);Yn.push({a:_n,b:Sn,p:jn,s:In,r:!0,t:{trigger:{isMarket:!Rt,triggerPx:Kn,tpsl:"sl"}}}),Xn=Xn??Kn}if(ct!=null&&Number(ct)>0){const Kn=await ie(Ge,ct),jn=Rt?Kn:await q(Ge,Sn,Number(Kn),mn);Yn.push({a:_n,b:Sn,p:jn,s:In,r:!0,t:{trigger:{isMarket:!Rt,triggerPx:Kn,tpsl:"tp"}}}),Xn=Xn??Kn}if(!Yn.length)throw new Error("TP/SL price required");return ht({type:"order",orders:Yn,grouping:"normalTpsl"},{symbol:Ge,isBuy:Sn,size:In,price:Xn??0,telemetry:un,usePosSide:!0})},Ve=async(Ge={})=>(await tn({filter:"tpsl",symbol:Ge.symbol}),He(Ge)),bt=async(Ge,ct,vt,{price:Ht,slippage:Rt=a,cloid:mn,tif:un="Ioc",reduceOnly:yn=!1,builder:_n,telemetry:In}={})=>{const Sn=await q(Ge,ct,Ht,Rt);return rt({symbol:Ge,isBuy:ct,size:vt,price:Sn,tif:"FrontendMarket",reduceOnly:yn,cloid:mn,builder:_n,telemetry:In})},xt=async(Ge,ct,{price:vt,slippage:Ht=a,cloid:Rt,tif:mn="Ioc",reduceOnly:un=!0,builder:yn,telemetry:_n}={})=>{let In,Sn=ct;if(Sn==null){const De=await L.clearinghouseState(e),pe=((De==null?void 0:De.assetPositions)||[]).find(Ae=>{var ze,zt;return((zt=(ze=Ae==null?void 0:Ae.position)==null?void 0:ze.coin)==null?void 0:zt.toUpperCase())===String(Ge).toUpperCase()});if(!pe)throw new Error(`No position found for ${Ge}`);const qe=parseFloat(pe.position.szi);if(!qe)throw new Error(`No open size on ${Ge}`);Sn=Math.abs(qe),In=qe<0}else try{const De=await L.clearinghouseState(e),pe=((De==null?void 0:De.assetPositions)||[]).find(Ae=>{var ze,zt;return((zt=(ze=Ae==null?void 0:Ae.position)==null?void 0:ze.coin)==null?void 0:zt.toUpperCase())===String(Ge).toUpperCase()});In=(pe?parseFloat(pe.position.szi):0)<0}catch{In=!1}const Yn=await q(Ge,In,vt,Ht),Xn=await se(Ge),zn=await ae(Ge,Sn),jn={type:"order",orders:[{a:Xn,b:In,p:Yn,s:zn,r:!0,t:{limit:{tif:"FrontendMarket"}},...Rt?{c:Rt}:{}}],grouping:"na",...yn?{builder:yn}:{}};return ht(jn,{symbol:Ge,isBuy:In,size:zn,price:Yn,telemetry:_n,usePosSide:!0})},Qt=async Ge=>{const ct=await L.openOrders(e),vt=Ge?ct.filter(un=>un.coin.toUpperCase()===String(Ge).toUpperCase()):ct;if(!vt.length)return{status:"ok",response:{type:"cancel",data:{count:0}}};const Ht=new Map;for(const un of vt)Ht.has(un.coin)||Ht.set(un.coin,await se(un.coin));const mn={type:"cancel",cancels:vt.map(un=>({a:Ht.get(un.coin),o:Number(un.oid)}))};return Je(mn)},St=async Ge=>{const ct=Ge==null?{type:"scheduleCancel"}:{type:"scheduleCancel",time:Date.now()+Math.max(5e3,Number(Ge))};return Je(ct)},on=async({symbol:Ge,isBuy:ct,size:vt,minutes:Ht,randomize:Rt=!1,reduceOnly:mn=!1}={})=>{var Xn,zn,Kn,jn,De,pe,qe,Ae;const un=await se(Ge),yn=await ae(Ge,vt),In={type:"twapOrder",twap:{a:un,b:!!ct,s:yn,r:!!mn,m:Number(Ht),t:!!Rt}},Sn=await Je(In),Yn=((Kn=(zn=(Xn=Sn==null?void 0:Sn.response)==null?void 0:Xn.data)==null?void 0:zn.status)==null?void 0:Kn.error)||((De=(jn=Sn==null?void 0:Sn.response)==null?void 0:jn.data)==null?void 0:De.error)||((qe=(pe=Sn==null?void 0:Sn.data)==null?void 0:pe.status)==null?void 0:qe.error)||((Ae=Sn==null?void 0:Sn.data)==null?void 0:Ae.error);if(Yn)throw new Error(Yn);return Sn},cn=async({symbol:Ge,twapId:ct}={})=>{const Ht={type:"twapCancel",a:await se(Ge),t:Number(ct)};return Je(Ht)},Vn=async({symbol:Ge,oid:ct,cloid:vt}={})=>{const Ht=await se(Ge);if(ct!=null&&/^\d+$/.test(String(ct)))return Je({type:"cancel",cancels:[{a:Ht,o:Number(ct)}]});if(vt)return Je({type:"cancelByCloid",cancels:[{asset:Ht,cloid:String(vt)}]});throw new Error("cancelOrder requires a numeric oid or a cloid")},tn=async({filter:Ge="all",symbol:ct=null}={})=>{const vt=await L.openOrders(e),Ht=Array.isArray(vt)?vt:[],Rt=In=>{const Sn=String(In.orderType||In.type||"").toLowerCase();return Ge==="all"?!0:Ge==="limit"?Sn==="limit":Ge==="tpsl"?Sn.includes("take profit")||Sn.includes("stop"):Ge==="reduceOnly"?!!In.reduceOnly:Ge==="nonReduce"?!In.reduceOnly:!1},mn=Ht.filter(In=>(!ct||String(In.coin).toUpperCase()===String(ct).toUpperCase())&&Rt(In));if(!mn.length)return{ok:!0,count:0};const un=new Map,yn=[];for(const In of mn){let Sn=un.get(In.coin);Sn||(Sn=await se(In.coin),un.set(In.coin,Sn)),yn.push({a:Sn,o:Number(In.oid)})}return Je({type:"cancel",cancels:yn})},fn=async()=>{const Ge=await L.clearinghouseState(e),vt=(Array.isArray(Ge==null?void 0:Ge.assetPositions)?Ge.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 vt){const Rt=Ht.coin,mn=Math.abs(Number(Ht.szi));await xt(Rt,mn,{tif:"FrontendMarket",reduceOnly:!0})}return!0},rn={usdTransfer:async(Ge,ct)=>{const vt=Date.now(),Ht={type:"usdSend",hyperliquidChain:M,signatureChainId:l,destination:String(Ge).toLowerCase(),amount:String(ct),time:vt};return Je(Ht)},spotTransfer:async(Ge,ct,vt)=>{const Ht=Date.now(),Rt={type:"spotSend",hyperliquidChain:M,signatureChainId:l,destination:String(Ge).toLowerCase(),token:ct,amount:String(vt),time:Ht};return Je(Rt)},usdClassTransfer:async(Ge,ct)=>{const vt=Date.now(),Ht={type:"usdClassTransfer",hyperliquidChain:M,signatureChainId:l,amount:String(Ge),toPerp:!!ct,nonce:vt};return Je(Ht,vt)},withdraw:async(Ge,ct)=>{const vt=Date.now(),Ht={type:"withdraw3",hyperliquidChain:M,signatureChainId:l,destination:String(Ge).toLowerCase(),amount:String(ct),time:vt};return Je(Ht,vt)},cDeposit:async Ge=>{const ct=Date.now(),vt={type:"cDeposit",hyperliquidChain:M,signatureChainId:l,wei:String(Ge),nonce:ct};return Je(vt,ct)},cWithdraw:async Ge=>{const ct=Date.now(),vt={type:"cWithdraw",hyperliquidChain:M,signatureChainId:l,wei:String(Ge),nonce:ct};return Je(vt,ct)},approveBuilderFee:async({builder:Ge,maxFeeRate:ct})=>{const vt=Date.now(),Ht={type:"approveBuilderFee",hyperliquidChain:M,signatureChainId:l,builder:String(Ge).toLowerCase(),maxFeeRate:String(ct),nonce:vt};return Je(Ht,vt)}},nt=(()=>{const Ge="hl:pairs",ct=()=>{try{return JSON.parse(localStorage.getItem(Ge)||"[]")}catch{return[]}},vt=yn=>{try{localStorage.setItem(Ge,JSON.stringify(yn))}catch{}};return{read:ct,write:vt,get:yn=>ct().find(_n=>_n.id===yn)||null,add:yn=>{const _n=ct();_n.push(yn),vt(_n)},upsert:yn=>{const _n=ct().filter(In=>In.id!==yn.id);_n.push(yn),vt(_n)},remove:yn=>vt(ct().filter(_n=>_n.id!==yn))}})(),it=(Ge="PAIR")=>`${Ge}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;async function Ut(Ge,ct,vt,Ht,Rt){const mn=[{symbol:ct.symbol,side:"long",size:Number(ct.size),oid:RF(Ht)??null},{symbol:vt.symbol,side:"short",size:Number(vt.size),oid:RF(Rt)??null}];return nt.add({id:Ge,createdAt:Date.now(),legs:mn}),{pairId:Ge,long:{oid:mn[0].oid},short:{oid:mn[1].oid}}}const hn=async({long:Ge,short:ct,entrySlippage:vt=a,triggerSlippage:Ht=.1,telemetry:Rt,pairId:mn}={})=>{if(!(Ge!=null&&Ge.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");if(!(Number(Ge.size)>0)||!(Number(ct.size)>0))throw new Error("pair sizes must be > 0");const un=mn||it(),[yn,_n]=await Promise.all([placeMarketWithTPSL({symbol:Ge.symbol,isBuy:!0,size:Number(Ge.size),entrySlippage:vt,tpPrice:Ge.tpPrice??null,slPrice:Ge.slPrice??null,triggerSlippage:Ht,telemetry:Rt,cloid:`${un}:L`}),placeMarketWithTPSL({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),entrySlippage:vt,tpPrice:ct.tpPrice??null,slPrice:ct.slPrice??null,triggerSlippage:Ht,telemetry:Rt,cloid:`${un}:S`})]);return Ut(un,Ge,ct,yn,_n)},nn=async({long:Ge,short:ct,triggerSlippage:vt=a,telemetry:Ht,pairId:Rt}={})=>{if(!(Ge!=null&&Ge.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");const mn=Rt||it(),[un,yn]=await Promise.all([Ge.tpPrice||Ge.slPrice?st({symbol:Ge.symbol,isBuy:!0,size:Number(Ge.size),price:Number(Ge.price),tif:String(Ge.tif||"Gtc"),reduceOnly:!!Ge.reduceOnly,tpPrice:Ge.tpPrice??null,slPrice:Ge.slPrice??null,triggerSlippage:vt,telemetry:Ht,cloid:`${mn}:L`}):rt({symbol:Ge.symbol,isBuy:!0,size:Number(Ge.size),price:Number(Ge.price),tif:String(Ge.tif||"Gtc"),reduceOnly:!!Ge.reduceOnly,telemetry:Ht,cloid:`${mn}:L`}),ct.tpPrice||ct.slPrice?st({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:vt,telemetry:Ht,cloid:`${mn}:S`}):rt({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),price:Number(ct.price),tif:String(ct.tif||"Gtc"),reduceOnly:!!ct.reduceOnly,telemetry:Ht,cloid:`${mn}:S`})]);return Ut(mn,Ge,ct,un,yn)},Vt=async({long:Ge,short:ct,telemetry:vt,pairId:Ht}={})=>{if(!(Ge!=null&&Ge.symbol)||!(ct!=null&&ct.symbol))throw new Error("pair requires long.symbol and short.symbol");const Rt=Ht||it(),[mn,un]=await Promise.all([on({symbol:Ge.symbol,isBuy:!0,size:Number(Ge.size),minutes:Number(Ge.minutes),randomize:!!Ge.randomize,reduceOnly:!!Ge.reduceOnly}),on({symbol:ct.symbol,isBuy:!1,size:Number(ct.size),minutes:Number(ct.minutes),randomize:!!ct.randomize,reduceOnly:!!ct.reduceOnly})]);return Ut(Rt,Ge,ct,mn,un)};async function pt(Ge){var Rt;const ct=await L.clearinghouseState(e),vt=((ct==null?void 0:ct.assetPositions)||[]).find(mn=>{var un,yn;return((yn=(un=mn==null?void 0:mn.position)==null?void 0:un.coin)==null?void 0:yn.toUpperCase())===String(Ge).toUpperCase()}),Ht=Number(((Rt=vt==null?void 0:vt.position)==null?void 0:Rt.szi)||0);return{size:Math.abs(Ht),side:Ht>=0?"long":"short"}}return{updateLeverage:async(Ge,ct,vt)=>{var yn,_n,In,Sn,Yn,Xn,zn,Kn;const Rt={type:"updateLeverage",asset:await se(Ge),isCross:String(ct||"").toLowerCase()==="cross",leverage:Number(vt)},mn=await Je(Rt),un=((In=(_n=(yn=mn==null?void 0:mn.response)==null?void 0:yn.data)==null?void 0:_n.status)==null?void 0:In.error)||((Yn=(Sn=mn==null?void 0:mn.response)==null?void 0:Sn.data)==null?void 0:Yn.error)||((zn=(Xn=mn==null?void 0:mn.data)==null?void 0:Xn.status)==null?void 0:zn.error)||((Kn=mn==null?void 0:mn.data)==null?void 0:Kn.error)||((mn==null?void 0:mn.status)==="err"?mn==null?void 0:mn.response:null);if(un)throw new Error(String(un));return mn},placeOrder:rt,placeLimitWithTPSL:st,placeTPSLForPosition:He,replaceTPSLForPosition:Ve,cancelAllOrders:Qt,scheduleCancel:St,marketOpen:bt,marketClose:xt,placeMarketWithTPSL:async Ge=>{const ct=await q(Ge.symbol,Ge.isBuy,null,Ge.entrySlippage??a);return st({...Ge,price:Number(ct),tif:"FrontendMarket"})},placeTwapOrder:on,cancelTwapOrder:cn,cancelOrder:Vn,cancelOrdersFiltered:tn,closeAllPositions:fn,marketOpenPair:hn,limitOpenPair:nn,twapOpenPair:Vt,marketClosePair:async({pairId:Ge,slippage:ct=a,fraction:vt=1,telemetry:Ht}={})=>{const Rt=nt.get(Ge);if(!Rt)throw new Error("Unknown pairId");const[mn]=Rt.legs.filter(jn=>jn.side==="long"),[un]=Rt.legs.filter(jn=>jn.side==="short");if(!mn||!un)throw new Error("Pair legs corrupted");const[yn,_n]=await Promise.all([pt(mn.symbol),pt(un.symbol)]),In=Math.max(0,Math.min(yn.size,mn.size)*Number(vt||1)),Sn=Math.max(0,Math.min(_n.size,un.size)*Number(vt||1)),Yn=[];if(In>0&&Yn.push(xt(mn.symbol,In,{slippage:ct,reduceOnly:!0,telemetry:Ht,cloid:`${Ge}:L:CLOSE`})),Sn>0&&Yn.push(xt(un.symbol,Sn,{slippage:ct,reduceOnly:!0,telemetry:Ht,cloid:`${Ge}:S:CLOSE`})),!Yn.length)return{pairId:Ge,message:"Nothing to close"};const Xn=await Promise.all(Yn),[zn,Kn]=await Promise.all([pt(mn.symbol),pt(un.symbol)]);return zn.size===0&&Kn.size===0&&nt.remove(Ge),{pairId:Ge,results:Xn}},pairs:{list:()=>nt.read(),get:Ge=>nt.get(Ge),remove:Ge=>nt.remove(Ge)},info:L,transfers:rn,utils:{getPerpAssetId:se,getSzDecimals:ee,toPxString:ie,toSzString:ae,withSlippagePx:q,trimZeros:K,getPxDecimalsAt:re,getTickSize:de,quantizePx:G}}}const _se="https://api.hyperliquid.xyz/info",tmn="wss://api.hyperliquid.xyz/ws";function nmn(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 aqe(){for(const t of Jd.subs)try{t(Jd.rows)}catch{}}async function rmn(){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,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=nmn(x.name),v=Number(g.markPx??g.midPx??0),C=Number(g.prevDayPx??0);s.push({kind:"hip3",dex:a,builder:y.builder||a,rawSymbol:x.name,coin:y.symbol,symbol:y.symbol,last:v,prevDayPx:C,chg24:C?(v-C)/C*100:0,vol:Number(g.dayNtlVlm??0),funding:Number(g.funding??0),leverage:x.maxLeverage??null,openInterest:Number(g.openInterest??0)})}}catch{}return s}catch{return[]}}async function MNe(){try{const[t,e]=await Promise.all([rmn(),smn()]);Jd.rows=[...t,...e],aqe()}catch{}}function imn(){if(!Jd.started){Jd.started=!0,MNe(),Jd.timer=setInterval(MNe,6e4);try{const t=new WebSocket(tmn);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||{};Qpn(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,aqe()},t.onclose=()=>{Jd.ws=null}}catch{}}}function yz(){const[t,e]=h.useState(Jd.rows);return h.useEffect(()=>{imn(),e(Jd.rows);const n=r=>{e(r)};return Jd.subs.add(n),()=>{Jd.subs.delete(n)}},[]),t}const SQ=({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(sI,{children:s&&i.jsx(ho.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(L(u)),[x,g]=h.useState((n==null?void 0:n.markPx)||0),[y,v]=h.useState("text-white"),[C,N]=h.useState({last:null,mark:null,oracle:null}),I=h.useRef((n==null?void 0:n.markPx)||0),P=yz(),M=l.length?l:P,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 he=n.markPx.toString(),_e=he.includes(".")?he.split(".")[1].length:0;r(_e)}},[F,n==null?void 0:n.markPx]),h.useEffect(()=>{if(!F)return;let he=!1;const _e=async()=>{var xe;try{const ge=await(await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allMids"})})).json(),Ce=((xe=ge==null?void 0:ge.data)==null?void 0:xe.universe)||[],[je,Oe]=String(a).split("/"),$e=Ce.find(He=>(He==null?void 0:He.name)===je),Ye=Ce.find(He=>(He==null?void 0:He.name)===Oe),Je=Number(($e==null?void 0:$e.markPx)||0),ht=Number((Ye==null?void 0:Ye.markPx)||0),rt=Number(($e==null?void 0:$e.oraclePx)||0),st=Number((Ye==null?void 0:Ye.oraclePx)||0);if(Je>0&&ht>0){const He=Je/ht,Ve=rt>0&&st>0?rt/st:null;N({last:He,mark:He,oracle:Ve});const bt=He.toString().includes(".")?He.toString().split(".")[1].length:0;r(bt)}}catch{}he||setTimeout(_e,1500)};return _e(),()=>{he=!0}},[F,a]);function L(he){const _e=new Date,xe=_e.getTime(),Se=Number(he);if(Number.isFinite(Se)&&Se>xe){const ht=Math.max(0,Math.floor((Se-xe)/1e3)),rt=String(Math.floor(ht/3600)).padStart(2,"0"),st=String(Math.floor(ht%3600/60)).padStart(2,"0"),He=String(ht%60).padStart(2,"0");return`${rt}:${st}:${He}`}_e.setSeconds(_e.getSeconds()+1);const ge=Date.UTC(_e.getUTCFullYear(),_e.getUTCMonth(),_e.getUTCDate(),_e.getUTCHours(),_e.getUTCMinutes(),_e.getUTCSeconds()),je=new Date(Date.UTC(_e.getUTCFullYear(),_e.getUTCMonth(),_e.getUTCDate(),_e.getUTCHours()+1,0,0,0)).getTime()-ge,Oe=Math.floor(je/1e3),$e=String(Math.floor(Oe/3600)).padStart(2,"0"),Ye=String(Math.floor(Oe%3600/60)).padStart(2,"0"),Je=String(Oe%60).padStart(2,"0");return`${$e}:${Ye}:${Je}`}h.useEffect(()=>{f(L(u));const he=setInterval(()=>f(L(u)),1e3);return()=>clearInterval(he)},[u]),h.useEffect(()=>{if(F){const he=C.mark;if(!he)return;const _e=I.current;he>_e?v("text-[#1DE6A3]"):he<_e&&v("text-[#FF7173]"),g(he);const xe=setTimeout(()=>v("text-white"),800);return I.current=he,()=>clearTimeout(xe)}else{if(!(n!=null&&n.markPx))return;const he=n.markPx,_e=I.current;he>_e?v("text-[#1DE6A3]"):he<_e&&v("text-[#FF7173]"),g(he);const xe=setTimeout(()=>v("text-white"),800);return I.current=he,()=>clearTimeout(xe)}},[F,C.mark,n==null?void 0:n.markPx]);const z=()=>i.jsx("div",{className:"flex items-center justify-start w-[76px]",children:i.jsx("div",{className:"w-[76px] max-w-[76px] h-[16px] rounded skeleton-ticker-text short ml-4 mt-1"})}),Q=(n==null?void 0:n.source)==="extended",se=he=>{const _e=Number(he);if(!Number.isFinite(_e))return z();const xe=Math.abs(_e);let Se=1;return xe>=1e3?Se=1:xe>=100?Se=2:xe>=1?Se=3:xe>=.1?Se=4:Se=6,_e.toLocaleString(void 0,{maximumFractionDigits:Se})},ee=he=>he==null||isNaN(he)?z():he>=1e3?d3(he):he,K=he=>{const _e=Number(he);if(!Number.isFinite(_e))return z();const xe=Math.abs(_e),Se=_e>=0?"+":"-";if(!Q)return`${Se}${xe.toFixed(5)}`;let ge=0;xe<.1?ge=6:xe<1?ge=4:xe<10?ge=2:xe<100&&(ge=1);const Ce=xe.toFixed(ge),je=ge>0?Ce.replace(/\.?0+$/,""):Ce;return`${Se}${je}`},re=Number.isFinite(n==null?void 0:n.markPx)&&Number.isFinite(n==null?void 0:n.prevDayPx)?n.markPx-n.prevDayPx:null,de=re!=null&&(n!=null&&n.prevDayPx)?re/n.prevDayPx*100:null,G=re!=null?K(re):null,ie=re==null?"text-white":re>=0?"text-[#1DE6A3]":"text-[#FF7173]",ae=de==null?"text-white":de>=0?"text-[#1DE6A3]":"text-[#FF7173]",q=()=>{const[he,_e]=String(a).split("/");return i.jsxs("div",{className:"flex -space-x-2 items-center",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${he||""}.svg`||za,alt:"pair_a",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a]",loading:"lazy",onError:xe=>wm(xe)}),i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${_e||""}.svg`||za,alt:"pair_b",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a] border border-[#0f0f0f]",loading:"lazy",onError:xe=>wm(xe)})]})},W=F?"pair":"single",ne=F?a:t,oe=F?o:e;return i.jsx("div",{className:"flex justify-between items-center gap-2 md:gap-4 w-full relative",children:i.jsxs("div",{className:"flex justify-between xl:justify-start items-center gap-2 sm:gap-4 w-full sm:w-max",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"flex justify-center items-center",children:F?i.jsx(q,{}):i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${$[t]||(t==null?void 0:t.split("/")[0])}.svg`||za,alt:"token_image",className:"w-8 h-8 min-w-8 min-h-8 rounded-full",loading:"lazy",onError:he=>wm(he)})}),i.jsx(Zde,{markets:M,value:ne,onChange:oe,loading:!M.length,showIcon:!0,mode:W})]}),i.jsx("div",{className:"hidden lg:flex bg-[#101010]",children:F?i.jsx(i.Fragment,{}):i.jsxs(i.Fragment,{children:[i.jsx(PC,{title:i.jsx(SQ,{text:"Used for margining, computing unrealized PnL, liquidations and triggering TP/SL orders.",children:"Mark"}),widthValue:"70px",info:Q?se(x):ee(x),color_1:y}),i.jsx(PC,{title:i.jsx(SQ,{text:"Median price from external sources reported by validators; used to calculate funding rates.",children:"Oracle"}),widthValue:"80px",info:Q?se(n==null?void 0:n.oraclePx):ee(n==null?void 0:n.oraclePx),color_1:"text-white"}),i.jsx(PC,{title:"24h Change",widthValue:"120px",info:G??z(),info_2:de,color_1:ie,color_2:ae}),i.jsx(PC,{title:"24h Volume",widthValue:"130px",info:n!=null&&n.dayNtlVlm?`$${Er(parseFloat(n==null?void 0:n.dayNtlVlm))}`:z(),color_1:"text-white"}),i.jsx(PC,{title:"Open Interest",widthValue:"130px",info:n!=null&&n.oraclePx?`$${Er(parseFloat((n==null?void 0:n.oraclePx)*(n==null?void 0:n.openInterest)))}`:z(),color_1:"text-white"}),i.jsx(PC,{title:i.jsx(SQ,{text:"If the funding rate is positive, longs pay shorts. If negative, shorts pay longs.",children:"Funding"}),title_2:"Countdown",widthValue:"145px",info:(n==null?void 0:n.funding)!=null?((n==null?void 0:n.funding)*100).toFixed(4)+"%":z(),info_2:(n==null?void 0:n.funding)!=null?d:z(),color_1:"text-[#1DE6A3]",color_2:"text-white",isLast:!0})]})}),i.jsx("div",{className:"flex lg:hidden justify-start items-center gap-4",children:"All Positions"})]})})},PC=({title:t,title_2:e,widthValue:n,info:r,info_2:s,color_1:a,color_2:o,isLast:l})=>i.jsxs("div",{className:"flex items-center",children:[i.jsxs("div",{style:{minWidth:n},className:"flex flex-col items-center justify-center",children:[i.jsx("div",{className:"flex flex-col items-start",children:e?i.jsxs("div",{className:`text-[#B7B7B7] text-[12px] font-medium font-inter leading
-snug`,children:[t," / ",e]}):i.jsx("div",{className:"text-[#B7B7B7] text-[12px] font-medium font-inter leading-snug",children:t})}),s?i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{className:`${a} text-[12px] font-semibold font-inter leading-[16px]`,children:r}),i.jsx("div",{className:`${a} flex justify-center items-center max-h-2`,children:r?"/":""}),i.jsx("div",{className:`${o} text-[12px] font-semibold font-inter leading-[16px]`,children:e=="Countdown"?s:`${s>0?"+":""}${parseFloat(s).toFixed(2)}%`})]}):i.jsx("div",{className:`${a} text-[12px] font-semibold font-inter leading-[16px]`,children:r})]}),!l&&i.jsx("div",{className:"border-l border-[#3E3E3E]",style:{height:24}})]}),omn="wss://api.hyperliquid.xyz/ws",NQ=new Map;function RNe(t){const e=(t||"").toLowerCase();return e?(NQ.has(e)||NQ.set(e,{key:e,ws:null,ping:null,subs:new Set,connected:!1,connecting:!1}),NQ.get(e)):null}function oqe(t){if(!t||t.connecting||t.connected)return;t.connecting=!0;const e=new WebSocket(omn);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(()=>oqe(t),1500)};e.onclose=n,e.onerror=n}function lqe(t,e){const n=RNe(t);return n?(n.subs.add(e),oqe(n),()=>{const r=RNe(t);if(r&&(r.subs.delete(e),!r.subs.size&&r.ws))try{r.ws.close()}catch{}}):()=>{}}const lmn="https://api.hyperliquid.xyz/info",jQ=new Map,cmn=["xyz"];function umn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(jQ.has(e)||jQ.set(e,{key:e,rows:[],count:void 0,loading:!0,emptyTimer:null,tpslByCoin:{},viewOrdersOnly:new Set,subs:new Set}),jQ.get(e)):null}function cqe(t){t.subs.forEach(e=>{try{e({rows:t.rows,count:t.count,loading:t.loading,tpslByCoin:t.tpslByCoin,viewOrdersOnly:t.viewOrdersOnly})}catch{}})}function dmn(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 LNe(t,e){const n=dmn(e);t.rows=n,t.count=n.length,t.loading=!1,cqe(t)}function LF(t,e){if(Array.isArray(e)&&e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),LNe(t,e);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,LNe(t,[])},1e3))}function DF(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,cqe(t)}function uqe(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 dqe(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=uqe(t),s=r.length>0;return{hasAssetPositions:n,assetPositions:e,hasOpenOrders:s,openOrders:r}}function fmn(t){if(!t||typeof t!="object")return{assetPositions:[],openOrders:[]};const{hasAssetPositions:e,assetPositions:n,hasOpenOrders:r,openOrders:s}=dqe(t);return{assetPositions:e?n:[],openOrders:r?s:[]}}function efe(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=umn(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=lqe(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)&&LF(s,u.assetPositions);const d=uqe(u);d.length&&DF(s,d);return}if(c==="webData2"||c==="webData3"){const u=l.data||{},{hasAssetPositions:d,assetPositions:f,hasOpenOrders:x,openOrders:g}=dqe(u);d&&LF(s,f),x&&DF(s,g)}});return(async()=>{try{const l=cmn.map(f=>{const x={type:"clearinghouseState",user:r};return f&&(x.dex=f),x}),c=await Promise.all(l.map(f=>fetch(lmn,{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}=fmn(f);Array.isArray(x)&&x.length&&u.push(...x),Array.isArray(g)&&g.length&&d.push(...g)}LF(s,u),DF(s,d)}catch{LF(s,[]),DF(s,[])}})(),()=>{s.subs.delete(a),o()}},[t]),e}function fqe(t){const{count:e}=efe(t);return e}const AQ=new Map;function hmn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(AQ.has(e)||AQ.set(e,{key:e,rows:[],count:void 0,loading:!0,subs:new Set,emptyTimer:null}),AQ.get(e)):null}function pmn(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 _Q(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 DNe(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 EQ(t,e){const n=mmn(e);t.rows=n,t.count=n.length,t.loading=!1,pmn(t)}function kQ(t,e,n){if(e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),EQ(t,e);return}if(n===0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),EQ(t,[]);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,!(n>0)&&EQ(t,[])},2e3))}function tfe(t){const e=(t==null?void 0:t.toLowerCase())||"",n=fqe(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=hmn(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=lqe(e,c=>{if(!c)return;const u=c.channel,d=c.data||{};if(u==="openOrders"){const f=_Q(d);kQ(a,f,n);return}if(u==="user"){const f=d.state;if(!f||!DNe(f))return;const x=_Q(f);kQ(a,x,n);return}if(u==="webData2"||u==="webData3"){if(!DNe(d))return;const f=_Q(d);kQ(a,f,n);return}});return()=>{a.subs.delete(o),l()}},[e,n]),r}function xmn(t){const{count:e}=tfe(t);return e}const Fv={"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","12h":"720","1d":"1D","1w":"1W","1M":"1M"},f9={"1m":60,"5m":300,"15m":900,"30m":1800,"1h":3600,"4h":14400,"12h":43200,"1d":86400,"1w":604800,"1M":2592e3},BF={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"},gmn="wss://api.starknet.extended.exchange",TQ="https://api.starknet.extended.exchange/api/v1",IQ="https://express-proxy-delta.vercel.app/proxy?url=",bmn={"1m":"PT1M","5m":"PT5M","15m":"PT15M","30m":"PT30M","1h":"PT1H","4h":"PT4H","12h":"PT12H","1d":"PT24H","1w":"P7D","1M":"P30D"},ymn="https://mainnet.zklighter.elliot.ai/api/v1/candles",vmn="https://mainnet.zklighter.elliot.ai/api/v1/candlesticks",wmn=["tv.js","charting_library.standalone.js","charting_library.js"];let $F=null;function Cmn(t="/charting_library/"){return typeof window>"u"?Promise.resolve(null):window.TradingView&&window.TradingView.widget?Promise.resolve(window.TradingView):$F||($F=(async()=>{for(const e of wmn){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})(),$F)}const Smn="#133024",hqe="#67FFBD",Nmn="#311621",pqe="#FF79AD",jmn={background:Smn,border:hqe},Amn={background:Nmn,border:pqe},_mn="#67FFBD",Emn="rgba(103,255,189,0.12)",kmn="#67FFBD",Tmn="#FF797C",Imn="rgba(255,121,124,0.12)",Pmn="#FF79AD",Fmn="#67FFBD",Omn="rgba(103,255,189,0.08)",Mmn="#67FFBD",BNe="#FF79AD",$Ne="rgba(255,121,173,0.08)",UNe="#FF79AD",Q9=t=>{const e=String(t||"").trim().toUpperCase();return e==="SELL"||e==="SHORT"||e==="S"?"S":e==="BUY"||e==="LONG"||e==="B"?"B":""},NM="",zNe="tv_chart_layout_v3",Tb=t=>typeof t=="string"&&t.includes("/");function Rmn(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 mqe(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function Lmn(t){const e=new Date(t),n=mqe(t),r=e.getUTCDay();return n-r*864e5}function Dmn(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)}function Ov(t,e){if(e==="1d")return mqe(t);if(e==="1w")return Lmn(t);if(e==="1M")return Dmn(t);const n=f9[e]||60;return Math.floor(t/1e3/n)*n*1e3}function nfe(t){return/limit/i.test(String(t.type||""))?Number(t.limitPx)||0:Number(t.triggerPx)||0}function xqe(t){return Number(t.sz??t.size??t.sizeCoin??t.coinSize??t.baseSize??t.qty??t.quantity??0)||0}function Bmn(t,e){const n=Q9(t.sideRaw||t.side),r=/take\s*profit/i.test(String(t.type||"")),s=/stop/i.test(String(t.type||"")),a=nfe(t),o=xqe(t),l=t.coin||e||"",c=o>0?` (${o.toLocaleString(void 0,{maximumFractionDigits:6})}${l?" "+l:""})`:"";return r?NM+`TP ${n==="S"?">":"<"} ${a}${c}`:s?NM+`SL ${n==="S"?"<":">"} ${a}${c}`:NM+`Limit ${a}${c}`}function $mn(t){const e=/take\s*profit/i.test(String(t.type||"")),n=/stop/i.test(String(t.type||"")),r=Q9(t.sideRaw||t.side),s=r==="S"||r==="A";return n?{txt:Tmn,bg:Imn,br:Pmn}:e?s?{txt:BNe,bg:$Ne,br:UNe}:{txt:_mn,bg:Emn,br:kmn}:s?{txt:BNe,bg:$Ne,br:UNe}:{txt:Fmn,bg:Omn,br:Mmn}}function HNe(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]===NM)});return{...r,sources:s}})})}}function Umn(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}|${nfe(t)}`)}function VNe(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 UF(t,e,n){t.forEach(r=>{r&&(typeof r.then=="function"?r.then(s=>{s!=null&&VNe(e,n,s)}).catch(()=>{}):VNe(e,n,r))})}const zmn=(()=>{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 PQ({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),N=h.useRef([]),I=h.useRef([]),P=tfe(s||"").rows,M=h.useRef(null),F=h.useRef(e),$=h.useRef(new Map),L=h.useRef(0),[z,Q]=h.useState([]);h.useEffect(()=>{P.length>0&&(N.current=P)},[P]);let se;P.length===0?(L.current+=1,L.current<=1?se=N.current:se=P):(L.current=0,se=P);const ee=h.useMemo(()=>o!=="hyperliquid"?[]:se.filter(q=>q&&q.coin===t),[se,t,o]);h.useEffect(()=>{if(o!=="extended"||!d){Q([]);return}let q=!1;const W=async()=>{try{const oe=`${TQ}/user/orders`,he=`${IQ}${encodeURIComponent(oe)}`,xe=await(await fetch(he,{headers:{"X-Api-Key":d}})).json().catch(()=>null);if(q)return;const ge=((xe==null?void 0:xe.data)&&Array.isArray(xe.data)&&xe.data||(Array.isArray(xe)?xe:[])).map((Ce,je)=>{var Oe;return{id:Ce.id??je,market:(Ce.market||"").toUpperCase(),type:(Ce.type||"").toUpperCase(),side:Q9(Ce.side)||(Ce.side||"").toUpperCase(),sideRaw:Q9(Ce.side)||"B",status:(Ce.status||"").toUpperCase(),limitPx:Number(Ce.price)||null,triggerPx:((Oe=Ce.trigger)==null?void 0:Oe.triggerPrice)!=null?Number(Ce.trigger.triggerPrice):null,qty:Number(Ce.qty)||null,takeProfit:Ce.takeProfit||null,stopLoss:Ce.stopLoss||null,reduceOnly:!!Ce.reduceOnly,createdTime:Ce.createdTime||null,updatedTime:Ce.updatedTime||null}}).filter(Ce=>Ce.status==="NEW"||Ce.status==="PARTIALLY_FILLED");Q(ge)}catch{q||Q([])}};W();const ne=setInterval(W,1e4);return()=>{q=!0,clearInterval(ne)}},[o,d]);const K=h.useMemo(()=>{if(o==="hyperliquid")return ee;if(o==="extended"){const q=String(c||t||"").toUpperCase();return z.filter(W=>String(W.market||"").toUpperCase()===q)}return[]},[o,ee,z,c,t]);let re=zmn;try{const q=typeof window<"u"?JSON.parse(window.localStorage.getItem("tradingview.chartproperties")||"null"):null;q&&q.timezone&&(re=q.timezone)}catch{}const de=typeof window<"u"?window.localStorage.getItem("tranding_chart_interval_time"):null,G=de&&Fv[de]?de:e,ie=Fv[G]||"60";h.useEffect(()=>{P.length>0&&(I.current=P)},[P]),h.useEffect(()=>{if(!v)return;const q=x.current,W=q&&q.activeChart&&q.activeChart();if(!W)return;const ne=Fv[e]?Fv[e]:Object.values(Fv).includes(e)?e:ie,oe=M.current!==t,he=F.current!==e;if(oe){M.current=t,F.current=e;const _e=g.current;if(_e&&typeof _e.clearMarksCache=="function")try{_e.clearMarksCache()}catch{}try{W.setSymbol(t,ne,()=>{var xe;try{W.requestMarksRefresh&&W.requestMarksRefresh(),(xe=W.autoScaleAllSeries)==null||xe.call(W)}catch{}})}catch{}}else if(he){F.current=e;try{W.setResolution(ne,()=>{var _e;try{W.requestMarksRefresh&&W.requestMarksRefresh(),(_e=W.autoScaleAllSeries)==null||_e.call(W)}catch{}})}catch{}}},[t,e,v,ie]),h.useEffect(()=>{let q=!0;return(async()=>{const W=await Cmn(r);if(!q||!W||!W.widget||!f.current)return;f.current.innerHTML="";let ne=5;function oe(ge,Ce,je,Oe,$e,Ye,Je){let ht=ge||null,rt=Je||null,st=null,He=null,Ve=null,bt=null,xt=null,Qt=null;const St={},on={},cn={},Vn={};let tn=!0,fn=Ye,rn=null,nt=0;const it=De=>+String(De).slice(0,13);let Ut="1h",hn="",nn=[],Vt=null,pt=null,We=null;const It=De=>bmn[De]||"PT1M",Ge=De=>{if($e)return $e;const pe=String(De||"");return!pe||pe.includes("/")?"":pe.includes("-")?pe:`${pe}-USD`},ct=(De,pe)=>{if(!pe)return;const qe=Vn[pe]||[],Ae=qe[qe.length-1];Ae&&Ae.time===De.time?qe[qe.length-1]=De:qe.push(De),qe.length>2e3&&qe.splice(0,qe.length-2e3),Vn[pe]=qe},vt=(De,pe,qe)=>{const Ae=Vn[De]||[];return Ae.length?Ae.filter(ze=>Number.isFinite(ze.time)&&ze.time/1e3>=pe&&ze.time/1e3<=qe):[]},Ht=(De,pe,qe)=>{const Ae=Number(fn);if(!Number.isFinite(Ae)||Ae<=0)return[];const ze=Ov(qe*1e3,De);return Math.floor(ze/1e3)<pe?[]:[{time:ze,open:Ae,high:Ae,low:Ae,close:Ae,volume:0}]};function Rt(){je==="hyperliquid"&&(st||(st=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),st.onopen=()=>{xt&&st&&st.send(JSON.stringify({method:"subscribe",subscription:xt}))},st.onmessage=De=>{var Ae;const pe=(Ae=JSON.parse(De.data))==null?void 0:Ae.data;if(!pe||!pe.c)return;const qe={time:it(pe.t),open:+pe.o,high:+pe.h,low:+pe.l,close:+pe.c,volume:pe.v??0};Object.values(St).forEach(ze=>ze(qe))},st.onclose=()=>{st=null}))}function mn(){je==="extended"&&(!Qt||He||(He=new WebSocket(Qt),He.onmessage=De=>{let pe;try{pe=JSON.parse(De.data)}catch{return}const qe=Array.isArray(pe==null?void 0:pe.data)?pe.data:[];qe.length&&qe.forEach(Ae=>{const ze={time:it(Ae.T),open:+Ae.o,high:+Ae.h,low:+Ae.l,close:+Ae.c,volume:Ae.v!=null?Number(Ae.v):0};!Number.isFinite(ze.time)||!Number.isFinite(ze.open)||(ct(ze,Ut),Object.values(St).forEach(zt=>zt(ze)))})},He.onclose=()=>{He=null}))}function un(De,pe,qe){if(je!=="hyperliquid")return;if(Ve)try{Ve.close()}catch{}if(bt)try{bt.close()}catch{}pt=null,We=null,Ve=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),bt=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),Ve.onopen=()=>{Ve&&Ve.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:De,interval:qe}}))},bt.onopen=()=>{bt&&bt.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:pe,interval:qe}}))};const Ae=ze=>zt=>{var Wn;const kt=(Wn=JSON.parse(zt.data))==null?void 0:Wn.data;if(!kt||!kt.c)return;const gt={time:it(kt.t),open:+kt.o,high:+kt.h,low:+kt.l,close:+kt.c,volume:kt.v??0};if(ze==="A"?pt=gt:We=gt,!pt||!We)return;const Mt=Ov(pt.time,Ut),ln=Ov(We.time,Ut);if(Mt!==ln)return;const vn={time:Math.max(pt.time,We.time),open:pt.open/We.open,high:pt.high/We.high,low:pt.low/We.low,close:pt.close/We.close,volume:0};Object.values(St).forEach(On=>On(vn))};Ve.onmessage=Ae("A"),bt.onmessage=Ae("B"),Ve.onclose=()=>{Ve=null},bt.onclose=()=>{bt=null}}function yn(De){const pe=String(De||"");return pe==="BTC"||pe==="ETH"?2:pe.startsWith("1000")||pe.includes("/")?4:3}async function _n(De,pe,qe,Ae){const kt=(f9[pe]||60)*1e4,gt=Math.max(qe*1e3,Ae*1e3-kt*1e3),{data:Mt}=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"candleSnapshot",req:{coin:De,interval:pe,startTime:gt,endTime:Ae*1e3}});return(Array.isArray(Mt)?Mt:Mt&&Mt.data?Mt.data:[]).map(vn=>({time:it(vn.t),open:+vn.o,high:+vn.h,low:+vn.l,close:+vn.c,volume:vn.v??0})).sort((vn,Wn)=>vn.time-Wn.time)}async function In(De,pe,qe,Ae,ze){const[zt,kt]=await Promise.all([_n(De,qe,Ae,ze),_n(pe,qe,Ae,ze)]),gt=[];let Mt=0,ln=0;for(;Mt<zt.length&&ln<kt.length;){const vn=Ov(zt[Mt].time,Ut),Wn=Ov(kt[ln].time,Ut);vn===Wn?(gt.push({time:Math.max(zt[Mt].time,kt[ln].time),open:zt[Mt].open/kt[ln].open,high:zt[Mt].high/kt[ln].high,low:zt[Mt].low/kt[ln].low,close:zt[Mt].close/kt[ln].close,volume:0}),Mt++,ln++):vn<Wn?Mt++:ln++}return gt}async function Sn(De,pe,qe,Ae){if(De==null)return[];const ze=f9[pe]||60,zt=Math.max(ze,Ae-qe),kt=Math.max(1,Math.ceil(zt/ze)),gt={market_id:De,resolution:pe,r:pe,start_timestamp:qe*1e3,end_timestamp:Ae*1e3,start:qe*1e3,end:Ae*1e3,count_back:kt,limit:kt,set_timestamp_to_end:!0},Mt=On=>{if(!On)return null;if(Array.isArray(On)){const[m,p,S,A,k,T]=On;return{time:it(m),open:+p,high:+S,low:+A,close:+k,volume:Number(T??0)||0}}const $t=On.t??On.time??On.timestamp??On.start_timestamp??On.startTime??On.start_time??0,Nn=On.o??On.open,Fn=On.h??On.high,Tt=On.l??On.low,pn=On.c??On.close,ke=On.v??On.volume??On.V??0;return{time:it($t),open:+Nn,high:+Fn,low:+Tt,close:+pn,volume:Number(ke??0)||0}},ln=On=>On.map($t=>Mt($t)).filter($t=>$t&&Number.isFinite($t.time)&&Number.isFinite($t.open)&&$t.time/1e3>=qe&&$t.time/1e3<=Ae).sort(($t,Nn)=>$t.time-Nn.time),vn=async On=>{const{data:$t}=await ps.get(On,{params:gt});return $t?Array.isArray($t.c)?$t.c:Array.isArray($t.data)?$t.data:Array.isArray($t.candlesticks)?$t.candlesticks:Array.isArray($t.candles)?$t.candles:Array.isArray($t)?$t:[]:[]};let Wn=[];try{Wn=await vn(ymn)}catch{}if(!Wn.length)try{Wn=await vn(vmn)}catch{}return ln(Wn)}async function Yn(De,pe,qe,Ae){if(!De)return[];const ze=f9[pe]||60,zt=Math.max(ze,Ae-qe),kt=Math.min(1e4,Math.max(1,Math.ceil(zt/ze))),gt=It(pe),Mt=`${TQ}/info/candles/${De}/trades?interval=${gt}&limit=${kt}&endTime=${Ae*1e3}`,ln=`${IQ}${encodeURIComponent(Mt)}`,{data:vn}=await ps.get(ln);return(Array.isArray(vn==null?void 0:vn.data)?vn.data:[]).map(On=>({time:it(On.T),open:+On.o,high:+On.h,low:+On.l,close:+On.c,volume:On.v!=null?Number(On.v):0})).filter(On=>Number.isFinite(On.time)&&Number.isFinite(On.open)&&On.time/1e3>=qe&&On.time/1e3<=Ae).sort((On,$t)=>On.time-$t.time)}async function Xn(De,pe,qe){if(!ht)return[];if(Tb(De))return[];const{data:Ae}=await ps.post("https://api.hyperliquid.xyz/info",{type:"userFills",user:ht,coin:De,startTime:pe*1e3,endTime:qe*1e3});return(Array.isArray(Ae)?Ae:Ae&&Ae.data?Ae.data:[]).filter(kt=>{const gt=kt.coin||kt.asset||kt.symbol;return gt?String(gt).toUpperCase()===String(De).toUpperCase():!0}).map(kt=>({t:+String(kt.time).slice(0,13),b:Rmn(kt),px:Number(kt.px||kt.price),sz:Number(kt.sz||kt.size)})).filter(kt=>kt.t/1e3>=pe&&kt.t/1e3<=qe&&Number.isFinite(kt.px)&&kt.px>0)}async function zn(De,pe,qe){if(!rt)return[];if(!De)return[];const Ae=`${TQ}/user/trades`,ze=`${IQ}${encodeURIComponent(Ae)}`,{data:zt}=await ps.get(ze,{headers:{"X-Api-Key":rt}}),kt=Array.isArray(zt==null?void 0:zt.data)?zt.data:Array.isArray(zt)?zt:[],gt=String(De||"").toUpperCase();return kt.filter(Mt=>String(Mt.market||"").toUpperCase()===gt).map(Mt=>({t:+String(Mt.createdTime||Mt.time||Mt.paidTime||0).slice(0,13),b:Q9(Mt.side)!=="S"})).filter(Mt=>Mt.t/1e3>=pe&&Mt.t/1e3<=qe&&Number.isFinite(Mt.t))}function Kn(De){on[De]&&(clearInterval(on[De]),delete on[De])}function jn(){Object.keys(on).forEach(De=>{Kn(De)})}return{setWallet:De=>{ht=De||null,hn="",nn=[],Vt=null},setExtendedApiKey:De=>{rt=De||null,hn="",nn=[],Vt=null},setExtendedFallbackPrice:De=>{fn=De},clearMarksCache:()=>{hn="",nn=[],Vt=null},onReady:De=>De({supported_resolutions:Object.values(Fv),supports_group_request:!1,supports_marks:!0,supports_timescale_marks:!1,supports_time:!0}),resolveSymbol:(De,pe)=>{rn=De;const qe=cn[De]??yn(De);cn[De]=qe,typeof Ce=="function"&&Ce(qe),pe({name:De,ticker:De,full_name:De,description:Tb(De)?De:De+"/USD",type:"crypto",session:"24x7",timezone:re,exchange:je==="lighter"?"Lighter":je==="extended"?"Extended":"Hyperliquid",pricescale:Math.pow(10,qe),minmov:1,has_intraday:!0,supported_resolutions:Object.values(Fv),data_status:"streaming"})},getServerTime:De=>De(Math.floor(Date.now()/1e3)),getBars:async(De,pe,{from:qe,to:Ae},ze,zt)=>{const kt=De.ticker||De.name,gt=++nt;try{const Mt=BF[pe]||"1m";Mt&&(Ut=Mt);let ln=[];if(je==="lighter")Tb(kt)||(ln=await Sn(Oe,Mt,qe,Ae));else if(je==="extended"){if(!Tb(kt)){const vn=Ge(kt);if(vn&&tn)try{ln=await Yn(vn,Mt,qe,Ae)}catch{tn=!1}ln.length||(ln=vt(Mt,qe,Ae)),ln.length||(ln=Ht(Mt,qe,Ae))}}else if(Tb(kt)){const vn=String(kt).split("/"),Wn=vn[0],On=vn[1];ln=await In(Wn,On,Mt,qe,Ae)}else ln=await _n(kt,Mt,qe,Ae);if(kt!==rn||gt!==nt)return;ze(ln,{noData:ln.length===0})}catch(Mt){const ln=Mt&&Mt.response&&Mt.response.status;if(je==="lighter"&&ln===400){kt===rn&>===nt&&ze([],{noData:!0});return}try{zt(Mt&&Mt.message?Mt.message:"Datafeed error")}catch{}}},getMarks:async(De,pe,qe,Ae,ze)=>{const zt=De.ticker||De.name;if(Tb(zt))return Ae([]);const kt=BF[ze]||null;kt&&(Ut=kt);let gt=Number(pe),Mt=Number(qe);const ln=Math.floor(Date.now()/1e3);(!Number.isFinite(gt)||!Number.isFinite(Mt)||Mt<=gt||gt<=0||Mt<=0)&&(Mt=ln,gt=Mt-30*24*3600);const vn=je==="extended"?Ge(zt):zt;if(je==="extended"&&!rt)return Ae([]);const Wn=[je,vn||zt,gt,Mt,Ut];je==="extended"&&Wn.push(rt||"no-key");const On=Wn.join("|");if(On===hn&&nn.length)return Ae(nn);if(Vt&&Vt.key===On){const Nn=await Vt.promise;return Ae(Nn)}Vt={key:On,promise:(async()=>{try{let Nn=new Map;if(je==="hyperliquid"){const Tt=await Xn(zt,gt,Mt);Nn=new Map;for(const pn of Tt){const ke=Ov(pn.t,Ut),m=Math.floor(ke/1e3),p=pn.b?"B":"S",S=m+"-"+p;Nn.has(S)||Nn.set(S,{time:m,isBuy:pn.b})}}else if(je==="extended"){const Tt=await zn(vn,gt,Mt);Nn=new Map;for(const pn of Tt){const ke=Ov(pn.t,Ut),m=Math.floor(ke/1e3),p=pn.b?"B":"S",S=m+"-"+p;Nn.has(S)||Nn.set(S,{time:m,isBuy:pn.b})}}const Fn=Array.from(Nn.values()).map((Tt,pn)=>({id:Tt.time+"-"+(Tt.isBuy?"B":"S")+"-"+pn,time:Tt.time,color:Tt.isBuy?jmn:Amn,label:Tt.isBuy?"B":"S",labelFontColor:Tt.isBuy?hqe:pqe,text:Tt.isBuy?"Buy":"Sell",minSize:16,borderWidth:1,hoveredBorderWidth:2})).sort((Tt,pn)=>Tt.time-pn.time);return hn=On,nn=Fn,Vt=null,Fn}catch{return Vt=null,[]}})()};const $t=await Vt.promise;Ae($t)},getTimescaleMarks:(De,pe,qe,Ae)=>Ae([]),subscribeBars:(De,pe,qe,Ae)=>{const ze=De.ticker||De.name,zt=BF[pe]||"1m";if(St[Ae]=qe,Ut=zt,je==="lighter"){Kn(Ae);const kt=f9[Ut]||60,gt=Math.max(2e3,Math.min(15e3,Math.floor(kt*1e3/3)));let Mt=0;const ln=async()=>{try{const vn=Math.floor(Date.now()/1e3),Wn=vn-kt*500,On=await Sn(Oe,Ut,Wn,vn);if(!Array.isArray(On)||!On.length)return;const $t=On[On.length-1];if(!Number.isFinite($t.time))return;if($t.time>Mt){Mt=$t.time;const Nn=St[Ae];Nn&&Nn($t)}}catch{}};ln(),on[Ae]=setInterval(ln,gt);return}if(je==="extended"){if(Tb(ze))return;const kt=Ge(ze);if(!kt)return;const gt=It(zt);if(Qt=`${gmn}/stream.extended.exchange/v1/candles/${encodeURIComponent(kt)}/trades?interval=${encodeURIComponent(gt)}`,He){try{He.close()}catch{}He=null}mn();return}if(je==="hyperliquid")if(Tb(ze)){const kt=String(ze).split("/"),gt=kt[0],Mt=kt[1];un(gt,Mt,zt)}else{if(xt={type:"candle",coin:ze,interval:zt},st){try{st.close()}catch{}st=null}Rt()}},unsubscribeBars:De=>{delete St[De],Kn(De)},cleanup:()=>{try{st&&st.close()}catch{}try{He&&He.close()}catch{}try{Ve&&Ve.close()}catch{}try{bt&&bt.close()}catch{}jn(),hn="",nn=[],Vt=null,pt=null,We=null,Qt=null}}}const he=oe(s||null,ge=>{ne=ge},o,l,c,u,o==="extended"?d:null);g.current=he;let _e=null;if(typeof window<"u"){const ge=window.localStorage.getItem(zNe);if(ge)try{_e=HNe(JSON.parse(ge))}catch{}}const xe={container:f.current.id,library_path:r,datafeed:he,autosize:!0,theme:"dark",locale:"en",timezone:re,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:ge=>Number(ge).toLocaleString("en-US",{minimumFractionDigits:ne,maximumFractionDigits:ne})},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}};_e?xe.saved_data=_e:(xe.symbol=t,xe.interval=ie);const Se=new window.TradingView.widget(xe);x.current=Se,Se.onChartReady(()=>{const ge=Se.activeChart(),Ce=()=>{var Oe;try{(Oe=ge.autoScaleAllSeries)==null||Oe.call(ge)}catch{}},je=()=>{!Se||!Se.save||typeof window>"u"||Se.save(Oe=>{try{const $e=HNe(Oe||{});window.localStorage.setItem(zNe,JSON.stringify($e||{}))}catch{}})};if(!_e)try{const Oe=Math.floor(Date.now()/1e3);ge.setVisibleRange({from:Oe-30*24*3600,to:Oe},{percentRightMargin:.2}),Ce()}catch{}try{ge.setEntityMarksVisible(!0)}catch{}ge.onIntervalChanged().subscribe(null,Oe=>{try{const $e=BF[Oe]||Oe||ie;$e&&typeof window<"u"&&window.localStorage.setItem("tranding_chart_interval_time",$e)}catch{}try{ge.requestMarksRefresh()}catch{}je()}),Se.subscribe("onAutoSaveNeeded",()=>{je()}),je(),C(!0)})})(),()=>{q=!1;const W=x.current,ne=g.current;try{const oe=W&&W.activeChart&&W.activeChart();oe&&(UF(y.current,W,oe),y.current.clear(),UF($.current,W,oe),$.current.clear())}catch{}try{ne&&ne.cleanup&&ne.cleanup()}catch{}try{W&&W.remove&&W.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 q=x.current;if(!q||!v)return;const W=q.activeChart&&q.activeChart();if(W)try{W.requestMarksRefresh&&W.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 q=g.current.setExtendedFallbackPrice;typeof q=="function"&&q(u)},[u,o]),h.useEffect(()=>{if(!v||o!=="hyperliquid"&&o!=="extended")return;const q=x.current,W=q&&q.activeChart&&q.activeChart();if(!W||!W.createMultipointShape)return;const ne=y.current;UF(ne,q,W),ne.clear();const oe=Array.isArray(K)?K:[];if(!oe.length)return;const he=W.getVisibleRange&&W.getVisibleRange(),_e=Math.floor(Date.now()/1e3),xe=he&&he.to||_e,Se=new Map;for(const ge of oe){const Ce=nfe(ge);if(!Number.isFinite(Ce)||Ce<=0)continue;const je=ge.sideRaw==="S"?"S":"B",Oe=/take\s*profit/i.test(String(ge.type||"")),$e=/stop/i.test(String(ge.type||"")),Je=`${Ce}|${je}|${Oe?"TP":$e?"SL":"L"}`,ht=xqe(ge);if(!Se.has(Je))Se.set(Je,{base:ge,px:Ce,sz:ht});else{const rt=Se.get(Je);rt.sz+=ht}}Se.forEach(({base:ge,px:Ce,sz:je})=>{const Oe=$mn(ge),$e={...ge,sz:je},Ye=Bmn($e,t),Je={time:xe,price:Ce};try{const ht=W.createMultipointShape([Je],{shape:"horizontal_line",text:Ye,lock:!0,disableSelection:!0,disableSave:!0,overrides:{linecolor:Oe.br,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!0,textcolor:Oe.txt,fillBackground:!0,backgroundColor:Oe.bg,bold:!1,fontsize:11}}),rt=Umn($e,t);y.current.set(rt,ht)}catch{}})},[K,v,t,o]),h.useEffect(()=>{if(!v||K.length>0)return;const q=x.current,W=q&&q.activeChart&&q.activeChart();if(!W)return;let ne=null;try{const Se=W.getPanes&&W.getPanes();if(Array.isArray(Se)&&Se[0]){const ge=Se[0].getRightPriceScales&&Se[0].getRightPriceScales();Array.isArray(ge)&&ge[0]?ne=ge[0]:Se[0].getMainSourcePriceScale&&(ne=Se[0].getMainSourcePriceScale())}}catch{}const oe=$.current;if(UF(oe,q,W),oe.clear(),!Array.isArray(a)){try{ne&&ne.setAutoScale(!0)}catch{}return}const he=W.getVisibleRange&&W.getVisibleRange(),_e=Math.floor(Date.now()/1e3),xe=he&&he.to||_e;if(a.forEach((Se,ge)=>{const Ce=Number(typeof Se=="number"?Se:Se&&Se.price);if(!Number.isFinite(Ce)||Ce<=0)return;const je=typeof Se=="object"&&Se?Se.side:null,Oe=je==="buy"?"#1EC98A":je==="sell"?"#FF5C7A":"#444CFF";try{const $e=W.createMultipointShape([{time:xe,price:Ce}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,text:"",overrides:{linecolor:Oe,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!1,fillBackground:!1}});oe.set(`grid-${t}-${ge}-${Ce}`,$e)}catch{}}),ne)try{ne.setAutoScale(!0)}catch{}},[a,v,t,K.length]);const ae=n||`tv_${t}_container`;return i.jsx("div",{id:ae,ref:f,className:"relative h-full min-h-[320px] w-full bg-[#101010]"})}const Hmn=({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(FQ(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 se;if((t==null?void 0:t.markPx)!=null){const ee=((se=t.markPx.toString().split(".")[1])==null?void 0:se.length)||0;e(ee)}},[t==null?void 0:t.markPx,e]),h.useEffect(()=>{u(FQ(l));const se=setInterval(()=>u(FQ(l)),1e3);return()=>clearInterval(se)},[l]),h.useEffect(()=>{if((t==null?void 0:t.markPx)==null)return;const se=t.markPx,ee=y.current;se>ee?g("text-[#1DE6A3]"):se<ee&&g("text-[#FF7173]"),f(se);const K=setTimeout(()=>g("text-white"),700);return y.current=se,()=>clearTimeout(K)},[t==null?void 0:t.markPx]);const v=(t==null?void 0:t.markPx)!=null&&(t==null?void 0:t.prevDayPx)!=null?t.markPx-t.prevDayPx:null,C=v!=null?v/t.prevDayPx*100:null,N=C!=null?C>=0?"text-[#1DE6A3]":"text-[#FF7173]":"text-white",I=se=>{const ee=Number(se);if(!Number.isFinite(ee))return null;const K=Math.abs(ee);let re=1;return K>=1e3?re=1:K>=100?re=2:K>=1?re=3:K>=.1?re=4:re=6,ee.toLocaleString(void 0,{maximumFractionDigits:re})},P=se=>se==null||isNaN(se)?null:se>=1e3?d3(se):se,M=se=>{const ee=Number(se);if(!Number.isFinite(ee))return null;const K=Math.abs(ee),re=ee>=0?"+":"-";if(!o)return`${re}${K.toFixed(5)}`;let de=0;K<.1?de=6:K<1?de=4:K<10?de=2:K<100&&(de=1);const G=K.toFixed(de),ie=de>0?G.replace(/\.?0+$/,""):G;return`${re}${ie}`},F=v!=null?M(v):null,$=d!=null?o?I(d):P(d):null,L=(t==null?void 0:t.dayNtlVlm)!=null?`$${d3(Number(t.dayNtlVlm))}`:null,z=(t==null?void 0:t.oraclePx)!=null&&(t==null?void 0:t.openInterest)!=null?`$${d3(Number(t.oraclePx*t.openInterest))}`:null,Q=(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(Zde,{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(_7,{label:"Mid Price",value:$,tone:x}),i.jsx(_7,{label:"24h Change",value:F,sub:C!=null?`${C>=0?"+":"-"}${Math.abs(C).toFixed(2)}%`:null,tone:N}),i.jsx(_7,{label:"Vol 24h",value:L}),i.jsx(_7,{label:"Open Interest",value:z}),i.jsx(_7,{label:"Funding",value:Q,sub:t!=null&&t.funding?c:null,tone:"text-[#50D2C1]"})]})})]})};function FQ(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 _7=({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(Vmn,{w:"90px"})}),n!=null&&i.jsx("span",{className:`text-[11px] leading-none ${r}`,children:n})]}),Vmn=({w:t="90px"})=>i.jsx("span",{className:"inline-block align-middle h-[12px] rounded skeleton-ticker-text short",style:{width:t}}),Wmn=({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(ude,{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(sse,{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?`${Er(e==null?void 0:e.long_qty)} ${t}`:"--",color:2}),i.jsx(zp,{name:"Total",info:e!=null&&e.total_qty?`${Er(e==null?void 0:e.total_qty)} ${t}`:"--",color:1}),i.jsx(zp,{name:"Short",info:e!=null&&e.short_qty?`${Er(e==null?void 0:e.short_qty)} ${t}`:"--",color:3,info_1:"true"}),i.jsx(sse,{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:wJ,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?`$${Er(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(WNe,{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:CJ,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?`$${Er(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(WNe,{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]`})]}),WNe=({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]`})}),qmn="wss://api.hyperliquid.xyz/ws",Gmn="https://api.hyperliquid.xyz/info",XD=t=>t==null?0:Number(t),QD=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),Kmn=(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})},Ymn=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},gqe={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}}},Xmn=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=gqe[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null},Qmn=(t,e)=>{if(!t)return null;const n=String(t).toUpperCase(),r=gqe[n];if(!r)return null;const s=Number(e)||0;return Object.values(r).find(l=>l.value===s)||null};function qNe(t,e,n){const r=new Map;for(const s of t||[]){const a=XD(s.px),o=XD(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 Zmn(t){var o;const n=await fetch(Gmn,{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 Jmn(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 e0n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function t0n(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(e0n),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 GNe(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 n0n(t){if(!t)return[];const e=String(t).trim(),n=Xmn(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await Zmn(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=Jmn(s);let c=t0n(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:GNe(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),GNe(e)}}function r0n(t,e){const n=Qmn(e,t);if(n)return{nSigFigs:n.nSigFigs,mantissa:n.mantissa};const r=Number(t)||0;let s=null;r>=1e4?s=2:r>=1e3?s=3:r>=100?s=4:r>=10&&(s=5);let a;if(s===5&&r>=10){const o=Math.pow(10,Math.floor(Math.log10(r))),l=Math.floor(r/o);l<2?a=1:l<5?a=2:a=5}return{nSigFigs:s,mantissa:a}}function 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 i0n({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,N]=h.useState([]),I=(q,W)=>x==="USD"?q*W:q,P=x==="USD"?"USD":t,M=q=>{const W=s.current;W&&W.readyState===WebSocket.OPEN?W.send(JSON.stringify(q)):(a.current.push(q),F())},F=()=>{const q=s.current;if(q&&(q.readyState===WebSocket.OPEN||q.readyState===WebSocket.CONNECTING)||o.current)return;const W=new WebSocket(qmn);s.current=W,W.onopen=()=>{l.current=0,a.current.splice(0,a.current.length).forEach(oe=>W.send(JSON.stringify(oe)))},W.onmessage=ne=>{var $e;const oe=JSON.parse(ne.data||"{}");if((oe==null?void 0:oe.channel)!=="l2Book")return;const he=(oe==null?void 0:oe.data)??oe,_e=(he==null?void 0:he.coin)??(oe==null?void 0:oe.coin);if(!_e||_e!==c.current)return;const xe=(he==null?void 0:he.levels)??(($e=he==null?void 0:he.data)==null?void 0:$e.levels)??(oe==null?void 0:oe.levels);let Se,ge;if(Array.isArray(xe))Se=xe[0]||[],ge=xe[1]||[];else if(xe)Se=xe.bs||xe.bids||[],ge=xe.as||xe.asks||[];else return;const Ce=Ye=>(Ye||[]).map(Je=>{const ht=Number(Array.isArray(Je)?Je[0]:Je.px),rt=Number(Array.isArray(Je)?Je[1]:Je.sz);return{px:ht,sz:rt}}).filter(Je=>Number.isFinite(Je.px)&&Je.px>0&&Number.isFinite(Je.sz)&&Je.sz>0),je=Ce(Se),Oe=Ce(ge);f({bids:je,asks:Oe})},W.onclose=()=>{l.current=Math.min(l.current+1,6),o.current=setTimeout(()=>{o.current=null,F()},500*Math.pow(2,l.current))},W.onerror=()=>{try{W.close()}catch{}}},$=q=>{q&&(s0n(u.current,q)||(u.current&&M({method:"unsubscribe",subscription:u.current}),u.current=q,M({method:"subscribe",subscription:q})))},L=()=>{f({bids:[],asks:[]})};h.useEffect(()=>{let q=!1;try{s.current&&s.current.readyState<=1&&(s.current.onmessage=null,s.current.onopen=null,s.current.onclose=null,s.current.onerror=null,s.current.close())}catch{}if(s.current=null,u.current=null,a.current=[],l.current=0,o.current=null,L(),N([]),v(null),c.current=t||null,!!t)return F(),(async()=>{const W=await n0n(t);q||(N(W),v(W[0]??null))})(),()=>{q=!0}},[t]),h.useEffect(()=>{if(!t)return;const q=y||1,{nSigFigs:W,mantissa:ne}=r0n(q,t),oe={type:"l2Book",coin:t};W!=null&&(oe.nSigFigs=W),ne!=null&&(oe.mantissa=ne),$(oe)},[t,y]);const z=h.useMemo(()=>(d.bids||[]).map(q=>XD(q.px)).filter(q=>Number.isFinite(q)&&q>0),[d]),Q=h.useMemo(()=>(d.asks||[]).map(q=>XD(q.px)).filter(q=>Number.isFinite(q)&&q>0),[d]),se=z.length?Math.max(...z):null,ee=Q.length?Math.min(...Q):null;h.useEffect(()=>{se!=null&&ee!=null&&(r==null||r({bestBid:se,bestAsk:ee,mid:(se+ee)/2}))},[se,ee,r]);const K=h.useMemo(()=>{const q=Number(y)||1,W=qNe(d.bids,q,"bid").sort((oe,he)=>he.price-oe.price),ne=qNe(d.asks,q,"ask").sort((oe,he)=>oe.price-he.price);return{bids:W,asksAsc:ne}},[d,y]),re=h.useMemo(()=>{const q=K.asksAsc.slice(0,e);let W=0;return q.map(oe=>(W+=I(oe.size,oe.price),{...oe,total:W})).reverse()},[K,e,x]),de=h.useMemo(()=>{const q=K.bids.slice(0,e);let W=0;return q.map(ne=>(W+=I(ne.size,ne.price),{...ne,total:W}))},[K,e,x]),G=h.useMemo(()=>{if(se==null||ee==null)return null;const q=Math.abs(ee-se),W=(ee+se)/2;return{diff:q,pct:W?q/W*100:0}},[se,ee]),ie=Math.max(re.reduce((q,W)=>Math.max(q,W.total||0),0),1e-9),ae=Math.max(de.reduce((q,W)=>Math.max(q,W.total||0),0),1e-9);return i.jsxs("div",{className:"flex flex-col h-full w-full font-semibold font-inter",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#292929]",children:[i.jsx(YNe,{value:String(y??""),onChange:q=>v(Number(q)),items:(C||[]).map(q=>({key:String(q),label:Ymn(q)}))}),i.jsx(YNe,{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 (",P,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",P,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[re.map((q,W)=>i.jsx(KNe,{side:"ask",step:Number(y)||1,price:q.price,size:q.size!=null?I(q.size,q.price):null,total:q.total,widthPct:q.total?Math.min(100,q.total/ie*100):0,onClick:()=>q.price!=null&&(n==null?void 0:n(q.price)),unit:x},`ask-${W}`)),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] border-y border-[#292929] my-1 w-full",children:[i.jsx("span",{className:"uppercase",children:"Spread"}),i.jsx("span",{className:"text-right",children:G?QD(G.diff,4):"--"}),i.jsx("span",{className:"text-right",children:G?`${QD(G.pct,4)}%`:"--"})]}),de.map((q,W)=>i.jsx(KNe,{side:"bid",step:Number(y)||1,price:q.price,size:q.size!=null?I(q.size,q.price):null,total:q.total,widthPct:q.total?Math.min(100,q.total/ae*100):0,onClick:()=>q.price!=null&&(n==null?void 0:n(q.price)),unit:x},`bid-${W}`))]})})]})}function KNe({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?"—":Kmn(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":QD(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":QD(r,f?0:6)})]})]})}function YNe({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",o0n=t=>`https://app.hyperliquid.xyz/explorer/tx/${t}`,XNe=t=>t==null?0:Number(t),l0n=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),c0n=t=>isNaN(t)?"--":t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:4}),u0n=t=>new Date(t).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});function d0n({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 N=Array.isArray(C.data)?C.data:[C.data];s.current.push(...N)}};n.current.addEventListener("message",f);const x=setInterval(()=>{if(!s.current.length)return;const v=s.current.splice(0,s.current.length);l(C=>{const N=[...v,...C],I=[],P=new Set;for(const M of N){const F=M.tid??`${M.hash??""}-${M.time??""}`;if(!P.has(F)&&(P.add(F),I.push(M),I.length>=e))break}return I.sort((M,F)=>(F.time||0)-(M.time||0)),I})},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=XNe(u.px),f=XNe(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:c0n(d)}),i.jsx("div",{className:"text-right text-[#dcdada]",children:l0n(f)}),i.jsx("div",{className:"text-right text-[#a8a8a8]",children:u.time?u0n(u.time):"--:--:--"}),i.jsx("div",{className:"flex justify-end",children:u.hash?i.jsx("a",{href:o0n(u.hash),target:"_blank",rel:"noreferrer",className:"text-white hover:text-white opacity-70 hover:opacity-100",children:i.jsx(jrt,{className:"w-4 h-4 shrink-0"})}):null})]},(u.tid??u.hash)+String(u.time))})})]})}function f0n({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=N=>{x(u),d(N)},v=g.findIndex(N=>N.k===u)>g.findIndex(N=>N.k===f)?"right":"left",C={enter:N=>({x:N==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:N=>({x:N==="right"?-24:24,opacity:0})};return i.jsx("div",{className:`flex h-full min-h-0 flex-col gap-2 ${c}`,children:i.jsxs("div",{className:"bg-[#101010] flex-1 min-h-0 overflow-hidden relative rounded-[16px] pt-2",children:[i.jsx("div",{className:"relative flex w-full px-2 gap-2",children:g.map(N=>{const I=u===N.k;return i.jsxs("button",{onClick:()=>y(N.k),className:`relative flex-1 flex items-center justify-center py-[6px] cursor-pointer font-semibold text-xs rounded-[12px] bg-transparent ${I?"text-white":"text-[#a8a8a8] hover:text-white"}`,children:[I&&i.jsx(ho.span,{layoutId:"side-pill",className:"absolute inset-0 bg-[#262626] rounded-[12px]",transition:{type:"spring",stiffness:380,damping:30}}),i.jsx("span",{className:"relative z-10",children:N.t})]},N.k)})}),i.jsx("div",{className:"relative w-full h-[calc(100%-40px)] min-h-0",children:i.jsx(sI,{mode:"wait",custom:v,children:i.jsxs(ho.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(Wmn,{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(i0n,{coin:t,rows:9,onSelectPrice:o,onBest:l})}),u==="trades"&&i.jsx("div",{className:"h-full overflow-auto",children:i.jsx(d0n,{coin:t})})]},u)})})]})})}const bqe="#101010",Lo="#101010",Ra="#2b3640",Bi="#929292",Si="#929292",zg="#67FFBD",h9="#FF7272",h0n="https://dextrabothypev2.nftinit.io",p0n=[{key:"market",label:"Market"},{key:"limit",label:"Limit"},{key:"twap",label:"Twap"}];function m0n({mode:t,onModeChange:e,className:n=""}){const r=h.useMemo(()=>p0n,[]),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 ${Ra}`},children:[r.map(u=>{const d=t===u.key;return i.jsx("button",{ref:f=>a.current[u.key]=f,onClick:()=>e(u.key),className:"relative font-semibold bg-transparent",style:{color:d?"#FFFFFF":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 H4({children:t,onClick:e}){return i.jsx("button",{onClick:e,className:"w-full px-[16px] py-[6px] bg-[#262626] grid place-items-center rounded-[8px] text-white font-semibold",style:{border:`1px solid ${Ra}`},children:t})}function Ib({label:t,value:e,onChange:n,right:r,clearZeroOnFocus:s=!0,restoreZeroOnBlur:a=!0}){const o=r?Ie.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:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none font-inter text-white placeholder:text-gray-500",inputMode:"decimal",type:"number",value:e,onChange:l,onFocus:()=>{s&&String(e)!==""&&Number(e)===0&&n("")},onBlur:c=>{a&&(c.target.value===""||c.target.value===".")&&n("0")},placeholder:"0.00",style:{fontFeatureSettings:'"tnum"'}}),i.jsx("div",{className:"shrink-0",children:o})]})]})}function zF({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:Lo,color:Bi},children:[a," ▾"]}),r&&i.jsx("div",{className:"absolute right-0 z-40 mt-1 min-w-[140px] rounded-md p-1",style:{background:Lo,border:`1px solid ${Ra}`},children:n.map(l=>i.jsx("div",{className:"px-2 py-1 rounded cursor-pointer",style:{background:l.key===t?"#26313b":"transparent",color:l.key===t?"#ffffff":Bi},onClick:()=>{e(l.key),s(!1)},children:l.label},l.key))})]})}function Mv({k:t,v:e,strong:n=!1,link:r=!1}){return i.jsxs("div",{className:"flex items-center justify-between text-[#929292] font-inter text-[13px] font-normal leading-4 space-y-2",children:[i.jsx("span",{children:t}),i.jsx("span",{style:{color:Bi},children:e})]})}function QNe({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:bqe,border:`1px solid ${Ra}`,borderRadius:16,padding:16},children:[t&&i.jsx("div",{className:"mb-3 text-sm font-semibold",style:{color:Bi},children:t}),e]})}function z0({children:t,onClick:e}){return i.jsx("button",{onClick:e,className:"w-full h-[38px] rounded-xl font-semibold text-sm",style:{background:zg,color:"#0f151a"},children:t})}function OQ({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)":Lo,border:`1px solid ${t?"#67FFBD":Ra}`,color:Bi},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t?"#67FFBD":"#555"}}),i.jsx("div",{className:"font-semibold",children:n})]}),i.jsx("div",{className:"text-[12px] leading-5",style:{color: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?_a.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 Ese(t=""){return t?`${t.slice(0,6)}...${t.slice(-4)}`:""}const MQ="https://api.hyperliquid.xyz/info",x0n="wss://api.hyperliquid.xyz/ws",RQ={accountValue:0,withdrawable:0,totalNtlPos:0,totalRawUsd:0,totalMarginUsed:0,crossMaintenanceMarginUsed:0,unrealizedPnl:0,crossAccountValue:0};function aI(t){const[e,n]=h.useState(RQ),[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 I=!0;return n(RQ),s([]),o({}),c({}),d({}),x(!1),t?((async()=>{try{const[P,M,F]=await Promise.all([fetch(MQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:t})}),fetch(MQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:t})}),fetch(MQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotMeta"})})]);if(!I)return;const $=await P.json(),L=await M.json(),z=await F.json(),Q=($==null?void 0:$.marginSummary)||{},se=($==null?void 0:$.crossMarginSummary)||{},ee=Array.isArray($==null?void 0:$.assetPositions)?$.assetPositions.reduce((ae,q)=>{var W;return ae+Number(((W=q==null?void 0:q.position)==null?void 0:W.unrealizedPnl)||0)},0):0,K={accountValue:Number((Q==null?void 0:Q.accountValue)||0),totalNtlPos:Number((Q==null?void 0:Q.totalNtlPos)||0),totalRawUsd:Number((Q==null?void 0:Q.totalRawUsd)||0),withdrawable:Number(($==null?void 0:$.withdrawable)||0),totalMarginUsed:Number((Q==null?void 0:Q.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number(($==null?void 0:$.crossMaintenanceMarginUsed)||0),unrealizedPnl:ee,crossAccountValue:Number((se==null?void 0:se.accountValue)||0)},re=Array.isArray(L==null?void 0:L.balances)?L.balances.map(ae=>({coin:String(ae.coin),total:Number(ae.total||0),hold:Number(ae.hold||0)})):[],de={},G={};if((Array.isArray(z==null?void 0:z.tokens)?z.tokens:[]).forEach(ae=>{const q=ae==null?void 0:ae.name;q&&(ae.tokenId&&(de[q]=ae.tokenId),G[q]={tokenId:ae.tokenId||null,evmContract:ae.evmContract||null})}),!I)return;n(K),s(re),o(de),c(G)}catch{if(!I)return;n(RQ),s([]),o({}),c({})}finally{I&&x(!0)}})(),()=>{I=!1}):(I&&x(!0),()=>{I=!1})},[t]),h.useEffect(()=>{if(!t)return;const I=new WebSocket(x0n);return g.current=I,I.onopen=()=>{[{method:"subscribe",subscription:{type:"user",user:t}},{method:"subscribe",subscription:{type:"webData2",user:t}}].forEach(P=>I.send(JSON.stringify(P))),y.current=setInterval(()=>{I.readyState===WebSocket.OPEN&&I.send(JSON.stringify({id:99,method:"ping"}))},3e4)},I.onmessage=P=>{var M,F,$,L,z,Q;try{const se=JSON.parse(P.data);if((se==null?void 0:se.channel)==="webData2"&&((M=se==null?void 0:se.data)!=null&&M.clearinghouseState)){const K=se.data.clearinghouseState,re=(K==null?void 0:K.marginSummary)||{},de=(K==null?void 0:K.crossMarginSummary)||{},G=Array.isArray(K==null?void 0:K.assetPositions)?K.assetPositions.reduce((ie,ae)=>{var q;return ie+Number(((q=ae==null?void 0:ae.position)==null?void 0:q.unrealizedPnl)||0)},0):0;n(ie=>({...ie,accountValue:Number((re==null?void 0:re.accountValue)||0),totalNtlPos:Number((re==null?void 0:re.totalNtlPos)||0),totalRawUsd:Number((re==null?void 0:re.totalRawUsd)||0),withdrawable:(K==null?void 0:K.withdrawable)!=null?Number(K.withdrawable):ie.withdrawable,totalMarginUsed:Number((re==null?void 0:re.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number((K==null?void 0:K.crossMaintenanceMarginUsed)||0),crossAccountValue:Number((de==null?void 0:de.accountValue)||0),unrealizedPnl:G}))}if((se==null?void 0:se.channel)==="webData2"&&Array.isArray((F=se==null?void 0:se.data)==null?void 0:F.assetCtxs)){const K={};for(const re of se.data.assetCtxs){const de=re==null?void 0:re.coin,G=Number((re==null?void 0:re.midPx)??(re==null?void 0:re.markPx)??(re==null?void 0:re.px));de&&Number.isFinite(G)&&(K[de]=G)}Object.keys(K).length&&d(re=>({...re,...K}))}if((se==null?void 0:se.channel)==="user"&&(($=se==null?void 0:se.data)!=null&&$.state)){const K=se.data.state,re=(K==null?void 0:K.marginSummary)||{},de=Array.isArray(K==null?void 0:K.assetPositions)?K.assetPositions.reduce((G,ie)=>{var ae;return G+Number(((ae=ie==null?void 0:ie.position)==null?void 0:ae.unrealizedPnl)||0)},0):void 0;n(G=>({...G,accountValue:Number((re==null?void 0:re.accountValue)||0),totalNtlPos:Number((re==null?void 0:re.totalNtlPos)||0),totalRawUsd:Number((re==null?void 0:re.totalRawUsd)||0),totalMarginUsed:Number((re==null?void 0:re.totalMarginUsed)||0),...de!=null?{unrealizedPnl:de}:{}}))}const ee=Array.isArray((z=(L=se==null?void 0:se.data)==null?void 0:L.spotState)==null?void 0:z.balances)?se.data.spotState.balances:Array.isArray((Q=se==null?void 0:se.data)==null?void 0:Q.balances)?se.data.balances:null;if(Array.isArray(ee)){const K=ee.filter(re=>re&&re.coin).map(re=>({coin:String(re.coin),total:Number(re.total||0),hold:Number(re.hold||0)}));s(K)}}catch{}},I.onclose=()=>{y.current&&clearInterval(y.current)},I.onerror=()=>{},()=>{y.current&&clearInterval(y.current);try{I.close()}catch{}}},[t]);const v=h.useMemo(()=>({spot:r.reduce((P,M)=>{if(M.coin==="USDC")return P+Number(M.total||0);const F=u[M.coin];return P+(F?Number(M.total||0)*Number(F):0)},0),perps:e.accountValue}),[r,u,e.accountValue]),C=h.useMemo(()=>{const I=e.accountValue,P=e.unrealizedPnl,M=Number(e.crossAccountValue||0)>0?Number(e.crossAccountValue||0):Number(I||0),F=M>0?Number(e.crossMaintenanceMarginUsed||0)/M:0,$=Number(e.crossMaintenanceMarginUsed||0),L=I>0?e.totalNtlPos/I:0;return{balance:I,uPnl:P,cmr:F,maintenanceMargin:$,crossLeverage:L}},[e]);return{rows:h.useMemo(()=>{const I=[];return I.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(P=>{const M=Math.max(0,Number(P.total||0)-Number(P.hold||0)),F=u[P.coin],$=P.coin==="USDC"?Number(P.total||0):Number(F)?Number(P.total||0)*Number(F):null;I.push({id:`spot-${P.coin}`,kind:"spot",coin:P.coin,unit:P.coin,totalDisplay:P.total,totalSort:P.total,availableDisplay:M,availableSort:M,usdcValue:$})}),I},[e,r,u]),perps:e,spotBalances:r,tokenIdMap:a,tokenMetaMap:l,priceMap:u,accountEquity:v,perpsOverview:C,initialLoaded:f}}const g0n="https://dextrabothypev2.nftinit.io/api/wallet/request-agent",b0n="https://express-proxy-delta.vercel.app/proxy?url=",y0n="https://api.starknet.extended.exchange/api/v1",yqe=t=>`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} USDC`;function v0n({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}=aI(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 N=setTimeout(()=>u(!1),2e3);return()=>clearTimeout(N)},[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":Bi},onClick:n,children:[i.jsxs("div",{className:"text-xs font-semibold flex items-center gap-2",children:[i.jsx("span",{children:t.wallet_name}),c?i.jsx(LVe,{size:3,color:"#ffffff"}):C?i.jsxs("span",{className:"text-[11px]",children:["— ",yqe(v)]}):""]}),i.jsx("div",{className:"text-[11px]",style:{color:Si},children:Ese(t.wallet_address)})]})}function oI({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),N=h.useRef(null),{address:I}=es();h.useEffect(()=>{const Q=()=>{try{c(!!localStorage.getItem("hyperToken")),d(se=>se+1)}catch{}};return Q(),window.addEventListener("localStorageUpdated",Q),window.addEventListener("storage",Q),()=>{window.removeEventListener("localStorageUpdated",Q),window.removeEventListener("storage",Q)}},[]),h.useEffect(()=>{if(!l||!e)return;x(!0);const Q=setTimeout(()=>x(!1),2e3);return()=>clearTimeout(Q)},[e,l]),h.useEffect(()=>{var se;Number.isFinite(Number(r))&&x(!1);const Q=t&&t.length?String(((se=t.find(ee=>String(ee.wallet_id)===String(e))||t[0])==null?void 0:se.wallet_id)??""):null;Q&&Number.isFinite(Number(r))&&Number(r)>=0&&(C.current=Q,y(ee=>ee[Q]===Number(r)?ee:{...ee,[Q]:Number(r)}))},[r,t,e]),h.useEffect(()=>{const Q=ee=>{N.current&&(N.current.contains(ee.target)||o(!1))},se=ee=>{ee.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",Q,!0),document.addEventListener("keydown",se),()=>{document.removeEventListener("pointerdown",Q,!0),document.removeEventListener("keydown",se)}},[]);const P=t&&t.length>0,M=P?t.find(Q=>String(Q.wallet_id)===String(e))||(e?null:t[0]):null,F=M&&M.wallet_address?`${M.wallet_name||`Wallet ${M.wallet_id}`} — ${Ese(M.wallet_address)}`:M?M.wallet_name||`Wallet ${M.wallet_id}`:I?`MetaMask — ${Ese(I)}`:"Select Wallet";let $=null;if(Number.isFinite(Number(r)))$=Number(r);else if(M){const se=(g&&g[M.wallet_id!=null?String(M.wallet_id):""])??M.available_balance??M.availableForTrade??M.available_for_trade??M.balance??M.available??null,ee=Number(se);Number.isFinite(ee)&&($=ee)}const L=M&&!f&&$!=null?`${F} — ${yqe($)}`:F,z=h.useCallback(async Q=>{var q;if(s!=="hyper")return{data:{agent_pk:null,from_cache:!1}};const se=localStorage.getItem("hyperTradeToken")||"",ee=localStorage.getItem("hyperToken")||"",K=localStorage.getItem("hyperAddress")||"",re=`hl_pk:${Q}`,de=localStorage.getItem(re);if(de)return localStorage.setItem("hl_pk",de),{data:{agent_pk:de,from_cache:!0}};const ie=await(await fetch(g0n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:K,trade_token:se,token:ee,wallet_id:String(Q)})})).json().catch(()=>({})),ae=(q=ie==null?void 0:ie.data)==null?void 0:q.agent_pk;return ae&&(localStorage.setItem(re,ae),localStorage.setItem("hl_pk",ae)),ie},[s]);return h.useEffect(()=>{if(!M||s!=="hyper"||!l)return;const se=`hl_pk:${String(M.wallet_id)}`,ee=localStorage.getItem("hyperTradeToken")||"",K=localStorage.getItem("hyperToken")||"",re=localStorage.getItem("hyperAddress")||"";if(!(!ee||!K||!re)){try{const de=localStorage.getItem(se);if(de){localStorage.setItem("hl_pk",de);return}}catch{}z(M.wallet_id).catch(()=>{})}},[l,s,M,z,u]),h.useEffect(()=>{if(typeof window>"u")return;const Q=s==="lighter"?"lighter":"hl";if(t&&t.length){const se=t.find(re=>String(re.wallet_id)===String(e))||t[0];if(!se)return;const ee=String(se.wallet_id),K=String(se.wallet_address||"").toLowerCase();try{window.localStorage.setItem(`${Q}_selected_wallet_id`,ee),window.localStorage.setItem(`${Q}_selected_wallet_address`,K),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:ee,address:K,mode:s}})),s==="hyper"&&l&&z(se.wallet_id).catch(()=>{})}catch{}}else if(I){const se="",ee=String(I||"").toLowerCase();try{window.localStorage.setItem(`${Q}_selected_wallet_id`,se),window.localStorage.setItem(`${Q}_selected_wallet_address`,ee),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:se,address:ee,mode:s}}))}catch{}}},[t,e,s,I,l,z]),h.useEffect(()=>{if(s!=="extended")return;let Q=!1;const se=async ee=>{var ie,ae,q;const K=ee.wallet_id!=null?String(ee.wallet_id):"";if(!K||v.current.has(K))return;const re=g[K];if(Number.isFinite(re)&&re>0)return;const de=ee.available_balance??ee.availableForTrade??ee.available_for_trade??ee.balance??ee.available??null,G=Number(de);if(Number.isFinite(G)&&G>0){y(W=>W[K]===G?W:{...W,[K]:G});return}if(ee.wallet_api_key){v.current.add(K);try{const W=`${b0n}${encodeURIComponent(`${y0n}/user/balance`)}`,oe=await(await fetch(W,{headers:{"X-Api-Key":ee.wallet_api_key}})).json().catch(()=>({}));if(Q)return;const he=((ie=oe==null?void 0:oe.data)==null?void 0:ie.availableForTrade)??(oe==null?void 0:oe.availableForTrade)??((ae=oe==null?void 0:oe.data)==null?void 0:ae.available_balance)??(oe==null?void 0:oe.available_balance)??((q=oe==null?void 0:oe.data)==null?void 0:q.available)??(oe==null?void 0:oe.available)??null,_e=Number(he);Number.isFinite(_e)&&y(xe=>xe[K]===_e?xe:{...xe,[K]:_e})}catch{}finally{v.current.delete(K)}}};return t.forEach(ee=>se(ee)),()=>{Q=!0}},[t,s,g]),i.jsxs("div",{className:"relative",ref:N,children:[i.jsxs("div",{onClick:()=>o(Q=>!Q),className:"h-[32px] px-3 rounded-md flex justify-between items-center cursor-pointer",style:{background:Lo,border:`1px solid ${Ra}`,color:Bi},children:[i.jsxs("span",{className:"truncate text-xs flex items-center gap-1",children:[L,f&&i.jsx(LVe,{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:Lo,border:`1px solid ${Ra}`},children:[i.jsxs("div",{onClick:()=>{o(!1);const Q=s==="hyper"?"hyperliquid":s==="lighter"?"lighter":"extended";window.open(`/wallet-management#${Q}#add-account#${Q}`,"_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"})]}),P&&t.map(Q=>{const se=String(Q.wallet_id)===String(e);return i.jsx(v0n,{w:Q,active:se,open:a,mode:s,balances:g,onSelect:async()=>{n(String(Q.wallet_id)),o(!1);try{await z(Q.wallet_id)}catch{}}},Q.wallet_id)}),!P&&i.jsx("div",{className:"px-3 py-2 text-xs",style:{color:Si},children:"No wallets"})]})]})}const LQ=new Map;function w0n(t,e){const n=LQ.get(t);if(n)return n;const r=Promise.resolve().then(e).finally(()=>LQ.delete(t));return LQ.set(t,r),r}const C0n=15e3,ZNe=new Map;function vqe(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=ZNe.get(d);if(x&&f-x.ts<C0n)return o(x.data),c(!1),x.data;c(!0);const g=await w0n(d,async()=>{const v=await(await fetch(`${h0n}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})})).json();let C=Array.isArray(v==null?void 0:v.data)?v.data:Array.isArray(v)?v:v!=null&&v.wallet_id?[v]:[];return C=C.map(N=>{var I,P,M;return{...N,balances:{eth:((I=N==null?void 0:N.balances)==null?void 0:I.eth)??0,usdc:((P=N==null?void 0:N.balances)==null?void 0:P.usdc)??0,hyper_usdc:((M=N==null?void 0:N.balances)==null?void 0:M.hyper_usdc)??0}}}),C});return o(g),ZNe.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 wj({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,N,I)=>Math.max(N,Math.min(I,C)),d=Math.max(2,s.length)-1,f=C=>{const N=u(Number(C)||0,s[0],s[s.length-1]);if(N<=s[0])return 0;if(N>=s[s.length-1])return 100;let I=0;for(;I<d&&N>s[I+1];)I++;const P=s[I+1]-s[I]||1,M=(N-s[I])/P;return(I+M)/d*100},x=C=>{const I=u(Number(C)||0,0,100)/100*d,P=Math.min(d-1,Math.floor(I)),M=I-P,F=s[P]+(s[P+1]-s[P])*M;if(!o)return F;let $=s[0],L=1/0;for(const z of s){const Q=Math.abs(z-F);Q<L&&(L=Q,$=z)}return $},g=f(t),y=Math.round(u(t,0,100)),v={type:"spring",stiffness:420,damping:32,mass:.2};return i.jsxs("div",{className:`relative w-full pt-4 pb-5 ${a}`,children:[i.jsx("div",{className:"absolute inset-x-0 top-5 h-2 rounded-full",style:{background:r},children:i.jsx(pm.div,{className:"h-2 rounded-full",animate:{width:`${g}%`},transition:v,style:{background:n}})}),i.jsx("div",{className:"absolute inset-x-0 top-6",children:s.map((C,N)=>{const I=N/d*100,P=g/100*d;return N<=P?null:i.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 top-1/2",style:{left:`${I}%`},children:i.jsx("div",{className:"h-[10px] w-[10px] rounded-full",style:{background:n,boxShadow:"0 0 0 2px rgba(0,0,0,0.35) inset"}})},N)})}),i.jsx(pm.div,{className:`${g>34?"-ml-2.5":"ml-2.5"} absolute top-5 -translate-y-full -translate-x-1/2 pointer-events-none z-10`,animate:{left:`${g}%`},transition:v,children:i.jsx("div",{className:"h-[18px] min-w-[24px] px-2 rounded-[6px] flex items-center justify-center text-[12px] leading-none",style:{background:n,color:"#0d0d0d",border:`1px solid ${Ra}`},children:y})}),i.jsx(pm.div,{className:"absolute top-[17px] -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none",animate:{left:`${g-2}%`,scale:l?1.12:1},transition:v,children:i.jsx("div",{className:"h-4 w-4 rounded-full",style:{background:"#0f151a",border:`2px solid ${n}`}})}),i.jsx("div",{className:"absolute inset-x-0 bottom-0",children:s.map((C,N)=>{if(N===0)return null;const I=N/d*100;return i.jsxs("div",{className:"absolute -translate-x-1/2 text-[12px] text-[#CFCFCF]",style:{left:`${I}%`},children:[C,"%"]},N)})}),i.jsx("input",{type:"range",min:0,max:100,step:.1,value:g,onMouseDown:()=>c(!0),onMouseUp:()=>c(!1),onTouchStart:()=>c(!0),onTouchEnd:()=>c(!1),onChange:C=>e(Math.round(x(C.target.value))),className:"absolute -left-2 -right-2 top-0 h-8 opacity-0 cursor-pointer z-30"})]})}const FC=42161,HF=10,DQ=[{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"uint256"}],outputs:[{type:"bool"}]}],c0={BTC:"bc1plaavkq4u7wj8cc8nhrm6rxkhz9ylurw2u6l42ne7gw4493hvacks8wct4q",ETH:"0xa1D7ad9f7065BeE7b0b3E2AC30C9ddAaD9A70C71",SOL:"HWzcDXaTB2mPXvQYQy2g6PCNaj4mhTPVNoJP8zVupHJs",XPL:"0xa1D7ad9f7065BeE7b0b3E2AC30C9ddAaD9A70C71",USDC_BRIDGE_2:"0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7"},Rv={USDC:{kind:"usdc",chains:[{key:"Arbitrum",label:"Arbitrum"}],icon:"USDC",bridge:c0.USDC_BRIDGE_2},BTC:{kind:"address",chains:[{key:"Bitcoin",label:"Bitcoin"}],icon:"BTC",address:c0.BTC,eta:"~21 minutes",fee:"~$2.29",min:"0.002 BTC",networkNote:"This address can only receive BTC on the Bitcoin network. Deposits below 0.002 BTC and deposits from other networks will result in a loss of funds."},ETH:{kind:"address",chains:[{key:"Ethereum",label:"Ethereum"}],icon:"ETH",address:c0.ETH,eta:"~3 minutes",fee:"~$1.22",min:"0.05 ETH",networkNote:"This address can only receive ETH on the Ethereum network. ETH sent from L2s (e.g. Arbitrum, Base, Optimism) will be lost. Any other asset (e.g., USDC, USDT) sent from Ethereum will be lost. Deposits below 0.05 ETH will result in a loss of funds."},SOL:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"SOL",address:c0.SOL,eta:"~1 minute",fee:"~1.40",min:"0.2 SOL",networkNote:"This address can only receive SOL on the Solana network. Any other asset (e.g., USDC, USDT) sent from Solana will be lost. Deposits below 0.2 SOL will result in a loss of funds."},"2Z":{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"2Z",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"150 2Z",networkNote:"This address can only receive 2Z on the Solana network. Deposits below 150 2Z will result in a loss of funds."},BONK:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"BONK",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"1000000 BONK",networkNote:"This address can only receive BONK on the Solana network. Deposits below 1000000 BONK will result in a loss of funds."},FARTCOIN:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"FARTCOIN",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"20 FARTCOIN",networkNote:"This address can only receive FARTCOIN on the Solana network. Deposits below 20 FARTCOIN will result in a loss of funds."},PUMP:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"PUMP",address:c0.SOL,eta:"~1 minute",fee:"~1.21",networkNote:"This address can only receive PUMP on the Solana network."},SPX:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"SPX",address:c0.SOL,eta:"~1 minute",fee:"~1.21",networkNote:"This address can only receive SPX on the Solana network."},XPL:{kind:"address",chains:[{key:"Plasma",label:"Plasma"}],icon:"XPL",address:c0.XPL,eta:"~1 minute",fee:"~1.20",min:"15 XPL",networkNote:"This address can only receive XPL on the Plasma network. Deposits below 15 XPL will result in a loss of funds."}};function S0n({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||Rv[n].chains[0].key),d=Rv[o],[f,x]=h.useState(""),[g,y]=h.useState(!1),[v,C]=h.useState(null),[N,I]=h.useState(!1);h.useEffect(()=>{t&&(l(n),u(r||Rv[n].chains[0].key),x(""),y(!1),C(null),I(!1))},[t,n,r]);const P=h.useMemo(()=>`https://app.hyperliquid.xyz/coins/${(d.icon||o).toUpperCase()}.svg`,[o,d.icon]);d.kind==="usdc"?`${c}`:`${o}${c}`;const{address:M,isConnected:F}=es(),$=t8(),{switchChainAsync:L}=Eoe(),z=pIe(),{writeContractAsync:Q}=m2t(),se=o==="USDC",ee=se&&c==="Arbitrum",K=se&&c!=="Arbitrum",re=ee&&$!==FC,{data:de}=hxe({address:a,abi:DQ,functionName:"decimals",chainId:FC,query:{enabled:ee}}),G=Number(de??6),{data:ie,refetch:ae}=hxe({address:a,abi:DQ,functionName:"balanceOf",args:[M??"0x0000000000000000000000000000000000000000"],chainId:FC,query:{enabled:ee&&!!M}}),q=h.useMemo(()=>{try{return ie?mT(ie,G):"0.00"}catch{return"0.00"}},[ie,G]),W=ee&&Number(f||0)<HF;function ne(ge,Ce="error"){C({text:ge,type:Ce})}function oe(ge){const Ce=String((ge==null?void 0:ge.shortMessage)||(ge==null?void 0:ge.message)||ge||"");return Ce.toLowerCase().includes("does not match the connection's chain")||Ce.toLowerCase().includes("chain mismatch")||Ce.toLowerCase().includes("connector chain")?"You're not on Arbitrum. Please switch to Arbitrum.":Ce}async function he(){try{if(!F)return ne("Wallet is not connected");if(K)return ne("The deposit bridge supports Arbitrum only");re&&await L({chainId:FC});const ge=String(f||"").trim();if(!ge||Number(ge)<=0)return ne("Enter a valid amount");if(Number(ge)<HF)return ne(`Minimum is ${HF} USDC`);const Ce=u1t(ge,G);y(!0),C({type:"info",text:"Submitting transaction..."});const je=await Q({address:a,abi:DQ,functionName:"transfer",args:[Rv.USDC.bridge,Ce],chainId:FC});C({type:"info",text:"Waiting for confirmation..."}),await z.waitForTransactionReceipt({hash:je}),C({type:"success",text:"Deposit completed"}),x(""),ae==null||ae()}catch(ge){ne(oe(ge),"error")}finally{y(!1)}}function _e(ge){var Ce;ge&&((Ce=navigator.clipboard)==null||Ce.writeText(ge),I(!0),setTimeout(()=>I(!1),1500))}const xe=K?"Arbitrum Required":ee?re?"Deposit":g?"Depositing...":"Deposit":"Done",Se=g||K||ee&&W;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:P,alt:o,className:"w-10 h-10",onError:ge=>{ge.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:ge=>{var je;const Ce=ge.target.value;l(Ce),u((je=Rv[Ce].chains[0])==null?void 0:je.key),C(null)},children:Object.keys(Rv).map(ge=>i.jsx("option",{value:ge,children:ge},ge))}),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:ge=>{u(ge.target.value),C(null)},children:Rv[o].chains.map(ge=>i.jsx("option",{value:ge.key,children:ge.label},ge.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)]})]}),ee&&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:ge=>x(ge.target.value.replace(",",".").replace(/[^\d.]/g,"")),inputMode:"decimal"}),i.jsxs("button",{type:"button",onClick:()=>x(String(q)),className:"absolute right-3 text-[12px] text-[#67FFBD] font-semibold",children:["MAX: ",Number(q||0).toFixed(2)]})]}),i.jsxs("div",{className:"text-[11px]",style:{color:W?"#ffb4b4":"#9BA3A7"},children:["Minimum: ",HF," USDC"]})]}),se&&i.jsx(i.Fragment,{children:K&&i.jsxs("div",{className:"p-2 rounded-lg text-[12px] mt-1 border border-[#2a2a2a] bg-[#3b1f1f] text-[#ffb4b4]",children:["The deposit bridge supports ",i.jsx("b",{children:"Arbitrum"})," only. Please select Arbitrum as the deposit chain."]})}),d.kind==="address"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-[12px] leading-5 text-[#9BA3A7]",children:["Deposits should arrive after ",d.eta,". This service is provided by Unit Protocol. Estimated fee ",d.fee," depending on the ",c," network."]}),i.jsxs("div",{className:"h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] px-3 flex items-center justify-between",children:[i.jsx("span",{className:"text-[13px] text-[#b7b7b7]",children:"Address"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-white truncate max-w-[240px]",children:d.address}),i.jsx("button",{onClick:()=>_e(d.address),className:"text-[12px] text-[#67FFBD]",children:"Copy"})]})]}),N&&i.jsx("div",{className:"text-[11px] text-[#67FFBD]",children:"Copied ✓"}),d.networkNote&&i.jsxs("div",{className:"p-2 rounded-lg text-[12px] mt-1 border border-[#2a2a2a] bg-[#3b1f1f] text-[#ffb4b4]",children:["IMPORTANT: ",d.min?`Minimum ${d.min}. `:"",d.networkNote]})]}),i.jsx("button",{onClick:se?K?void 0:re?async()=>{try{C(null),await L({chainId:FC}),C({type:"success",text:"Switched to Arbitrum"})}catch(ge){C({type:"error",text:oe(ge)})}}:he:e,disabled:Se,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:xe})]})]})]})})}function N0n(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 j0n(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 A0n=new TextEncoder,_0n=50;function E0n(t,e,n){A0n.encodeInto(t,e.subarray(n))}function k0n(t,e,n){t.length>_0n?E0n(t,e,n):j0n(t,e,n)}new TextDecoder;class VF{constructor(e,n){this.type=e,this.data=n}}class ZD extends Error{constructor(e){super(e);const n=Object.create(ZD.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:ZD.name})}}function T0n(t,e,n){const r=n/4294967296,s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function wqe(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function I0n(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}const P0n=-1,F0n=4294967296-1,O0n=17179869184-1;function M0n({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=O0n)if(e===0&&t<=F0n){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),wqe(r,4,t),n}}function R0n(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 L0n(t){if(t instanceof Date){const e=R0n(t);return M0n(e)}else return null}function D0n(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=I0n(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new ZD(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function B0n(t){const e=D0n(t);return new Date(e.sec*1e3+e.nsec/1e6)}const $0n={type:P0n,encode:L0n,decode:B0n};class kse{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register($0n)}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 VF(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 VF(o,a)}}}return e instanceof VF?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new VF(n,e)}}kse.defaultCodec=new kse;function U0n(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function z0n(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):U0n(t)?new Uint8Array(t):Uint8Array.from(t)}const H0n=100,V0n=2048;class rfe{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??kse.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)??H0n,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??V0n,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 rfe({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=N0n(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),k0n(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=z0n(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),T0n(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),wqe(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 Cqe(t,e){return new rfe(e).encodeSharedRef(t)}const W0n={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},q0n={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function G0n(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function Tse(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(Tse);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]=Tse(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=G0n(r))}return e}function K0n(t){return ms(t)}function Y0n(t,e,n){const r=Tse(t),s=Cqe(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(K0n(e),s.length+9)),mo(o)}function X0n(t,e){return{source:e?"a":"b",connectionId:t}}async function Q0n(t,e){const n=await t.signTypedData(e.domain,e.types,e.message),{r,s,v:a}=lu.from(n);return{r,s,v:a}}async function Z0n(t,e,n,r,s){const a=Y0n(e,n,r),o=X0n(a,s);return Q0n(t,{domain:W0n,types:q0n,primaryType:"Agent",message:o})}function lI({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 cle(a);return Z0n(o,r,n,s,e)}}}function J0n(t){return new cle(t).address}function exn({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 txn=({children:t})=>i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1 font-semibold",children:t}),nxn=({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 JNe(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}const BQ=t=>t==="perps"?"Perps":"Spot";function Sqe({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(N=>N==="perps"?"spot":"perps"),y=()=>d(String(x)),v=()=>s==null?void 0:s({toPerp:l==="spot",amount:u,available:x}),C=!Number(u)||Number(u)<=0||Number(u)>x||a;return i.jsxs(exn,{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:BQ(l)}),i.jsx(ule,{className:"text-[#67FFBD]"}),i.jsx("span",{className:`${f==="perps"?"text-[#67FFBD] font-medium":"text-[#bdbdbd]"}`,children:BQ(f)})]})}),i.jsxs("div",{className:"space-y-2 text-xs",children:[i.jsx(txn,{children:"Amount (USDC)"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(nxn,{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:JNe(x,6)})]})]}),i.jsxs("div",{className:"text-[12px] text-[#9B9B9B]",children:["Available (",BQ(l),"): ",JNe(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 eje({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 $Q=42161,rxn="0xa4b1",tje="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 ixn({open:t,onClose:e,perpsBalance:n=0,defaultDest:r=""}){const{address:s}=es(),a=t8(),{switchChainAsync:o}=Eoe(),{signTypedDataAsync:l}=p2t(),[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 M=Math.max(0,Number(n||0)-1);return M>0?Number(M.toFixed(6)):0},[n]),N="Withdraw USDC to Arbitrum";async function I(){var M;try{const F=Number(c||0);if(!F||F<=1){v({type:"error",text:"Enter an amount greater than $1 (fee)."});return}if(F>C){v({type:"error",text:"Amount exceeds available balance (after $1 fee)."});return}const $=(d||"").trim().toLowerCase();if(!/^0x[a-f0-9]{40}$/.test($)){v({type:"error",text:"Invalid destination address."});return}if(a!==$Q)try{await o({chainId:$Q})}catch{v({type:"error",text:"Switch to Arbitrum to withdraw."});return}g(!0),v({type:"info",text:"Signing request..."});const L=Date.now(),z={name:"HyperliquidSignTransaction",version:"1",chainId:$Q,verifyingContract:"0x0000000000000000000000000000000000000000"},Q={"HyperliquidTransaction:Withdraw":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},se={hyperliquidChain:tje,destination:$,amount:String(F),time:L},ee=await l({domain:z,types:Q,primaryType:"HyperliquidTransaction:Withdraw",message:se});v({type:"info",text:"Submitting..."});const K={action:{type:"withdraw3",signatureChainId:rxn,hyperliquidChain:tje,destination:$,amount:String(F),time:L},nonce:L,signature:sxn(ee)},re=await fetch("https://api.hyperliquid.xyz/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}).then(de=>de.json());if((re==null?void 0:re.status)==="ok")v({type:"success",text:"Withdraw submitted. Funds will arrive shortly."}),setTimeout(()=>{u(""),e==null||e()},700),(M=window==null?void 0:window.dispatchEvent)==null||M.call(window,new Event("balances:refresh"));else{const de=typeof(re==null?void 0:re.response)=="string"?re.response:JSON.stringify(re);v({type:"error",text:de||"Withdraw failed."})}}catch(F){v({type:"error",text:String((F==null?void 0:F.message)||F)})}finally{g(!1)}}const P=y&&i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{border:`1px solid ${Ra}`,background:y.type==="error"?"#3b1f1f":y.type==="success"?"#1f3b2b":"#1b2a3b",color:y.type==="error"?"#ffb4b4":y.type==="success"?"#b7ffd8":"#c9e1ff"},children:y.text});return i.jsx(lp,{open:t,onClose:e,children:i.jsxs(ym,{title:N,children:[P,i.jsxs(eje,{label:"Amount",children:[i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Lo,border:`1px solid ${Ra}`,width:"100%"},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none text-right text-sm",inputMode:"decimal",placeholder:"0.0",style:{color:Bi,fontFeatureSettings:'"tnum"'},value:c,onChange:M=>u(M.target.value)}),i.jsx("button",{className:"text-xs text-[#67FFBD] h-6 flex items-center justify-center",onClick:()=>u(C?String(C):"0"),children:"MAX"})]}),i.jsxs("div",{className:"text-[11px]",style:{color:Si},children:["MAX: ",C.toFixed(6)," USDC"]})]}),i.jsx(eje,{label:"Destination Address",children:i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Lo,border:`1px solid ${Ra}`,width:"100%"},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none text-sm",placeholder:"0x...",style:{color:Bi},value:d,onChange:M=>f(M.target.value)}),i.jsx("button",{className:"text-xs h-6 flex items-center justify-center text-[#67FFBD]",onClick:async()=>{const M=await navigator.clipboard.readText().catch(()=>"");M&&f(M.trim())},children:"Paste"})]})}),i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{background:"#3b1f1f",color:"#ffb4b4",border:`1px solid ${Ra}`},children:"IMPORTANT: A $1 fee is deducted from each withdrawal."}),i.jsx("button",{onClick:I,disabled:x,className:"w-full h-[42px] mt-1 rounded-xl font-semibold text-sm disabled:opacity-60",style:{background:zg,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:zg},children:[n,": ",t,"%"]}),i.jsxs("span",{className:"font-semibold",style:{color:h9},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, ${zg}80 0%, ${zg}80 ${t}%, ${h9}80 ${t}%, ${h9}80 100%)`,border:`1px solid ${Ra}`}}),i.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 rounded-md w-4 h-4",style:{left:`${t}%`,top:"50%",background:zg,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:zg},children:s?`${s.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""}),i.jsx("span",{style:{color:h9},children:a?`${a.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""})]})]})}function oxn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(t)}function lxn({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(oxn,{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 UQ="wss://api.hyperliquid.xyz/ws";function E7(t,e=2){const n=Number(t||0),r={maximumFractionDigits:e,minimumFractionDigits:n===0?2:0};return n.toLocaleString(void 0,r)}function nje(t){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}const rje=t=>{const e=String(t||"").toUpperCase();return e==="GTC"?"Gtc":e==="IOC"?"Ioc":e==="ALO"?"Alo":"Gtc"};function cxn(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 uxn({book:t,side:e,sizeCoin:n,mid:r}){const s=cxn(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 Nqe={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},dxn="dextra-global-toast";function Va(t,e){return dn.promise(t,e,{id:dxn,...Nqe})}const k7=t=>Number(t||0);function fxn(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 hxn(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 pxn({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:k7(f)||1,longSize:k7(n??(g?0:y?v:0)),shortSize:k7(r??(g||y?0:v)),slippage:Number(o||0),takeProfit:l&&k7(c)>0?String(c):"",stopLoss:l&&k7(u)>0?String(u):""}}}async function zQ({draft:t,responses:e,user:n}){const r=[];for(const o of Array.isArray(e)?e:[e])r.push(...fxn(o));const s=r.length?await hxn(n,r):[];return{...t,exchangeOids:r,orderStatus:s}}function OC(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 sje({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(""),[N,I]=h.useState("USD"),[P,M]=h.useState(0),[F,$]=h.useState(!1),[L,z]=h.useState("GTC"),[Q,se]=h.useState(!1),[ee,K]=h.useState(""),[re,de]=h.useState(""),[G,ie]=h.useState(""),[ae,q]=h.useState(""),[W,ne]=h.useState(!1),[oe,he]=h.useState(!1),[_e,xe]=h.useState(!1),[Se,ge]=h.useState("Cross"),[Ce,je]=h.useState("Cross"),[Oe,$e]=h.useState(s),[Ye,Je]=h.useState(!1),[ht,rt]=h.useState(!1),[st,He]=h.useState(!1),[Ve,bt]=h.useState("One-Way"),[xt,Qt]=h.useState(""),[St,on]=h.useState("USDC"),[cn,Vn]=h.useState(0),[tn,fn]=h.useState(5),[rn,nt]=h.useState(!1),[it,Ut]=h.useState(0),[hn,nn]=h.useState(!1),[Vt,pt]=h.useState(null),[We,It]=h.useState(null),[Ge,ct]=h.useState(null),[vt,Ht]=h.useState(s),[Rt,mn]=h.useState(null),[un,yn]=h.useState({address:null,token:null}),[_n,In]=h.useState(null),[Sn,Yn]=h.useState(null),[Xn,zn]=h.useState(null),[Kn,jn]=h.useState(50),[De,pe]=h.useState(!1),[qe,Ae]=h.useState({bids:[],asks:[]}),[ze,zt]=h.useState(!1),[kt,gt]=h.useState(String(t)),[Mt,ln]=h.useState(()=>{if(typeof window>"u")return"8";const En=localStorage.getItem("hl_max_slip_pct");if(En==null||En==="")return"8";const Bn=Number(En);return Number.isFinite(Bn)&&Bn>0?String(Bn):"8"}),[vn,Wn]=h.useState(""),[On,$t]=h.useState({}),[Nn,Fn]=h.useState([]),[Tt,pn]=h.useState(!1),ke=h.useRef(null),m=h.useRef(null),[p,S]=h.useState(()=>localStorage.getItem("skipCloseConfirm")==="true"),[A,k]=h.useState([0,0]),[T,D]=h.useState({takerPct:null,makerPct:null});h.useEffect(()=>{localStorage.setItem("skipCloseConfirm",p?"true":"false")},[p]);const V=h.useMemo(()=>Math.max(0,Number(Mt||0))/100,[Mt]),X=En=>String(En||"").trim().toUpperCase(),le="dextrabot.last_used_leverage",ce=()=>{try{return JSON.parse(localStorage.getItem(le)||"{}")}catch{return{}}},fe=En=>{const Bn=`leverage:${X(En)}`,mt=Number(localStorage.getItem(Bn));return Number.isFinite(mt)&&mt>0?mt:null},ye=En=>{const Bn=X(En),mt=ce(),Kt=Number(mt==null?void 0:mt[Bn]);return Number.isFinite(Kt)&&Kt>0?Kt:fe(Bn)},Pe=(En,Bn)=>{var Zn;const mt=X(En),Kt=Math.max(1,Number(Bn)||1),sr=ce();sr[mt]=Kt,localStorage.setItem(le,JSON.stringify(sr)),localStorage.setItem(`leverage:${mt}`,String(Kt)),(Zn=window.dispatchEvent)==null||Zn.call(window,new Event("localStorageUpdated"))},{isConnected:Me}=es(),{openConnectModal:Ke}=B5(),{setSignInConnectButtonOpen:we}=h.useContext(Yr),{address:Te}=es(),te=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,Be=!!(typeof window<"u"&&localStorage.getItem("hyperToken")&&(Me||te)),Ue=h.useRef(null);h.useEffect(()=>{const En=Te?Te.toLowerCase():null;if(Ue.current&&Ue.current!==En&&typeof window<"u"){const Bn=window.localStorage;Bn.removeItem("hyperToken"),Bn.removeItem("hyperAddress"),Bn.removeItem("hyperTradeToken"),Bn.removeItem("hl_pk"),Bn.removeItem("hl:wallet_id"),Object.keys(Bn).forEach(mt=>{mt.startsWith("hl_pk:")&&Bn.removeItem(mt)}),window.dispatchEvent(new Event("localStorageUpdated"))}Ue.current=En,pt(null)},[Te]),h.useEffect(()=>{const En=(a==null?void 0:a.id)!=null?String(a.id):null;if(En==null){pt(null);return}pt(Bn=>Bn!=null&&String(Bn)===En?Bn:En)},[a==null?void 0:a.id]),h.useEffect(()=>{Vt!=null&&localStorage.setItem("hl:wallet_id",String(Vt))},[Vt]);const Fe=h.useRef(null);h.useEffect(()=>{l!=="pair"&&kt&&Fe.current===kt&&Pe(kt,Oe)},[Oe,kt,l]),h.useEffect(()=>{let En,Bn=!0;function mt(){En=new WebSocket(UQ),En.onopen=()=>{const Kt={method:"subscribe",subscription:{type:"l2Book",coin:String(t).toUpperCase()}};En.send(JSON.stringify(Kt))},En.onmessage=Kt=>{var Ls;if(!Bn)return;const sr=JSON.parse(Kt.data),Zn=((Ls=sr==null?void 0:sr.data)==null?void 0:Ls.levels)||(sr==null?void 0:sr.levels),Or=(Zn==null?void 0:Zn.bs)||(Zn==null?void 0:Zn.bids)||[],Ir=(Zn==null?void 0:Zn.as)||(Zn==null?void 0:Zn.asks)||[],ns=Ot=>Ot.map(lr=>Array.isArray(lr)?{px:Number(lr[0]),sz:Number(lr[1])}:{px:Number(lr.px),sz:Number(lr.sz)}).filter(lr=>lr.px>0&&lr.sz>0);(Or.length||Ir.length)&&Ae({bids:ns(Or),asks:ns(Ir)})}}return mt(),()=>{Bn=!1;try{En&&En.close()}catch{}}},[t]),h.useEffect(()=>{const En=()=>{const Bn=typeof window<"u"?localStorage.getItem("hyperAddress"):null,mt=typeof window<"u"?localStorage.getItem("hyperToken"):null;yn({address:Bn,token:mt})};return En(),window.addEventListener("localStorageUpdated",En),window.addEventListener("storage",En),()=>{window.removeEventListener("localStorageUpdated",En),window.removeEventListener("storage",En)}},[]);const at=()=>{const En=parseFloat(String(Mt).replace(",",".")),mt=Math.max(.01,Math.min(50,Number.isFinite(En)?En:8)).toString();ln(mt),localStorage.setItem("hl_max_slip_pct",mt),zt(!1)},{wallets:ut}=vqe(un.address,un.token,!0,{pollMs:5e3});h.useEffect(()=>{if(!ut||!ut.length||Vt&&ut.some(mt=>String(mt.wallet_id)===String(Vt)))return;const En=ut.find(mt=>mt.confirmed)||ut[0];if(!En)return;const Bn=String(En.wallet_id);String(Vt)!==Bn&&(pt(Bn),o==null||o({id:Bn,address:En.wallet_address}))},[ut,Vt,o]);const yt=h.useMemo(()=>(ut||[]).find(En=>String(En.wallet_id)===String(Vt))||null,[ut,Vt]);h.useEffect(()=>{n!=null&&n!==""&&(d("limit"),y(Number(n)))},[n]),h.useEffect(()=>{let En=!0;pn(!1);async function Bn(){try{const Kt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"metaAndAssetCtxs"})})).json(),sr=Array.isArray(Kt)?Kt[0]:Kt,Zn=(sr==null?void 0:sr.universe)||[],Or=new Map(Zn.map(Ls=>{const Ot=typeof Ls=="string"?Ls:(Ls==null?void 0:Ls.name)??(Ls==null?void 0:Ls[0])??"";return[X(Ot),typeof Ls=="string"?{name:Ot}:Ls]}));if(l==="pair"){const[Ls,Ot]=String(c||"").split("/").map(Vr=>Vr.trim()),lr=Or.get(X(Ls)),Qn=Or.get(X(Ot));if(En){const Vr=(lr==null?void 0:lr.maxLeverage)??s,us=(Qn==null?void 0:Qn.maxLeverage)??s,as=Math.max(1,Math.min(Vr,us));Ht(as),$e(xs=>Math.min(xs||1,as)),It(null),ct(null),mn(null),gt(null),pn(!0)}return}const Ir=Or.get(X(t));if(!Ir){En&&(It(null),ct(null),Ht(s),$e(Ls=>Math.min(Ls||1,s)),mn(null),gt(String(t)),pn(!0));return}const ns=(Ir==null?void 0:Ir.name)||String(t);if(En){It(0),ct((Ir==null?void 0:Ir.szDecimals)??0),Ht((Ir==null?void 0:Ir.maxLeverage)??s),mn((Ir==null?void 0:Ir.maintenanceMarginFraction)??(Ir==null?void 0:Ir.mmr)??null),gt(ns);const Ls=ye(ns),Ot=Ls!=null?Math.min((Ir==null?void 0:Ir.maxLeverage)??s,Math.max(1,Ls)):Math.min((Ir==null?void 0:Ir.maxLeverage)??s,Math.max(1,Oe||1));$e(Ot),Fe.current=ns,pn(!0)}}catch{En&&(It(null),ct(null),Ht(s),$e(mt=>Math.min(mt||1,s)),mn(null),gt(String(t)),pn(!0))}}return Bn(),()=>{En=!1}},[t,s,l,c]);const Lt=f==="buy",Gt=Lt?zg:h9,an=h.useMemo(()=>{var mt,Kt,sr,Zn;const En=(Kt=(mt=qe==null?void 0:qe.bids)==null?void 0:mt[0])==null?void 0:Kt.px,Bn=(Zn=(sr=qe==null?void 0:qe.asks)==null?void 0:sr[0])==null?void 0:Zn.px;return Number.isFinite(En)&&Number.isFinite(Bn)&&En>0&&Bn>0?(Bn+En)/2:null},[qe]),et=h.useMemo(()=>{if(u==="limit"&&g!=="")return Number(g);const En=Number(e||0);if(En>0)return En;if(Number(an||0)>0)return Number(an);const Bn=Number((On||{})[t]||0);return Bn>0?Bn:0},[u,g,e,an,On,t]),Pt=yt==null?void 0:yt.wallet_address,{accountEquity:qt,perpsOverview:ft,spotBalances:tt,perps:Bt}=aI(Pt),{rows:gn}=efe(Pt);h.useEffect(()=>{let En=!1;async function Bn(){var Kt,sr,Zn,Or;if(!Pt){En||D({takerPct:null,makerPct:null});return}try{const ns=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFees",user:Pt.toLowerCase()})})).json();if(En)return;const Ls=Number(ns.userCrossRate??((Kt=ns.feeSchedule)==null?void 0:Kt.cross)??NaN),Ot=Number(ns.userAddRate??((sr=ns.feeSchedule)==null?void 0:sr.add)??NaN);if(!Number.isFinite(Ls)||!Number.isFinite(Ot)){D({takerPct:null,makerPct:null});return}const lr=Number(ns.activeReferralDiscount??((Zn=ns.feeSchedule)==null?void 0:Zn.referralDiscount)??0)||0,Qn=Number(((Or=ns.activeStakingDiscount)==null?void 0:Or.discount)??0)||0,Vr=Math.max(0,1-lr-Qn),us=Ls*Vr,as=Ot*Vr;D({takerPct:us*100,makerPct:as*100})}catch{En||D({takerPct:null,makerPct:null})}}Bn();const mt=setInterval(Bn,5*60*1e3);return()=>{En=!0,clearInterval(mt)}},[Pt]);const tr=h.useMemo(()=>{const{takerPct:En,makerPct:Bn}=T;if(En==null||Bn==null)return"—";const mt=Kt=>Number(Kt).toLocaleString(void 0,{minimumFractionDigits:4,maximumFractionDigits:4});return`${mt(En)}% / ${mt(Bn)}%`},[T]);h.useEffect(()=>{let En=!1;async function Bn(){if(!(!Pt||l==="pair"))try{const Kt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"activeAssetData",user:Pt.toLowerCase(),coin:String(kt||t)})})).json();if(En)return;const sr=Kt==null?void 0:Kt.leverage;if(!sr)return;const Zn=String(sr.type||"").toLowerCase()==="cross"?"Cross":"Isolated",Ir=Math.max(1,Math.min(vt||s,Number(sr.value||sr.leverage)||1));ge(Zn),je(Zn),$e(Ir)}catch{}}return Bn(),()=>{En=!0}},[Pt,t,l,vt,s]),h.useEffect(()=>{if(!Pt)return;const En=new WebSocket(UQ);return ke.current=En,En.onopen=()=>{En.send(JSON.stringify({method:"subscribe",subscription:{type:"user",user:Pt}})),En.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:Pt}})),m.current=setInterval(()=>{En.readyState===WebSocket.OPEN&&En.send(JSON.stringify({id:99,method:"ping"}))},3e4)},En.onmessage=Bn=>{var mt,Kt,sr,Zn;try{const Or=JSON.parse(Bn.data),Ir=(Or==null?void 0:Or.data)||{},ns=(mt=Ir==null?void 0:Ir.meta)==null?void 0:mt.universe,Ls=Ir==null?void 0:Ir.allMids;if(Array.isArray(ns)&&Array.isArray(Ls)&&ns.length===Ls.length){const lr={};for(let Qn=0;Qn<ns.length;Qn++){const Vr=typeof ns[Qn]=="string"?ns[Qn]:((Kt=ns[Qn])==null?void 0:Kt.name)||((sr=ns[Qn])==null?void 0:sr[0]),us=Number(Ls[Qn]);Vr&&Number.isFinite(us)&&(lr[Vr]=us)}$t(Qn=>({...Qn,...lr}))}const Ot=Array.isArray((Zn=Ir==null?void 0:Ir.spotState)==null?void 0:Zn.balances)?Ir.spotState.balances:Array.isArray(Ir==null?void 0:Ir.balances)?Ir.balances:null;Array.isArray(Ot)&&Fn(Ot.filter(lr=>lr&&lr.coin).map(lr=>({coin:String(lr.coin),total:Number(lr.total||0),hold:Number(lr.hold||0)})))}catch{}},En.onclose=()=>{m.current&&clearInterval(m.current)},()=>{m.current&&clearInterval(m.current);try{En.close()}catch{}}},[Pt]),h.useEffect(()=>{if(!Pt){k([0,0]);return}k([0,0]);let En=!0;const Bn=new WebSocket(UQ);return Bn.onopen=()=>{Bn.send(JSON.stringify({method:"subscribe",subscription:{type:"activeAssetData",user:Pt.toLowerCase(),coin:String(t)}}))},Bn.onmessage=mt=>{if(En)try{const Kt=JSON.parse(mt.data);if(Kt.channel==="activeAssetData"&&Kt.data){const sr=Kt.data.availableToTrade||[];k([Number(sr[0]||0),Number(sr[1]||0)])}}catch{}},Bn.onclose=()=>{En&&k([0,0])},()=>{En=!1;try{Bn.close()}catch{}}},[Pt,t]);const Dn=h.useMemo(()=>{const En=(tt||[]).find(Bn=>Bn.coin==="USDC");return En?Math.max(0,Number(En.total||0)-Number(En.hold||0)):0},[tt]),er=h.useMemo(()=>{if(!Nn.length)return null;let En=0;for(const Bn of Nn){const mt=Number(Bn.total||0);if(mt>0)if(Bn.coin==="USDC")En+=mt;else{const Kt=On[Bn.coin];Number.isFinite(Kt)&&Kt>0&&(En+=mt*Kt)}}return En},[Nn,On]),Sr=Number((Bt==null?void 0:Bt.accountValue)??0),dr=Number((Bt==null?void 0:Bt.totalMarginUsed)??0),kr=Math.max(0,Sr-dr),qn=kr,Tn=kr<1;async function $n({toPerp:En,amount:Bn,available:mt}){var Kt;try{if(pe(!0),!_n){await Va(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message});return}if(!Number(Bn)){await Va(Promise.reject(new Error("Amount is invalid")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message});return}if(Number(Bn)>Number(mt||0)){await Va(Promise.reject(new Error("Amount exceeds available")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message});return}const sr=_n.transfers.usdClassTransfer(String(Bn),!!En).then(Zn=>{if((Zn==null?void 0:Zn.status)==="ok")return"Transfer successful.";const Or=typeof(Zn==null?void 0:Zn.response)=="string"?Zn.response:"Transfer failed";throw new Error(Or)});await Va(sr,{loading:`Transferring ${Bn} USDC ${En?"Spot → Perps":"Perps → Spot"}...`,success:Zn=>Zn,error:Zn=>(Zn==null?void 0:Zn.message)||"Transfer failed"}),(Kt=window==null?void 0:window.dispatchEvent)==null||Kt.call(window,new Event("balances:refresh")),Je(!1)}catch{}finally{pe(!1)}}const ir=(()=>{const En=Number(v)||0;return N==="COIN"?En:et?En/et:0})(),ls=ir*(et||0),cs=Oe?ls/Oe:0;function lt(En){const Bn=Math.max(1,Number(Oe)||1),mt=Math.max(0,Number(Rt)||0),Kt=En/Bn+En*mt,sr=qn>0?Kt/qn*100:0;M(Math.max(0,Math.min(100,Math.round(sr))))}function Nt(En){M(En);const Bn=Math.max(1,Number(Oe)||1),mt=Math.max(0,Number(Rt)||0),Kt=En/100*qn,sr=1/Bn+mt,Zn=sr>0?Kt/sr:0;if(l==="pair"){Wn(Zn?String(Zn.toFixed(2)):"");return}if(N==="USD")C(Zn?String(Zn.toFixed(2)):"");else{const Or=et?Zn/et:0,Ir=Ge??4;C(Or?String(Or.toFixed(Ir)):""),lt(Or*et)}}function Rn(En){const Bn=Math.max(1,Number(Oe)||1),mt=Math.max(0,Number(Rt)||0),Kt=En/Bn+En*mt,sr=qn>0?Kt/qn*100:0;Ut(Math.max(0,Math.min(100,Math.round(sr))))}function ar(En){const Bn=Math.max(0,Math.min(100,Number(En)||0));Ut(Bn);const mt=Math.max(1,Number(Oe)||1),Kt=Math.max(0,Number(Rt)||0),sr=Bn/100*qn,Zn=1/mt+Kt,Or=Zn>0?sr/Zn:0;if(St==="COIN"){const Ir=et?Or/et:0,ns=Ge??4;Qt(Ir?String(Ir.toFixed(ns)):"")}else Qt(Or?String(Or.toFixed(2)):"")}function Tr(En){Qt(En);const Bn=Number(En)||0,Kt=(St==="COIN"?Bn:et?Bn/et:0)*(et||0);Rn(Kt)}function Lr(En){if(En===St)return;const Bn=Number(xt)||0;let mt="";if(En==="USDC")mt=String(((Bn||0)*(et||0)).toFixed(2)),on("USDC"),Qt(mt),Rn(Number(mt)||0);else if(!et)on("COIN"),Qt(""),Rn(0);else{const Kt=Ge??4;mt=String(((Bn||0)/et).toFixed(Kt)),on("COIN"),Qt(mt),Rn((Number(mt)||0)*et)}}function $r(En){C(En);const Bn=Number(En)||0,Kt=(N==="COIN"?Bn:et?Bn/et:0)*(et||0);lt(Kt)}function cr(En){const Bn=En==="USDC"?"USD":En;if(Bn===N)return;const mt=Number(v)||0;let Kt="";if(Bn==="USD")Kt=String(((mt||0)*(et||0)).toFixed(2)),I("USD"),C(Kt),lt(Number(Kt)||0);else if(!et)I("COIN"),C(""),lt(0);else{const sr=Ge??4;Kt=String(((mt||0)/et).toFixed(sr)),I("COIN"),C(Kt),lt((Number(Kt)||0)*et)}}function wr({entry:En,side:Bn,notionalUSD:mt,maintenanceFrac:Kt,marginMode:sr,accountValueUSD:Zn,isolatedMarginUSD:Or}){const Ir=Number(En)||0,ns=Math.abs(Number(mt)||0);if(!Ir||!ns)return null;const Ls=Bn==="buy"?1:-1,Ot=Math.max(0,Number(Kt)||0),lr=ns/Ir,Qn=ns*Ot;let Vr;sr==="Cross"?Vr=Zn-Qn:Vr=Or-Qn;const us=1-Ot*Ls;if(!lr||!isFinite(us))return null;const as=Ir-Ls*(Vr/lr)/us;return Math.max(0,as)}const ss=Number((ft==null?void 0:ft.balance)??0),mr=typeof Rt=="number"?Rt:.01,ts=ir>0&&et?wr({entry:et,side:f,notionalUSD:ls,maintenanceFrac:mr,marginMode:Se,accountValueUSD:ss}):null;h.useEffect(()=>{$r(v)},[N,et,Oe,qn]),h.useEffect(()=>{u==="twap"&&Tr(xt)},[u,St,xt,et,Oe,qn]);const Qs=h.useMemo(()=>uxn({book:qe,side:f,sizeCoin:ir,mid:e}),[qe,f,ir,e]);h.useEffect(()=>{let En=!1;async function Bn(){if(!(yt!=null&&yt.wallet_address)||!Vt){In(null);return}const mt=lI({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null}),Kt=vj({address:yt.wallet_address,signer:mt,dex:"",defaultSlippage:V});En||In(Kt)}return Bn(),()=>{En=!0}},[Vt,yt==null?void 0:yt.wallet_address,V]);const Es=En=>En||En===0?String(Math.trunc(Number(En))):"",br=Number(et||0),Zt=En=>{ie(En),Yn("pct");const Bn=Number(En),mt=Math.max(1,Number(Oe)||1);if(!br||!isFinite(Bn)){K("");return}const Kt=Bn/(mt*100),sr=Lt?br*(1+Kt):br*(1-Kt);K(Es(sr))};h.useEffect(()=>{Q&&(K(""),de(""),ie(""),q(""),Yn(null),zn(null))},[f]);const me=En=>{K(En),Yn("price");const Bn=Number(En),mt=Math.max(1,Number(Oe)||1);if(!br||!Bn){ie("");return}const Kt=Bn/br,sr=Lt?(Kt-1)*mt*100:(1-Kt)*mt*100;ie(String(Number(sr).toFixed(2)))},dt=En=>{q(En),zn("pct");const Bn=Number(En),mt=Math.max(1,Number(Oe)||1);if(!br||!isFinite(Bn)){de("");return}const Kt=Bn/(mt*100),sr=Lt?br*(1-Kt):br*(1+Kt);de(Es(sr))},_t=En=>{de(En),zn("price");const Bn=Number(En),mt=Math.max(1,Number(Oe)||1);if(!br||!Bn){q("");return}const Kt=Bn/br,sr=Lt?(1-Kt)*mt*100:(Kt-1)*mt*100;q(String(Number(sr).toFixed(2)))};h.useEffect(()=>{br&&(Q&&(Sn==="pct"?Zt(G):Sn==="price"&&me(ee)),Xn==="pct"?dt(ae):Xn==="price"&&_t(re))},[br,Oe]);function At(){var En;(En=window==null?void 0:window.dispatchEvent)==null||En.call(window,new Event("balances:refresh"))}async function xn(En){const Bn=()=>{typeof En=="function"&&En()};if(!Vt){await Va(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message}),Bn();return}if(!_n){await Va(Promise.reject(new Error("Please sign in to perform this action.")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message}),Bn();return}const mt=String(Se||"").toLowerCase().startsWith("iso")?"isolated":"cross",sr=Math.max(1,Math.min(vt||s,Number(Oe)||1));if(!Pr&&Math.abs(Xr||0)>0){const Zn=String(Ce||"").toLowerCase().startsWith("iso")?"isolated":"cross";if(mt!==Zn){await Va(new Promise(Or=>Or()),{loading:"Validating...",success:()=>{throw new Error("Cannot switch leverage type with open position.")},error:Or=>Or.message}),ge(Ce),Bn();return}}try{if(l==="pair"){const[Zn,Or]=String(c||"").split("/").map(ns=>ns.trim().toUpperCase()),Ir=Promise.all([_n.updateLeverage(Zn,mt,sr),_n.updateLeverage(Or,mt,sr)]);await Va(Ir,{loading:`Updating for ${Zn}/${Or}...`,success:()=>"Updated",error:ns=>(ns==null?void 0:ns.message)||"Failed to update leverage for pair"})}else{const Zn=kt||String(t).toUpperCase(),Or=_n.updateLeverage(Zn,mt,sr);await Va(Or,{loading:`Updating for ${Zn}...`,success:()=>"Updated",error:Ir=>(Ir==null?void 0:Ir.message)||"Failed to update leverage"}),je(Se)}Bn()}catch{ge(Ce),Bn()}}async function Cn(){const[En,Bn]=String(c||"").split("/").map(mt=>mt.trim().toUpperCase());try{if(!Vt){await Va(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}if(!_n){await Va(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const mt=await _n.info.allMids(),Kt=Number(mt[En]||0),sr=Number(mt[Bn]||0);if(!(Kt>0&&sr>0)){await Va(Promise.reject(new Error("Mid price not available for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const Zn=Math.max(1,Math.min(Number(Oe)||1,Number(vt)||1));Zn!==Oe&&($e(Zn),dn.success(`Leverage adjusted to ${Zn}x`,Nqe));let Or=Number(vn)>0?Number(vn):P/100*qn*Zn;if(!(Or>0)){await Va(Promise.reject(new Error("Enter a valid total notional for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const Ir=Math.max(0,Math.min(100,Number(Kn)||0))/100,ns=Or*Ir,Ls=Or-ns,Ot=ns/Kt,lr=Ls/sr,Qn=pxn({longSymbol:En,shortSymbol:Bn,longSize:Ot,shortSize:lr,orderType:u,reduceOnlyFlag:!!F,maxSlipVal:V,tpOnFlag:!1,tpVal:"",slVal:"",userAddr:(yt==null?void 0:yt.wallet_address)||Te,lev:Zn,coinSym:"",isPairMode:!0,isBuySide:!0,sizeCoinVal:0});if(u==="market"){const Vr=F?_n.marketClose(En,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}):_n.marketOpen(En,!0,Number(Ot),{tif:"Ioc",reduceOnly:!1,slippage:V}),us=F?_n.marketClose(Bn,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}):_n.marketOpen(Bn,!1,Number(lr),{tif:"Ioc",reduceOnly:!1,slippage:V}),as=(async()=>{const[xs,bs]=await Promise.all([Vr,us]);return await zQ({draft:Qn,responses:[xs,bs],user:Qn.userAddress}),"Pair market placed"})();await Va(as,{loading:`Opening ${En} long / ${Bn} short...`,success:xs=>xs,error:xs=>(xs==null?void 0:xs.message)||"Pair order failed"}),At(),M(0),Wn("");return}if(u==="limit"){const Vr=rje(L),us=_n.placeOrder({symbol:En,isBuy:!0,size:Number(Ot),price:Kt,tif:Vr,reduceOnly:!1}),as=_n.placeOrder({symbol:Bn,isBuy:!1,size:Number(lr),price:sr,tif:Vr,reduceOnly:!1}),xs=(async()=>{const[bs,zi]=await Promise.all([us,as]);return await zQ({draft:Qn,responses:[bs,zi],user:Qn.userAddress}),"Pair limit placed"})();await Va(xs,{loading:`Placing ${En} long / ${Bn} short limits...`,success:bs=>bs,error:bs=>(bs==null?void 0:bs.message)||"Pair limit failed"}),At(),M(0),Wn("");return}if(u==="twap"){const Vr=Math.max(5,Math.min(1440,Number(cn||0)*60+Number(tn||0))),us=_n.placeTwapOrder({symbol:En,isBuy:!0,size:Number(Ot),minutes:Vr,randomize:!!rn,reduceOnly:!!F}),as=_n.placeTwapOrder({symbol:Bn,isBuy:!1,size:Number(lr),minutes:Vr,randomize:!!rn,reduceOnly:!!F}),xs=(async()=>{const[bs,zi]=await Promise.all([us,as]);return await zQ({draft:Qn,responses:[bs,zi],user:Qn.userAddress}),"Pair TWAP started"})();await Va(xs,{loading:"Starting pair TWAP...",success:bs=>bs,error:bs=>(bs==null?void 0:bs.message)||"Pair TWAP failed"}),At(),M(0),Wn("");return}await Va(Promise.reject(new Error("Unsupported mode for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message})}catch{}}const fr=h.useMemo(()=>{const En=Number(cn||0)*60+Number(tn||0);return En?Math.max(5,Math.min(1440,En)):0},[cn,tn]),_r=h.useMemo(()=>{if(!fr)return 0;const En=Math.floor(fr*60/30);return Math.max(1,En+1)},[fr]),pr=h.useMemo(()=>{const En=Number(xt)||0;return En>0?St==="COIN"?En:et?En/et:0:0},[xt,St,et]),hr=h.useMemo(()=>!_r||!(pr>0)?0:pr/_r,[pr,_r]),Xr=h.useMemo(()=>{const En=String(t||"").toUpperCase();if(!gn||!gn.length)return 0;const Bn=gn.find(mt=>String(mt.coin||"").toUpperCase()===En);return Bn?Number(Bn.size||0):0},[gn,t]);async function is(){try{if(!Vt){await Va(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Bn=>Bn.message});return}if(!_n){await Va(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Bn=>Bn.message});return}if(l==="pair"){nn(!0),await Cn(),nn(!1);return}const En=Number(v)||0;if((u==="market"||u==="limit")&&En<=0&&!(u==="market"&&F)){await Va(Promise.reject(new Error("Enter a valid amount")),{loading:"Validating...",success:"OK",error:Bn=>Bn.message});return}if(nn(!0),u==="market")if(F){const Bn=En>0?OC(_n.marketClose(t,Number(ir),{tif:"Ioc",reduceOnly:!0,slippage:V})):OC(_n.marketClose(t,void 0,{tif:"Ioc",reduceOnly:!0,slippage:V}));await Va(Bn,{loading:`Closing ${t} position...`,success:mt=>mt,error:mt=>(mt==null?void 0:mt.message)||"Close failed"}),At()}else{const Bn=Q&&ee!==""&&Number(ee)>0,mt=Q&&re!==""&&Number(re)>0,Kt=OC(Bn||mt?_n.placeMarketWithTPSL({symbol:t,isBuy:Lt,size:Number(ir),entrySlippage:V,tpPrice:Bn?Number(ee):null,slPrice:mt?Number(re):null,triggerSlippage:.1}):_n.marketOpen(t,Lt,Number(ir),{tif:"Ioc",reduceOnly:!1,slippage:V}));await Va(Kt,{loading:`Placing ${Lt?"Buy":"Sell"} market order...`,success:sr=>sr,error:sr=>(sr==null?void 0:sr.message)||"Order failed"}),At(),M(0),C("")}else if(u==="limit"){const Bn=rje(L),mt=Q&&ee!==""&&Number(ee)>0,Kt=Q&&re!==""&&Number(re)>0,sr=OC(mt||Kt?_n.placeLimitWithTPSL({symbol:t,isBuy:Lt,size:Number(ir),price:Number(g),tif:Bn,reduceOnly:F,tpPrice:mt?Number(ee):null,slPrice:Kt?Number(re):null,triggerSlippage:V}):_n.placeOrder({symbol:t,isBuy:Lt,size:Number(ir),price:Number(g),tif:Bn,reduceOnly:F}));await Va(sr,{loading:`Placing ${Lt?"Buy":"Sell"} limit order...`,success:Zn=>Zn,error:Zn=>(Zn==null?void 0:Zn.message)||"Order failed"}),At(),M(0),C("")}else if(u==="twap"){const Bn=fr;if(!Bn){await Va(Promise.reject(new Error("Enter a valid running time (min 5 minutes)")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message}),nn(!1);return}let mt=0;const Kt=Number(xt)||0;if(St==="COIN")mt=Kt;else{if(!et){await Va(Promise.reject(new Error("Price required to convert USD to size")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message}),nn(!1);return}mt=Kt/et}if(!(mt>0)){await Va(Promise.reject(new Error("Enter a valid TWAP size")),{loading:"Validating...",success:"OK",error:Zn=>Zn.message}),nn(!1);return}const sr=_n.placeTwapOrder({symbol:t,isBuy:Lt,size:Number(mt),minutes:Bn,randomize:!!rn,reduceOnly:!!F});await Va(sr,{loading:`Starting TWAP for ${t}...`,success:()=>`TWAP started: ${Number(mt).toLocaleString(void 0,{maximumFractionDigits:Ge??4})} ${t} over ${Bn}m`,error:Zn=>(Zn==null?void 0:Zn.message)||"TWAP failed"}),At()}else{await Va(Promise.reject(new Error("This mode is not wired to HyperSDK yet")),{loading:"Validating...",success:"OK",error:Bn=>Bn.message}),nn(!1);return}}catch{}finally{nn(!1)}}const Pr=l==="pair",[yr,nr]=String(c||"").split("/").map(En=>En.trim().toUpperCase()),gs=h.useMemo(()=>Pr?0:Number((Lt?A[0]:A[1])||0),[Pr,Lt,A]),ei=Number(Pr?vn||0:ls||0),ci=u!=="twap"&&ei<10,Fr=ci?"Order must have minimum value of $10.":Tn?"Not Enough Margin":hn?"Placing...":u==="twap"?l==="pair"?"Start Pair TWAP":"Start TWAP":u==="scale"?"Place Scale Orders":l==="pair"?"Place Pair Order":"Place Order";return i.jsxs("div",{className:"w-full text-[12px]",style:{background:bqe,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(H4,{onClick:()=>ne(!0),children:Se}),i.jsx(H4,{onClick:Tt?()=>he(!0):void 0,children:Tt?`${Oe}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(H4,{onClick:()=>xe(!0),children:Ve})]}),i.jsx(lxn,{skipConfirm:p,setSkipConfirm:S})]}),Be&&i.jsx("div",{className:"mb-3",children:i.jsx(oI,{wallets:ut,value:Vt,selectedBalance:ft==null?void 0:ft.balance,onChange:En=>{if(String(Vt)===String(En))return;pt(En);const Bn=(ut||[]).find(mt=>String(mt.wallet_id)===String(En));o==null||o({id:String(En),address:(Bn==null?void 0:Bn.wallet_address)||null})}})}),i.jsx(m0n,{mode:u,onModeChange:d,moreItems:[{key:"twap",label:"TWAP"}],className:"mb-3"}),!Pr&&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)":Lo,color:f==="buy"?"rgb(15, 21, 26)":Bi},children:"Buy / Long"}),i.jsx("button",{type:"button",onClick:()=>x("sell"),className:"h-[34px] rounded-lg font-bold transition-colors flex justify-center items-center",style:{background:f==="sell"?"rgb(255,121,124)":Lo,color:f==="sell"?"rgb(15, 21, 26)":Bi},children:"Sell / Short"})]})}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:Si},children:"Available to Trade"}),i.jsxs("div",{className:"text-white font-semibold",children:[gs.toLocaleString(void 0,{maximumFractionDigits:2})," ","USDC"]})]}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:Si},children:"Current Position"}),i.jsx("div",{className:"text-white font-semibold",children:Xr?`${Math.abs(Xr).toLocaleString(void 0,{maximumFractionDigits:Ge??5})} ${t}`:`0.00000 ${t}`})]}),!Pr&&u==="limit"&&i.jsx("div",{className:"mb-3",children:i.jsx(Ib,{label:"Price (USDC)",value:g,onChange:y,right:i.jsx("div",{className:"h-[22px] px-2 rounded-md flex justify-center items-center cursor-pointer",style:{background:"#1b242c",color:"#67FFBD",border:`1px solid ${Ra}`},onClick:()=>y(e??""),children:"Mid"})})}),!Pr&&(u==="market"||u==="limit")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mb-3",children:i.jsx(Ib,{label:"Size",value:v,onChange:$r,right:i.jsx(zF,{value:N,onChange:cr,items:[{key:"USD",label:"USDC"},{key:"COIN",label:t}]})})}),i.jsxs("div",{className:"flex items-center gap-3 mb-6 ",children:[i.jsx(wj,{value:P,onChange:Nt,accent:Gt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:P,onChange:En=>Nt(Math.max(0,Math.min(100,Number(En.target.value)||0))),style:{color:Bi,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:En=>$(En.target.checked)}),"Reduce Only"]}),u==="limit"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Us,{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(zF,{value:L,onChange:z,items:[{key:"GTC",label:"GTC"},{key:"IOC",label:"IOC"},{key:"ALO",label:"ALO"}]})]}),u==="market"&&i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:Q,onChange:En=>se(En.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:Q,onChange:En=>se(En.target.checked)}),"TP/SL"]}),Q&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsx(Ib,{label:"TP",value:ee,onChange:me}),i.jsx(Ib,{label:"Gain %",value:G,onChange:Zt,right:i.jsx("span",{style:{color:Si},children:"%"})}),i.jsx(Ib,{label:"SL",value:re,onChange:_t}),i.jsx(Ib,{label:"Loss %",value:ae,onChange:dt,right:i.jsx("span",{style:{color:Si},children:"%"})})]})]}),Pr&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-2 w-full flex justify-between gap-2",children:[i.jsxs("span",{className:"h-[34px] rounded-lg font-semibold bg-[rgba(103,255,189,0.16)] text-[#67FFBD] flex justify-center items-center w-1/2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${yr}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),yr," Long"]}),i.jsxs("span",{className:"h-[34px] rounded-lg font-semibold bg-[rgba(255,121,124,0.12)] text-[#FF7272] flex justify-center items-center w-1/2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${nr}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),nr," Short"]})]}),i.jsx("div",{className:"mb-3",children:i.jsx(axn,{value:Kn,onChange:jn,leftLabel:yr,rightLabel:nr,leftUsd:Number(vn||0)>0?Number(vn)*Kn/100:0,rightUsd:Number(vn||0)>0?Number(vn)*(100-Kn)/100:0})}),i.jsx("div",{className:"mb-3",children:i.jsx(Ib,{label:"Size (USD)",value:vn,onChange:En=>{Wn(En)},right:i.jsx("div",{className:"h-[22px] px-2 rounded-md flex justify-center items-center cursor-pointer",style:{background:"#1b242c",color:"#67FFBD",border:`1px solid ${Ra}`},onClick:()=>{const En=qn*(Number(Oe)||1);Wn(String(En.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:En=>$(En.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(zF,{value:L,onChange:z,items:[{key:"GTC",label:"GTC"},{key:"IOC",label:"IOC"},{key:"ALO",label:"ALO"}]})]})]})]}),u==="twap"&&!Pr&&i.jsxs(i.Fragment,{children:[i.jsx(Ib,{label:"Total Size",value:xt,onChange:Tr,right:i.jsx(zF,{value:St,onChange:Lr,items:[{key:"USDC",label:"USDC"},{key:"COIN",label:t}]})}),i.jsxs("div",{className:"flex items-center gap-3 mb-8 mt-3",children:[i.jsx(wj,{value:it,onChange:ar,accent:Gt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:it,onChange:En=>ar(Math.max(0,Math.min(100,Number(En.target.value)||0))),style:{color:Bi,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:Lo,border:`1px solid ${Ra}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Hour(s)",value:cn===0?"":cn,onChange:En=>{const Bn=En.target.value.replace(/[^\d]/g,""),mt=Math.max(0,Math.min(24,Number(Bn)||0));Vn(mt)},style:{color:cn?"#FFFFFF":Si,fontFeatureSettings:'"tnum"'}})}),i.jsx("div",{className:"h-[30px] px-2 rounded-lg flex items-center",style:{background:Lo,border:`1px solid ${Ra}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Minute(s)",value:tn===0?"":tn,onFocus:()=>{tn===5&&fn(0)},onChange:En=>{const Bn=En.target.value.replace(/[^\d]/g,""),mt=Math.max(0,Math.min(59,Number(Bn)||0));fn(mt)},style:{color:tn?"#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:rn,onChange:En=>nt(En.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:En=>$(En.target.checked)}),"Reduce Only"]})]})]}),Be?i.jsx("button",{onClick:is,disabled:hn||!Vt||Tn||ci,className:"w-full h-[32px] rounded-xl font-bold transition-opacity mb-2 flex items-center justify-center disabled:opacity-60",style:{background:Gt,color:"#0f151a"},children:Fr}):i.jsx(om,{onClick:()=>{Ke==null||Ke(),we(!0)}}),u==="twap"&&!Pr?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:[fr.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:_r.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:hr>0?`${hr.toLocaleString(void 0,{maximumFractionDigits:Ge??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:tr})]})]}):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:Pr?"-":ts?`$${ts.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:Pr?`$${Number(vn||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(ls||0).toLocaleString(void 0,{maximumFractionDigits:2})}`})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Margin Required"}),i.jsx("span",{className:"text-white",children:Pr?`$${(Number(vn||0)/(Number(Oe)||1)||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(cs||0).toLocaleString(void 0,{maximumFractionDigits:2})}`})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Slippage"}),i.jsxs("button",{type:"button",onClick:()=>zt(!0),className:"text-[#67FFBD] hover:opacity-80 h-5 text-xs flex justify-center items-center",children:[`Est: ${Qs}% / `,`Max: ${Number(Mt||0).toFixed(2)}%`]})]})]}),Be&&yt&&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"}),Be&&yt&&i.jsxs("div",{className:"flex w-full gap-2 mt-2",children:[i.jsxs(QNe,{onClick:()=>Je(!0),className:"flex-1",children:["Perps ",i.jsx(ule,{className:"mx-1 text-xs"})," Spot"]}),i.jsx(QNe,{onClick:()=>rt(!0),className:"flex-1",children:"Withdraw"})]}),i.jsxs("div",{className:"mt-3 pt-2",children:[i.jsx("div",{className:"mb-2 text-white font-inter text-[13px] font-normal leading-4",children:"Account Equity"}),i.jsx(Mv,{k:"Spot",v:`$${nje(er??Number(qt.spot||0))}`}),i.jsx(Mv,{k:"Perps",v:`$${nje(ft.balance)}`})]}),i.jsxs("div",{className:"mt-3 pt-2",children:[i.jsx("div",{className:"mb-2 text-white font-inter text-[13px] font-normal leading-4",children:"Perps Overview"}),i.jsx(Mv,{k:"Balance",v:`$${E7(ft.balance,2)}`}),i.jsx(Mv,{k:"Unrealized PNL",v:i.jsxs("span",{style:{color:ft.uPnl<0?"#FF7173":"#67FFBD"},children:["$",E7(ft.uPnl,2)]})}),i.jsx(Mv,{k:"Cross Margin Ratio",v:i.jsxs("span",{style:{color:ft.cmr>=.5?"#FF7173":"#67FFBD"},children:[E7(ft.cmr*100,2),"%"]}),link:!0}),i.jsx(Mv,{k:"Maintenance Margin",v:`$${E7(ft.maintenanceMargin,2)}`}),i.jsx(Mv,{k:"Cross Account Leverage",v:`${E7(ft.crossLeverage,2)}x`})]}),i.jsx(S0n,{open:st,onClose:()=>He(!1),initialAsset:"USDC",initialChain:"Arbitrum",toWalletAddress:(yt==null?void 0:yt.wallet_address)||""}),i.jsx(Sqe,{open:Ye,onClose:()=>Je(!1),perpsAvailable:kr,spotUsdcAvailable:Dn,onSubmit:$n,loading:De,initialToPerp:!1}),i.jsx(ixn,{open:ht,onClose:()=>rt(!1),perpsBalance:Number((ft==null?void 0:ft.balance)??0),defaultDest:Te||""}),i.jsx(lp,{open:oe,onClose:()=>he(!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 ",Pr?`${yr}/${nr}`:t," ","positions. The maximum leverage is ",vt,"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:vt,step:1,value:Oe,onChange:En=>$e(Number(En.target.value)),className:"flex-1",style:{accentColor:zg}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",value:Oe,onChange:En=>$e(Math.max(1,Math.min(vt,Number(En.target.value)||1))),style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},className:"ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>xn(()=>he(!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:ze,onClose:()=>zt(!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:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",type:"text",inputMode:"decimal",value:Mt,onChange:En=>{const Bn=En.target.value.replace(",",".");if(Bn===""){ln("");return}/^\d*\.?\d*$/.test(Bn)&&ln(Bn)},style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:Si},className:"ml-1",children:"%"})]}),i.jsx(z0,{onClick:at,children:"Confirm"})]})}),i.jsx(lp,{open:W,onClose:()=>ne(!1),children:i.jsxs(ym,{title:`${Pr?`${yr}/${nr}`:t} Margin Mode`,children:[i.jsx(OQ,{active:Se==="Cross",onClick:()=>ge("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(OQ,{active:Se==="Isolated",onClick:()=>ge("Isolated"),title:"Isolated",desc:"Manage your risk on individual positions by restricting the amount of margin allocated to each. If the margin ratio of an isolated position reaches 100%, the position will be liquidated. Margin can be added or removed to individual positions in this mode."}),i.jsx("div",{className:"mt-3",children:i.jsx(z0,{onClick:()=>xn(()=>ne(!1)),children:"Confirm"})})]})}),i.jsx(lp,{open:_e,onClose:()=>xe(!1),children:i.jsxs(ym,{title:"Position Mode",children:[i.jsx(OQ,{active:Ve==="One-Way",onClick:()=>bt("One-Way"),title:"One-Way",desc:"Open orders in the same direction merge into a single position for each market."}),i.jsx("div",{className:"mt-3",children:i.jsx(z0,{onClick:()=>xe(!1),children:"Confirm"})})]})})]})}const Pb=({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(Vs,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!0})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{value:e,onChange:r,type:"number",name:s,onFocus:c,onBlur:u,autoComplete:"off",onKeyDown:["Unrealized PnL","Funding Paid"].includes(t)?void 0:d,placeholder:"Min",className:`py-0.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-sm font-medium font-inter leading-[8px] w-1/2 px-2 ${e!=null&&e!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`}),i.jsx("input",{value:n,onChange:r,type:"number",name:a,autoComplete:"off",onFocus:c,onBlur:u,onKeyDown:["Unrealized PnL","Funding Paid"].includes(t)?void 0:d,placeholder:"Max",className:`bg-[#1b1b1b] rounded-md border border-[#303030] py-0.5 h-8 block sm:text-sm font-semibold font-manrope leading-none w-1/2 px-2 ${n!=null&&n!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`})]})]})},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:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})]}),i.jsx(Pb,{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(Pb,{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(Pb,{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(Pb,{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(Pb,{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(Pb,{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(Pb,{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(Pb,{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})]})},jqe=h.createContext({key:"All",setKey:()=>{}});function xxn({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(jqe.Provider,{value:s,children:t})}function B2(){return h.useContext(jqe)}function gxn({className:t=""}){const{key:e,setKey:n}=B2(),r=["All","Active","Long","Short"];return i.jsxs("label",{className:`inline-flex items-center gap-2 ${t}`,children:[i.jsx("span",{className:"text-[#9B9B9B] text-[12px]",children:"Filter"}),i.jsx("select",{value:e,onChange:s=>n(s.target.value),className:"h-7 bg-[#262626] text-white text-[12px] rounded-md px-2 border border-[#2F2F2F] outline-none",children:r.map(s=>i.jsx("option",{value:s,children:s},s))})]})}function bxn(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 yxn(t,e){var n;if(e==="positions"){const r=Number((t==null?void 0:t.szi)??(t==null?void 0:t.size)??((n=t==null?void 0:t.position)==null?void 0:n.szi)??0);return Math.abs(r)>0}return!0}function u1(t,e="generic",n="All"){if(!Array.isArray(t)||t.length===0)return t||[];if(n==="All")return t;if(n==="Active")return t.filter(s=>yxn(s,e));const r=n;return t.filter(s=>{const a=bxn(s);return a?a===r:!1})}const vxn=({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}=B2(),{copyTradeWatchList:x,trackedWatchList:g,setSignModalOpen:y}=h.useContext(Yr),{address:v}=es(),[C,N]=h.useState(!1),[I,P]=h.useState(null),[M,F]=h.useState(null),[$,L]=h.useState(""),[z,Q]=h.useState(""),[se,ee]=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:""}),K=()=>{c("All"),Q(""),ee({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:""})},de=((q,W)=>W.reduce((ne,oe)=>{const he=q[oe];return he!==void 0&&he!==""&&he!==null&&ne++,ne},0))({...se,walletFilter:z},[...Object.keys(se),"walletFilter"]),G=h.useMemo(()=>u1(t,"positions",f),[t,f]),ie=async({walletAddress:q,isFollow:W,isScalper:ne})=>{try{L(q);const oe=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!oe){y(!0);return}const _e=W?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",xe=W?{address:v?v.toLowerCase():he,token:oe,follow_address:q.toLowerCase()}:{address:v?v.toLowerCase():he,token:oe},Se=await fetch(_e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(xe)});if(!Se.ok)throw new _l(`Server responded with status ${Se.status}`);const ge=await Se.json();ge.success?(P(Array.isArray(ge==null?void 0:ge.data)?[...ge.data].sort((Ce,je)=>new Date(je.created_at||0)-new Date(Ce.created_at||0)):ge==null?void 0:ge.data),F(ne),N(!0)):dn.error(ge.error_message)}catch(oe){dn.error(oe.message||"Something went wrong!")}},ae=[{key:"action",label:"Action",sortable:!1,width:"125px",render:(q,W)=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{onClick:ne=>{ne.preventDefault();const oe=x==null?void 0:x.some(he=>he.wallet_address===(W==null?void 0:W.address));ie({walletAddress:W==null?void 0:W.address,isFollow:oe,isScalper:W==null?void 0:W.is_scalper})},className:`${x.some(ne=>ne.wallet_address===(W==null?void 0:W.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($5,{walletAddress:W==null?void 0:W.address,children:i.jsx("div",{className:"w-[18px] h-[18px] flex items-center justify-center cursor-pointer",children:g.some(ne=>ne.wallet_address===(W==null?void 0:W.address))?i.jsx("img",{src:j5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:zj,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})},{key:"address",label:"Wallet",sortable:!0,sortValue:q=>(q.address||"").toLowerCase(),render:(q,W)=>i.jsx("div",{onClick:()=>window.open(`/wallet-details/${W==null?void 0:W.address}`,"_blank"),className:"flex items-center gap-2.5 cursor-pointer",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(ag,{info:W!=null&&W.address?`${W.address.slice(0,5)}...${W.address.slice(-4)}`:"--",textColor:"text-white"}),i.jsx("img",{onClick:ne=>{ne.stopPropagation(),navigator.clipboard.writeText((W==null?void 0:W.address)||""),dn.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:_o,alt:"",className:"cursor-pointer"})]})})},{key:"direction",label:"Direction",sortable:!0,sortValue:q=>q.direction==="long"?1:q.direction==="short"?0:-1,render:(q,W)=>i.jsx("div",{className:"flex items-center gap-2 h-8",children:i.jsxs("div",{className:`${W.direction==="long"?"text-[#67ffbd] bg-[#67ffbd]/20":W.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:W.direction==="long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):W.direction==="short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold leading-[8px] tracking-wide uppercase",children:[W.direction," - ",W.leverage_value,"x"]})]})})},{key:"notional",label:"Notional",sortable:!0,sortValue:q=>Number(q.notional)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.notional)==null||isNaN(parseFloat(W==null?void 0:W.notional))?"--":`$${ad(W==null?void 0:W.notional)}`,textColor:"text-white"})},{key:"szi",label:"Size",sortable:!0,sortValue:q=>Number(q.szi)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.szi)==null||isNaN(parseFloat(W==null?void 0:W.szi))?"--":`${Er(W==null?void 0:W.szi)}`,textColor:"text-white"})},{key:"entry_price",label:"Entry Price",sortable:!0,sortValue:q=>Number(q.entry_price)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.entry_price)==null||isNaN(parseFloat(W==null?void 0:W.entry_price))?"--":`$${d3(parseFloat(W==null?void 0:W.entry_price).toFixed((W==null?void 0:W.entry_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:q=>Number(q.liq_price)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.liq_price)==null||isNaN(parseFloat(W==null?void 0:W.liq_price))?"--":`$${d3(parseFloat(W==null?void 0:W.liq_price).toFixed((W==null?void 0:W.liq_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"unrealized_pnl",label:"Unrealized PnL",sortable:!0,sortValue:q=>Number(q.unrealized_pnl)||0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.unrealized_pnl)==null||isNaN(parseFloat(W==null?void 0:W.unrealized_pnl))?"--":`$${Er(Math.abs(W==null?void 0:W.unrealized_pnl))}`,textColor:`${(W==null?void 0:W.unrealized_pnl)==null||isNaN(parseFloat(W==null?void 0:W.unrealized_pnl))||(W==null?void 0:W.unrealized_pnl)===0?"text-white":(W==null?void 0:W.unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"funding_paid",label:"Funding Paid",sortable:!0,sortValue:q=>Number(q.funding_paid)||0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.funding_paid)==null||isNaN(parseFloat(W==null?void 0:W.funding_paid))?"--":`$${Er(Math.abs(W==null?void 0:W.funding_paid))}`,textColor:`${(W==null?void 0:W.funding_paid)==null||isNaN(parseFloat(W==null?void 0:W.funding_paid))||(W==null?void 0:W.funding_paid)===0?"text-white":(W==null?void 0:W.funding_paid)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"account_value",label:"Margin",sortable:!0,sortValue:q=>Number(q.account_value)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.account_value)==null||isNaN(parseFloat(W==null?void 0:W.account_value))?"--":`$${ad(W==null?void 0:W.account_value)}`,textColor:"text-white"})},{key:"perp_equity",label:"Account Value",sortable:!0,sortValue:q=>Number(q.perp_equity)||-1/0,render:(q,W)=>i.jsx(ag,{info:(W==null?void 0:W.perp_equity)==null||isNaN(parseFloat(W==null?void 0:W.perp_equity))?"--":`$${ad(W==null?void 0:W.perp_equity)}`,textColor:"text-white"})}];return i.jsxs(i.Fragment,{children:[i.jsx(U5,{open:C,setOpen:N,copyTradeData:I,copyTradeWallet:$,setCopyTradeWallet:L,isScalper:M,setCopyTradeData:P}),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:`${de>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 ${de>0?"text-blue-500":"text-white"}`}),de>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:de})]}),de>0&&i.jsx(wxn,{title:"Reset Filter",set_click:()=>K(),tableSortButton:"Reset"})]}),i.jsx("div",{className:"flex",children:i.jsx(ude,{periods:a,selectedPeriod:s,handlePeriod:o,borderColor:"ticker"})}),e&&i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]})]})}),i.jsxs("div",{className:"flex flex-col sm:flex-row w-full h-full",children:[i.jsxs("div",{className:`${u?"":"hidden"} w-[95%] sm:w-72 sm:min-w-72 h-[calc(100%-70px)] bg-[#232323] border border-[#292929] rounded-2xl m-2 overflow-hidden`,children:[i.jsxs("div",{className:"w-full sticky top-0 bg-[#232323] flex justify-between items-center pt-[2px] pl-3 pr-1 mt-3",children:[i.jsx("div",{className:"text-white text-base font-semibold font-inter leading-[8px]",children:"Filters"}),i.jsx("div",{onClick:()=>K(),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md inline-flex items-center mr-3 cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-inter leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx(mxn,{walletFilter:z,setWalletFilter:Q,filterTerminal:se,setFilterTerminal:ee,resetFilters:K})]}),i.jsx("div",{className:"w-full h-[calc(100%-60px)] relative flex-grow",children:e?i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-10",children:i.jsx(Ba,{})}):n&&!t?i.jsx("div",{className:"flex min-h-[26vh] sm:min-h-[66vh] flex-col justify-center items-center",children:i.jsx(_l,{})}):(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:Kl,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:ae,rowHeight:30,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal"})})]})]})]})},ag=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-[12px] font-semibold font-inter leading-none flex items-center justify-start px-1 gap-0.5`,children:t})}),wxn=({title:t,set_click:e,tableSortButton:n})=>i.jsx("div",{onClick:e,className:`${n==t?"bg-[#3d3d3d] text-white":n=="Reset"?"bg-[#3d3d3d] text-white hover:bg-[#4d4d4d]":"bg-[#161616] text-[#9b9b9b]"} text-[12px] font-medium font-inter leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-7`,children:t});function Qv(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function ije(t){return new Promise(e=>setTimeout(e,t))}function aje(t){if(!t)return"";const e=String(t);return e.slice(0,6)+"..."+e.slice(-4)}function Cxn({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 WF({children:t}){return i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1",children:t})}function oje({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 lje({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 Sxn({children:t}){return i.jsx("div",{className:"grid grid-cols-2 gap-4",children:t})}function Nxn({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 jxn({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 Axn(){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 _xn(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 Exn=t=>typeof t=="string"&&/^0x[0-9a-fA-F]{40}$/.test(t.trim());function kxn({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(L=>L.coin===f)?Math.max(0,Number(b.total||0)-Number(b.hold||0)):0,C=()=>y(String(v)),N=()=>s({kind:"send",from:u,token:f,destination:l,amount:g,available:v}),I=Exn(l),P=Number(g)>0&&Number(g)<=Number(v||0),M=!I||!P,F=l.length>0&&!I;return i.jsx(Cxn,{open:t,onClose:e,title:"Send Tokens",children:i.jsxs("div",{className:"space-y-4 text-xs",children:[i.jsxs("div",{children:[i.jsx(WF,{children:"Destination"}),i.jsx(oje,{value:l,onChange:c,placeholder:"Enter Hyperliquid account address (0x…)",invalid:F})]}),i.jsxs(Sxn,{children:[i.jsxs("div",{children:[i.jsx(WF,{children:"From Account"}),i.jsx(lje,{value:u,onChange:$=>d($),options:[{value:"perps",label:"Perps Account"},{value:"spot",label:"Spot Account"}]})]}),i.jsxs("div",{children:[i.jsx(WF,{children:"Token"}),i.jsx(lje,{value:f,onChange:x,options:o,disabled:u==="perps"})]})]}),i.jsxs("div",{children:[i.jsx(WF,{children:"Amount"}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(oje,{value:g,onChange:y,placeholder:"0.0"}),i.jsx(Nxn,{onMax:C})]}),i.jsxs("div",{className:"mt-1 text-[12px] text-[#9B9B9B]",children:["Available: ",Qv(v,6)," ",f]})]}),i.jsx(jxn,{onClick:N,disabled:M,loading:a,children:"Send"})]})})}const Txn={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},Ixn={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function Pxn(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function Ise(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ise);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]=Ise(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=Pxn(r))}return e}function Fxn(t,e,n){const r=Ise(t),s=Cqe(r),a=e==null?9:29,o=new Uint8Array(s.length+a);o.set(s);const l=new DataView(o.buffer);return l.setBigUint64(s.length,BigInt(n),!1),e==null?l.setUint8(s.length+8,0):(l.setUint8(s.length+8,1),o.set(ms(e),s.length+9)),mo(o)}function Oxn(t,e){return{source:e?"a":"b",connectionId:t}}function Mxn(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 Rxn(t,e){const n=Axn();if(!n)throw new Error("No injected provider");return await _xn(n,"0xa4b1"),await n.request({method:"eth_signTypedData_v4",params:[t,JSON.stringify(e)]})}function Lxn({addr:t,isMainnet:e=!0,vaultAddress:n=null}){return{sign:async(r,s)=>{const a=Fxn(r,n,s),o={domain:Txn,types:Ixn,primaryType:"Agent",message:Oxn(a,e)},l=await Rxn(t,o);return Mxn(l)}}}const cje=t=>t?`${t.slice(0,6)}...${t.slice(-4)}`:"-";function Dxn({walletAddress:t,listHeight:e=560}){const{address:n}=es(),{latestPnL:r}=h.useContext(Yr),[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 ae=window.localStorage.getItem("hl_selected_wallet_address")||null;a(ae||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=aI(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),N=h.useMemo(()=>{const ie=typeof window<"u"?localStorage.getItem("hl_pk"):null,ae=ie?J0n(ie).toLowerCase():null,q=n?n.toLowerCase():null,W=s?s.toLowerCase():null,ne=ie&&ae&&W&&ae===W;return{mode:ne?"local":!ne&&q?"metamask":"none",localAddr:ae,mmAddr:q,targetAddr:W}},[n,s]);h.useEffect(()=>{const ie=ae=>{var W;const q=!!((W=ae==null?void 0:ae.detail)!=null&&W.toPerp);y(ne=>({...ne,transfer:!0,transferInitToPerp:q}))};return window.addEventListener("balances:open-transfer",ie),()=>window.removeEventListener("balances:open-transfer",ie)},[]);const I=h.useMemo(()=>{try{if(!s)return null;if(N.mode==="local"){const ie=lI({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return vj({address:s,signer:ie,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null})}if(N.mode==="metamask"&&N.mmAddr){const ie=Lxn({addr:N.mmAddr,isMainnet:!0,vaultAddress:null});return vj({address:s,signer:ie,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>null})}return null}catch{return null}},[s,N]);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(ae=>ae.json()),window.dispatchEvent(new CustomEvent("noop"))}catch{}})()};return window.addEventListener("balances:refresh",ie),()=>window.removeEventListener("balances:refresh",ie)},[s]);const P=h.useMemo(()=>c||[],[c]),M=h.useMemo(()=>{const ie=P.find(ae=>ae.coin==="USDC");return ie?Math.max(0,Number(ie.total||0)-Number(ie.hold||0)):0},[P]),F=()=>{const ie=N.mode==="local"?N.localAddr:N.mode==="metamask"?N.mmAddr:null;return ie?N.targetAddr?ie!==N.targetAddr?(dn.error(`Connected wallet ${aje(ie)} does not match selected account ${aje(N.targetAddr)}. Switch wallet or change the selected account.`,{id:"addr-mismatch",duration:6e3}),!1):!0:(dn.error("Target account is missing.",{id:"target-missing"}),!1):(dn.error("Wallet not connected or signer unavailable.",{id:"signer-missing"}),!1)},$=()=>{dn.error("No deposit found for this account. Please deposit USDC (Arbitrum) to Hyperliquid before performing this action.",{id:"err-deposit"})},L=async({from:ie,token:ae,destination:q,amount:W,available:ne})=>{var oe;try{if(C(!0),!I)throw new Error("SDK not ready");if(!F())return;const he=(q||"").trim().toLowerCase();if(!he||!he.startsWith("0x")||he.length!==42)throw new Error("Destination address is invalid");if(!Number(W))throw new Error("Amount is invalid");if(Number(W)>Number(ne||0))throw new Error("Amount exceeds available balance");let _e;if(ie==="perps")_e=await I.transfers.usdTransfer(he,W);else{const xe=u[ae];if(!xe)throw new Error(`TokenId not found for ${ae}`);const Se=`${ae}:${xe}`;_e=await I.transfers.spotTransfer(he,Se,String(W))}if((_e==null?void 0:_e.status)==="ok")dn.success("Send successful.",{id:"send-success"}),await ije(600),(oe=window==null?void 0:window.dispatchEvent)==null||oe.call(window,new Event("balances:refresh"));else{const xe=typeof(_e==null?void 0:_e.response)=="string"?_e.response:JSON.stringify(_e);xe&&xe.toLowerCase().includes("must deposit")?$():dn.error(`Send failed: ${xe||"Unknown error"}`,{id:"send-error"})}}catch(he){const _e=(he==null?void 0:he.message)||"Send failed";_e.toLowerCase().includes("must deposit")?$():dn.error(_e,{id:"send-error"})}finally{C(!1),y(he=>({...he,send:!1}))}},z=async({toPerp:ie,amount:ae,available:q})=>{var W;try{if(C(!0),!I)throw new Error("SDK not ready");if(!F())return;if(!Number(ae))throw new Error("Amount is invalid");if(Number(ae)>Number(q||0))throw new Error("Amount exceeds available balance");const ne=await I.transfers.usdClassTransfer(String(ae),!!ie);if((ne==null?void 0:ne.status)==="ok")dn.success("Transfer successful.",{id:"transfer-success"}),await ije(600),(W=window==null?void 0:window.dispatchEvent)==null||W.call(window,new Event("balances:refresh"));else{const oe=typeof(ne==null?void 0:ne.response)=="string"?ne.response:JSON.stringify(ne);oe&&oe.toLowerCase().includes("must deposit")?$():dn.error(`Transfer failed: ${oe||"Unknown error"}`,{id:"transfer-error"})}}catch(ne){const oe=(ne==null?void 0:ne.message)||"Transfer failed";oe.toLowerCase().includes("must deposit")?$():dn.error(oe,{id:"transfer-error"})}finally{C(!1),y(ne=>({...ne,transfer:!1}))}},Q=1,[se,ee]=h.useState(()=>typeof window>"u"?!1:localStorage.getItem("hide_small_balances")==="1");h.useEffect(()=>{const ie=ae=>{var q;typeof((q=ae==null?void 0:ae.detail)==null?void 0:q.value)=="boolean"?ee(ae.detail.value):ee(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 K=h.useMemo(()=>ie=>{if(Number.isFinite(Number(ie.usdcValue)))return Number(ie.usdcValue);const ae=f[ie.coin],q=Number(ie.totalDisplay??0);return Number.isFinite(ae)&&Number.isFinite(q)?ae*q:null},[f]),re=h.useMemo(()=>{const ie=[],ae=Number((l==null?void 0:l.accountValue)??0),q=Number((l==null?void 0:l.totalMarginUsed)??0),W=Math.max(0,ae-q);return ie.push({id:"USDC_PERPS",kind:"perps",coin:"USDC",unit:"USDC",usdcValue:ae,totalDisplay:ae,availableDisplay:W,totalSort:ae,availableSort:W}),P.forEach(ne=>{const oe=String(ne.coin),he=Number(ne.total||0),_e=Number(ne.hold||0),xe=Math.max(0,he-_e);let Se=null;oe==="USDC"&&(Se=he);const ge=f[oe];Se==null&&Number.isFinite(ge)&&(Se=ge*he),ie.push({id:`SPOT_${oe}`,kind:"spot",coin:oe,unit:oe,usdcValue:Se,totalDisplay:he,availableDisplay:xe,totalSort:he,availableSort:xe})}),ie},[l,P,f]),de=h.useMemo(()=>se?re.filter(ie=>{if(ie.kind==="perps")return!0;const ae=K(ie);return ae!=null?ae>=Q:Number(ie.totalDisplay??0)>=1e-6}):re,[re,se,K]),G=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:ie=>ie.coin,render:(ie,ae)=>i.jsxs("span",{className:"text-white",children:[ae.coin," ",ae.kind==="perps"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Perps)"}):ae.coin==="USDC"&&ae.kind==="spot"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Spot)"}):null]})},{key:"total",label:"Total Balance",sortable:!0,sortValue:ie=>ie.totalSort,render:(ie,ae)=>i.jsxs("span",{className:"text-white",children:[Qv(ae.totalDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ae.unit})]})},{key:"available",label:"Available Balance",sortable:!0,sortValue:ie=>ie.availableSort,render:(ie,ae)=>{const q=ae.kind==="perps"&&ae.coin==="USDC",W=Number((l==null?void 0:l.withdrawable)||0),ne=q?`Available balance to open positions ignoring open orders. ${Qv(W,2)} USDC is availableto withdraw.`:void 0;return i.jsxs("span",{className:"text-white underline-offset-2",title:ne,children:[Qv(ae.availableDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ae.unit})]})}},{key:"usdcValue",label:"USDC Value",sortable:!0,sortValue:ie=>{const ae=K(ie);return ae??-1},render:(ie,ae)=>{const q=K(ae);return i.jsxs("span",{className:"text-white",children:[q!=null?Qv(q):"-"," ",q!=null?i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"}):null]})}},{key:"pnlRoe",label:"PnL (ROE %)",sortable:!1,render:(ie,ae)=>{if(ae.kind!=="perps")return i.jsx("span",{className:"text-white",children:"-"});const q=r==null?void 0:r.all,W=Number((l==null?void 0:l.accountValue)||0),ne=W>0&&typeof q=="number"?q/W*100:null,oe=typeof q!="number"?"text-white":q>0?"text-[#67FFBD]":q<0?"text-[#FF7173]":"text-white";return i.jsxs("span",{className:oe,children:[typeof q!="number"?"-":`$${Qv(Math.abs(q),2)}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ne==null?"":`(${Qv(Math.abs(ne),2)}%)`})]})}},{key:"send",label:"Send",sortable:!1,render:(ie,ae)=>ae.kind==="perps"||ae.coin==="USDC"?i.jsxs("button",{onClick:()=>y(q=>({...q,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,ae)=>ae.coin==="USDC"?i.jsxs("button",{onClick:()=>y(q=>({...q,transfer:!0,transferInitToPerp:ae.kind==="spot"})),className:"p-0 inline-flex items-center gap-1 h-5 text-white bg-transparent hover:opacity-90 -ml-1",title:ae.kind==="perps"?"Transfer to Spot":"Transfer to Perpetual",children:[i.jsx(ule,{}),i.jsx("span",{children:ae.kind==="perps"?"Transfer to Spot":"Transfer to Perps"})]}):null},{key:"contract",label:"Contract",sortable:!1,render:(ie,ae)=>{const q=d[ae.coin],W=(q==null?void 0:q.tokenId)||null,ne=(q==null?void 0:q.evmContract)||null;if(W){const oe=`https://app.hyperliquid.xyz/explorer/token/${W}`;return i.jsx("a",{href:oe,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent hover:text-white/80 -ml-2",children:cje(W)})}if(ne){const oe=`https://arbiscan.io/token/${ne}`;return i.jsx("a",{href:oe,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent -ml-2",children:cje(ne)})}return i.jsx("span",{className:"text-[#9B9B9B] -ml-2",children:"-"})}}],[r==null?void 0:r.all,l,K,d]);return x?i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:de,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(kxn,{open:g.send,onClose:()=>y(ie=>({...ie,send:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotBalances:P,onSubmit:L,loading:v}),i.jsx(Sqe,{open:g.transfer,onClose:()=>y(ie=>({...ie,transfer:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotUsdcAvailable:M,onSubmit:z,loading:v,initialToPerp:!!g.transferInitToPerp})]}):i.jsx("div",{className:"mt-2 flex pt-12 justify-center text-[12px] text-[#9B9B9B]",style:{height:e},children:"Loading..."})}const Bxn={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},$xn="dextra-global-toast";function HQ(t,e){return dn.promise(t,e,{id:$xn,...Bxn})}async function VQ(t){const e=lI({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return vj({address:t,signer:e,dex:""})}function wo(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function Uxn(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}function sfe({open:t,onClose:e,title:n,width:r=720,children:s}){return t?_a.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 Hg=({children:t})=>i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mb-1",children:t}),Pse=({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]"}),WQ=({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]}),Aqe=({children:t,onClick:e,disabled:n,loading:r})=>i.jsxs("button",{onClick:e,disabled:n||r,className:`w-full h-8 rounded-xl !mt-10 font-medium font-inter text-[12px] flex items-center justify-center gap-2 ${n||r?"bg-[#2C2C2C] text-[#8A8A8A] cursor-not-allowed":"bg-[#67FFBD] text-[#101010] hover:opacity-95"}`,children:[r?i.jsx(f2,{size:14,color:"#FFF"}):null,i.jsx("span",{children:t})]});function zxn({open:t,onClose:e,row:n,onConfirm:r,initialTab:s="limit",busy:a=!1}){const[o,l]=Ie.useState(s),[c,u]=Ie.useState(n!=null&&n.markPrice?String(n.markPrice):""),[d,f]=Ie.useState(100),x=Ie.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);Ie.useEffect(()=>{t&&!x.current&&(l(s),f(100),u(n!=null&&n.markPrice?String(n.markPrice):""),x.current=!0),!t&&x.current&&(x.current=!1)},[t,s,n==null?void 0:n.markPrice]);const N=()=>{a||(o==="market"?r==null||r({mode:"market",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,side:n==null?void 0:n.type,size:v}):r==null||r({mode:"limit",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,side:n==null?void 0:n.type,price:C,size:v}))},I=o==="market"?"Market Close":"Limit Close",P=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(sfe,{open:t,onClose:a?()=>{}:e,title:I,width:500,children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"text-[12px] text-[#9B9B9B]",children:P}),i.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[i.jsx(Hg,{children:"Size"}),i.jsxs("div",{className:"text-[#CFCFCF]",children:[wo(g)," ",n==null?void 0:n.coin]})]}),o==="market"?i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{children:[i.jsx(Hg,{children:"Price"}),i.jsx(WQ,{right:"",children:i.jsx("span",{className:"text-white",children:"Market"})})]}),i.jsxs("div",{children:[i.jsx(Hg,{children:"Size"}),i.jsx(WQ,{right:"USDC",children:wo(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(Hg,{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(Pse,{value:c,onChange:u,placeholder:"0.0"})]}),i.jsxs("div",{children:[i.jsx(Hg,{children:"Size"}),i.jsx(WQ,{right:"USDC",children:wo(v*(C||y),2)})]})]}),i.jsx(wj,{value:d,onChange:f,accent:"#67FFBD",trackBg:"rgba(255,255,255,0.12)",marks:[0,25,50,75,100],snap:!0}),i.jsx(Aqe,{onClick:N,disabled:o==="limit"&&!c,loading:a,children:o==="market"?"Market Close":"Confirm"})]})})}function Hxn({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(sfe,{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," ",wo(a)]}),i.jsxs("div",{className:"text-[#FF797C]",children:[o," ",wo(a)]})]})}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx("button",{onClick:e,disabled:s,className:`flex-1 h-10 rounded-xl border border-[#2A2A2A] bg-transparent text-white hover:bg-white/5 ${s?"opacity-60 cursor-not-allowed":""}`,children:"Cancel"}),i.jsx("button",{onClick:()=>r==null?void 0:r({mode:"reverse",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,from:n==null?void 0:n.type,to:o,size:a}),disabled:s,className:`flex-1 h-10 rounded-xl bg-[#67FFBD] text-[#101010] hover:opacity-95 ${s?"opacity-60 cursor-not-allowed":""}`,children:s?i.jsx(f2,{size:14,color:"#FFF"}):"Reverse"})]})]})})}const uje=({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 Vxn({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,N]=h.useState(!1),I=Number((n==null?void 0:n.entryPrice)||0),P=Number((n==null?void 0:n.markPrice)??0),M=Math.abs(Number((n==null?void 0:n.size)||0)),F=n==null?void 0:n.type,$=(((ie=n==null?void 0:n.leverage)==null?void 0:ie.type)||(n==null?void 0:n.marginType)||"").toString(),L=ae=>Number.isFinite(ae)?Math.max(0,ae):0,z=(ae,q=4)=>Number.isFinite(ae)?String(Number(ae.toFixed(q))):"",Q=ae=>{var oe;if(!I)return"";const q=Number(ae);if(!Number.isFinite(q))return"";const W=Number(((oe=n==null?void 0:n.leverage)==null?void 0:oe.value)||1),ne=(F==="Long"?q/I-1:1-q/I)*100*W;return z(L(ne),2)},se=ae=>{var oe;if(!I)return"";const q=Number(ae);if(!Number.isFinite(q))return"";const W=Number(((oe=n==null?void 0:n.leverage)==null?void 0:oe.value)||1),ne=(F==="Long"?1-q/I:q/I-1)*100*W;return z(L(ne),2)},ee=ae=>{var he;const q=Number(ae);if(!Number.isFinite(q)||!I)return"";const W=Number(((he=n==null?void 0:n.leverage)==null?void 0:he.value)||1),ne=q/(W*100),oe=F==="Long"?I*(1+ne):I*(1-ne);return z(oe,4)},K=ae=>{var he;const q=Number(ae);if(!Number.isFinite(q)||!I)return"";const W=Number(((he=n==null?void 0:n.leverage)==null?void 0:he.value)||1),ne=q/(W*100),oe=F==="Long"?I*(1-ne):I*(1+ne);return z(oe,4)};h.useEffect(()=>{if(t){const ae=r?String(r):"",q=s?String(s):"";l(ae),u(q),f(ae?Q(ae):""),g(q?se(q):""),v(!1),N(!1)}},[t,r,s]);const re=o&&M?Math.max(0,(F==="Long"?Number(o)-P:P-Number(o))*M):0,de=c&&M?Math.max(0,(F==="Long"?P-Number(c):Number(c)-P)*M):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(sfe,{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:[wo(M)," ",i.jsx("span",{className:"text-[#67FFBD]",children:n==null?void 0:n.coin})]})]}),i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Entry Price"}),i.jsx("span",{className:"text-white",children:wo(I,4)})]}),i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Mark Price"}),i.jsx("span",{className:"text-white",children:wo(P,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(Hg,{children:"TP Price"}),i.jsx(Pse,{value:o,onChange:ae=>{l(ae),f(ae?Q(ae):"")},placeholder:"0.0"}),i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mt-1",children:"Est Gain:"}),i.jsxs("div",{className:"text-[11px] text-[#67FFBD]",children:["+$",wo(re,2)]})]}),i.jsxs("div",{children:[i.jsx(Hg,{children:"Gain"}),i.jsx(uje,{value:d,onChange:ae=>{f(ae),l(ae?ee(ae):"")}})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_220px] gap-6 items-start",children:[i.jsxs("div",{children:[i.jsx(Hg,{children:"SL Price"}),i.jsx(Pse,{value:c,onChange:ae=>{u(ae),g(ae?se(ae):"")},placeholder:"0.0"}),i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mt-1",children:"Est Loss:"}),i.jsxs("div",{className:"text-[11px] text-[#FF7173]",children:["-$",wo(de,2)]})]}),i.jsxs("div",{children:[i.jsx(Hg,{children:"Loss"}),i.jsx(uje,{value:x,onChange:ae=>{g(ae),u(ae?K(ae):"")}})]})]}),i.jsxs("div",{className:"flex items-center gap-6 text-[12px] text-white",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:y,onChange:ae=>v(ae.target.checked)}),i.jsx("span",{children:"Configure Amount"})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:C,onChange:ae=>N(ae.target.checked)}),i.jsx("span",{children:"Limit Price"})]})]}),i.jsx(Aqe,{onClick:G,disabled:!o&&!c,children:"Confirm"})]})]})})}function Wxn({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&&_a.createPortal(i.jsx("div",{className:"fixed z-[99998] w-[300px] rounded-xl border border-[#2A2A2A] bg-[#0F0F0F] shadow-2xl p-3",style:{top:c.y,left:c.x},onPointerDown:d=>d.stopPropagation(),children:i.jsxs("div",{className:"mt-2 text-[13px] text-white/90",children:[i.jsx("div",{className:`${t?"hover:bg-white/5":"opacity-40 pointer-events-none"} px-2 py-1.5 rounded cursor-pointer`,onClick:()=>t&&(e==null?void 0:e("limit")),children:"Limit Close"}),i.jsx("div",{className:`${t?"hover:bg-white/5":"opacity-40 pointer-events-none"} px-2 py-1.5 rounded cursor-pointer`,onClick:()=>t&&(e==null?void 0:e("market")),children:"Market Close"}),i.jsxs("div",{className:`px-2 py-1.5 rounded cursor-pointer ${s?"opacity-60 pointer-events-none":"hover:bg-white/5"}`,onClick:()=>!s&&(r==null?void 0:r()),children:["Close All (Market)",s?i.jsx("span",{className:"inline-flex ml-2 align-middle",children:i.jsx(f2,{size:12,color:"#FFF"})}):null]})]})}),document.body)]})}function qxn({walletAddress:t,listHeight:e=560}){var xe,Se,ge,Ce;const{isReferralCodeName:n}=h.useContext(Yr),{rows:r,tpslByCoin:s={},viewOrdersOnly:a}=efe(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}=B2(),[f,x]=h.useState({}),[g,y]=h.useState(null),[v,C]=h.useState(!1),[N,I]=h.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),[P,M]=h.useState(null),F=h.useMemo(()=>u.find(je=>je.id===P)||null,[u,P]),[$,L]=h.useState(!1),[z,Q]=h.useState("limit"),[se,ee]=h.useState(!1),[K,re]=h.useState(!1),[de,G]=h.useState(!1),ie=()=>typeof window<"u"&&window.localStorage.getItem("skipCloseConfirm")==="true",ae={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},q=je=>ae[je]||je,W=h.useCallback(async({id:je,coin:Oe,tpPrice:$e,slPrice:Ye,configureAmount:Je,useLimitPx:ht})=>{var rt;try{const st=await VQ(t);await HQ(st.replaceTPSLForPosition({symbol:Oe,tpPrice:$e??null,slPrice:Ye??null,useLimitPx:!!ht,triggerSlippage:.1}),{loading:`Placing TP/SL for ${Oe}...`,success:`TP/SL placed for ${Oe}`,error:He=>`TP/SL failed: ${(He==null?void 0:He.message)||He}`}),x(He=>({...He,[je]:{tp:$e||null,sl:Ye||null}})),(rt=window.dispatchEvent)==null||rt.call(window,new Event("orders:refresh"))}catch{}finally{y(null)}},[t]);h.useEffect(()=>{if(v&&!N.referral){const je=n||window.localStorage.getItem("refcode")||"";je&&I(Oe=>({...Oe,referral:je}))}},[v,n,N.referral]);const ne=h.useCallback(async je=>{re(!0);try{const Oe=await VQ(t),$e=je.mode==="market"?Oe.marketClose(je.coin,je.size,{tif:"Ioc",reduceOnly:!0}):Oe.placeOrder({symbol:je.coin,isBuy:je.side==="Short",size:je.size,price:je.price,tif:"Gtc",reduceOnly:!0});await HQ($e,{loading:`Closing ${je.coin} ${je.mode}...`,success:`Closed ${je.coin} (${wo(je.size)} ${je.mode})`,error:Ye=>`Close failed: ${je.coin} • ${(Ye==null?void 0:Ye.message)||Ye}`}),L(!1)}finally{re(!1)}},[t]),oe=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:Oe=>Oe.coin||"",render:(Oe,$e)=>{var ht;const Ye=Ao(),Je=()=>Ye(`/terminal/hyperliquid/${$e.coin}`);return i.jsxs("div",{onPointerDown:Je,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/${q($e.coin)}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:$e.coin}),i.jsx("span",{children:Oe.replace("xyz:","")||"--"}),i.jsx("div",{className:"flex justify-start items-center gap-2 h-8 ml-1",children:i.jsx("div",{className:`${$e.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:[wo(((ht=$e.leverage)==null?void 0:ht.value)??0,0),"x"]})})})]})}},{key:"size",label:"Size",sortable:!0,sortValue:Oe=>Math.abs(Oe.size),render:(Oe,$e)=>i.jsxs("span",{className:`font-medium ${$e.type==="Long"?"text-[#67ffbd]":"text-[#ff787b]"}`,children:[wo(Math.abs(Oe))," ",$e.coin.replace("xyz:","")]})},{key:"positionValue",label:"Pos. Val.",sortable:!0,sortValue:Oe=>Oe.positionValue,render:Oe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",wo(Oe,2)]})},{key:"entryPrice",label:"Entry Price",sortable:!0,sortValue:Oe=>Oe.entryPrice,render:Oe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",wo(Oe,4)]})},{key:"markPrice",label:"Mark Price",sortable:!0,sortValue:Oe=>Oe.markPrice,render:Oe=>i.jsxs("span",{className:"text-white font-semibold",children:["$",wo(Oe,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:Oe=>Oe.pnl,render:(Oe,$e)=>i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsxs("span",{className:$e.pnl>=0?"text-[#67FFBD]":"text-[#FF797C]",children:["$",wo(Math.abs($e.pnl),2)," ",i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",wo(Math.abs($e.roe),1),"%)"]})]}),i.jsx("button",{onClick:Ye=>{var ht;Ye.stopPropagation();const Je=n||window.localStorage.getItem("refcode")||"";I({coin:$e.coin,type:$e.type.toUpperCase(),leverage:((ht=$e.leverage)==null?void 0:ht.value)||0,roe:$e.roe||0,entryPrice:Number($e.entryPrice||0),markPrice:Number($e.markPrice||0),referral:Je,positionDistribution:0,pnl:Number($e.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:Oe=>Oe.liquidationPx??-1,render:Oe=>Oe==null?i.jsx("span",{className:"text-[#979797]",children:"--"}):i.jsx("span",{className:"text-white font-semibold",children:wo(Oe,0)})},{key:"marginUsed",label:"Margin",headerTooltip:"For isolated positions margin includes unrealized pnl.",sortable:!0,sortValue:Oe=>Oe.marginUsed,render:(Oe,$e)=>{var ht;const Ye=$e.marginUsed,Je=(ht=$e.leverage)!=null&&ht.type?Uxn($e.leverage.type):null;return i.jsxs("span",{className:"text-white font-semibold",children:["$",wo(Ye,2)," ",Je?i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",Je,")"]}):null]})}},{key:"funding",label:"Funding",headerTooltip:"Net funding payments since the position was opened. Hover for all-time and since changed.",sortable:!0,sortValue:Oe=>Oe.funding,render:Oe=>i.jsxs("span",{className:Number(Oe)<=0?"text-[#67FFBD] font-semibold":"text-[#FF797C] font-semibold",children:["$",wo(Math.abs(Oe),4)]})},{key:"close",label:i.jsx(Wxn,{selectedRow:F,onOpenCloseModal:async Oe=>{if(F){if(Q(Oe),Oe==="market"&&ie()){await ne({mode:"market",id:F==null?void 0:F.id,coin:F==null?void 0:F.coin,side:F==null?void 0:F.type,size:Math.abs(Number((F==null?void 0:F.size)||0))});return}L(!0)}},onOpenReverse:()=>F&&ee(!0),onCloseAll:async()=>{G(!0);try{const Oe=await VQ(t);await HQ(Oe.closeAllPositions(),{loading:"Closing all positions...",success:"Closed all positions",error:$e=>`Close all failed: ${($e==null?void 0:$e.message)||$e}`})}finally{G(!1)}},busyCloseAll:de}),sortable:!1,align:"start",render:(Oe,$e)=>i.jsxs("div",{className:"w-full flex items-center gap-1",children:[i.jsx("button",{onClick:()=>{M($e.id),Q("limit"),L(!0)},className:"flex justify-center items-center h-5 px-2 rounded-md text-[11px] font-semibold text-[#0f151a] bg-[rgb(103,255,189)] -ml-2",children:"Limit"}),i.jsx("button",{onClick:async()=>{M($e.id),Q("market"),ie()?await ne({mode:"market",id:$e.id,coin:$e.coin,side:$e.type,size:Math.abs(Number($e.size||0))}):L(!0)},className:"flex justify-center items-center h-5 px-2 rounded-md text-[11px] font-semibold text-[#0f151a] bg-[rgb(103,255,189)]",children:"Market"})]})},{key:"tpSl",label:"TP/SL",sortable:!1,render:(Oe,$e)=>{const Ye=s==null?void 0:s[$e.coin],Je=Ye&&(Ye.tp||Ye.sl),ht=a instanceof Set?a.has($e.coin):!1,rt=f[$e.id];return Je?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[Ye.tp?wo(Ye.tp,0):"--"," /"," ",Ye.sl?wo(Ye.sl,0):"--"]}),i.jsx("button",{onClick:()=>y($e),className:"opacity-80 hover:opacity-100 bg-transparent p-0",children:"✎"})]}):ht?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"})}):rt&&(rt.tp||rt.sl)?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[rt.tp?wo(rt.tp,0):"--"," /"," ",rt.sl?wo(rt.sl,0):"--"]}),i.jsx("button",{onClick:()=>y($e),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($e),className:"text-[#CFCFCF] underline underline-offset-4 decoration-dotted hover:text-white p-0 bg-transparent",children:"-- / -- ✎"})})}}],[F,n,f,s,a,t,de,ne]),he=g?((xe=s==null?void 0:s[g.coin])==null?void 0:xe.tp)??((Se=f[g.id])==null?void 0:Se.tp)??null:null,_e=g?((ge=s==null?void 0:s[g.coin])==null?void 0:ge.sl)??((Ce=f[g.id])==null?void 0:Ce.sl)??null:null;return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:u1(u,"positions",d),columns:oe,rowHeight:30,listHeight:e,tableClassName:"mt-2 font-inter",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:je=>`border-b border-[#1E1E1E] bg-transparent !rounded-none ${P===je.id?"bg-[#0d0d0d]":""}`,cellClassName:()=>"py-1 flex min-w-0 !text-[11px] font-normal",rowKey:je=>je.id,onRowClick:je=>M(je.id),emptyRenderer:()=>i.jsx("div",{className:"flex items-center justify-center h-[200px] text-[#9B9B9B] text-sm",children:"No open positions"})}),i.jsx(Vxn,{open:!!g,onClose:()=>y(null),row:g,initialTp:he,initialSl:_e,onSubmit:W}),i.jsx(zxn,{open:$&&!!F,onClose:()=>L(!1),row:F,initialTab:z,onConfirm:ne,busy:K}),i.jsx(Hxn,{open:se&&!!F,onClose:()=>ee(!1),row:F,onConfirm:je=>{ee(!1),console.log("REVERSE CONFIRM",je)}}),i.jsx(nI,{open:v,setOpen:C,data:N,setTradeInfo:I})]})}async function dje(t){const e=lI({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return vj({address:t,signer:e,dex:""})}function Fse(t,e=2,n=!0){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:n?0:e,maximumFractionDigits:e})}function Gxn(t,e=2){return`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})} USDC`}function Kxn(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 Yxn(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 Xxn({open:t,onClose:e,children:n,title:r}){return t?i.jsxs("div",{className:"fixed inset-0 z-[999] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[1px]",onClick:e}),i.jsxs("div",{className:"relative z-[1000] w-[760px] max-w-[95vw] rounded-2xl border border-[#262626] bg-[#141414] p-6 shadow-2xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("div",{className:"text-white font-semibold",children:r}),i.jsx("button",{onClick:e,className:"rounded-md px-2 py-1 text-[#9B9B9B] hover:bg-[#1F1F1F] hover:text-white",children:"×"})]}),n]})]}):null}function Qxn(t){return typeof(t==null?void 0:t.type)=="string"&&t.type.toLowerCase()==="limit"}function Zxn(t){return typeof t=="string"&&t.toLowerCase().includes("stop")}function Jxn(t){return typeof t=="string"&&t.toLowerCase().includes("take profit")}function egn(t){return t==="B"?"Long":"Short"}function tgn(t){return t==="B"?"Short":"Long"}function T7({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 qF({title:t,order:e,parentRawSide:n}){const r=!!e,s=r?e.side?egn(e.side):tgn(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(T7,{k:"Order Type",v:e.orderType||"--"}),i.jsx(T7,{k:"Side",v:s}),i.jsx(T7,{k:"Amount",v:`${e.sz}`}),i.jsx(T7,{k:"Trigger",v:e.triggerCondition&&e.triggerCondition!=="N/A"?e.triggerCondition:"N/A"}),i.jsx(T7,{k:"Price",v:a?`$${Fse(e.limitPx,3)}`:"Market"})]}):i.jsx("div",{className:"text-[#9B9B9B]",children:"—"})]})}function ngn({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(f2,{size:12,color:"#FFF"})}):null]})});return i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:s,className:"w-[120px] min-w-0 h-8 px-2 rounded-lg border border-[#2A2A2A] bg-[#161616] text-[#CFCFCF] text-xs flex items-center justify-between overflow-hidden",onClick:c=>{c.stopPropagation(),r(u=>!u)},title:"Cancel menu",children:[i.jsx("span",{className:"truncate",children:"Cancel"}),i.jsx("span",{className:"opacity-70 ml-2",children:"▾"})]}),n&&_a.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 rgn({walletAddress:t,listHeight:e=560,onCancelOrder:n,onBulkCancel:r}){const{rows:s,loading:a}=tfe(t),[o,l]=h.useState(!1),[c,u]=h.useState(null),[d,f]=h.useState(null),[x,g]=h.useState(null),{key:y}=B2(),[v,C]=h.useState(new Set),[N,I]=h.useState(!1),P=W=>v.has(W),M=W=>C(ne=>new Set([...ne,W])),F=W=>C(ne=>{const oe=new Set(ne);return oe.delete(W),oe}),$=h.useCallback(async W=>{await(await dje(t)).cancelOrder({symbol:W.coin,oid:W.oid})},[t]),L=h.useCallback(async W=>{await(await dje(t)).cancelOrdersFiltered({filter:W})},[t]),z={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},Q=W=>z[W]||W,se=n??$,ee=r??L,K=h.useCallback(async W=>{const ne=W.oid;if(!P(ne)){M(ne);try{await dn.promise(Promise.resolve(se(W)),{loading:`Cancelling: ${W.coin} #${ne}...`,success:`Cancelled: ${W.coin} #${ne}`,error:oe=>`Cancel failed: ${W.coin} #${ne} • ${(oe==null?void 0:oe.message)||oe}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{F(ne)}}},[se,v]),re=W=>W==="all"?"All orders":W==="limit"?"Limit orders":W==="tpsl"?"TP/SL orders":W==="reduceOnly"?"ReduceOnly orders":W==="nonReduce"?"Non-Reduce orders":W,de=h.useCallback(async W=>{if(W){I(!0);try{await dn.promise(Promise.resolve(ee(W)),{loading:`Bulk cancelling: ${re(W)}...`,success:`Bulk cancelled: ${re(W)}`,error:ne=>`Bulk cancel failed: ${re(W)} • ${(ne==null?void 0:ne.message)||ne}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{I(!1)}}},[ee]),G=h.useCallback(W=>{const ne=Array.isArray(W==null?void 0:W.children)?W.children:[],oe=ne.find(_e=>Jxn(_e.orderType))||null,he=ne.find(_e=>Zxn(_e.orderType))||null;u({orderType:W.type,coin:W.coin,side:W.sideRaw,sz:W.size,limitPx:W.limitPx,triggerCondition:W.triggerCondition,timestamp:W.timestamp}),f(he||oe||null),g(oe&&he?oe:null),l(!0)},[]),ie=h.useMemo(()=>[{key:"timestamp",label:"Time",sortable:!0,width:"140px",sortValue:W=>W.timestamp,render:W=>i.jsx("span",{className:"text-white",children:Kxn(W)})},{key:"type",label:"Type",sortable:!0,width:"120px",sortValue:W=>W.type||"",render:(W,ne)=>i.jsx("span",{className:"text-white",children:ne.type||"--"})},{key:"coin",label:"Coin",sortable:!0,sortValue:W=>W.coin||"",render:(W,ne)=>{const oe=(ne.side==="B",ne.reduceOnly?"text-[#FF797C]":"text-[#67FFBD]"),he=Ao(),_e=()=>he(`/terminal/hyperliquid/${ne.coin}`);return i.jsxs("div",{onPointerDown:_e,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Q(ne.coin)}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:ne.coin}),i.jsx("span",{className:oe,children:ne.coin.replace("xyz:","")||"--"})]})}},{key:"side",label:"Direction",sortable:!0,sortValue:W=>W.side==="B"?1:0,render:(W,ne)=>{const oe=Yxn(ne),he=ne.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 ${he?"text-[#FF797C] bg-[#FF797C]/20":"text-[#67FFBD] bg-[#67FFBD]/20"}`,children:oe})}},{key:"size",label:"Size",sortable:!0,sortValue:W=>W.size,render:W=>i.jsx("span",{className:"text-white font-semibold",children:W})},{key:"originalSize",label:"Original Size",sortable:!0,sortValue:W=>Math.abs(W.originalSize),render:W=>i.jsx("span",{className:"text-white font-semibold",children:W})},{key:"orderValue",label:"Order value",sortable:!0,sortValue:W=>Math.abs(W.orderValue),render:W=>i.jsx("span",{className:"text-white font-semibold",children:Gxn(W,2)})},{key:"price",label:"Price",sortable:!0,sortValue:W=>W.limitPx,render:(W,ne)=>{if(ne.price==="Market")return i.jsx("span",{className:"text-white font-semibold",children:"Market"});const oe=typeof ne.pxDecimals=="number"?ne.pxDecimals:3;return i.jsx("span",{className:"text-white font-semibold",children:Fse(ne.limitPx,oe)})}},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:W=>W.reduceOnly?1:0,render:W=>i.jsx("span",{className:"text-white font-semibold",children:W?"Yes":"No"})},{key:"triggerCondition",label:"Trigger",sortable:!0,sortValue:W=>W.triggerPx||0,width:"140px",render:(W,ne)=>ne.triggerPx&&ne.triggerPx!=="N/A"?i.jsx("span",{className:"text-white font-semibold",children:ne.type==="Stop Market"?`Price Below ${ne.triggerPx}`:ne.type==="Take Profit Market"?`Price Above ${ne.triggerPx}`:ne.triggerPx}):i.jsx("span",{children:"N/A"})},{key:"tp_sl",label:"TP/SL",sortable:!1,render:(W,ne)=>{const oe=Array.isArray(ne.children)&&ne.children.length>0;return Qxn(ne)&&oe?i.jsx("button",{onClick:he=>{he.stopPropagation(),G(ne)},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(ngn,{onBulkCancel:de,busy:N}),sortable:!1,render:(W,ne)=>{const oe=P(ne.oid);return i.jsx("button",{onClick:he=>{he.stopPropagation(),oe||K(ne)},disabled:oe,className:`h-6 w-6 flex items-center justify-center rounded-md border text-[#FF797C] transition-all duration-200 p-1 text-[11px] ${oe?"opacity-60 cursor-not-allowed border-red-500/30 bg-red-500/10":"border-[#2A2A2A] bg-red-500/20 hover:bg-red-500/30 border-red-500/50 hover:bg-[#2A0F12]"}`,title:oe?"Cancelling...":"Cancel order",children:oe?i.jsx(f2,{size:12,color:"#FF797C"}):"×"})}}],[G,K,de,N,v]),ae=(d?1:0)+(x?1:0),q=c?`${c.coin} • TP/SL for Limit @ ${Fse(c.limitPx,3)}`:"Take Profit / Stop Loss";return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:u1(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:W=>W.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No open orders"})}),i.jsxs(Xxn,{open:o,onClose:()=>l(!1),title:q,children:[i.jsx("div",{className:"text-center text-[14px] text-[#9B9B9B] mb-4",children:ae===2?"If order A is filled, orders B and C will be placed":"If order A is filled, order B will be placed"}),i.jsxs("div",{className:"flex flex-col items-stretch gap-6",children:[i.jsxs("div",{className:"mx-auto",children:[i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"Order A"}),i.jsx("div",{className:"w-[360px]",children:i.jsx(qF,{title:"",order:c,parentRawSide:c==null?void 0:c.side})})]}),i.jsx("div",{className:"relative mx-auto h-10 w-px bg-[#2a2a2a]"}),ae===2?i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"If order B filled, cancel order C"}),i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"If order C filled, cancel order B"}),i.jsx(qF,{title:"Order B",order:d,parentRawSide:c==null?void 0:c.side}),i.jsx(qF,{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(qF,{title:"",order:d,parentRawSide:c==null?void 0:c.side})]})]})]})]})}async function sgn(t){const e=lI({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return vj({address:t,signer:e,dex:""})}const ign="wss://api.hyperliquid.xyz/ws",_qe="https://api.hyperliquid.xyz/info";function Lv(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function I7(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function qQ(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 GQ(t){return t?"Yes":"No"}function Eqe(t,e){const n=Number(e||0);return n?Number(t||0)/n:null}const KQ=new Map;function kqe(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(KQ.has(e)||KQ.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}),KQ.get(e)):null}function x5(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 jM(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 Tqe(t){if(t.booting||t.connected)return;t.booting=!0,jM(t);const e=new WebSocket(ign);t.ws=e,e.onopen=()=>{t.connected=!0,!t.hydratedActive&&t.activeRows.length===0&&(t.loadingActive=!0,x5(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=Eqe(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,x5(t)}}catch{}},e.onclose=()=>{jM(t),setTimeout(()=>Tqe(t),1500)},e.onerror=()=>{jM(t)},t.booting=!1}async function Iqe(t){try{t.loadingHistory=!0,x5(t);const n=await(await fetch(_qe,{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=Eqe(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,x5(t)}}function ogn(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 Pqe(t){try{t.loadingFills=!0,x5(t);const n=await(await fetch(_qe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userTwapSliceFills",user:t.key})})).json();t.fillRows=ogn(n||[])}catch{t.fillRows=[]}finally{t.loadingFills=!1,x5(t)}}function lgn(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=kqe(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}),Tqe(s),Iqe(s),Pqe(s),()=>{s.subs.delete(a),s.subs.size===0&&jM(s)}},[e]),n}function cgn(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 ugn(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 AM(t=""){const e=t.toLowerCase();return e.includes("long")||e==="buy"}function _M(t=""){const e=t.toLowerCase();return e.includes("short")||e==="sell"}function dgn(t=""){return AM(t)&&!_M(t)?3:AM(t)&&_M(t)?2:_M(t)&&!AM(t)?1:0}function fgn({walletAddress:t}){const{activeRows:e,historyRows:n,fillRows:r,loadingActive:s,loadingHistory:a,loadingFills:o,hydratedActive:l}=lgn(t),c=ugn(1e3),u=h.useMemo(()=>e.map(re=>({...re,runtimeMs:Math.max(0,c-Number(re.timestamp||0))})),[e,c]),{key:d}=B2(),[f,x]=h.useState(new Set),g=re=>f.has(re),y=re=>x(de=>new Set([...de,re])),v=re=>x(de=>{const G=new Set(de);return G.delete(re),G}),C=async re=>{const de=re.twapId??Number(re.id);if(!g(de)){y(de);try{const G=await sgn(t);await dn.promise(G.cancelTwapOrder({symbol:re.coin,twapId:de}),{loading:`Terminating: ${re.coin} #${de}...`,success:`Terminated: ${re.coin} #${de}`,error:ae=>`Terminate failed: ${re.coin} #${de} • ${(ae==null?void 0:ae.message)||ae}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}});const ie=kqe(t);if(ie){const ae=String(de);ie.activeRows=ie.activeRows.filter(q=>String(q.twapId??q.id)!==ae),ie.hydratedActive=!0,x5(ie),Iqe(ie),Pqe(ie)}}finally{v(de)}}},[N,I]=h.useState("active"),[P,M]=h.useState("active"),F=["active","history","fills"],$=F.indexOf(N)>F.indexOf(P)?"right":"left",L={enter:re=>({x:re==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:re=>({x:re==="right"?-24:24,opacity:0})};h.useEffect(()=>{const re=setInterval(()=>{},3e4);return()=>clearInterval(re)},[]);const z=(re,de,G)=>re?i.jsxs("div",{className:"px-3 py-6 flex items-center gap-2 text-[#9B9B9B]",children:[i.jsx(f2,{size:14,color:"#9B9B9B"}),i.jsx("span",{children:G})]}):i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:de}),Q=h.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:re=>re.coin||"",render:(re,de)=>{const G=de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=Ao(),ae=()=>ie(`/terminal/hyperliquid/${de.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${de.coin}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:de.coin}),i.jsx("span",{className:`font-bold ${G}`,children:re||"--"})]})}},{key:"sz",label:"Size",sortable:!0,sortValue:re=>re.sz,render:(re,de)=>{const G=de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return i.jsxs("span",{className:G,children:[Lv(re)," ",de.coin]})}},{key:"executedSz",label:"Executed Size",sortable:!0,sortValue:re=>re.executedSz,render:(re,de)=>{const G=de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return re&&Number(re)!==0?i.jsxs("span",{className:G,children:[Lv(re)," ",de.coin]}):i.jsx("span",{className:"text-[#9B9B9B]",children:"--"})}},{key:"avgPx",label:"Average Price",sortable:!0,sortValue:re=>re.avgPx||0,render:re=>re?i.jsx("span",{className:"text-white font-semibold",children:I7(re,0)}):"--"},{key:"runtime",label:"Running Time / Total",sortable:!0,sortValue:re=>re.runtimeMs??0,render:(re,de)=>(Math.max(0,Math.floor((Date.now()-de.timestamp)/6e4)),i.jsxs("span",{className:"text-white font-semibold",children:[cgn(de.runtimeMs??0)," / ",de.minutes," minutes"]}))},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:re=>re.reduceOnly?1:0,render:re=>i.jsx("span",{className:"text-white font-semibold",children:GQ(re)})},{key:"timestamp",label:"Creation Time",sortable:!0,sortValue:re=>re.timestamp,render:re=>i.jsx("span",{className:"text-white font-semibold",children:qQ(re)})},{key:"errors",label:"Errors",sortable:!1,render:re=>i.jsx("span",{className:"text-[#9B9B9B] font-semibold",children:re||"--"})},{key:"terminate",label:"Terminate",sortable:!1,render:(re,de)=>{const G=de.twapId??Number(de.id),ie=g(G);return i.jsx("button",{onClick:ae=>{ae.stopPropagation(),ie||C(de)},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(f2,{size:12,color:"#FF797C"}):"×"})}}],[f,t]),se=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:re=>re.time,render:re=>i.jsx("span",{className:"text-white font-semibold",children:qQ(re)})},{key:"coin",label:"Coin",sortable:!0,sortValue:re=>re.coin||"",render:(re,de)=>{const G=de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=Ao(),ae=()=>ie(`/terminal/hyperliquid/${de.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${de.coin}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:de.coin}),i.jsx("span",{className:`font-bold ${G}`,children:re||"--"})]})}},{key:"totalSz",label:"Total Size",sortable:!0,sortValue:re=>re.totalSz,render:(re,de)=>i.jsxs("span",{className:de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",children:[Lv(re)," ",de.coin]})},{key:"executedSz",label:"Executed Size",sortable:!0,sortValue:re=>re.executedSz,render:(re,de)=>i.jsxs("span",{className:de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",children:[Lv(re)," ",de.coin]})},{key:"avgPx",label:"Average Price",sortable:!0,sortValue:re=>re.avgPx||0,render:re=>re?i.jsx("span",{className:"text-white font-semibold",children:I7(re,0)}):"--"},{key:"totalMinutes",label:"Total Runtime",sortable:!0,sortValue:re=>re.totalMinutes,render:re=>i.jsxs("span",{className:"text-white font-semibold",children:[Lv(re,0)," minutes"]})},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:re=>re.reduceOnly?1:0,render:re=>i.jsx("span",{className:"text-white font-semibold",children:GQ(re)})},{key:"randomize",label:"Randomize",sortable:!0,sortValue:re=>re.randomize?1:0,render:re=>i.jsx("span",{className:"text-white font-semibold",children:GQ(re)})},{key:"status",label:"Status",sortable:!0,sortValue:re=>re.status||"",render:re=>i.jsx("span",{className:"text-white font-semibold",children:re||"--"})}],[]),ee=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:re=>re.time,render:(re,de)=>i.jsx("span",{className:"text-white font-semibold",children:qQ(de.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:re=>re.coin||"",render:(re,de)=>{const G=de.side==="A"||de.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",ie=Ao(),ae=()=>ie(`/terminal/hyperliquid/${de.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${de.coin}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:de.coin}),i.jsx("span",{className:`font-bold ${G}`,children:re||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:re=>dgn(re.dir),render:re=>i.jsx("span",{className:`${_M(re)?"text-[#FF6B6B]":AM(re)?"text-[#67FFBD]":"text-white"}`,children:re||"--"})},{key:"px",label:"Price",sortable:!0,sortValue:re=>re.px,render:re=>re!=null?i.jsxs("span",{className:"text-white font-semibold",children:["$",I7(re,0)]}):"--"},{key:"sz",label:"Size",sortable:!0,sortValue:re=>re.sz,render:re=>i.jsx("span",{className:"text-white font-semibold",children:Lv(re)})},{key:"tradeValue",label:"Trade Value",sortable:!0,sortValue:re=>re.px*re.sz,render:(re,de)=>de.px&&de.sz?i.jsxs("span",{className:"text-white font-semibold",children:["$",I7(de.px*de.sz)]}):"--"},{key:"fee",label:"Fee",sortable:!0,sortValue:re=>re.fee,render:re=>i.jsx("span",{className:"text-white font-semibold",children:Lv(re)})},{key:"closedPnl",label:"Closed PnL",sortable:!0,sortValue:re=>re.closedPnl-re.fee,render:(re,de)=>{const G=Number(de.closedPnl||0)-Number(de.fee||0),ie=G>0,ae=G<0;return i.jsxs("span",{className:`${ie?"text-[#67FFBD] font-semibold":ae?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:["$",I7(Math.abs(G))]})}},{key:"oid",label:"Order ID",sortable:!0,sortValue:re=>re.oid,render:re=>i.jsx("span",{className:"text-[#979797] font-semibold",children:re||"--"})}],[]),K=i.jsx("div",{className:"px-3",children:i.jsx("div",{className:"relative flex gap-2 overflow-x-auto whitespace-nowrap py-2",children:[{k:"active",t:"Active"},{k:"history",t:"History"},{k:"fills",t:"Fill History"}].map(re=>{const de=N===re.k;return i.jsxs("button",{onClick:()=>{M(N),I(re.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 ${de?"text-white":"text-[#929292] hover:text-white"}`,children:[de&&i.jsx(ho.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:re.t})]},re.k)})})});return i.jsxs("div",{className:"flex flex-col h-full",children:[K,i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(sI,{mode:"wait",custom:$,children:i.jsx(ho.div,{custom:$,variants:L,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:320,damping:28},className:"absolute inset-0",children:N==="active"?i.jsx(zu,{data:u1(u,"twap",d),loading:s||!l,columns: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:re=>re.id,emptyState:z(s||!l,"No Active TWAP","Loading Active TWAP…")}):N==="history"?i.jsx(zu,{data:u1(n,"twap",d),loading:a,columns:se,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:re=>re.id,emptyState:z(a,"No TWAP History","Loading TWAP History…")}):i.jsx(zu,{data:u1(r,"twap",d),loading:o,columns:ee,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:re=>re.id,emptyState:z(o,"No TWAP fills available","Loading TWAP fills…")})},N)})})]})}const hgn="wss://api.hyperliquid.xyz/ws",pgn="https://api-ui.hyperliquid.xyz/info",mgn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},xgn=t=>mgn[t]||t;function ggn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function P7(t,e=2){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function Ose(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Mse(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function bgn(t){return Ose(t)?1:Mse(t)?0:-1}function ygn(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 vgn(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 YQ=new Map;function wgn(t,e=!0){const n=(t==null?void 0:t.toLowerCase())||"";if(!n)return null;YQ.has(n)||YQ.set(n,{key:n,rows:[],loading:!0,ws:null,ping:null,subs:new Set,booting:!1,connected:!1,hydrated:!1,aggregateByTime:e});const r=YQ.get(n);return r.aggregateByTime=e,r}function Rse(t){t.subs.forEach(e=>e({rows:t.rows,loading:t.loading}))}function EM(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 Fqe(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 Cgn(t){try{t.loading=!0,Rse(t);const n=await(await fetch(pgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({aggregateByTime:!!t.aggregateByTime,type:"userFills",user:t.key})})).json();t.rows=Fqe(n||[]),t.hydrated=!0}catch{t.rows=[]}finally{t.loading=!1,Rse(t)}}function fje(t,e){const n=(e==null?void 0:e.fills)||e||[];if(!Array.isArray(n)||!n.length)return;const r=Fqe(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,Rse(t)}async function Oqe(t){if(t.booting||t.connected)return;t.booting=!0,EM(t);const e=new WebSocket(hgn);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"&&fje(t,a==null?void 0:a.data),(a==null?void 0:a.channel)==="user"&&((r=a==null?void 0:a.data)!=null&&r.fills)&&fje(t,(s=a==null?void 0:a.data)==null?void 0:s.fills)}catch{}},e.onclose=()=>{EM(t),setTimeout(()=>Oqe(t),1500)},e.onerror=()=>{EM(t)},t.booting=!1}function Sgn(t,e){const n=(t==null?void 0:t.toLowerCase())||"",[r,s]=h.useState({rows:[],loading:!0});return h.useEffect(()=>{const a=wgn(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}),Cgn(a),Oqe(a),()=>{a.subs.delete(o),a.subs.size===0&&EM(a)}},[n,e]),r}function Ngn({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}=Sgn(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}=B2(),{isReferralCodeName:d}=h.useContext(Yr),[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),N=h.useCallback(async M=>{const F=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,$=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;if(!F||!$||!M||M.length===0)return null;try{const{data:L}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:F,token:$,position_oids:M},{headers:{"Content-Type":"application/json"}});if(L&&L.success){const z=parseFloat(L.leverage);return C(Q=>{const se=new Map(Q);return M.forEach(ee=>se.set(String(ee),z)),se}),z}}catch(L){console.error("leverage fetch error:",L)}return null},[]);h.useEffect(()=>{if(f&&!g.referral){const M=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";M&&y(F=>({...F,referral:M}))}},[f,d,g.referral]);const I=h.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:M=>M.time,render:(M,F)=>i.jsx("button",{onClick:()=>l($=>$==="date"?"relative":"date"),className:"text-left text-white bg-transparent font-semibold",children:c.current==="date"?vgn(F.time):ygn(F.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:M=>M.coin||"",render:(M,F)=>{const $=Ao(),L=()=>$(`/terminal/hyperliquid/${F.coin}`);return i.jsxs("div",{onPointerDown:L,className:"flex items-center text-white font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${xgn(F.coin)}.svg`,onError:Qi,className:"w-5 h-5 mr-2",alt:F.coin}),i.jsx("span",{className:`font-bold ${Mse(F.dir)?"text-[#FF6B6B]":Ose(F.dir)?"text-[#67FFBD]":"text-white"}`,children:M||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:M=>bgn(M.dir),render:M=>i.jsx("span",{className:`font-semibold ${Mse(M)?"text-[#FF6B6B]":Ose(M)?"text-[#67FFBD]":"text-white"}`,children:M||"--"})},{key:"px",label:"Price",sortable:!0,sortValue:M=>M.px,render:M=>i.jsx("span",{className:"text-white font-semibold",children:P7(M)})},{key:"sz",label:"Size",sortable:!0,sortValue:M=>M.sz,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[ggn(M)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.coin})]})},{key:"tradeValue",label:"Trade Value",sortable:!0,sortValue:M=>M.px*M.sz,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[P7(F.px*F.sz)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]})},{key:"fee",label:"Fee",sortable:!0,sortValue:M=>M.fee,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[P7(M)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.feeToken||"USDC"})]})},{key:"netPnl",label:"Closed PnL",sortable:!0,sortValue:M=>M.closedPnl-M.fee,render:(M,F)=>{const $=Number(F.closedPnl||0),L=Number(F.fee||0),z=$-L,Q=z>0,se=z<0,ee=!!$,K=Number(F.px||0)*Number(F.sz||0),re=K>0?z/K*100:0;return i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:`${Q?"text-[#67FFBD] font-semibold":se?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:[z===0?P7(0):`${z<0?"-":""}${P7(Math.abs(z))}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]}),ee&&i.jsx("button",{onClick:async()=>{const de=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";let G=0;const ie=F.oid;if(ie){const ae=v.get(String(ie));if(ae!=null)G=ae;else{const q=await N([ie]);typeof q=="number"&&!Number.isNaN(q)&&(G=q)}}y({coin:F.coin||"",type:(F.dir||"").toUpperCase(),leverage:G,roe:re,entryPrice:Number(F.px||0),markPrice:Number(F.px||0),referral:de,positionDistribution:0,pnl:Number(z||0),closePx:Number(F.px||0)}),x(!0)},className:"flex items-center h-6 text-[#67FFBD] text-[11px] font-semibold bg-transparent p-0",title:"Share",children:i.jsx("img",{src:jm,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}}],[o,d,N,v]),P=h.useMemo(()=>u1(s,"trades",u),[s,u]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center justify-end mt-2 px-1 mr-5",children:i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-[#9B9B9B]",children:[i.jsx("span",{children:"Aggregate"}),i.jsx("input",{type:"checkbox",checked:n,onChange:M=>r(M.target.checked),className:"w-3 h-3 accent-[#67FFBD]"})]})}),i.jsx(zu,{data:P,loading:a,columns:I,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:M=>M.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No trades"})}),i.jsx(nI,{open:f,setOpen:x,data:g,setTradeInfo:y,pnlTitle:""})]})}const jgn="https://api.hyperliquid.xyz/info";function Agn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function hje(t,e=4){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function _gn(t){return`${(Number(t||0)*100).toLocaleString(void 0,{maximumFractionDigits:6})}%`}function Egn(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 kgn(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 Tgn({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}=B2(),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(jgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFunding",user:t,startTime:y})})).json(),I=(Array.isArray(C)?C:Array.isArray(C==null?void 0:C.data)?C.data:[]).map((P,M)=>{const F=(P==null?void 0:P.delta)||{},$=Number((F==null?void 0:F.szi)||0),L=Number((F==null?void 0:F.fundingRate)||0),z=Number((F==null?void 0:F.usdc)||0);let Q=$>0?"Long":$<0?"Short":null;return!Q&&L!==0&&z!==0&&(Q=L>0?z<0?"Long":"Short":z<0?"Short":"Long"),Q||(Q="Flat"),{id:`${P.time||M}-${F.coin||""}-${M}`,time:Number((P==null?void 0:P.time)||0),coin:(F==null?void 0:F.coin)||"",rate:Number((F==null?void 0:F.fundingRate)||0),size:$,amount:z,token:"USDC",side:Q}}).sort((P,M)=>M.time-P.time);x&&s(I)}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"?kgn(g.time):Egn(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=Ao(),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:Qi,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:[Agn(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?hje(0):`${x<0?"-":""}${hje(Math.abs(x))}`})}},{key:"rate",label:"Rate",sortable:!0,sortValue:x=>x.rate,render:x=>i.jsx("span",{className:"text-white font-semibold",children:_gn(x)})}],[]);return i.jsx(zu,{data:u1(r,"funding",u),loading:a,columns:f,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:x=>x.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No funding records"})})}function GF(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function Ign(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 Pgn(t){return t.side==="B"?t.reduceOnly?"Close Short":"Open Long":t.side==="A"?t.reduceOnly?"Close Long":"Open Short":t.side||"-"}function Lse(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Dse(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function Fgn(t){return Lse(t)?1:Dse(t)?0:-1}function Ogn({walletAddress:t,listHeight:e=560}){const[n,r]=h.useState([]),[s,a]=h.useState(!1),{key:o}=B2();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:Pgn(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":`${GF(Number(y.limitPx||0),2)} USD`,reduceOnly:!!y.reduceOnly,trigger:y.triggerCondition&&y.triggerCondition!=="N/A"?`${y.triggerCondition} @ ${GF(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:Ign(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=Ao(),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:Qi,className:"w-5 h-5 mr-2",alt:u.coin}),i.jsx("span",{className:`font-bold ${Dse(u.sideText)?"text-[#FF6B6B]":Lse(u.sideText)?"text-[#67FFBD]":"text-white"}`,children:c})]})}},{key:"sideText",label:"Side",sortable:!0,sortValue:c=>Fgn(c.sideText),render:c=>i.jsx("span",{className:`font-semibold ${Dse(c)?"text-[#FF6B6B]":Lse(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:GF(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:GF(c)}):i.jsx("span",{className:"text-white font-semibold",children:"--"})},{key:"orderValue",label:"Order Value",sortable:!0,sortValue:c=>c.orderValue,render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"priceLabel",label:"Price",sortable:!0,sortValue:c=>c.priceLabel==="Market"?-1:Number(String(c.priceLabel).replace(/[^0-9.]/g,"")),render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:c=>c.reduceOnly?1:0,render:c=>i.jsx("span",{className:"text-whitefont-semibold",children:c?"✓":"–"})},{key:"trigger",label:"Trigger",sortable:!0,sortValue:c=>c.trigger||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c||"N/A"})},{key:"status",label:"Status",sortable:!0,sortValue:c=>c.status||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"orderId",label:"Order ID",sortable:!0,sortValue:c=>c.trigger||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})}],[]);return i.jsx(zu,{data:u1(n,"orderHistory",o),columns:l,loading:s,skeletonRowCount:12,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:c=>c.id})}const Mgn="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/list/",Rgn="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",Lgn="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",Dgn="https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/update/";function pje(t,e=4){const n=Number(t||0);return Number.isFinite(n)?n.toLocaleString(void 0,{maximumFractionDigits:e}):"--"}function Bgn(t,e=2){const n=Number(t||0);return Number.isFinite(n)?`$${n.toLocaleString(void 0,{maximumFractionDigits:e})}`:"--"}const $gn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},F7=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 $gn[t]||t},Ugn=t=>t&&t.length>10?`${t.slice(0,6)}...${t.slice(-4)}`:t||"--";function kM({walletAddress:t,sourceMarket:e="hyper"}){var $,L;const{botSlotsInfo:n,refreshBotSlots:r}=h.useContext(Yr)||{},[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=Ao();h.useEffect(()=>{let z=!0;async function Q(){if(typeof window>"u")return;const se=window.localStorage.getItem("hyperAddress"),ee=window.localStorage.getItem("hyperToken");if(!se||!ee){z&&(a([]),l(!1));return}try{l(!0);const re=await(await fetch(Mgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:se,token:ee})})).json(),G=(Array.isArray(re==null?void 0:re.data)?re.data:Array.isArray(re)?re:[]).filter(ie=>e?ie.source_market===e:!0);z&&a(G)}catch{z&&(a([]),dn.error("Failed to load bots"))}finally{z&&l(!1)}}return Q(),()=>{z=!1}},[t,e,d]),h.useEffect(()=>{const z=Q=>{const se=Q&&Q.detail&&Q.detail.sourceMarket;se&&se!==e||f(ee=>ee+1)};return window.addEventListener("gridbotUpdated",z),()=>{window.removeEventListener("gridbotUpdated",z)}},[e]);const v=h.useMemo(()=>{const z=s.map(Q=>{const se=Q.bot_params||{},ee=se.investment||{},K=se.priceRange||{},re=se.liquidationPrices||{},de=se.direction==="long"?"Long":se.direction==="short"?"Short":"--";return{id:Q.id,coin:Q.coin||se.symbol||"--",market:Q.source_market||"",status:Q.is_deleted?"Stopped":"Active",side:de,gridType:se.gridType||"--",gridCount:se.gridCount??"--",lower:K.lower??null,upper:K.upper??null,currentPrice:se.currentPrice??null,leverage:ee.leverage??null,collateral:ee.collateral??null,totalInvestment:ee.totalInvestment??null,liqLong:re.long??null,liqShort:re.short??null,trailingUp:se.trailing_up??null,trailingDown:se.trailing_down??null,slUp:se.sl_up??null,slDown:se.sl_down??null,timestamp:se.timestamp||null,walletName:Q.wm_name||null,walletAddress:Q.wm_address||null,walletId:Q.wallet_id??null,raw:Q}});return z.sort((Q,se)=>{const ee=Q.status==="Active",K=se.status==="Active";if(ee!==K)return ee?-1:1;const re=Q.timestamp?new Date(Q.timestamp).getTime():0;return(se.timestamp?new Date(se.timestamp).getTime():0)-re}),z},[s]),C=async(z,Q)=>{var K,re,de;if(!z||!z.raw||typeof window>"u")return;const se=window.localStorage.getItem("hyperAddress"),ee=window.localStorage.getItem("hyperToken");if(!se||!ee){dn.error("Please sign in to manage bots");return}try{u(z.id);const G={is_deleted:Q,bot_params:z.raw.bot_params||{}},ie=String(((K=z.raw)==null?void 0:K.source_market)||"").toLowerCase().includes("lighter")?Lgn:String(((re=z.raw)==null?void 0:re.source_market)||"").toLowerCase().includes("extended")?Dgn:Rgn,q=await(await fetch(ie,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:se,token:ee,bot_id:z.id,update_params:G})})).json().catch(()=>null);if(!(q!=null&&q.success)){const W=(q==null?void 0:q.error_message)||(q==null?void 0:q.message)||(q==null?void 0:q.detail)||"Failed to update bot";throw new Error(W)}dn.success(Q?"Bot stopped":"Bot started"),a(W=>W.map(ne=>ne.id===z.id?{...ne,is_deleted:Q}:ne)),r==null||r(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:((de=z.raw)==null?void 0:de.source_market)||e}})),f(W=>W+1)}catch(G){dn.error(G.message||"Failed to update bot")}finally{u(null)}},N=z=>{if(!z||!z.raw||typeof window>"u")return;const Q=z.status==="Active",se=(ee,K)=>{var ae,q,W,ne;const re=((ae=ee==null?void 0:ee.raw)==null?void 0:ae.wallet_id)??(ee==null?void 0:ee.walletId),de=((q=K==null?void 0:K.raw)==null?void 0:q.wallet_id)??(K==null?void 0:K.walletId);if(re&&de&&String(re)===String(de))return!0;const G=((ee==null?void 0:ee.walletAddress)||((W=ee==null?void 0:ee.raw)==null?void 0:W.wm_address)||"").toLowerCase(),ie=((K==null?void 0:K.walletAddress)||((ne=K==null?void 0:K.raw)==null?void 0:ne.wm_address)||"").toLowerCase();return!!(G&&ie&&G===ie)};if(!Q){if(v.some(K=>{var re,de;return K.id!==z.id&&K.status==="Active"&&((re=K.raw)==null?void 0:re.source_market)===((de=z.raw)==null?void 0:de.source_market)&&se(K,z)})){dn.error("You already have an active bot on this wallet. Please add an account.");return}g(z);return}C(z,Q)},I=()=>g(null),P=()=>{x&&(C(x,!1),g(null))},M=z=>{var re,de,G;if(!z)return;const Q=z.coin;if(!Q)return;const se=((re=z.raw)==null?void 0:re.source_market)||z.market||e,ee=z.status==="Active",K={sourceMarket:se,coin:Q,botParams:((de=z.raw)==null?void 0:de.bot_params)||{},walletId:(G=z.raw)==null?void 0:G.wallet_id,isActive:ee};if(typeof window<"u"){try{window.localStorage.setItem("gridbot:pending_selection",JSON.stringify(K))}catch{}window.dispatchEvent(new CustomEvent("gridbotSelectFromTasks",{detail:K}))}y(se==="hyper"?`/terminal/hyperliquid/${F7(Q)}#gridbot`:se==="lighter"?`/terminal/lighter/${F7(Q)}#gridbot`:`/terminal/extended/${F7(Q)}#gridbot`)},F=h.useMemo(()=>[{key:"status",label:"Status",sortable:!0,sortValue:z=>z.status==="Active"?1:0,render:z=>{const Q=z==="Active"?"text-[#67ffbd] bg-[#67ffbd]/15":"text-[#9B9B9B] bg-[#9B9B9B]/10";return i.jsx("span",{className:`inline-flex h-6 items-center justify-center px-2 py-[2px] rounded-md text-[11px] font-semibold ${Q}`,children:z})}},{key:"coin",label:"Coin",sortable:!0,sortValue:z=>z.coin||"",render:(z,Q)=>{var re;const se=Ao(),ee=String(((re=Q.raw)==null?void 0:re.source_market)||Q.market||e||"").toLowerCase();ee.includes("lighter")||ee.includes("extended");const K=()=>se(`/terminal/${ee}/${F7(Q.coin)}${Q.status==="Active"||Q.status==="Stopped"?"#gridbot":""}`);return i.jsxs("div",{onPointerDown:K,className:"flex items-center gap-2 text-white font-medium hover:opacity-80 cursor-pointer",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${F7(z)}.svg`,onError:Qi,className:"w-4 h-4",alt:z}),i.jsx("span",{children:z.replace("XYZ:","")||"--"})]})}},{key:"wallet",label:"Wallet",sortable:!0,sortValue:z=>z.walletName||z.walletAddress||"",render:(z,Q)=>{const se=Q.walletName||"Wallet",ee=Q.walletAddress?Ugn(Q.walletAddress):"--";return i.jsxs("div",{className:"flex flex-col leading-[14px]",children:[i.jsx("span",{className:"text-white font-medium",children:se}),i.jsx("span",{className:"text-[10px] text-white/60",children:ee})]})}},{key:"gridCount",label:"Grids",sortable:!0},{key:"lower",label:"Lower",sortable:!0,render:z=>z==null?"--":i.jsx("span",{className:"text-[#67FFBD] font-semibold",children:pje(z)})},{key:"upper",label:"Upper",sortable:!0,render:z=>z==null?"--":i.jsx("span",{className:"text-[#FF797C] font-semibold",children:pje(z)})},{key:"investment",label:"Investment",sortable:!0,sortValue:z=>z.totalInvestment??z.collateral??0,render:(z,Q)=>i.jsx("div",{className:"flex flex-col leading-[14px]",children:i.jsx("span",{className:"text-white font-semibold",children:Q.collateral!=null?Bgn(Q.collateral):"--"})})},{key:"leverage",label:"Lev",sortable:!0,render:z=>z==null?"--":`${z}x`},{key:"gridType",label:"Grid Type",sortable:!0},{key:"actions",label:"Actions",render:(z,Q)=>{const se=Q.status==="Active",ee=c===Q.id;return i.jsxs("div",{className:"relative z-10 flex items-center justify-start gap-2",onClick:K=>K.stopPropagation(),onMouseDown:K=>K.stopPropagation(),children:[i.jsx("button",{type:"button",onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),M(Q)},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:ee,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),N(Q)},className:`h-6 flex justify-center items-center px-3 rounded-md text-[11px] font-semibold ${se?"bg-[#2a1616] text-[#ff797c] hover:bg-[#3a1c1c]":"bg-[#101613] text-[#67ffbd] hover:bg-[#19201b]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:ee?"Saving...":se?"Stop":"Start"})]})}}],[c]);return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:v,loading:o,columns:F,rowHeight:32,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent",cellClassName:()=>"py-1 text-[11px] font-normal",rowKey:z=>z.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No bots for this market"})}),i.jsx(yp,{isOpen:!!x,onClose:I,children:i.jsxs("div",{className:"w-[320px] sm:w-[380px] rounded-2xl bg-[#050505] px-6 py-5 text-[#E5E7EB]",onClick:z=>z.stopPropagation(),children:[i.jsxs("div",{className:"text-sm font-semibold text-white",children:["Start"," ",String((($=x==null?void 0:x.raw)==null?void 0:$.source_market)||"").toLowerCase().includes("lighter")?"Lighter":String(((L=x==null?void 0:x.raw)==null?void 0:L.source_market)||"").toLowerCase().includes("extended")?"Extended":"Hyperliquid"," ","Grid Bot?"]}),i.jsxs("p",{className:"mt-3 text-[13px] text-[#9B9B9B]",children:["You are starting the"," ",i.jsx("span",{className:"text-white font-bold",children:x==null?void 0:x.coin})," ","grid bot. Make sure your parameters are correct."]}),i.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:I,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:P,className:"h-9 rounded-xl bg-[#67FFBD] px-4 text-[12px] font-semibold text-black transition hover:brightness-105",children:"Start Bot"})]})]})})]})}function zgn(){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 Hgn(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(Yr),[y,v]=h.useState(()=>typeof window>"u"?d||null:window.localStorage.getItem("hl_selected_wallet_address")||d||null);h.useEffect(()=>{const he=()=>{if(typeof window>"u"){v(d||null);return}const _e=window.localStorage.getItem("hl_selected_wallet_address");v(_e||d||null)};return he(),window.addEventListener("hl_selected_wallet_changed",he),window.addEventListener("storage",he),()=>{window.removeEventListener("hl_selected_wallet_changed",he),window.removeEventListener("storage",he)}},[d]);const C=y||d||null,[N,I]=h.useState(()=>C);h.useEffect(()=>{C&&I(C)},[C]);const P=C||N||null,[M,F]=h.useState({address:null,token:null}),[$,L]=h.useState(!1);h.useEffect(()=>{const he=()=>{const _e=typeof window<"u"?localStorage.getItem("hyperAddress"):null,xe=typeof window<"u"?localStorage.getItem("hyperToken"):null;F({address:_e,token:xe}),L(!0)};return he(),window.addEventListener("localStorageUpdated",he),window.addEventListener("storage",he),()=>{window.removeEventListener("localStorageUpdated",he),window.removeEventListener("storage",he)}},[]);const z=!!(M.address&&M.token),Q=he=>he==="balances"?"Connect your wallet to see your balances":he==="positions"?"Connect your wallet to see your positions":he==="open"?"Connect your wallet to see your open orders":he==="twap"?"Connect your wallet to see your TWAP orders":he==="trades"?"Connect your wallet to see your trade history":he==="funding"?"Connect your wallet to see your funding history":he==="orders"?"Connect your wallet to see your order history":"Connect your wallet to continue",se=(he,_e)=>$?z?he: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:Q(_e)}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>g(!0)})})]}):he,K=`terminalTabs:${typeof window<"u"?window.location.pathname:"tt"}`,[re,de]=h.useState(()=>typeof window>"u"?"balances":localStorage.getItem(K)||"balances"),G=fqe(P),ie=xmn(P),ae=[{k:"balances",t:"Balances"},{k:"positions",t:`Positions${z&&Number.isFinite(G)?` (${G})`:""}`},{k:"open",t:`Open Orders${z&&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(()=>{ae.map(_e=>_e.k).includes(re)||de("balances")},[ae,re]),h.useEffect(()=>{typeof window<"u"&&localStorage.setItem(K,re)},[re,K]),h.useEffect(()=>{const he=_e=>{var ge;const xe=(ge=_e==null?void 0:_e.detail)==null?void 0:ge.tab,Se=ae.map(Ce=>Ce.k);xe&&Se.includes(xe)&&de(xe)};return window.addEventListener("terminal:setTab",he),()=>window.removeEventListener("terminal:setTab",he)},[ae]);const q=he=>{de(he)},W=(P||"no-wallet").toLowerCase();let ne;re==="balances"?ne=i.jsx(Dxn,{walletAddress:P}):re==="positions"?ne=i.jsx(qxn,{walletAddress:P,coin:f}):re==="open"?ne=i.jsx(rgn,{walletAddress:P}):re==="twap"?ne=i.jsx(fgn,{walletAddress:P}):re==="trades"?ne=i.jsx(Ngn,{walletAddress:P}):re==="funding"?ne=i.jsx(Tgn,{walletAddress:P}):re==="orders"?ne=i.jsx(Ogn,{walletAddress:P}):re==="bots"?ne=i.jsx(kM,{walletAddress:P,sourceMarket:x}):re==="all"?ne=i.jsx(vxn,{data:e,loading:n,error:r,isDigits:s,period:a,periods:o,handlePeriodChange:l}):ne=i.jsx("div",{className:"h-full"});const oe=re==="all"?ne:se(ne,re);return i.jsx(xxn,{children:i.jsxs("div",{className:`bg-[#101010] rounded-2xl flex flex-col h-full ${u} overflow-hidden ${c}`,children:[i.jsx("div",{className:"px-3",children:i.jsxs("div",{className:"relative flex overflow-x-auto whitespace-nowrap pt-2 -mb-3",children:[ae.map(he=>{const _e=re===he.k;return i.jsxs("button",{onClick:()=>q(he.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 ${_e?"text-white":"text-[#929292] hover:text-white"}`,children:[_e&&i.jsx("span",{className:"absolute inset-0 rounded-lg bg-[#262626]"}),i.jsx("span",{className:"relative z-10",children:he.t})]},he.k)}),i.jsx("div",{className:"absolute right-3 top-2 hidden md:flex items-center gap-3",children:re==="balances"?i.jsx(zgn,{}):i.jsx(gxn,{})})]})}),i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0",children:oe})})]})},W)}function ife(){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),N=f>0?C*f:null;return{symbol:d.symbol,last:f,chg24:y,vol:v,funding:null,openInterest:N,marketId:d.market_id,priceDecimals:d.supported_price_decimals??d.price_decimals??6,sizeDecimals:d.supported_size_decimals??d.size_decimals??0,minBaseAmount:Number(d.min_base_amount??0),minQuoteAmount:Number(d.min_quote_amount??0),raw:d}});r||e(u)}catch{r||e([])}s=!1}}a();const o=setInterval(a,5e3);return()=>{r=!0,clearInterval(o),s=!1}},[]),t}const Vgn="https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended",Wgn="https://dextrabothypesocketv2.nftinit.io/",qgn='J5a5j28NeLpQbf"=h',Ggn=6e4,Kgn=t=>{if(t==null||t==="")return null;const e=Number(t);return Number.isFinite(e)?e:null},og=(...t)=>{for(const e of t){const n=Kgn(e);if(n!=null)return n}return null},Mqe=t=>String(t||"").trim().toUpperCase(),Ygn=t=>Mqe(t).replace(/-USD$/,"").replace(/\/USD$/,"");function Xgn(t,e){var N;if(!t||typeof t!="object")return null;const n=Mqe(t.value||t.symbol||t.market||t.coin||t.label),r=Ygn(t.label||t.assetName||t.uiName||n);if(!n&&!r)return null;const s=t.marketStats||{},a=og(s.lastPrice,s.markPrice,s.indexPrice,t.lastPrice,t.markPrice,t.last),o=og(s.markPrice,t.markPrice,s.lastPrice,t.lastPrice,a),l=og(t.volume,s.dailyVolume,t.vol),c=og(s.fundingRate,t.fundingRate,t.funding),u=og(s.openInterestBase,t.openInterestBase),d=og(s.openInterest,t.openInterestUsd,t.openInterest),f=og((N=t==null?void 0:t.tradingConfig)==null?void 0:N.maxLeverage,t.maxLeverage,t.leverage,t.max_leverage);let x=null;const g=og(s.dailyPriceChange,t.dailyPriceChange);if(g!=null&&a!=null){const I=a-g;I&&(x=g/I*100)}if(x==null){const I=og(s.dailyPriceChangePercentage,t.dailyPriceChangePercentage,t.change24hPct,t.chg24);I!=null&&(x=Math.abs(I)<=1?I*100:I)}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 Qgn(){for(const t of nf.subs)try{t(nf.rows)}catch{}}function Rqe(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 Lqe(t){const e=t.map((n,r)=>Xgn(n,r)).filter(n=>n&&n.symbol);return e.length?(nf.rows=e,Qgn(),!0):!1}function mje(t){const e=Rqe(t);return e.length?Lqe(e):!1}async function xje(){try{const e=await(await fetch(Vgn)).json(),n=Rqe(e);if(!n.length)return;Lqe(n)}catch{}}function Zgn(){if(!nf.started){nf.started=!0,xje(),nf.timer=setInterval(()=>{nf.socket&&nf.socket.connected||xje()},Ggn);try{const t=Dy(Wgn);nf.socket=t;const e=()=>{try{t.emit("extended_feed_subscribe",{password:qgn},r=>mje(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(mje(a))return}})}catch{}}}function afe(){const[t,e]=h.useState(nf.rows);return h.useEffect(()=>{Zgn();const n=r=>e(r);return nf.subs.add(n),nf.rows.length&&e(nf.rows),()=>{nf.subs.delete(n)}},[]),t}const Jgn=["arithmetic","geometric"];function e1n(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 gje({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 bje({coin:t,midPrice:e,selectedPrice:n,wallet:r,onLevelsChange:s}){const a=ife(),[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(""),[N,I]=h.useState("arithmetic"),[P,M]=h.useState(""),[F,$]=h.useState(0),[L,z]=h.useState(10),[Q,se]=h.useState(!1),[ee,K]=h.useState(!1),[re,de]=h.useState(!1),[G,ie]=h.useState(50),[ae,q]=h.useState([]),[W,ne]=h.useState(!1),[oe,he]=h.useState(0),[_e,xe]=h.useState(!1),[Se,ge]=h.useState(!1),[Ce,je]=h.useState(0),[Oe,$e]=h.useState(!1),[Ye,Je]=h.useState(0),[ht,rt]=h.useState(!1),[st,He]=h.useState(!0),[Ve,bt]=h.useState(!1),[xt,Qt]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),St=h.useRef(!1),{refreshBotSlots:on,botSlotsInfo:cn}=h.useContext(Yr),Vn=h.useCallback(async()=>{try{const k=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!k||!T){He(!1),bt(!0);return}const D=await vi(T.toLowerCase(),k);He(!!(D!=null&&D.farming_tools))}catch{He(!1)}finally{bt(!0)}},[]);h.useEffect(()=>{on==null||on(),Vn()},[on,Vn]);const tn=h.useMemo(()=>{const k=Array.isArray(cn)?cn:[],T=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 T||k.find(D=>String((D==null?void 0:D.bot_type)||"").toLowerCase()==="grid_bot")},[cn]),fn=Number((tn==null?void 0:tn.total_slot_count)||0),rn=Number((tn==null?void 0:tn.using_extra_slot_count)||0)+Number((tn==null?void 0:tn.using_subs_slot_count)||0),nt=fn+rn,it=tn?fn<=0:!1,Ut=it;h.useEffect(()=>{r&&r.id&&r.address&&Qt(k=>k.id===r.id&&k.address&&k.address.toLowerCase()===r.address.toLowerCase()?k:{id:r.id,address:r.address})},[r==null?void 0:r.id,r==null?void 0:r.address]);const hn=h.useMemo(()=>a.find(k=>k.symbol===t),[a,t]),nn=hn&&hn.raw&&hn.raw.last_trade_price!=null&&Number(hn.raw.last_trade_price)||0;h.useEffect(()=>{let k=!1;async function T(){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 X=Array.isArray(V)&&V||Array.isArray(V.data)&&V.data||Array.isArray(V.coins)&&V.coins||[],le=String(t||"").toUpperCase(),ce=X.find(ye=>String(ye.value||ye.label||ye.symbol||ye.coin||"").toUpperCase()===le),fe=ce&&ce.maxLeverage!=null?Number(ce.maxLeverage):null;!k&&fe!=null&&Number.isFinite(fe)&&fe>0&&(ie(fe),z(ye=>{const Pe=Number(ye)||1;return Math.min(fe,Math.max(1,Pe))}))}catch{if(k)return}}return t&&T(),()=>{k=!0}},[t]),h.useEffect(()=>{let k=!1;async function T(){if(typeof window>"u")return;const D=window.localStorage.getItem("hyperAddress"),V=window.localStorage.getItem("hyperToken");if(!D||!V){k||q([]);return}ne(!0);try{const le=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(!le||k)return;let ce=[];Array.isArray(le)?ce=le:Array.isArray(le.data)?ce=le.data:le&&le.wallet_id!=null&&(ce=[le]);const fe=await Promise.all(ce.map(async ye=>{let Pe=null;if(ye.available_balance!=null){const Me=Number(ye.available_balance);Number.isFinite(Me)&&(Pe=Me)}else if(ye.balance!=null){const Me=Number(ye.balance);Number.isFinite(Me)&&(Pe=Me)}try{if(ye.wallet_address){const Ke=await(await fetch(`https://mainnet.zklighter.elliot.ai/api/v1/account?by=l1_address&value=${encodeURIComponent(Ic(ye.wallet_address))}`)).json().catch(()=>null),we=Ke&&Array.isArray(Ke.accounts)&&Ke.accounts.length>0&&Ke.accounts[0];if(we&&we.available_balance!=null){const Te=Number(we.available_balance);Number.isFinite(Te)&&(Pe=Te)}}}catch{}return{wallet_id:ye.wallet_id,wallet_address:ye.wallet_address,wallet_name:ye.wallet_name||`Wallet ${ye.wallet_id}`,available_balance:Pe}}));if(k)return;q(fe),Qt(ye=>{if(ye&&ye.id)return ye;const Pe=fe[0];return Pe?{id:Pe.wallet_id,address:Pe.wallet_address}:ye})}catch{k||q([])}finally{k||ne(!1)}}return T(),()=>{k=!0}},[]);const Vt=h.useMemo(()=>{if(!xt||!xt.id)return null;const k=ae.find(D=>String(D.wallet_id)===String(xt.id));if(!k||k.available_balance==null)return null;const T=Number(k.available_balance);return Number.isFinite(T)?T:null},[ae,xt]),pt=(k,T,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 X=Number(k.gridCount);x(X),y(String(X))}if((k.gridType==="geometric"||k.gridType==="arithmetic")&&I(k.gridType),k.investment&&k.investment.leverage!=null&&Number.isFinite(Number(k.investment.leverage))){const X=Number(k.investment.leverage);z(X)}if(k.investment&&k.investment.collateral!=null&&Number.isFinite(Number(k.investment.collateral))){const X=Number(k.investment.collateral);if(M(String(X)),T&&T>0&&X>0){const le=X/T*100;$(Math.max(0,Math.min(100,le)))}else $(0)}else M(""),$(0);se(V)};h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(xt!=null&&xt.id)||!(xt!=null&&xt.address)){se(!1);return}let k=!1;function T(){c(""),d(""),x(2),y("2"),I("arithmetic"),M(""),$(0),z(10),C("")}async function D(){K(!0);try{const V=window.localStorage.getItem("hyperToken");if(!V){k||(se(!1),T(),K(!1));return}const X={address:localStorage.getItem("hyperAddress"),token:V,wallet_id:Number(xt.id),source_market:"lighter",coin:String(t||"").toUpperCase()},ce=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)})).json().catch(()=>null);if(k)return;if(St.current){St.current=!1,K(!1);return}const fe=ce&&ce.data?ce.data:ce;fe&&typeof fe=="object"&&fe.is_deleted===!1&&fe.bot_params&&fe.bot_params?pt(fe.bot_params,Vt,!0):(se(!1),T())}catch{if(k)return;se(!1),c(""),d(""),x(2),y("2"),I("arithmetic"),M(""),$(0),z(10),C("")}finally{k||K(!1)}}return D(),()=>{k=!0}},[t,xt==null?void 0:xt.id,xt==null?void 0:xt.address,Ce]);const We=h.useMemo(()=>e1n(l,u,f,N),[l,u,f,N]),It=h.useMemo(()=>{if(!We.length)return[];const k=Number(l),T=Number(u),D=Number.isFinite(k)&&Number.isFinite(T)?(k+T)/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(It)},[It,s]);const Ge=k=>{const T=Number(k);if(!(T>0))return;const V=T*.01;c((T-V).toFixed(2)),d((T+V).toFixed(2))};h.useEffect(()=>{const k=T=>{const D=T&&T.detail&&T.detail.sourceMarket;D&&D!=="lighter"||je(V=>V+1)};return window.addEventListener("gridbotUpdated",k),()=>{window.removeEventListener("gridbotUpdated",k)}},[]),h.useEffect(()=>{const k=T=>{const D=T&&T.detail;if(!D)return;const V=D.sourceMarket||D.source_market;if(V&&V!=="lighter"||String(D.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const le=D.botParams||{};if(St.current=!0,pt(le,Vt,D.isActive),D.isActive===!0?se(!0):D.isActive===!1&&se(!1),D.walletId&&ae&&ae.length){const ce=ae.find(fe=>String(fe.wallet_id)===String(D.walletId));ce&&Qt({id:ce.wallet_id,address:ce.wallet_address})}};return window.addEventListener("gridbotSelectFromTasks",k),()=>{window.removeEventListener("gridbotSelectFromTasks",k)}},[t,ae]),h.useEffect(()=>{if(typeof window>"u")return;const k=window.localStorage.getItem("gridbot:pending_selection");if(!k)return;let T=null;try{T=JSON.parse(k)}catch{T=null}if(!(!T||T.sourceMarket&&T.sourceMarket!=="lighter"||String(T.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(St.current=!0,pt(T.botParams||{},Vt,T.isActive),T.isActive===!0?se(!0):T.isActive===!1&&se(!1),T.walletId&&ae&&ae.length){const D=ae.find(V=>String(V.wallet_id)===String(T.walletId));D&&Qt({id:D.wallet_id,address:D.wallet_address})}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,ae,Vt]),h.useEffect(()=>{if(l||u)return;const k=nn>0?nn:Number(e||n||0);!Number.isFinite(k)||k<=0||Ge(k)},[nn,e,n,l,u]);const ct=h.useMemo(()=>{if(nn>0)return nn;const k=Number(e||0);if(k>0)return k;const T=Number(n||0);if(T>0)return T;const D=Number(l),V=Number(u);return Number.isFinite(D)&&Number.isFinite(V)&&V>D?(D+V)/2:0},[nn,e,n,l,u]),vt=ct,Ht=h.useMemo(()=>{const k=Math.max(1,Number(L)||1);return Math.min(G,k)},[L,G]),Rt=Number(P)||0,mn=Rt*Ht,un=We.length,yn=ct>0?ct:nn,_n=yn>0&&un>0&&mn>0?Number((mn/un/yn).toFixed(5)):0,In=Number.isFinite(hn==null?void 0:hn.sizeDecimals)?hn.sizeDecimals:4,Sn=Number.isFinite(hn==null?void 0:hn.priceDecimals)?hn.priceDecimals:4,Yn=Sn,Xn=(hn==null?void 0:hn.minBaseAmount)??0,zn=(hn==null?void 0:hn.minQuoteAmount)??0,Kn=_n>0?Number(_n.toFixed(In)):0,jn=Kn>0&&Xn>0&&Kn<Xn,De=Kn>0&&zn>0&&We.length>0&&We.some(k=>k*Kn<zn),pe=ct>0&&mn>0&&Rt>0?gje({entry:ct,side:"buy",notionalUSD:mn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Rt,isolatedMarginUSD:Rt}):null,qe=ct>0&&mn>0&&Rt>0?gje({entry:ct,side:"sell",notionalUSD:mn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Rt,isolatedMarginUSD:Rt}):null,Ae=h.useMemo(()=>{if(!l&&!u)return"";const k=Number(l),T=Number(u);if(!Number.isFinite(k)||!Number.isFinite(T))return"";if(!(T>k))return"Upper price must be greater than lower price.";if(vt>0){if(k>vt)return`Lower price cannot be above mark price (${vt.toFixed(Sn)}).`;if(T<vt)return`Upper price cannot be below mark price (${vt.toFixed(Sn)}).`}return""},[l,u,vt,Sn]),ze=h.useMemo(()=>{const k=Number(l),T=Number(u);return!(!Number.isFinite(k)||!Number.isFinite(T)||!(T>k)||vt>0&&(k>vt||T<vt))},[l,u,vt]),zt=un>1&&ze&&Rt>0&&Ht>0&&(xt==null?void 0:xt.id)&&(xt==null?void 0:xt.address),kt=oe>0,gt=!!v,Mt=jn||De,ln=Ve&&!st,vn=zt&&!ee&&!re&&!W&&!kt&&!gt&&!Mt&&!it&&!ln,Wn=re||ee||W||gt?!1:Q||ln?!0:Mt||kt||it?!1:zt,On=re||ee||W?!0:Q||ln?!1:Mt||kt||it||gt?!0:!zt,$t=Q||re||ee,Nn=G&&G>0;h.useEffect(()=>{if(!oe)return;const k=setInterval(()=>{he(T=>T>1?T-1:0)},1e3);return()=>clearInterval(k)},[oe]);const Fn=()=>{if($t)return;const k=nn>0?nn:ct>0?ct:Number(e||n||0);!Number.isFinite(k)||k<=0||Ge(k)},Tt=k=>{if($t)return;const T=Math.max(0,Math.min(100,Number(k)||0));if($(T),!Vt||Vt<=0){T===0&&M("");return}const D=Vt*T/100;M(D&&Number.isFinite(D)?String(D.toFixed(2)):"")},pn=k=>{if($t)return;M(k);const T=Number(k);if(!Vt||!Number.isFinite(T)||T<=0||Vt<=0){$(0);return}const D=T/Vt*100;$(Math.max(0,Math.min(100,D)))},ke=async()=>{if(!vn||typeof window>"u"||!(xt!=null&&xt.address)||!(xt!=null&&xt.id))return;const k=We.filter(Pe=>Number.isFinite(Pe));if(k.length<2)return;const T=k[0],D=k[k.length-1],V=(T+D)/2,X=k.length,le=window.localStorage.getItem("hyperToken");if(!le)return;const ce=Kn,fe={symbol:String(t||"").toUpperCase(),gridType:N==="geometric"?"geometric":"arithmetic",direction:o,priceRange:{lower:Number(T.toFixed(Yn)),upper:Number(D.toFixed(Yn)),middle:Number(V.toFixed(Yn))},gridCount:X,gridPrices:k.map(Pe=>Number(Pe.toFixed(Yn))),investment:{collateral:Rt,leverage:Ht,totalInvestment:mn,qtyPerOrder:ce},liquidationPrices:{long:pe?Number(pe.toFixed(2)):null,short:qe?Number(qe.toFixed(2)):null},marginMode:"Cross",currentPrice:ct||null,timestamp:new Date().toISOString()},ye={address:localStorage.getItem("hyperAddress"),token:le,wallet_id:Number(xt.id),source_market:"lighter",bot_params:fe,coin:String(t||"").toUpperCase()};de(!0);try{const Me=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ye)})).json().catch(()=>null);if(!(Me&&(Me.success===!0||Me.status==="ok"||Me.status==="success"))){const we=Me&&(Me.error_message||Me.message||Me.detail)||"Grid bot failed to start.";dn.error(we);return}se(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),on==null||on(),dn.success("Grid bot started.")}catch{dn.error("An error occurred while starting the grid bot.")}finally{de(!1)}},m=async()=>{if(typeof window>"u"||!(xt!=null&&xt.address)||!(xt!=null&&xt.id))return;const k=window.localStorage.getItem("hyperToken");if(!k)return;const T={address:localStorage.getItem("hyperAddress"),token:k,wallet_id:Number(xt.id),source_market:"lighter",coin:String(t||"").toUpperCase()};de(!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(T)})).json().catch(()=>null);if(!(V&&(V.success===!0||V.status==="ok"||V.status==="success"))){const le=V&&(V.error_message||V.message||V.detail)||"Grid bot could not be stopped.";dn.error(le);return}se(!1),he(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),on==null||on(),dn.success("Grid bot has been stopped.")}catch{dn.error("An error occurred while stopping the grid bot.")}finally{de(!1)}},p=()=>{if(ln){rt(!0);return}Wn&&(Q?m():ge(!0))},S=async()=>{vn&&(ge(!1),await ke())},A=ln?"Subscribe / 0.12 ETH":re?Q?"Stopping...":"Starting...":Q?"Stop":kt?`Stopping ${oe}s`:"Start";return i.jsxs(i.Fragment,{children:[ht&&i.jsx($Ve,{open:ht,setOpen:rt,checkAccountCopy:Vn,roleType:"farming"}),Oe&&i.jsx(M5,{open:Oe,setOpen:$e,oldSlotCount:Ye,checkAccountLighter:on,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(oI,{wallets:ae,value:xt&&xt.id?String(xt.id):"",onChange:k=>{const T=ae.find(D=>String(D.wallet_id)===String(k));T&&Qt({id:T.wallet_id,address:T.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(N5,{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:nt?`${rn}/${nt}`:tn?"0/0":"--"})})]}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[11px] text-[#7C7C7C]",children:it?"No slots left. Get more to start new grid bots.":""}),Ut&&i.jsx("button",{type:"button",onClick:()=>{Je(fn),$e(!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:Fn,disabled:$t,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=>{$t||c(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:$t})})]}),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=>{$t||d(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:$t})})]})]}),vt>0&&i.jsxs("div",{className:"text-[11px] text:white/40 text-white/40",children:["Mark Price: ",vt.toFixed(Sn)]}),Ae&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:Ae})]}),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($t)return;const T=k.target.value.replace(/[^\d]/g,"");if(y(T),C(""),T==="")return;const D=Number(T);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:$t})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:N,onChange:k=>{$t||I(k.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:$t,children:Jgn.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:P,onChange:k=>pn(k.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:$t}),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(H4,{onClick:Nn&&!$t?()=>xe(!0):void 0,children:Nn?`${Ht}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-3 pb-6",children:[i.jsx(wj,{value:F,onChange:k=>Tt(k),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:F,onChange:k=>Tt(Math.max(0,Math.min(100,Number(k.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:$t}),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:"," ",mn>0?`${mn.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:"," ",Kn>0?`${Kn} ${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:pe?`$${pe.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:qe?`$${qe.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:p,disabled:On,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${On?"bg-[#303030] text-white/40 cursor-not-allowed opacity-70":ln?"bg-[#7446FF] text-white hover:bg-[#5834C3]":Q?"bg-[#FF7173] text:black text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90"}`,children:A}),jn&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",Xn," ",t,")."]}),De&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",zn.toFixed(2),"."]})]})]})]}),i.jsx(lp,{open:_e,onClose:()=>xe(!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:L,onChange:k=>z(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:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:L,onChange:k=>{const T=Number(k.target.value)||1,D=Math.max(1,Math.min(G||1,T));z(D)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>xe(!1),children:"Confirm"})]})}),i.jsx(lp,{open:Se,onClose:()=>ge(!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:Bi},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:Bi},children:un||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:N==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Kn>0?`${Kn} ${t}`:"--"})]})]}),i.jsx("div",{className:"mt-2 pt-3 border-t border-[#292929]",children:i.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[i.jsx("span",{className:"font-medium",style:{color:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:mn>0?`${mn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:S,disabled:re,children:re?"Starting...":"Confirm"})})]})})]})}const t1n=["arithmetic","geometric"],n1n=6,Dqe="https://api.hyperliquid.xyz/info",r1n=10,s1n=10*60*1e3;let Fb={data:null,ts:0,promise:null};async function i1n(){const t=Date.now();if(Fb.data&&t-Fb.ts<s1n)return Fb.data;if(Fb.promise)return Fb.promise;const e=fetch(Dqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allPerpMetas"})}).then(n=>n.json()).then(n=>{const r=Array.isArray(n)?n:[];return Fb={data:r,ts:Date.now(),promise:null},r}).catch(n=>{throw Fb.promise=null,n});return Fb.promise=e,e}function 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 yje({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 XQ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function o1n(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 l1n(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 vje({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){const o=yz(),[l]=h.useState("short"),[c,u]=h.useState(""),[d,f]=h.useState(""),[x,g]=h.useState(2),[y,v]=h.useState("2"),[C,N]=h.useState(""),[I,P]=h.useState("arithmetic"),[M,F]=h.useState(""),[$,L]=h.useState(0),[z,Q]=h.useState(10),[se,ee]=h.useState(!1),[K,re]=h.useState(!1),[de,G]=h.useState(!1),[ie,ae]=h.useState(50),[q,W]=h.useState(0),[ne,oe]=h.useState(!1),[he,_e]=h.useState(!1),[xe,Se]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),[ge,Ce]=h.useState({address:null,token:null}),[je,Oe]=h.useState(null),[$e,Ye]=h.useState(null),[Je,ht]=h.useState(""),[rt,st]=h.useState(""),[He,Ve]=h.useState(""),[bt,xt]=h.useState(""),[Qt,St]=h.useState(!1),[on,cn]=h.useState(!1),[Vn,tn]=h.useState(!1),[fn,rn]=h.useState(!1),[nt,it]=h.useState(0),Ut=()=>{u(""),f(""),g(2),v("2"),P("arithmetic"),F(""),L(0),Q(10),N(""),ht(""),st(""),Ve(""),xt(""),St(!1),cn(!1),tn(!1),rn(!1)},{address:hn,isConnected:nn}=es();nn&&(typeof window<"u"&&window.localStorage.getItem("hyperToken"));const{wallets:Vt,loading:pt}=vqe(ge.address,ge.token,!0,{pollMs:5e3}),We=h.useRef(!1),It=pt&&(!Vt||Vt.length===0);h.useEffect(()=>{r&&r.id&&r.address&&Se(ut=>ut.id===r.id&&ut.address&&ut.address.toLowerCase()===r.address.toLowerCase()?ut:{id:r.id,address:r.address})},[r==null?void 0:r.id,r==null?void 0:r.address]),h.useEffect(()=>{const ut=()=>{const yt=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,Lt=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;Ce({address:yt,token:Lt})};return ut(),window.addEventListener("localStorageUpdated",ut),window.addEventListener("storage",ut),()=>{window.removeEventListener("localStorageUpdated",ut),window.removeEventListener("storage",ut)}},[]),h.useEffect(()=>{if(xe.id||!Vt||!Vt.length)return;const ut=Vt.find(Lt=>Lt.confirmed)||Vt[0];if(!ut)return;const yt={id:ut.wallet_id,address:ut.wallet_address};Se(yt),typeof s=="function"&&s({id:String(yt.id),address:yt.address})},[Vt,xe.id,s]),h.useEffect(()=>{t&&(Ut(),ee(!1))},[t]);const Ge=h.useMemo(()=>o.find(ut=>ut.symbol===t),[o,t]),ct=Ge&&Ge.raw&&Ge.raw.last_trade_price!=null&&Number(Ge.raw.last_trade_price)||0;h.useEffect(()=>{let ut=!1;async function yt(){if(t)try{const Gt=await(await fetch(Dqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allPerpMetas"})})).json().catch(()=>null);if(!Gt||ut)return;let an=null;for(const Pt of Gt)if(Array.isArray(Pt==null?void 0:Pt.universe)){for(const qt of Pt.universe)if(String(qt.name||"").toUpperCase()===String(t||"").toUpperCase()){an=qt;break}}if(!an||!Number.isFinite(an.maxLeverage))return;const et=Number(an.maxLeverage);ae(et),Q(Pt=>Math.min(et,Math.max(1,Pt)))}catch{}}return yt(),()=>{ut=!0}},[t]),h.useEffect(()=>{let ut=!1;async function yt(){try{const Gt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper_fr")).json().catch(()=>null);if(!Gt||ut)return;const an=Array.isArray(Gt)&&Gt||Array.isArray(Gt.data)&&Gt.data||Array.isArray(Gt.coins)&&Gt.coins||[],et=String(t||"").toUpperCase(),Pt=an.find(ft=>String(ft.value||ft.label||ft.symbol||ft.coin||"").toUpperCase()===et),qt=Pt&&Pt.maxLeverage!=null?Number(Pt.maxLeverage):null;!ut&&qt!=null&&Number.isFinite(qt)&&qt>0&&(ae(qt),Q(ft=>Math.min(qt,Math.max(1,Number(ft)||1))))}catch{}}return t&&yt(),()=>{ut=!0}},[t]);const vt=(xe==null?void 0:xe.address)||(hn?hn.toLowerCase():null),{perpsOverview:Ht}=aI(vt),Rt=h.useMemo(()=>{if(!Ht||Ht.balance==null)return null;const ut=Number(Ht.balance);return Number.isFinite(ut)?ut:null},[Ht]),mn=(ut,yt)=>{var Dn,er,Sr,dr;const Lt=ut.priceRange||{},Gt=Array.isArray(ut.gridPrices)?ut.gridPrices:[];let an=Lt.lower,et=Lt.upper;(!Number.isFinite(an)||!Number.isFinite(et))&&Gt.length>=2&&(an=Gt[0],et=Gt[Gt.length-1]),Number.isFinite(an)?u(String(an)):u(""),Number.isFinite(et)?f(String(et)):f("");let Pt=ut.gridCount;Number.isFinite(Pt)||Gt.length>=2&&(Pt=Gt.length),Number.isFinite(Pt)?(g(Pt),v(String(Pt))):(g(2),v("2"));let qt=ut.gridType;qt!=="geometric"&&qt!=="arithmetic"&&(qt="arithmetic"),P(qt);const ft=ut.investment||{};if(ft&&ft.leverage!=null&&Number.isFinite(Number(ft.leverage))&&Q(Number(ft.leverage)),ft&&ft.collateral!=null&&Number.isFinite(Number(ft.collateral))){const kr=Number(ft.collateral);if(F(String(kr)),yt&&yt>0&&kr>0){const qn=kr/yt*100;L(Math.max(0,Math.min(100,qn)))}else L(0)}else F(""),L(0);const tt=ut.trailing_up??((Dn=ut==null?void 0:ut.trailing)==null?void 0:Dn.up),Bt=ut.trailing_down??((er=ut==null?void 0:ut.trailing)==null?void 0:er.down),gn=ut.sl_up??((Sr=ut==null?void 0:ut.sl)==null?void 0:Sr.up),tr=ut.sl_down??((dr=ut==null?void 0:ut.sl)==null?void 0:dr.down);ht(tt!=null&&Number.isFinite(Number(tt))?String(tt):""),st(Bt!=null&&Number.isFinite(Number(Bt))?String(Bt):""),Ve(gn!=null&&Number.isFinite(Number(gn))?String(gn):""),xt(tr!=null&&Number.isFinite(Number(tr))?String(tr):""),St(tt!=null&&Number.isFinite(Number(tt))),cn(Bt!=null&&Number.isFinite(Number(Bt))),tn(gn!=null&&Number.isFinite(Number(gn))),rn(tr!=null&&Number.isFinite(Number(tr)))};h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(xe!=null&&xe.id)||!(xe!=null&&xe.address)){ee(!1),Ut();return}let ut=!1;async function yt(){re(!0);try{const Lt=window.localStorage.getItem("hyperToken");if(!Lt){ut||(ee(!1),Ut(),re(!1));return}const Gt={address:window.localStorage.getItem("hyperAddress"),token:Lt,wallet_id:Number(xe.id),source_market:"hyper",coin:String(t||"").toUpperCase()},et=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Gt)})).json().catch(()=>null);if(ut)return;if(We.current){We.current=!1,re(!1);return}const Pt=et&&et.data?et.data:et;Pt&&typeof Pt=="object"&&Pt.is_deleted===!1&&Pt.bot_params&&Pt.bot_params?(mn(Pt.bot_params,Rt),ee(!0)):(ee(!1),Ut(),u(""),f(""))}catch{ee(!1),Ut(),u(""),f("")}finally{ut||re(!1)}}return yt(),()=>{ut=!0}},[t,xe==null?void 0:xe.id,xe==null?void 0:xe.address,nt]),h.useEffect(()=>{if(typeof window>"u")return;const ut=window.localStorage.getItem("gridbot:pending_selection");if(!ut)return;let yt=null;try{yt=JSON.parse(ut)}catch{yt=null}if(!(!yt||yt.sourceMarket&&yt.sourceMarket!=="hyper"||String(yt.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(We.current=!0,mn(yt.botParams||{},Rt),yt.isActive===!0?ee(!0):yt.isActive===!1&&ee(!1),yt.walletId&&Vt&&Vt.length){const Lt=Vt.find(Gt=>String(Gt.wallet_id)===String(yt.walletId));if(Lt){const Gt={id:Lt.wallet_id,address:Lt.wallet_address};Se(Gt),typeof s=="function"&&s({id:String(Gt.id),address:Gt.address})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,Vt,s,Rt]),h.useEffect(()=>{const ut=yt=>{const Lt=yt&&yt.detail&&yt.detail.sourceMarket;Lt&&Lt!=="hyper"||it(Gt=>Gt+1)};return window.addEventListener("gridbotUpdated",ut),()=>{window.removeEventListener("gridbotUpdated",ut)}},[]),h.useEffect(()=>{const ut=yt=>{const Lt=yt&&yt.detail;if(!Lt)return;const Gt=Lt.sourceMarket||Lt.source_market;if(Gt&&Gt!=="hyper"||String(Lt.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const et=Lt.botParams||{};if(mn(et,Rt),We.current=!0,Lt.isActive===!0?ee(!0):Lt.isActive===!1&&ee(!1),Lt.walletId&&Vt&&Vt.length){const Pt=Vt.find(qt=>String(qt.wallet_id)===String(Lt.walletId));if(Pt){const qt={id:Pt.wallet_id,address:Pt.wallet_address};Se(qt),typeof s=="function"&&s({id:String(qt.id),address:qt.address})}}};return window.addEventListener("gridbotSelectFromTasks",ut),()=>{window.removeEventListener("gridbotSelectFromTasks",ut)}},[t,Vt,s]);const un=h.useMemo(()=>a1n(c,d,x,I),[c,d,x,I]),yn=h.useMemo(()=>{if(!un.length)return[];const ut=Number(c),yt=Number(d),Lt=Number.isFinite(ut)&&Number.isFinite(yt)?(ut+yt)/2:null;return un.map(Gt=>({price:Gt,side:Lt==null?null:Gt>=Lt?"sell":"buy"}))},[un,c,d]);h.useEffect(()=>{typeof a=="function"&&a(yn)},[yn,a]);const _n=ut=>{const yt=Number(ut);if(!(yt>0))return;const Lt=yt*.01;u((yt-Lt).toFixed(2)),f((yt+Lt).toFixed(2))},In=h.useMemo(()=>{if(ct>0)return ct;const ut=Number(e||0);if(ut>0)return ut;const yt=Number(n||0);if(yt>0)return yt;const Lt=Number(c),Gt=Number(d);return Number.isFinite(Lt)&&Number.isFinite(Gt)&&Gt>Lt?(Lt+Gt)/2:0},[ct,e,n,c,d]);h.useEffect(()=>{let ut=!1;async function yt(){const Lt=o1n(t);if(!Lt){Oe(null),Ye(null);return}try{const Gt=await i1n();let an=null;e:for(const et of Gt)if(Array.isArray(et==null?void 0:et.universe)){for(const Pt of et.universe)if(String((Pt==null?void 0:Pt.name)||"").toUpperCase()===Lt){const ft=Number(Pt.szDecimals);Number.isFinite(ft)&&(an=ft);break e}}if(ut)return;an!=null?Oe(an):(Oe(null),Ye(null))}catch{Oe(null),Ye(null)}}return t?yt():(Oe(null),Ye(null)),()=>{ut=!0}},[t]),h.useEffect(()=>{if(!Number.isFinite(je)){Ye(null);return}const ut=l1n(In,je);Ye(ut)},[In,je]);const Sn=In,Yn=h.useMemo(()=>Math.min(ie,Math.max(1,Number(z)||1)),[z,ie]),Xn=Number(M)||0,zn=Xn*Yn,Kn=un.length,jn=In>0?In:ct,De=jn>0&&Kn>0&&zn>0?Number((zn/Kn/jn).toFixed(5)):0,pe=Number.isFinite(je)?je:Number.isFinite(Ge==null?void 0:Ge.sizeDecimals)?Ge.sizeDecimals:4,qe=h.useMemo(()=>{if(Number.isFinite($e))return $e;const ut=Number.isFinite(pe)?Number(pe):4,yt=Math.max(0,n1n-ut),Lt=Math.abs(Number(In||0));if(!(Lt>0)||!Number.isFinite(Lt))return yt;const Gt=Lt>=1?Math.floor(Math.log10(Lt))+1:0,an=Math.max(0,5-Gt);return Math.min(yt,an)},[$e,pe,In]),Ae=qe,ze=(Ge==null?void 0:Ge.minBaseAmount)??0,zt=(Ge==null?void 0:Ge.minQuoteAmount)??0,kt=De>0?Number(De.toFixed(pe)):0,gt=kt>0&&ze>0&&kt<ze,Mt=kt>0&&zt>0&&un.length>0&&un.some(ut=>ut*kt<zt),ln=h.useMemo(()=>{if(kt<=0||un.length===0)return 0;let ut=1/0;for(const yt of un){if(!(yt>0))continue;const Lt=yt*kt;Lt<ut&&(ut=Lt)}return ut===1/0?0:ut},[kt,un]),vn=kt<=0||ln<r1n,Wn=In>0&&zn>0&&Xn>0?yje({entry:In,side:"buy",notionalUSD:zn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Xn,isolatedMarginUSD:Xn}):null,On=In>0&&zn>0&&Xn>0?yje({entry:In,side:"sell",notionalUSD:zn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Xn,isolatedMarginUSD:Xn}):null,$t=h.useMemo(()=>{if(!c&&!d)return"";const ut=Number(c),yt=Number(d);if(!Number.isFinite(ut)||!Number.isFinite(yt))return"";if(!(yt>ut))return"Upper price must be greater than lower price.";if(Sn>0){if(ut>Sn)return`Lower price cannot be above mark price (${Sn.toFixed(qe)}).`;if(yt<Sn)return`Upper price cannot be below mark price (${Sn.toFixed(qe)}).`}return""},[c,d,Sn,qe]),Nn=h.useMemo(()=>{const ut=Number(c),yt=Number(d);return!(!Number.isFinite(ut)||!Number.isFinite(yt)||!(yt>ut)||Sn>0&&(ut>Sn||yt<Sn))},[c,d,Sn]),Fn=Number(c),Tt=Number(d),pn=Number(Je),ke=Number(rt),m=Number(He),p=Number(bt),S=Qt&&(Je===""||!Number.isFinite(pn)||!(pn>Tt)),A=on&&(rt===""||!Number.isFinite(ke)||!(ke<Fn));h.useEffect(()=>{Qt||ht(""),on||st("")},[Qt,on]),h.useEffect(()=>{Vn||Ve(""),fn||xt("")},[Vn,fn]);const k=Vn&&(He===""||!Number.isFinite(m)||!Qt&&Number.isFinite(Tt)&&!(m>Tt)||Qt&&Number.isFinite(pn)&&!(m>pn)),T=fn&&(bt===""||!Number.isFinite(p)||!on&&Number.isFinite(Fn)&&!(p<Fn)||on&&Number.isFinite(ke)&&!(p<ke)),D=Kn>1&&Nn&&Xn>0&&Yn>0&&(xe==null?void 0:xe.id)&&(xe==null?void 0:xe.address),V=q>0,X=!!C,le=gt||Mt,ce=S||A||k||T,fe=D&&!K&&!de&&!It&&!V&&!X&&!le&&!vn&&!ce,ye=de||K||It||X||le||vn||V||ce?!1:se?!0:D,Pe=se||de||K||It;h.useEffect(()=>{if(!q)return;const ut=setInterval(()=>W(yt=>yt>1?yt-1:0),1e3);return()=>clearInterval(ut)},[q]);const Me=()=>{if(Pe)return;const ut=ct>0?ct:In>0?In:Number(e||n||0);!Number.isFinite(ut)||ut<=0||_n(ut)},Ke=ut=>{if(Pe)return;const yt=Math.max(0,Math.min(100,Number(ut)||0));if(L(yt),!Rt||Rt<=0){yt===0&&F("");return}const Lt=Rt*yt/100;F(Lt&&Number.isFinite(Lt)?String(Lt.toFixed(2)):"")},we=ut=>{if(Pe)return;F(ut);const yt=Number(ut);if(!Rt||!Number.isFinite(yt)||yt<=0||Rt<=0){L(0);return}const Lt=yt/Rt*100;L(Math.max(0,Math.min(100,Lt)))},Te=async()=>{if(!fe||typeof window>"u"||!(xe!=null&&xe.address)||!(xe!=null&&xe.id))return;const ut=un.filter(Bt=>Number.isFinite(Bt));if(ut.length<2)return;const yt=ut[0],Lt=ut[ut.length-1],Gt=(yt+Lt)/2,an=ut.length,et=window.localStorage.getItem("hyperToken");if(!et)return;if(Qt&&S){dn.error("Trailing Up is invalid.");return}if(on&&A){dn.error("Trailing Down is invalid.");return}if(Vn&&k){const Bt=Qt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";dn.error(Bt);return}if(fn&&T){const Bt=on?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";dn.error(Bt);return}const Pt=kt,qt=XQ(t),ft={symbol:String(t||"").toUpperCase(),dex:qt,gridType:I==="geometric"?"geometric":"arithmetic",direction:l,priceRange:{lower:Number(yt.toFixed(Ae)),upper:Number(Lt.toFixed(Ae)),middle:Number(Gt.toFixed(Ae))},gridCount:an,gridPrices:ut.map(Bt=>Number(Bt.toFixed(Ae))),investment:{collateral:Xn,leverage:Yn,totalInvestment:zn,qtyPerOrder:Pt},liquidationPrices:{long:Wn?Number(Wn.toFixed(2)):null,short:On?Number(On.toFixed(2)):null},trailing_up:Qt&&!S?Number(pn.toFixed(Ae)):null,trailing_down:on&&!A?Number(ke.toFixed(Ae)):null,sl_up:Vn&&!k?Number(m.toFixed(Ae)):null,sl_down:fn&&!T?Number(p.toFixed(Ae)):null,marginMode:"Cross",currentPrice:In||null,timestamp:new Date().toISOString()},tt={address:window.localStorage.getItem("hyperAddress"),token:et,wallet_id:Number(xe.id),source_market:"hyper",...qt?{dex:qt}:{},bot_params:ft,coin:String(t||"").toUpperCase()};G(!0);try{const gn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tt)})).json().catch(()=>null);if(!(gn&&(gn.success===!0||gn.status==="ok"||gn.status==="success"))){const Dn=gn&&(gn.error_message||gn.message||gn.detail)||"Grid bot failed to start.";dn.error(Dn);return}ee(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),dn.success("Grid bot started.")}catch{dn.error("An error occurred while starting the grid bot.")}finally{G(!1)}},te=async()=>{if(typeof window>"u"||!(xe!=null&&xe.address)||!(xe!=null&&xe.id))return;const ut=window.localStorage.getItem("hyperToken");if(!ut)return;const yt=XQ(t),Lt={address:window.localStorage.getItem("hyperAddress"),token:ut,wallet_id:Number(xe.id),source_market:"hyper",...yt?{dex:yt}:{},coin:String(t||"").toUpperCase()};G(!0);try{const an=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Lt)})).json().catch(()=>null);if(!(an&&(an.success===!0||an.status==="ok"||an.status==="success"))){const Pt=an&&(an.error_message||an.message||an.detail)||"Grid bot could not be stopped.";dn.error(Pt);return}ee(!1),W(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),dn.success("Grid bot has been stopped.")}catch{dn.error("An error occurred while stopping the grid bot.")}finally{G(!1)}},ve=()=>{ye&&(se?te():_e(!0))},Be=async()=>{fe&&(_e(!1),await Te())},Ue=de?se?"Stopping...":"Starting...":se?"Stop":V?`Stopping ${q}s`:"Start",Fe=["xyz","vntl","flx"].includes(XQ(t))?"Isolated":"Cross",at=!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(oI,{wallets:Vt,value:xe&&xe.id?String(xe.id):"",onChange:ut=>{const yt=(Vt||[]).find(Lt=>String(Lt.wallet_id)===String(ut))||null;if(yt){const Lt={id:yt.wallet_id,address:yt.wallet_address};Se(Lt),typeof s=="function"&&s({id:String(Lt.id),address:Lt.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:Me,disabled:Pe,className:"text-[11px] px-2 py-0.5 rounded-md bg-[#161616] border border-[#292929] text-white/60 hover:text-white disabled:opacity-60 disabled:cursor-not-allowed",children:"Autofill"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Lower"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:c,onChange:ut=>{Pe||u(ut.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pe})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Upper"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:d,onChange:ut=>{Pe||f(ut.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pe})})]})]}),Sn>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",Sn.toFixed(qe)]}),$t&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:$t})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("span",{className:"text-xs text-white/70",children:"Number of Grids (Even only)"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:i.jsx("input",{value:y,onChange:ut=>{if(Pe)return;const yt=ut.target.value.replace(/[^\d]/g,"");if(v(yt),N(""),yt==="")return;const Lt=Number(yt);if(Number.isFinite(Lt)){if(Lt<2){N("The minimum number of grids must be 2.");return}if(Lt>120){N("The maximum number of grids is 120.");return}if(Lt%2!==0){N("The number of grids must be even.");return}g(Lt)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:Pe})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:I,onChange:ut=>{Pe||P(ut.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:Pe,children:t1n.map(ut=>i.jsx("option",{value:ut,className:"bg-[#101010]",children:ut[0].toUpperCase()+ut.slice(1)},ut))})})]}),i.jsx("div",{className:"text-[11px] text-white/40",children:C&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:C})})]}),at,i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Investment"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:[i.jsx("input",{value:M,onChange:ut=>we(ut.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:Pe}),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(H4,{onClick:ie&&ie>0&&!Pe?()=>oe(!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(wj,{value:$,onChange:ut=>Ke(ut),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:$,onChange:ut=>Ke(Math.max(0,Math.min(100,Number(ut.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:Pe}),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:"," ",zn>0?`${zn.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:"," ",kt>0?`${kt} ${t}`:"--"]}),i.jsxs("span",{children:["Margin Mode: ",Fe]})]})]}),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:Wn?`$${Wn.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:On?`$${On.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:ve,disabled:!ye,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${ye?se?"bg-[#FF7173] text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90":"bg-[#303030] text-white/40 cursor-not-allowed opacity-70"}`,children:Ue}),gt&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",ze," ",t,")."]}),Mt&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",zt.toFixed(2),"."]}),vn&&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."}),at]})]})]}),i.jsx(lp,{open:ne,onClose:()=>oe(!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:z,onChange:ut=>Q(Math.max(1,Math.min(ie||1,Number(ut.target.value)))),className:"flex-1",style:{accentColor:"#67FFBD"}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:z,onChange:ut=>{const yt=Number(ut.target.value)||1,Lt=Math.max(1,Math.min(ie||1,yt));Q(Lt)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>oe(!1),children:"Confirm"})]})}),i.jsx(lp,{open:he,onClose:()=>_e(!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:Fe}),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:Bi},children:Number.isFinite(Number(c))&&Number.isFinite(Number(d))?`${Number(c).toFixed(Ae)} - ${Number(d).toFixed(Ae)} 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:Bi},children:Kn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:I==="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:Bi},children:kt>0?`${kt} ${t}`:"--"})]}),at,at,at,at]}),i.jsx("div",{className:"mt-2 pt-3 border-t border-[#292929]",children:i.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[i.jsx("span",{className:"font-medium",style:{color:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:zn>0?`${zn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:Be,disabled:de,children:de?"Starting...":"Confirm"})})]})})]})}const c1n=["arithmetic","geometric"],u1n=10,d1n="https://express-proxy-delta.vercel.app/proxy?url=",f1n="https://api.starknet.extended.exchange/api/v1";function h1n(t,e,n,r,s,a=1){const o=Number(t),l=Number(e),c=Number(n);if(!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(c))return[];if(c<2||l<=o)return[];const u=Number.isFinite(Number(r))?Number(r):0,d=Math.max(1,Number(a)||1),f=Math.max(0,u)*d,x=c>0?f/c:0;if(s==="geometric"){if(!(o>0)||!(l>0))return[];const C=Math.pow(l/o,1/(c-1));return Array.from({length:c},(N,I)=>{const P=o*Math.pow(C,I),M=P>0?x/P:0;return{index:I,price:P,qty:M,order_size_usd:x}})}const g=(l-o)/(c-1),y=(o+l)/2,v=y>0?x/y:0;return Array.from({length:c},(C,N)=>{const I=o+g*N;return{index:N,price:I,qty:v,order_size_usd:x}})}function wje({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 QQ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function p1n(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 Cje({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){var ir,ls,cs;const{setSignInConnectButtonOpen:o}=h.useContext(Yr),l=afe();h.useState("short");const[c,u]=h.useState("neutral"),[d,f]=h.useState(""),[x,g]=h.useState(""),[y,v]=h.useState(2),[C,N]=h.useState("2"),[I,P]=h.useState(""),[M,F]=h.useState("arithmetic"),[$,L]=h.useState(""),[z,Q]=h.useState(0),[se,ee]=h.useState(10),[K,re]=h.useState(!1),[de,G]=h.useState(!1),[ie,ae]=h.useState(!1),[q,W]=h.useState(50),[ne,oe]=h.useState(0),[he,_e]=h.useState(!1),[xe,Se]=h.useState(!1),[ge,Ce]=h.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address,apiKey:r.apiKey}:{id:null,address:null,apiKey:null}),[je,Oe]=h.useState({address:null,token:null}),[$e,Ye]=h.useState(null),[Je,ht]=h.useState(""),[rt,st]=h.useState(""),[He,Ve]=h.useState(""),[bt,xt]=h.useState(""),[Qt,St]=h.useState(!1),[on,cn]=h.useState(!1),[Vn,tn]=h.useState(!1),[fn,rn]=h.useState(!1),[nt,it]=h.useState(0),Ut=h.useRef(null),hn=h.useRef(!1),nn=lt=>{const Nt=Number(lt);if(!Number.isFinite(Nt)||Nt<=0)return{num:null,str:""};const Rn=Nt>=3?Nt*.99:Nt,ar=Number(Rn.toFixed(2));return{num:Number.isFinite(ar)?ar:null,str:Number.isFinite(ar)?String(Nt.toFixed(2)):""}},Vt=()=>{f(""),g(""),v(2),N("2"),F("arithmetic"),L(""),Q(0),ee(10),P(""),u("neutral"),ht(""),st(""),Ve(""),xt(""),St(!1),cn(!1),tn(!1),rn(!1),Ut.current=null,hn.current=!1},{address:pt,isConnected:We}=es(),Ge=!(We&&!!(typeof window<"u"&&window.localStorage.getItem("hyperToken"))),[ct,vt]=h.useState([]),[Ht,Rt]=h.useState(!1),mn=h.useRef(!1),un=Ht&&(!ct||ct.length===0);h.useEffect(()=>{r&&r.id&&r.address&&Ce(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 Nt=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,Rn=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;Oe({address:Nt,token:Rn})};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){vt([]);return}let lt=!1;return(async()=>{try{Rt(!0);const ar=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(ar!=null&&ar.success&&Array.isArray(ar.data)){const Tr=ar.data.map((Lr,$r)=>({...Lr,wallet_id:Lr.wallet_id??Lr.id??$r,wallet_address:Lr.wallet_address||"",wallet_name:Lr.wallet_name||Lr.name||`Extended Wallet ${$r+1}`,wallet_api_key:Lr.wallet_api_key||Lr.api_key||null}));vt(Tr)}else vt([])}catch(Rn){lt||(console.error("Extended wallet list error",Rn),vt([]))}finally{lt||Rt(!1)}})(),()=>{lt=!0}},[je.address,je.token]),h.useEffect(()=>{if(ge.id||!ct||!ct.length)return;const lt=ct.find(Rn=>Rn.confirmed)||ct[0];if(!lt)return;const Nt={id:lt.wallet_id,address:lt.wallet_address,apiKey:lt.wallet_api_key};Ce(Nt),typeof s=="function"&&s({id:String(Nt.id),address:Nt.address,apiKey:Nt.apiKey})},[ct,ge.id,s]),h.useEffect(()=>{if(!(ge!=null&&ge.id)||!(ct!=null&&ct.length))return;const lt=ct.find(ar=>String(ar.wallet_id)===String(ge.id));if(!lt||!(ge.apiKey!==lt.wallet_api_key||!ge.address&<.wallet_address))return;const Rn={id:lt.wallet_id,address:lt.wallet_address,apiKey:lt.wallet_api_key};Ce(Rn),typeof s=="function"&&s({id:String(Rn.id),address:Rn.address,apiKey:Rn.apiKey})},[ge==null?void 0:ge.id,ge==null?void 0:ge.apiKey,ge==null?void 0:ge.address,ct,s]),h.useEffect(()=>{t&&(Vt(),re(!1))},[t]);const yn=h.useMemo(()=>{if(!t)return null;const lt=String(t).toUpperCase(),Nt=lt.replace(/-USD$/,"");return l.find(Rn=>{const ar=String((Rn==null?void 0:Rn.symbol)||"").toUpperCase(),Tr=String((Rn==null?void 0:Rn.rawSymbol)||"").toUpperCase();return ar===lt||Tr===lt||ar===Nt||Tr===Nt})||null},[l,t]),_n=h.useMemo(()=>{const lt=yn==null?void 0:yn.marketStats,Nt=(lt==null?void 0:lt.markPrice)??(lt==null?void 0:lt.lastPrice)??(lt==null?void 0:lt.indexPrice)??(yn==null?void 0:yn.markPrice)??(yn==null?void 0:yn.lastPrice)??(yn==null?void 0:yn.last)??null,Rn=Number(Nt);return Number.isFinite(Rn)?Rn:0},[yn]);h.useEffect(()=>{var Rn;const lt=((Rn=yn==null?void 0:yn.tradingConfig)==null?void 0:Rn.maxLeverage)??(yn==null?void 0:yn.maxLeverage)??(yn==null?void 0:yn.leverage),Nt=Number(lt);!Number.isFinite(Nt)||Nt<=0||(W(Nt),ee(ar=>Math.min(Nt,Math.max(1,Number(ar)||1))))},[yn]);const In=(ge==null?void 0:ge.address)||(pt?pt.toLowerCase():null),{perpsOverview:Sn}=aI(In),Yn=h.useMemo(()=>{const lt=ct.find(Lr=>String(Lr.wallet_id)===String(ge==null?void 0:ge.id)),Nt=(lt==null?void 0:lt.available_balance)??(lt==null?void 0:lt.balance)??null,Rn=Number(Nt);if(!(ge!=null&&ge.apiKey))return Number.isFinite(Rn)?Rn:null;const ar=Number($e==null?void 0:$e.availableForTrade);if(Number.isFinite(ar))return ar;if(Number.isFinite(Rn))return Rn;if(!Sn||Sn.balance==null)return null;const Tr=Number(Sn.balance);return Number.isFinite(Tr)?Tr:null},[$e,Sn,ge==null?void 0:ge.apiKey,ge==null?void 0:ge.id,ct]);h.useEffect(()=>{if(!(ge!=null&&ge.apiKey)){Ye(null);return}let lt=!1;const Nt=async()=>{var ar,Tr,Lr;try{const $r=`${d1n}${encodeURIComponent(`${f1n}/user/balance`)}`,wr=await(await fetch($r,{headers:{"X-Api-Key":ge.apiKey}})).json().catch(()=>null);if(!lt){const ss=((ar=wr==null?void 0:wr.data)==null?void 0:ar.availableForTrade)??(wr==null?void 0:wr.availableForTrade)??((Tr=wr==null?void 0:wr.data)==null?void 0:Tr.available_balance)??(wr==null?void 0:wr.available_balance)??((Lr=wr==null?void 0:wr.data)==null?void 0:Lr.available)??(wr==null?void 0:wr.available),mr=Number(ss);Ye({availableForTrade:Number.isFinite(mr)&&mr>=0?mr:null,raw:wr})}}catch{lt||Ye(null)}};Nt();const Rn=setInterval(Nt,2e4);return()=>{lt=!0,clearInterval(Rn)}},[ge==null?void 0:ge.apiKey]);const Xn=(lt,Nt)=>{var fr,_r,pr,hr;const Rn=lt.priceRange||{},Tr=(Array.isArray(lt.gridPrices)?lt.gridPrices:[]).map(Xr=>Xr&&typeof Xr=="object"&&Xr.price!=null?Number(Xr.price):Number(Xr)).filter(Xr=>Number.isFinite(Xr));let Lr=Rn.lower,$r=Rn.upper;(!Number.isFinite(Lr)||!Number.isFinite($r))&&Tr.length>=2&&(Lr=Tr[0],$r=Tr[Tr.length-1]),Number.isFinite(Lr)?f(String(Lr)):f(""),Number.isFinite($r)?g(String($r)):g("");let cr=lt.gridType;cr!=="geometric"&&cr!=="arithmetic"&&(cr="arithmetic"),F(cr);const wr=lt.grid_side_mode??lt.gridSideMode??lt.gridSide??lt.sideMode??null,ss=String(wr||"").toLowerCase(),mr=lt.grid_count_base??lt.gridCountBase??lt.grid_count_input??lt.gridCountInput??null,ts=Number(mr);let Qs=lt.gridCount;Number.isFinite(Qs)||Tr.length>=2&&(Qs=Tr.length);const Es=ss&&ss!=="neutral"&&Number.isFinite(ts)?ts:Qs;Number.isFinite(Es)?(v(Es),N(String(Es))):(v(2),N("2")),u(ss==="short"||ss==="short_only"?"short":ss==="long"||ss==="long_only"?"long":"neutral");const br=lt.investment||{};br&&br.leverage!=null&&Number.isFinite(Number(br.leverage))&&ee(Number(br.leverage));const Zt=br.wallet_balance??br.walletBalance??br.balance??br.available_balance??br.availableBalance??null,me=(br==null?void 0:br.collateral_input)??(br==null?void 0:br.collateralInput)??(br==null?void 0:br.collateral)??(br==null?void 0:br.collateral_used)??(br==null?void 0:br.collateralUsed)??(br==null?void 0:br.collateralEffective)??null,dt=Number(me);if(br&&Number.isFinite(dt)){const{num:Xr,str:is}=nn(dt);L(is),Ut.current=Xr;const Pr=br.percentChosen!=null?Number(br.percentChosen):br.percent!=null?Number(br.percent):null,yr=Pr!=null&&Number.isFinite(Pr),nr=Number(Zt);if(yr)Q(Math.max(0,Math.min(100,Pr))),hn.current=!1;else{const gs=Number.isFinite(nr)&&nr>0?nr:Nt;if(gs&&gs>0&&Xr>0){const ei=Xr/gs*100;Q(Math.max(0,Math.min(100,ei))),hn.current=!1}else Q(0),hn.current=Xr>0}}else L(""),Q(0),Ut.current=null,hn.current=!1;const _t=lt.trailing_up??((fr=lt==null?void 0:lt.trailing)==null?void 0:fr.up),At=lt.trailing_down??((_r=lt==null?void 0:lt.trailing)==null?void 0:_r.down),xn=lt.sl_up??((pr=lt==null?void 0:lt.sl)==null?void 0:pr.up),Cn=lt.sl_down??((hr=lt==null?void 0:lt.sl)==null?void 0:hr.down);ht(_t!=null&&Number.isFinite(Number(_t))?String(_t):""),st(At!=null&&Number.isFinite(Number(At))?String(At):""),Ve(xn!=null&&Number.isFinite(Number(xn))?String(xn):""),xt(Cn!=null&&Number.isFinite(Number(Cn))?String(Cn):""),St(_t!=null&&Number.isFinite(Number(_t))),cn(At!=null&&Number.isFinite(Number(At))),tn(xn!=null&&Number.isFinite(Number(xn))),rn(Cn!=null&&Number.isFinite(Number(Cn)))};h.useEffect(()=>{if(!hn.current)return;const lt=Number(Ut.current),Nt=Number(Yn);if(!Number.isFinite(lt)||lt<=0||!Number.isFinite(Nt)||Nt<=0)return;const Rn=lt/Nt*100;Q(Math.max(0,Math.min(100,Rn))),hn.current=!1},[Yn]),h.useEffect(()=>{if(typeof window>"u")return;if(!t||!(ge!=null&&ge.id)||!(ge!=null&&ge.address)){re(!1),Vt();return}let lt=!1;async function Nt(){G(!0);try{const Rn=window.localStorage.getItem("hyperToken");if(!Rn){lt||(re(!1),Vt(),G(!1));return}const ar={address:window.localStorage.getItem("hyperAddress"),token:Rn,wallet_id:Number(ge.id),source_market:"extended",coin:String(t||"").toUpperCase()},Lr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ar)})).json().catch(()=>null);if(lt)return;if(mn.current){mn.current=!1,G(!1);return}const $r=Lr&&Lr.data?Lr.data:Lr,wr=(Array.isArray($r)?$r:[$r]).filter(Boolean).filter(mr=>mr&&typeof mr=="object"&&String(mr.coin||"").toUpperCase()===String(t||"").toUpperCase()&&String(mr.wallet_id||"")===String(ge.id||"")),ss=wr.find(mr=>mr&&typeof mr=="object"&&mr.is_deleted===!1&&mr.bot_params)||wr.find(mr=>mr&&typeof mr=="object"&&mr.is_deleted!==!0&&mr.bot_params)||null;if(ss){if(ss.wallet_id&&String(ss.wallet_id)!==String(ge.id)){const mr=ct.find(ts=>String(ts.wallet_id)===String(ss.wallet_id));if(mr){const ts={id:mr.wallet_id,address:mr.wallet_address,apiKey:mr.wallet_api_key};Ce(ts),typeof s=="function"&&s({id:String(ts.id),address:ts.address,apiKey:ts.apiKey})}}Xn(ss.bot_params,Yn),re(!0)}else re(!1),Vt(),f(""),g("")}catch{re(!1),Vt(),f(""),g("")}finally{lt||G(!1)}}return Nt(),()=>{lt=!0}},[t,ge==null?void 0:ge.id,ge==null?void 0:ge.address,nt,ct,s]),h.useEffect(()=>{if(typeof window>"u")return;const lt=window.localStorage.getItem("gridbot:pending_selection");if(!lt)return;let Nt=null;try{Nt=JSON.parse(lt)}catch{Nt=null}if(!(!Nt||Nt.sourceMarket&&Nt.sourceMarket!=="extended"||String(Nt.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(mn.current=!0,Xn(Nt.botParams||{},Yn),Nt.isActive===!0?re(!0):Nt.isActive===!1&&re(!1),Nt.walletId&&ct&&ct.length){const Rn=ct.find(ar=>String(ar.wallet_id)===String(Nt.walletId));if(Rn){const ar={id:Rn.wallet_id,address:Rn.wallet_address,apiKey:Rn.wallet_api_key};Ce(ar),typeof s=="function"&&s({id:String(ar.id),address:ar.address,apiKey:ar.apiKey})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,ct,s,Yn]),h.useEffect(()=>{const lt=Nt=>{const Rn=Nt&&Nt.detail&&Nt.detail.sourceMarket;Rn&&Rn!=="extended"||it(ar=>ar+1)};return window.addEventListener("gridbotUpdated",lt),()=>{window.removeEventListener("gridbotUpdated",lt)}},[]),h.useEffect(()=>{const lt=Nt=>{const Rn=Nt&&Nt.detail;if(!Rn)return;const ar=Rn.sourceMarket||Rn.source_market;if(ar&&ar!=="extended"||String(Rn.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const Lr=Rn.botParams||{};if(Xn(Lr,Yn),mn.current=!0,Rn.isActive===!0?re(!0):Rn.isActive===!1&&re(!1),Rn.walletId&&ct&&ct.length){const $r=ct.find(cr=>String(cr.wallet_id)===String(Rn.walletId));if($r){const cr={id:$r.wallet_id,address:$r.wallet_address,apiKey:$r.wallet_api_key};Ce(cr),typeof s=="function"&&s({id:String(cr.id),address:cr.address,apiKey:cr.apiKey})}}};return window.addEventListener("gridbotSelectFromTasks",lt),()=>{window.removeEventListener("gridbotSelectFromTasks",lt)}},[t,ct,s]);const zn=h.useMemo(()=>Math.min(q,Math.max(1,Number(se)||1)),[se,q]),Kn=(()=>{const lt=Number($);return!Number.isFinite(lt)||lt<=0?0:lt>=3?lt*.99:lt})(),jn=Number($)||0,De=h.useMemo(()=>{const lt=Number(d),Nt=Number(x);return!Number.isFinite(lt)||!Number.isFinite(Nt)?null:(lt+Nt)/2},[d,x]),pe=h.useMemo(()=>{if(_n>0)return _n;const lt=Number(e||0);if(lt>0)return lt;const Nt=Number(n||0);return Nt>0?Nt:De!=null&&De>0?De:0},[_n,e,n,De]),qe=Number.isFinite(pe)&&pe>0?pe:De,Ae=h.useMemo(()=>h1n(d,x,y,Kn,M,zn),[d,x,y,Kn,M,zn]),ze=h.useMemo(()=>{const lt=Ae.map((ss,mr)=>{const ts=Number(ss==null?void 0:ss.price);return Number.isFinite(ts)?{index:Number.isFinite(ss==null?void 0:ss.index)?ss.index:mr,price:ts}:null}).filter(Boolean);if(!lt.length)return[];const Nt=Kn*zn,Rn=Number.isFinite(qe)&&qe>0?qe:null;let ar=0,Tr=0;if(Rn!=null)for(const ss of lt)ss.price>=Rn?Tr+=1:ar+=1;else ar=lt.length;let Lr=lt.length;c==="long"?Lr=ar+Tr*2:c==="short"&&(Lr=Tr+ar*2),(!Number.isFinite(Lr)||Lr<=0)&&(Lr=lt.length);const $r=Lr>0?Nt/Lr:0,cr=De??0,wr=M==="geometric";return lt.map(ss=>{const mr=wr?ss.price>0?$r/ss.price:0:cr>0?$r/cr:0;return{index:ss.index,price:ss.price,qty:mr,order_size_usd:$r}})},[Ae,Kn,zn,De,M,c,qe]),zt=h.useMemo(()=>ze.length?ze.map(lt=>({price:lt.price,side:qe==null?null:Number(lt.price)>=qe?"sell":"buy"})):[],[ze,qe]);h.useEffect(()=>{typeof a=="function"&&a(zt)},[zt,a]);const kt=lt=>{const Nt=Number(lt);if(!(Nt>0))return;const Rn=Nt*.01;f((Nt-Rn).toFixed(2)),g((Nt+Rn).toFixed(2))},gt=pe,Mt=Kn*zn,ln=ze.length,vn=h.useMemo(()=>{if(!ze.length)return 0;let lt=0,Nt=0;for(const Rn of ze){const ar=Number(Rn==null?void 0:Rn.qty);Number.isFinite(ar)&&(lt+=ar,Nt+=1)}return Nt?lt/Nt:0},[ze]),Wn=Number(yn==null?void 0:yn.collateralAssetPrecision),On=Number(yn==null?void 0:yn.assetPrecision),$t=(ir=yn==null?void 0:yn.tradingConfig)==null?void 0:ir.minOrderSizeChange,Nn=(()=>{const lt=Number($t);if(!Number.isFinite(lt))return null;const[,Nt=""]=String($t).split(".");return Math.max(0,Nt.length)})(),Fn=Number.isFinite(Wn)?Wn:Number.isFinite(On)?On:4,Tt=Nn!=null&&Number.isFinite(Nn)?Nn:Fn,pn=Number((ls=yn==null?void 0:yn.tradingConfig)==null?void 0:ls.minPriceChange),ke=h.useMemo(()=>Number.isFinite(pn)&&pn>0?pn>=1?0:Math.min(8,Math.max(0,-Math.floor(Math.log10(pn)))):p1n(pe),[pn,pe]),m=ke,p=Number(((cs=yn==null?void 0:yn.tradingConfig)==null?void 0:cs.minOrderSize)??0),S=0,A=vn>0?Number(vn.toFixed(Tt)):0,k=h.useMemo(()=>ze.some(lt=>Number(lt==null?void 0:lt.qty)>0),[ze]),T=k&&p>0&&ze.some(lt=>{const Nt=Number(lt==null?void 0:lt.qty);return Number.isFinite(Nt)?Nt<p:!1}),D=k&&S>0,V=h.useMemo(()=>{if(!k||ze.length===0)return 0;let lt=1/0;for(const Nt of ze){const Rn=Number(Nt==null?void 0:Nt.price),ar=Number(Nt==null?void 0:Nt.qty);if(!Number.isFinite(Rn)||!Number.isFinite(ar))continue;if(Rn<=0||ar<=0){lt=0;break}const Tr=Rn*ar;Tr<lt&&(lt=Tr)}return lt===1/0?0:lt},[k,ze]),X=k&&V<u1n,le=pe>0&&Mt>0&&Kn>0?wje({entry:pe,side:"buy",notionalUSD:Mt,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Kn,isolatedMarginUSD:Kn}):null,ce=pe>0&&Mt>0&&Kn>0?wje({entry:pe,side:"sell",notionalUSD:Mt,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Kn,isolatedMarginUSD:Kn}):null,fe=h.useMemo(()=>{if(!d&&!x)return"";const lt=Number(d),Nt=Number(x);if(!Number.isFinite(lt)||!Number.isFinite(Nt))return"";if(!(Nt>lt))return"Upper price must be greater than lower price.";if(gt>0){if(lt>gt)return`Lower price cannot be above mark price (${gt.toFixed(ke)}).`;if(Nt<gt)return`Upper price cannot be below mark price (${gt.toFixed(ke)}).`}return""},[d,x,gt,ke]),ye=h.useMemo(()=>{const lt=Number(d),Nt=Number(x);return!(!Number.isFinite(lt)||!Number.isFinite(Nt)||!(Nt>lt)||gt>0&&(lt>gt||Nt<gt))},[d,x,gt]),Pe=Number(d),Me=Number(x),Ke=Number(Je),we=Number(rt),Te=Number(He),te=Number(bt),ve=Qt&&(Je===""||!Number.isFinite(Ke)||!(Ke>Me)),Be=on&&(rt===""||!Number.isFinite(we)||!(we<Pe));h.useEffect(()=>{Qt||ht(""),on||st("")},[Qt,on]),h.useEffect(()=>{Vn||Ve(""),fn||xt("")},[Vn,fn]);const Ue=Vn&&(He===""||!Number.isFinite(Te)||!Qt&&Number.isFinite(Me)&&!(Te>Me)||Qt&&Number.isFinite(Ke)&&!(Te>Ke)),Fe=fn&&(bt===""||!Number.isFinite(te)||!on&&Number.isFinite(Pe)&&!(te<Pe)||on&&Number.isFinite(we)&&!(te<we)),at=ln>1&&ye&&Kn>0&&zn>0&&(ge==null?void 0:ge.id)&&(ge==null?void 0:ge.address),ut=ne>0,yt=!!I,Lt=T||D,Gt=ve||Be||Ue||Fe,an=at&&!de&&!ie&&!un&&!ut&&!yt&&!Lt&&!X&&!Gt,et=ie||de||un||yt||Lt||X||ut||Gt?!1:K?!0:at,Pt=K||ie||de||un;h.useEffect(()=>{if(!ne)return;const lt=setInterval(()=>oe(Nt=>Nt>1?Nt-1:0),1e3);return()=>clearInterval(lt)},[ne]);const qt=()=>{if(Pt)return;const lt=_n>0?_n:pe>0?pe:Number(e||n||0);!Number.isFinite(lt)||lt<=0||kt(lt)},ft=lt=>{if(Pt)return;hn.current=!1;const Nt=Math.max(0,Math.min(100,Number(lt)||0));if(Q(Nt),!Yn||Yn<=0){Nt===0&&L("");return}const Rn=Yn*Nt/100;nn(Rn),L(Number.isFinite(Rn)?Rn.toFixed(2):"")},tt=lt=>{if(Pt)return;hn.current=!1;const Nt=Number(lt);if(L(lt),!Yn||!Number.isFinite(Nt)||Nt<=0||Yn<=0){Q(0);return}const Rn=(Nt>=3?Nt*.99:Nt)/Yn*100;Q(Math.max(0,Math.min(100,Rn)))},Bt=async()=>{if(!an||typeof window>"u"||!(ge!=null&&ge.address)||!(ge!=null&&ge.id))return;const lt=ze.filter(Es=>Number.isFinite(Es==null?void 0:Es.price));if(lt.length<2)return;const Nt=lt[0],Rn=lt[lt.length-1],ar=lt.length,Tr=ar>1?ar-1:0,Lr=M!=="geometric"&&Tr>0?(Rn.price-Nt.price)/Tr:null,$r=M==="geometric"&&Tr>0?Math.pow(Rn.price/Nt.price,1/Tr):null,cr=(Nt.price+Rn.price)/2,wr=window.localStorage.getItem("hyperToken");if(!wr)return;if(Qt&&ve){dn.error("Trailing Up is invalid.");return}if(on&&Be){dn.error("Trailing Down is invalid.");return}if(Vn&&Ue){const Es=Qt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";dn.error(Es);return}if(fn&&Fe){const Es=on?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";dn.error(Es);return}const ss=A,mr=QQ(t),ts={symbol:String(t||"").toUpperCase(),dex:mr,gridType:M==="geometric"?"geometric":"arithmetic",direction:c,grid_side_mode:c,grid_count_base:y,priceRange:{lower:Number(Nt.price.toFixed(m)),upper:Number(Rn.price.toFixed(m)),middle:Number(cr.toFixed(m))},gridCount:ar,gridPrices:lt.map(Es=>({price:Number(Es.price.toFixed(m)),qty:Number(Number(Es.qty||0).toFixed(Tt))})),trailing_up_grid_prices:(()=>{if(!(Qt&&!ve&&Number.isFinite(Ke)))return[];const Es=[];if(M==="geometric"&&$r&&$r>0){let br=Rn.price*$r,Zt=0;for(;br<=Ke+1e-12&&Zt<500;){const me=(pe>0,A);Es.push({price:Number(br.toFixed(m)),qty:Number(me.toFixed(Tt))}),br*=$r,Zt+=1}}else if(Lr&&Lr>0)for(let br=Rn.price+Lr,Zt=0;br<=Ke+1e-12&&Zt<500;br+=Lr,Zt+=1)Es.push({price:Number(br.toFixed(m)),qty:Number(A.toFixed(Tt))});return Es})(),trailing_down_grid_prices:(()=>{if(!(on&&!Be&&Number.isFinite(we)))return[];const Es=[];if(M==="geometric"&&$r&&$r>0){let br=Nt.price/$r,Zt=0;for(;br>=we-1e-12&&Zt<500;)Es.push({price:Number(br.toFixed(m)),qty:Number(A.toFixed(Tt))}),br/=$r,Zt+=1}else if(Lr&&Lr>0)for(let br=Nt.price-Lr,Zt=0;br>=we-1e-12&&Zt<500;br-=Lr,Zt+=1)Es.push({price:Number(br.toFixed(m)),qty:Number(A.toFixed(Tt))});return Es})(),investment:{collateral:jn,collateralUsed:Kn,percentChosen:z,leverage:zn,totalInvestment:Kn,qtyPerOrder:ss},liquidationPrices:{long:le?Number(le.toFixed(2)):null,short:ce?Number(ce.toFixed(2)):null},trailing_up:Qt&&!ve?Number(Ke.toFixed(m)):null,trailing_down:on&&!Be?Number(we.toFixed(m)):null,sl_up:Vn&&!Ue?Number(Te.toFixed(m)):null,sl_down:fn&&!Fe?Number(te.toFixed(m)):null,marginMode:"Cross",currentPrice:pe||null,timestamp:new Date().toISOString()},Qs={address:window.localStorage.getItem("hyperAddress"),token:wr,wallet_id:Number(ge.id),source_market:"extended",bot_params:ts,coin:String(t||"").toUpperCase()};ae(!0);try{const br=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qs)})).json().catch(()=>null);if(!(br&&(br.success===!0||br.status==="ok"||br.status==="success"))){const me=br&&(br.error_message||br.message||br.detail)||"Grid bot failed to start.";dn.error(me);return}re(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),dn.success("Grid bot started.")}catch{dn.error("An error occurred while starting the grid bot.")}finally{ae(!1)}},gn=async()=>{if(typeof window>"u"||!(ge!=null&&ge.address)||!(ge!=null&&ge.id))return;const lt=window.localStorage.getItem("hyperToken");if(!lt)return;QQ(t);const Nt={address:window.localStorage.getItem("hyperAddress"),token:lt,wallet_id:Number(ge.id),source_market:"extended",coin:String(t||"").toUpperCase()};ae(!0);try{const ar=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Nt)})).json().catch(()=>null);if(!(ar&&(ar.success===!0||ar.status==="ok"||ar.status==="success"))){const Lr=ar&&(ar.error_message||ar.message||ar.detail)||"Grid bot could not be stopped.";dn.error(Lr);return}re(!1),oe(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),dn.success("Grid bot has been stopped.")}catch{dn.error("An error occurred while stopping the grid bot.")}finally{ae(!1)}},tr=()=>{et&&(K?gn():Se(!0))},Dn=async()=>{an&&(Se(!1),await Bt())},er=ie?K?"Stopping...":"Starting...":K?"Stop":ut?`Stopping ${ne}s`:"Start",Sr=["xyz","vntl","flx"].includes(QQ(t))?"Isolated":"Cross",dr=Qt&&!ve,kr=on&&!Be,qn=Vn&&!Ue,Tn=fn&&!Fe,$n=[{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(oI,{wallets:ct,mode:"extended",value:ge&&ge.id?String(ge.id):"",onChange:lt=>{const Nt=(ct||[]).find(Rn=>String(Rn.wallet_id)===String(lt))||null;if(Nt){const Rn={id:Nt.wallet_id,address:Nt.wallet_address,apiKey:Nt.wallet_api_key};Ce(Rn),typeof s=="function"&&s({id:String(Rn.id),address:Rn.address,apiKey:Rn.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:$n.map(lt=>{const Nt=c===lt.key;return i.jsx("button",{type:"button",onClick:()=>{Pt||u(lt.key)},disabled:Pt,"aria-pressed":Nt,className:`h-8 rounded-lg border text-[11px] font-semibold transition-colors ${Pt?"opacity-60 cursor-not-allowed":"cursor-pointer"} ${Nt?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:qt,disabled:Pt,className:"text-[11px] px-2 py-0.5 rounded-md bg-[#161616] border border-[#292929] text-white/60 hover:text-white disabled:opacity-60 disabled:cursor-not-allowed",children:"Autofill"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Lower"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:d,onChange:lt=>{Pt||f(lt.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pt})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Upper"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:x,onChange:lt=>{Pt||g(lt.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pt})})]})]}),gt>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",gt.toFixed(ke)]}),fe&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:fe})]}),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(Pt)return;const Nt=lt.target.value.replace(/[^\d]/g,"");if(N(Nt),P(""),Nt==="")return;const Rn=Number(Nt);if(Number.isFinite(Rn)){if(Rn<2){P("The minimum number of grids must be 2.");return}if(Rn>200){P("The maximum number of grids is 200.");return}if(Rn%2!==0){P("The number of grids must be even.");return}v(Rn)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:Pt})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:M,onChange:lt=>{Pt||F(lt.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:Pt,children:c1n.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:I&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:I})})]}),(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(Us,{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=>tt(lt.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:Pt}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"USDC"})]}),i.jsx("div",{className:"flex flex-col gap-1 w-[120px]",children:i.jsx(H4,{onClick:q&&q>0&&!Pt?()=>_e(!0):void 0,children:q&&q>0?`${zn}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 !mt-4 pb-6",children:[i.jsx(wj,{value:z,onChange:lt=>ft(lt),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:z,onChange:lt=>ft(Math.max(0,Math.min(100,Number(lt.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:Pt}),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,": ",`${q}x`]}),i.jsxs("span",{children:["Total:"," ",Mt>0?`${Mt.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: ",Sr]})]})]}),i.jsxs("section",{className:"pt-2 border-t border-[#292929]",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-2",children:[i.jsx("span",{children:"Est. Liq Long"}),i.jsx("span",{children:le?`$${le.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:ce?`$${ce.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),Ge?i.jsx(om,{onClick:()=>typeof o=="function"?o(!0):null}):i.jsx("button",{type:"button",onClick:tr,disabled:!et,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${et?K?"bg-[#FF7173] text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90":"bg-[#303030] text-white/40 cursor-not-allowed opacity-70"}`,children:er}),T&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",p," ",t,")."]}),D,X&&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."}),Gt&&i.jsx("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:"Fix trailing/SL input errors to start."})]})]})]}),i.jsx(lp,{open:he,onClose:()=>_e(!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 ",q,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:q||1,step:1,value:se,onChange:lt=>ee(Math.max(1,Math.min(q||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:Lo,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:se,onChange:lt=>{const Nt=Number(lt.target.value)||1,Rn=Math.max(1,Math.min(q||1,Nt));ee(Rn)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>_e(!1),children:"Confirm"})]})}),i.jsx(lp,{open:xe,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:Sr}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-[#FF71731a] text-[#FF7173]",children:["Leverage ",zn,"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:Bi},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:Bi},children:ln||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:M==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:A>0?`${A} ${t}`:"--"})]}),dr&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Trailing Up"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(Je).toFixed(m)," USDC"]})]}),kr&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"Trailing Down"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(rt).toFixed(m)," USDC"]})]}),qn&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"SL Up"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(He).toFixed(m)," USDC"]})]}),Tn&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:Si},children:"SL Down"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(bt).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:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:Mt>0?`${Mt.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:Dn,disabled:ie,children:ie?"Starting...":"Confirm"})})]})})]})}const Cj="/assets/fee-animation-Cvx53PQy.mp4",m1n="wss://mainnet.zklighter.elliot.ai/stream",x1n="https://api.hyperliquid.xyz/info",JD=t=>t==null?0:Number(t),eB=(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})},b1n=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}}},v1n=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};async function w1n(t){var o;const n=await fetch(x1n,{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 C1n(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 S1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function N1n(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(S1n),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 Sje(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 j1n(t){if(!t)return[];const e=String(t).trim(),n=v1n(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await w1n(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=C1n(s);let c=N1n(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:Sje(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),Sje(e)}}function Nje(t,e,n){const r=new Map;for(const s of t||[]){const a=JD(s.px),o=JD(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 A1n({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),[N,I]=h.useState([]),P=(ae,q)=>g==="USD"?ae*q:ae,M=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 ae=c.current;if(!((ae==null?void 0:ae.bids)instanceof Map)||!((ae==null?void 0:ae.asks)instanceof Map))return;const q=512,W=Array.from(ae.bids.entries()).map(([oe,he])=>({px:oe,sz:he})).sort((oe,he)=>he.px-oe.px).slice(0,q),ne=Array.from(ae.asks.entries()).map(([oe,he])=>({px:oe,sz:he})).sort((oe,he)=>oe.px-he.px).slice(0,q);x({bids:W,asks:ne})}))},$=ae=>{if(ae==null)return;const q=a.current;if(q&&(q.readyState===WebSocket.OPEN||q.readyState===WebSocket.CONNECTING))return;const W=new WebSocket(m1n);a.current=W,W.onopen=()=>{l.current=0;const ne={type:"subscribe",channel:`order_book/${String(ae)}`};try{W.send(JSON.stringify(ne))}catch{}},W.onmessage=ne=>{let oe;try{oe=JSON.parse(ne.data||"{}")}catch{return}if((oe==null?void 0:oe.type)!=="update/order_book")return;const he=`order_book:${String(ae)}`;if(oe.channel!==he)return;const _e=oe.order_book;if(!_e)return;let xe=c.current;(!xe||typeof xe!="object")&&(xe={bids:new Map,asks:new Map},c.current=xe),xe.bids instanceof Map||(xe.bids=new Map),xe.asks instanceof Map||(xe.asks=new Map);const Se=(ge,Ce)=>{const je=Array.isArray(_e[ge])?_e[ge]:[];if(je.length)for(const Oe of je){const $e=Number(Oe.price),Ye=Number(Oe.size);Number.isFinite($e)&&(!Number.isFinite(Ye)||Ye<=0?Ce.delete($e):Ce.set($e,Ye))}};Se("bids",xe.bids),Se("asks",xe.asks),F()},W.onclose=()=>{l.current=Math.min(l.current+1,6),!o.current&&(o.current=setTimeout(()=>{o.current=null,$(ae)},500*Math.pow(2,l.current)))},W.onerror=()=>{try{W.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:[]}),I([]),C(null),t==null)return;$(t);let ae=!1;return(async()=>{const q=await j1n(e||"");ae||(I(q),C(q[0]??null))})(),()=>{ae=!0}},[t,e]);const L=h.useMemo(()=>(f.bids||[]).map(ae=>JD(ae.px)).filter(ae=>Number.isFinite(ae)&&ae>0),[f]),z=h.useMemo(()=>(f.asks||[]).map(ae=>JD(ae.px)).filter(ae=>Number.isFinite(ae)&&ae>0),[f]),Q=L.length?Math.max(...L):null,se=z.length?Math.min(...z):null;h.useEffect(()=>{Q!=null&&se!=null&&(s==null||s({bestBid:Q,bestAsk:se,mid:(Q+se)/2}))},[Q,se,s]);const ee=h.useMemo(()=>{const ae=Number(v)||1,q=Nje(f.bids,ae,"bid").sort((ne,oe)=>oe.price-ne.price),W=Nje(f.asks,ae,"ask").sort((ne,oe)=>ne.price-oe.price);return{bids:q,asksAsc:W}},[f,v]),K=h.useMemo(()=>{const ae=ee.asksAsc.slice(0,n);let q=0;return ae.map(ne=>(q+=P(ne.size,ne.price),{...ne,total:q})).reverse()},[ee,n,g]),re=h.useMemo(()=>{const ae=ee.bids.slice(0,n);let q=0;return ae.map(W=>(q+=P(W.size,W.price),{...W,total:q}))},[ee,n,g]),de=h.useMemo(()=>{if(Q==null||se==null)return null;const ae=Math.abs(se-Q),q=(se+Q)/2;return{diff:ae,pct:q?ae/q*100:0}},[Q,se]),G=Math.max(K.reduce((ae,q)=>Math.max(ae,q.total||0),0),1e-9),ie=Math.max(re.reduce((ae,q)=>Math.max(ae,q.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(Aje,{value:String(v??""),onChange:ae=>C(Number(ae)),items:(N||[]).map(ae=>({key:String(ae),label:b1n(ae)}))}),i.jsx(Aje,{value:g,onChange:y,items:[{key:"USD",label:"USD"},{key:"COIN",label:e||"COIN"}],align:"right"})]}),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] w-full",children:[i.jsx("span",{className:"uppercase",children:"Price"}),i.jsxs("span",{className:"uppercase text-center",children:["Size (",M,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",M,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[K.map((ae,q)=>i.jsx(jje,{side:"ask",step:Number(v)||1,price:ae.price,size:ae.size!=null?P(ae.size,ae.price):null,total:ae.total,widthPct:ae.total?Math.min(100,ae.total/G*100):0,onClick:()=>ae.price!=null&&(r==null?void 0:r(ae.price)),unit:g},`ask-${q}`)),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:de?eB(de.diff,4):"--"}),i.jsx("span",{className:"text-right",children:de?`${eB(de.pct,4)}%`:"--"})]}),re.map((ae,q)=>i.jsx(jje,{side:"bid",step:Number(v)||1,price:ae.price,size:ae.size!=null?P(ae.size,ae.price):null,total:ae.total,widthPct:ae.total?Math.min(100,ae.total/ie*100):0,onClick:()=>ae.price!=null&&(r==null?void 0:r(ae.price)),unit:g},`bid-${q}`))]})})]})}function jje({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?"—":g1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":eB(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":eB(r,f?0:6)})]})]})}function Aje({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},_je=(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})},Eje=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),_1n=(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})},E1n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},k1n={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}}},T1n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=k1n[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null};function I1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function P1n(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(I1n),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 kje(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 F1n(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 O1n(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 M1n({apiBaseUrl:t,market:e,baseSymbol:n}){var s,a,o,l;const r=T1n(n);if(r&&r.length)return r;try{const c=await F1n(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=P1n(d,u);return f=Array.from(new Set(f.filter(x=>Number.isFinite(x)&&x>0))).sort((x,g)=>x-g),f.length?f:kje(n)}catch{return kje(n)}}function Tje(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 R1n({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 _e;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:[]}),[N,I]=h.useState("COIN"),[P,M]=h.useState(null),[F,$]=h.useState([]),L=(xe,Se)=>N==="USD"?xe*Se:xe,z=N==="USD"?"USD":e?String(e):"COIN";h.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]);const Q=()=>{g.current||(g.current=!0,requestAnimationFrame(()=>{if(g.current=!1,!y.current)return;const xe=x.current;if(!((xe==null?void 0:xe.bids)instanceof Map)||!((xe==null?void 0:xe.asks)instanceof Map))return;const Se=1024,ge=Array.from(xe.bids.entries()).map(([je,Oe])=>({px:je,sz:Oe})).sort((je,Oe)=>Oe.px-je.px).slice(0,Se),Ce=Array.from(xe.asks.entries()).map(([je,Oe])=>({px:je,sz:Oe})).sort((je,Oe)=>je.px-Oe.px).slice(0,Se);C({bids:ge,asks:Ce})}))},se=(xe,Se)=>{const ge=x.current||{bids:new Map,asks:new Map};ge.bids=new Map,ge.asks=new Map,x.current=ge;for(const Ce of xe||[]){const je=sd((Ce==null?void 0:Ce.p)??(Ce==null?void 0:Ce.price)),Oe=sd((Ce==null?void 0:Ce.q)??(Ce==null?void 0:Ce.qty));if(!je||!Number.isFinite(Oe)||Oe<=1e-8)continue;const $e=Number(Oe.toFixed(12));$e>1e-8&&ge.bids.set(je,$e)}for(const Ce of Se||[]){const je=sd((Ce==null?void 0:Ce.p)??(Ce==null?void 0:Ce.price)),Oe=sd((Ce==null?void 0:Ce.q)??(Ce==null?void 0:Ce.qty));if(!je||!Number.isFinite(Oe)||Oe<=1e-8)continue;const $e=Number(Oe.toFixed(12));$e>1e-8&&ge.asks.set(je,$e)}},ee=(xe,Se)=>{for(const ge of xe||[]){const Ce=sd(ge==null?void 0:ge.p),je=sd(ge==null?void 0:ge.q);if(!Ce||!Number.isFinite(je)||je===0)continue;const $e=sd(Se.get(Ce)||0)+je;if(Math.abs($e)<=1e-8)Se.delete(Ce);else{const Ye=Number($e.toFixed(12));Ye<=0?Se.delete(Ce):Se.set(Ce,Ye)}}},K=xe=>{if(!xe)return;const Se=c.current;if(Se&&(Se.readyState===WebSocket.OPEN||Se.readyState===WebSocket.CONNECTING))return;const ge=`${o}/stream.extended.exchange/v1/orderbooks/${encodeURIComponent(xe)}`,Ce=new WebSocket(ge);c.current=Ce,Ce.onopen=()=>{d.current=0,f.current=null},Ce.onmessage=je=>{let Oe;try{Oe=JSON.parse(je.data||"{}")}catch{return}const $e=Number(Oe==null?void 0:Oe.seq);if(Number.isFinite($e)){const Ve=f.current;if(Ve!=null&&$e!==Ve+1){try{Ce.close()}catch{}return}f.current=$e}const Ye=String((Oe==null?void 0:Oe.type)||"").toUpperCase(),Je=Oe==null?void 0:Oe.data;if(!Je)return;const ht=Array.isArray(Je)?Je.find(Ve=>String(Ve==null?void 0:Ve.m)===String(xe)):Je;if(!ht||String(ht==null?void 0:ht.m)!==String(xe))return;const rt=String((ht==null?void 0:ht.t)||Ye).toUpperCase(),st=(ht==null?void 0:ht.b)||[],He=(ht==null?void 0:ht.a)||[];if(rt==="SNAPSHOT")se(st,He);else if(rt==="DELTA"){const Ve=x.current;Ve!=null&&Ve.bids||(Ve.bids=new Map),Ve!=null&&Ve.asks||(Ve.asks=new Map),ee(st,Ve.bids),ee(He,Ve.asks)}else return;Q()},Ce.onclose=()=>{d.current=Math.min(d.current+1,6),!u.current&&(u.current=setTimeout(()=>{u.current=null,K(xe)},500*Math.pow(2,d.current)))},Ce.onerror=()=>{try{Ce.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:[]}),$([]),M(null),!t)return;let xe=!1;return(async()=>{try{const Se=await O1n(a,t);if(xe)return;se(((Se==null?void 0:Se.bids)||[]).map(ge=>({price:ge.price,qty:ge.qty})),((Se==null?void 0:Se.asks)||[]).map(ge=>({price:ge.price,qty:ge.qty}))),Q()}catch{}})(),K(t),(async()=>{const Se=await M1n({apiBaseUrl:a,market:t,baseSymbol:e||t.split("-")[0]});xe||($(Se),M(Se[0]??null))})(),()=>{xe=!0}},[t,e,a,o]);const re=h.useMemo(()=>(v.bids||[]).map(xe=>sd(xe.px)).filter(xe=>Number.isFinite(xe)&&xe>0),[v]),de=h.useMemo(()=>(v.asks||[]).map(xe=>sd(xe.px)).filter(xe=>Number.isFinite(xe)&&xe>0),[v]),G=re.length?Math.max(...re):null,ie=de.length?Math.min(...de):null;h.useEffect(()=>{G!=null&&ie!=null&&(s==null||s({bestBid:G,bestAsk:ie,mid:(G+ie)/2}))},[G,ie,s]);const ae=h.useMemo(()=>{const xe=Number(P)||1,Se=Tje(v.bids,xe,"bid").sort((Ce,je)=>je.price-Ce.price),ge=Tje(v.asks,xe,"ask").sort((Ce,je)=>Ce.price-je.price);return{bids:Se,asksAsc:ge}},[v,P]),q=h.useMemo(()=>{const xe=ae.asksAsc.slice(0,n);let Se=0;return xe.map(Ce=>(Se+=L(Ce.size,Ce.price),{...Ce,total:Se})).reverse()},[ae,n,N]),W=h.useMemo(()=>{const xe=ae.bids.slice(0,n);let Se=0;return xe.map(ge=>(Se+=L(ge.size,ge.price),{...ge,total:Se}))},[ae,n,N]),ne=h.useMemo(()=>{if(G==null||ie==null)return null;const xe=Math.abs(ie-G),Se=(ie+G)/2;return{diff:xe,pct:Se?xe/Se*100:0}},[G,ie]),oe=Math.max(q.reduce((xe,Se)=>Math.max(xe,Se.total||0),0),1e-9),he=Math.max(W.reduce((xe,Se)=>Math.max(xe,Se.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(Pje,{value:String(P??""),onChange:xe=>M(Number(xe)),items:(F||[]).map(xe=>({key:String(xe),label:E1n(xe)}))}),i.jsx(Pje,{value:N,onChange:I,items:[{key:"USD",label:"USD"},{key:"COIN",label:e||((_e=t==null?void 0:t.split("-"))==null?void 0:_e[0])||"COIN"}],align:"right"})]}),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] w-full",children:[i.jsx("span",{className:"uppercase",children:"Price"}),i.jsxs("span",{className:"uppercase text-center",children:["Size (",z,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",z,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[q.map((xe,Se)=>i.jsx(Ije,{side:"ask",step:Number(P)||1,price:xe.price,size:xe.size!=null?L(xe.size,xe.price):null,total:xe.total,widthPct:xe.total?Math.min(100,xe.total/oe*100):0,onClick:()=>xe.price!=null&&(r==null?void 0:r(xe.price)),unit:N},`ask-${Se}`)),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:ne?Eje(ne.diff,4):"--"}),i.jsx("span",{className:"text-right",children:ne?`${Eje(ne.pct,4)}%`:"--"})]}),W.map((xe,Se)=>i.jsx(Ije,{side:"bid",step:Number(P)||1,price:xe.price,size:xe.size!=null?L(xe.size,xe.price):null,total:xe.total,widthPct:xe.total?Math.min(100,xe.total/he*100):0,onClick:()=>xe.price!=null&&(r==null?void 0:r(xe.price)),unit:N},`bid-${Se}`))]})})]})}function Ije({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?"—":_1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":_je(n,x)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":_je(r,x)})]})]})}function Pje({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 KF="#67FFBD",L1n={type:"spring",stiffness:260,damping:26,mass:1},Bqe=t=>{const e=Number(t);return Number.isFinite(e)?e:null},lg=(...t)=>{for(const e of t){const n=Bqe(e);if(n!=null)return n}return null},D1n=t=>{const e=Bqe(t);return e==null?null:Math.abs(e)>1?e/100:e};function O7({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 YF({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(ho.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(ho.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:Cj,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},Cj)]}),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:KF},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:KF},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:KF},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:KF},children:a})]})]})]})]})}function B1n({data:t,loading:e,error:n,coin:r,setCoin:s,period:a,periods:o,handlePeriodChange:l}){var vn,Wn,On,$t,Nn,Fn;const c=Ao(),u=Xl(),{exchange:d,coin:f}=g2(),{address:x,isConnected:g}=es(),{setSignInConnectButtonOpen:y}=h.useContext(Yr),[v,C]=h.useState("single"),[N,I]=h.useState("BTC/ETH"),[P,M]=h.useState([]),[F,$]=h.useState(2),[L,z]=h.useState("1m"),[Q,se]=h.useState(null),[ee,K]=h.useState(null),[re,de]=h.useState({}),[G,ie]=h.useState({id:null,address:null}),[ae,q]=h.useState(!1),[W,ne]=h.useState(!1),[oe,he]=h.useState(()=>typeof window>"u"||window.location.hash==="#gridbot"?"grid":window.location.hash==="#trade"?"trade":"grid"),[_e,xe]=h.useState([]),[Se,ge]=h.useState(()=>d==="lighter"?"lighter":d==="extended"?"extended":"hyperliquid"),[Ce,je]=h.useState(()=>r||f||"BTC"),[Oe,$e]=h.useState(()=>d==="lighter"&&f||"BTC"),[Ye,Je]=h.useState(()=>d==="extended"&&f||"BTC"),[ht,rt]=h.useState(null),[st,He]=h.useState(!1),[Ve,bt]=h.useState(null),[xt,Qt]=h.useState(!1),[St,on]=h.useState(null),[cn,Vn]=h.useState(!1),[tn,fn]=h.useState({address:null,token:null}),[rn,nt]=h.useState(!1),[it,Ut]=h.useState(!1),[hn,nn]=h.useState(!1),[Vt,pt]=h.useState(!1),[We,It]=h.useState(""),[Ge,ct]=h.useState(!1),[vt,Ht]=h.useState(""),Rt=h.useRef(null),mn=h.useRef(null),un=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,yn=Tt=>z(Tt),_n=yz(),In=ife(),Sn=afe(),Yn=Se==="hyperliquid"?_n:Se==="lighter"?In:Sn,Xn=Se==="hyperliquid"?!_n.length:Se==="lighter"?!In.length:!Sn.length,zn=Se==="hyperliquid"?Ce:Se==="lighter"?Oe:Ye,Kn=Se==="hyperliquid"&&v==="pair"?N:zn,jn=Se==="hyperliquid"&&v==="pair"&&N.split("/")[0]||Ce,De=h.useMemo(()=>Se==="lighter"&&zn?In.find(Tt=>Tt.symbol===zn):null,[Se,In,zn]),pe=(De==null?void 0:De.marketIndex)??(De==null?void 0:De.market_id)??(De==null?void 0:De.id)??((vn=De==null?void 0:De.raw)==null?void 0:vn.marketIndex)??((Wn=De==null?void 0:De.raw)==null?void 0:Wn.market_id)??((On=De==null?void 0:De.raw)==null?void 0:On.id)??null,qe=h.useMemo(()=>{if(!zn)return null;const Tt=String(zn||"").toUpperCase(),pn=Tt.replace(/-USD$/,"");return Sn.find(ke=>{const m=String((ke==null?void 0:ke.symbol)||"").toUpperCase(),p=String((ke==null?void 0:ke.rawSymbol)||"").toUpperCase();return m===Tt||p===Tt||m===pn||p===pn})||null},[Sn,zn]),Ae=h.useMemo(()=>{if(qe!=null&&qe.rawSymbol)return qe.rawSymbol;if(!zn)return"";const Tt=String(zn||"").toUpperCase();return Tt.includes("-")?Tt:`${Tt}-USD`},[qe,zn]),ze=h.useMemo(()=>qe!=null&&qe.symbol?qe.symbol:zn?String(zn||"").toUpperCase().replace(/-USD$/,"").replace(/\/USD$/,""):"",[qe,zn]),zt=h.useMemo(()=>{const Tt=(qe==null?void 0:qe.lastPrice)??(qe==null?void 0:qe.last);if(Tt!=null&&Number.isFinite(Number(Tt)))return Number(Tt);const pn=qe==null?void 0:qe.marketStats,ke=(pn==null?void 0:pn.lastPrice)??(pn==null?void 0:pn.markPrice)??(qe==null?void 0:qe.markPrice)??null;return ke!=null&&Number.isFinite(Number(ke))?Number(ke):null},[qe]);h.useEffect(()=>{u.hash==="#gridbot"?he("grid"):u.hash==="#trade"?he("trade"):u.hash||he("grid")},[u.hash]),h.useEffect(()=>{d==="lighter"&&Se!=="lighter"?ge("lighter"):d==="hyperliquid"&&Se!=="hyperliquid"?ge("hyperliquid"):d==="extended"&&Se!=="extended"&&ge("extended")},[d,Se]),h.useEffect(()=>{d==="hyperliquid"?f&&f!==Ce&&(je(f),s(f)):d==="lighter"?f&&f!==Oe&&$e(f):d==="extended"&&f&&f!==Ye&&Je(f)},[d,f,Ce,Oe,Ye,s]),h.useEffect(()=>{const Tt=()=>{if(typeof window>"u")return;const pn=window.localStorage.getItem("hyperAddress"),ke=window.localStorage.getItem("hyperToken");fn({address:pn,token:ke})};return Tt(),window.addEventListener("localStorageUpdated",Tt),window.addEventListener("storage",Tt),()=>{window.removeEventListener("localStorageUpdated",Tt),window.removeEventListener("storage",Tt)}},[]);const kt=h.useMemo(()=>!tn.address||!tn.token?!1:un?!0:x?tn.address.toLowerCase()===x.toLowerCase():!1,[tn.address,tn.token,x,un]);h.useEffect(()=>{if(!kt){nt(!1),Ut(!1),nn(!1),pt(!1),It(""),Ht("");return}if(rn)return;let Tt=!1;return(async()=>{if(typeof window>"u")return;const ke=window.localStorage.getItem("hyperToken"),m=window.localStorage.getItem("hyperAddress");if(!ke||!m){Tt||(nt(!0),Ut(!1),nn(!1));return}pt(!0);try{const p=await vi(m.toLowerCase(),ke);if(Tt)return;const S=(p==null?void 0:p.data)||p||{},A=(S==null?void 0:S.data)||S||{},k=A.grid_hyper_alpha_code??S.grid_hyper_alpha_code??!1,T=A.grid_lighter_alpha_code??S.grid_lighter_alpha_code??!1;Ut(!k),nn(!T),nt(!0)}catch{Tt||(Ut(!1),nn(!1),nt(!0))}finally{Tt||pt(!1)}})(),()=>{Tt=!0}},[kt,rn]),h.useEffect(()=>{kt&&nt(!1)},[Se,kt]),h.useEffect(()=>{(Se!=="lighter"||oe!=="grid")&&(It(""),Ht(""))},[Se,oe]);const gt=async()=>{var Tt,pn,ke,m;if(!We.trim()){dn.error("Please enter your alpha code");return}if(!tn.address||!tn.token){dn.error("Please sign in again");return}ct(!0),Ht("");try{const p={address:tn.address.toLowerCase(),token:tn.token,alpha_code:We.trim(),source_market:Se==="hyperliquid"?"hyper":"lighter",app_type:"grid_bot"},A=(await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",p)).data||{};if(A.success){const k=A.message||"Alpha code added successfully";dn.success(k),Ht(k),Se==="hyperliquid"?Ut(!1):Se==="lighter"&&nn(!1),nt(!0)}else{const k=A.error_message||A.message||"This alpha code is invalid";dn.error(k),Ht(k)}}catch(p){const S=((pn=(Tt=p==null?void 0:p.response)==null?void 0:Tt.data)==null?void 0:pn.error_message)||((m=(ke=p==null?void 0:p.response)==null?void 0:ke.data)==null?void 0:m.message)||p.message||"Failed to validate alpha code";dn.error(S),Ht(S)}finally{ct(!1)}};h.useEffect(()=>{Se==="hyperliquid"?s(Ce):Se==="lighter"?!Oe&&In.length>0&&$e(In[0].symbol):Se==="extended"&&!Ye&&Sn.length>0&&Je(Sn[0].symbol)},[Se,Ce,Oe,Ye,In,Sn,s]),h.useEffect(()=>{if(Se!=="extended"||!Sn.length)return;const Tt=Sn.some(pn=>pn.symbol===Ye);(!Ye||!Tt)&&Je(Sn[0].symbol)},[Se,Ye,Sn]),h.useEffect(()=>{if(!x){if(un&&tn.address){ie(Tt=>Tt.address&&Tt.address.toLowerCase()===tn.address.toLowerCase()?Tt:{id:null,address:tn.address});return}ie(Tt=>Tt.address?{id:null,address:null}:Tt);return}ie(Tt=>Tt.address&&Tt.address.toLowerCase()===x.toLowerCase()?Tt:{id:null,address:x})},[x,tn.address,un]),h.useEffect(()=>{if(Se!=="hyperliquid"){if(Rt.current){try{Rt.current.close()}catch{}Rt.current=null}M([]),mn.current=null;return}if(!jn)return;const Tt=(pn,ke)=>{if(pn)try{pn.readyState===WebSocket.OPEN&&pn.send(JSON.stringify(ke))}catch(m){console.error("activeAssetCtx ws send error",m)}};if(Rt.current){const pn=Rt.current;mn.current&&mn.current!==jn&&Tt(pn,{method:"unsubscribe",subscription:{type:"activeAssetCtx",coin:mn.current}}),Tt(pn,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:jn}})}else{const pn=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");Rt.current=pn,pn.onopen=()=>{Tt(pn,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:jn}})},pn.onmessage=ke=>{var p;let m;try{m=JSON.parse(ke.data)}catch(S){console.error("activeAssetCtx ws parse error",S);return}(p=m==null?void 0:m.data)!=null&&p.ctx&&M({...m.data.ctx,source:"hyperliquid"})},pn.onclose=()=>{Rt.current===pn&&(Rt.current=null)},pn.onerror=ke=>{console.error("activeAssetCtx ws error",ke)}}mn.current=jn},[jn,Se]),h.useEffect(()=>()=>{Rt.current&&(Rt.current.close(),Rt.current=null)},[]),h.useEffect(()=>{if(Se!=="lighter")return;if(!zn){M([]);return}const Tt=In.find(k=>k.symbol===zn);if(!Tt||!Tt.raw){M([]);return}const pn=Tt.raw,ke=Number(pn.last_trade_price??0)||0,m=Number(pn.daily_price_change??0)||0,p=Number(pn.daily_quote_token_volume??0)||0,S=Number(pn.open_interest??0)||0,A=m&&ke?ke/(1+m/100):ke;M({markPx:ke,oraclePx:ke,prevDayPx:A,dayNtlVlm:p,openInterest:S,funding:0,source:"lighter"})},[Se,zn,In]),h.useEffect(()=>{if(Se!=="extended")return;if(!qe){M([]);return}const Tt=qe.marketStats||{},pn=lg(Tt.markPrice,Tt.lastPrice,Tt.indexPrice,qe.markPrice,qe.lastPrice,qe.last),ke=lg(Tt.indexPrice,Tt.markPrice,Tt.lastPrice,qe.indexPrice,pn),m=lg(Tt.dailyPriceChange,qe.dailyPriceChange),p=lg(Tt.dailyPriceChangePercentage,qe.dailyPriceChangePercentage,qe.change24hPct,qe.chg24),S=D1n(p);let A=null;if(pn!=null){if(m!=null){const ce=pn-m;Number.isFinite(ce)&&ce>0&&(A=ce)}if(A==null&&S!=null){const ce=1+S;if(Number.isFinite(ce)&&ce!==0){const fe=pn/ce;Number.isFinite(fe)&&fe>0&&(A=fe)}}}const k=lg(Tt.dailyVolume,qe.volume,qe.vol),T=lg(Tt.openInterestBase,qe.openInterestBase),D=lg(Tt.openInterest,qe.openInterestUsd,qe.openInterest);let V=T;V==null&&D!=null&&ke!=null&&ke>0&&(V=D/ke);const X=lg(Tt.fundingRate,qe.fundingRate,qe.funding),le=lg(Tt.nextFundingRate,qe.nextFundingRate);M({markPx:pn,oraclePx:ke,prevDayPx:A,dayNtlVlm:k,openInterest:V,funding:X,nextFundingTime:le,source:"extended"})},[Se,qe]),h.useEffect(()=>{Se==="hyperliquid"&&xe([])},[Se]),h.useEffect(()=>{Se==="lighter"&&(se(null),K(null))},[Se]),h.useEffect(()=>{if(Se!=="lighter"){rt(null);return}if(!g||!x){rt(null);return}let Tt=!1;return(async()=>{if(typeof window>"u")return;const ke=tn.address,m=tn.token;if(!ke||!m){Tt||rt(null);return}if(ke.toLowerCase()!==x.toLowerCase()){Tt||rt(null);return}He(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{address:ke,token:m});if(Tt)return;const S=p.data;let A=[];if(Array.isArray(S)?A=S:S&&Array.isArray(S.data)?A=S.data:S&&S.wallet_id!=null&&(A=[S]),!A.length)rt(null);else{const k=A[0],T={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};rt(T),ie({id:T.id,address:T.address})}}catch{Tt||rt(null)}finally{Tt||He(!1)}})(),()=>{Tt=!0}},[Se,g,x,tn.address,tn.token]),h.useEffect(()=>{if(Se!=="extended"){bt(null);return}const Tt=tn.address,pn=tn.token;if(!Tt||!pn){bt(null);return}if(!un&&x&&Tt.toLowerCase()!==x.toLowerCase()){bt(null);return}let ke=!1;return(async()=>{Qt(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{address:Tt,token:pn});if(ke)return;const S=p.data;let A=[];if(Array.isArray(S)?A=S:S&&Array.isArray(S.data)?A=S.data:S&&S.wallet_id!=null&&(A=[S]),!A.length)bt(null);else{const k=A[0],T={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};bt(T),ie({id:T.id,address:T.address})}}catch{ke||bt(null)}finally{ke||Qt(!1)}})(),()=>{ke=!0}},[Se,tn.address,tn.token,x,un]),h.useEffect(()=>{if(Se!=="hyperliquid"){on(null);return}if(!g||!x){on(null);return}let Tt=!1;return(async()=>{if(typeof window>"u")return;const ke=tn.address,m=tn.token;if(!ke||!m){Tt||on(null);return}if(ke.toLowerCase()!==x.toLowerCase()){Tt||on(null);return}Vn(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{address:ke,token:m});if(Tt)return;const S=p.data;let A=!1;Array.isArray(S)?A=S.length>0:S&&Array.isArray(S.data)?A=S.data.length>0:S&&S.wallet_id!=null&&(A=!0),on(A)}catch{Tt||on(null)}finally{Tt||Vn(!1)}})(),()=>{Tt=!0}},[Se,g,x,tn.address,tn.token]);const Mt=Tt=>{if(v==="pair")return;const pn=oe==="grid"?"#gridbot":"#trade";Se==="hyperliquid"?(je(Tt),s(Tt),c(`/terminal/hyperliquid/${Tt}${pn}`)):Se==="lighter"?($e(Tt),c(`/terminal/lighter/${Tt}${pn}`)):(Je(Tt),c(`/terminal/extended/${Tt}${pn}`))},ln=()=>{typeof window>"u"||window.open("/dca-bot","_blank","noopener,noreferrer")};return i.jsxs("div",{className:"w-full min-h-screen bg-[#050505] text-white font-manrope p-2 mb-6",children:[i.jsx("div",{className:"flex items-center gap-2 mb-4",children:i.jsxs("div",{className:"inline-flex bg-[#161616] rounded-full p-1 text-[11px]",children:[i.jsxs("div",{className:"flex justify-center items-center",children:[i.jsx("img",{src:"https://i.imgflip.com/7zho2e.png",className:"w-4 h-4 mr-1 ml-2",alt:""}),i.jsx("button",{onClick:()=>{const Tt=Ce||r||"BTC";he("grid"),ge("hyperliquid"),c(`/terminal/hyperliquid/${Tt}#gridbot`)},className:`px-3 py-1 rounded-full transition mr-2 ${Se==="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 Tt=Oe||"BTC";he("grid"),ge("lighter"),c(`/terminal/lighter/${Tt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${Se==="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 Tt=Ye||"BTC";he("grid"),ge("extended"),c(`/terminal/extended/${Tt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${Se==="extended"?"bg-white text-black":"text:white/60 text-white/60 hover:text-white"}`,children:"Extended"})]})]})}),i.jsx(ho.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(ho.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(Hmn,{coin:zn,data:($t=t.position_info)==null?void 0:$t[0],setIsDigits:$,headerData:P,active:L,onCoinChange:Mt,markets:Yn,marketsLoading:Xn,mode:v,pairKey:N,onPairChange:I})})}),i.jsxs("div",{className:"flex flex-col gap-1 xl:grid xl:h-[600px] rounded-[16px]",style:{gridTemplateColumns:ae?"minmax(0,1fr) 24px":"minmax(0,1fr) 300px"},children:[i.jsxs(ho.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:zn,data:(Nn=t.position_info)==null?void 0:Nn[0],setIsDigits:$,headerData:P,handleClick:yn,active:L,onCoinChange:Mt,mode:v,pairKey:N,onPairChange:I,markets:Yn,market:Se})}),i.jsx("div",{className:"flex-1 min-h-0",children:Se==="hyperliquid"?i.jsx(PQ,{coin:Kn,interval:L,walletAddress:G==null?void 0:G.address,gridLines:oe==="grid"?_e:[],market:"hyperliquid"},`hl-${Kn}-${L}`):Se==="lighter"?i.jsx(PQ,{coin:zn,interval:"1h",walletAddress:G==null?void 0:G.address,gridLines:oe==="grid"?_e:[],market:"lighter",lighterMarketId:pe},`lighter-${zn}-${L}-${pe||"x"}`):i.jsx(PQ,{coin:zn,interval:L,walletAddress:G==null?void 0:G.address,gridLines:oe==="grid"?_e:[],market:"extended",extendedMarket:Ae,extendedLastPrice:zt},`extended-${zn}-${L}-${Ae||"x"}`)})]}),i.jsxs(ho.div,{className:"hidden sm:flex w-full xl:h-full xl:min-h-0 relative rounded-[16px]",children:[!ae&&i.jsxs("div",{className:"group relative w-full h-full bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:[i.jsx("button",{onClick:()=>q(!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"})})})}),Se==="hyperliquid"?i.jsx(f0n,{className:"w-full xl:h-full xl:min-h-0 overflow-y-auto",coin:r,data:e?[]:(Fn=t.position_info)==null?void 0:Fn[0],loading:e,period:a,periods:o,handlePeriodChange:l,onBookPrice:Tt=>se(Tt),onBest:({mid:Tt})=>K(Tt)}):Se==="lighter"?pe!=null?i.jsx(A1n,{marketId:pe,baseSymbol:zn,rows:10,onSelectPrice:Tt=>se(Tt),onBest:({mid:Tt})=>K(Tt)}):i.jsx(O7,{title:"Lighter Order Book",subtitle:"Select a market to see the order book"}):i.jsx(R1n,{market:Ae,baseSymbol:ze||zn,rows:10,onSelectPrice:Tt=>se(Tt),onBest:({mid:Tt})=>K(Tt)})]}),ae&&i.jsxs("div",{className:"group relative w-[24px] h-full bg-[#101010] border border-[#292929] rounded-[16px] flex items-center justify-center",children:[i.jsx("button",{onClick:()=>q(!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(ho.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 Tt=Se==="hyperliquid"?Ce||r||"BTC":Se==="lighter"?Oe||"BTC":Ye||"BTC";xe([]),he("trade"),c(`/terminal/${Se}/${Tt}#trade`)},className:`px-3 py-1 rounded-full transition ${oe==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const Tt=Se==="hyperliquid"?Ce||r||"BTC":Se==="lighter"?Oe||"BTC":Ye||"BTC";he("grid"),c(`/terminal/${Se}/${Tt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${oe==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:Se==="hyperliquid"?"HL Grid Bot":Se==="lighter"?"Lighter Grid Bot":"Extended Grid Bot"}),Se==="extended"&&i.jsx("button",{onClick:ln,className:"px-3 py-1 rounded-full transition text-white/60 hover:text-white",children:"DCA Bot"})]})}),i.jsx("div",{className:"min-h-[260px]",children:oe==="trade"?Se==="hyperliquid"?i.jsx(sje,{coin:r,midPrice:ee,selectedPrice:Q,maxLeverage:re[r]||25,wallet:G,onWalletChange:ie,uiMode:v,pairKey:N},`trade-${G.address}`):Se==="lighter"?i.jsx("div",{className:"h-[260px]",children:i.jsx(O7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"})}):i.jsx("div",{className:"h-[260px]",children:i.jsx(O7,{title:"Extended Perp Trading",subtitle:"Coming Soon"})}):Se==="hyperliquid"?cn||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):kt?it?i.jsx(YF,{code:We,onCodeChange:It,onSubmit:gt,loading:Ge,checking:Vt,message:vt}):St===!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(vje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onWalletChange:ie,onLevelsChange:xe}):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)})})]}):Se==="lighter"?st||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…"}):kt?hn?i.jsx(YF,{code:We,onCodeChange:It,onSubmit:gt,loading:Ge,checking:Vt,message:vt}):ht?i.jsx(bje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onLevelsChange:xe}):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)})})]}):xt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60 py-6",children:"Loading Extended account…"}):kt?Ve?i.jsx(Cje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onLevelsChange:xe}):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)})})]})})]}),Se==="lighter"&&kt&&i.jsx(ho.div,{className:"xl:hidden bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:i.jsx(kM,{walletAddress:G==null?void 0:G.address,sourceMarket:"lighter"})}),i.jsx(ho.div,{className:"h-[500px] bg-[#101010] border border-[#292929] overflow-hidden rounded-[16px]",children:Se==="hyperliquid"?i.jsx(Hgn,{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}`):Se==="lighter"?kt?i.jsx(kM,{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(kM,{walletAddress:G==null?void 0:G.address,sourceMarket:"extended"})})]}),i.jsxs(ho.div,{animate:{width:W?28:350},transition:L1n,className:"hidden xl:flex flex-col gap-1 rounded-[16px] overflow-visible",style:{minWidth:W?28:350},children:[!W&&i.jsxs("div",{className:"group relative bg-[#101010] border border-[#292929] flex-1 rounded-[16px] flex flex-col",children:[i.jsx("button",{onClick:()=>ne(!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 Tt=Se==="hyperliquid"?Ce||r||"BTC":Se==="lighter"?Oe||"BTC":Ye||"BTC";he("trade"),xe([]),c(`/terminal/${Se}/${Tt}#trade`)},className:`px-3 py-1 rounded-full transition ${oe==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const Tt=Se==="hyperliquid"?Ce||r||"BTC":Se==="lighter"?Oe||"BTC":Ye||"BTC";he("grid"),c(`/terminal/${Se}/${Tt}#gridbot`)},className:`px-3 py-1 rounded-full transition ${oe==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Grid Bot"}),Se==="extended"&&i.jsx("button",{onClick:ln,className:"px-3 py-1 rounded-full transition text-white/60 hover:text-white",children:"DCA Bot"})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:oe==="trade"?Se==="hyperliquid"?i.jsx(sje,{coin:r,midPrice:ee,selectedPrice:Q,maxLeverage:re[r]||25,wallet:G,onWalletChange:ie,uiMode:v,pairKey:N}):Se==="lighter"?i.jsx(O7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"}):i.jsx(O7,{title:"Extended Perp Trading",subtitle:"Coming Soon"}):Se==="hyperliquid"?cn||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):kt?it?i.jsx(YF,{code:We,onCodeChange:It,onSubmit:gt,loading:Ge,checking:Vt,message:vt}):St===!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(vje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onWalletChange:ie,onLevelsChange:xe}):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)})})]}):Se==="lighter"?st||Vt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Lighter account…"}):kt?hn?i.jsx(YF,{code:We,onCodeChange:It,onSubmit:gt,loading:Ge,checking:Vt,message:vt}):ht?i.jsx(bje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onLevelsChange:xe}):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)})})]}):xt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Extended account…"}):kt?Ve?i.jsx(Cje,{coin:zn,midPrice:ee,selectedPrice:Q,wallet:G,onLevelsChange:xe}):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)})})]})})]}),W&&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:()=>ne(!1),className:"hidden xl:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity bg-transparent z-10",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#161616] border border-r-0 border-[#292929] flex items-center justify-center shadow z-10",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M15 6L9 12l6 6",stroke:"#CFCFCF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),i.jsx("div",{className:"-rotate-90 whitespace-nowrap text-[11px] tracking-wide text-[#BFBFBF] z-0",children:oe==="trade"?"Trade Panel":"Grid Bot"})]})]})]})})]})}const $1n=()=>{es();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(Yr),{coin:x}=g2(),[g,y]=h.useState(x||"BTC"),v=yz();function C(ne){return ne?ne.includes(":")?ne.split(":")[1]:ne:""}function N(ne){if(!ne)return"";if(ne.includes(":")){const[oe,he]=ne.split(":");return`${he} (${oe})`}return ne}const I=C(g),P=v.find(ne=>ne.symbol===`${I}-USD`||ne.symbol===`${I}-USDH`||ne.symbol===`${I}-USDC`),M=(P==null?void 0:P.last)??(P==null?void 0:P.coin),$=`${M?(ne=>{if(ne==null||!isFinite(ne))return"";const oe=Number(ne),he=Math.abs(oe),_e=he>=1e3?0:he>=1?2:he>=.1?6:7,xe=oe.toFixed(_e);return Number(xe).toLocaleString(void 0,{maximumFractionDigits:_e})})(M):""} | ${N(g)} | Dextrabot | Top Hyperliquid Wallets`;h.useEffect(()=>{$&&(document.title=$)},[$]);const[L,z]=h.useState([]),[Q,se]=h.useState(!1),[ee,K]=h.useState(null);h.useEffect(()=>{const ne=document.querySelector("main > div");return ne&&(ne.style.background="#050505"),()=>{ne&&(ne.style.background="")}},[]);const re=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90}],de=parseInt(localStorage.getItem("ticker_period")),G=!isNaN(de)&&re[de]?re[de].value:re[1].value,[ie,ae]=h.useState(G),q=ne=>{ae(Number(ne)),localStorage.setItem("ticker_period",re.findIndex(oe=>oe.value===Number(ne)).toFixed(0))},W=async({coin:ne,period:oe})=>{try{se(!0);const he=`https://dextradata.nftinit.io/api/hyper/terminal/v2/${ne}/${oe}`,_e=await fetch(he);if(!_e.ok)throw z([]),new Error("Network response was not ok");const xe=await _e.json();xe!=null&&xe.success?(z(xe),se(!1),window.localStorage.getItem("hyperToken")&&(d(),f())):(z([]),se(!1),K(xe==null?void 0:xe.error_message))}catch(he){K(he.message),se(!1)}};return h.useEffect(()=>{g&&ie&&W({coin:g,period:ie})},[g,ie]),h.useEffect(()=>{(async()=>{var _e,xe;const oe=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!(!oe||!he))try{const Se=await vi(he.toLowerCase(),oe);Se!=null&&Se.success?(t(Se==null?void 0:Se.telegram_chat_id),e(Se==null?void 0:Se.subscriber_role),n(Se==null?void 0:Se.subs_expire_day),r((_e=Se==null?void 0:Se.mushboomer_counts)==null?void 0:_e.eth),a((xe=Se==null?void 0:Se.mushboomer_counts)==null?void 0:xe.sol),o(Se==null?void 0:Se.referral_code),l(Se==null?void 0:Se.refcode),s(Se==null?void 0:Se.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(Se){console.error("Token verification error:",Se)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(B1n,{data:L,loading:Q,error:ee,coin:g,setCoin:y,period:ie,periods:re,handlePeriodChange:q})})})]})},U1n="https://dextradata.nftinit.io/api/hyper/whale_stats/v2/",Rh=t=>{if(t==null)return"-";const e=Number(t),n=e<0?"-":"",r=Math.abs(e);return r>=1e9?`${n}$${(r/1e9).toFixed(2)}B`:r>=1e6?`${n}$${(r/1e6).toFixed(2)}M`:r>=1e3?`${n}$${(r/1e3).toFixed(2)}K`:`${n}$${r.toFixed(2)}`},cg=t=>t==null?"-":`${Number(t).toFixed(1)}%`,XF=t=>`calc(${t}%)`;function z1n({onData:t}){const[e,n]=h.useState(null);if(h.useEffect(()=>{let l=null;const c=()=>ps.get(U1n).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:cct,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(Us,{content:"Total value of whale positions opened in the last 24 hours.",children:i.jsxs("div",{className:"flex items-center gap-[6px] w-fit",children:[i.jsx("span",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Open Positions"}),i.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-[6px] py-[3px] bg-[#202020] text-[10px] leading-[10px] font-medium rounded-full",children:"LAST 24H"}),i.jsx("img",{src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_position)}),i.jsxs("div",{className:"flex gap-1 h-[16px] w-full max-w-[170px]",children:[i.jsx("span",{className:"flex items-center justify-center bg-[#67FFBD] rounded-[4px] text-[#12450F] text-[10px] leading-[10px] font-semibold px-6",style:{width:XF(r)},children:cg(r)}),i.jsx("span",{className:"flex items-center justify-center bg-[#FF797C] rounded-[4px] text-[#5E2425] text-[10px] leading-[10px] font-semibold px-6",style:{width:XF(s)},children:cg(s)})]}),i.jsxs("div",{className:"flex items-center text-[10px] leading-[10px] font-medium gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"}),i.jsx("span",{children:"Long"}),i.jsx("span",{children:Rh(e.long.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",cg(r),")"]})]}),i.jsx("span",{className:"h-[10px] w-px bg-[#262626]"}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"}),i.jsx("span",{children:"Short"}),i.jsx("span",{children:Rh(e.short.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",cg(s),")"]})]})]})]}),i.jsx("div",{className:"h-px w-full bg-[#262626]"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Us,{content:"Total margin whales are currently using across all positions.",children:i.jsxs("div",{className:"flex items-center gap-[6px] mt-2 w-fit",children:[i.jsx("span",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Whale Margin Usage"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsxs("div",{className:"flex items-end gap-2",children:[i.jsx("span",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_margin)}),i.jsx(Us,{content:"(Total Margin / Total Perp. Equity) * 100",children:i.jsxs("span",{className:"text-[#929292] font-inter text-[20px] not-italic font-semibold leading-[21px] tracking-[-0.2px]",children:["(",cg(e.total_margin/e.total_perp_equity*100),")"]})}),e.long.margin>e.short.margin?i.jsx("span",{className:"bg-[rgba(103,255,189,0.16)] p-[2px] rounded-full",children:i.jsx(Oie,{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(zl,{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:XF(a)},children:cg(a)}),i.jsx("span",{className:"flex items-center justify-center bg-[#FF797C] rounded-[4px] text-[#5E2425] text-[10px] leading-[10px] font-semibold px-6",style:{width:XF(o)},children:cg(o)})]}),i.jsxs("div",{className:"flex items-center text-[10px] leading-[10px] font-medium gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"}),i.jsx("span",{children:"Long"}),i.jsx("span",{className:"text-[#909090]",children:Rh(e.long.margin)}),i.jsxs("span",{children:["(",cg(a),")"]})]}),i.jsx("span",{className:"h-[10px] w-px bg-[#262626]"}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"}),i.jsx("span",{children:"Short"}),i.jsx("span",{className:"text-[#909090]",children:Rh(e.short.margin)}),i.jsxs("span",{children:["(",cg(o),")"]})]})]})]}),i.jsx("div",{className:"h-px w-full bg-[#262626]"}),i.jsxs("div",{className:"flex gap-16",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Us,{content:"Whales’ unrealized profit and loss from open positions in the last 24 hours.",children:i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("div",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"PnL"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_pnl)}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"})," Long"," ",Rh(e.long.pnl)]})]}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"})," Short"," ",Rh(e.short.pnl)]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Us,{content:"Funding fees paid or received by whales based on their open positions.",children:i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("div",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Funding"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_funding)}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"})," Long"," ",Rh(e.long.funding)]})]}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"})," Short"," ",Rh(e.short.funding)]})]})]})]})]})}const id={1:{label:"Shrimp",emoji:"🦐",bg:"bg-[rgba(255,144,0,0.16)]",txt:"text-[#FF9000]"},2:{label:"Fish",emoji:"🐟",bg:"bg-[rgba(121,156,232,0.16)]",txt:"text-[#97B8FF]"},3:{label:"Dolphin",emoji:"🐬",bg:"bg-[rgba(103,255,245,0.16)]",txt:"text-[#4DDCDE]"},4:{label:"Apex Predator",emoji:"🦈",bg:"bg-[rgba(81,180,255,0.16)]",txt:"text-[#51B4FF]"},5:{label:"Small Whale",emoji:"🐋",bg:"bg-[rgba(255,121,173,0.16)]",txt:"text-[#FF79AD]"},6:{label:"Whale",emoji:"🐳",bg:"bg-[rgba(198,121,255,0.16)]",txt:"text-[#C679FF]"},7:{label:"Tidal Whale",emoji:"🌊",bg:"bg-[rgba(255,121,137,0.16)]",txt:"text-[#FF7989]"},8:{label:"Leviathan",emoji:"🐉",bg:"bg-[rgba(73,242,73,0.16)]",txt:"text-[#49F249]"}},kk=[{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"}],ofe=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]},H1n="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",V1n=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`},MC=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)}`},W1n=t=>t<250?1:t<1e4?2:t<5e4?3:t<1e5?4:t<5e5?5:t<1e6?6:t<5e6?7:8,Fje=t=>ofe(W1n(t)),Oje=()=>{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 ps.post(H1n,{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=Fje((x==null?void 0:x.global_account_value)??0);return o===((y=kk.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=Fje(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:Qi,className:"w-5 h-5"}),g.coin]})},{key:"activity",label:"Activity",width:"140px",render:(x,g)=>{var M,F,$,L;const y=(M=g==null?void 0:g.position_details)==null?void 0:M.direction,v=y==="Long",C=y==="Short",N=(L=($=(F=g==null?void 0:g.position_details)==null?void 0:F.position)==null?void 0:$.leverage)==null?void 0:L.value,I=g.side==="Change Position"?v?"Short > Long":"Long > Short":y??"Position Close",P=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:[P&&i.jsx(Os,{className:`w-3 h-3 ${v?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),I]}),N&&i.jsxs("div",{className:"inline-flex justify-center items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium text-[#67ffbd] bg-[rgba(103,255,189,0.16)]",children:[N,"X"]})]})}},{key:"current_trade_value",label:"Trade",width:"80px",sortable:!0,render:x=>MC(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?MC(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?MC(g.position_details.position.entryPx):"-"}},{key:"side",label:"Side",width:"120px",sortable:!0,sortValue:x=>(x==null?void 0:x.side)||"",render:x=>i.jsx("div",{className:`h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5 text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase ${x==="Increase"||x==="Change Position"?"text-[#67ffbd] bg-[#67ffbd]/20":x==="Decrease"||x==="Position Close"?"text-[#ff787b] bg-[#ff797c]/20":"text-white"}`,children:x||"-"})},{key:"position_details.position.size",label:"Size",sortable:!0,width:"110px",sortValue:x=>{var g,y;return Math.abs(Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.szi))||0},render:(x,g)=>{var N,I;const y=(I=(N=g==null?void 0:g.position_details)==null?void 0:N.position)==null?void 0:I.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)?"-":MC(Math.abs(y)),!isNaN(y)&&i.jsx("img",{src:v?x_:g_,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?`${MC(y)}`:"-"}},{key:"position_details.position.unrealizedPnl",label:"uPnL",sortable:!0,width:"100px",sortValue:x=>{var g,y;return Math.abs(Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.unrealizedPnl))||0},render:(x,g)=>{var N,I;const y=parseFloat((I=(N=g==null?void 0:g.position_details)==null?void 0:N.position)==null?void 0:I.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)?"-":`${MC(Math.abs(y))}`,!isNaN(y)&&i.jsx("img",{src:v?x_:g_,className:"ml-[6px] w-[9px] h-[8px]",alt:""})]})}},{key:"flags",label:i.jsx(Us,{content:"Quick view of this whale’s recent trading performance.",children:i.jsx("span",{children:"Last 5 T."})}),width:"90px",render:(x,g)=>{const y=g.last5Trade??[];return i.jsx("div",{className:"inline-flex h-[18px] px-[2px] py-[4px] justify-center items-center rounded-[6px] overflow-visible",children:y.slice(0,5).map((v,C)=>{let N="",I=null;return v===null?(N="bg-[#747474]",I=t9e):v===!0?(N="bg-[#67FFBD]",I=e9e):(N="bg-[#FF9C9C]",I=n9e),i.jsx("div",{className:`relative z[${C}] w-[18px] h-[18px] flex-shrink-0 flex items-center justify-center rounded-full border-2 border-[#101010] ${N} ${C!==0?"-ml-[6px]":""}`,children:i.jsx(I,{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:V1n(new Date((y=g.insert_date)==null?void 0:y.$date).getTime())})}}],f=(x,g)=>{var M;const v=((M=x==null?void 0:x.position_details)==null?void 0:M.direction)==="Long",C=x.current_trade_value>=5e6,N=C?v?"before:bg-[#67FFBD] before:shadow-[0_0_12px_#67FFBD] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-[#FF797C] before:shadow-[0_0_12px_#FF797C] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-transparent";return`
relative before:content-[''] before:absolute before:left-[8px] before:w-[2px] before:rounded-full
${C?v?"bg-[rgba(103,255,189,0.16)]":"bg-[rgba(255,131,117,0.16)]":g%2===0?"bg-[#191919]":"bg-transparent"} ${N} ${C?v?"hover:bg-[rgba(14,70,53,0.32)]":"hover:bg-[rgba(74,16,18,0.32)]":"hover:bg-[rgba(39,39,39,0.32)]"} cursor-pointer mb-4 py-5 transition-colors duration-300
`};return n?i.jsx("div",{className:"rounded-[16px] bg-[#101010] p-4 space-y-4 mt-6",children:i.jsx("div",{className:"space-y-3",children:[...Array(32)].map((x,g)=>i.jsx("div",{className:"h-[42px] w-full bg-[#202020] rounded-md animate-pulse"},g))})}):i.jsx(i.Fragment,{children:i.jsxs("div",{className:"font-manrope font-medium relative p-1 mt-4 sm:w-[1440px] sm:mx-auto",children:[i.jsxs("div",{className:"flex-col items-center space-y-2 sm:pl-[60px]",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(Us,{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"}),kk.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(Us,{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")})})]})})},D8=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)},$qe=(t,e)=>Math.floor(t/Math.pow(10,e)%10),Bse=(t,e)=>!($qe(t,e)%2),ku=(t,e,n)=>{const r=t%e;return n&&$qe(t,n)%2===0?-r:r},g5=(t,e,n)=>e[t%n],q1n=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"},G1n=4,oo=80;function K1n(t,e){const n=D8(t),r=e&&e.length;return Array.from({length:G1n},(s,a)=>({color:g5(n+a,e,r),translateX:ku(n*(a+1),oo/2-(a+17),1),translateY:ku(n*(a+1),oo/2-(a+17),2),rotate:ku(n*(a+1),360),isSquare:Bse(n,2)}))}const Mje=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=K1n(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+oo+" "+oo,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:oo,height:oo,children:i.jsx("rect",{width:oo,height:oo,rx:r?void 0:oo*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:oo,height:oo,fill:o[0].color}),i.jsx("rect",{x:(oo-60)/2,y:(oo-20)/2,width:oo,height:o[1].isSquare?oo:oo/8,fill:o[1].color,transform:"translate("+o[1].translateX+" "+o[1].translateY+") rotate("+o[1].rotate+" "+oo/2+" "+oo/2+")"}),i.jsx("circle",{cx:oo/2,cy:oo/2,fill:o[2].color,r:oo/5,transform:"translate("+o[2].translateX+" "+o[2].translateY+")"}),i.jsx("line",{x1:0,y1:oo/2,x2:oo,y2:oo/2,strokeWidth:2,stroke:o[3].color,transform:"translate("+o[3].translateX+" "+o[3].translateY+") rotate("+o[3].rotate+" "+oo/2+" "+oo/2+")"})]})]})},Dv=90,Y1n=5;function X1n(t,e){const n=D8(t),r=e&&e.length,s=Array.from({length:Y1n},(o,l)=>g5(n+l,e,r)),a=[];return a[0]=s[0],a[1]=s[1],a[2]=s[1],a[3]=s[2],a[4]=s[2],a[5]=s[3],a[6]=s[3],a[7]=s[0],a[8]=s[4],a}const Q1n=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=X1n(t,e),l=Ie.useId();return i.jsxs("svg",{viewBox:"0 0 "+Dv+" "+Dv,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:Dv,height:Dv,children:i.jsx("rect",{width:Dv,height:Dv,rx:r?void 0:Dv*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("path",{d:"M0 0h90v45H0z",fill:o[0]}),i.jsx("path",{d:"M0 45h90v45H0z",fill:o[1]}),i.jsx("path",{d:"M83 45a38 38 0 00-76 0h76z",fill:o[2]}),i.jsx("path",{d:"M83 45a38 38 0 01-76 0h76z",fill:o[3]}),i.jsx("path",{d:"M77 45a32 32 0 10-64 0h64z",fill:o[4]}),i.jsx("path",{d:"M77 45a32 32 0 11-64 0h64z",fill:o[5]}),i.jsx("path",{d:"M71 45a26 26 0 00-52 0h52z",fill:o[6]}),i.jsx("path",{d:"M71 45a26 26 0 01-52 0h52z",fill:o[7]}),i.jsx("circle",{cx:45,cy:45,r:23,fill:o[8]})]})]})},Z1n=64,Bv=80;function J1n(t,e){const n=D8(t),r=e&&e.length;return Array.from({length:Z1n},(s,a)=>g5(n%(a+1),e,r))}const ebn=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=J1n(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+Bv+" "+Bv,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,"mask-type":"alpha",maskUnits:"userSpaceOnUse",x:0,y:0,width:Bv,height:Bv,children:i.jsx("rect",{width:Bv,height:Bv,rx:r?void 0:Bv*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:10,height:10,fill:o[0]}),i.jsx("rect",{x:20,width:10,height:10,fill:o[1]}),i.jsx("rect",{x:40,width:10,height:10,fill:o[2]}),i.jsx("rect",{x:60,width:10,height:10,fill:o[3]}),i.jsx("rect",{x:10,width:10,height:10,fill:o[4]}),i.jsx("rect",{x:30,width:10,height:10,fill:o[5]}),i.jsx("rect",{x:50,width:10,height:10,fill:o[6]}),i.jsx("rect",{x:70,width:10,height:10,fill:o[7]}),i.jsx("rect",{y:10,width:10,height:10,fill:o[8]}),i.jsx("rect",{y:20,width:10,height:10,fill:o[9]}),i.jsx("rect",{y:30,width:10,height:10,fill:o[10]}),i.jsx("rect",{y:40,width:10,height:10,fill:o[11]}),i.jsx("rect",{y:50,width:10,height:10,fill:o[12]}),i.jsx("rect",{y:60,width:10,height:10,fill:o[13]}),i.jsx("rect",{y:70,width:10,height:10,fill:o[14]}),i.jsx("rect",{x:20,y:10,width:10,height:10,fill:o[15]}),i.jsx("rect",{x:20,y:20,width:10,height:10,fill:o[16]}),i.jsx("rect",{x:20,y:30,width:10,height:10,fill:o[17]}),i.jsx("rect",{x:20,y:40,width:10,height:10,fill:o[18]}),i.jsx("rect",{x:20,y:50,width:10,height:10,fill:o[19]}),i.jsx("rect",{x:20,y:60,width:10,height:10,fill:o[20]}),i.jsx("rect",{x:20,y:70,width:10,height:10,fill:o[21]}),i.jsx("rect",{x:40,y:10,width:10,height:10,fill:o[22]}),i.jsx("rect",{x:40,y:20,width:10,height:10,fill:o[23]}),i.jsx("rect",{x:40,y:30,width:10,height:10,fill:o[24]}),i.jsx("rect",{x:40,y:40,width:10,height:10,fill:o[25]}),i.jsx("rect",{x:40,y:50,width:10,height:10,fill:o[26]}),i.jsx("rect",{x:40,y:60,width:10,height:10,fill:o[27]}),i.jsx("rect",{x:40,y:70,width:10,height:10,fill:o[28]}),i.jsx("rect",{x:60,y:10,width:10,height:10,fill:o[29]}),i.jsx("rect",{x:60,y:20,width:10,height:10,fill:o[30]}),i.jsx("rect",{x:60,y:30,width:10,height:10,fill:o[31]}),i.jsx("rect",{x:60,y:40,width:10,height:10,fill:o[32]}),i.jsx("rect",{x:60,y:50,width:10,height:10,fill:o[33]}),i.jsx("rect",{x:60,y:60,width:10,height:10,fill:o[34]}),i.jsx("rect",{x:60,y:70,width:10,height:10,fill:o[35]}),i.jsx("rect",{x:10,y:10,width:10,height:10,fill:o[36]}),i.jsx("rect",{x:10,y:20,width:10,height:10,fill:o[37]}),i.jsx("rect",{x:10,y:30,width:10,height:10,fill:o[38]}),i.jsx("rect",{x:10,y:40,width:10,height:10,fill:o[39]}),i.jsx("rect",{x:10,y:50,width:10,height:10,fill:o[40]}),i.jsx("rect",{x:10,y:60,width:10,height:10,fill:o[41]}),i.jsx("rect",{x:10,y:70,width:10,height:10,fill:o[42]}),i.jsx("rect",{x:30,y:10,width:10,height:10,fill:o[43]}),i.jsx("rect",{x:30,y:20,width:10,height:10,fill:o[44]}),i.jsx("rect",{x:30,y:30,width:10,height:10,fill:o[45]}),i.jsx("rect",{x:30,y:40,width:10,height:10,fill:o[46]}),i.jsx("rect",{x:30,y:50,width:10,height:10,fill:o[47]}),i.jsx("rect",{x:30,y:60,width:10,height:10,fill:o[48]}),i.jsx("rect",{x:30,y:70,width:10,height:10,fill:o[49]}),i.jsx("rect",{x:50,y:10,width:10,height:10,fill:o[50]}),i.jsx("rect",{x:50,y:20,width:10,height:10,fill:o[51]}),i.jsx("rect",{x:50,y:30,width:10,height:10,fill:o[52]}),i.jsx("rect",{x:50,y:40,width:10,height:10,fill:o[53]}),i.jsx("rect",{x:50,y:50,width:10,height:10,fill:o[54]}),i.jsx("rect",{x:50,y:60,width:10,height:10,fill:o[55]}),i.jsx("rect",{x:50,y:70,width:10,height:10,fill:o[56]}),i.jsx("rect",{x:70,y:10,width:10,height:10,fill:o[57]}),i.jsx("rect",{x:70,y:20,width:10,height:10,fill:o[58]}),i.jsx("rect",{x:70,y:30,width:10,height:10,fill:o[59]}),i.jsx("rect",{x:70,y:40,width:10,height:10,fill:o[60]}),i.jsx("rect",{x:70,y:50,width:10,height:10,fill:o[61]}),i.jsx("rect",{x:70,y:60,width:10,height:10,fill:o[62]}),i.jsx("rect",{x:70,y:70,width:10,height:10,fill:o[63]})]})]})},nl=36;function tbn(t,e){const n=D8(t),r=e&&e.length,s=g5(n,e,r),a=ku(n,10,1),o=a<5?a+nl/9:a,l=ku(n,10,2),c=l<5?l+nl/9:l;return{wrapperColor:s,faceColor:q1n(s),backgroundColor:g5(n+13,e,r),wrapperTranslateX:o,wrapperTranslateY:c,wrapperRotate:ku(n,360),wrapperScale:1+ku(n,nl/12)/10,isMouthOpen:Bse(n,2),isCircle:Bse(n,1),eyeSpread:ku(n,5),mouthSpread:ku(n,3),faceRotate:ku(n,10,3),faceTranslateX:o>nl/6?o/2:ku(n,8,1),faceTranslateY:c>nl/6?c/2:ku(n,7,2)}}const Rje=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=tbn(t,e),l=h.useId();return i.jsxs("svg",{viewBox:"0 0 "+nl+" "+nl,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:nl,height:nl,children:i.jsx("rect",{width:nl,height:nl,rx:r?void 0:nl*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:nl,height:nl,fill:o.backgroundColor}),i.jsx("rect",{x:"0",y:"0",width:nl,height:nl,transform:"translate("+o.wrapperTranslateX+" "+o.wrapperTranslateY+") rotate("+o.wrapperRotate+" "+nl/2+" "+nl/2+") scale("+o.wrapperScale+")",fill:o.wrapperColor,rx:o.isCircle?nl:nl/6}),i.jsxs("g",{transform:"translate("+o.faceTranslateX+" "+o.faceTranslateY+") rotate("+o.faceRotate+" "+nl/2+" "+nl/2+")",children:[o.isMouthOpen?i.jsx("path",{d:"M15 "+(19+o.mouthSpread)+"c2 1 4 1 6 0",stroke:o.faceColor,fill:"none",strokeLinecap:"round"}):i.jsx("path",{d:"M13,"+(19+o.mouthSpread)+" a1,0.75 0 0,0 10,0",fill:o.faceColor}),i.jsx("rect",{x:14-o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:"none",fill:o.faceColor}),i.jsx("rect",{x:20+o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:"none",fill:o.faceColor})]})]})]})},nbn=4,Wd=80;function rbn(t,e){const n=D8(t),r=e&&e.length;return Array.from({length:nbn},(s,a)=>g5(n+a,e,r))}const sbn=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=rbn(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]})]})]})]})},ibn=3,Cu=80;function abn(t,e){const n=D8(t),r=e&&e.length;return Array.from({length:ibn},(s,a)=>({color:g5(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 Uqe=({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"})]})})]})},obn={pixel:ebn,bauhaus:Mje,ring:Q1n,beam:Rje,sunset:sbn,marble:Uqe,geometric:Rje,abstract:Mje},zqe=({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=obn[t]||Uqe;return i.jsx(l,{colors:e,name:n,title:r,size:s,square:a,...o})},QF="rgba(155,155,155,0.16)";function lbn({row:t}){var f,x,g,y,v,C,N,I,P,M,F,$;const e=(f=t==null?void 0:t.position_details)==null?void 0:f.direction,n=(y=(g=(x=t==null?void 0:t.position_details)==null?void 0:x.position)==null?void 0:g.leverage)==null?void 0:y.value,r=e==="Long",s=e==="Short",a=(C=(v=t==null?void 0:t.position_details)==null?void 0:v.position)==null?void 0:C.szi,o=(I=(N=t==null?void 0:t.position_details)==null?void 0:N.position)==null?void 0:I.entryPx,l=parseFloat((M=(P=t==null?void 0:t.position_details)==null?void 0:P.position)==null?void 0:M.unrealizedPnl),c=t.side==="Change Position"?r?"Short > Long":"Long > Short":e??"Position Close",u=e==="Long"||e==="Short",d=({label:L,value:z,extraClass:Q=""})=>i.jsxs("div",{className:"flex flex-col flex-1 px-2",children:[i.jsx("span",{className:"text-white/64 text-[12px] font-medium leading-[13px] tracking-[0.24px]",children:L}),i.jsx("span",{className:`text-[12px] font-semibold leading-[13px] tracking-[0.24px] ${Q}`,children:z})]});return i.jsxs("div",{className:"z-[80] w-[362px] h-[204px] rounded-[16px] bg-white/10 backdrop-blur-[43px] p-3 flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(zqe,{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:Qi,className:"w-8 h-8"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-white text-[14px] font-semibold leading-[13px] tracking-[0.28px]",children:t.coin}),i.jsx("span",{className:"text-white/40 text-[12px] font-medium leading-[13px] tracking-[0.24px]",children:t.coin_name||""})]}),i.jsxs("div",{className:"ml-[10px] flex gap-[8px]",children:[i.jsxs("div",{className:`inline-flex items-center gap-1 px-1 py-1 h-6 rounded-[6px] text-[11px] uppercase font-medium ${r?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":s?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[u&&i.jsx(Os,{className:`w-3 h-3 ${r?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),c]}),n&&i.jsxs("div",{className:"inline-flex items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium text-[#67ffbd] bg-[rgba(103,255,189,0.16)]",children:[n,"X"]})]})]}),i.jsx("div",{style:{background:QF},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:QF},children:[i.jsx(d,{label:"Trade Value",value:`$${Er(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:Er(Math.abs(o))})})]}),i.jsx("div",{style:{background:QF},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:QF},children:[i.jsx(d,{label:"Size",value:isNaN(a)?"-":Er(Math.abs(a))}),i.jsx(d,{label:"Entry Price",value:`$${Er((($=(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?"-":""}$${Er(Math.abs(l))}`,i.jsx("img",{src:l>0?x_:g_,className:"ml-[6px] w-[9px] h-[8px]"})]})})]})]})}function cbn(){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 ubn="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",Lje=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`},ZQ=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,Dje=t=>ofe(dbn(t)),fbn=()=>{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=cbn(),f=h.useCallback(async(C=!1)=>{C&&r(!0);try{const N=await ps.post(ubn,{limit:1e3,offset:0});if(N.data.success){const I=N.data.data.filter(P=>{var M;return!((M=P==null?void 0:P.typeDetail)!=null&&M.includes("Top100Wallet"))});e(I),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 I;if(!c)return!0;const N=Dje((C==null?void 0:C.global_account_value)??0);return c===((I=kk.find(P=>P.label===N.label))==null?void 0:I.id)}):t,[t,c]),g=[{key:"wallet",label:"Address",width:"235px",render:(C,N)=>{const I=(N==null?void 0:N.global_account_value)??0,P=Dje(I);return i.jsx(Us,{content:i.jsx(lbn,{row:N}),children:i.jsxs("div",{className:"flex items-center gap-1.5 text-[14px] tracking-[0.24px] cursor-pointer",children:[i.jsx("span",{className:"text-[18px] leading-none",children:P.emoji}),i.jsxs("span",{className:"max-w-20 mr-2",children:[N.wallet.slice(0,5),"...",N.wallet.slice(-4)]}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ml-[10px] ${P.bg} ${P.txt}`,children:P.label})]})})}},{key:"coin",label:"Symbol",width:"114px",sortable:!0,render:(C,N)=>i.jsxs("div",{className:"flex items-center gap-2 text-[14px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${N.coin}.svg`,onError:Qi,className:"w-5 h-5"}),N.coin]})},{key:"activity",label:"Activity",width:"130px",render:(C,N)=>{var z,Q,se,ee;const I=(z=N==null?void 0:N.position_details)==null?void 0:z.direction,P=I==="Long",M=I==="Short",F=(ee=(se=(Q=N==null?void 0:N.position_details)==null?void 0:Q.position)==null?void 0:se.leverage)==null?void 0:ee.value,$=N.side==="Change Position"?P?"Short > Long":"Long > Short":I??"Position Close",L=I==="Long"||I==="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 ${P?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":M?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[L&&i.jsx(Os,{className:`w-3 h-3 ${P?"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
${P?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":M?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[F,"X"]})]})}},{key:"current_trade_value",label:"Trade",width:"70px",sortable:!0,render:C=>ZQ(C)},{key:"position_value",label:"Position",sortable:!0,width:"85px",sortValue:C=>{var N,I;return Number((I=(N=C==null?void 0:C.position_details)==null?void 0:N.position)==null?void 0:I.positionValue)},render:(C,N)=>{var I,P;return(P=(I=N==null?void 0:N.position_details)==null?void 0:I.position)!=null&&P.positionValue?ZQ(N.position_details.position.positionValue):"-"}},{key:"price",label:"Price",width:"80px",sortable:!0,sortValue:C=>{var N,I;return Number((I=(N=C==null?void 0:C.position_details)==null?void 0:N.position)==null?void 0:I.entryPx)},render:(C,N)=>{var I,P;return(P=(I=N==null?void 0:N.position_details)==null?void 0:I.position)!=null&&P.entryPx?ZQ(N.position_details.position.entryPx):"-"}},{key:"flags",label:i.jsx(Us,{content:"Quick view of this whale’s recent trading performance.",children:i.jsx("span",{children:"Last 5 T."})}),width:"90px",render:(C,N)=>{const I=N.last5Trade??[];return i.jsx("div",{className:"inline-flex h-[18px] px-[2px] py-[4px] justify-center items-center rounded-[6px] overflow-visible",children:I.slice(0,5).map((P,M)=>{let F="",$=null;return P===null?(F="bg-[#747474]",$=t9e):P===!0?(F="bg-[#67FFBD]",$=e9e):(F="bg-[#FF9C9C]",$=n9e),i.jsx("div",{className:`relative z[${M}] w-[18px] h-[18px] flex-shrink-0 flex items-center justify-center rounded-full border-2 border-[#101010] ${F} ${M!==0?"-ml-[6px]":""}`,children:i.jsx($,{className:"w-3 h-3 text-black"})},M)})})}},{key:"insert_date",label:"Time",sortable:!0,width:"80px",sortValue:C=>{var N;return(N=C.insert_date)==null?void 0:N.$date},render:(C,N)=>{var I;return i.jsx("div",{className:"text-gray-400",children:Lje(new Date((I=N.insert_date)==null?void 0:I.$date).getTime())})}}],y=h.useMemo(()=>d?g.slice(1):g,[g,d]),v=(C,N)=>{var z;const P=((z=C==null?void 0:C.position_details)==null?void 0:z.direction)==="Long",M=C.current_trade_value>=5e6,F=M?P?"before:bg-[#67FFBD] before:shadow-[0_0_12px_#67FFBD] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-[#FF797C] before:shadow-[0_0_12px_#FF797C] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-transparent";return`
relative before:content-[''] before:absolute before:left-[8px] before:w-[2px] before:rounded-full
${M?P?"bg-[rgba(103,255,189,0.16)]":"bg-[rgba(255,131,117,0.16)]":N%2===0?"bg-[#191919]":"bg-transparent"} ${F} ${M?P?"hover:bg-[rgba(14,70,53,0.32)]":"hover:bg-[rgba(74,16,18,0.32)]":"hover:bg-[rgba(39,39,39,0.32)]"} cursor-pointer mb-4 py-5 transition-colors duration-300
`};return n?i.jsxs("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 space-y-4",children:[i.jsx("div",{className:"flex justify-end",children:i.jsx("div",{className:"h-8 w-24 bg-[#202020] rounded-[8px] animate-pulse"})}),i.jsx("div",{className:"space-y-3",children:[...Array(7)].map((C,N)=>i.jsx("div",{className:"h-[34px] w-full bg-[#202020] rounded-md animate-pulse"},N))})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-full font-manrope font-medium relative mt-1",children:[i.jsxs("div",{className:"flex items-center justify-between pb-2",children:[i.jsx(Us,{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 ",Lje(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"}),kk.map(({id:C,label:N,emoji:I,description:P})=>{const M=c===C;return i.jsx("div",{onClick:()=>u(M?"":C),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] transition-colors cursor-pointer ${M?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(Us,{content:P,children:I})},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:uct,alt:"Expand",className:"w-5 h-5 sm:hidden"})]})]}),x.length===0?i.jsx("div",{className:"h-[312px] flex items-center justify-center text-[#9B9B9B] text-sm",children:"No data available for this filter."}):i.jsx(zu,{data:x,columns:y,tableClassName:"text-[14px]",theadClassName:"text-[13px] font-inter !text-[#9B9B9B] bg-transparent font-normal",tbodyClassName:"text-[14px]",cellClassName:"text-[14px] text-right font-medium",rowClassName:v,rowHeight:42,listHeight:285,rowKey:C=>{var N,I;return((N=C._id)==null?void 0:N.$oid)||((I=C.insert_date)==null?void 0:I.$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(Oje,{})})})}),i.jsx("div",{className:" w-screen h-screen bg-[#101010] flex flex-col overflow-x-auto overflow-y-auto z-[9999]",children:i.jsx(Oje,{})})]})]})};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 Bje(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function vz(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Bje(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():Bje(t[s],null)}}}}function du(...t){return h.useCallback(vz(...t),t)}function K5(t,e=[]){let n=[];function r(a,o){const l=h.createContext(o),c=n.length;n=[...n,o];const u=f=>{var N;const{scope:x,children:g,...y}=f,v=((N=x==null?void 0:x[t])==null?void 0:N[c])||l,C=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,hbn(s,...e)]}function hbn(...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 m2=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},pbn=Wy[" useInsertionEffect ".trim().toString()]||m2;function wz({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=xbn(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 pbn(()=>{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 xbn(t){return typeof t=="function"}function Tk(t){const e=gbn(t),n=h.forwardRef((r,s)=>{const{children:a,...o}=r,l=h.Children.toArray(a),c=l.find(ybn);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 gbn(t){const e=h.forwardRef((n,r)=>{const{children:s,...a}=n;if(h.isValidElement(s)){const o=wbn(s),l=vbn(a,s.props);return s.type!==h.Fragment&&(l.ref=r?vz(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 bbn=Symbol("radix.slottable");function ybn(t){return h.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bbn}function vbn(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 wbn(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 Cbn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hc=Cbn.reduce((t,e)=>{const n=Tk(`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 Hqe(t,e){t&&_a.flushSync(()=>t.dispatchEvent(e))}function Vqe(t){const e=t+"CollectionProvider",[n,r]=K5(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:C,children:N}=v,I=Ie.useRef(null),P=Ie.useRef(new Map).current;return i.jsx(s,{scope:C,itemMap:P,collectionRef:I,children:N})};o.displayName=e;const l=t+"CollectionSlot",c=Tk(l),u=Ie.forwardRef((v,C)=>{const{scope:N,children:I}=v,P=a(l,N),M=du(C,P.collectionRef);return i.jsx(c,{ref:M,children:I})});u.displayName=l;const d=t+"CollectionItemSlot",f="data-radix-collection-item",x=Tk(d),g=Ie.forwardRef((v,C)=>{const{scope:N,children:I,...P}=v,M=Ie.useRef(null),F=du(C,M),$=a(d,N);return Ie.useEffect(()=>($.itemMap.set(M,{ref:M,...P}),()=>void $.itemMap.delete(M))),i.jsx(x,{[f]:"",ref:F,children:I})});g.displayName=d;function y(v){const C=a(t+"CollectionConsumer",v);return Ie.useCallback(()=>{const I=C.collectionRef.current;if(!I)return[];const P=Array.from(I.querySelectorAll(`[${f}]`));return Array.from(C.itemMap.values()).sort(($,L)=>P.indexOf($.ref.current)-P.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:o,Slot:u,ItemSlot:g},y,r]}var Sbn=h.createContext(void 0);function Wqe(t){const e=h.useContext(Sbn);return t||e||"ltr"}function T1(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 Nbn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(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 jbn="DismissableLayer",$se="dismissableLayer.update",Abn="dismissableLayer.pointerDownOutside",_bn="dismissableLayer.focusOutside",$je,qqe=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cz=h.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,u=h.useContext(qqe),[d,f]=h.useState(null),x=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=h.useState({}),y=du(e,L=>f(L)),v=Array.from(u.layers),[C]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),N=v.indexOf(C),I=d?v.indexOf(d):-1,P=u.layersWithOutsidePointerEventsDisabled.size>0,M=I>=N,F=Tbn(L=>{const z=L.target,Q=[...u.branches].some(se=>se.contains(z));!M||Q||(s==null||s(L),o==null||o(L),L.defaultPrevented||l==null||l())},x),$=Ibn(L=>{const z=L.target;[...u.branches].some(se=>se.contains(z))||(a==null||a(L),o==null||o(L),L.defaultPrevented||l==null||l())},x);return Nbn(L=>{I===u.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},x),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($je=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Uje(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=$je)}},[d,x,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Uje())},[d,u]),h.useEffect(()=>{const L=()=>g({});return document.addEventListener($se,L),()=>document.removeEventListener($se,L)},[]),i.jsx(Hc.div,{...c,ref:y,style:{pointerEvents:P?M?"auto":"none":void 0,...t.style},onFocusCapture:mi(t.onFocusCapture,$.onFocusCapture),onBlurCapture:mi(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:mi(t.onPointerDownCapture,F.onPointerDownCapture)})});Cz.displayName=jbn;var Ebn="DismissableLayerBranch",kbn=h.forwardRef((t,e)=>{const n=h.useContext(qqe),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})});kbn.displayName=Ebn;function Tbn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(t),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){Gqe(Abn,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 Ibn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(t),r=h.useRef(!1);return h.useEffect(()=>{const s=a=>{a.target&&!r.current&&Gqe(_bn,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 Uje(){const t=new CustomEvent($se);document.dispatchEvent(t)}function Gqe(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?Hqe(s,a):s.dispatchEvent(a)}var JQ=0;function Kqe(){h.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??zje()),document.body.insertAdjacentElement("beforeend",t[1]??zje()),JQ++,()=>{JQ===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),JQ--}},[])}function zje(){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 eZ="focusScope.autoFocusOnMount",tZ="focusScope.autoFocusOnUnmount",Hje={bubbles:!1,cancelable:!0},Pbn="FocusScope",lfe=h.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[l,c]=h.useState(null),u=T1(s),d=T1(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(P){if(g.paused||!l)return;const M=P.target;l.contains(M)?f.current=M:Ub(f.current,{select:!0})},C=function(P){if(g.paused||!l)return;const M=P.relatedTarget;M!==null&&(l.contains(M)||Ub(f.current,{select:!0}))},N=function(P){if(document.activeElement===document.body)for(const F of P)F.removedNodes.length>0&&Ub(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const I=new MutationObserver(N);return l&&I.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),I.disconnect()}}},[r,l,g.paused]),h.useEffect(()=>{if(l){Wje.add(g);const v=document.activeElement;if(!l.contains(v)){const N=new CustomEvent(eZ,Hje);l.addEventListener(eZ,u),l.dispatchEvent(N),N.defaultPrevented||(Fbn(Dbn(Yqe(l)),{select:!0}),document.activeElement===v&&Ub(l))}return()=>{l.removeEventListener(eZ,u),setTimeout(()=>{const N=new CustomEvent(tZ,Hje);l.addEventListener(tZ,d),l.dispatchEvent(N),N.defaultPrevented||Ub(v??document.body,{select:!0}),l.removeEventListener(tZ,d),Wje.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,N=document.activeElement;if(C&&N){const I=v.currentTarget,[P,M]=Obn(I);P&&M?!v.shiftKey&&N===M?(v.preventDefault(),n&&Ub(P,{select:!0})):v.shiftKey&&N===P&&(v.preventDefault(),n&&Ub(M,{select:!0})):N===I&&v.preventDefault()}},[n,r,g.paused]);return i.jsx(Hc.div,{tabIndex:-1,...o,ref:x,onKeyDown:y})});lfe.displayName=Pbn;function Fbn(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ub(r,{select:e}),document.activeElement!==n)return}function Obn(t){const e=Yqe(t),n=Vje(e,t),r=Vje(e.reverse(),t);return[n,r]}function Yqe(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 Vje(t,e){for(const n of t)if(!Mbn(n,{upTo:e}))return n}function Mbn(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 Rbn(t){return t instanceof HTMLInputElement&&"select"in t}function Ub(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Rbn(t)&&e&&t.select()}}var Wje=Lbn();function Lbn(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=qje(t,e),t.unshift(e)},remove(e){var n;t=qje(t,e),(n=t[0])==null||n.resume()}}}function qje(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Dbn(t){return t.filter(e=>e.tagName!=="A")}var Bbn=Wy[" useId ".trim().toString()]||(()=>{}),$bn=0;function tB(t){const[e,n]=h.useState(Bbn());return m2(()=>{t||n(r=>r??String($bn++))},[t]),t||(e?`radix-${e}`:"")}var Ubn=typeof document<"u",zbn=function(){},TM=Ubn?h.useLayoutEffect:zbn;function nB(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(!nB(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)&&!nB(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Xqe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Gje(t,e){const n=Xqe(t);return Math.round(e*n)/n}function nZ(t){const e=h.useRef(t);return TM(()=>{e.current=t}),e}function Hbn(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);nB(x,r)||g(r);const[y,v]=h.useState(null),[C,N]=h.useState(null),I=h.useCallback(q=>{q!==$.current&&($.current=q,v(q))},[]),P=h.useCallback(q=>{q!==L.current&&(L.current=q,N(q))},[]),M=a||y,F=o||C,$=h.useRef(null),L=h.useRef(null),z=h.useRef(d),Q=c!=null,se=nZ(c),ee=nZ(s),K=nZ(u),re=h.useCallback(()=>{if(!$.current||!L.current)return;const q={placement:e,strategy:n,middleware:x};ee.current&&(q.platform=ee.current),k7e($.current,L.current,q).then(W=>{const ne={...W,isPositioned:K.current!==!1};de.current&&!nB(z.current,ne)&&(z.current=ne,_a.flushSync(()=>{f(ne)}))})},[x,e,n,ee,K]);TM(()=>{u===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[u]);const de=h.useRef(!1);TM(()=>(de.current=!0,()=>{de.current=!1}),[]),TM(()=>{if(M&&($.current=M),F&&(L.current=F),M&&F){if(se.current)return se.current(M,F,re);re()}},[M,F,re,se,Q]);const G=h.useMemo(()=>({reference:$,floating:L,setReference:I,setFloating:P}),[I,P]),ie=h.useMemo(()=>({reference:M,floating:F}),[M,F]),ae=h.useMemo(()=>{const q={position:n,left:0,top:0};if(!ie.floating)return q;const W=Gje(ie.floating,d.x),ne=Gje(ie.floating,d.y);return l?{...q,transform:"translate("+W+"px, "+ne+"px)",...Xqe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:ne}},[n,l,ie.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:re,refs:G,elements:ie,floatingStyles:ae}),[d,re,G,ie,ae])}const Vbn=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?Phe({element:r.current,padding:s}).fn(n):{}:r?Phe({element:r,padding:s}).fn(n):{}}}},Wbn=(t,e)=>({...j7e(t),options:[t,e]}),qbn=(t,e)=>({...A7e(t),options:[t,e]}),Gbn=(t,e)=>({...ott(t),options:[t,e]}),Kbn=(t,e)=>({..._7e(t),options:[t,e]}),Ybn=(t,e)=>({...E7e(t),options:[t,e]}),Xbn=(t,e)=>({...att(t),options:[t,e]}),Qbn=(t,e)=>({...Vbn(t),options:[t,e]});var Zbn="Arrow",Qqe=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"})})});Qqe.displayName=Zbn;var Jbn=Qqe;function eyn(t){const[e,n]=h.useState(void 0);return m2(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var cfe="Popper",[Zqe,B8]=K5(cfe),[tyn,Jqe]=Zqe(cfe),eGe=t=>{const{__scopePopper:e,children:n}=t,[r,s]=h.useState(null);return i.jsx(tyn,{scope:e,anchor:r,onAnchorChange:s,children:n})};eGe.displayName=cfe;var tGe="PopperAnchor",nGe=h.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=Jqe(tGe,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})});nGe.displayName=tGe;var ufe="PopperContent",[nyn,ryn]=Zqe(ufe),rGe=h.forwardRef((t,e)=>{var Ce,je,Oe,$e,Ye,Je;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=Jqe(ufe,n),[N,I]=h.useState(null),P=du(e,ht=>I(ht)),[M,F]=h.useState(null),$=eyn(M),L=($==null?void 0:$.width)??0,z=($==null?void 0:$.height)??0,Q=r+(a!=="center"?"-"+a:""),se=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},ee=Array.isArray(u)?u:[u],K=ee.length>0,re={padding:se,boundary:ee.filter(iyn),altBoundary:K},{refs:de,floatingStyles:G,placement:ie,isPositioned:ae,middlewareData:q}=Hbn({strategy:"fixed",placement:Q,whileElementsMounted:(...ht)=>N7e(...ht,{animationFrame:g==="always"}),elements:{reference:C.anchor},middleware:[Wbn({mainAxis:s+z,alignmentAxis:o}),c&&qbn({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Gbn():void 0,...re}),c&&Kbn({...re}),Ybn({...re,apply:({elements:ht,rects:rt,availableWidth:st,availableHeight:He})=>{const{width:Ve,height:bt}=rt.reference,xt=ht.floating.style;xt.setProperty("--radix-popper-available-width",`${st}px`),xt.setProperty("--radix-popper-available-height",`${He}px`),xt.setProperty("--radix-popper-anchor-width",`${Ve}px`),xt.setProperty("--radix-popper-anchor-height",`${bt}px`)}}),M&&Qbn({element:M,padding:l}),ayn({arrowWidth:L,arrowHeight:z}),x&&Xbn({strategy:"referenceHidden",...re})]}),[W,ne]=aGe(ie),oe=T1(y);m2(()=>{ae&&(oe==null||oe())},[ae,oe]);const he=(Ce=q.arrow)==null?void 0:Ce.x,_e=(je=q.arrow)==null?void 0:je.y,xe=((Oe=q.arrow)==null?void 0:Oe.centerOffset)!==0,[Se,ge]=h.useState();return m2(()=>{N&&ge(window.getComputedStyle(N).zIndex)},[N]),i.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:ae?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Se,"--radix-popper-transform-origin":[($e=q.transformOrigin)==null?void 0:$e.x,(Ye=q.transformOrigin)==null?void 0:Ye.y].join(" "),...((Je=q.hide)==null?void 0:Je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(nyn,{scope:n,placedSide:W,onArrowChange:F,arrowX:he,arrowY:_e,shouldHideArrow:xe,children:i.jsx(Hc.div,{"data-side":W,"data-align":ne,...v,ref:P,style:{...v.style,animation:ae?void 0:"none"}})})})});rGe.displayName=ufe;var sGe="PopperArrow",syn={top:"bottom",right:"left",bottom:"top",left:"right"},iGe=h.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=ryn(sGe,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(Jbn,{...s,ref:n,style:{...s.style,display:"block"}})})});iGe.displayName=sGe;function iyn(t){return t!==null}var ayn=t=>({name:"transformOrigin",options:t,fn(e){var C,N,I;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]=aGe(n),f={start:"0%",center:"50%",end:"100%"}[d],x=(((N=s.arrow)==null?void 0:N.x)??0)+l/2,g=(((I=s.arrow)==null?void 0:I.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 aGe(t){const[e,n="center"]=t.split("-");return[e,n]}var dfe=eGe,Sz=nGe,ffe=rGe,hfe=iGe,oyn="Portal",pfe=h.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,a]=h.useState(!1);m2(()=>a(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?Qse.createPortal(i.jsx(Hc.div,{...r,ref:e}),o):null});pfe.displayName=oyn;function lyn(t,e){return h.useReducer((n,r)=>e[n][r]??n,t)}var $2=t=>{const{present:e,children:n}=t,r=cyn(e),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),a=du(r.ref,uyn(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:a}):null};$2.displayName="Presence";function cyn(t){const[e,n]=h.useState(),r=h.useRef(null),s=h.useRef(t),a=h.useRef("none"),o=t?"mounted":"unmounted",[l,c]=lyn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=ZF(r.current);a.current=l==="mounted"?u:"none"},[l]),m2(()=>{const u=r.current,d=s.current;if(d!==t){const x=a.current,g=ZF(u);t?c("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&x!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),m2(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=g=>{const v=ZF(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=ZF(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 ZF(t){return(t==null?void 0:t.animationName)||"none"}function uyn(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 rZ="rovingFocusGroup.onEntryFocus",dyn={bubbles:!1,cancelable:!0},cI="RovingFocusGroup",[Use,oGe,fyn]=Vqe(cI),[hyn,lGe]=K5(cI,[fyn]),[pyn,myn]=hyn(cI),cGe=h.forwardRef((t,e)=>i.jsx(Use.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Use.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(xyn,{...t,ref:e})})}));cGe.displayName=cI;var xyn=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=Wqe(a),[v,C]=wz({prop:o,defaultProp:l??null,onChange:c,caller:cI}),[N,I]=h.useState(!1),P=T1(u),M=oGe(n),F=h.useRef(!1),[$,L]=h.useState(0);return h.useEffect(()=>{const z=x.current;if(z)return z.addEventListener(rZ,P),()=>z.removeEventListener(rZ,P)},[P]),i.jsx(pyn,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:v,onItemFocus:h.useCallback(z=>C(z),[C]),onItemShiftTab:h.useCallback(()=>I(!0),[]),onFocusableItemAdd:h.useCallback(()=>L(z=>z+1),[]),onFocusableItemRemove:h.useCallback(()=>L(z=>z-1),[]),children:i.jsx(Hc.div,{tabIndex:N||$===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,z=>{const Q=!F.current;if(z.target===z.currentTarget&&Q&&!N){const se=new CustomEvent(rZ,dyn);if(z.currentTarget.dispatchEvent(se),!se.defaultPrevented){const ee=M().filter(ie=>ie.focusable),K=ee.find(ie=>ie.active),re=ee.find(ie=>ie.id===v),G=[K,re,...ee].filter(Boolean).map(ie=>ie.ref.current);fGe(G,d)}}F.current=!1}),onBlur:mi(t.onBlur,()=>I(!1))})})}),uGe="RovingFocusGroupItem",dGe=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...l}=t,c=tB(),u=a||c,d=myn(uGe,n),f=d.currentTabStopId===u,x=oGe(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:v}=d;return h.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),i.jsx(Use.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 N=yyn(C,d.orientation,d.dir);if(N!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let P=x().filter(M=>M.focusable).map(M=>M.ref.current);if(N==="last")P.reverse();else if(N==="prev"||N==="next"){N==="prev"&&P.reverse();const M=P.indexOf(C.currentTarget);P=d.loop?vyn(P,M+1):P.slice(M+1)}setTimeout(()=>fGe(P))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:v!=null}):o})})});dGe.displayName=uGe;var gyn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function byn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function yyn(t,e,n){const r=byn(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gyn[r]}function fGe(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function vyn(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var wyn=cGe,Cyn=dGe,Syn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},RC=new WeakMap,JF=new WeakMap,eO={},sZ=0,hGe=function(t){return t&&(t.host||hGe(t.parentNode))},Nyn=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=hGe(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})},jyn=function(t,e,n,r){var s=Nyn(e,Array.isArray(t)?t:[t]);eO[n]||(eO[n]=new WeakMap);var a=eO[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=(RC.get(x)||0)+1,C=(a.get(x)||0)+1;RC.set(x,v),a.set(x,C),o.push(x),v===1&&y&&JF.set(x,!0),C===1&&x.setAttribute(n,"true"),y||x.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",x,N)}})};return d(e),l.clear(),sZ++,function(){o.forEach(function(f){var x=RC.get(f)-1,g=a.get(f)-1;RC.set(f,x),a.set(f,g),x||(JF.has(f)||f.removeAttribute(r),JF.delete(f)),g||f.removeAttribute(n)}),sZ--,sZ||(RC=new WeakMap,RC=new WeakMap,JF=new WeakMap,eO={})}},pGe=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=Syn(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),jyn(r,s,n,"aria-hidden")):function(){return null}},Yb=function(){return Yb=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Yb.apply(this,arguments)};function Ayn(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 _yn(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 mGe=XDe(),iZ=function(){},Nz=h.forwardRef(function(t,e){var n=h.useRef(null),r=h.useState({onScrollCapture:iZ,onWheelCapture:iZ,onTouchMoveCapture:iZ}),s=r[0],a=r[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,x=t.sideCar,g=t.noRelative,y=t.noIsolation,v=t.inert,C=t.allowPinchZoom,N=t.as,I=N===void 0?"div":N,P=t.gapMode,M=Ayn(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=x,$=SDe([n,e]),L=Yb(Yb({},M),s);return h.createElement(h.Fragment,null,d&&h.createElement(F,{sideCar:mGe,removeScrollBar:u,shards:f,noRelative:g,noIsolation:y,inert:v,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:P}),o?h.cloneElement(h.Children.only(l),Yb(Yb({},L),{ref:$})):h.createElement(I,Yb({},L,{className:c,ref:$}),l))});Nz.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nz.classNames={fullWidth:L9,zeroRight:R9};var zse=!1;if(typeof window<"u")try{var tO=Object.defineProperty({},"passive",{get:function(){return zse=!0,!0}});window.addEventListener("test",tO,tO),window.removeEventListener("test",tO,tO)}catch{zse=!1}var LC=zse?{passive:!1}:!1,Eyn=function(t){return t.tagName==="TEXTAREA"},xGe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Eyn(t)&&n[e]==="visible")},kyn=function(t){return xGe(t,"overflowY")},Tyn=function(t){return xGe(t,"overflowX")},Kje=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=gGe(t,r);if(s){var a=bGe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Iyn=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Pyn=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},gGe=function(t,e){return t==="v"?kyn(e):Tyn(e)},bGe=function(t,e){return t==="v"?Iyn(e):Pyn(e)},Fyn=function(t,e){return t==="h"&&e==="rtl"?-1:1},Oyn=function(t,e,n,r,s){var a=Fyn(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=bGe(t,l),y=g[0],v=g[1],C=g[2],N=v-C-a*y;(y||N)&&gGe(t,l)&&(f+=N,x+=y);var I=l.parentNode;l=I&&I.nodeType===Node.DOCUMENT_FRAGMENT_NODE?I.host:I}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},nO=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Yje=function(t){return[t.deltaX,t.deltaY]},Xje=function(t){return t&&"current"in t?t.current:t},Myn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Ryn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Lyn=0,DC=[];function Dyn(t){var e=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(Lyn++)[0],a=h.useState(Fce)[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=_yn([t.lockRef.current],(t.shards||[]).map(Xje),!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 N=nO(v),I=n.current,P="deltaX"in v?v.deltaX:I[0]-N[0],M="deltaY"in v?v.deltaY:I[1]-N[1],F,$=v.target,L=Math.abs(P)>Math.abs(M)?"h":"v";if("touches"in v&&L==="h"&&$.type==="range")return!1;var z=Kje(L,$);if(!z)return!0;if(z?F=L:(F=L==="v"?"h":"v",z=Kje(L,$)),!z)return!1;if(!r.current&&"changedTouches"in v&&(P||M)&&(r.current=F),!F)return!0;var Q=r.current||F;return Oyn(Q,C,v,Q==="h"?P:M)},[]),c=h.useCallback(function(v){var C=v;if(!(!DC.length||DC[DC.length-1]!==a)){var N="deltaY"in C?Yje(C):nO(C),I=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&Myn(F.delta,N)})[0];if(I&&I.should){C.cancelable&&C.preventDefault();return}if(!I){var P=(o.current.shards||[]).map(Xje).filter(Boolean).filter(function(F){return F.contains(C.target)}),M=P.length>0?l(C,P[0]):!o.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),u=h.useCallback(function(v,C,N,I){var P={name:v,delta:C,target:N,should:I,shadowParent:Byn(N)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(M){return M!==P})},1)},[]),d=h.useCallback(function(v){n.current=nO(v),r.current=void 0},[]),f=h.useCallback(function(v){u(v.type,Yje(v),v.target,l(v,t.lockRef.current))},[]),x=h.useCallback(function(v){u(v.type,nO(v),v.target,l(v,t.lockRef.current))},[]);h.useEffect(function(){return DC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,LC),document.addEventListener("touchmove",c,LC),document.addEventListener("touchstart",d,LC),function(){DC=DC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,LC),document.removeEventListener("touchmove",c,LC),document.removeEventListener("touchstart",d,LC)}},[]);var g=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(a,{styles:Ryn(s)}):null,g?h.createElement(eBe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Byn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const $yn=ZDe(mGe,Dyn);var mfe=h.forwardRef(function(t,e){return h.createElement(Nz,Yb({},t,{ref:e,sideCar:$yn}))});mfe.classNames=Nz.classNames;var Hse=["Enter"," "],Uyn=["ArrowDown","PageUp","Home"],yGe=["ArrowUp","PageDown","End"],zyn=[...Uyn,...yGe],Hyn={ltr:[...Hse,"ArrowRight"],rtl:[...Hse,"ArrowLeft"]},Vyn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},uI="Menu",[Ik,Wyn,qyn]=Vqe(uI),[Y5,vGe]=K5(uI,[qyn,B8,lGe]),jz=B8(),wGe=lGe(),[Gyn,$8]=Y5(uI),[Kyn,dI]=Y5(uI),CGe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:a,modal:o=!0}=t,l=jz(e),[c,u]=h.useState(null),d=h.useRef(!1),f=T1(a),x=Wqe(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(dfe,{...l,children:i.jsx(Gyn,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:i.jsx(Kyn,{scope:e,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:x,modal:o,children:r})})})};CGe.displayName=uI;var Yyn="MenuAnchor",xfe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=jz(n);return i.jsx(Sz,{...s,...r,ref:e})});xfe.displayName=Yyn;var Xyn="MenuPortal",[v4n,SGe]=Y5(Xyn,{forceMount:void 0}),fp="MenuContent",[Qyn,gfe]=Y5(fp),NGe=h.forwardRef((t,e)=>{const n=SGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=$8(fp,t.__scopeMenu),o=dI(fp,t.__scopeMenu);return i.jsx(Ik.Provider,{scope:t.__scopeMenu,children:i.jsx($2,{present:r||a.open,children:i.jsx(Ik.Slot,{scope:t.__scopeMenu,children:o.modal?i.jsx(Zyn,{...s,ref:e}):i.jsx(Jyn,{...s,ref:e})})})})}),Zyn=h.forwardRef((t,e)=>{const n=$8(fp,t.__scopeMenu),r=h.useRef(null),s=du(e,r);return h.useEffect(()=>{const a=r.current;if(a)return pGe(a)},[]),i.jsx(bfe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:mi(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jyn=h.forwardRef((t,e)=>{const n=$8(fp,t.__scopeMenu);return i.jsx(bfe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),e2n=Tk("MenuContent.ScrollLock"),bfe=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=$8(fp,n),N=dI(fp,n),I=jz(n),P=wGe(n),M=Wyn(n),[F,$]=h.useState(null),L=h.useRef(null),z=du(e,L,C.onContentChange),Q=h.useRef(0),se=h.useRef(""),ee=h.useRef(0),K=h.useRef(null),re=h.useRef("right"),de=h.useRef(0),G=y?mfe:h.Fragment,ie=y?{as:e2n,allowPinchZoom:!0}:void 0,ae=W=>{var Ce,je;const ne=se.current+W,oe=M().filter(Oe=>!Oe.disabled),he=document.activeElement,_e=(Ce=oe.find(Oe=>Oe.ref.current===he))==null?void 0:Ce.textValue,xe=oe.map(Oe=>Oe.textValue),Se=f2n(xe,ne,_e),ge=(je=oe.find(Oe=>Oe.textValue===Se))==null?void 0:je.ref.current;(function Oe($e){se.current=$e,window.clearTimeout(Q.current),$e!==""&&(Q.current=window.setTimeout(()=>Oe(""),1e3))})(ne),ge&&setTimeout(()=>ge.focus())};h.useEffect(()=>()=>window.clearTimeout(Q.current),[]),Kqe();const q=h.useCallback(W=>{var oe,he;return re.current===((oe=K.current)==null?void 0:oe.side)&&p2n(W,(he=K.current)==null?void 0:he.area)},[]);return i.jsx(Qyn,{scope:n,searchRef:se,onItemEnter:h.useCallback(W=>{q(W)&&W.preventDefault()},[q]),onItemLeave:h.useCallback(W=>{var ne;q(W)||((ne=L.current)==null||ne.focus(),$(null))},[q]),onTriggerLeave:h.useCallback(W=>{q(W)&&W.preventDefault()},[q]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:h.useCallback(W=>{K.current=W},[]),children:i.jsx(G,{...ie,children:i.jsx(lfe,{asChild:!0,trapped:s,onMountAutoFocus:mi(a,W=>{var ne;W.preventDefault(),(ne=L.current)==null||ne.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(Cz,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:x,onDismiss:g,children:i.jsx(wyn,{asChild:!0,...P,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:F,onCurrentTabStopIdChange:$,onEntryFocus:mi(c,W=>{N.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(ffe,{role:"menu","aria-orientation":"vertical","data-state":$Ge(C.open),"data-radix-menu-content":"",dir:N.dir,...I,...v,ref:z,style:{outline:"none",...v.style},onKeyDown:mi(v.onKeyDown,W=>{const oe=W.target.closest("[data-radix-menu-content]")===W.currentTarget,he=W.ctrlKey||W.altKey||W.metaKey,_e=W.key.length===1;oe&&(W.key==="Tab"&&W.preventDefault(),!he&&_e&&ae(W.key));const xe=L.current;if(W.target!==xe||!zyn.includes(W.key))return;W.preventDefault();const ge=M().filter(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);yGe.includes(W.key)&&ge.reverse(),u2n(ge)}),onBlur:mi(t.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(Q.current),se.current="")}),onPointerMove:mi(t.onPointerMove,Pk(W=>{const ne=W.target,oe=de.current!==W.clientX;if(W.currentTarget.contains(ne)&&oe){const he=W.clientX>de.current?"right":"left";re.current=he,de.current=W.clientX}}))})})})})})})});NGe.displayName=fp;var t2n="MenuGroup",yfe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{role:"group",...r,ref:e})});yfe.displayName=t2n;var n2n="MenuLabel",jGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{...r,ref:e})});jGe.displayName=n2n;var rB="MenuItem",Qje="menu.itemSelect",Az=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,a=h.useRef(null),o=dI(rB,t.__scopeMenu),l=gfe(rB,t.__scopeMenu),c=du(e,a),u=h.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const x=new CustomEvent(Qje,{bubbles:!0,cancelable:!0});f.addEventListener(Qje,g=>r==null?void 0:r(g),{once:!0}),Hqe(f,x),x.defaultPrevented?u.current=!1:o.onClose()}};return i.jsx(AGe,{...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===" "||Hse.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Az.displayName=rB;var AGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=t,o=gfe(rB,n),l=wGe(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(Ik.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:i.jsx(Cyn,{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,Pk(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:mi(t.onPointerLeave,Pk(y=>o.onItemLeave(y))),onFocus:mi(t.onFocus,()=>f(!0)),onBlur:mi(t.onBlur,()=>f(!1))})})})}),r2n="MenuCheckboxItem",_Ge=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return i.jsx(PGe,{scope:t.__scopeMenu,checked:n,children:i.jsx(Az,{role:"menuitemcheckbox","aria-checked":sB(n)?"mixed":n,...s,ref:e,"data-state":wfe(n),onSelect:mi(s.onSelect,()=>r==null?void 0:r(sB(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_Ge.displayName=r2n;var EGe="MenuRadioGroup",[s2n,i2n]=Y5(EGe,{value:void 0,onValueChange:()=>{}}),kGe=h.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,a=T1(r);return i.jsx(s2n,{scope:t.__scopeMenu,value:n,onValueChange:a,children:i.jsx(yfe,{...s,ref:e})})});kGe.displayName=EGe;var TGe="MenuRadioItem",IGe=h.forwardRef((t,e)=>{const{value:n,...r}=t,s=i2n(TGe,t.__scopeMenu),a=n===s.value;return i.jsx(PGe,{scope:t.__scopeMenu,checked:a,children:i.jsx(Az,{role:"menuitemradio","aria-checked":a,...r,ref:e,"data-state":wfe(a),onSelect:mi(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});IGe.displayName=TGe;var vfe="MenuItemIndicator",[PGe,a2n]=Y5(vfe,{checked:!1}),FGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,a=a2n(vfe,n);return i.jsx($2,{present:r||sB(a.checked)||a.checked===!0,children:i.jsx(Hc.span,{...s,ref:e,"data-state":wfe(a.checked)})})});FGe.displayName=vfe;var o2n="MenuSeparator",OGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Hc.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});OGe.displayName=o2n;var l2n="MenuArrow",MGe=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=jz(n);return i.jsx(hfe,{...s,...r,ref:e})});MGe.displayName=l2n;var c2n="MenuSub",[w4n,RGe]=Y5(c2n),p9="MenuSubTrigger",LGe=h.forwardRef((t,e)=>{const n=$8(p9,t.__scopeMenu),r=dI(p9,t.__scopeMenu),s=RGe(p9,t.__scopeMenu),a=gfe(p9,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(xfe,{asChild:!0,...u,children:i.jsx(AGe,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":$Ge(n.open),...t,ref:vz(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,Pk(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,Pk(f=>{var g,y;d();const x=(g=n.content)==null?void 0:g.getBoundingClientRect();if(x){const v=(y=n.content)==null?void 0:y.dataset.side,C=v==="right",N=C?-5:5,I=x[C?"left":"right"],P=x[C?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+N,y:f.clientY},{x:I,y:x.top},{x:P,y:x.top},{x:P,y:x.bottom},{x:I,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===" "||Hyn[r.dir].includes(f.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),f.preventDefault())})})})});LGe.displayName=p9;var DGe="MenuSubContent",BGe=h.forwardRef((t,e)=>{const n=SGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=$8(fp,t.__scopeMenu),o=dI(fp,t.__scopeMenu),l=RGe(DGe,t.__scopeMenu),c=h.useRef(null),u=du(e,c);return i.jsx(Ik.Provider,{scope:t.__scopeMenu,children:i.jsx($2,{present:r||a.open,children:i.jsx(Ik.Slot,{scope:t.__scopeMenu,children:i.jsx(bfe,{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=Vyn[o.dir].includes(d.key);f&&x&&(a.onOpenChange(!1),(g=l.trigger)==null||g.focus(),d.preventDefault())})})})})})});BGe.displayName=DGe;function $Ge(t){return t?"open":"closed"}function sB(t){return t==="indeterminate"}function wfe(t){return sB(t)?"indeterminate":t?"checked":"unchecked"}function u2n(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function d2n(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function f2n(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=d2n(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 h2n(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 p2n(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return h2n(n,e)}function Pk(t){return e=>e.pointerType==="mouse"?t(e):void 0}var m2n=CGe,x2n=xfe,g2n=NGe,b2n=yfe,y2n=jGe,v2n=Az,w2n=_Ge,C2n=kGe,S2n=IGe,N2n=FGe,j2n=OGe,A2n=MGe,_2n=LGe,E2n=BGe,_z="DropdownMenu",[k2n,C4n]=K5(_z,[vGe]),Sf=vGe(),[T2n,UGe]=k2n(_z),zGe=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,c=Sf(e),u=h.useRef(null),[d,f]=wz({prop:s,defaultProp:a??!1,onChange:o,caller:_z});return i.jsx(T2n,{scope:e,triggerId:tB(),triggerRef:u,contentId:tB(),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})})};zGe.displayName=_z;var HGe="DropdownMenuTrigger",VGe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,a=UGe(HGe,n),o=Sf(n);return i.jsx(x2n,{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:vz(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())})})})});VGe.displayName=HGe;var WGe="DropdownMenuContent",qGe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=UGe(WGe,n),a=Sf(n),o=h.useRef(!1);return i.jsx(g2n,{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)"}})});qGe.displayName=WGe;var I2n="DropdownMenuGroup",P2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(b2n,{...s,...r,ref:e})});P2n.displayName=I2n;var F2n="DropdownMenuLabel",O2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(y2n,{...s,...r,ref:e})});O2n.displayName=F2n;var M2n="DropdownMenuItem",GGe=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(v2n,{...s,...r,ref:e})});GGe.displayName=M2n;var R2n="DropdownMenuCheckboxItem",L2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(w2n,{...s,...r,ref:e})});L2n.displayName=R2n;var D2n="DropdownMenuRadioGroup",B2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(C2n,{...s,...r,ref:e})});B2n.displayName=D2n;var $2n="DropdownMenuRadioItem",U2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(S2n,{...s,...r,ref:e})});U2n.displayName=$2n;var z2n="DropdownMenuItemIndicator",H2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(N2n,{...s,...r,ref:e})});H2n.displayName=z2n;var V2n="DropdownMenuSeparator",W2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(j2n,{...s,...r,ref:e})});W2n.displayName=V2n;var q2n="DropdownMenuArrow",G2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(A2n,{...s,...r,ref:e})});G2n.displayName=q2n;var K2n="DropdownMenuSubTrigger",Y2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(_2n,{...s,...r,ref:e})});Y2n.displayName=K2n;var X2n="DropdownMenuSubContent",Q2n=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Sf(n);return i.jsx(E2n,{...s,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Q2n.displayName=X2n;var aZ=zGe,Z2n=VGe,oZ=qGe,lZ=GGe,Ez="Popover",[KGe,S4n]=K5(Ez,[B8]),fI=B8(),[J2n,U2]=KGe(Ez),YGe=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!1}=t,l=fI(e),c=h.useRef(null),[u,d]=h.useState(!1),[f,x]=wz({prop:r,defaultProp:s??!1,onChange:a,caller:Ez});return i.jsx(dfe,{...l,children:i.jsx(J2n,{scope:e,contentId:tB(),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})})};YGe.displayName=Ez;var XGe="PopoverAnchor",evn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(XGe,n),a=fI(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return h.useEffect(()=>(o(),()=>l()),[o,l]),i.jsx(Sz,{...a,...r,ref:e})});evn.displayName=XGe;var QGe="PopoverTrigger",ZGe=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(QGe,n),a=fI(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":rKe(s.open),...r,ref:o,onClick:mi(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:i.jsx(Sz,{asChild:!0,...a,children:l})});ZGe.displayName=QGe;var Cfe="PopoverPortal",[tvn,nvn]=KGe(Cfe,{forceMount:void 0}),JGe=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,a=U2(Cfe,e);return i.jsx(tvn,{scope:e,forceMount:n,children:i.jsx($2,{present:n||a.open,children:i.jsx(pfe,{asChild:!0,container:s,children:r})})})};JGe.displayName=Cfe;var Sj="PopoverContent",eKe=h.forwardRef((t,e)=>{const n=nvn(Sj,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,a=U2(Sj,t.__scopePopover);return i.jsx($2,{present:r||a.open,children:a.modal?i.jsx(svn,{...s,ref:e}):i.jsx(ivn,{...s,ref:e})})});eKe.displayName=Sj;var rvn=Tk("PopoverContent.RemoveScroll"),svn=h.forwardRef((t,e)=>{const n=U2(Sj,t.__scopePopover),r=h.useRef(null),s=du(e,r),a=h.useRef(!1);return h.useEffect(()=>{const o=r.current;if(o)return pGe(o)},[]),i.jsx(mfe,{as:rvn,allowPinchZoom:!0,children:i.jsx(tKe,{...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})})})}),ivn=h.forwardRef((t,e)=>{const n=U2(Sj,t.__scopePopover),r=h.useRef(!1),s=h.useRef(!1);return i.jsx(tKe,{...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()}})}),tKe=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=U2(Sj,n),g=fI(n);return Kqe(),i.jsx(lfe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Cz,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>x.onOpenChange(!1),children:i.jsx(ffe,{"data-state":rKe(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)"}})})})}),nKe="PopoverClose",avn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(nKe,n);return i.jsx(Hc.button,{type:"button",...r,ref:e,onClick:mi(t.onClick,()=>s.onOpenChange(!1))})});avn.displayName=nKe;var ovn="PopoverArrow",lvn=h.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=fI(n);return i.jsx(hfe,{...s,...r,ref:e})});lvn.displayName=ovn;function rKe(t){return t?"open":"closed"}var cvn=YGe,uvn=ZGe,dvn=JGe,fvn=eKe;const hvn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,pvn=[{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,N]=h.useState(null),[I,P]=h.useState(null),[M,F]=h.useState(""),{setSignModalOpen:$,copyTradeWatchList:L,getCopyTradeWatchList:z,getTrackedWatchList:Q,setIsWhitelist:se,setMushboomerETH:ee,setMushboomerSOL:K}=h.useContext(Yr);h.useEffect(()=>{const q=()=>{const ne="https://dextradata.nftinit.io/api/hyper/top_whales/",oe=d==="All"?ne:`${ne}?user_tier=${d}`;ps.get(oe).then(he=>{var _e;return e(((_e=he.data)==null?void 0:_e.positions_list)||[])})};q();const W=setInterval(q,3e4);return()=>clearInterval(W)},[d]),h.useEffect(()=>{const q=localStorage.getItem("hyperToken"),W=localStorage.getItem("hyperAddress");!q||!W||(async()=>{var ne,oe;try{const he=await vi(W.toLowerCase(),q);he!=null&&he.success&&(se(he.whitelist),ee(((ne=he.mushboomer_counts)==null?void 0:ne.eth)||0),K(((oe=he.mushboomer_counts)==null?void 0:oe.sol)||0))}catch{}})()},[]),h.useEffect(()=>{localStorage.getItem("hyperToken")&&(z(),Q())},[]);const re=async({walletAddress:q,isFollow:W,isScalper:ne})=>{try{const oe=localStorage.getItem("hyperToken"),he=localStorage.getItem("hyperAddress");if(!oe){$(!0);return}const _e=W?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",xe=W?{address:he?he.toLowerCase():localAddress,token:oe,follow_address:q.toLowerCase()}:{address:he?he.toLowerCase():localAddress,token:oe},ge=await(await fetch(_e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(xe)})).json();if(!ge.success){dn.error(ge.error_message||"Something went wrong");return}z(),Q(),P(Array.isArray(ge==null?void 0:ge.data)?[...ge.data].sort((Ce,je)=>new Date(je.created_at||0)-new Date(Ce.created_at||0)):ge==null?void 0:ge.data),F(q),N(ne),v(!0)}catch(oe){dn.error(oe.message||"Something went wrong")}},de=h.useMemo(()=>[...new Set(t.map(q=>q.coin))],[t]),G=h.useMemo(()=>t.filter(q=>{if(n!=="All"&&q.coin!==n||s!=="All"&&q.direction!==s.toLowerCase()||d!=="All"&&![String(d),id[d].label].includes(String(q.user_tier)))return!1;if(o){const W=Number(q.unrealized_pnl),ne=Math.min(o.min,o.max),oe=Math.max(o.min,o.max);if(W<ne||W>oe)return!1}return!(c==="Profit"&&Number(q.funding_paid)<=0||c==="Loss"&&Number(q.funding_paid)>=0)}),[t,n,s,o,c,d]),ie=q=>{if(q==null)return"-";const W=Number(q),ne=W<0?"-":"",oe=Math.abs(W);return oe>=1e9?`${ne}$${(oe/1e9).toFixed(2)}B`:oe>=1e6?`${ne}$${(oe/1e6).toFixed(2)}M`:oe>=1e3?`${ne}$${(oe/1e3).toFixed(2)}K`:`${ne}$${oe.toFixed(2)}`},ae=[{key:"rank",label:"#",width:"46px",render:(q,W,ne)=>i.jsx("span",{className:"text-[#9B9B9B]",children:ne+1})},{key:"wallet",label:"Wallet",width:"210px",render:(q,W)=>{const ne=ofe(W.user_tier);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[18px] leading-none",children:ne.emoji}),i.jsx("a",{href:`/wallet-details/${W.address}`,target:"_blank",onClick:oe=>oe.stopPropagation(),className:"text-white font-medium hover:text-white w-24",children:hvn(W.address)}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ${ne.bg} ${ne.txt}`,children:ne.label})]})}},{key:"coin",label:"Coin",sortable:!0,width:"95px",render:(q,W)=>i.jsxs("a",{href:`/terminal/${W.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/${W.coin}.svg`,onError:Qi,className:"w-5 h-5 mr-2"}),W.coin]})},{key:"direction",label:"Direction",width:"150px ",sortable:!0,render:(q,W)=>{const ne=W.direction==="long",oe=ne?"LONG":"SHORT",he=ne?"#67FFBD":"#FF797C",_e=ne?"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 ${_e}`,style:{color:he},children:[i.jsx(Os,{className:`w-3 h-3 ${ne?"rotate-180":""}`,style:{color:he}}),oe]}),i.jsxs("div",{className:`inline-flex items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium ${_e}`,style:{color:he},children:[W.max_leverage,"X"]})]})}},{key:"notional",label:"Position",sortable:!0,width:"130px",sortValue:q=>Number(q.notional),render:(q,W)=>ie(Number(W.notional))},{key:"szi",label:"Size",sortable:!0,sortValue:q=>Number(q.szi),render:q=>ie(q)},{key:"entry_price",label:"Entry",sortable:!0,sortValue:q=>Number(q.entry_price),render:q=>ie(q)},{key:"market_price",label:"Market",sortable:!0,sortValue:q=>Number(q.market_price),render:q=>ie(q)},{key:"unrealized_pnl",label:"PnL",sortable:!0,sortValue:q=>Math.abs(Number(q.unrealized_pnl)),render:q=>{const W=Number(q)>=0;return i.jsxs("span",{className:`flex items-center ${W?"text-[#3DB380]":"text-[#FF797C]"}`,children:[ie(Math.abs(q)),i.jsx("img",{src:W?x_:g_,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:q=>Number(q.liq_price),render:q=>ie(q)},{key:"funding_paid",label:"Fee",sortable:!0,sortValue:q=>Number(q.funding_paid),render:q=>{const W=Number(q)>=0;return i.jsxs("span",{className:`flex items-center ${W?"text-[#3DB380]":"text-[#FF797C]"}`,children:[ie(Math.abs(q)),i.jsx("img",{src:W?x_:g_,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"action",label:"Action",width:"100px",render:(q,W)=>{const ne=L.some(oe=>oe.wallet_address===W.address);return i.jsx("div",{onClick:oe=>{oe.preventDefault(),oe.stopPropagation(),re({walletAddress:W.address,isFollow:ne})},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(U5,{open:y,setOpen:v,copyTradeData:I,copyTradeWallet:M,setCopyTradeWallet:F,isScalper:C,setCopyTradeData:P}),i.jsx(Us,{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(q=>!q),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:oct,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(Zje,{mobile:!0,symbols:de,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(Zje,{symbols:de,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((q,W)=>i.jsx("div",{className:"animate-pulse bg-[#202020] h-[24px] w-full rounded-md"},W))}):i.jsx(zu,{data:G,columns:ae,rowKey:q=>q.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 cZ({children:t,value:e}){return i.jsx(Z2n,{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(u_,{className:"w-4 h-4 shrink-0"})]})})}function Zje({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 N=x===""?null:Number(x),I=y===""?null:Number(y),P=N??I??0,M=I??N??1/0;l({min:P,max:M,label:`${P<0?"-":""}$${Math.abs(P)} - ${M===1/0?"∞":`${M<0?"-":""}$${Math.abs(M)}`}`})},[x,y]);const C=t?"flex flex-wrap gap-2 px-4 py-4 bg-[#1B1B1B] rounded-[16px]":"flex items-center gap-[8px] py-3 overflow-x-auto";return i.jsxs("div",{className:C,children:[!t&&i.jsxs("div",{className:"flex items-center gap-[8px] text-white font-medium pr-[8px]",children:[i.jsx("img",{src:act,className:"w-[21px] h-[21px]"}),i.jsx("span",{className:"font-manrope text-[14px] font-medium",children:"Filters"})]}),i.jsxs(aZ,{children:[i.jsxs(cZ,{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:Qi,className:"w-4 h-4"}),n]})]}),i.jsx(oZ,{sideOffset:6,className:"z-50 min-w-[140px] max-h-[280px] overflow-y-auto rounded-md bg-[#242424] p-2",children:["All",...e].map(N=>i.jsxs(lZ,{onSelect:()=>r(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${n===N?"bg-[#2F2F2F]":""}`,children:[N!=="All"&&i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${N}.svg`,onError:Qi,className:"w-4 h-4"}),N]},N))})]}),i.jsxs(aZ,{children:[i.jsxs(cZ,{value:s!=="All",children:["Side ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:s})]}),i.jsx(oZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Long","Short"].map(N=>i.jsx(lZ,{onSelect:()=>a(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${s===N?"bg-[#2F2F2F]":""}`,children:N},N))})]}),i.jsxs(aZ,{children:[i.jsxs(cZ,{value:c!=="All",children:["Fee ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:c})]}),i.jsx(oZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Profit","Loss"].map(N=>i.jsx(lZ,{onSelect:()=>u(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${c===N?"bg-[#2F2F2F]":""}`,children:N},N))})]}),i.jsxs(cvn,{children:[i.jsx(uvn,{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(u_,{className:"w-4 h-4"})]})}),i.jsx(dvn,{children:i.jsxs(fvn,{sideOffset:6,align:"start",className:"z-50 w-64 rounded-lg bg-[#242424] p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("span",{className:"text-white font-manrope text-[13px] font-medium leading-[8px] pl-[15px]",children:"Unrealized PnL"}),i.jsx("button",{onClick:()=>{g(""),v("")},className:"rounded-[6px] border border-[#353535] px-2 py-[6px] text-[#CECECE] font-manrope text-[11px] font-medium leading-[8px] bg-transparent",children:"Clear"})]}),i.jsx("div",{className:"space-y-3",children:["Min","Max"].map((N,I)=>{const P=I===0?x:y,M=I===0?g:v,F=P!=="";return i.jsxs("div",{children:[i.jsx("label",{className:"block mb-1 text-[#A8A8A8] text-[13px] leading-[8px] tracking-[-0.26px] font-normal pl-[15px] pb-[9px]",children:N}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#67FFBD] text-sm",children:"$"}),i.jsx("input",{type:"number",value:P,onChange:$=>M($.target.value),placeholder:"..",className:`w-full h-[32px] pl-7 pr-3 rounded-md outline-none text-[14px] leading-[8px] tracking-[-0.28px] font-medium ${F?"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]":"bg-[#353535] text-[#A8A8A8]"}`})]})]},N)})}),i.jsx("div",{className:"h-px bg-[#363636]"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-white font-inter text-[13px] font-medium leading-[8px] pl-[15px] pb-[13px] pt-1",children:"Presets"}),pvn.map(N=>i.jsx("button",{onClick:()=>{N.label==="All"?(g(""),v("")):(g(N.min.toString()),v(N.max===1/0?"":N.max.toString()))},className:`w-full text-left px-3 py-2 rounded-md text-[13px] leading-[8px] tracking-[-0.26px] font-medium bg-transparent ${(o==null?void 0:o.label)===N.label?"bg-[#2F2F2F] text-white":"text-[#A8A8A8]"} hover:bg-[#2A2A2A] hover:rounded-[6px] hover:p-[9px] hover:text-white hover:border-none`,children:N.label},N.label))]})]})})]}),i.jsx("div",{className:"h-5 w-px bg-[#262626] mx-3"}),i.jsx("div",{className:"inline-flex items-center h-8 px-1.5 py-[18px] rounded-[8px] border border-[#262626] flex-shrink-0 gap-[12px]",children:i.jsxs("div",{className:"flex items-center gap-[12px]",children:[i.jsx("div",{onClick:()=>f("All"),className:`flex items-center justify-center h-7 w-7 px-4 rounded-[8px] text-white text-[14px] font-inter leading-[16px] cursor-pointer transition-colors ${d==="All"?"bg-[#262626]":"hover:bg-[#262626]"}`,children:"All"}),kk.map(({id:N,emoji:I,description:P})=>{const M=d===N;return i.jsx("div",{onClick:()=>f(M?"All":N),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] cursor-pointer transition-colors ${M?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(Us,{content:P,children:I})},N)})]})})]})}function xvn({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(zD,{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(Oie,{className:"w-[10px] h-[10px]",style:{color:c}}):i.jsx(zl,{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 uZ,kz="HoverCard",[sKe,N4n]=K5(kz,[B8]),Tz=B8(),[gvn,Iz]=sKe(kz),iKe=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:s,onOpenChange:a,openDelay:o=700,closeDelay:l=300}=t,c=Tz(e),u=h.useRef(0),d=h.useRef(0),f=h.useRef(!1),x=h.useRef(!1),[g,y]=wz({prop:r,defaultProp:s??!1,onChange:a,caller:kz}),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]),N=h.useCallback(()=>y(!1),[y]);return h.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),i.jsx(gvn,{scope:e,open:g,onOpenChange:y,onOpen:v,onClose:C,onDismiss:N,hasSelectionRef:f,isPointerDownOnContentRef:x,children:i.jsx(dfe,{...c,children:n})})};iKe.displayName=kz;var aKe="HoverCardTrigger",oKe=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=Iz(aKe,n),a=Tz(n);return i.jsx(Sz,{asChild:!0,...a,children:i.jsx(Hc.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:mi(t.onPointerEnter,aB(s.onOpen)),onPointerLeave:mi(t.onPointerLeave,aB(s.onClose)),onFocus:mi(t.onFocus,s.onOpen),onBlur:mi(t.onBlur,s.onClose),onTouchStart:mi(t.onTouchStart,o=>o.preventDefault())})})});oKe.displayName=aKe;var Sfe="HoverCardPortal",[bvn,yvn]=sKe(Sfe,{forceMount:void 0}),lKe=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:s}=t,a=Iz(Sfe,e);return i.jsx(bvn,{scope:e,forceMount:n,children:i.jsx($2,{present:n||a.open,children:i.jsx(pfe,{asChild:!0,container:s,children:r})})})};lKe.displayName=Sfe;var iB="HoverCardContent",cKe=h.forwardRef((t,e)=>{const n=yvn(iB,t.__scopeHoverCard),{forceMount:r=n.forceMount,...s}=t,a=Iz(iB,t.__scopeHoverCard);return i.jsx($2,{present:r||a.open,children:i.jsx(vvn,{"data-state":a.open?"open":"closed",...s,onPointerEnter:mi(t.onPointerEnter,aB(a.onOpen)),onPointerLeave:mi(t.onPointerLeave,aB(a.onClose)),ref:e})})});cKe.displayName=iB;var vvn=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,...l}=t,c=Iz(iB,n),u=Tz(n),d=h.useRef(null),f=du(e,d),[x,g]=h.useState(!1);return h.useEffect(()=>{if(x){const y=document.body;return uZ=y.style.userSelect||y.style.webkitUserSelect,y.style.userSelect="none",y.style.webkitUserSelect="none",()=>{y.style.userSelect=uZ,y.style.webkitUserSelect=uZ}}},[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&&Svn(d.current).forEach(v=>v.setAttribute("tabindex","-1"))}),i.jsx(Cz,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:mi(a,y=>{y.preventDefault()}),onDismiss:c.onDismiss,children:i.jsx(ffe,{...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)"}})})}),wvn="HoverCardArrow",Cvn=h.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=Tz(n);return i.jsx(hfe,{...s,...r,ref:e})});Cvn.displayName=wvn;function aB(t){return e=>e.pointerType==="touch"?void 0:t()}function Svn(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 Nvn=iKe,jvn=oKe,Avn=lKe,_vn=cKe;const Evn="#67FFBD",kvn="#FF797C",dZ=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 Tvn({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:Evn}}),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:dZ(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:kvn}}),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:dZ(r.short)}),i.jsxs("span",{className:"text-[10px] font-medium leading-[10px] text-[#909090]",children:["(",a,"%)"]})]})]});return i.jsx(Us,{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:dZ(r.total)})]})},r.coin)})]})}const Ivn="https://dextradata.nftinit.io/api/hyper/wallet/whale/open_interest/?period=1d",Pvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/tx_summary/?period=1d",Fvn={BTC:"Bitcoin",ETH:"Ethereum",HYPE:"Hyperliquid",SOL:"Solana",XRP:"XRP",PUMP:"Pump",FARTCOIN:"Fartcoin"},Ovn=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 Mvn(){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([ps.get(Ivn),ps.get(Pvn)]),C=((u=(c=y.data)==null?void 0:c.position_summary)==null?void 0:u.slice(0,10).map(M=>({coin:M.coin,long:Number(M.long),short:Number(M.short),total:Number(M.total)})))||[],N=((f=(d=v.data)==null?void 0:d.whale_summary)==null?void 0:f.slice(0,10).map(M=>({coin:M.coin,long:Number(M.long_tx_count),short:Number(M.short_tx_count),total:Number(M.total_tx_count)})))||[];r(C),a(N);const I=C[0]||{},P=((g=(x=v.data)==null?void 0:x.whale_summary)==null?void 0:g[0])||{};e([{type:"position",title:"Highest OI",coin:I.coin||"",name:Fvn[I.coin]||I.coin,value:Ovn(I.total)},{type:"trader",title:"Most Traded",coin:P.coin||"",name:"Top Trader",value:`${P.whale_count??"-"} Whales | TX: ${P.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(Nvn,{openDelay:0,closeDelay:0,children:[i.jsx(jvn,{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(Avn,{children:i.jsx(_vn,{side:"right",align:"start",sideOffset:0,collisionPadding:8,children:i.jsx(Tvn,{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 Rvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/top_user_pnl/?period=1d",Lvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/high_risk_traders/?period=1d",Dvn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,Bvn=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 $vn(){const[t,e]=h.useState(null);return h.useEffect(()=>{const n=async()=>{var s,a,o,l;try{const[c,u]=await Promise.all([ps.get(Rvn),ps.get(Lvn)]),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:Dvn(g.user_token),wallet:g.user_token,amount:`${Number(g.pnl)>=0?"+":"-"}${Bvn(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(zqe,{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(Us,{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 fZ(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 Uvn({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(Us,{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:fZ(e)})]}),i.jsx(xvn,{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(Us,{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:fZ(e)})]}),i.jsx(Mvn,{})]}),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(Us,{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:fZ(e)})]}),i.jsx($vn,{})]})]})}function zvn(){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(Ga,{children:i.jsxs(no,{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:bae,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(Us,{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:blt,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(z1n,{onData:s=>{e(s),r(new Date)}})}),i.jsx("div",{className:"w-full sm:w-2/3",children:i.jsx(fbn,{})})]}),i.jsx("div",{className:"mt-4",children:i.jsx(Uvn,{data:t,lastUpdated:n})}),i.jsx("div",{className:"mt-4",children:i.jsx(mvn,{})})]})]})}const Hvn=()=>{const{setSignModalOpen:t}=h.useContext(Yr),{address:e}=es(),[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 N=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!N||n.join("")===""||n.join("").length<6){N?n.join("")===""?a("Please enter the verification code."):n.join("").length<6&&a("The verification code must be 6 characters long."):t(!0);return}l(!0),a("");const P="https://dextrabothypev2.nftinit.io/api/telegram/sign_with_telegram/",M={address:e?e.toLowerCase():I,token:N,temp_password:n.join("")},$=await(await fetch(P,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(M)})).json();$!=null&&$.success?($!=null&&$.telegram_chat_id&&u(!0),r(Array(6).fill("")),dn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#67ffbd",paddingLeft:"5px"},children:"Verified successfully."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.32)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),l(!1)):(console.log($.error_message),a("Invalid code. Please request a new code from Telegram and try again."),f(!0),l(!1))}catch(N){console.error("Error in telegram verify:",N),dn.error(N.message||"Something went wrong!"),a(N.message||"Something went wrong!"),f(!0),l(!1)}},g=(N,I)=>{f(!1);const P=[...n];P[I]=N.target.value.toUpperCase().slice(0,1),r(P),N.target.value.length===1&&I<5&&document.getElementById(`code-input-${I+1}`).focus()},y=N=>{f(!1);const I=N.clipboardData.getData("Text").slice(0,6),P=[...n];for(let F=0;F<I.length;F++)P[F]=I[F].toUpperCase();r(P);const M=document.getElementById(`code-input-${(I==null?void 0:I.length)-1}`);M==null||M.focus(),M==null||M.select()},v=(N,I)=>{var P,M;if(f(!1),N.key==="Backspace"){if(n[I]){const F=[...n];F[I]="",r(F)}else if(I>0){const F=document.getElementById(`code-input-${I-1}`),$=[...n];$[I-1]="",r($),F==null||F.focus()}}else N.key==="ArrowLeft"&&I>0?(P=document.getElementById(`code-input-${I-1}`))==null||P.focus():N.key==="ArrowRight"&&I<5&&((M=document.getElementById(`code-input-${I+1}`))==null||M.focus())},C=()=>{r(Array(6).fill("")),f(!1)};return i.jsxs("div",{className:"flex flex-col items-center justify-center px-2 pb-2 gap-6 w-max h-max bg-[#212121]/90 rounded-2xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#2a2a2a] relative pt-10",onPaste:y,children:[s&&i.jsxs("div",{style:{backdropFilter:"blur(16px)"},className:"w-full max-w-[345px] px-3 py-2 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 absolute top-2 ",children:[i.jsx("img",{src:Hl,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:k_e,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:T_e,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:fct,alt:"",className:"w-auto h-[40px]"}),i.jsx("h1",{className:"text-center text-white text-sm font-medium font-['Inter'] leading-4 tracking-[-0.28px]",children:"Verify Your Telegram Account"}),i.jsx("p",{className:"mb-2 -mt-4 text-center text-[#929292] text-[13px] font-normal font-['Inter'] leading-4 max-w-[240px]",children:"Enter the 6-character verification code sent to your Telegram account."}),i.jsx("div",{className:"flex gap-2",children:n.map((N,I)=>i.jsx("input",{id:`code-input-${I}`,type:"text",maxLength:"1",value:N,autoComplete:"off",onChange:P=>g(P,I),onKeyDown:P=>v(P,I),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`},I))}),i.jsxs("div",{className:"text-center",children:[i.jsxs("span",{class:"text-[#929292] text-[11px] font-normal font-['Inter'] leading-none",children:["Didn’t get a code?"," "]}),i.jsx("span",{onClick:()=>window.open("https://t.me/Dextrabot_CopyTrade_bot","_blank"),class:"text-[#929292] hover:text-white text-[11px] font-medium font-['Inter'] leading-4 cursor-pointer",children:"Open Telegram App"})]}),i.jsxs("div",{className:"flex items-center justify-center gap-2 relative",children:[i.jsx("div",{onClick:C,className:"w-[140px] h-10 px-6 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] outline outline-1 outline-offset-[-1px] outline-[#424242] flex justify-center items-center gap-2.5 cursor-pointer group",children:i.jsx("div",{className:"text-[#b7b7b7] group-hover:text-white text-sm font-semibold font-['Inter'] leading-4 tracking-[-0.28px]",children:"Clear"})}),i.jsx("div",{onClick:N=>{N.preventDefault(),o||x()},className:"w-[196px] h-10 px-6 py-3 bg-white hover:bg-[#E5E5E5] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-center items-center gap-2.5 cursor-pointer",children:o?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[72px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-[8px]",children:"Authorize Wallet"})})]})]})]})},Vvn=()=>{const{isConnected:t,address:e}=es(),{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(Yr),[v,C]=h.useState(!!window.localStorage.getItem("hyperToken"));return h.useEffect(()=>{const N=window.localStorage.getItem("hyperToken");C(!!N)},[e,t,n,r]),h.useEffect(()=>{(async()=>{var M,F;const I=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!(!I||!P))try{const $=await vi(P.toLowerCase(),I);$!=null&&$.success?(a($==null?void 0:$.telegram_chat_id),o($==null?void 0:$.subscriber_role),l($==null?void 0:$.subs_expire_day),c((M=$==null?void 0:$.mushboomer_counts)==null?void 0:M.eth),u((F=$==null?void 0:$.mushboomer_counts)==null?void 0:F.sol),d($==null?void 0:$.referral_code),f($==null?void 0:$.refcode),x($==null?void 0:$.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""))}catch($){console.error("Token verification error:",$),console.error($.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(Hvn,{}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(pz,{})})})]})};function Wvn({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(hl,{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 qvn(){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 Nfe={};(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 ne=new OffscreenCanvas(1,1),oe=ne.getContext("2d");oe.fillRect(0,0,1,1);var he=ne.transferToImageBitmap();try{oe.createPattern(he,"no-repeat")}catch{return!1}return!0}();function c(){}function u(ne){var oe=n.exports.Promise,he=oe!==void 0?oe:e.Promise;return typeof he=="function"?new he(ne):(ne(c,c),null)}var d=function(ne,oe){return{transform:function(he){if(ne)return he;if(oe.has(he))return oe.get(he);var _e=new OffscreenCanvas(he.width,he.height),xe=_e.getContext("2d");return xe.drawImage(he,0,0),oe.set(he,_e),_e},clear:function(){oe.clear()}}}(l,new Map),f=function(){var ne=Math.floor(16.666666666666668),oe,he,_e={},xe=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(oe=function(Se){var ge=Math.random();return _e[ge]=requestAnimationFrame(function Ce(je){xe===je||xe+ne-1<je?(xe=je,delete _e[ge],Se()):_e[ge]=requestAnimationFrame(Ce)}),ge},he=function(Se){_e[Se]&&cancelAnimationFrame(_e[Se])}):(oe=function(Se){return setTimeout(Se,ne)},he=function(Se){return clearTimeout(Se)}),{frame:oe,cancel:he}}(),x=function(){var ne,oe,he={};function _e(xe){function Se(ge,Ce){xe.postMessage({options:ge||{},callback:Ce})}xe.init=function(Ce){var je=Ce.transferControlToOffscreen();xe.postMessage({canvas:je},[je])},xe.fire=function(Ce,je,Oe){if(oe)return Se(Ce,null),oe;var $e=Math.random().toString(36).slice(2);return oe=u(function(Ye){function Je(ht){ht.data.callback===$e&&(delete he[$e],xe.removeEventListener("message",Je),oe=null,d.clear(),Oe(),Ye())}xe.addEventListener("message",Je),Se(Ce,$e),he[$e]=Je.bind(null,{data:{callback:$e}})}),oe},xe.reset=function(){xe.postMessage({reset:!0});for(var Ce in he)he[Ce](),delete he[Ce]}}return function(){if(ne)return ne;if(!r&&a){var xe=["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{ne=new Worker(URL.createObjectURL(new Blob([xe])))}catch(Se){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",Se),null}_e(ne)}return ne}}(),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(ne,oe){return oe?oe(ne):ne}function v(ne){return ne!=null}function C(ne,oe,he){return y(ne&&v(ne[oe])?ne[oe]:g[oe],he)}function N(ne){return ne<0?0:Math.floor(ne)}function I(ne,oe){return Math.floor(Math.random()*(oe-ne))+ne}function P(ne){return parseInt(ne,16)}function M(ne){return ne.map(F)}function F(ne){var oe=String(ne).replace(/[^0-9a-f]/gi,"");return oe.length<6&&(oe=oe[0]+oe[0]+oe[1]+oe[1]+oe[2]+oe[2]),{r:P(oe.substring(0,2)),g:P(oe.substring(2,4)),b:P(oe.substring(4,6))}}function $(ne){var oe=C(ne,"origin",Object);return oe.x=C(oe,"x",Number),oe.y=C(oe,"y",Number),oe}function L(ne){ne.width=document.documentElement.clientWidth,ne.height=document.documentElement.clientHeight}function z(ne){var oe=ne.getBoundingClientRect();ne.width=oe.width,ne.height=oe.height}function Q(ne){var oe=document.createElement("canvas");return oe.style.position="fixed",oe.style.top="0px",oe.style.left="0px",oe.style.pointerEvents="none",oe.style.zIndex=ne,oe}function se(ne,oe,he,_e,xe,Se,ge,Ce,je){ne.save(),ne.translate(oe,he),ne.rotate(Se),ne.scale(_e,xe),ne.arc(0,0,1,ge,Ce,je),ne.restore()}function ee(ne){var oe=ne.angle*(Math.PI/180),he=ne.spread*(Math.PI/180);return{x:ne.x,y:ne.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:ne.startVelocity*.5+Math.random()*ne.startVelocity,angle2D:-oe+(.5*he-Math.random()*he),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:ne.color,shape:ne.shape,tick:0,totalTicks:ne.ticks,decay:ne.decay,drift:ne.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:ne.gravity*3,ovalScalar:.6,scalar:ne.scalar,flat:ne.flat}}function K(ne,oe){oe.x+=Math.cos(oe.angle2D)*oe.velocity+oe.drift,oe.y+=Math.sin(oe.angle2D)*oe.velocity+oe.gravity,oe.velocity*=oe.decay,oe.flat?(oe.wobble=0,oe.wobbleX=oe.x+10*oe.scalar,oe.wobbleY=oe.y+10*oe.scalar,oe.tiltSin=0,oe.tiltCos=0,oe.random=1):(oe.wobble+=oe.wobbleSpeed,oe.wobbleX=oe.x+10*oe.scalar*Math.cos(oe.wobble),oe.wobbleY=oe.y+10*oe.scalar*Math.sin(oe.wobble),oe.tiltAngle+=.1,oe.tiltSin=Math.sin(oe.tiltAngle),oe.tiltCos=Math.cos(oe.tiltAngle),oe.random=Math.random()+2);var he=oe.tick++/oe.totalTicks,_e=oe.x+oe.random*oe.tiltCos,xe=oe.y+oe.random*oe.tiltSin,Se=oe.wobbleX+oe.random*oe.tiltCos,ge=oe.wobbleY+oe.random*oe.tiltSin;if(ne.fillStyle="rgba("+oe.color.r+", "+oe.color.g+", "+oe.color.b+", "+(1-he)+")",ne.beginPath(),o&&oe.shape.type==="path"&&typeof oe.shape.path=="string"&&Array.isArray(oe.shape.matrix))ne.fill(ae(oe.shape.path,oe.shape.matrix,oe.x,oe.y,Math.abs(Se-_e)*.1,Math.abs(ge-xe)*.1,Math.PI/10*oe.wobble));else if(oe.shape.type==="bitmap"){var Ce=Math.PI/10*oe.wobble,je=Math.abs(Se-_e)*.1,Oe=Math.abs(ge-xe)*.1,$e=oe.shape.bitmap.width*oe.scalar,Ye=oe.shape.bitmap.height*oe.scalar,Je=new DOMMatrix([Math.cos(Ce)*je,Math.sin(Ce)*je,-Math.sin(Ce)*Oe,Math.cos(Ce)*Oe,oe.x,oe.y]);Je.multiplySelf(new DOMMatrix(oe.shape.matrix));var ht=ne.createPattern(d.transform(oe.shape.bitmap),"no-repeat");ht.setTransform(Je),ne.globalAlpha=1-he,ne.fillStyle=ht,ne.fillRect(oe.x-$e/2,oe.y-Ye/2,$e,Ye),ne.globalAlpha=1}else if(oe.shape==="circle")ne.ellipse?ne.ellipse(oe.x,oe.y,Math.abs(Se-_e)*oe.ovalScalar,Math.abs(ge-xe)*oe.ovalScalar,Math.PI/10*oe.wobble,0,2*Math.PI):se(ne,oe.x,oe.y,Math.abs(Se-_e)*oe.ovalScalar,Math.abs(ge-xe)*oe.ovalScalar,Math.PI/10*oe.wobble,0,2*Math.PI);else if(oe.shape==="star")for(var rt=Math.PI/2*3,st=4*oe.scalar,He=8*oe.scalar,Ve=oe.x,bt=oe.y,xt=5,Qt=Math.PI/xt;xt--;)Ve=oe.x+Math.cos(rt)*He,bt=oe.y+Math.sin(rt)*He,ne.lineTo(Ve,bt),rt+=Qt,Ve=oe.x+Math.cos(rt)*st,bt=oe.y+Math.sin(rt)*st,ne.lineTo(Ve,bt),rt+=Qt;else ne.moveTo(Math.floor(oe.x),Math.floor(oe.y)),ne.lineTo(Math.floor(oe.wobbleX),Math.floor(xe)),ne.lineTo(Math.floor(Se),Math.floor(ge)),ne.lineTo(Math.floor(_e),Math.floor(oe.wobbleY));return ne.closePath(),ne.fill(),oe.tick<oe.totalTicks}function re(ne,oe,he,_e,xe){var Se=oe.slice(),ge=ne.getContext("2d"),Ce,je,Oe=u(function($e){function Ye(){Ce=je=null,ge.clearRect(0,0,_e.width,_e.height),d.clear(),xe(),$e()}function Je(){r&&!(_e.width===s.width&&_e.height===s.height)&&(_e.width=ne.width=s.width,_e.height=ne.height=s.height),!_e.width&&!_e.height&&(he(ne),_e.width=ne.width,_e.height=ne.height),ge.clearRect(0,0,_e.width,_e.height),Se=Se.filter(function(ht){return K(ge,ht)}),Se.length?Ce=f.frame(Je):Ye()}Ce=f.frame(Je),je=Ye});return{addFettis:function($e){return Se=Se.concat($e),Oe},canvas:ne,promise:Oe,reset:function(){Ce&&f.cancel(Ce),je&&je()}}}function de(ne,oe){var he=!ne,_e=!!C(oe||{},"resize"),xe=!1,Se=C(oe,"disableForReducedMotion",Boolean),ge=a&&!!C(oe||{},"useWorker"),Ce=ge?x():null,je=he?L:z,Oe=ne&&Ce?!!ne.__confetti_initialized:!1,$e=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,Ye;function Je(rt,st,He){for(var Ve=C(rt,"particleCount",N),bt=C(rt,"angle",Number),xt=C(rt,"spread",Number),Qt=C(rt,"startVelocity",Number),St=C(rt,"decay",Number),on=C(rt,"gravity",Number),cn=C(rt,"drift",Number),Vn=C(rt,"colors",M),tn=C(rt,"ticks",Number),fn=C(rt,"shapes"),rn=C(rt,"scalar"),nt=!!C(rt,"flat"),it=$(rt),Ut=Ve,hn=[],nn=ne.width*it.x,Vt=ne.height*it.y;Ut--;)hn.push(ee({x:nn,y:Vt,angle:bt,spread:xt,startVelocity:Qt,color:Vn[Ut%Vn.length],shape:fn[I(0,fn.length)],ticks:tn,decay:St,gravity:on,drift:cn,scalar:rn,flat:nt}));return Ye?Ye.addFettis(hn):(Ye=re(ne,hn,je,st,He),Ye.promise)}function ht(rt){var st=Se||C(rt,"disableForReducedMotion",Boolean),He=C(rt,"zIndex",Number);if(st&&$e)return u(function(Qt){Qt()});he&&Ye?ne=Ye.canvas:he&&!ne&&(ne=Q(He),document.body.appendChild(ne)),_e&&!Oe&&je(ne);var Ve={width:ne.width,height:ne.height};Ce&&!Oe&&Ce.init(ne),Oe=!0,Ce&&(ne.__confetti_initialized=!0);function bt(){if(Ce){var Qt={getBoundingClientRect:function(){if(!he)return ne.getBoundingClientRect()}};je(Qt),Ce.postMessage({resize:{width:Qt.width,height:Qt.height}});return}Ve.width=Ve.height=null}function xt(){Ye=null,_e&&(xe=!1,e.removeEventListener("resize",bt)),he&&ne&&(document.body.contains(ne)&&document.body.removeChild(ne),ne=null,Oe=!1)}return _e&&!xe&&(xe=!0,e.addEventListener("resize",bt,!1)),Ce?Ce.fire(rt,Ve,xt):Je(rt,Ve,xt)}return ht.reset=function(){Ce&&Ce.reset(),Ye&&Ye.reset()},ht}var G;function ie(){return G||(G=de(null,{useWorker:!0,resize:!0})),G}function ae(ne,oe,he,_e,xe,Se,ge){var Ce=new Path2D(ne),je=new Path2D;je.addPath(Ce,new DOMMatrix(oe));var Oe=new Path2D;return Oe.addPath(je,new DOMMatrix([Math.cos(ge)*xe,Math.sin(ge)*xe,-Math.sin(ge)*Se,Math.cos(ge)*Se,he,_e])),Oe}function q(ne){if(!o)throw new Error("path confetti are not supported in this browser");var oe,he;typeof ne=="string"?oe=ne:(oe=ne.path,he=ne.matrix);var _e=new Path2D(oe),xe=document.createElement("canvas"),Se=xe.getContext("2d");if(!he){for(var ge=1e3,Ce=ge,je=ge,Oe=0,$e=0,Ye,Je,ht=0;ht<ge;ht+=2)for(var rt=0;rt<ge;rt+=2)Se.isPointInPath(_e,ht,rt,"nonzero")&&(Ce=Math.min(Ce,ht),je=Math.min(je,rt),Oe=Math.max(Oe,ht),$e=Math.max($e,rt));Ye=Oe-Ce,Je=$e-je;var st=10,He=Math.min(st/Ye,st/Je);he=[He,0,0,He,-Math.round(Ye/2+Ce)*He,-Math.round(Je/2+je)*He]}return{type:"path",path:oe,matrix:he}}function W(ne){var oe,he=1,_e="#000000",xe='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof ne=="string"?oe=ne:(oe=ne.text,he="scalar"in ne?ne.scalar:he,xe="fontFamily"in ne?ne.fontFamily:xe,_e="color"in ne?ne.color:_e);var Se=10*he,ge=""+Se+"px "+xe,Ce=new OffscreenCanvas(Se,Se),je=Ce.getContext("2d");je.font=ge;var Oe=je.measureText(oe),$e=Math.ceil(Oe.actualBoundingBoxRight+Oe.actualBoundingBoxLeft),Ye=Math.ceil(Oe.actualBoundingBoxAscent+Oe.actualBoundingBoxDescent),Je=2,ht=Oe.actualBoundingBoxLeft+Je,rt=Oe.actualBoundingBoxAscent+Je;$e+=Je+Je,Ye+=Je+Je,Ce=new OffscreenCanvas($e,Ye),je=Ce.getContext("2d"),je.font=ge,je.fillStyle=_e,je.fillText(oe,ht,rt);var st=1/he;return{type:"bitmap",bitmap:Ce.transferToImageBitmap(),matrix:[st,0,0,st,-$e*st/2,-Ye*st/2]}}n.exports=function(){return ie().apply(this,arguments)},n.exports.reset=function(){ie().reset()},n.exports.create=de,n.exports.shapeFromPath=q,n.exports.shapeFromText=W})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),Nfe,!1);const Gvn=Nfe.exports;Nfe.exports.create;const Kvn=200,Yvn={origin:{y:.7}};function M7(t,e){Gvn({...Yvn,...e,particleCount:Math.floor(Kvn*t)})}function Xvn(){M7(.25,{spread:26,startVelocity:55}),M7(.2,{spread:60}),M7(.35,{spread:100,decay:.91,scalar:.8}),M7(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),M7(.1,{spread:120,startVelocity:45})}function Qvn({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=xe=>{navigator.clipboard.writeText(xe),dn.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=xe=>xe>=1e9?`${(xe/1e9).toFixed(0)}B`:xe>=1e6?`${(xe/1e6).toFixed(0)}M`:xe>=1e3?`${(xe/1e3).toFixed(0)}K`:xe.toFixed(0),{main:y,steps:v}=t,C=Object.values(t.steps).flat().map(xe=>({...xe,timestamp:new Date(xe.timestamp).getTime()})).sort((xe,Se)=>xe.timestamp-Se.timestamp),N={};C.forEach(xe=>{N[xe.timestamp]=(N[xe.timestamp]||0)+xe.pnl_this_step});let I=t.main.initial_equity;const P=Object.entries(N).sort((xe,Se)=>xe[0]-Se[0]).map(([xe,Se])=>(I+=Se,[Number(xe),+I.toFixed(2)])),M=P.map(([,xe])=>xe);let F=M[0],$=0;M.forEach(xe=>{xe>F&&(F=xe);const Se=(F-xe)/F;Se>$&&($=Se)});const L=($*100).toFixed(2),z=C.filter(xe=>xe.pnl_this_step>0).length,Q=C.filter(xe=>xe.pnl_this_step<0).length,se=`${(z/C.length*100).toFixed(2)}%`,ee=P.slice(1).map(([,xe],Se)=>{const ge=P[Se][1];return(xe-ge)/ge}),K=xe=>xe.length?xe.reduce((Se,ge)=>Se+ge,0)/xe.length:0,re=xe=>{const Se=K(xe),ge=K(xe.map(Ce=>(Ce-Se)**2));return Math.sqrt(ge)},de=(re(ee)?K(ee)/re(ee):0).toFixed(2),G=((y.my_total_equity/y.initial_equity-1)*100).toFixed(2),ie={},ae=xe=>{var Se;return{time:new Date(xe.timestamp).toLocaleTimeString(),pnl:xe.pnl_this_step,coin:xe.coin,activity:{direction:((Se=xe.trader_direction)==null?void 0:Se.toLowerCase())==="long"?"Long":"Short",leverage:xe.trader_leverage},size:xe.trader_szi,posValue:xe.our_target_value,entry:xe.our_pos_entry_price,close:xe.market_price}};C.forEach(xe=>{const Se=new Date(xe.timestamp).toLocaleDateString();ie[Se]=ie[Se]||{rows:[],totalPnl:0},ie[Se].rows.push(ae(xe)),ie[Se].totalPnl+=xe.pnl_this_step});const q=Object.entries(ie).sort((xe,Se)=>new Date(xe[0])-new Date(Se[0]));let W=y.initial_equity;const ne=q.map(([xe,{rows:Se,totalPnl:ge}])=>(W+=ge,{date:xe,rows:Se,totalPnl:ge,equity:W}));h.useEffect(()=>{var xe;if(((xe=t==null?void 0:t.main)==null?void 0:xe.final_pnl)>0){Xvn(),o(!0);const Se=setTimeout(()=>o(!1),3e3);return()=>clearTimeout(Se)}},[t]);const oe={chart:{type:"area",toolbar:{show:!1},background:"transparent",animations:{enabled:!1}},stroke:{width:2,curve:"straight",colors:[u]},fill:{type:"gradient",gradient:{shade:"dark",shadeIntensity:1,opacityFrom:.45,opacityTo:0,stops:[0,100],colorStops:[{offset:0,color:u,opacity:.45},{offset:100,color:u,opacity:0}]}},grid:{show:!0,borderColor:d,strokeDashArray:6,xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},xaxis:{type:"datetime",labels:{style:{colors:"#9B9B9B",fontSize:"12px",fontFamily:"Manrope",fontWeight:500},datetimeUTC:!1,format:"dd/MM"}},yaxis:{labels:{style:{colors:"#9B9B9B",fontSize:"12px",fontFamily:"Manrope",fontWeight:500},formatter:xe=>g(xe)}},dataLabels:{enabled:!1},tooltip:{theme:"dark",x:{format:"dd/MM HH:mm"},y:{formatter:xe=>`$${xe.toFixed(2)}`},marker:{fillColors:[u]}},zoom:{enabled:!1},markers:{size:0,colors:[u]}},he=[{key:"time",label:"Time",width:"0.7fr"},{key:"pnl",label:"PnL",width:"0.7fr",headerClassName:"flex justify-end",render:xe=>i.jsxs("span",{className:`flex justify-end ${xe<0?"text-[#FF797C]":"text-[#67FFBD]"}`,children:[xe<0?"- $":"$",Math.abs(xe).toFixed(2)]})},{key:"coin",label:"Symbol",sortable:!0,width:"0.7fr",render:(xe,Se)=>i.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Se.coin}.svg`,onError:Qi,className:"w-5 h-5"}),Se.coin]})},{key:"activity",label:"Direction",width:"1.3fr",render:(xe,Se)=>{const ge=Se.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 ${ge?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":"text-[#ff787b] bg-[rgba(255,131,117,0.16)]"}`,children:[i.jsx(Os,{className:`w-3 h-3 ${ge?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),`${Se.activity.direction} - ${Se.activity.leverage}x`]})}},{key:"size",label:"Size",width:"0.8fr"},{key:"posValue",label:"Position Value",width:"1fr",render:xe=>`$${xe.toFixed(2)}`},{key:"entry",label:"Entry Price",width:"0.9fr",render:xe=>`$${xe.toLocaleString()}`},{key:"close",label:"Close Price",width:"0.9fr",render:xe=>`$${xe.toLocaleString()}`}],_e=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(zD,{options:{...oe,chart:{...oe.chart,sparkline:{enabled:!1}}},series:[{name:"Equity",data:P}],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",_e?"max-w-96 sm:max-w-5xl":"max-w-96 sm:max-w-xl"].join(" "),children:[i.jsxs("div",{className:"flex items-center justify-between mb-[19px]",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-[18px] font-semibold",children:"My Backtest Results"})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{className:"px-6 py-3 text-[#0B331C] text-[13px] font-semibold rounded-[10px] bg-[#1DE674] h-[32px] flex justify-center items-center",onClick:n,children:"New Backtest"}),i.jsx("button",{className:"px-6 py-3 text-[#67FFBD] text-[13px] font-semibold rounded-[10px] bg-[rgba(103,255,189,0.16)] h-[32px] flex items-center gap-2",onClick:()=>x(window.location.href),children:"Share"})]})]}),i.jsx("div",{className:"grid grid-cols-4 gap-4",children:[["Initial Perp Equity",y.initial_equity,"white"],["Final Perp Equity",y.my_total_equity,y.my_total_equity<y.initial_equity?"#FF797C":"#67FFBD"],[f,y.final_pnl,y.final_pnl<0?"#FF797C":"#67FFBD"],["Max Drawdown",`${L}%`,"#FF797C"],["Win Rate",se,"white"],["Win / Loss",i.jsxs("div",{className:"flex gap-0 sm:gap-1",children:[i.jsxs("span",{className:"flex gap-1 items-center",children:[i.jsx("span",{className:"text-[#67FFBD]",children:"●"}),z]})," ",i.jsxs("span",{className:"flex gap-1 items-center",children:[i.jsx("span",{className:"text-[#FF797C]",children:"●"}),Q]})]}),"white"],["Growth Rate",`${G}%`,G<0?"#FF797C":"#67FFBD"],["Sharpe",de,"white"]].map(([xe,Se,ge])=>i.jsxs("div",{children:[i.jsx("div",{className:"text-[#8E8E8E] text-[14px] pb-1",children:xe}),i.jsx("div",{style:{color:ge},className:"text-[14px] font-semibold whitespace-nowrap",children:typeof Se=="number"?`$${Se.toFixed(2)}`:Se})]},xe))}),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:dct,alt:"expand",className:"cursor-pointer",onClick:()=>s(!0)})]}),i.jsx(zD,{options:oe,series:[{name:"Equity",data:P}],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:ne.map(({date:xe,rows:Se,totalPnl:ge,equity:Ce})=>{const je=ge>=0,Oe=l[xe];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($e=>({...$e,[xe]:!Oe})),children:[i.jsx("span",{className:"text-left text-white",children:xe}),i.jsxs("span",{className:"text-center text-white",children:["$",Ce.toFixed(2)]}),i.jsxs("span",{className:`text-right ${je?"text-[#67FFBD]":"text-[#FF797C]"}`,children:[je?"+":"-","$",Math.abs(ge).toFixed(2)]})]}),Oe&&i.jsx("div",{className:"overflow-x-auto",children:i.jsx(zu,{columns:he,data:Se,listHeight:Math.min(Se.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})})]},xe)})})]})]})}const Zvn=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()},Jvn=()=>{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 ewn(){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){dn.error(x.error_message),e("starter");return}window.history.replaceState(null,"","?"+Zvn(l)),a(l.period),r(x),e("result")}catch(f){console.error(f),e("starter"),dn.error("Backtest failed. Please try again.")}},[]);return h.useEffect(()=>{const l=Jvn();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(Wvn,{onRun:o}),t==="loading"&&i.jsx(qvn,{}),t==="result"&&i.jsx(Qvn,{result:n,period:s,onBack:()=>{window.history.replaceState(null,"",window.location.pathname),e("starter")}})]})}const twn=({tg:t})=>{const{address:e}=es(),[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(P5,{open:n,setOpen:r,handleListRequest:()=>{},handlePageChange:()=>{}}),i.jsx("div",{className:"flex flex-col items-center justify-center px-6 sm:px-16 pb-10 gap-6 w-max h-max bg-[#212121]/90 rounded-2xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#2a2a2a] relative pt-10",children:i.jsxs("div",{className:"flex flex-col items-center text-white text-base font-medium font-['Inter'] text-center gap-4",children:[i.jsx("img",{src:Ki,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:T_e,alt:""}),i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-none min-w-max",children:"Open Telegram App"})]})]})]})})]})},nwn=()=>{const[t]=MAe(),e=t==null?void 0:t.get("tg"),{isConnected:n,address:r}=es(),{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(Yr),[N,I]=h.useState(!!window.localStorage.getItem("hyperToken"));return h.useEffect(()=>{const P=window.localStorage.getItem("hyperToken");I(!!P)},[r,n,s,a]),h.useEffect(()=>{(async()=>{var $,L;const M=window.localStorage.getItem("hyperToken"),F=window.localStorage.getItem("hyperAddress");if(!(!M||!F))try{const z=await vi(F.toLowerCase(),M);z!=null&&z.success?(l(z==null?void 0:z.telegram_chat_id),c(z==null?void 0:z.subscriber_role),u(z==null?void 0:z.subs_expire_day),d(($=z==null?void 0:z.mushboomer_counts)==null?void 0:$.eth),f((L=z==null?void 0:z.mushboomer_counts)==null?void 0:L.sol),x(z==null?void 0:z.referral_code),g(z==null?void 0:z.refcode),y(z==null?void 0:z.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(z){console.error("Token verification error:",z),console.error(z.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{children:[i.jsx("title",{children:"Dextrabot Telegram Wallet Setup – Create API or Generated Wallet"}),i.jsx("meta",{name:"description",content:"Easily set up your Telegram copy trading wallet on Dextrabot. Create an API Wallet with your own account or generate a new wallet instantly, then connect to Telegram to start trading."}),i.jsx("meta",{name:"og:title",content:"Dextrabot Telegram Wallet Setup – Create API or Generated Wallet"}),i.jsx("meta",{name:"og:description",content:"Easily set up your Telegram copy trading wallet on Dextrabot. Create an API Wallet with your own account or generate a new wallet instantly, then connect to Telegram to start trading."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/telegram-api-wallet"})]})}),i.jsx("div",{style:{background:"linear-gradient(135deg, #0d0d0d 0%, #1c1c1c 50%, #0d0d0d 100%)"},className:"flex justify-center items-center w-full h-[calc(100vh-6rem)] sm:h-[calc(100vh-5rem)] min-h-max max-h-[calc(100vh-6rem)] sm:max-h-[calc(100vh-5rem)] px-4 pt-16 sm:pt-4 pb-10 bg-[#161616]",children:N?i.jsx(twn,{tg:e}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(pz,{})})})]})},Jje="/assets/share1-C-zw_JWP.jpg",rwn="/assets/share2-DdEku457.jpg",swn="/assets/share3-CNxpeTYT.jpg",iwn="/assets/share4-DJuI_ZiE.jpg",awn="/assets/share5-T6uiFcTh.jpg",own="/assets/share6-DjS5fdAF.jpg",lwn="/assets/share7-BaMtg3x6.jpg",cwn="/assets/share8-xyCgNFII.jpg",uwn="/assets/share9-BLclkV1L.jpg",dwn="/assets/share10-C9sVwYdl.jpg",fwn="/assets/share11-_FKzaoRV.jpg",hwn="/assets/share12-DHiXk6_m.jpg",pwn="/assets/share13-0mVBxTxA.jpg",mwn="/assets/share14-B6N7agx8.jpg",xwn="/assets/share15-D46qu5xc.jpg",gwn="/assets/share16-B06pZYlo.jpg",bwn="/assets/share17-C9ObNWuI.jpg",ywn="/assets/share18-DafUfIIP.jpg",vwn="/assets/share19-DdeHQJDd.jpg",wwn="/assets/share20-Cx0LCWyZ.jpg",Cwn="/assets/lighter-banner-B9jyiBZ3.png",Swn="#67FFBD",Nwn="https://dextrabothypev2.nftinit.io/api/hyper/fee_calculator_save/";function jwn({initialWalletAddress:t}){const e=Ao(),[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,N]=h.useState(!1),[I,P]=h.useState(Jje),[M,F]=h.useState(""),[$,L]=h.useState(""),z=h.useRef(!1),Q=h.useRef(null),se=h.useRef(null),ee=h.useRef(0),K=[Jje,rwn,swn,iwn,awn,own,lwn,cwn,uwn,dwn,fwn,hwn,pwn,mwn,xwn,gwn,bwn,ywn,vwn,wwn];h.useEffect(()=>{const $e=document.querySelector("main");$e&&($e.style.background="#0b0b0b"),F(`${window.location.origin}${window.location.pathname}`);const Ye=decodeURIComponent((window.location.hash||"").replace(/^#/,"")),Je=window.location.pathname.split("/").filter(Boolean),ht=Je[Je.length-1]||"",st=ht&&ht.toLowerCase()!=="hyperliquid-fee-calculator"?decodeURIComponent(ht):"",He=Ye||st;if(He){f(He),r(He);const Ve=`${window.location.pathname}#${encodeURIComponent(He)}`;window.history.replaceState(null,"",Ve),L(`${window.location.origin}${Ve}`),ae(He)}return()=>{$e&&($e.style.background="")}},[]),h.useEffect(()=>{t&&t.trim()&&ae(t)},[t]);const re=$e=>{const Ye=Number($e||0);return Math.abs(Ye)>=1e6?`$${(Ye/1e6).toFixed(2)}M`:Math.abs(Ye)>=1e3?`$${(Ye/1e3).toFixed(2)}K`:`$${Ye.toFixed(2)}`},de=$e=>`$${Number($e||0).toFixed(2)}`,G=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"}),ie=async $e=>{if(z.current)return;z.current=!0;const Ye=window.localStorage.getItem("hyperAddress")||"",Je={wallet_address:n||null,calculator_logs:{total_fee_spent:de((($e==null?void 0:$e.totalFee)||0)+(($e==null?void 0:$e.totalBuilderFee)||0)),trading_fees:de(($e==null?void 0:$e.totalFee)||0),builder_fees:de(($e==null?void 0:$e.totalBuilderFee)||0),total_fills:Number(($e==null?void 0:$e.totalFills)||0),created_at:G()}};Ye&&(Je.address=Ye);try{await fetch(Nwn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Je)})}catch{}},ae=async $e=>{if(!$e){dn.error("Please enter a wallet address");return}z.current=!1,a(!0),l(null),u(null),g(!1),v(0),N(!1),e(`/hyperliquid-fee-calculator/${$e}`,{replace:!0}),L(`${window.location.origin}/hyperliquid-fee-calculator/${$e}`);try{await pln($e,Ye=>{Ye.totalFills>=2e3&&g(!0),u({...Ye,isPartial:!Ye.isComplete}),v(Math.min(Ye.requestCount/12*100,100)),Ye.isComplete&&(g(!1),v(100),a(!1),N(!0),ie(Ye),e(`/hyperliquid-fee-calculator/${$e}`,{replace:!0}))})}catch(Ye){l(Ye.message||"Failed to calculate fees"),dn.error("Failed to calculate fees"),g(!1),a(!1)}},q=$e=>{f($e),$e.trim()&&r($e.trim())},W=(()=>{const $e=((c==null?void 0:c.totalFee)||0)+((c==null?void 0:c.totalBuilderFee)||0);return`I paid ${re($e)} in total fees on Hyperliquid.
Generate your own fee report and see potential savings with 0% builder fees.`})(),ne=async()=>{if(Q.current)try{await document.fonts.ready;const $e=await V1(Q.current,{cacheBust:!0,backgroundColor:"#0b0b0b",useCORS:!0,pixelRatio:2}),Ye=document.createElement("a");Ye.href=$e,Ye.download="dextrabot-fee-card.png",document.body.appendChild(Ye),Ye.click(),document.body.removeChild(Ye)}catch{dn.error("Failed to download PNG.")}},oe=$||M||"https://app.dextrabot.com/hyperliquid-fee-calculator",he=`https://x.com/intent/post?text=${encodeURIComponent(W)}&url=${encodeURIComponent(oe)}`,[_e,xe]=h.useState({rx:0,ry:0,gx:50,gy:50}),Se=12,ge=$e=>{se.current&&(cancelAnimationFrame(ee.current),ee.current=requestAnimationFrame(()=>{const Ye=se.current.getBoundingClientRect(),Je=($e.clientX-Ye.left)/Ye.width,ht=($e.clientY-Ye.top)/Ye.height,rt=(Je-.5)*(Se*2),st=(.5-ht)*(Se*2);xe({rx:Math.max(-12,Math.min(Se,st)),ry:Math.max(-12,Math.min(Se,rt)),gx:Je*100,gy:ht*100})}))},Ce=()=>{cancelAnimationFrame(ee.current),xe({rx:0,ry:0,gx:50,gy:50})},je=s,Oe=!n.trim();return i.jsxs(Ga,{children:[i.jsxs(no,{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(ho.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:qj,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:Swn},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(UVe,{className:"h-5 w-5 text-[#88a296]"})}),i.jsx("input",{type:"text",value:d,onChange:$e=>q($e.target.value),placeholder:"Paste wallet address…",className:"w-full pl-10 pr-12 py-3 rounded-xl bg-[#060808] border border-[#1c2a24] text-white placeholder-[#6e857d] focus:outline-none focus:border-[#67FFBD] focus:ring-1 focus:ring-[#67FFBD]"}),d?i.jsx("button",{onClick:()=>{f(""),r(""),window.history.replaceState(null,"",window.location.pathname),L("")},className:"absolute inset-y-0 right-2 flex justify-center items-center h-10 top-[5px]",children:i.jsx(Cde,{className:"h-6 w-6 text-[#8ea79e] hover:text-white transition-colors"})}):null]}),i.jsxs(ho.button,{whileTap:{scale:.98},onClick:()=>ae(n),disabled:je||Oe,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]":Oe?"bg-[#16211b] text-[#7ea391] cursor-not-allowed border border-[#1e2e27]":"bg[rgba(103,255,189,0.95)]"}`,style:!je&&!Oe?{backgroundColor:"rgba(103,255,189,0.95)",color:"#0b0b0b"}:void 0,children:[i.jsx(sI,{initial:!1,children:je&&i.jsx(ho.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:Cj,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[320px] lg:h-[380px] object-cover"},Cj)]})})]})]}),C&&c&&i.jsx(ho.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},children:i.jsxs("div",{className:"flex flex-col lg:flex-row items-start gap-4",children:[i.jsx("div",{className:"shrink-0",children:i.jsxs("button",{onClick:()=>{N(!1),e("/hyperliquid-fee-calculator",{replace:!0})},className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 border border-[#23372e] bg-[#0c1210] hover:bg-[#0f1714] text-[#d7ffe9]",children:[i.jsx(Ycn,{className:"w-5 h-5"}),"Back"]})}),i.jsxs("div",{className:"shrink-0",children:[i.jsx(Awn,{refCard:Q,refWrap:se,tilt:_e,onMove:ge,onLeave:Ce,feeData:c,selectedImage:I}),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(LSt,{})}),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(rQ,{className:"w-5 h-5 text-[#7a8c86]"})]}),i.jsx("div",{className:"mt-3 grid grid-cols-1 gap-2",children:i.jsx("a",{href:he,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(ISt,{})}),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(rQ,{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(OSt,{})}),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(rQ,{className:"w-5 h-5 text-[#7a8c86]"})]}),i.jsxs("div",{className:"mt-8",children:[i.jsx("div",{className:"grid grid-cols-4 gap-2 pb-4",children:K.map(($e,Ye)=>i.jsx(ho.button,{whileHover:{y:-2},whileTap:{scale:.98},onClick:()=>P($e),className:`rounded-md overflow-hidden border ${I===$e?"border-[#67FFBD]":"border-[#2b2b2b]"}`,children:i.jsx("img",{src:$e,alt:`bg-${Ye}`,className:"w-full h-16 object-cover"})},Ye))}),i.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[i.jsx("button",{onClick:ne,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:Cwn,alt:"Lighter — Zero Fee",className:"h-full w-full cursor-pointer",loading:"eager",decoding:"async",draggable:!1,onClick:()=>{window.location.hash="lighter-farming"}})})]})]})]})}function Awn({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:Ki,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:Ki,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 e8e=()=>{const{walletAddress:t}=g2(),{setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setIsWhitelist:a,setMushboomerSOL:o,setIsReferralCode:l,setIsReferralCodeName:c,setHyperToken:u,setHyperAddress:d}=h.useContext(Yr);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 vi(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(Ga,{children:i.jsxs(no,{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(jwn,{initialWalletAddress:t})})})]})};function _wn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M1.72 5.47a.75.75 0 0 1 1.06 0L9 11.69l3.756-3.756a.75.75 0 0 1 .985-.066 12.698 12.698 0 0 1 4.575 6.832l.308 1.149 2.277-3.943a.75.75 0 1 1 1.299.75l-3.182 5.51a.75.75 0 0 1-1.025.275l-5.511-3.181a.75.75 0 0 1 .75-1.3l3.943 2.277-.308-1.149a11.194 11.194 0 0 0-3.528-5.617l-3.809 3.81a.75.75 0 0 1-1.06 0L1.72 6.53a.75.75 0 0 1 0-1.061Z",clipRule:"evenodd"},child:[]}]})(t)}function t8e(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15.22 6.268a.75.75 0 0 1 .968-.431l5.942 2.28a.75.75 0 0 1 .431.97l-2.28 5.94a.75.75 0 1 1-1.4-.537l1.63-4.251-1.086.484a11.2 11.2 0 0 0-5.45 5.173.75.75 0 0 1-1.199.19L9 12.312l-6.22 6.22a.75.75 0 0 1-1.06-1.061l6.75-6.75a.75.75 0 0 1 1.06 0l3.606 3.606a12.695 12.695 0 0 1 5.68-4.974l1.086-.483-4.251-1.632a.75.75 0 0 1-.432-.97Z",clipRule:"evenodd"},child:[]}]})(t)}function n8e(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H7.5a.75.75 0 0 1 0-1.5h11.69l-3.22-3.22a.75.75 0 0 1 0-1.06Zm-7.94 9a.75.75 0 0 1 0 1.06l-3.22 3.22H16.5a.75.75 0 0 1 0 1.5H4.81l3.22 3.22a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"},child:[]}]})(t)}function r8e(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"},child:[]}]})(t)}function Ewn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M12 .75a8.25 8.25 0 0 0-4.135 15.39c.686.398 1.115 1.008 1.134 1.623a.75.75 0 0 0 .577.706c.352.083.71.148 1.074.195.323.041.6-.218.6-.544v-4.661a6.714 6.714 0 0 1-.937-.171.75.75 0 1 1 .374-1.453 5.261 5.261 0 0 0 2.626 0 .75.75 0 1 1 .374 1.452 6.712 6.712 0 0 1-.937.172v4.66c0 .327.277.586.6.545.364-.047.722-.112 1.074-.195a.75.75 0 0 0 .577-.706c.02-.615.448-1.225 1.134-1.623A8.25 8.25 0 0 0 12 .75Z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M9.013 19.9a.75.75 0 0 1 .877-.597 11.319 11.319 0 0 0 4.22 0 .75.75 0 1 1 .28 1.473 12.819 12.819 0 0 1-4.78 0 .75.75 0 0 1-.597-.876ZM9.754 22.344a.75.75 0 0 1 .824-.668 13.682 13.682 0 0 0 2.844 0 .75.75 0 1 1 .156 1.492 15.156 15.156 0 0 1-3.156 0 .75.75 0 0 1-.668-.824Z",clipRule:"evenodd"},child:[]}]})(t)}function kwn({value:t,onChange:e,options:n=[{value:"extended",label:"Extended"}],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:Lo,border:`1px solid ${Ra}`,color:Bi},children:[i.jsx("span",{className:"truncate text-xs font-medium",style:{color:Bi},children:(c==null?void 0:c.label)||"Select"}),i.jsx("span",{className:"ml-2 flex items-center",children:i.jsx("span",{className:"ml-2",children:"▾"})})]}),a&&i.jsx("div",{className:"absolute z-50 mt-1 w-full max-h-[240px] overflow-auto rounded-md p-1",style:{background:Lo,border:`1px solid ${Ra}`},children:n.map(u=>{const d=String(u.value)===String(t);return i.jsx("div",{className:"px-3 py-2 rounded cursor-pointer text-xs font-medium",style:{background:d?"#26313b":"transparent",color:d?"#ffffff":Bi},onClick:()=>{e==null||e(u.value),o(!1)},children:u.label},u.value)})})]})}const zb="#67FFBD",IM="#ff7073",rO="#60A5FA",s8e="#A78BFA",Twn="#F97316",Iwn={KBONK:"BONK",KPEPE:"PEPE",KSHIB:"SHIB",KFLOKI:"FLOKI",KNEIRO:"NEIRO",KDOGS:"DOGS",KLUNC:"LUNC"},Pwn=new Set(["KBONK","KPEPE","KSHIB"]),Fwn="https://app.hyperliquid.xyz/coins",i8e={SAFE:{icon:"✅",color:zb,label:"Safe",tooltip:"Order can be safely executed with sufficient collateral buffer"},WARNING:{icon:"⚠️",color:Twn,label:"Warning",tooltip:"Position is approaching liquidation risk, consider reducing leverage or adding collateral"},STOPPED:{icon:"🛑",color:IM,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(Vs,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5"})}):t;return i.jsxs("span",{className:"relative inline-flex",children:[i.jsx("span",{ref:o,onMouseEnter:l,onMouseLeave:()=>r(!1),className:"cursor-help transition-colors ml-1 inline-flex",children:c}),n&&i.jsxs("div",{className:"fixed z-50 px-3 py-2 text-xs bg-[#1a1a1a] border border-[#333] rounded-lg shadow-xl max-w-xs text-[#ccc] whitespace-normal",style:{left:s.x,top:s.y-8,transform:"translate(-50%, -100%)"},children:[e,i.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0",style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:"6px solid #333"}})]})]})},ug=({label:t,value:e,onChange:n,min:r,max:s,step:a,suffix:o,tooltip:l,placeholder:c,helperText:u,validate:d,readOnly:f=!1,forceError:x=!1,forceErrorMessage:g=null})=>{const[y,v]=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},N=F=>{let $=F.target.value;const L=parseFloat($);$!==""&&r!==void 0&&!Number.isNaN(L)&&!Number.isNaN(parseFloat(r))&&L<parseFloat(r)&&($=String(parseFloat(r))),$!==""&&s!==void 0&&!Number.isNaN(L)&&!Number.isNaN(parseFloat(s))&&L>parseFloat(s)&&($=String(parseFloat(s))),n($)},I=()=>{v(!0)},P=C(e),M=x&&(g||P)?g||P:y&&P?P:null;return i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:[t,l&&i.jsx(Uh,{content:l,children:"?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"number",value:e,onChange:N,onBlur:I,onWheel:F=>F.currentTarget.blur(),min:r,max:s,step:a,readOnly:f,placeholder:c,className:`w-full px-3 py-2 rounded-lg ${f?"bg-[#101010]":"bg-[#161616]"} border text-white text-sm focus:outline-none transition-colors ${M?"border-[#ff7073] focus:border-[#ff7073]":f?"border-[#1c2a24] focus:border-[#1c2a24] cursor-not-allowed":"border-[#1c2a24] focus:border-[#67FFBD]"}`}),o&&i.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#6e857d] text-sm",children:o})]}),M&&i.jsx("p",{className:"text-[10px] text-[#ff7073] px-1",children:M}),u&&!M&&i.jsx("p",{className:"text-[10px] text-[#666] px-1",children:u})]})},Own=t=>{const e=String(t||"").toUpperCase();return Pwn.has(e)?`1000${e.slice(1)}`:e},Io=(t,e=2)=>{if(t==null||isNaN(t))return"-";const n=Math.abs(t);return n>=1e9?`${(t/1e9).toFixed(2)}B`:n>=1e6?`${(t/1e6).toFixed(2)}M`:n>=1e3?`${(t/1e3).toFixed(2)}K`:t.toFixed(e)},Ob=(t,e=!1)=>t==null||isNaN(t)?"-":t<=0?e?"Safe ✓":"N/A":t>=1e4?`$${t.toFixed(1)}`:t>=1e3?`$${t.toFixed(2)}`:t>=100?`$${t.toFixed(3)}`:t>=10?`$${t.toFixed(4)}`:`$${t.toFixed(5)}`,Mwn=t=>t==null||isNaN(t)?"-":`${t.toFixed(2)}%`,Rwn=(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)},Ac=t=>String(t||"").toUpperCase().replace(/-USD(T)?$/,"").replace(/\/USD(T)?$/,"").replace(/USD(T)?$/,""),Lwn=(t,e=[])=>{const n=Ac(t),r=e.find(s=>{var o;const a=Ac(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},Dwn=(t,e=[])=>{const n=Ac(t);return e.find(r=>{var a;const s=Ac(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},Bwn=({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"})]})]})]})},a8e=({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 $wn(){var an;const t=ife(),e=t.length===0,n=afe(),r=n.length===0,[s,a]=h.useState("extended"),[o,l]=h.useState([]),[c,u]=h.useState(50),[d,f]=h.useState({}),[x,g]=h.useState("extended"),[y,v]=h.useState("BTC"),[C,N]=h.useState(""),[I,P]=h.useState("long"),[M,F]=h.useState("10"),[$,L]=h.useState("5"),[z,Q]=h.useState("10"),[se,ee]=h.useState("10"),[K,re]=h.useState("1500"),[de,G]=h.useState(!1),[ie,ae]=h.useState("1"),[q,W]=h.useState(""),[ne,oe]=h.useState(!0),[he,_e]=h.useState("0.50"),[xe,Se]=h.useState("1.1"),[ge,Ce]=h.useState("1"),[je,Oe]=h.useState(!0),[$e,Ye]=h.useState(!0),[Je,ht]=h.useState(!0),[rt,st]=h.useState(!0),[He,Ve]=h.useState("details"),[bt,xt]=h.useState([]),[Qt,St]=h.useState(!1),[on,cn]=h.useState([]),[Vn,tn]=h.useState(!1),[fn,rn]=h.useState(null),[nt,it]=h.useState(!1),[Ut,hn]=h.useState({}),[nn,Vt]=h.useState({}),[pt,We]=h.useState(null),It=h.useRef(!1),Ge=h.useRef(!0),ct=h.useRef(0),vt=s==="extended"?n:t,Ht=s==="extended"?r:e,Rt=s==="extended"?"extended_selected_wallet_id":"lighter_selected_wallet_id",mn=h.useMemo(()=>`dca_last_coin_${s}`,[s]),un=h.useMemo(()=>`dca_settings_${s}`,[s]),yn=h.useMemo(()=>({baseOrderMargin:"5",dcaOrderMargin:"10",maxDcaOrders:"10",tpTarget:"1",stopLoss:"",priceDeviation:"0.50",dcaSizeMultiplier:"1.1",priceDevMultiplier:"1"}),[]);h.useEffect(()=>{if(typeof window>"u")return;const et=window.localStorage.getItem(un),Pt={...yn};if(et)try{const qt=JSON.parse(et)||{};Object.keys(yn).forEach(ft=>{qt[ft]!==void 0&&qt[ft]!==null&&(Pt[ft]=String(qt[ft]))})}catch{}L(Pt.baseOrderMargin),Q(Pt.dcaOrderMargin),ee(Pt.maxDcaOrders),ae(Pt.tpTarget),W(Pt.stopLoss),_e(Pt.priceDeviation),Se(Pt.dcaSizeMultiplier),Ce(Pt.priceDevMultiplier)},[un,yn]),h.useEffect(()=>{if(typeof window>"u")return;const et={baseOrderMargin:$,dcaOrderMargin:z,maxDcaOrders:se,tpTarget:ie,stopLoss:q,priceDeviation:he,dcaSizeMultiplier:xe,priceDevMultiplier:ge};try{window.localStorage.setItem(un,JSON.stringify(et))}catch{}},[un,$,z,se,ie,q,he,xe,ge]);const _n=h.useMemo(()=>{const et=new Map;return o.forEach(Pt=>{const qt=Ac(Pt.value||Pt.label||Pt.symbol||Pt.coin);if(!qt)return;const ft=Pt.maxLeverage??Pt.max_leverage??Pt.leverage??null,tt=Number(ft);et.set(qt,Number.isFinite(tt)?tt:null)}),et},[o]),In=h.useMemo(()=>vt.map(et=>{var tt,Bt,gn;const Pt=Ac(et.symbol||et.rawSymbol||((tt=et.raw)==null?void 0:tt.symbol)||et.market||et.coin),qt=et.leverage??et.maxLeverage??et.max_leverage??(Pt?_n.get(Pt):null),ft=Number.isFinite(Number(qt))&&Number(qt)>0?Number(qt):null;return{...et,symbol:et.symbol||((Bt=et.raw)==null?void 0:Bt.symbol)||et.rawSymbol||et.market||"",rawSymbol:et.rawSymbol||((gn=et.raw)==null?void 0:gn.symbol)||et.symbol,leverage:ft,maxLeverage:et.maxLeverage??et.max_leverage??ft}}),[vt,_n]),Sn="https://dextrabothypev2.nftinit.io/api/hyper/dca_bot",{setSignModalOpen:Yn,hyperToken:Xn,hyperAddress:zn}=h.useContext(Yr),[Kn,jn]=h.useState({address:null,token:null}),De=h.useCallback(()=>Kn,[Kn]),[pe,qe]=h.useState(!1),Ae=et=>{if(!et)return null;const Pt=String(et);return Pt==="null"||Pt==="undefined"?null:Pt};h.useEffect(()=>{const et=()=>{if(typeof window>"u")return;const qt=Ae(zn||window.localStorage.getItem("hyperAddress")),ft=Ae(Xn||window.localStorage.getItem("hyperToken"));jn({address:qt,token:ft}),(!qt||!ft)&&(qe(!1),cn([]),rn(null),ct.current=0)};et(),window.addEventListener("localStorageUpdated",et),window.addEventListener("storage",et);const Pt=setInterval(()=>{if(typeof window>"u")return;const qt=Ae(zn||window.localStorage.getItem("hyperAddress")),ft=Ae(Xn||window.localStorage.getItem("hyperToken"));jn(tt=>tt.address===qt&&tt.token===ft?tt:{address:qt,token:ft}),(!qt||!ft)&&(qe(!1),cn([]),rn(null),ct.current=0)},1500);return()=>{window.removeEventListener("localStorageUpdated",et),window.removeEventListener("storage",et),clearInterval(Pt)}},[Xn,zn]),h.useEffect(()=>{const et=!!Kn.token,Pt=!!Kn.address;qe(et&&Pt)},[Kn]),h.useEffect(()=>()=>{Ge.current=!1},[]);const ze=h.useCallback(async()=>{if(It.current)return;const et=Kn.address,Pt=Kn.token;if(!et||!Pt){It.current=!1,tn(!1);return}const qt=Date.now();if(!(qt-ct.current<4500)){ct.current=qt,It.current=!0,tn(!0);try{let ft=[];const Bt=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:et.toLowerCase(),token:Pt,balance:"true"})})).json().catch(()=>null);if(!Ge.current||!Bt){It.current=!1,tn(!1);return}let gn=[];if(Array.isArray(Bt)?gn=Bt:Array.isArray(Bt==null?void 0:Bt.data)&&(gn=Bt.data),ft=await Promise.all(gn.map(async(Dn,er)=>{var Tn,$n,ir;let Sr=null;const dr=Number(Dn.available_balance??Dn.availableForTrade??Dn.available_for_trade??Dn.balance??Dn.available??null);Number.isFinite(dr)&&(Sr=dr);const kr=Dn.wallet_id??Dn.id??er,qn=Dn.wallet_api_key||Dn.api_key||null;if(qn&&Sr==null)try{const ls=`https://express-proxy-delta.vercel.app/proxy?url==${encodeURIComponent("https://api.starknet.extended.exchange/api/v1/user/balance")}`,lt=await(await fetch(ls,{headers:{"X-Api-Key":qn}})).json().catch(()=>null),Nt=((Tn=lt==null?void 0:lt.data)==null?void 0:Tn.availableForTrade)??(lt==null?void 0:lt.availableForTrade)??(($n=lt==null?void 0:lt.data)==null?void 0:$n.available_balance)??(lt==null?void 0:lt.available_balance)??((ir=lt==null?void 0:lt.data)==null?void 0:ir.available)??(lt==null?void 0:lt.available),Rn=Number(Nt);Number.isFinite(Rn)&&Rn>=0&&(Sr=Rn)}catch{}return{wallet_id:kr,wallet_address:Dn.wallet_address||Dn.address||"",wallet_name:Dn.wallet_name||Dn.name||`Extended Wallet ${er+1}`,available_balance:Sr,wallet_api_key:qn}})),!Ge.current)return;cn(ft),ft.length>0?rn(Dn=>{const er=typeof window<"u"?window.localStorage.getItem(Rt):null,Sr=(Dn==null?void 0:Dn.id)??er,dr=Sr&&ft.find(kr=>String(kr.wallet_id)===String(Sr))||ft[0];return dr?{id:dr.wallet_id,address:dr.wallet_address,apiKey:dr.wallet_api_key}:null}):rn(null)}catch(ft){console.error("Error loading wallets:",ft),Ge.current&&cn([])}finally{It.current=!1,Ge.current&&tn(!1)}}},[Kn.address,Kn.token,s,Rt]);h.useEffect(()=>{pe&&ze()},[pe,ze]),h.useEffect(()=>{Kn.address&&Kn.token?(qe(!0),ze()):(qe(!1),cn([]),rn(null),ct.current=0)},[Kn.address,Kn.token,ze]),h.useEffect(()=>{const et=()=>ze();return window.addEventListener("localStorageUpdated",et),window.addEventListener("storage",et),()=>{window.removeEventListener("localStorageUpdated",et),window.removeEventListener("storage",et)}},[ze]),h.useEffect(()=>{ct.current=0,cn([]),rn(null),We(null)},[s]),h.useEffect(()=>{G(!1)},[fn==null?void 0:fn.id,s]);const zt=h.useMemo(()=>{if(!fn||!fn.id)return null;const et=on.find(qt=>String(qt.wallet_id)===String(fn.id));if(!et)return null;if(s==="extended"&&fn.apiKey){const qt=Number(pt==null?void 0:pt.availableForTrade);if(Number.isFinite(qt))return qt}const Pt=Number(et.available_balance??et.availableForTrade??et.available_for_trade??et.balance??et.available??null);return Number.isFinite(Pt)?Pt:null},[on,fn,s,pt]),kt=h.useCallback(async()=>{const et=Kn.address,Pt=Kn.token;if(!et||!Pt){xt([]);return}St(!0);try{const ft=await(await fetch(`${Sn}/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:et.toLowerCase(),token:Pt,source_market:s})})).json().catch(()=>null),Bt=(Array.isArray(ft==null?void 0:ft.data)?ft.data:ft!=null&&ft.data?[ft.data]:[]).filter(gn=>gn?s?String(gn.source_market||"").toLowerCase()===String(s||"").toLowerCase()?!0:s==="hyper"&&!gn.source_market:!0:!1);xt(Bt)}catch(qt){console.error("Error loading bots:",qt),xt([])}finally{St(!1)}},[De,Sn,s]);h.useEffect(()=>{kt()},[kt,Kn.address,Kn.token,s]);const gt=h.useCallback(async()=>{var qt,ft;const{address:et,token:Pt}=De();if(!et||!Pt||!fn||!fn.id){dn.error("Please connect your wallet and select a wallet.");return}it(!0);try{const tt=(qt=y==null?void 0:y.toUpperCase())==null?void 0:qt.trim(),Bt=Own(tt);let gn=null;if(s==="lighter")try{const ar=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(ar!=null&&ar.funding_rates&&Array.isArray(ar.funding_rates)){const Tr=ar.funding_rates.find(Lr=>String(Lr.symbol||"").toUpperCase().trim()===tt);console.log("coinRate",Tr),Tr&&Tr.market_id!=null?(gn=Tr.market_id,console.log(`✅ Found market_id ${gn} for coin ${tt} from funding-rates API (exchange: ${Tr.exchange})`)):(console.warn(`❌ Coin ${tt} not found in funding-rates API`),console.log("Sample available symbols:",ar.funding_rates.slice(0,20).map(Lr=>Lr.symbol)))}else console.warn("No funding_rates array in API response")}catch(Rn){console.error("Error fetching funding-rates API:",Rn),gn=d[tt]||null,gn&&console.log(`Using cached market_id ${gn} for coin ${tt}`)}if(gn===null){if(s==="extended"&&(!vt||!vt.length)){dn.error("Extended markets are loading. Please try again in a moment."),it(!1);return}gn=Lwn(y,vt)}if(gn===null&&s!=="extended"){console.error("Market not found for coin:",tt),dn.error(`Unable to find market index for ${tt}. Please make sure the coin is available on ${s}.`),it(!1);return}gn!=null&&console.log(`Using market_index: ${gn} for coin: ${tt}`);const tr=on.find(Rn=>String(Rn.wallet_id)===String(fn.id));if(!tr||!tr.wallet_id){dn.error("Unable to find selected wallet. Please select a wallet again."),it(!1);return}const Dn=Math.max(1,Math.min(Number(c)||100,Number(M)||1)),er=Dwn(y,vt),Sr=String(y||"").toUpperCase(),dr=Number((er==null?void 0:er.maxLeverage)??(er==null?void 0:er.leverage)??(er==null?void 0:er.max_leverage)??c??0),kr=s==="extended"&&dr>0?Math.min(dr,Dn||dr):Dn,qn=parseFloat(ie)||0,Tn=Number(C)||Number(er==null?void 0:er.markPrice)||Number(er==null?void 0:er.lastPrice)||Number(er==null?void 0:er.last)||null,$n=Number(((ft=er==null?void 0:er.tradingConfig)==null?void 0:ft.minOrderSize)??(er==null?void 0:er.minOrderSize)),ir=Number.isFinite($n)&&$n>0&&Number.isFinite(Tn)&&Tn>0?$n*Tn:null;if(s==="extended"&&ir!=null){const Rn=parseFloat($)||0,ar=parseFloat(z)||0,Tr=Rn*kr,Lr=ar*kr;if(Tr<ir||Lr<ir){const $r=[];Tr<ir&&$r.push("Base Order"),Lr<ir&&$r.push("DCA Order");const cr=$r.length===1?` (${$r[0]})`:$r.length===2?" (Base Order & DCA Order)":"";dn.error(`Minimum order size for ${Sr} is $${ir.toFixed(2)}${cr}. Increase order size or leverage.`),it(!1);return}}const ls={direction:I,leverage:kr,base_amount_usd:parseFloat($)||0,safety_amount_usd:parseFloat(z)||0,max_safety_orders:parseInt(se)||0,price_deviation:parseFloat(he)||.5,step_scale:parseFloat(ge)||1,volume_scale:parseFloat(xe)||1.5,tp_percent:qn,stop_loss_percent:q?parseFloat(q):0};s!=="extended"&&gn!=null&&(ls.market_index=Number.isFinite(Number(gn))?Number(gn):gn);const cs={address:et.toLowerCase(),token:Pt,wallet_id:tr.wallet_id,source_market:s,bot_params:ls,coin:Bt};console.log("DCA Bot API Request:",JSON.stringify(cs,null,2));const Nt=await(await fetch(`${Sn}/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(cs)})).json().catch(()=>null);Nt!=null&&Nt.success?(dn.success("DCA Bot started successfully!"),await kt(),Ve("bots")):dn.error((Nt==null?void 0:Nt.error_message)||"Failed to start bot. Please try again.")}catch(tt){console.error("Error starting bot:",tt),dn.error("Error starting bot. Please try again.")}finally{it(!1)}},[De,fn,s,y,vt,d,on,I,M,$,z,se,he,xe,ge,ie,q,kt,Sn]);h.useCallback(async et=>{const{address:Pt,token:qt}=De();if(!Pt||!qt||!fn||!fn.id){dn.error("Please connect your wallet and select a wallet.");return}const ft=on.find(tt=>String(tt.wallet_id)===String(fn.id));if(!ft||!ft.wallet_id){dn.error("Unable to find selected wallet. Please select a wallet again.");return}hn(tt=>({...tt,[et]:!0}));try{const Bt=await(await fetch(`${Sn}/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:qt,wallet_id:ft.wallet_id,source_market:s,coin:y})})).json().catch(()=>null);Bt!=null&&Bt.success?await kt():dn.error((Bt==null?void 0:Bt.error_message)||"Failed to stop bot. Please try again.")}catch(tt){console.error("Error stopping bot:",tt),dn.error("Error stopping bot. Please try again.")}finally{hn(tt=>({...tt,[et]:!1}))}},[De,fn,s,y,on,kt,Sn]);const Mt=h.useCallback(async(et,Pt,qt={})=>{const{address:ft,token:tt}=De();if(!ft||!tt){dn.error("Please connect your wallet.");return}hn(Bt=>({...Bt,[et]:!0})),xt(Bt=>Bt.map(gn=>gn.id===et||gn.bot_id===et?{...gn,is_deleted:Pt,...qt}:gn));try{const gn=await(await fetch(`${Sn}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ft.toLowerCase(),token:tt,bot_id:et,update_params:{is_deleted:Pt,...qt}})})).json().catch(()=>null);if(gn!=null&&gn.success)await kt(),Pt&&dn.success("DCA Bot has been stopped.");else{await kt();const tr=(gn==null?void 0:gn.error_message)||(gn==null?void 0:gn.message)||(gn==null?void 0:gn.detail)||(gn==null?void 0:gn.error),Dn=Pt?"Failed to stop bot. Please try again.":"Cannot start this bot. Another bot for this coin may already be active. Stop it first or choose a different coin.";dn.error(tr||Dn)}}catch(Bt){console.error("Error updating bot:",Bt),await kt(),dn.error(Pt?"Failed to stop bot. Please try again.":"Cannot start this bot. Another bot for this coin may already be active. Stop it first or choose a different coin.")}finally{hn(Bt=>({...Bt,[et]:!1}))}},[De,kt,Sn]);h.useCallback(async et=>{const{address:Pt,token:qt}=De();if(!Pt||!qt){dn.error("Please connect your wallet.");return}if(confirm("Are you sure you want to delete this bot? This action cannot be undone.")){Vt(ft=>({...ft,[et]:!0})),xt(ft=>ft.filter(tt=>tt.id!==et&&tt.bot_id!==et));try{const ft=await fetch(`${Sn}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:qt,bot_id:et,update_params:{permanent_delete:!0,is_deleted:!0}})}),tt=await ft.json().catch(()=>null);if(console.log("Delete bot response:",tt),console.log("Response status:",ft.status),tt!=null&&tt.success)await kt();else{console.log("Trying delete endpoint as fallback...");const Bt=await fetch(`${Sn}/delete/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:qt,bot_id:et})}),gn=await Bt.json().catch(()=>null);if(console.log("Delete endpoint response:",gn),gn!=null&&gn.success)await kt();else{await kt();const tr=(gn==null?void 0:gn.error_message)||(tt==null?void 0:tt.error_message)||(gn==null?void 0:gn.message)||(tt==null?void 0:tt.message)||(gn==null?void 0:gn.detail)||(tt==null?void 0:tt.detail)||`Failed to delete bot. Status: ${Bt.status||ft.status}`;console.error("Delete bot error:",tr,{data:tt,deleteData:gn}),dn.error(tr)}}}catch(ft){console.error("Error deleting bot:",ft),await kt(),dn.error(`Error deleting bot: ${ft.message||"Please try again."}`)}finally{Vt(ft=>({...ft,[et]:!1}))}}},[De,kt,Sn]),h.useEffect(()=>{let et=!1;async function Pt(){try{const ft=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(et||!(ft!=null&&ft.funding_rates))return;const tt={};ft.funding_rates.filter(Bt=>Bt.exchange==="lighter").forEach(Bt=>{if(Bt.symbol&&Bt.market_id!=null){const gn=String(Bt.symbol).toUpperCase().trim();tt[gn]=Bt.market_id}}),et||(f(tt),console.log(`✅ Loaded ${Object.keys(tt).length} market IDs from funding-rates API for lighter exchange`))}catch(qt){console.error("Error loading market IDs from funding-rates API:",qt),et||f({})}}return Pt(),()=>{et=!0}},[]),h.useEffect(()=>{let et=!1;async function Pt(){try{const ft=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=lighter_fr")).json().catch(()=>null);if(et)return;let tt=[];Array.isArray(ft)?tt=ft:Array.isArray(ft==null?void 0:ft.data)?tt=ft.data:Array.isArray(ft==null?void 0:ft.coins)&&(tt=ft.coins);const Bt=tt.map(gn=>({value:String(gn.value||gn.label||gn.symbol||gn.coin||"").toUpperCase(),label:gn.label||gn.value||gn.symbol||gn.coin,maxLeverage:gn.maxLeverage||50}));et||l(Bt)}catch{et||l([])}}return Pt(),()=>{et=!0}},[]),h.useEffect(()=>{var tr;if(!vt.length)return;const et=Ac(y);if(et?vt.some(Dn=>Ac(Dn.symbol)===et):!1)return;const qt=typeof window<"u"?window.localStorage.getItem(mn):null,ft=Ac(qt),tt=qt&&ft?vt.some(Dn=>Ac(Dn.symbol)===ft):!1,Bt=vt[0],gn=tt?ft:Ac((Bt==null?void 0:Bt.symbol)||((tr=Bt==null?void 0:Bt.raw)==null?void 0:tr.symbol)||(Bt==null?void 0:Bt.rawSymbol));v(gn||"BTC")},[vt,y,mn]);const ln=h.useMemo(()=>{const et=Ac(y);return et&&(vt.find(Pt=>Ac(Pt.symbol)===et)||vt.find(Pt=>{var qt;return Ac(((qt=Pt.raw)==null?void 0:qt.symbol)||Pt.rawSymbol)===et}))||null},[vt,y]),vn=h.useMemo(()=>{const et=Ac(y);if(!et)return null;const Pt=Iwn[et]||et;return(ln==null?void 0:ln.kind)==="hip3"&&(ln!=null&&ln.builder)?`${ln.builder}:${Pt}`:Pt},[y,ln]),Wn=h.useMemo(()=>{const et=Ac(y);return et&&bt.find(Pt=>{var ft,tt;const qt=Ac(Pt.coin||Pt.symbol||((ft=Pt.bot_params)==null?void 0:ft.coin)||((tt=Pt.bot_params)==null?void 0:tt.symbol));return!Pt.is_deleted&&qt===et})||null},[bt,y]),On=h.useMemo(()=>{const et=bt.filter(qt=>!qt.is_deleted),Pt=bt.filter(qt=>qt.is_deleted);return[...et,...Pt]},[bt]),$t=Number(C)||Number(ln==null?void 0:ln.markPrice)||Number(ln==null?void 0:ln.lastPrice)||Number(ln==null?void 0:ln.last)||null,Nn=Number(((an=ln==null?void 0:ln.tradingConfig)==null?void 0:an.minOrderSize)??(ln==null?void 0:ln.minOrderSize)),Fn=s==="extended"&&Number.isFinite(Nn)&&Nn>0&&Number.isFinite($t)&&$t>0?Nn*$t:null,Tt=Math.max(1,Number(M)||1),pn=parseFloat($)||0,ke=parseFloat(z)||0,m=pn*Tt,p=ke*Tt,S=s==="extended"&&Fn!=null&&m<Fn,A=s==="extended"&&Fn!=null&&p<Fn,k=S||A,T=et=>{if(Fn==null||!Number.isFinite(Tt)||Tt<=0)return"Minimum order size not met";const Pt=Fn/Tt,qt=Math.abs(Tt-Math.round(Tt))<1e-6?Math.round(Tt):Number(Tt.toFixed(2));return`${et} must be at least $${Pt.toFixed(2)} (min. $${Fn.toFixed(2)} notional ÷ ${qt}x leverage)`};h.useEffect(()=>{const et=o.find(ft=>ft.value===y),Pt=s==="extended"?(ln==null?void 0:ln.maxLeverage)??(ln==null?void 0:ln.leverage)??(ln==null?void 0:ln.max_leverage)??50:et==null?void 0:et.maxLeverage,qt=Number(Pt);Number.isFinite(qt)&&qt>0&&(u(qt),F(ft=>{const tt=parseInt(ft)||1;return String(Math.min(qt,Math.max(1,tt)))}))},[y,o,ln,s]),h.useEffect(()=>{if(s!=="extended"||!(fn!=null&&fn.apiKey)){We(null);return}let et=!1;const Pt=async()=>{var ft,tt,Bt,gn;try{const tr=`https://express-proxy-delta.vercel.app/proxy?url=${encodeURIComponent("https://api.starknet.extended.exchange/api/v1/user/balance")}`,er=await(await fetch(tr,{headers:{"X-Api-Key":fn.apiKey}})).json().catch(()=>null);if(et)return;const Sr=((ft=er==null?void 0:er.data)==null?void 0:ft.availableForTrade)??(er==null?void 0:er.availableForTrade)??((tt=er==null?void 0:er.data)==null?void 0:tt.available_balance)??(er==null?void 0:er.available_balance)??((Bt=er==null?void 0:er.data)==null?void 0:Bt.available)??(er==null?void 0:er.available),dr=Number(Sr),kr=((gn=er==null?void 0:er.data)==null?void 0:gn.equity)??(er==null?void 0:er.equity),qn=Number(kr);We({availableForTrade:Number.isFinite(dr)&&dr>=0?dr:null,equity:Number.isFinite(qn)?qn:null,raw:er})}catch{et||We(null)}};Pt();const qt=setInterval(Pt,2e4);return()=>{et=!0,clearInterval(qt)}},[s,fn==null?void 0:fn.apiKey]),h.useEffect(()=>{if(s!=="extended")return;const et=pt==null?void 0:pt.equity;Number.isFinite(et)&&!de&&re(String(et))},[pt==null?void 0:pt.equity,s,de]);const D=h.useRef(y),V=h.useRef(!1);h.useEffect(()=>{const et=D.current!==y,Pt=!V.current&&!C;if((et||Pt)&&(ln!=null&&ln.last)&&ln.last>0){D.current=y,V.current=!0;const qt=Rwn(ln.last,ln.priceDecimals);N(Number(ln.last).toFixed(qt))}},[y,ln==null?void 0:ln.last,C]);const X=h.useCallback(et=>{const Pt=Ac(et);v(Pt),typeof window<"u"&&window.localStorage.setItem(mn,Pt)},[mn]),le=h.useCallback(et=>{G(!0),re(et)},[]),ce=h.useCallback(et=>{N(et)},[]),fe=Ht,ye=I==="smart",Pe=h.useCallback(et=>{const Pt=parseFloat(M)||10,qt=.6/Pt,ft=parseFloat(C)||0,tt=parseFloat($)||0,Bt=parseFloat(z)||0,gn=parseInt(se)||0,tr=parseFloat(K)||1/0,Dn=parseFloat(he)||0,er=parseFloat(xe)||1.1,Sr=parseFloat(ge)||1,dr=parseFloat(ie)||0,kr=parseFloat(q)||100,qn=et==="smart",Tn=et==="long";if(qn)return{orders:[],metrics:null};if(ft<=0||tt<=0)return{orders:[],metrics:null};let $n=tt;for(let xn=1;xn<=gn;xn++)$n+=Bt*Math.pow(er,xn-1);const ir=[];let ls=0,cs=0,lt=0,Nt=0,Rn=0,ar=0,Tr=!1,Lr=null;const $r=tr,cr=tt*Pt,wr=cr/ft;ls=tt,cs=cr,lt=wr,ls>tr&&(Tr=!0,Lr=0);const ss=Tn?(ft*lt-$r)/(lt*(1-qt)):($r+ft*lt)/(lt*(1+qt)),mr=Tn?ft*(1+dr/100):ft*(1-dr/100);let ts="SAFE";ss<=0||(Tn&&ss>=ft||!Tn&&ss<=ft)&&(ts="LIQUIDATED"),Tr&&(ts="WARNING",ar++);const Qs=wr*ft*qt,Es=$r/Qs,br=Tn?(mr-ft)*wr:(ft-mr)*wr;ir.push({label:"Base",deviation:0,price:ft,margin:tt,positionValue:cr,coins:wr,totalCoins:wr,totalMargin:ls,avgEntry:ft,tpPrice:mr,tpProfit:br,liqPrice:ss,healthRatio:Es,status:ts});let Zt=!1,me=ss,dt=ft,_t=mr;for(let xn=1;xn<=gn;xn++){xn===1?Nt=Dn:Nt+=Dn*Math.pow(Sr,xn-1);const Cn=Tn?ft*(1-Nt/100):ft*(1+Nt/100);if(Zt){ir.push({label:`DCA ${xn}`,deviation:Nt,price:Cn,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:"CANCELLED"});continue}if(Cn<=0){Zt=!0,ir.push({label:`DCA ${xn}-${gn}`,deviation:Nt,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:gn-xn+1,isLong:Tn});break}const fr=Bt*Math.pow(er,xn-1),_r=fr*Pt,pr=_r/Cn,hr=ls+fr;hr>tr&&!Tr&&(Tr=!0,Lr=xn),ls=hr,cs+=_r,lt+=pr;const Xr=cs/lt,is=Tn?(Xr*lt-$r)/(lt*(1-qt)):($r+Xr*lt)/(lt*(1+qt));if(Tn?is>0&&Cn<=is:is>0&&Cn>=is){Zt=!0,ir.push({label:"💀 Liq",deviation:null,price:me,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:dt,tpPrice:_t,tpProfit:null,liqPrice:me,healthRatio:null,status:"LIQUIDATED"});for(let Kt=xn;Kt<=gn;Kt++){let sr=0;for(let Ir=1;Ir<=Kt;Ir++)Ir===1?sr=Dn:sr+=Dn*Math.pow(Sr,Ir-1);const Zn=Tn?ft*(1-sr/100):ft*(1+sr/100),Or=Zn>0;ir.push({label:`DCA ${Kt}`,deviation:sr,price:Or?Zn:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:Or?"CANCELLED":"EXCEEDED"})}break}const yr=Tn?is>=Xr:is<=Xr,nr=Tn?Xr*(1+dr/100):Xr*(1-dr/100),gs=kr>=100?null:Tn?Xr*(1-kr/100):Xr*(1+kr/100),ei=Tn?(Cn-Xr)*lt:(Xr-Cn)*lt,ci=$r+ei,Fr=lt*Cn*qt,En=ci/Fr;let Bn="SAFE";if(yr){Zt=!0,ir.push({label:`DCA ${xn}`,deviation:Nt,price:Cn,margin:fr,positionValue:_r,coins:pr,totalCoins:lt,totalMargin:ls,avgEntry:Xr,tpPrice:null,tpProfit:null,liqPrice:is,healthRatio:null,status:"LIQUIDATED"});for(let Kt=xn+1;Kt<=gn;Kt++){let sr=0;for(let Ir=1;Ir<=Kt;Ir++)Ir===1?sr=Dn:sr+=Dn*Math.pow(Sr,Ir-1);const Zn=Tn?ft*(1-sr/100):ft*(1+sr/100),Or=Zn>0;ir.push({label:`DCA ${Kt}`,deviation:sr,price:Or?Zn:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:Or?"CANCELLED":"EXCEEDED"})}break}else gs!==null&&(Tn&&Cn<=gs||!Tn&&Cn>=gs)?(Bn="STOPPED",Zt=!0):En<1.5?(Bn="WARNING",ar++):Rn++;const mt=Tn?(nr-Xr)*lt:(Xr-nr)*lt;me=is,dt=Xr,_t=nr,ir.push({label:`DCA ${xn}`,deviation:Nt,price:Cn,margin:fr,positionValue:_r,coins:pr,totalCoins:lt,totalMargin:ls,avgEntry:Xr,tpPrice:nr,tpProfit:mt,liqPrice:is,healthRatio:En,status:Bn})}const At=[...ir].reverse().find(xn=>xn.status!=="CANCELLED")||ir[ir.length-1];return{orders:ir,metrics:{totalMargin:ls,totalPositionValue:cs,liquidationPrice:At.liqPrice,breakEvenPrice:At.avgEntry,safeCount:Rn,warningCount:ar,budgetOk:!Tr,budgetExceededAt:Lr,leverage:Pt,requiredBudget:$n}}},[C,M,$,z,se,K,he,xe,ge,ie,q]),Me=h.useMemo(()=>Pe(I),[Pe,I]),Ke=h.useMemo(()=>Me.orders.filter(et=>et.status!=="CANCELLED").map(et=>({name:et.label,orderPrice:je&&et.price!=null&&et.price>0?et.price:null,avgEntry:$e&&et.avgEntry!=null&&et.avgEntry>0?et.avgEntry:null,tpPrice:Je&&et.tpPrice!=null&&et.tpPrice>0?et.tpPrice:null,liqPrice:rt&&et.liqPrice!=null&&et.liqPrice>0?et.liqPrice:null,status:et.status})),[Me.orders,je,$e,Je,rt]),we=h.useMemo(()=>{const et=[];if(Ke.forEach(tt=>{tt.orderPrice!=null&&et.push(tt.orderPrice),tt.avgEntry!=null&&et.push(tt.avgEntry),tt.tpPrice!=null&&et.push(tt.tpPrice)}),et.length===0)return["auto","auto"];const Pt=Math.min(...et),qt=Math.max(...et),ft=(qt-Pt)*.1;return[Math.max(0,Pt-ft),qt+ft]},[Ke]),Te=et=>{const{cx:Pt,cy:qt,payload:ft}=et;return ft.status==="LIQUIDATED"&&Pt&&qt?i.jsx("text",{x:Pt,y:qt,textAnchor:"middle",dominantBaseline:"middle",fontSize:14,children:"💀"}):null},te=et=>{switch(et){case"orderPrice":Oe(!je);break;case"avgEntry":Ye(!$e);break;case"tpPrice":ht(!Je);break;case"liqPrice":st(!rt);break}},ve=et=>{const{payload:Pt}=et;return i.jsx("div",{className:"flex flex-wrap justify-center gap-2 sm:gap-4 mt-2",children:Pt.map((qt,ft)=>{const tt=qt.dataKey==="orderPrice"?je:qt.dataKey==="avgEntry"?$e:qt.dataKey==="tpPrice"?Je:qt.dataKey==="liqPrice"?rt:!0;return i.jsxs("button",{onClick:()=>te(qt.dataKey),className:`flex items-center gap-1.5 text-xs px-2 py-1 rounded transition-all ${tt?"opacity-100":"opacity-40"}`,style:{color:qt.color},children:[i.jsx("span",{className:"w-3 h-0.5",style:{backgroundColor:qt.color}}),qt.value]},ft)})})},{orders:Be,metrics:Ue}=Me,Fe=Be.filter(et=>et.status!=="CANCELLED"),at=h.useMemo(()=>{var Dn,er;if(!ye)return null;const et=Pe("long"),Pt=Pe("short"),qt=(Dn=et.metrics)==null?void 0:Dn.safeCount,ft=(er=Pt.metrics)==null?void 0:er.safeCount,tt=et.orders.some(Sr=>Sr.status==="LIQUIDATED"),Bt=Pt.orders.some(Sr=>Sr.status==="LIQUIDATED"),gn=Number.isFinite(qt)&&Number.isFinite(ft)?Math.max(qt,ft):null;let tr=!1;return Number.isFinite(qt)&&Number.isFinite(ft)?qt>ft?tr=tt:ft>qt?tr=Bt:tr=tt&&Bt:tr=tt||Bt,{safeOrders:gn,hasLiquidation:tr}},[Pe,ye]),ut=h.useMemo(()=>ye?!!(at!=null&&at.hasLiquidation):Fe.some(et=>et.status==="LIQUIDATED"),[ye,Fe,at==null?void 0:at.hasLiquidation]),yt=h.useMemo(()=>{if(!ut)return null;const et=ye?at==null?void 0:at.safeOrders:Ue==null?void 0:Ue.safeCount,Pt=Number.isFinite(et)?et:0,qt=parseInt(se)||0;return`Liquidation occurs before completing all DCA orders. Safe orders: ${Pt} of ${qt}. Reduce leverage, widen spacing, or lower max DCA orders.`},[ut,ye,at==null?void 0:at.safeOrders,Ue==null?void 0:Ue.safeCount,se]),Lt=h.useMemo(()=>{const et=ye?at==null?void 0:at.safeOrders:Ue==null?void 0:Ue.safeCount,Pt=parseInt(se);return!Number.isFinite(et)||!Number.isFinite(Pt)?null:Pt>et?`Only ${et} of ${Pt} DCA orders are currently safe. Increase budget, reduce leverage, or lower Max DCA Orders.`:null},[ye,at==null?void 0:at.safeOrders,Ue==null?void 0:Ue.safeCount,se]),Gt=({variant:et="desktop"})=>{const Pt=et==="desktop"?"px-4 py-5":"p-3";return i.jsxs("div",{className:`${Pt} space-y-3`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-[#a78bfa]/15 text-[#d7c8ff]",children:i.jsx(n8e,{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(r8e,{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(t8e,{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(_wn,{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(r8e,{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(Ewn,{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(kwn,{value:x,onChange:g})]})}),i.jsx("div",{className:"col-span-2",children:i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:[s==="extended"?"Extended Wallet":"Lighter Wallet",i.jsx(Uh,{content:"Select the wallet to use for this DCA bot. The bot will execute trades using this wallet.",children:"?"})]}),pe?Vn?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(oI,{wallets:on,value:fn&&fn.id?String(fn.id):"",onChange:et=>{const Pt=on.find(qt=>String(qt.wallet_id)===String(et));Pt&&(rn({id:Pt.wallet_id,address:Pt.wallet_address,apiKey:Pt.wallet_api_key}),typeof window<"u"&&window.localStorage.setItem(Rt,String(Pt.wallet_id)))},selectedBalance:zt,mode:s}):i.jsx("div",{className:"w-full",children:i.jsx(om,{onClick:()=>Yn(!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:`${Fwn}/${vn||"BTC"}.svg`,alt:y||"coin",className:"w-6 h-6 rounded-full bg-[#161616] border border-[#1c2a24]",loading:"lazy",onError:et=>wm(et)}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Zde,{markets:In,value:y,onChange:X,loading:fe,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:()=>P("short"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${I==="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:()=>P("long"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${I==="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:()=>P("smart"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${I==="smart"?"bg-[#a78bfa]/20 border-[#a78bfa] text-[#d7c8ff]":"bg-[#161616] border-[#1c2a24] text-[#7f7b9f] hover:border-[#a78bfa]/50"}`,children:[i.jsx(n8e,{className:"w-4 h-4"}),"Smart"]})]})]}),i.jsx("div",{className:"col-span-2",children:i.jsx(Bwn,{value:M,onChange:F,min:1,max:c,tooltip:`Position multiplier. 10x leverage means $100 margin controls $1,000 position. Max leverage for ${y}: ${c}x`})})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"3"}),"Order Sizing"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(ug,{label:"Base Order Margin",value:$,onChange:L,step:"1",min:"1",suffix:"$",tooltip:"Initial margin for the first position opened at Entry Price.",validate:(et,Pt)=>!Pt||isNaN(et)?"Required":et<1?"Must be at least 1":s==="extended"&&Fn!=null&&et*Tt<Fn?T("Base Order Margin"):null}),i.jsx(ug,{label:"DCA Order Margin",value:z,onChange:Q,step:"1",min:"1",suffix:"$",tooltip:"Starting margin for DCA orders.",validate:(et,Pt)=>!Pt||isNaN(et)?"Required":et<1?"Must be at least 1":s==="extended"&&Fn!=null&&et*Tt<Fn?T("DCA Order Margin"):null}),i.jsx(ug,{label:"Max DCA Orders",value:se,onChange:ee,step:"1",max:"50",tooltip:"Maximum number of DCA orders to place after the Base Order.",validate:(et,Pt)=>!Pt||isNaN(et)?"Required":et<1?"Minimum 1":et>50?"Maximum 50":null,forceError:ut||!!Lt,forceErrorMessage:yt||Lt}),i.jsx(ug,{label:"Available to Trade",value:zt!=null?String(zt):"",onChange:()=>{},step:"100",suffix:"$",readOnly:!0,tooltip:"Wallet balance available for trading. Read only."})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"4"}),"Exit Strategy"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(ug,{label:"Take Profit",value:ie,onChange:ae,step:"0.1",suffix:"%",tooltip:"Target profit % calculated from the weighted average entry price."}),i.jsx(ug,{label:"Stop Loss",value:q,onChange:W,step:"1",suffix:"%",tooltip:"Maximum loss % from average entry before position closes. Leave empty to disable stop loss and rely only on liquidation"})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] overflow-hidden",children:[i.jsxs("button",{onClick:()=>oe(!ne),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: ",he,"% • Dev Mult: ",ge,"x • Size: ",xe,"x"]})]}),ne?i.jsx(Zcn,{className:"w-4 h-4 text-[#67FFBD]"}):i.jsx(W9,{className:"w-4 h-4 text-[#67FFBD]"})]}),i.jsx(sI,{children:ne&&i.jsx(ho.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},children:i.jsxs("div",{className:"px-4 pb-4 grid grid-cols-2 gap-3 border-t border-[#1c2a24] pt-3",children:[i.jsx(ug,{label:"Price Deviation",value:he,onChange:_e,step:"0.1",suffix:"%",tooltip:"Initial price change % from Entry Price to trigger DCA."}),i.jsx(ug,{label:"DCA Order Size Multiplier",value:xe,onChange:Se,step:"0.1",suffix:"x",tooltip:"Multiplier for each DCA order's margin."}),i.jsx(ug,{label:"Price Deviation Multiplier",value:ge,onChange:Ce,step:"0.05",suffix:"x",tooltip:"Multiplier for price gaps between DCA orders."})]})})})]}),(()=>{const et=C&&!isNaN(parseFloat(C))&&parseFloat(C)>0,Pt=$&&!isNaN(parseFloat($))&&parseFloat($)>=1,qt=z&&!isNaN(parseFloat(z))&&parseFloat(z)>=1,ft=se&&!isNaN(parseInt(se))&&parseInt(se)>=1,tt=K&&!isNaN(parseFloat(K))&&parseFloat(K)>0,Bt=et&&Pt&&qt&&ft&&tt,gn=k,tr=kr=>{const qn=parseFloat(C)||0,Tn=parseFloat($)||0,$n=parseFloat(z)||0,ir=parseInt(se)||0,ls=parseFloat(K)||1/0,cs=parseFloat(xe)||1.1;if(qn<=0||Tn<=0)return null;let lt=Tn,Nt=0,Rn=lt>ls;Rn||(Nt+=1);for(let Tr=1;Tr<=ir;Tr++){const Lr=$n*Math.pow(cs,Tr-1);lt+=Lr,!Rn&<>ls&&(Rn=!0),Rn||(Nt+=1)}return{budgetOk:lt<=ls,safeCount:Nt}},Dn=ye?{long:tr(),short:tr()}:null,er=ye&&(Dn==null?void 0:Dn.long)&&(Dn==null?void 0:Dn.short)&&Dn.long.budgetOk&&Dn.short.budgetOk&&Dn.long.safeCount>0&&Dn.short.safeCount>0&&!gn,Sr=ye?Bt&&er:Bt&&Ue&&Ue.budgetOk&&Ue.safeCount>0&&!gn;let dr=null;if(!Bt)dr="Please fill in all required fields";else if(gn&&Fn!=null){const kr=[];S&&kr.push("Base Order"),A&&kr.push("DCA Order");const qn=kr.length===1?` (${kr[0]})`:kr.length===2?" (Base Order & DCA Order)":"";dr=`Minimum order size for ${String(y||"").toUpperCase()} is $${Fn.toFixed(2)}${qn}. Increase order size or leverage.`}else!ye&&Ue&&!Ue.budgetOk?dr="Budget exceeded - increase budget or reduce orders":!ye&&Ue&&Ue.safeCount===0?dr="No safe orders - reduce leverage or increase budget":ye&&(!(Dn!=null&&Dn.long)||!(Dn!=null&&Dn.short)||!Dn.long.budgetOk||!Dn.short.budgetOk)?dr="Budget exceeded in Smart mode - adjust margin or orders":ye&&(Dn!=null&&Dn.long)&&(Dn!=null&&Dn.short)&&(Dn.long.safeCount===0||Dn.short.safeCount===0)&&(dr="No safe orders in Smart mode - reduce leverage or increase budget");return i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[(()=>{const kr=(Wn==null?void 0:Wn.id)||(Wn==null?void 0:Wn.bot_id),qn=kr&&Ut[kr]===!0,Tn=kr&&nn[kr]===!0,$n=!!Wn,ir=$n?qn||Tn:!Sr||nt||!fn||!fn.id,ls=()=>{$n&&kr?Mt(kr,!0):gt()};return i.jsx("button",{onClick:ls,disabled:ir,className:`w-full py-2.5 rounded-lg text-sm font-semibold transition-all flex items-center justify-center gap-2 ${$n?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":Sr&&fn&&fn.id&&!nt?"bg-[#67FFBD] text-[#101010] hover:bg-[#9FFFDA]":"bg-[#333] text-[#666] cursor-not-allowed"} disabled:opacity-60 disabled:cursor-not-allowed`,children:$n?qn?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"]}):nt?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"]})})})(),dr&&i.jsx("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:dr}),(!fn||!fn.id)&&i.jsx("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:"Please select a Extended wallet first"}),i.jsx("p",{className:"text-xs text-[#555] text-center mt-2",children:"Bot will execute orders on Extended exchange"})]})})(),i.jsx("div",{className:"h-4"})]}),i.jsxs("div",{className:"lg:col-span-2 space-y-4 pb-6",children:[i.jsx("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4 mb-4",children:i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#0b1511] border border-[#1e2e27] flex items-center justify-center",children:i.jsx(t8e,{className:"w-5 h-5 text-[#67FFBD]"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-base font-semibold text-[#d7ffe9]",children:"DCA Bot and Calculator"}),i.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Plan your strategy and start DCAing"}),i.jsx("div",{className:"flex items-center mt-1 text-sm text-[#67FFBD]",children:i.jsxs("a",{href:"https://docs.dextrabot.com/dca-bot/extended-dca-bot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-lg bg-[#101010]/70 hover:bg-[#111] transition-colors",children:[i.jsx("span",{className:"text-xs text-white",children:"New to DCA? Learn how it works"}),i.jsx("span",{children:"📚"})]})})]})]}),Ue&&i.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Total Margin",i.jsx(Uh,{content:"Total margin required for Base Order + all DCA orders",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold text-white",children:["$",Io(Ue.totalMargin)]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Position Value",i.jsx(Uh,{content:"Combined notional value of all positions. Total Margin × Leverage",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold text-white",children:["$",Io(Ue.totalPositionValue)]}),i.jsxs("div",{className:"text-xs text-[#555]",children:[Ue.leverage,"x leverage"]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Safe Orders",i.jsx(Uh,{content:"DCA orders that can be executed safely.",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold",style:{color:zb},children:[Ue.safeCount,"/",parseInt(se)||0]})]})]})]})}),!ye&&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(YUe,{width:"100%",height:"100%",children:i.jsxs(man,{data:Ke.length>0?Ke:[{name:"No Data",orderPrice:null,avgEntry:null,tpPrice:null,liqPrice:null}],margin:{top:10,right:20,left:10,bottom:5},children:[i.jsx(UHe,{strokeDasharray:"3 3",stroke:"#1c2a24"}),i.jsx(F8,{dataKey:"name",stroke:"#666",fontSize:10,interval:0,angle:Ke.length>6?-45:0,textAnchor:Ke.length>6?"end":"middle",height:Ke.length>6?50:30,tickFormatter:et=>et==="Base"?"B":et.startsWith("DCA")?`D${et.split(" ")[1]}`:et.includes("Liq")?"💀":et}),i.jsx(O8,{stroke:"#666",fontSize:10,tickFormatter:et=>`$${Io(et)}`,domain:we,allowDataOverflow:!0}),i.jsx(sm,{contentStyle:{backgroundColor:"#101010",border:"1px solid #333",borderRadius:"6px",fontSize:"11px"},formatter:(et,Pt)=>[Ob(et),Pt],labelFormatter:et=>et==="B"?"Base Order":et.startsWith("D")?`DCA ${et.slice(1)}`:et}),i.jsx(j3,{content:ve}),i.jsx($0,{type:"monotone",dataKey:"orderPrice",name:"Order Price",stroke:zb,strokeWidth:2,dot:{fill:zb,r:3},connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"avgEntry",name:"Avg Entry",stroke:rO,strokeWidth:2,dot:{fill:rO,r:2},connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"tpPrice",name:"TP",stroke:s8e,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"liqPrice",name:"Liq",stroke:IM,strokeWidth:1.5,strokeDasharray:"4 4",dot:Te,connectNulls:!0})]})})}),i.jsxs("div",{className:"text-xs text-[#555] text-center mt-2",children:["B = Base Order • D1-D",se," = 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:()=>Ve("details"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${He==="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:()=>Ve("bots"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${He==="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"})]}),He==="details"&&(ye?i.jsx(Gt,{variant:"desktop"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-4 py-3",children:i.jsx(a8e,{entryPrice:C,onEntryPriceChange:ce,maxBudget:K,onBudgetChange:le})}),i.jsxs("div",{className:"overflow-x-auto",children:[i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#161616] text-[#888]",children:[i.jsx("th",{className:"px-3 py-2 text-left",children:"#"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Dev %"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Price"}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"Margin"}),i.jsx("th",{className:"px-3 py-2 text-right hidden xl:table-cell",children:"Pos. Value"}),i.jsxs("th",{className:"px-3 py-2 text-right",children:["Size (",y,")"]}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"Total Margin"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Avg Entry"}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"TP"}),i.jsx("th",{className:"px-3 py-2 text-right",children:i.jsxs("span",{className:"flex items-center justify-end gap-1",children:["TP Profit",i.jsx(Uh,{content:"Profit if price reaches Take Profit level after this order executes.",children:i.jsx("span",{className:"text-[#666]",children:"?"})})]})}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Liq"}),i.jsx("th",{className:"px-3 py-2 text-center",children:"Status"})]})}),i.jsx("tbody",{children:Fe.map((et,Pt)=>{const qt=i8e[et.status];if(et.status==="EXCEEDED"){const ft=et.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:qt.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:et.label})," ","— ",ft]})]})})},Pt)}return i.jsxs("tr",{className:"border-t border-[#1c2a24] hover:bg-[#111]",children:[i.jsx("td",{className:"px-3 py-2 font-medium whitespace-nowrap",children:et.label}),i.jsx("td",{className:"px-3 py-2 text-right",children:et.deviation!=null?Mwn(et.deviation):"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:Ob(et.price)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:et.margin!=null?`$${Io(et.margin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden xl:table-cell",children:et.positionValue!=null?`$${Io(et.positionValue)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:et.coins!=null?Io(et.coins,4):"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:et.totalMargin!=null?`$${Io(et.totalMargin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:rO},children:Ob(et.avgEntry)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",style:{color:s8e},children:Ob(et.tpPrice)}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:zb},children:et.tpProfit!=null?`$${Io(et.tpProfit)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:et.liqPrice<=0?zb:IM},children:Ob(et.liqPrice,!0)}),i.jsx("td",{className:"px-3 py-2 text-center",children:i.jsx(Uh,{content:qt.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:`${qt.color}15`,color:qt.color},children:qt.icon})})})]},Pt)})})]}),Fe.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"})]})]})]})),He==="bots"&&i.jsx("div",{className:"p-4",children:Qt?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..."})]}):On.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:On.map(et=>{const Pt=!et.is_deleted,qt=et.bot_params||{},ft=et.created_at?new Date(et.created_at):null,tt=ft?(()=>{const dr=Date.now()-ft.getTime(),kr=Math.floor(dr/(1e3*60*60)),qn=Math.floor(kr/24);return qn>0?`${qn}d ago`:kr>0?`${kr}h ago`:`${Math.floor(dr/(1e3*60))}m ago`})():null,Bt=qt.direction==="long"?"Long":qt.direction==="short"?"Short":"Smart",gn=qt.price_deviation??qt.priceDeviation??0,tr=qt.step_scale??qt.price_dev_multiplier??qt.priceDevMultiplier??0,Dn=qt.volume_scale??qt.dca_size_multiplier??qt.dcaSizeMultiplier??0,er=qt.tp_percent??qt.tp_target??qt.take_profit_percent??0,Sr=qt.stop_loss_percent??qt.stop_loss??0;return qt.market_index??qt.marketIndex,qt.coin_idx??qt.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:[et.coin||y," DCA Bot"]}),Pt?i.jsx("span",{className:"px-2 py-0.5 text-xs rounded bg-[#67FFBD]/20 text-[#67FFBD]",children:"Active"}):i.jsx("span",{className:"px-2 py-0.5 text-xs rounded bg-[#666]/20 text-[#666]",children:"Stopped"})]}),tt&&i.jsx("span",{className:"text-[11px] text-[#7c7c7c]",children:tt})]}),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 ${qt.direction==="long"?"text-[#67FFBD]":qt.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:Bt})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[qt.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:["$",Io(qt.base_amount_usd||qt.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:["$",Io(qt.safety_amount_usd||qt.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:qt.max_safety_orders||qt.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:[Io(gn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Io(tr),"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:[Io(Dn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Take Profit:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Io(er),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Stop Loss:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Io(Sr),"%"]})]}),tt&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:tt})]})]}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:()=>Mt(et.id||et.bot_id,Pt),disabled:Ut[et.id||et.bot_id]||nn[et.id||et.bot_id],className:`w-full py-2 rounded-lg text-sm font-semibold transition-colors ${Pt?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Ut[et.id||et.bot_id]?Pt?"Stopping...":"Starting...":Pt?"Stop Bot":"Start Bot"})})]},et.id||et.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:()=>Ve("details"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${He==="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:()=>Ve("bots"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${He==="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"})]}),He==="details"&&(ye?i.jsx(Gt,{variant:"mobile"}):i.jsxs("div",{className:"p-3 space-y-2",children:[i.jsx(a8e,{className:"w-full",entryPrice:C,onEntryPriceChange:ce,maxBudget:K,onBudgetChange:le}),Fe.map((et,Pt)=>{const qt=i8e[et.status];if(et.status==="EXCEEDED"){const ft=et.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:qt.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:et.label})," ","— ",ft]})]})},Pt)}return i.jsxs("div",{className:"bg-[#111] rounded-lg p-3 border border-[#1c2a24]",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsx("span",{className:"font-medium text-sm",children:et.label}),i.jsx(Uh,{content:qt.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:`${qt.color}15`,color:qt.color},children:qt.icon})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Price:"}),i.jsx("span",{children:Ob(et.price)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Size:"}),i.jsx("span",{children:et.coins!=null?`${Io(et.coins,4)} ${y}`:"-"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Avg Entry:"}),i.jsx("span",{style:{color:rO},children:Ob(et.avgEntry)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Liq:"}),i.jsx("span",{style:{color:et.liqPrice<=0?zb:IM},children:Ob(et.liqPrice,!0)})]}),i.jsxs("div",{className:"flex justify-between col-span-2 pt-1 border-t border-[#1c2a24] mt-1",children:[i.jsx("span",{className:"text-[#666]",children:"TP Profit:"}),i.jsx("span",{style:{color:zb},className:"font-medium",children:et.tpProfit!=null?`$${Io(et.tpProfit)}`:"-"})]})]})]},Pt)})]})),He==="bots"&&i.jsx("div",{className:"p-3",children:Qt?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..."})]}):On.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:On.map(et=>{const Pt=!et.is_deleted,qt=et.bot_params||{},ft=et.created_at?new Date(et.created_at):null,tt=ft?(()=>{const qn=Date.now()-ft.getTime(),Tn=Math.floor(qn/(1e3*60*60)),$n=Math.floor(Tn/24);return $n>0?`${$n}d ago`:Tn>0?`${Tn}h ago`:`${Math.floor(qn/(1e3*60))}m ago`})():null,Bt=qt.direction==="long"?"Long":qt.direction==="short"?"Short":"Smart",gn=qt.price_deviation??qt.priceDeviation??0,tr=qt.step_scale??qt.price_dev_multiplier??qt.priceDevMultiplier??0,Dn=qt.volume_scale??qt.dca_size_multiplier??qt.dcaSizeMultiplier??0,er=qt.tp_percent??qt.tp_target??qt.take_profit_percent??0,Sr=qt.stop_loss_percent??qt.stop_loss??0,dr=qt.market_index??qt.marketIndex,kr=qt.coin_idx??qt.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:[et.coin||y," DCA"]}),Pt?i.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded bg-[#67FFBD]/20 text-[#67FFBD]",children:"Active"}):i.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded bg-[#666]/20 text-[#666]",children:"Stopped"})]}),tt&&i.jsx("span",{className:"text-[10px] text-[#7c7c7c]",children:tt})]}),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 ${qt.direction==="long"?"text-[#67FFBD]":qt.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:Bt})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[qt.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:["$",Io(qt.base_amount_usd||qt.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:["$",Io(qt.safety_amount_usd||qt.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:qt.max_safety_orders||qt.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:[Io(gn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Io(tr),"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:[Io(Dn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"TP:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Io(er),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"SL:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Io(Sr),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Market:"}),i.jsx("span",{className:"ml-1 text-white",children:dr??"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Coin Idx:"}),i.jsx("span",{className:"ml-1 text-white",children:kr??"-"})]}),tt&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:tt})]})]}),i.jsx("div",{className:"mt-3",children:i.jsx("button",{onClick:()=>Mt(et.id||et.bot_id,Pt),disabled:Ut[et.id||et.bot_id]||nn[et.id||et.bot_id],className:`w-full py-1.5 rounded-lg text-[11px] font-semibold transition-colors ${Pt?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Ut[et.id||et.bot_id]?"...":Pt?"Stop Bot":"Start Bot"})})]},et.id||et.bot_id)})})})]})})]})]})})}const Uwn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Yr);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 vi(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(Ga,{children:i.jsxs(no,{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($wn,{})})})]})},R7=({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..."})]}),oB="/assets/subscribeAnimation-oYDBxlRF.mp4",zwn=()=>{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(Yr),{address:f}=es(),[x,g]=h.useState(1),[y,v]=h.useState(""),[C,N]=h.useState(""),[I,P]=h.useState(!1),[M,F]=h.useState(!1),[$,L]=h.useState(""),[z,Q]=h.useState(0),[se,ee]=h.useState(0),[K,re]=h.useState(!1),de=ge=>/^\d*$/.test(ge),G=ge=>{["e","E","+","-"].includes(ge.key)&&ge.preventDefault()},ie=h.useMemo(()=>{if(x==="")return!1;const ge=Number(x);return Number.isInteger(ge)&&ge>=1},[x]),W=(ge=>{const[Ce,je]=ge.split(" "),[Oe,$e,Ye]=Ce.split("-").map(Number),[Je,ht]=je.split(":").map(Number);return new Date(Date.UTC(Ye,$e-1,Oe,Je-3,ht))})("29-11-2025 23:59");h.useState(()=>new Date().getTime()>=W.getTime());const ne=h.useRef(z);h.useEffect(()=>{ne.current=z},[z]);const oe=h.useRef(0);h.useEffect(()=>{oe.current=se},[se]);const he=async()=>{var je,Oe;const ge=window.localStorage.getItem("hyperToken"),Ce=window.localStorage.getItem("hyperAddress");if(!(!ge||!Ce))try{const $e=await vi(Ce.toLowerCase(),ge);$e!=null&&$e.success?(e($e==null?void 0:$e.telegram_chat_id),n($e==null?void 0:$e.subscriber_role),r($e==null?void 0:$e.subs_expire_day),s((je=$e==null?void 0:$e.mushboomer_counts)==null?void 0:je.eth),a((Oe=$e==null?void 0:$e.mushboomer_counts)==null?void 0:Oe.sol),o($e==null?void 0:$e.referral_code),l($e==null?void 0:$e.refcode),c($e==null?void 0:$e.whitelist),u(ge),d(Ce),v($e==null?void 0:$e.farming_tools),Q(Number(($e==null?void 0:$e.subs_expire_day)||0))):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""))}catch($e){console.error("Token verification error:",$e),console.error($e.message||"An unknown error occurred.")}};h.useEffect(()=>{K&&he()},[K]),h.useEffect(()=>{const ge=localStorage.getItem("hyperToken"),Ce=localStorage.getItem("hyperAddress");re(!!(ge&&Ce));const je=setInterval(()=>{const Oe=localStorage.getItem("hyperToken"),$e=localStorage.getItem("hyperAddress");re(!!(Oe&&$e))},800);return()=>clearInterval(je)},[]);const _e=async()=>new kl(window.ethereum).eth.getAccounts(Ce=>Ce),xe=async(ge="subscribe",Ce=24,je=5e3)=>{Ce<=0||(await new Promise(Oe=>setTimeout(Oe,je)),await he(),ge==="subscribe"&&ne.current===oe.current?xe(ge,Ce-1,je):he())},Se=async ge=>{const Ce=window.localStorage.getItem("hyperToken"),je=window.localStorage.getItem("hyperAddress");if(!Ce||!f){t(!0);return}N(""),ee(ne.current),oe.current=ne.current,F(!0),P(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Ye){console.error("Failed to switch network",Ye),P(!1);return}const Oe=new kl(window.ethereum);var $e=await _e();if($e.length>0?$e=$e[0]:$e=void 0,$e){const Je=ge*.12,ht=Oe.utils.toWei(Je.toString(),"ether"),rt={from:$e,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:ht};await Oe.eth.sendTransaction(rt).then(st=>{console.log("txHash :>> ",st),P(!1),L(st.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:Ce,payment_tx:st.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),he(),xe("subscribe")}).catch(st=>{console.log(st),st.code===-32003||st.message.includes("insufficient funds")?N("Insufficient funds."):st.message==="MetaMask Tx Signature: User denied transaction signature."&&F(!1)})}else await Oe.eth.requestAccounts()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:M,setOpen:F,transactionHash:$,transactionLoading:I,paymentPresaleRole:!(z<=se),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:oB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},oB)}),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(ge=>{const Ce=Number(ge||0);return Ce>1?String(Ce-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:x,onChange:ge=>{const Ce=ge.target.value.trim();if(Ce==="")return g("");de(Ce)&&g(Ce)},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(ge=>{const Ce=Number(ge||0);return String(Ce+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),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:ge=>{ge.preventDefault(),ie&&Se(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"})]})})]})]})},Hwn=()=>{es();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Yr);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 vi(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(Ga,{children:i.jsxs(no,{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(zwn,{})})]})},uKe=({open:t,setOpen:e,makerStatus:n,isStatusWallet:r,info:s,modalLoading:a})=>i.jsxs(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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"})})]})]})})})})})]}),Vwn=({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,N]=h.useState(!1),[I,P]=h.useState(!1);h.useState(!1);const[M,F]=h.useState(""),[$,L]=h.useState(!1),[z,Q]=h.useState(null),[se,ee]=h.useState(""),[K,re]=h.useState(!1);h.useState(!1);const[de,G]=h.useState([]),[ie,ae]=h.useState("");h.useState("");const[q,W]=h.useState(100),[ne,oe]=h.useState("NEUTRAL"),[he,_e]=h.useState("AGGRESSIVE"),[xe,Se]=h.useState("");h.useState(""),h.useState("");const[ge,Ce]=h.useState(!1),[je,Oe]=h.useState(!1),[$e,Ye]=h.useState(!1),{setSignModalOpen:Je,setTelegramChatId:ht,setSubscriberRole:rt,setMushboomerETH:st,setMushboomerSOL:He,setIsReferralCode:Ve,setIsReferralCodeName:bt,setIsWhitelist:xt,setHyperToken:Qt,setHyperAddress:St}=h.useContext(Yr),on="https://dextrabothypev2.nftinit.io",cn="https://api.hyperliquid.xyz/info",Vn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};h.useEffect(()=>{async function gt(){var Mt;if(open)try{const vn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper")).json();if(vn!=null&&vn.coins){const Wn=(Mt=vn==null?void 0:vn.coins)==null?void 0:Mt.map($t=>{const Nn=($t==null?void 0:$t.value)||"",Fn=Vn[Nn]||Nn,Tt=Fn==="xyz:MSTR"?"":`https://app.hyperliquid.xyz/coins/${Fn}.svg`;return{...$t,icon:Tt}}),On=vn.coins.filter($t=>$t.value.includes(":")).map($t=>{const[Nn,Fn]=$t.value.split(":");return Fn});f(Wn),g(On)}}catch(ln){console.error("Failed to fetch coin list:",ln)}}gt()},[]);const tn=gt=>{var Mt;return((Mt=d.find(ln=>ln.label===gt))==null?void 0:Mt.maxLeverage)??100},fn=gt=>({HL_FEE:15e-5,BUILDER_FEE:2e-4,GROW_RATE:(x==null?void 0:x.includes(gt))?.1:1}),rn=(gt,Mt)=>{if(!gt||!Mt)return"";const{HL_FEE:ln,BUILDER_FEE:vn,GROW_RATE:Wn}=fn(Mt);return(Number(gt)*(ln+vn*Wn)).toFixed(0)},nt=(gt,Mt)=>{if(!gt||!Mt)return"";const{HL_FEE:ln,BUILDER_FEE:vn,GROW_RATE:Wn}=fn(Mt);return(Number(gt)/(ln+vn*Wn)).toFixed(0)},it=gt=>gt===""||gt===null?"":Number(gt).toLocaleString("en-US"),Ut=gt=>gt?gt.replace(/,/g,""):"",hn=gt=>{if(gt==null||gt==="")return"0.00";const Mt=Number(gt);return Number.isNaN(Mt)?"0.00":Mt.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},nn=gt=>/^\d*$/.test(gt),Vt=gt=>/^\d*\.?\d{0,6}$/.test(gt),pt=gt=>{["e","E","+","-"].includes(gt.key)&>.preventDefault()};h.useEffect(()=>{if(!o)return;const gt=tn(o),Mt=Number(ie);!Number.isNaN(Mt)&&Mt>gt&&ae(String(gt)),!Number.isNaN(Mt)&&Mt<1&&ie!==""&&ae("1")},[o]);const We=h.useMemo(()=>{if(!z||!ie||!xe)return"";const gt=he==="NORMAL"?.02:he==="PASSIVE"?.05:.1,Mt=Number(z)*Number(ie),ln=Number(xe)*gt;return Mt>ln?"":"Insufficient margin to create order, please increase your margin."},[z,ie,xe,he]),It=h.useMemo(()=>{if(ie==="")return!1;const gt=Number(ie),Mt=tn(o);return Number.isInteger(gt)&>>=1&><=Mt},[ie,o,d]);h.useEffect(()=>{if(!o)return;const gt=tn(o),Mt=Number(ie);!Number.isNaN(Mt)&&Mt>gt&&ae(String(gt)),!Number.isNaN(Mt)&&Mt<1&&ie!==""&&ae("1")},[o]);const Ge=h.useMemo(()=>{if(q==="")return!1;const gt=Number(q);return Number.isNaN(gt)?!1:gt===0?!0:gt>=0},[q]),ct=h.useMemo(()=>{if(xe==="")return!1;const gt=Number(xe);return!Number.isNaN(gt)&>>0},[xe]),vt=h.useMemo(()=>n.map(gt=>{const Mt=(gt==null?void 0:gt.wallet_name)??(gt==null?void 0:gt.name)??(gt==null?void 0:gt.label)??String(gt==null?void 0:gt.wallet_id),ln=(gt==null?void 0:gt.version)===3?`${Mt} - (API-AGENT) Wallet`:Mt;return{value:(gt==null?void 0:gt.wallet_id)??(gt==null?void 0:gt.id)??(gt==null?void 0:gt.value)??"",label:ln,raw:gt}}),[n]),Ht=h.useMemo(()=>{var gt;return(gt=vt.find(Mt=>String(Mt.value)===String(s)))==null?void 0:gt.raw},[vt,s]),Rt=h.useMemo(()=>{const gt=Ht||{};return gt.address||gt.evm_address||gt.wallet_address||gt.public_address||gt.eth_address||gt.addr||null},[Ht]),mn=s!==""&&o!==""&&K&&It&&ct&&!We&&(ne==="LONG"||ne==="SHORT"||ne==="NEUTRAL")&&(he==="AGGRESSIVE"||he==="NORMAL"||he==="PASSIVE");h.useEffect(()=>{const gt=localStorage.getItem("hyperToken"),Mt=localStorage.getItem("hyperAddress");re(!!(gt&&Mt));const ln=setInterval(()=>{const vn=localStorage.getItem("hyperToken"),Wn=localStorage.getItem("hyperAddress");re(!!(vn&&Wn))},800);return()=>clearInterval(ln)},[]),h.useEffect(()=>{F(""),K&&_n()},[K]),h.useEffect(()=>{Rt?un(Rt):(Q(null),ee(""),G([]))},[Rt]),h.useEffect(()=>{K&&(t(),qe())},[K]);async function un(gt){var Mt;try{ee(""),L(!0),Q(null);const vn=await(await fetch(cn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:gt})})).json();Q((Mt=vn==null?void 0:vn.marginSummary)==null?void 0:Mt.accountValue)}catch(ln){ee(ln.message||"Failed to load USDC balance.")}finally{L(!1)}}function yn(){const gt=Rt||window.localStorage.getItem("hyperAddress");gt&&un(gt)}async function _n(){try{v(!0);const gt=window.localStorage.getItem("hyperToken"),Mt=window.localStorage.getItem("hyperAddress");if(!gt||!Mt){re(!1),Je(!0);return}const vn=await(await fetch(`${on}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Mt.toLowerCase(),token:gt})})).json();vn!=null&&vn.success?r((vn==null?void 0:vn.data)||[]):F((vn==null?void 0:vn.error_message)||"Failed to load wallets.")}catch(gt){F(gt.message||"Wallet list error.")}finally{v(!1)}}async function In(){if(!K){Je(!0);return}if(mn)try{P(!0),F(""),Ye(!0);const gt=window.localStorage.getItem("hyperToken"),Mt=window.localStorage.getItem("hyperAddress");if(!gt||!Mt){re(!1),Je(!0);return}const ln={coin:c,leverage:Number(ie),volume:Number(xe),orderBookDepth:1,perOrderPosValue:he==="PASSIVE"?2:he==="NORMAL"?5:10,direction:ne,executionMode:he,budget:Number(q)},vn={address:Mt.toLowerCase(),token:gt,wallet_id:Number(s),source_market:"hyper",bot_params:ln,coin:o},On=await(await fetch(`${on}/api/hyper/mmbot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(vn)})).json();On!=null&&On.success?(t(),dn.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((On==null?void 0:On.error_message)||"Start failed."),dn.error((On==null?void 0:On.error_message)||"Save failed."))}catch(gt){F(gt.message||"An error occurred while saving.")}finally{P(!1),Oe(!1),Ye(!1)}}const Sn=32,Yn={control:(gt,Mt)=>({...gt,backgroundColor:"#242424",borderColor:Mt.isFocused?"#67FFBD":"#353535",minHeight:Sn,height:Sn,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:gt=>({...gt,height:Sn,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:gt=>({...gt,height:Sn}),input:gt=>({...gt,color:"#FFFFFF",margin:0,padding:0}),singleValue:gt=>({...gt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:gt=>({...gt,color:"#7F7F7F",fontSize:"12px"}),menu:gt=>({...gt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:gt=>({...gt,paddingTop:0,paddingBottom:0,maxHeight:180}),option:(gt,Mt)=>({...gt,backgroundColor:Mt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:Sn,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:gt=>({...gt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:gt=>({...gt,backgroundColor:"#353535"})},Xn=({max:gt})=>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:[gt,"x"]}),zn=()=>i.jsx("div",{className:"px-2 py-0.5 rounded-md bg-[#0f1b1b] text-[#67ffbd] text-[10px] font-semibold",children:"xyz"}),Kn=gt=>{var ln;const Mt=x==null?void 0:x.includes(gt.data.label);return i.jsx(ma.Option,{...gt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(ln=gt.data)!=null&&ln.icon?i.jsx("img",{src:gt.data.icon,alt:gt.data.label,className:"w-4 h-4",onError:vn=>vn.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:gt.data.label}),Mt&&i.jsx(zn,{}),i.jsx(Xn,{max:gt.data.maxLeverage})]})})},jn=gt=>{var ln;const Mt=x==null?void 0:x.includes(gt.data.label);return i.jsx(ma.SingleValue,{...gt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(ln=gt.data)!=null&&ln.icon?i.jsx("img",{src:gt.data.icon,alt:gt.data.label,className:"w-4 h-4",onError:vn=>vn.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:gt.data.label}),Mt&&i.jsx(zn,{}),i.jsx(Xn,{max:gt.data.maxLeverage})]})})},De=(gt,Mt)=>{if(l(gt),u(Mt),q===""&&xe===""){W(100),Se(nt(100,gt));return}if(q===""&&xe!==""){W(rn(xe,gt));return}if(q!==""&&xe===""){Se(nt(q,gt));return}W(rn(xe,gt))},pe=d,qe=async()=>{var ln,vn;const gt=window.localStorage.getItem("hyperToken"),Mt=window.localStorage.getItem("hyperAddress");if(!(!gt||!Mt))try{N(!0);const Wn=await vi(Mt.toLowerCase(),gt);Wn!=null&&Wn.success?(ht(Wn==null?void 0:Wn.telegram_chat_id),rt(Wn==null?void 0:Wn.subscriber_role),st((ln=Wn==null?void 0:Wn.mushboomer_counts)==null?void 0:ln.eth),He((vn=Wn==null?void 0:Wn.mushboomer_counts)==null?void 0:vn.sol),Ve(Wn==null?void 0:Wn.referral_code),bt(Wn==null?void 0:Wn.refcode),xt(Wn==null?void 0:Wn.whitelist),Qt(gt),St(Mt),N(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Qt(""),St(""),N(!1))}catch(Wn){console.error("Token verification error:",Wn),console.error(Wn.message||"An unknown error occurred."),N(!1)}},Ae=gt=>i.jsxs(ma.MenuList,{...gt,children:[i.jsxs("div",{onClick:()=>{gt.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"}),gt.children]}),ze=y||I,zt=!1,kt=tn(o);return i.jsxs(i.Fragment,{children:[ge&&_a.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:ge,setOpen:Ce,handleListRequest:_n,handlePageChange:()=>{}})}),document.body),i.jsx(uKe,{open:je,setOpen:Oe,makerStatus:In,isStatusWallet:"",info:"settings",modalLoading:$e}),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(hl,{styles:Yn,isDisabled:ze||y||zt,isLoading:y,options:vt,components:{MenuList:Ae},setIsGenWalletModal:Ce,value:vt.find(gt=>String(gt.value)===String(s))||null,onChange:gt=>{a((gt==null?void 0:gt.value)??""),e((gt==null?void 0:gt.value)??"")},placeholder:K?y?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{K||Je(!0)},menuIsOpen:K?void 0:!1}),!K&&i.jsx("button",{type:"button",onClick:()=>Je(!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(hl,{styles:Yn,components:{Option:Kn,SingleValue:jn},isDisabled:ze||zt,options:pe,value:pe.find(gt=>gt.label===o)||null,onChange:gt=>De((gt==null?void 0:gt.label)??"",(gt==null?void 0:gt.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:gt=>{const Mt=gt.target.value.trim();if(Mt==="")return ae("");nn(Mt)&&ae(Mt)},onKeyDown:pt,inputMode:"numeric",autoComplete:"off",placeholder:o?`1–${kt}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]":It?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:ze||zt})]}),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:it(q),onChange:gt=>{let Mt=Ut(gt.target.value);if(Mt===""){W(""),Se("");return}if(Vt(Mt)){W(Mt);const ln=nt(Mt,o);Se(ln)}},onKeyDown:pt,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] ${q===""?"border-[#353535]":Ge?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:ze||zt})]})]}),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:it(xe),onChange:gt=>{let Mt=Ut(gt.target.value);if(Mt===""){Se(""),W("");return}if(Vt(Mt)){Se(Mt);const ln=rn(Mt,o);W(ln)}},onKeyDown:pt,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] ${xe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:ze||zt})]})]}),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":ne==="SHORT",onClick:()=>oe("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",ze||zt?"cursor-not-allowed":"cursor-pointer",ne==="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":ne==="NEUTRAL",onClick:()=>oe("NEUTRAL"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",ze||zt?"cursor-not-allowed":"cursor-pointer",ne==="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":ne==="LONG",onClick:()=>oe("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",ze||zt?"cursor-not-allowed":"cursor-pointer",ne==="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":he==="AGGRESSIVE",onClick:()=>_e("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",ze||zt?"cursor-not-allowed":"cursor-pointer",he==="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 ",he==="AGGRESSIVE"?" ✓":""]})}),i.jsx("button",{"aria-pressed":he==="NORMAL",onClick:()=>_e("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",ze||zt?"cursor-not-allowed":"cursor-pointer",he==="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 ",he==="NORMAL"?" ✓":""]})}),i.jsx("button",{"aria-pressed":he==="PASSIVE",onClick:()=>_e("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",ze||zt?"cursor-not-allowed":"cursor-pointer",he==="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 ",he==="PASSIVE"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:"flex items-start gap-3 mt-3 pt-3 border-t border-[#353535] bg[rgba(27,27,27,0.32)] rounded-b-3xl w-full",children:[i.jsxs("div",{className:"flex basis-1/2 flex-col gap-1",children:[K&&i.jsxs("div",{className:"text-[12px] text-[#9B9B9B] flex items-center gap-2",children:["Available Perp Balance (USDC):",i.jsx("span",{className:"text-white",children:$?"Loading...":se?"—":hn(z??"0")}),i.jsx("div",{onClick:yn,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(Jg,{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:Hl,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:()=>{Oe(!0)},disabled:!mn||ze,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!mn||ze?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer"}`,children:I?"Loading...":"Start"})})})]})]})},Wwn=({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?_a.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},qwn=({data:t,shareModalOpen:e,setShareModalOpen:n})=>{var C,N,I,P,M;const{isReferralCodeName:r}=h.useContext(Yr),[s,a]=h.useState(za),[o,l]=h.useState(!0),c=h.useRef(null),u=async()=>{if(c.current)try{await document.fonts.ready,await new Promise(L=>setTimeout(L,500));const F=await V1(c.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),$=document.createElement("a");$.href=F,$.download="dextrabot-market-maker.png",document.body.appendChild($),$.click(),document.body.removeChild($),dn.success("PNG successfully downloaded!")}catch(F){console.error("Error generating PNG:",F),dn.error("Failed to download PNG.")}},d=async F=>{l(!0);try{const L=await(await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(F)}`)).blob();return new Promise((z,Q)=>{const se=new FileReader;se.onloadend=()=>z(se.result),se.onerror=Q,se.readAsDataURL(L)})}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(za))},[t]);const f=r||window.localStorage.getItem("refcode")||"",x=f?`https://app.dextrabot.com/referral/${f}`:"",g=t?`I’m market making #${t==null?void 0:t.coin} with Dextrabot on Hyperliquid HIP-3
Low risk. High XP.
Watch me farm the airdrop while everyone sleep.
Volume: $${((N=(C=t==null?void 0:t.bot_params)==null?void 0:C.volume)==null?void 0:N.toLocaleString("en-US"))||0}`:`I’m market making with Dextrabot on Hyperliquid HIP-3
Low risk. High XP.
Watch me farm the airdrop while everyone sleep.`,y=x||"https://app.dextrabot.com/market-maker",v=`https://x.com/intent/post?text=${encodeURIComponent(g)}&url=${encodeURIComponent(y)}`;return i.jsx(i.Fragment,{children:i.jsx(Wwn,{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:qj,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:["$",(I=t==null?void 0:t.bot_params)!=null&&I.volume?Ms((P=t==null?void 0:t.bot_params)==null?void 0:P.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||za,alt:"",className:"rounded-full w-8 h-8",onError:F=>Qi(F)}),(t==null?void 0:t.coin)||"--"]})]}),i.jsxs("div",{className:"bg-white/3 rounded-2xl p-3 border border-white/5",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-wide text-white/50",children:"Directional Bias"}),i.jsx("p",{className:"text-lg font-semibold text-white mt-1",children:((M=t==null?void 0:t.bot_params)==null?void 0:M.direction)||"--"})]})]})]}),i.jsxs("div",{className:"mt-4 flex items-center justify-between text-[11px] text-white/50",children:[i.jsx("span",{children:"Generated by Dextrabot"}),i.jsx("span",{children:new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]}),!t&&i.jsx("p",{className:"text-xs text-white/60 mt-4",children:"An unknown error has occurred."}),i.jsxs("div",{className:"mt-6 space-y-3",children:[i.jsx("button",{onClick:F=>{F.preventDefault(),o||u()},disabled:!t,className:`${o?"cursor-not-allowed":"cursor-pointer"} w-full border border-emerald-400/60 rounded-2xl py-3
text-emerald-300 font-semibold hover:bg-emerald-400/10
transition disabled:opacity-40 disabled:cursor-not-allowed`,children:"Download image"}),i.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:`w-full block text-center bg-white text-black
font-semibold rounded-2xl py-3 hover:bg-gray-100 transition`,children:"Share on X"})]})]})})})},Gwn=({data:t,setData:e,loading:n,error:r,fetchInfoOnOpen:s,isFilterWallet:a})=>{var rn,nt;h.useContext(Yr);const{isConnected:o,address:l}=es(),[c,u]=h.useState([]),[d,f]=h.useState(null),[x,g]=h.useState(!1);h.useState(!1);const[y,v]=h.useState(!1),[C,N]=h.useState(!1),[I,P]=h.useState({}),[M,F]=h.useState(!1),[$,L]=h.useState({id:"",walletAddress:"",isDeleted:!1}),[z,Q]=h.useState(!1),[se,ee]=h.useState(""),[K,re]=h.useState([]),[de,G]=h.useState([]),[ie,ae]=h.useState([]),[q,W]=h.useState(!1),[ne,oe]=h.useState(!1),[he,_e]=h.useState(!1),[xe,Se]=h.useState(!1),ge=h.useRef(null),Ce=h.useRef(null),je=h.useRef(null),Oe=h.useRef(null),[$e,Ye]=h.useState(!1),Je="tag",[ht,rt]=h.useState(Je),st=it=>{if(!y){let Ut=t;a&&(Ut=Ut==null?void 0:Ut.filter(nn=>String(nn==null?void 0:nn.wallet_id)===String(a)));const hn=Ut==null?void 0:Ut.filter(nn=>{var Vt,pt,We,It,Ge,ct,vt,Ht;if(K.length>0){const Rt=K.includes("HyperLiquid")&&(nn==null?void 0:nn.source_market)==="hyper",mn=K.includes("Lighter")&&(nn==null?void 0:nn.source_market)==="lighter";if(!Rt&&!mn)return!1}if(de.length>0){const Rt=de.includes("Short")&&((Vt=nn==null?void 0:nn.bot_params)==null?void 0:Vt.direction)==="SHORT",mn=de.includes("Neutral")&&((pt=nn==null?void 0:nn.bot_params)==null?void 0:pt.direction)==="NEUTRAL",un=de.includes("Long")&&((We=nn==null?void 0:nn.bot_params)==null?void 0:We.direction)==="LONG";if(!Rt&&!mn&&!un)return!1}if(ie.length>0){const Rt=ie.includes("Aggressive")&&((It=nn==null?void 0:nn.bot_params)==null?void 0:It.executionMode)==="AGGRESSIVE",mn=ie.includes("Normal")&&((Ge=nn==null?void 0:nn.bot_params)==null?void 0:Ge.executionMode)==="NORMAL",un=ie.includes("Passive")&&((ct=nn==null?void 0:nn.bot_params)==null?void 0:ct.executionMode)==="PASSIVE";if(!Rt&&!mn&&!un)return!1}return!($e&&(nn!=null&&nn.is_deleted)||se&&!((Ht=(vt=nn==null?void 0:nn.bot_params)==null?void 0:vt.coin)!=null&&Ht.toLowerCase().includes(se.toLowerCase())))});return hn==null?void 0:hn.sort((nn,Vt)=>{var Yn,Xn,zn,Kn,jn,De,pe,qe,Ae,ze,zt,kt,gt,Mt;const pt=((Xn=(Yn=nn==null?void 0:nn.bot_params)==null?void 0:Yn.coin)==null?void 0:Xn.toUpperCase())||"",We=((Kn=(zn=Vt==null?void 0:Vt.bot_params)==null?void 0:zn.coin)==null?void 0:Kn.toUpperCase())||"",It=(nn==null?void 0:nn.wallet_id)||0,Ge=(Vt==null?void 0:Vt.wallet_id)||0,ct=Number(((jn=nn==null?void 0:nn.bot_params)==null?void 0:jn.volume)||0),vt=Number(((De=Vt==null?void 0:Vt.bot_params)==null?void 0:De.volume)||0),Ht=Number(((pe=nn==null?void 0:nn.bot_params)==null?void 0:pe.volume)||0),Rt=Number(((qe=Vt==null?void 0:Vt.bot_params)==null?void 0:qe.volume)||0),mn=Number(((Ae=nn==null?void 0:nn.bot_params)==null?void 0:Ae.volume)||0),un=Number(((ze=Vt==null?void 0:Vt.bot_params)==null?void 0:ze.volume)||0),yn=Number(((zt=nn==null?void 0:nn.bot_params)==null?void 0:zt.leverage)||0),_n=Number(((kt=Vt==null?void 0:Vt.bot_params)==null?void 0:kt.leverage)||0),In=Number(((gt=nn==null?void 0:nn.bot_params)==null?void 0:gt.budget)||0),Sn=Number(((Mt=Vt==null?void 0:Vt.bot_params)==null?void 0:Mt.budget)||0);return it==="coin"?pt<We?-1:pt>We?1:0:it==="-coin"?pt>We?-1:pt<We?1:0:it==="account"?It>Ge?-1:It<Ge?1:0:it==="-account"?It<Ge?-1:It>Ge?1:0:it==="volume"?ct-vt:it==="-volume"?vt-ct:it==="order"?Ht-Rt:it==="-order"?Rt-Ht:it==="perOrder"?mn-un:it==="-perOrder"?un-mn:it==="leverage"?yn-_n:it==="-leverage"?_n-yn:it==="budget"?In-Sn:it==="-budget"?Sn-In:0})}return t},He=h.useRef(null),Ve=["Short","Neutral","Long"],bt=["Aggressive","Normal","Passive"],xt=it=>{G(Ut=>Ut.includes(it)?Ut.filter(hn=>hn!==it):[...Ut,it])},Qt=it=>{ae(Ut=>Ut.includes(it)?Ut.filter(hn=>hn!==it):[...Ut,it])};h.useEffect(()=>{function it(Ut){ge.current&&!ge.current.contains(Ut.target)&&oe(!1),Ce.current&&!Ce.current.contains(Ut.target)&&_e(!1),Oe.current&&!Oe.current.contains(Ut.target)&&Se(!1),je.current&&!je.current.contains(Ut.target)&&W(!1)}return document.addEventListener("mousedown",it),()=>document.removeEventListener("mousedown",it)},[]);const St=async({id:it,walletAddress:Ut,isDeleted:hn})=>{try{const nn=window.localStorage.getItem("hyperToken"),Vt=window.localStorage.getItem("hyperAddress");if(!nn||!Vt||!it){dn.error("Something went wrong!");return}Q(!0),Ut&&P(ct=>({...ct,[Ut]:!0}));const pt="https://dextrabothypev2.nftinit.io/api/hyper/mmbot/update/",We={is_deleted:!hn},Ge=await(await fetch(pt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l?l.toLowerCase():Vt,token:nn,bot_id:Number(it),update_params:We})})).json();Ge.success?(e((Ge==null?void 0:Ge.data)||[]),dn.success("Action completed successfully.")):dn.error(Ge.error_message),F(!1)}catch{dn.error("Something went wrong")}finally{Q(!1),P(nn=>({...nn,[Ut]:!1}))}},on=async()=>{try{const it=window.localStorage.getItem("hyperToken"),Ut=window.localStorage.getItem("hyperAddress");if(!it||!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:it})})).json();Vt.success&&u((Vt==null?void 0:Vt.data)||[])}catch(it){dn.error(it.message||"Something went wrong")}finally{}};h.useEffect(()=>{on();const it=setInterval(()=>{on()},15e3);return()=>clearInterval(it)},[t]);const cn=h.useMemo(()=>{const it={};return c==null||c.forEach(Ut=>{Ut!=null&&Ut.id&&(it[Ut.id]=Ut.bot_params)}),it},[c]);h.useEffect(()=>{const it=localStorage.getItem("hyperToken"),Ut=localStorage.getItem("hyperAddress");N(!!(it&&Ut));const hn=setInterval(()=>{const nn=localStorage.getItem("hyperToken"),Vt=localStorage.getItem("hyperAddress");N(!!(nn&&Vt))},800);return()=>clearInterval(hn)},[]);const Vn={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]"}},tn=()=>i.jsx(Jg,{className:"w-4 h-4 text-yellow-400"}),fn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs(i.Fragment,{children:[i.jsx(uKe,{open:M,setOpen:F,makerStatus:St,isStatusWallet:$,info:"table",modalLoading:z}),i.jsx(qwn,{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:()=>Ye(!$e),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 ${$e?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} rounded`,children:$e&&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:ht,setSortOption:rt,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>W(!q),className:`${se?"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 ${se?"text-blue-500":"text-white"}`})}),q&&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:()=>ee(""),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:se,onChange:it=>ee(it.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:ht,setSortOption:rt,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:ht,setSortOption:rt,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:ht,setSortOption:rt,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:()=>_e(!he),className:`${de.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 ${de.length>0?"text-blue-500":"text-white"}`})}),he&&i.jsxs("div",{ref:Ce,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"})})]}),Ve==null?void 0:Ve.map(it=>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:de.includes(it),onChange:()=>xt(it),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 ${de.includes(it)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:de.includes(it)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),it]},it))]})]})]})}),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:()=>Se(!xe),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"}`})}),xe&&i.jsxs("div",{ref:Oe,className:`absolute left-[58px] mt-44 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>ae(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),bt==null?void 0:bt.map(it=>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(it),onChange:()=>Qt(it),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(it)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:ie.includes(it)&&i.jsx("img",{src:Ec,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),it]},it))]})]})]})}),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(Ba,{})})})}):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(_l,{})})})}):((rn=st(ht))==null?void 0:rn.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:Kl,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."})})]})})})})}):(nt=st(ht))==null?void 0:nt.map((it,Ut)=>{var Ht,Rt,mn,un,yn,_n,In,Sn,Yn,Xn,zn,Kn,jn,De;const hn=!!(it!=null&&it.is_deleted),nn=hn?"bg-[#3c1518]/70 border-[#ff6b6b]/60 text-[#ffd4d1] hover:bg-[#571f24]/80":"bg-[#123424]/70 border-[#2bd27c]/50 text-[#9cf7cb] hover:bg-[#185134]/80",Vt=cn[it==null?void 0:it.id]||{},pt=(Vt==null?void 0:Vt.status)||(it!=null&&it.is_deleted?"completed":"started"),We=Vn[pt],It=pt==="completed",Ge=It?"↻":hn?"▶":"⏹",ct=Vt!=null&&Vt.volume_usd?Vt.current_volume/Vt.volume_usd*100:0,vt=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 ${hn?"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/${it==null?void 0:it.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/${fn[(Ht=it==null?void 0:it.bot_params)==null?void 0:Ht.coin]||((mn=(Rt=it==null?void 0:it.bot_params)==null?void 0:Rt.coin)==null?void 0:mn.split("/")[0])}.svg`||za,alt:(un=it==null?void 0:it.bot_params)==null?void 0:un.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:pe=>Qi(pe)})}),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 zt;const pe=((zt=it==null?void 0:it.bot_params)==null?void 0:zt.coin)||"",qe=pe.includes(":"),Ae=qe?pe.split(":")[1]:pe,ze=qe?pe.split(":")[0]:null;return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:Ae}),ze&&i.jsx("span",{className:"text-[8px] bg-[#233] text-[#67FFBD] px-1 py-[0.5px] rounded-md w-fit mt-[1px]",children:ze})]})})()})})]})})})}),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:(it==null?void 0:it.source_market)==="lighter"?i.jsx(Us,{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:it==null?void 0:it.wm_name})]})}):(it==null?void 0:it.source_market)==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(Us,{content:"Hyperliquid",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:P1,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:it==null?void 0:it.wm_name})]})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(Us,{content:"Dextrabot",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:Ki,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:it==null?void 0:it.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(na,{info1:(yn=it==null?void 0:it.bot_params)!=null&&yn.leverage?`${(_n=it==null?void 0:it.bot_params)==null?void 0:_n.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(na,{info1:(In=it==null?void 0:it.bot_params)!=null&&In.volume?`$${(Yn=(Sn=it==null?void 0:it.bot_params)==null?void 0:Sn.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(na,{info1:(Xn=it==null?void 0:it.bot_params)!=null&&Xn.budget?`$${(Kn=(zn=it==null?void 0:it.bot_params)==null?void 0:zn.budget)==null?void 0:Kn.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(na,{info1:(jn=it==null?void 0:it.bot_params)==null?void 0:jn.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(na,{info1:(De=it==null?void 0:it.bot_params)==null?void 0:De.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:vt>=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:`${vt||0}%`,backgroundColor:vt>=100?"#3ec78c":"#d68b38"}}),i.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-bold",style:{color:vt>=100?"#d0ffd9":"#ffcb8a"},children:[vt?vt.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(na,{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:I[it.wallet_address]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{L({id:Number(it==null?void 0:it.id),walletAddress:it==null?void 0:it.wm_address,isDeleted:It?!0:it==null?void 0:it.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 ${It?"bg-[#2d2d2d] border-[#444]":nn}`,title:Ge,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:It?i.jsx(tn,{}):i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:Ge})})})})}),i.jsx("td",{className:`${Ut%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222] pr-4`,children:i.jsx("div",{onClick:()=>{f(it),g(!0)},className:"pl-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx(Brt,{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:Kl,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."})})]})})})})})})]})})})]})]})},Kwn="https://dextrabothypev2.nftinit.io",Ywn=()=>{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(`${Kwn}/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(OT,{className:"w-4 h-4 text-white"})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]}),i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/market-maker-bot/hyperliquid-market-maker-bot","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})]})}),i.jsxs(ho.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(Vwn,{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(Gwn,{data:n,setData:r,loading:t,error:s,fetchInfoOnOpen:c,isFilterWallet:o})})})]})]})},sO="#67FFBD",Xwn=({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(ho.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(Ba,{})]}):i.jsxs("div",{className:"relative h-full w-full flex justify-center items-center overflow-hidden rounded-[16px] bg-black",children:[i.jsx(ho.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(ho.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:Cj,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},Cj)]}),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:sO},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:sO},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:sO},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:sO},children:a})]})]})]})]})})},Qwn=()=>{const{setSignModalOpen:t}=h.useContext(Yr);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"})})]})]})})]})},Zwn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c,setSignModalOpen:u}=h.useContext(Yr),[d,f]=h.useState(!1),[x,g]=h.useState(!1),[y,v]=h.useState(""),[C,N]=h.useState(!1),[I,P]=h.useState(""),[M,F]=h.useState(!1);h.useEffect(()=>{const L=localStorage.getItem("hyperToken"),z=localStorage.getItem("hyperAddress");f(!!(L&&z));const Q=setInterval(()=>{const se=localStorage.getItem("hyperToken"),ee=localStorage.getItem("hyperAddress");f(!!(se&&ee))},800);return()=>clearInterval(Q)},[]),h.useEffect(()=>{(async()=>{var se,ee;const z=window.localStorage.getItem("hyperToken"),Q=window.localStorage.getItem("hyperAddress");if(!(!z||!Q))try{F(!0);const K=await vi(Q.toLowerCase(),z);K!=null&&K.success?(t(K==null?void 0:K.telegram_chat_id),e(K==null?void 0:K.subscriber_role),n((se=K==null?void 0:K.mushboomer_counts)==null?void 0:se.eth),s((ee=K==null?void 0:K.mushboomer_counts)==null?void 0:ee.sol),a(K==null?void 0:K.referral_code),o(K==null?void 0:K.refcode),r(K==null?void 0:K.whitelist),g(K==null?void 0:K.mm_hyper_alpha_code),F(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""),F(!1))}catch(K){console.error("Token verification error:",K),F(!1)}})()},[d]);const $=async()=>{var Q,se,ee,K;const L=window.localStorage.getItem("hyperToken"),z=window.localStorage.getItem("hyperAddress");if(!y.trim()){dn.error("Please enter your alpha code");return}if(!L||!z){u(!0);return}N(!0),P("");try{const re={address:z==null?void 0:z.toLowerCase(),token:L,alpha_code:y.trim(),source_market:"hyper",app_type:"mm_bot"},G=(await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",re)).data||{};if(G.success){const ie=G.message||"Alpha code added successfully";dn.success(`${ie}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),P(ie),g(!0)}else{const ie=G.error_message||G.message||"This alpha code is invalid";dn.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"}}),P(ie)}}catch(re){const de=((se=(Q=re==null?void 0:re.response)==null?void 0:Q.data)==null?void 0:se.error_message)||((K=(ee=re==null?void 0:re.response)==null?void 0:ee.data)==null?void 0:K.message)||re.message||"Failed to validate alpha code";dn.success(`${de}.`,{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"}}),P(de)}finally{N(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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(Ywn,{}):i.jsx(Xwn,{code:y,onCodeChange:v,onSubmit:$,loading:C,loadingCheckAccount:M,message:I}):i.jsx(Qwn,{})})})]})},Jwn=({data:t,refreshAgent:e,loadingCheckAccount:n,slotCount:r})=>{var G,ie,ae;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(GLe,{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:I_e},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"],N=(t==null?void 0:t.slots_info)||{},I=Object.fromEntries(Object.entries(N).filter(([q])=>!C.includes(q))),P=Object.values(I).reduce((q,W)=>q+W.total_qty,0),M=Object.values(I).reduce((q,W)=>q+W.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),$=((ae=t==null?void 0:t.copy_trade_slots_info)==null?void 0:ae.using_slot_count)||0,L=((t==null?void 0:t.bot_slots_info)||[]).find(q=>String((q==null?void 0:q.bot_type)||"").toLowerCase()==="grid_bot"&&String((q==null?void 0:q.source_market)||"").toLowerCase()==="lighter")||{},z=(L==null?void 0:L.total_slot_count)||0,Q=(L==null?void 0:L.using_subs_slot_count)||0,se=(L==null?void 0:L.using_extra_slot_count)||0,ee=Q+se,K=ee+z,re=()=>{navigator.clipboard.writeText(`https://app.dextrabot.com/referral/${t.refcode}`),o(!0),setTimeout(()=>o(!1),2e3)},de=!!window.localStorage.getItem("hyperToken");return i.jsxs(i.Fragment,{children:[l&&_a.createPortal(i.jsx(aue,{open:l,setOpen:c,oldSlotCount:f,checkAccountTrade:n,tradeMarket:"copyTrade"}),document.body),u&&_a.createPortal(i.jsx(M5,{open:u,setOpen:d,oldSlotCount:ee,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:qj,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(Jg,{className:"w-4 h-4 text-[#929292] hover:text-white"})})]}),de?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(R7,{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(R7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"px-3 py-1 bg-orange-500/10 rounded-lg text-orange-400 text-sm font-medium -mt-2.5",children:[$,"/",F," Active"]})]}),i.jsxs("div",{className:`flex items-center justify-between py-3 px-4 rounded-xl
bg-white/[0.02] hover:bg-white/[0.04] transition-colors
border border-white/5`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"h-5 flex items-center justify-center",children:v.lighter.src}),i.jsx("span",{className:"font-medium text-white/80",children:v.lighter.name})]}),i.jsxs("div",{className:"flex justify-end items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2 h-2 rounded-full ${$>0?"bg-green-400 shadow-green-400/50 shadow-sm":"bg-white/20"}`}),i.jsx("span",{className:$>0?"text-green-400 font-semibold":"text-white/40",children:$}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:F})]}),i.jsx("div",{className:"w-24 h-1.5 bg-white/5 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-gradient-to-r from-orange-500 to-red-500 rounded-full transition-all",style:{width:`${F>0?$/F*100:0}%`}})})]})]}),i.jsx("div",{className:"flex justify-end items-center w-full mt-4",children:i.jsx("button",{onClick:()=>{x(r),c(!0)},className:"px-4 py-1.5 rounded-lg text-sm font-semibold bg-gradient-to-r from-orange-500 to-red-500 text-white shadow-[0_0_12px_rgba(255,100,0,0.4)]hover:shadow-[0_0_18px_rgba(255,120,0,0.6)] transition-all",children:"Get More Slots"})})]}),i.jsxs("div",{className:`${K===0?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 relative overflow-hidden w-full`,children:[i.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-orange-500/10 to-transparent rounded-bl-full"}),i.jsxs("div",{className:"flex justify-between items-center mb-2.5 gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Grid Bot Slots"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(R7,{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:[ee,"/",K," Active"]})]}),i.jsxs("div",{className:`flex items-center justify-between py-3 px-4 rounded-xl
bg-white/[0.02] hover:bg-white/[0.04] transition-colors
border border-white/5`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"h-5 flex items-center justify-center",children:v.lighter.src}),i.jsx("span",{className:"font-medium text-white/80",children:"Lighter"})]}),i.jsxs("div",{className:"flex justify-end items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2 h-2 rounded-full ${ee>0?"bg-green-400 shadow-green-400/50 shadow-sm":"bg-white/20"}`}),i.jsx("span",{className:ee>0?"text-green-400 font-semibold":"text-white/40",children:ee}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:K})]}),i.jsx("div",{className:"w-24 h-1.5 bg-white/5 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-gradient-to-r from-orange-500 to-red-500 rounded-full transition-all",style:{width:`${K>0?ee/K*100:0}%`}})})]})]}),i.jsx("div",{className:"flex justify-end items-center w-full mt-4",children:i.jsx("button",{onClick:()=>{d(!0)},className:"px-4 py-1.5 rounded-lg text-sm font-semibold bg-gradient-to-r from-orange-500 to-red-500 text-white shadow-[0_0_12px_rgba(255,100,0,0.4)]hover:shadow-[0_0_18px_rgba(255,120,0,0.6)] transition-all",children:"Get More Slots"})})]}),i.jsxs("div",{className:`${Object.keys((t==null?void 0:t.slots_info)||{}).length===0?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 w-full`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Slots Overview"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(R7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"px-3 py-1 bg-orange-500/10 rounded-lg text-orange-400 text-sm font-medium",children:[M,"/",P," Active"]})]}),i.jsx("div",{className:"space-y-2",children:Object.entries(I).filter(([q])=>!C.includes(q)).map(([q,W])=>{var ne,oe,he;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:`${q==="apex"?"h-6":q==="basedapp"?"h-3.5":q==="pacifica"?"h-5":q==="variational"?"h-3":"h-3.5"} flex items-center justify-center`,children:[((ne=y[q])==null?void 0:ne.type)==="img"&&i.jsx("img",{src:y[q].src,alt:y[q].name,className:"w-full h-full"}),((oe=y[q])==null?void 0:oe.type)==="component"&&y[q].component]}),q==="lighter"&&i.jsx("span",{className:"font-medium text-white/80 -ml-3",children:((he=y[q])==null?void 0:he.name)||q})]}),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 ${W.active_qty>0?"bg-green-400 shadow-lg shadow-green-400/50":"bg-white/20"}`}),i.jsx("span",{className:W.active_qty>0?"text-green-400 font-semibold":"text-white/40",children:W.active_qty}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:W.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:`${W.active_qty/W.total_qty*100}%`}})})]})]},q)})})]}),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(R7,{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:re,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."})]})]})},e3n=()=>{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(Yr),{address:f}=es(),[x,g]=h.useState(1),[y,v]=h.useState({}),[C,N]=h.useState(""),[I,P]=h.useState(""),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState(""),[se,ee]=h.useState(0),[K,re]=h.useState(0),[de,G]=h.useState(!1),[ie,ae]=h.useState(0),[q,W]=h.useState(!1),ne=ht=>/^\d*$/.test(ht),oe=ht=>{["e","E","+","-"].includes(ht.key)&&ht.preventDefault()},he=h.useMemo(()=>{if(x==="")return!1;const ht=Number(x);return Number.isInteger(ht)&&ht>=1},[x]),Se=(ht=>{const[rt,st]=ht.split(" "),[He,Ve,bt]=rt.split("-").map(Number),[xt,Qt]=st.split(":").map(Number);return new Date(Date.UTC(bt,Ve-1,He,xt-3,Qt))})("29-11-2025 23:59");h.useState(()=>new Date().getTime()>=Se.getTime());const ge=h.useRef(se);h.useEffect(()=>{ge.current=se},[se]);const Ce=h.useRef(0);h.useEffect(()=>{Ce.current=K},[K]);const je=async()=>{var st,He,Ve;const ht=window.localStorage.getItem("hyperToken"),rt=window.localStorage.getItem("hyperAddress");if(!(!ht||!rt))try{W(!0);const bt=await vi(rt.toLowerCase(),ht);bt!=null&&bt.success?(e(bt==null?void 0:bt.telegram_chat_id),n(bt==null?void 0:bt.subscriber_role),r(bt==null?void 0:bt.subs_expire_day),s((st=bt==null?void 0:bt.mushboomer_counts)==null?void 0:st.eth),a((He=bt==null?void 0:bt.mushboomer_counts)==null?void 0:He.sol),o(bt==null?void 0:bt.referral_code),l(bt==null?void 0:bt.refcode),c(bt==null?void 0:bt.whitelist),u(ht),d(rt),N(bt==null?void 0:bt.farming_tools),ee(Number((bt==null?void 0:bt.subs_expire_day)||0)),v(bt),W(!1),ae(((Ve=bt==null?void 0:bt.copy_trade_slots_info)==null?void 0:Ve.extra_slot_count)||0)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),W(!1))}catch(bt){console.error("Token verification error:",bt),console.error(bt.message||"An unknown error occurred."),W(!1)}};h.useEffect(()=>{de&&je()},[de]),h.useEffect(()=>{const ht=localStorage.getItem("hyperToken"),rt=localStorage.getItem("hyperAddress");G(!!(ht&&rt));const st=setInterval(()=>{const He=localStorage.getItem("hyperToken"),Ve=localStorage.getItem("hyperAddress");G(!!(He&&Ve))},800);return()=>clearInterval(st)},[]);const Oe=async()=>new kl(window.ethereum).eth.getAccounts(rt=>rt),$e=async(ht="subscribe",rt=24,st=5e3)=>{rt<=0||(await new Promise(He=>setTimeout(He,st)),await je(),ht==="subscribe"&&ge.current===Ce.current?$e(ht,rt-1,st):je())},Ye=async ht=>{const rt=window.localStorage.getItem("hyperToken"),st=window.localStorage.getItem("hyperAddress");if(!rt||!f){t(!0);return}P(""),re(ge.current),Ce.current=ge.current,L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(bt){console.error("Failed to switch network",bt),F(!1);return}const He=new kl(window.ethereum);var Ve=await Oe();if(Ve.length>0?Ve=Ve[0]:Ve=void 0,Ve){const xt=ht*.12,Qt=He.utils.toWei(xt.toString(),"ether"),St={from:Ve,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Qt};await He.eth.sendTransaction(St).then(on=>{console.log("txHash :>> ",on),F(!1),Q(on.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():st,token:rt,payment_tx:on.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),je(),$e("subscribe")}).catch(on=>{console.log(on),on.code===-32003||on.message.includes("insufficient funds")?P("Insufficient funds."):on.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await He.eth.requestAccounts()},Je=()=>{je()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(_d,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:!(se<=K),errorFunds:I,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(Jwn,{data:y,refreshAgent:Je,loadingCheckAccount:q,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:oB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},oB)}),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(ht=>{const rt=Number(ht||0);return rt>1?String(rt-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:ht=>{const rt=ht.target.value.trim();if(rt==="")return g("");ne(rt)&&g(rt)},onKeyDown:oe,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] font-semibold outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>g(ht=>{const rt=Number(ht||0);return String(rt+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!==""&&!he&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),he&&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:ht=>{ht.preventDefault(),he&&Ye(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${he?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})})]})]})},t3n=()=>{es();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=h.useContext(Yr);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 vi(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(Ga,{children:i.jsxs(no,{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(e3n,{})})})]})},n3n="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",o8e=[{label:"1h",multiplier:1},{label:"8h",multiplier:8},{label:"1d",multiplier:24},{label:"1w",multiplier:168},{label:"1m",multiplier:720},{label:"3m",multiplier:2160},{label:"1y",multiplier:8760}],dg=[{id:"extended",name:"Extended",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{id:"variational",name:"Variational",iconType:"variational"},{id:"lighter",name:"Lighter",iconType:"lighter"},{id:"hyperliquid",name:"Hyperliquid",iconType:"hyperliquid"},{id:"aster",name:"Aster",iconType:"aster"},{id:"paradex",name:"Paradex",iconType:"paradex"}],l8e={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},c8e=(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},u8e=({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:uT,alt:t.name,className:`${e} rounded`});case"lighter":return i.jsx(yf,{className:e});case"hyperliquid":return i.jsx("img",{src:bae,alt:t.name,className:e});case"aster":return i.jsx(Uj,{className:e});case"paradex":return i.jsx("img",{src:dT,alt:t.name,className:`${e} rounded`});default:return null}},r3n=()=>{const t=Ao(),[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 ae=JSON.parse(G).filter(q=>dg.some(W=>W.id===q));return ae.length>0?ae:dg.map(q=>q.id)}catch{return dg.map(ie=>ie.id)}return dg.map(ie=>ie.id)}),[N,I]=h.useState(!1),P=h.useRef(!0),M=h.useRef(null);h.useEffect(()=>{localStorage.setItem("fundingSelectedExchanges",JSON.stringify(v))},[v]);const F=(G,ie,ae)=>{const q=l8e[ie],W=l8e[ae];q&&W&&t(`/funding-history/${q}-${W}-${G.toLowerCase()}`)};h.useEffect(()=>{const G=async()=>{try{const q=await(await fetch(n3n)).json();q.success&&Array.isArray(q.data)?(n(q.data),x(q.updated_at),o(null)):P.current&&o("Failed to fetch data")}catch(ae){P.current&&o(ae.message||"Failed to fetch data")}finally{P.current&&(s(!1),P.current=!1)}};G();const ie=setInterval(G,5e3);return()=>clearInterval(ie)},[]),h.useEffect(()=>{const G=ie=>{M.current&&!M.current.contains(ie.target)&&I(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[]);const $=G=>{C(ie=>ie.includes(G)?ie.length===1?ie:ie.filter(ae=>ae!==G):[...ie,G])},L=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})},z=h.useMemo(()=>{let G=e;if(l.trim()){const ie=l.toLowerCase();G=e.filter(ae=>ae.ticker.toLowerCase().includes(ie))}return G=G.filter(ie=>v.some(ae=>{var q,W;return(W=(q=ie.marketplaces)==null?void 0:q[ae])==null?void 0:W.available})),u.key&&(G=[...G].sort((ie,ae)=>{var ne,oe,he,_e;let q,W;if(u.key==="ticker")return q=ie.ticker,W=ae.ticker,u.direction==="asc"?q.localeCompare(W):W.localeCompare(q);if(u.key==="best_arb_apr")q=c8e(ie,v),W=c8e(ae,v);else if(u.key.startsWith("mp_")){const xe=u.key.replace("mp_","");q=parseFloat((oe=(ne=ie.marketplaces)==null?void 0:ne[xe])==null?void 0:oe.hourly_rate)||0,W=parseFloat((_e=(he=ae.marketplaces)==null?void 0:he[xe])==null?void 0:_e.hourly_rate)||0}else q=parseFloat(ie[u.key])||0,W=parseFloat(ae[u.key])||0;return u.direction==="asc"?q-W:W-q})),G},[e,l,u,v]),Q=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"})},se=G=>{if(u.key===G){if(u.direction==="asc")return i.jsx(i2,{className:"inline ml-1 text-[#67FFBD]"});if(u.direction==="desc")return i.jsx(s2,{className:"inline ml-1 text-[#67FFBD]"})}return i.jsx(a2,{className:"inline ml-1 text-gray-500"})},ee=G=>G>=0?"text-[#4ade80]":"text-[#f87171]",K=()=>{const G=o8e.find(ie=>ie.label===g);return G?G.multiplier:1},re=G=>{const ie=v.filter(ge=>{var Ce,je;return(je=(Ce=G.marketplaces)==null?void 0:Ce[ge])==null?void 0:je.available});if(ie.length<2)return null;let ae=1/0,q=-1/0,W=null,ne=null;for(const ge of ie){const Ce=parseFloat(G.marketplaces[ge].hourly_rate)||0;Ce<ae&&(ae=Ce,W=ge),Ce>q&&(q=Ce,ne=ge)}const oe=(q-ae)*8760*100;if(oe<=0||W===ne)return null;let he;oe>=100?he=`${oe.toFixed(2)}%`:oe>=1?he=`${oe.toFixed(2)}%`:he=`${oe.toFixed(4)}%`;const _e=dg.find(ge=>ge.id===W),xe=dg.find(ge=>ge.id===ne),Se=`${(xe==null?void 0:xe.name.toLowerCase())||ne}/${(_e==null?void 0:_e.name.toLowerCase())||W}`;return{apr:oe,apr_fmt:he,long_mp:W,short_mp:ne,long_rate:G.marketplaces[W].hourly_rate,short_rate:G.marketplaces[ne].hourly_rate,pair:Se}},de=G=>{const ie=K(),q=(parseFloat(G)||0)*ie*100;return Math.abs(q)>=100?`${q.toFixed(0)}%`:Math.abs(q)>=1?`${q.toFixed(2)}%`:`${q.toFixed(4)}%`};return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{children:[i.jsx("title",{children:"Funding Rates Arbitrage - Dextrabot"}),i.jsx("meta",{name:"description",content:"Compare funding rates across exchanges to discover delta neutral arbitrage opportunities."})]})}),i.jsxs("div",{className:"flex flex-col w-full h-[calc(100vh-5rem)] bg-[#0a0a0a]",children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h1",{className:"text-lg font-semibold text-white tracking-wide",children:"Funding Rates Arbitrage"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"Compare funding rates across exchanges to discover delta neutral arbitrage opportunities."})]}),i.jsx("div",{className:"flex items-center gap-4",children:!r&&!a&&e.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),i.jsx("span",{className:"text-gray-400 text-[10px] uppercase tracking-widest",children:"Live"})]}),f&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-px h-3 bg-neutral-700"}),i.jsxs("span",{className:"text-gray-400 text-[10px]",children:["Updated ",L(f)]})]})]})})]}),i.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:i.jsx(UVe,{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(Cde,{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:o8e.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:[z.length," of ",e.length," markets"]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsxs("div",{className:"relative",ref:M,children:[i.jsxs("button",{onClick:()=>I(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-neutral-900 border border-neutral-700 text-gray-300 hover:border-neutral-600 transition-colors",children:[i.jsxs("span",{className:"text-xs",children:["Exchanges (",v.length,")"]}),i.jsx(W9,{className:`w-3.5 h-3.5 transition-transform ${N?"rotate-180":""}`})]}),N&&i.jsx("div",{className:"absolute right-0 mt-1 w-56 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 p-2",children:dg.map(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(u8e,{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:()=>Q("ticker"),children:["Market ",se("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:()=>Q("best_arb_apr"),children:["Best Arb APR ",se("best_arb_apr")]}),dg.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:()=>Q(`mp_${G.id}`),children:i.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[i.jsx(u8e,{exchange:G,className:"w-3.5 h-3.5"}),i.jsx("span",{children:G.name}),se(`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((ae,q)=>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"})},q))},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})}):z.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:3+v.length,className:"px-6 py-12 text-center text-gray-500 text-xs",children:"No results found"})}):z.map(G=>{const ie=re(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:ae=>{ae.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:ae=>{ae.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(tun,{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})]})}),dg.filter(ae=>v.includes(ae.id)).map(ae=>{var Se;const q=(Se=G.marketplaces)==null?void 0:Se[ae.id],W=q==null?void 0:q.available,ne=q==null?void 0:q.hourly_rate,oe=parseFloat(ne)||0,he=ie.long_mp===ae.id,_e=ie.short_mp===ae.id,xe=he||_e;return i.jsx("td",{className:"px-2 py-2 w-[180px] min-w-[180px]",children:W?i.jsxs("div",{className:`flex flex-col items-center py-1.5 px-2 rounded ${xe?_e?"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 ${ee(oe)}`,children:de(ne)}),i.jsx("div",{className:"h-4 flex items-center",children:xe&&i.jsx("span",{className:`text-[9px] font-bold tracking-wide ${_e?"text-red-400":"text-emerald-400"}`,children:_e?"SHORT":"LONG"})})]}):i.jsxs("div",{className:"flex flex-col items-center py-1.5 px-2",children:[i.jsx("span",{className:"text-neutral-600 text-xs",children:"—"}),i.jsx("div",{className:"h-4"})]})},ae.id)})]},G.ticker)})})]})})]})]})};function Za(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 I3(t,e){return t.width===e.width&&t.height===e.height}var s3n=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 i3n(t){return new s3n(t)}var a3n=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=Za({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 Za({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=Za(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;I3(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=Za(this._transformBitmapSize(e,this._canvasElementClientSize)),s=I3(this.bitmapSize,r)?null:r;n===null&&s===null||n!==null&&s!==null&&I3(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}l3n().then(function(n){return n?e._initResizeObserver():e._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var n=d8e(this._canvasElement);if(n===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=i3n(n),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var e,n;if(this._canvasElement!==null){var r=d8e(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?c3n(a[0],s):Za({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=Za({width:s.inlineSize,height:s.blockSize});e._suggestNewBitmapSize(a)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function o3n(t,e){if(e.type==="device-pixel-content-box")return new a3n(t,e.transform,e.options);throw new Error("Unsupported binding target")}function d8e(t){return t.ownerDocument.defaultView}function l3n(){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 c3n(t,e){return Za({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 u3n=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 b5(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 u3n(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 dKe={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 f8e,h8e;function Nj(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 fKe(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 Jr(t){if(t===null)throw new Error("Value is null");return t}function Fy(t){return Jr(vf(t))}(function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"})(f8e||(f8e={})),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"}(h8e||(h8e={}));class El{constructor(){this.t=[]}i(e,n,r){const s={h:e,l:n,o:r===!0};this.t.push(s)}_(e){const n=this.t.findIndex(r=>e===r.h);n>-1&&this.t.splice(n,1)}u(e){this.t=this.t.filter(n=>n.l!==e)}p(e,n,r){const s=[...this.t];this.t=this.t.filter(a=>!a.o),s.forEach(a=>a.h(e,n,r))}v(){return this.t.length>0}m(){this.t=[]}}function nh(t,...e){for(const n of e)for(const r in n)n[r]!==void 0&&Object.prototype.hasOwnProperty.call(n,r)&&!["__proto__","constructor","prototype"].includes(r)&&(typeof n[r]!="object"||t[r]===void 0||Array.isArray(n[r])?t[r]=n[r]:nh(t[r],n[r]));return t}function jj(t){return typeof t=="number"&&isFinite(t)}function Fk(t){return typeof t=="number"&&t%1==0}function hI(t){return typeof t=="string"}function iO(t){return typeof t=="boolean"}function Yg(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"?Yg(s):s);return n}function d3n(t){return t!==null}function Vse(t){return t===null?void 0:t}const hKe="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function lB(t,e,n){return e===void 0&&(e=hKe),`${n=n!==void 0?`${n} `:""}${t}px ${e}`}class f3n{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=lB(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 hZ(t){return t<0?0:t>255?255:Math.round(t)||0}function p8e(t){return .199*t[0]+.687*t[1]+.114*t[2]}class h3n{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:p8e(n)>160?"black":"white"}}J(e){return p8e(this.K(e))}tt(e,n,r){const[s,a,o,l]=this.K(e),[c,u,d,f]=this.K(n),x=[hZ(s+r*(c-s)),hZ(a+r*(u-a)),hZ(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 p3n{constructor(){this.it=[]}st(e){this.it=e}nt(e,n,r){this.it.forEach(s=>{s.nt(e,n,r)})}}class X5{nt(e,n,r){e.useBitmapCoordinateSpace(s=>this.et(s,n,r))}}class m3n extends X5{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 x3n(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}const g3n={from:0,to:1};class b3n{constructor(e,n,r){this.Mt=new p3n,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(x3n),this.bt=this.St.map(n=>{const r=new m3n;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=g3n):l.lt=null})}}class y3n extends X5{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,Nj(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,Nj(e,this.Yt.Kt.Xt),fKe(e,c,0,n.width))}}class v3n{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 y3n(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 Pz(t,e,n,r,s,a){t.save(),t.globalCompositeOperation="copy",t.fillStyle=a,t.fillRect(e,n,r,s),t.restore()}function m8e(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 x8e(t,e,n,r,s,a,o=0,l=[0,0,0,0],c=""){if(t.save(),!o||!c||c===a)return m8e(t,e,n,r,s,l),t.fillStyle=a,t.fill(),void t.restore();const u=o/2;var d;m8e(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 pKe(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 g8e{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?x8e(u,f.oi,f._i,f.ui,f.ci,o,f.di,[f.ft,0,0,f.ft],o):x8e(u,f.fi,f._i,f.ui,f.ci,o,f.di,[0,f.ft,f.ft,0],o),this.Yt.pi&&(u.fillStyle=a,u.fillRect(f.fi,f.mi,f.wi-f.fi,f.gi)),this.Yt.Mi&&(u.fillStyle=n.D,u.fillRect(d.li?f.bi-f.di:0,f._i,f.di,f.Si-f._i)),d});e.useMediaCoordinateSpace(({context:c})=>{const u=l.xi;c.font=n.P,c.textAlign=l.li?"right":"left",c.textBaseline="middle",c.fillStyle=a,c.fillText(this.Yt.ri,u.Ci,(u._i+u.Si)/2+u.yi)})}hi(e,n,r,s){const{context:a,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,d=this.Yt.pi||!this.Yt.ki?n.C:0,f=this.Yt.Pi?n.S:0,x=n.A+this.ei.Ti,g=n.V+this.ei.Ri,y=n.I,v=n.B,C=this.Yt.ri,N=n.k,I=r.Di(a,C),P=Math.ceil(r.Vi(a,C)),M=N+x+g,F=n.S+y+v+P+d,$=Math.max(1,Math.floor(u));let L=Math.round(M*u);L%2!=$%2&&(L+=1);const z=f>0?Math.max(1,Math.floor(f*c)):0,Q=Math.round(F*c),se=Math.round(d*c),ee=this.ei.Ii??this.ei.Bi,K=Math.round(ee*u)-Math.floor(.5*u),re=Math.floor(K+$/2-L/2),de=re+L,G=s==="right",ie=G?l.width-f:f,ae=G?o.width-z:z;let q,W,ne;return G?(q=ae-Q,W=ae-se,ne=ie-d-y-f):(q=ae+Q,W=ae+se,ne=ie+d+y),{li:G,ai:{_i:re,mi:K,Si:de,ui:Q,ci:L,ft:2*c,di:z,oi:q,fi:ae,wi:W,gi:$,bi:o.width},xi:{_i:re/u,Si:de/u,Ci:ne,yi:I}}}}class Fz{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||g8e)(this.Ei,this.Ai),this.Oi=new(e||g8e)(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 w3n extends Fz{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 C3n=/[1-9]/g;class mKe{constructor(){this.Yt=null}ht(e){this.Yt=e}nt(e,n){if(this.Yt===null||this.Yt.Vt===!1||this.Yt.ri.length===0)return;const r=e.useMediaCoordinateSpace(({context:x})=>(x.font=n.P,Math.round(n.Gi.Vi(x,Jr(this.Yt).ri,C3n))));if(r<=0)return;const s=n.Ji,a=r+2*s,o=a/2,l=this.Yt.Qi;let c=this.Yt.Bi,u=Math.floor(c-o)+.5;u<0?(c+=Math.abs(0-u),u=Math.floor(c-o)+.5):u+a>l&&(c-=Math.abs(l-(u+a)),u=Math.floor(c-o)+.5);const d=u+a,f=Math.ceil(0+n.S+n.C+n.A+n.k+n.V);e.useBitmapCoordinateSpace(({context:x,horizontalPixelRatio:g,verticalPixelRatio:y})=>{const v=Jr(this.Yt);x.fillStyle=v.Z;const C=Math.round(u*g),N=Math.round(0*y),I=Math.round(d*g),P=Math.round(f*y),M=Math.round(2*g);if(x.beginPath(),x.moveTo(C,N),x.lineTo(C,P-M),x.arcTo(C,P,C+M,P,M),x.lineTo(I-M,P),x.arcTo(I,P,I,P-M,M),x.lineTo(I,N),x.fill(),v.pi){const F=Math.round(v.Bi*g),$=N,L=Math.round(($+n.C)*y);x.fillStyle=v.R;const z=Math.max(1,Math.floor(g)),Q=Math.floor(.5*g);x.fillRect(F-Q,$,z,L-$)}}),e.useMediaCoordinateSpace(({context:x})=>{const g=Jr(this.Yt),y=0+n.S+n.C+n.A+n.k/2;x.font=n.P,x.textAlign="left",x.textBaseline="middle",x.fillStyle=g.R;const v=n.Gi.Di(x,"Apr0");x.translate(u+s,y+v),x.fillText(g.ri,0,0)})}}class S3n{constructor(e,n,r){this.xt=!0,this.Gt=new mKe,this.Zt={Vt:!1,Z:"#4c525e",R:"white",ri:"",Qi:0,Bi:NaN,pi:!0},this.Ct=e,this.ts=n,this.ji=r}kt(){this.xt=!0}Tt(){return this.xt&&(this.Rt(),this.xt=!1),this.Gt.ht(this.Zt),this.Gt}Rt(){const e=this.Zt;if(e.Vt=!1,this.Ct.N().mode===2)return;const n=this.Ct.N().vertLine;if(!n.labelVisible)return;const r=this.ts.At();if(r.Ki())return;e.Qi=r.Qi();const s=this.ji();if(s===null)return;e.Bi=s.Bi;const a=r.ss(this.Ct.Bt());e.ri=r.ns(Jr(a)),e.Vt=!0;const o=this.ts.Xi().X(n.labelBackgroundColor);e.Z=o.Z,e.R=o.G,e.pi=r.N().ticksVisible}}let xKe=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 b8e;(function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden",t[t.MagnetOHLC=3]="MagnetOHLC"})(b8e||(b8e={}));class N3n extends xKe{constructor(e,n){super(),this.yt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.Ss=NaN,this.xs=NaN,this.Cs=NaN,this.ts=e,this.ys=n,this.ks=((s,a)=>o=>{const l=a(),c=s();if(o===Jr(this.yt).Ps())return{gt:c,Bi:l};{const u=Jr(o.zt());return{gt:o.Ts(l,u),Bi:l}}})(()=>this.ds,()=>this.Ss);const r=((s,a)=>()=>{const o=this.ts.At().Rs(s()),l=a();return o&&Number.isFinite(l)?{wt:o,Bi:l}:null})(()=>this.fs,()=>this.si());this.Ds=new S3n(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 v3n(this,e),this.gs.set(e,n));let r=this.Ms.get(e);return r||(r=new b3n(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(d3n),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 w3n(this,n,r),e.set(n,s)),s}}function Oz(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 y8e=".";function Xg(t,e){if(!jj(t))return"n/a";if(!Fk(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 Mz{constructor(e,n){if(n||(n=1),jj(e)&&Fk(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=y8e+Xg(+o.toFixed(this.xn)*this.Mn,a)}else r=Math.round(r*n)/n,a>0&&(s=y8e+Xg(0,a));return r.toFixed(0)+s}}class gKe extends Mz{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class j3n{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 A3n=/[2-9]/g;class cB{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||A3n,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 _3n{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 bKe{constructor(e,n,r){this.Wn=e,this.On=new cB(50),this.Fn=n,this.O=r,this.W=-1,this.Gt=new _3n(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 E3n extends X5{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),Nj(e,this.Yt.Xt),fKe(e,a,0,n.width))}}class jfe{constructor(e){this.Zn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Xt:0,Vt:!1},this.Gn=new E3n,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 k3n extends jfe{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 T3n extends X5{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 I3n=[{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 P3n{constructor(e){this.Gt=new T3n,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 I3n)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 F3n extends jfe{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 O3n extends Fz{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 v8e(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(v8e(Math.min,this.$e(),e.$e(),-1/0),v8e(Math.max,this.qe(),e.qe(),1/0))}je(e){if(!jj(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){jj(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 uB{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 uB(Cd.Ze(e.priceRange),e.margins)}}class M3n extends jfe{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 R3n extends Fz{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 L3n{constructor(e,n){this.ge=e,this.ys=n,this.er=new M3n(e,this),this.Wn=new R3n(e,this),this.rr=new bKe(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 D3n extends xKe{constructor(e){super(),this.ts=e}Qt(){return this.ts}}const B3n={Bar:(t,e,n,r)=>{const s=e.upColor,a=e.downColor,o=Jr(t(n,r)),l=Fy(o.Ft[0])<=Fy(o.Ft[3]);return{cr:o.R??(l?s:a)}},Candlestick:(t,e,n,r)=>{const s=e.upColor,a=e.downColor,o=e.borderUpColor,l=e.borderDownColor,c=e.wickUpColor,u=e.wickDownColor,d=Jr(t(n,r)),f=Fy(d.Ft[0])<=Fy(d.Ft[3]);return{cr:d.R??(f?s:a),dr:d.Ht??(f?o:l),pr:d.vr??(f?c:u)}},Custom:(t,e,n,r)=>({cr:Jr(t(n,r)).R??e.color}),Area:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.vt??e.lineColor,vt:s.vt??e.lineColor,mr:s.mr??e.topColor,wr:s.wr??e.bottomColor}},Baseline:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.Ft[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,gr:s.gr??e.topLineColor,Mr:s.Mr??e.bottomLineColor,br:s.br??e.topFillColor1,Sr:s.Sr??e.topFillColor2,Cr:s.Cr??e.bottomFillColor1,yr:s.yr??e.bottomFillColor2}},Line:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.R??e.color,vt:s.R??e.color}},Histogram:(t,e,n,r)=>({cr:Jr(t(n,r)).R??e.color})};class $3n{constructor(e){this.kr=(n,r)=>r!==void 0?r.Ft:this.ge.Xs().Pr(n),this.ge=e,this.Tr=B3n[e.Rr()]}Dr(e,n){return this.Tr(this.kr,this.ge.N(),e,n)}}function yKe(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 Aj=yKe.bind(null,!0),vKe=yKe.bind(null,!1);var w8e;(function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"})(w8e||(w8e={}));const Mb=30;class U3n{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=aO(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 Aj(this.Vr,e,(n,r)=>n.Re<r)}Zr(e){return vKe(this.Vr,e,(n,r)=>n.Re>r)}Gr(e,n,r){let s=null;for(let a=e;a<n;a++){const o=this.Vr[a].Ft[r];Number.isNaN(o)||(s===null?s={Jr:o,Qr:o}:(o<s.Jr&&(s.Jr=o),o>s.Qr&&(s.Qr=o)))}return s}$r(e,n,r){if(this.Ki())return null;let s=null;const a=Jr(this.Lr()),o=Jr(this.Ks()),l=Math.max(e,a),c=Math.min(n,o),u=Math.ceil(l/Mb)*Mb,d=Math.max(u,Math.floor(c/Mb)*Mb);{const x=this.Xr(l),g=this.Zr(Math.min(c,u,n));s=aO(s,this.Gr(x,g,r))}let f=this.Ir.get(r);f===void 0&&(f=new Map,this.Ir.set(r,f));for(let x=Math.max(u+1,l);x<d;x+=Mb){const g=Math.floor(x/Mb);let y=f.get(g);if(y===void 0){const v=this.Xr(g*Mb),C=this.Zr((g+1)*Mb-1);y=this.Gr(v,C,r),f.set(g,y)}s=aO(s,y)}{const x=this.Xr(d),g=this.Zr(c);s=aO(s,this.Gr(x,g,r))}return s}}function aO(t,e){return t===null?e:e===null?t:{Jr:Math.min(t.Jr,e.Jr),Qr:Math.max(t.Qr,e.Qr)}}class z3n{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 H3n{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 z3n(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 wKe{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 H3n(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 V3n=class extends wKe{us(){return[]}};class W3n{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 C8e{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 W3n(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 CKe(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 q3n{constructor(e,n){this.Gt=new mKe,this._h=e,this.uh=n}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...CKe(this._h)}),this.Gt}}class G3n extends Fz{constructor(e,n){super(),this._h=e,this.Yi=n}qi(e,n,r){const s=CKe(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 K3n extends wKe{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 q3n(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 G3n(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 C8e(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 C8e(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 pZ(t,e,n,r){t.forEach(s=>{e(s).forEach(a=>{a.rh()===n&&r.push(a)})})}function mZ(t){return t.Ws()}function Y3n(t){return t.wh()}function X3n(t){return t.gh()}const Q3n=["Area","Line","Baseline"];class Rz extends D3n{constructor(e,n,r,s,a){super(e),this.Yt=new U3n,this.er=new F3n(this),this.bh=[],this.Sh=new k3n(this),this.xh=null,this.Ch=null,this.yh=null,this.kh=[],this.ys=r,this.Ph=n;const o=new O3n(this);this.vs=[o],this.rr=new bKe(o,this,e),Q3n.includes(this.Ph)&&(this.xh=new P3n(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 $3n(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 L3n(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=[];pZ(this.kh,mZ,"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),pZ(this.kh,mZ,"normal",e),e}Jh(){return this.Qh(mZ,"bottom")}ta(e){return this.Qh(Y3n,e)}ia(e){return this.Qh(X3n,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 uB.Ze(r)}return this.na(e,n)}ea(){return this.ys.priceFormat.minMove}ra(){return this.ha}Ns(){var e;this.sh.kt();for(const n of this.vs)n.kt();for(const n of this.bh)n.kt();this.er.kt(),this.Sh.kt(),(e=this.xh)==null||e.kt(),this.kh.forEach(n=>n.Ns())}Wt(){return Jr(super.Wt())}Et(e){if(!((this.Ph==="Line"||this.Ph==="Area"||this.Ph==="Baseline")&&this.ys.crosshairMarkerVisible))return null;const n=this.Yt.Pr(e);return n===null?null:{gt:n.Ft[3],ft:this.aa(),Ht:this.la(),Ot:this.oa(),Lt:this._a(e)}}Ae(){return this.ys.title}Vt(){return this.ys.visible}ua(e){this.kh.push(new K3n(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!Oz(this.Wt().wa())}na(e,n){if(!Fk(e)||!Fk(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 uB(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 j3n(this.ys.priceFormat.precision);break;case"percent":this.ha=new gKe(this.ys.priceFormat.precision);break;default:{const e=Math.pow(10,this.ys.priceFormat.precision);this.ha=new Mz(e,this.ys.priceFormat.minMove*e)}}this.es!==null&&this.es.ga()}Qh(e,n){const r=[];return pZ(this.kh,e,n,r),r}}const Z3n=[3],J3n=[0,1,2,3];class e5n{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 Rz).reduce((d,f)=>{if(r.Un(f)||!f.Vt())return d;const x=f.Wt(),g=f.Xs();if(x.Ki()||!g.Te(n))return d;const y=g.Pr(n);if(y===null)return d;const v=Fy(f.zt()),C=this.ys.mode===3?J3n:Z3n;return d.concat(C.map(N=>x.Nt(y.Ft[N],v.Ft)))},[]);if(c.length===0)return s;c.sort((d,f)=>Math.abs(d-l)-Math.abs(f-l));const u=c[0];return s=a.Ts(u,o),s}}function Z9(t,e,n){return Math.min(Math.max(t,e),n)}function oO(t,e,n){return e-t<=n}class t5n extends X5{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}et({context:e,bitmapSize:n,horizontalPixelRatio:r,verticalPixelRatio:s}){if(this.Yt===null)return;const a=Math.max(1,Math.floor(r));e.lineWidth=a,function(o,l){o.save(),o.lineWidth%2&&o.translate(.5,.5),l(),o.restore()}(e,()=>{const o=Jr(this.Yt);if(o.Sa){e.strokeStyle=o.xa,Nj(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,Nj(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 n5n{constructor(e){this.Gt=new t5n,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 r5n{constructor(e){this.sh=new n5n(e)}lr(){return this.sh}}const xZ={Ia:4,Ba:1e-4};function x4(t,e){const n=100*(t-e)/e;return e<0?-n:n}function s5n(t,e){const n=x4(t.$e(),e),r=x4(t.qe(),e);return new Cd(n,r)}function J9(t,e){const n=100*(t-e)/e+100;return e<0?-n:n}function i5n(t,e){const n=J9(t.$e(),e),r=J9(t.qe(),e);return new Cd(n,r)}function dB(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 e_(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 L7(t,e){if(t===null)return null;const n=dB(t.$e(),e),r=dB(t.qe(),e);return new Cd(n,r)}function m9(t,e){if(t===null)return null;const n=e_(t.$e(),e),r=e_(t.qe(),e);return new Cd(n,r)}function gZ(t){if(t===null)return xZ;const e=Math.abs(t.qe()-t.$e());if(e>=1||e<1e-15)return xZ;const n=Math.ceil(Math.abs(Math.log10(e))),r=xZ.Ia+n;return{Ia:r,Ba:1/Math.pow(10,r)}}class bZ{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=oO(a,s,1e-14)&&a>s+1e-14,x=oO(a,r*l,1e-14),g=oO(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];oO(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 S8e{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 bZ(this.Aa,[2,2.5,2]),o=new bZ(this.Aa,[2,2,2.5]),l=new bZ(this.Aa,[2.5,2,2]),c=[];return c.push(a.La(e,n,s),o.La(e,n,s),l.La(e,n,s)),function(u){if(u.length<1)throw Error("array is empty");let d=u[0];for(let f=1;f<u.length;++f)u[f]<d&&(d=u[f]);return d}(c)}Ha(){const e=this.Yi,n=e.zt();if(n===null)return void(this.Oa=[]);const r=e.$t(),s=this.Na(r-1,n),a=this.Na(0,n),o=this.Yi.N().entireTextOnly?this.Ua()/2:0,l=o,c=r-1-o,u=Math.max(s,a),d=Math.min(s,a);if(u===d)return void(this.Oa=[]);const f=this.La(u,d);if(this.$a(n,f,u,d,l,c),e.qa()&&this.Ya(f,d,u)){const x=this.Yi.ja();this.Ka(n,f,l,c,x,2*x)}}Va(){return this.Oa}Ua(){return this.Yi.k()}Fa(){return Math.ceil(2.5*this.Ua())}$a(e,n,r,s,a,o){const l=this.Oa,c=this.Yi;let u=r%n;u+=u<0?n:0;const d=r>=s?1:-1;let f=null,x=0;for(let g=r-u;g>s;g-=n){const y=this.Wa(g,e,!0);f!==null&&Math.abs(y-f)<this.Fa()||y<a||y>o||(x<l.length?(l[x].ka=y,l[x].Xa=c.Za(g)):l.push({ka:y,Xa:c.Za(g)}),x++,f=y,c.Ga()&&(n=this.La(g*d,s)))}l.length=x}Ka(e,n,r,s,a,o){const l=this.Oa,c=this.Ja(e,r,a,o),u=this.Ja(e,s,-o,-a),d=this.Wa(0,e,!0)-this.Wa(n,e,!0);l.length>0&&l[0].ka-c.ka<d/2&&l.shift(),l.length>0&&u.ka-l[l.length-1].ka<d/2&&l.pop(),l.unshift(c),l.push(u)}Ja(e,n,r,s){const a=(r+s)/2,o=this.Na(n+r,e),l=this.Na(n+s,e),c=Math.min(o,l),u=Math.max(o,l),d=Math.max(.1,this.La(u,c)),f=this.Na(n+a,e),x=f-f%d,g=this.Wa(x,e,!0);return{Xa:this.Yi.Za(x),ka:g}}Ya(e,n,r){let s=Fy(this.Yi.Qe());return this.Yi.Ga()&&(s=m9(s,this.Yi.Qa())),s.$e()-n<e&&r-s.qe()<e}}function SKe(t){return t.slice().sort((e,n)=>Jr(e.hs())-Jr(n.hs()))}var N8e;(function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"})(N8e||(N8e={}));const j8e=new gKe,A8e=new Mz(100,1);class a5n{constructor(e,n,r,s,a){this.tl=0,this.il=null,this.Ge=null,this.sl=null,this.nl={el:!1,rl:null},this.hl=!1,this.al=0,this.ll=0,this.ol=new El,this._l=new El,this.ul=[],this.cl=null,this.dl=null,this.fl=null,this.pl=null,this.vl=null,this.ha=A8e,this.ml=gZ(null),this.wl=e,this.ys=n,this.gl=r,this.Ml=s,this.bl=a,this.Sl=new S8e(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=e_(a.$e(),o),c=e_(a.qe(),o);return isFinite(l)&&isFinite(c)}(this.Ge,this.ml)?(r=m9(this.Ge,this.ml),r!==null&&this.Vl(r)):this.ys.autoScale=!0),e.ie===1&&e.ie!==n.ie&&(r=L7(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=x4(e,n):this.Rl()&&(e=J9(e,n)),this.Cl(e,n)}Hl(e,n,r){this.Ol();const s=this.Ll(),a=Jr(this.Qe()),o=a.$e(),l=a.qe(),c=this.El()-1,u=this.Dl(),d=c/(l-o),f=r===void 0?0:r.from,x=r===void 0?e.length:r.to,g=this.Ul();for(let y=f;y<x;y++){const v=e[y],C=v.gt;if(isNaN(C))continue;let N=C;g!==null&&(N=g(v.gt,n));const I=s+d*(N-o),P=u?I:this.tl-1-I;v.ut=P}}$l(e,n,r){this.Ol();const s=this.Ll(),a=Jr(this.Qe()),o=a.$e(),l=a.qe(),c=this.El()-1,u=this.Dl(),d=c/(l-o),f=r===void 0?0:r.from,x=r===void 0?e.length:r.to,g=this.Ul();for(let y=f;y<x;y++){const v=e[y];let C=v.qh,N=v.Yh,I=v.jh,P=v.Kh;g!==null&&(C=g(v.qh,n),N=g(v.Yh,n),I=g(v.jh,n),P=g(v.Kh,n));let M=s+d*(C-o),F=u?M:this.tl-1-M;v.ql=F,M=s+d*(N-o),F=u?M:this.tl-1-M,v.Yl=F,M=s+d*(I-o),F=u?M:this.tl-1-M,v.jl=F,M=s+d*(P-o),F=u?M:this.tl-1-M,v.Kl=F}}Ts(e,n){const r=this.xl(e,n);return this.Xl(r,n)}Xl(e,n){let r=e;return this.Le()?r=function(s,a){return a<0&&(s=-s),s/100*a+a}(r,n):this.Rl()&&(r=function(s,a){return s-=100,a<0&&(s=-s),s/100*a+a}(r,n)),r}ba(){return this.ul}Dt(){return this.dl||(this.dl=SKe(this.ul)),this.dl}Zl(e){this.ul.indexOf(e)===-1&&(this.ul.push(e),this.ga(),this.Gl())}Jl(e){const n=this.ul.indexOf(e);if(n===-1)throw new Error("source is not attached to scale");this.ul.splice(n,1),this.ul.length===0&&(this.yl({sn:!0}),this.Vl(null)),this.ga(),this.Gl()}zt(){let e=null;for(const n of this.ul){const r=n.zt();r!==null&&(e===null||r.Hh<e.Hh)&&(e=r)}return e===null?null:e.Ft}Dl(){return this.ys.invertScale}Va(){const e=this.zt()===null;if(this.fl!==null&&(e||this.fl.Ql===e))return this.fl.Va;this.Sl.Ha();const n=this.Sl.Va();return this.fl={Va:n,Ql:e},this.ol.p(),n}io(){return this.ol}so(e){this.Le()||this.Rl()||this.pl===null&&this.sl===null&&(this.Ki()||(this.pl=this.tl-e,this.sl=Jr(this.Qe()).Ue()))}no(e){if(this.Le()||this.Rl()||this.pl===null)return;this.yl({sn:!1}),(e=this.tl-e)<0&&(e=0);let n=(this.pl+.2*(this.tl-1))/(e+.2*(this.tl-1));const r=Jr(this.sl).Ue();n=Math.max(n,.1),r.je(n),this.Vl(r)}eo(){this.Le()||this.Rl()||(this.pl=null,this.sl=null)}ro(e){this.Pl()||this.vl===null&&this.sl===null&&(this.Ki()||(this.vl=e,this.sl=Jr(this.Qe()).Ue()))}ho(e){if(this.Pl()||this.vl===null)return;const n=Jr(this.Qe()).Ye()/(this.El()-1);let r=e-this.vl;this.Dl()&&(r*=-1);const s=r*n,a=Jr(this.sl).Ue();a.Ke(s),this.Vl(a,!0),this.fl=null}ao(){this.Pl()||this.vl!==null&&(this.vl=null,this.sl=null)}ra(){return this.ha||this.ga(),this.ha}Zi(e,n){switch(this.ys.mode){case 2:return this.lo(x4(e,n));case 3:return this.ra().format(J9(e,n));default:return this.nr(e)}}Za(e){switch(this.ys.mode){case 2:return this.lo(e);case 3:return this.ra().format(e);default:return this.nr(e)}}Dh(e){return this.nr(e,Jr(this.cl).ra())}Vh(e,n){return e=x4(e,n),this.lo(e,j8e)}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=A8e,this.Le()?(this.ha=j8e,n=100):this.Rl()?(this.ha=new Mz(100,1),n=100):this.cl!==null&&(this.ha=this.cl.ra()),this.Sl=new S8e(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?dB(e,this.ml):e;const r=Jr(this.Qe()),s=this.Ll()+(this.El()-1)*(e-r.$e())/r.Ye();return this.Fl(s)}xl(e,n){if(this.Ol(),this.Ki())return 0;const r=this.Fl(e),s=Jr(this.Qe()),a=s.$e()+s.Ye()*((r-this.Ll())/(this.El()-1));return this.Ga()?e_(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=L7(f,this.ml);break;case 2:f=s5n(f,u.Ft);break;case 3:f=i5n(f,u.Ft)}if(n=n===null?f:n.vn(Jr(f)),d!==null){const x=d.tr();x!==null&&(s=Math.max(s,x.above),a=Math.max(a,x.below))}}}if(this.qa()&&(s=Math.max(s,this.ja()),a=Math.max(a,this.ja())),s===this.al&&a===this.ll||(this.al=s,this.ll=a,this.fl=null,this.kl()),n!==null){if(n.$e()===n.qe()){const c=this.cl,u=5*(c===null||this.Le()||this.Rl()?1:c.ea());this.Ga()&&(n=m9(n,this.ml)),n=new Cd(n.$e()-u,n.qe()+u),this.Ga()&&(n=L7(n,this.ml))}if(this.Ga()){const c=m9(n,this.ml),u=gZ(c);if(o=u,l=this.ml,o.Ia!==l.Ia||o.Ba!==l.Ba){const d=this.sl!==null?m9(this.sl,this.ml):null;this.ml=u,n=L7(c,u),d!==null&&(this.sl=L7(d,u))}}this.Vl(n)}else this.Ge===null&&(this.Vl(new Cd(-.5,.5)),this.ml=gZ(null));var o,l}Ul(){return this.Le()?x4:this.Rl()?J9:this.Ga()?e=>dB(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 _8e(t){return t instanceof Rz}class E8e{constructor(e,n){this.ul=[],this.do=new Map,this.tl=0,this.fo=0,this.po=1e3,this.dl=null,this.vo=new El,this.kh=[],this.uh=e,this.ts=n,this.mo=new r5n(this);const r=n.N();this.wo=this.Mo("left",r.leftPriceScale),this.bo=this.Mo("right",r.rightPriceScale),this.wo.Bl().i(this.So.bind(this,this.wo),this),this.bo.Bl().i(this.So.bind(this,this.bo),this),this.xo(r)}xo(e){if(e.leftPriceScale&&this.wo.hr(e.leftPriceScale),e.rightPriceScale&&this.bo.hr(e.rightPriceScale),e.localization&&(this.wo.ga(),this.bo.ga()),e.overlayPriceScales){const n=Array.from(this.do.values());for(const r of n){const s=Jr(r[0].Wt());s.hr(e.overlayPriceScales),e.localization&&s.ga()}}}Co(e){switch(e){case"left":return this.wo;case"right":return this.bo}return this.do.has(e)?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(_8e)}ba(){return this.ul}Un(e){const n=e.Wt();return n===null||this.wo!==n&&this.bo!==n}Zl(e,n,r){this.Vo(e,n,r?e.hs():this.ul.length)}Jl(e,n){const r=this.ul.indexOf(e);Fu(r!==-1,"removeDataSource: invalid data source"),this.ul.splice(r,1),n||this.ul.forEach((o,l)=>o.ls(l));const s=Jr(e.Wt()).wa();if(this.do.has(s)){const o=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=SKe(this.ul)),this.dl}qo(e,n){n=Z9(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(_8e)}Yo(){return this.vo}jo(){return this.mo}ua(e){this.kh.push(new V3n(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),!Oz(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,...Yg(n)},s=new a5n(e,r,this.ts.N().layout,this.ts.N().localization,this.ts.Xi());return s.Al(this.$t()),s}}function lO(t){return{Xo:t.Xo,Zo:{Kn:t.Go.externalId},Jo:t.Go.cursorStyle}}function o5n(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 l5n(t){return t.Ws!==void 0}function NKe(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 lO(s);for(const a of r){if(s&&s.Xo===a&&s.Go.zOrder!=="bottom"&&!s.Go.isBackground)return lO(s);if(l5n(a)){const o=o5n(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 lO(s)}return s!=null&&s.Go?lO(s):null}class c5n{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 t_{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 k8e(t,e){return t===null||e===null?t===e:t.He(e)}class u5n{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(Aj(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 N=l[u],I=N.index;if(!(I<C&&a(N))){x=I;break}u++,s.push(N),g=I,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 V4{constructor(e){this.m_=e}w_(){return this.m_===null?null:new t_(Math.floor(this.m_.Uh()),Math.ceil(this.m_.bi()))}g_(){return this.m_}static M_(){return new V4(null)}}function d5n(t,e){return t.weight>e.weight?t:e}class f5n{constructor(e,n,r,s){this.fo=0,this.b_=null,this.S_=[],this.vl=null,this.pl=null,this.x_=new u5n,this.C_=new Map,this.y_=V4.M_(),this.k_=!0,this.P_=new El,this.T_=new El,this.R_=new El,this.D_=null,this.V_=null,this.I_=new Map,this.B_=-1,this.A_=[],this.ys=n,this.Ml=r,this.E_=n.rightOffset,this.z_=n.barSpacing,this.ts=e,this.i_=s,this.L_(),this.x_.o_(n.uniformDistribution),this.O_()}N(){return this.ys}N_(e){nh(this.Ml,e),this.W_(),this.L_()}hr(e,n){nh(this.ys,e),this.ys.fixLeftEdge&&this.F_(),this.ys.fixRightEdge&&this.H_(),e.barSpacing!==void 0&&this.ts.dn(e.barSpacing),e.rightOffset!==void 0&&this.ts.fn(e.rightOffset),e.minBarSpacing===void 0&&e.maxBarSpacing===void 0||this.ts.dn(e.barSpacing??this.z_),e.ignoreWhitespaceIndices!==void 0&&e.ignoreWhitespaceIndices!==this.ys.ignoreWhitespaceIndices&&this.O_(),this.W_(),this.L_(),this.R_.p()}Rs(e){var n;return((n=this.S_[e])==null?void 0:n.time)??null}ss(e){return this.S_[e]??null}U_(e,n){if(this.S_.length<1)return null;if(this.i_.key(e)>this.i_.key(this.S_[this.S_.length-1].time))return n?this.S_.length-1:null;const r=Aj(this.S_,this.i_.key(e),(s,a)=>this.i_.key(s.time)<a);return this.i_.key(e)<this.i_.key(this.S_[r].time)?n?r:null:r}Ki(){return this.fo===0||this.S_.length===0||this.b_===null}q_(){return this.S_.length>0}ye(){return this.Y_(),this.y_.w_()}j_(){return this.Y_(),this.y_.g_()}K_(){const e=this.ye();if(e===null)return null;const n={from:e.Uh(),to:e.bi()};return this.X_(n)}X_(e){const n=Math.round(e.from),r=Math.round(e.to),s=Jr(this.Z_()),a=Jr(this.G_());return{from:Jr(this.ss(Math.max(s,n))),to:Jr(this.ss(Math.min(a,r)))}}J_(e){return{from:Jr(this.U_(e.from,!0)),to:Jr(this.U_(e.to,!0))}}Qi(){return this.fo}To(e){if(!isFinite(e)||e<=0||this.fo===e)return;const n=this.j_(),r=this.fo;if(this.fo=e,this.k_=!0,this.ys.lockVisibleTimeRangeOnResize&&r!==0){const s=this.z_*e/r;this.z_=s}if(this.ys.fixLeftEdge&&n!==null&&n.Uh()<=0){const s=r-e;this.E_-=Math.round(s/this.z_)+1,this.k_=!0}this.Q_(),this.tu()}qt(e){if(this.Ki()||!Fk(e))return 0;const n=this.iu()+this.E_-e;return this.fo-(n+.5)*this.z_-1}su(e,n){const r=this.iu(),s=n===void 0?0:n.from,a=n===void 0?e.length:n.to;for(let o=s;o<a;o++){const l=e[o].wt,c=r+this.E_-l,u=this.fo-(c+.5)*this.z_-1;e[o]._t=u}}nu(e,n){const r=Math.ceil(this.eu(e));return n&&this.ys.ignoreWhitespaceIndices&&!this.ru(r)?this.hu(r):r}fn(e){this.k_=!0,this.E_=e,this.tu(),this.ts.au(),this.ts.ar()}lu(){return this.z_}dn(e){this.ou(e),this.tu(),this.ts.au(),this.ts.ar()}_u(){return this.E_}Va(){if(this.Ki())return null;if(this.V_!==null)return this.V_;const e=this.z_,n=5*(this.ts.N().layout.fontSize+4)/8*(this.ys.tickMarkMaxCharacterLength||8),r=Math.round(n/e),s=Jr(this.ye()),a=Math.max(s.Uh(),s.Uh()-r),o=Math.max(s.bi(),s.bi()-r),l=this.x_.c_(e,n,this.ys.ignoreWhitespaceIndices,this.I_,this.B_),c=this.Z_()+r,u=this.G_()-r,d=this.uu(),f=this.ys.fixLeftEdge||d,x=this.ys.fixRightEdge||d;let g=0;for(const y of l){if(!(a<=y.index&&y.index<=o))continue;let v;g<this.A_.length?(v=this.A_[g],v.coord=this.qt(y.index),v.label=this.cu(y),v.weight=y.weight):(v={needAlignCoordinate:!1,coord:this.qt(y.index),label:this.cu(y),weight:y.weight},this.A_.push(v)),this.z_>n/2&&!d?v.needAlignCoordinate=!1:v.needAlignCoordinate=f&&y.index<=c||x&&y.index>=u,g++}return this.A_.length=g,this.V_=this.A_,this.A_}du(){this.k_=!0,this.dn(this.ys.barSpacing),this.fn(this.ys.rightOffset)}fu(e){this.k_=!0,this.b_=e,this.tu(),this.F_()}pu(e,n){const r=this.eu(e),s=this.lu(),a=s+n*(s/10);this.dn(a),this.ys.rightBarStaysOnScroll||this.fn(this._u()+(r-this.eu(e)))}so(e){this.vl&&this.ao(),this.pl===null&&this.D_===null&&(this.Ki()||(this.pl=e,this.vu()))}no(e){if(this.D_===null)return;const n=Z9(this.fo-e,0,this.fo),r=Z9(this.fo-Jr(this.pl),0,this.fo);n!==0&&r!==0&&this.dn(this.D_.lu*n/r)}eo(){this.pl!==null&&(this.pl=null,this.mu())}ro(e){this.vl===null&&this.D_===null&&(this.Ki()||(this.vl=e,this.vu()))}ho(e){if(this.vl===null)return;const n=(this.vl-e)/this.lu();this.E_=Jr(this.D_)._u+n,this.k_=!0,this.tu()}ao(){this.vl!==null&&(this.vl=null,this.mu())}wu(){this.gu(this.ys.rightOffset)}gu(e,n=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(n)||n<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const r=this.E_,s=performance.now();this.ts._n({Mu:a=>(a-s)/n>=1,bu:a=>{const o=(a-s)/n;return o>=1?e:r+(e-r)*o}})}kt(e,n){this.k_=!0,this.S_=e,this.x_.__(e,n),this.tu()}Su(){return this.P_}xu(){return this.T_}Cu(){return this.R_}iu(){return this.b_||0}yu(e){const n=e.h_();this.ou(this.fo/n),this.E_=e.bi()-this.iu(),this.tu(),this.k_=!0,this.ts.au(),this.ts.ar()}ku(){const e=this.Z_(),n=this.G_();e!==null&&n!==null&&this.yu(new t_(e,n+this.ys.rightOffset))}Pu(e){const n=new t_(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(V4.M_());const e=this.iu(),n=this.fo/this.z_,r=this.E_+e,s=new t_(r-n+1,r);this.Du(new V4(s))}Q_(){const e=Z9(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 c5n(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,k8e(n.w_(),this.y_.w_())||this.P_.p(),k8e(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 T8e,I8e,P8e,F8e,O8e;(function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"})(T8e||(T8e={}));class h5n{constructor(e,n,r){this.zu=[],this.Lu=[],this.fo=0,this.Ou=null,this.Nu=new El,this.Wu=new El,this.Fu=null,this.Hu=e,this.ys=n,this.i_=r,this.bl=new h3n(this.ys.layout.colorParsers),this.Uu=new f3n(this),this.uh=new f5n(this,n.timeScale,this.ys.localization,r),this.Ct=new N3n(this,n.crosshair),this.$u=new e5n(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=NKe(s,e,n);this.Ju(f&&{Xo:f.Xo,Zo:f.Zo,Jo:f.Jo||null}),this.Wu.p(this.Ct.Bt(),{x:e,y:n},r)}}gc(e,n,r){const s=r.Ps(),a=s.zt(),o=s.Nt(e,Jr(a)),l=this.uh.U_(n,!0),c=this.uh.qt(Jr(l));this.wc(c,o,null,r,!0)}Mc(e){this.sc().Ls(),this.Zh(),e||this.Wu.p(null,null,null)}Eh(){const e=this.Ct.Us();if(e!==null){const n=this.Ct.Bs(),r=this.Ct.As();this.wc(n,r,null,e)}this.Ct.Ns()}bc(e,n,r){const s=this.uh.Rs(0);n!==void 0&&r!==void 0&&this.uh.kt(n,r);const a=this.uh.Rs(0),o=this.uh.iu(),l=this.uh.ye();if(l!==null&&s!==null&&a!==null){const c=l.Te(o),u=this.i_.key(s)>this.i_.key(a),d=e!==null&&e>o&&!u,f=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,x=c&&(r!==void 0||f)&&this.uh.N().shiftVisibleRangeOnNewBar;if(d&&!x){const g=e-o;this.uh.fn(this.uh._u()-g)}}this.uh.fu(e)}Lh(e){e!==null&&e.$o()}Hn(e){if(function(r){return r instanceof E8e}(e))return e;const n=this.zu.find(r=>r.Dt().includes(e));return n===void 0?null:n}au(){this.zu.forEach(e=>e.$o()),this.Eh()}m(){this.zu.forEach(e=>e.m()),this.zu.length=0,this.ys.localization.priceFormatter=void 0,this.ys.localization.percentageFormatter=void 0,this.ys.localization.timeFormatter=void 0}Sc(){return this.Uu}Yn(){return this.Uu.N()}yo(){return this.Nu}xc(e,n){const r=this.qu(n);this.Cc(e,r),this.Lu.push(e),this.Lu.length===1?this.Bh():this.ar()}yc(e){const n=this.Hn(e),r=this.Lu.indexOf(e);Fu(r!==-1,"Series not found");const s=Jr(n);this.Lu.splice(r,1),s.Jl(e),e.m&&e.m(),this.uh.O_(),this.kc(s)}Ih(e,n){const r=Jr(this.Hn(e));r.Jl(e,!0),r.Zl(e,n,!0)}ku(){const e=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=Jr(this.Hn(e));r.Jl(e);const s=this.qu(n);this.Cc(e,s),r.ba().length===0&&this.kc(r)}Vc(){return this.Ku}$(){return this.Yu}Ut(e){const n=this.Ku,r=this.Yu;if(n===r)return n;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Fu===null||this.Fu.mr!==r||this.Fu.wr!==n)this.Fu={mr:r,wr:n,Ic:new Map};else{const a=this.Fu.Ic.get(e);if(a!==void 0)return a}const s=this.bl.tt(r,n,e/100);return this.Fu.Ic.set(e,s),s}Bc(e){return this.zu.indexOf(e)}Xi(){return this.bl}qu(e){if(Fu(e>=0,"Index should be greater or equal to 0"),(e=Math.min(this.zu.length,e))<this.zu.length)return this.zu[e];const n=new E8e(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),Oz(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 Wse(t){return!jj(t)&&!hI(t)}function jKe(t){return jj(t)}(function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"})(I8e||(I8e={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(P8e||(P8e={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(F8e||(F8e={})),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"}(O8e||(O8e={}));const M8e=t=>t.getUTCFullYear();function p5n(t,e,n){return e.replace(/yyyy/g,(r=>Xg(M8e(r),4))(t)).replace(/yy/g,(r=>Xg(M8e(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=>Xg((s=>s.getUTCMonth()+1)(r),2))(t)).replace(/dd/g,(r=>Xg((s=>s.getUTCDate())(r),2))(t))}class AKe{constructor(e="yyyy-MM-dd",n="default"){this.Ac=e,this.Ec=n}s_(e){return p5n(e,this.Ac,this.Ec)}}class m5n{constructor(e){this.zc=e||"%h:%m:%s"}s_(e){return this.zc.replace("%h",Xg(e.getUTCHours(),2)).replace("%m",Xg(e.getUTCMinutes(),2)).replace("%s",Xg(e.getUTCSeconds(),2))}}const x5n={Lc:"yyyy-MM-dd",Oc:"%h:%m:%s",Nc:" ",Wc:"default"};class g5n{constructor(e={}){const n={...x5n,...e};this.Fc=new AKe(n.Lc,n.Wc),this.Hc=new m5n(n.Oc),this.Uc=n.Nc}s_(e){return`${this.Fc.s_(e)}${this.Uc}${this.Hc.s_(e)}`}}function cO(t){return 60*t*60*1e3}function yZ(t){return 60*t*1e3}const uO=[{$c:(R8e=1,1e3*R8e),qc:10},{$c:yZ(1),qc:20},{$c:yZ(5),qc:21},{$c:yZ(30),qc:22},{$c:cO(1),qc:30},{$c:cO(3),qc:31},{$c:cO(6),qc:32},{$c:cO(12),qc:33}];var R8e;function L8e(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=uO.length-1;n>=0;--n)if(Math.floor(e.getTime()/uO[n].$c)!==Math.floor(t.getTime()/uO[n].$c))return uO[n].qc;return 0}function vZ(t){let e=t;if(hI(t)&&(e=Afe(t)),!Wse(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 D8e(t){if(!jKe(t))throw new Error("time must be of type isUTCTimestamp");return{Yc:t}}function Afe(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 B8e(t){hI(t.time)&&(t.time=Afe(t.time))}class $8e{options(){return this.ys}setOptions(e){this.ys=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?function(n){n.forEach(B8e)}(e):B8e(e)}createConverterToInternalObj(e){return Jr(function(n){return n.length===0?null:Wse(n[0].time)||hI(n[0].time)?vZ:D8e}(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 jKe(n=e)?D8e(n):Wse(n)?vZ(n):vZ(Afe(n));var n}updateFormatter(e){if(!this.ys)return;const n=e.dateFormat;this.ys.timeScale.timeVisible?this.Kc=new g5n({Lc:n,Oc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Nc:" ",Wc:e.locale}):this.Kc=new AKe(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(d5n,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=L8e(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=L8e(new Date(1e3*r[0].time.Yc),u)}})(e,n)}static Xc(e){return nh({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const _j=typeof window<"u";function U8e(){return!!_j&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function wZ(){return!!_j&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function qse(t){return t+t%2}function b5n(t){_j&&window.chrome!==void 0&&t.addEventListener("mousedown",e=>{if(e.button===1)return e.preventDefault(),!1})}class Lz{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=!wZ(),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=CZ(e.changedTouches,Jr(this.xd));if(n===null||(this.Sd=dO(e),this.md!==null)||this.Md)return;this.gd=!0;const r=this.Vd(u0(n),Jr(this.hd)),{jd:s,Kd:a,Dd:o}=r;if(this.ad||!(o<5)){if(!this.ad){const l=.5*s,c=a>=l&&!this.ys.Xd(),u=l>a&&!this.ys.Zd();c||u||(this.Md=!0),this.ad=!0,this.od=!0,this.Fd(),this.Ed()}if(!this.Md){const l=this.Rd(e,n);this.Id(l,this.Ad.Gd),BC(e)}}}Jd(e){if(e.button!==0)return;const n=this.Vd(u0(e),Jr(this.rd)),{Dd:r}=n;if(r>=5&&(this.ld=!0,this.Od()),this.ld){const s=this.Rd(e);this.zd(s,this.Ad.Qd)}}Vd(e,n){const r=Math.abs(n._t-e._t),s=Math.abs(n.ut-e.ut);return{jd:r,Kd:s,Dd:r+s}}tf(e){let n=CZ(e.changedTouches,Jr(this.xd));if(n===null&&e.touches.length===0&&(n=e.changedTouches[0]),n===null)return;this.xd=null,this.Sd=dO(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&&BC(e));this.Qc===0&&BC(e),e.touches.length===0&&this.ed&&(this.ed=!1,BC(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),U8e()&&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=dO(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;U8e()&&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})}wZ()&&(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}),b5n(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=z8e(e.touches[0],e.touches[1])/this.wd;this.Ad.pf(this.md,n),BC(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=z8e(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=!wZ()}hf(e){const n=CZ(e.touches,Jr(this.xd));if(n===null)return;const r=this.Rd(e,n);this.Id(r,this.Ad.bf),this.od=!0,this.ed=!0}Td(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:dO(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"&&BC(e)}}}}function z8e(t,e){const n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function BC(t){t.cancelable&&t.preventDefault()}function u0(t){return{_t:t.pageX,ut:t.pageY}}function dO(t){return t.timeStamp||performance.now()}function CZ(t,e){for(let n=0;n<t.length;++n)if(t[n].identifier===e)return t[n];return null}class y5n{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 Za({width:this.Vf.Nf().width,height:1})}Wf(){return Za({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 Lz(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=Z9(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 SZ(t,e){return t.sp-e.sp}function NZ(t,e,n){const r=(t.sp-e.sp)/(t.wt-e.wt);return Math.sign(r)*Math.min(Math.abs(r),n)}class v5n{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=NZ(this.np,this.ep,this.up),a=SZ(this.np,this.ep),o=[s],l=[a];if(r+=a,this.rp!==null){const u=NZ(this.ep,this.rp,this.up);if(Math.sign(u)===Math.sign(s)){const d=SZ(this.ep,this.rp);if(o.push(u),l.push(d),r+=d,this.hp!==null){const f=NZ(this.rp,this.hp,this.up);if(Math.sign(f)===Math.sign(s)){const x=SZ(this.rp,this.hp);o.push(f),l.push(x),r+=x}}}}let c=0;for(let u=0;u<o.length;++u)c+=l[u]/r*o[u];Math.abs(c)<this._p||(this.ap={sp:e,wt:n},this.op=c,this.lp=function(u,d){const f=Math.log(d);return Math.log(1*f/-u)/f}(Math.abs(c),this.cp))}bu(e){const n=Jr(this.ap),r=e-n.wt;return n.sp+this.op*(Math.pow(this.cp,r)-1)/Math.log(this.cp)}Mu(e){return this.ap===null||this.fp(e)===this.lp}fp(e){const n=e-Jr(this.ap).wt;return Math.min(n,this.lp)}}class w5n{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 y5(t,e){const n=Jr(t.ownerDocument).createElement("canvas");t.appendChild(n);const r=o3n(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 v5(t){var e;t.width=1,t.height=1,(e=t.getContext("2d"))==null||e.clearRect(0,0,1,1)}function Gse(t,e,n,r){t.ih&&t.ih(e,n,r)}function PM(t,e,n,r){t.nt(e,n,r)}function Kse(t,e,n,r){const s=t(n,r);for(const a of s){const o=a.Tt(r);o!==null&&e(o)}}function jZ(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 H8e(t,e,n,r){if(!t.length)return;let s=0;const a=t[0].$t(r,!0);let o=e===1?n/2-(t[0].Wi()-a/2):t[0].Wi()-a/2-n/2;o=Math.max(0,o);for(let l=1;l<t.length;l++){const c=t[l],u=t[l-1],d=u.$t(r,!1),f=c.Wi(),x=u.Wi();if(e===1?f>x-d:f<x+d){const g=x-d*e;c.Fi(g);const y=g-e*d/2;if((e===1?y<0:y>n)&&o>0){const v=e===1?-1-y:y-n,C=Math.min(v,o);for(let N=s;N<t.length;N++)t[N].Fi(t[N].Wi()+e*C);o-=C}}else s=l,o=e===1?x-d-f:f-(x+d)}}class V8e{constructor(e,n,r,s){this.Yi=null,this.kp=null,this.Pp=!1,this.Tp=new cB(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=jZ("normal",s),this.Lp=jZ("top",s),this.Op=jZ("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=y5(this.Ef,Za({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=y5(this.Ef,Za({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 Lz(this.Wp.canvasElement,l,{Xd:()=>!this.ys.handleScroll.vertTouchDrag,Zd:()=>!0})}m(){this.Pf.m(),this.Wp.unsubscribeSuggestedBitmapSizeChanged(this.Ap),v5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),v5(this.Np.canvasElement),this.Np.dispose(),this.Yi!==null&&this.Yi.io().u(this),this.Yi=null}Of(){return this.Ef}k(){return this.gl.fontSize}$p(){const e=this.Uu.N();return this.Rp!==e.P&&(this.Tp.In(),this.Rp=e.P),e}qp(){if(this.Yi===null)return 0;let e=0;const n=this.$p(),r=Jr(this.Np.canvasElement.getContext("2d",{colorSpace:this.yt.Bp().N().layout.colorSpace}));r.save();const s=this.Yi.Va();r.font=this.Yp(),s.length>0&&(e=Math.max(this.Tp.Vi(r,s[0].Xa),this.Tp.Vi(r,s[s.length-1].Xa)));const a=this.jp();for(let u=a.length;u--;){const d=this.Tp.Vi(r,a[u].ri());d>e&&(e=d)}const o=this.Yi.zt();if(o!==null&&this.kp!==null&&(l=this.ys.crosshair).mode!==2&&l.horzLine.visible&&l.horzLine.labelVisible){const u=this.Yi.Ts(1,o),d=this.Yi.Ts(this.kp.height-2,o);e=Math.max(e,this.Tp.Vi(r,this.Yi.Zi(Math.floor(Math.min(u,d))+.11111111111111,o)),this.Tp.Vi(r,this.Yi.Zi(Math.ceil(Math.max(u,d))-.11111111111111,o)))}var l;r.restore();const c=e||34;return qse(Math.ceil(n.S+n.C+n.I+n.B+5+c))}Kp(e){this.kp!==null&&I3(this.kp,e)||(this.kp=e,this.Vp=!0,this.Np.resizeCanvasElement(e),this.Wp.resizeCanvasElement(e),this.Vp=!1,this.Ef.style.width=`${e.width}px`,this.Ef.style.height=`${e.height}px`)}Xp(){return Jr(this.kp).width}_s(e){this.Yi!==e&&(this.Yi!==null&&this.Yi.io().u(this),this.Yi=e,e.io().i(this.ol.bind(this),this))}Wt(){return this.Yi}In(){const e=this.yt.Xf();this.yt.Bp().Qt().Ho(e,Jr(this.Wt()))}Zp(e){if(this.kp===null)return;const n={colorSpace:this.yt.Bp().N().layout.colorSpace};if(e!==1){this.Gp(),this.Np.applySuggestedBitmapSize();const s=b5(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=b5(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?Pz(e,0,0,r,s,o):pKe(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)}H8e(s,1,this.kp.height,n),H8e(a,-1,this.kp.height,n)}sv(e){if(this.kp===null)return;const n=this.jp(),r=this.$p(),s=this.Ep?"right":"left";n.forEach(a=>{a.Ui()&&a.Tt(Jr(this.Yi)).nt(e,r,this.Tp,s)})}nv(e){if(this.kp===null||this.Yi===null)return;const n=this.yt.Bp().Qt(),r=[],s=this.yt.Xf(),a=n.sc().Fs(s,this.Yi);a.length&&r.push(a);const o=this.$p(),l=this.Ep?"right":"left";r.forEach(c=>{c.forEach(u=>{u.Tt(Jr(this.Yi)).nt(e,o,this.Tp,l)})})}ev(e){this.Ef.style.cursor=e===1?"ns-resize":"default"}ol(){const e=this.qp();this.Dp<e&&this.yt.Bp().Qt().Bh(),this.Dp=e}Yp(){return lB(this.gl.fontSize,this.gl.fontFamily)}}function C5n(t,e){var n;return((n=t.Jh)==null?void 0:n.call(t,e))??[]}function W8e(t,e){var n;return((n=t.Ws)==null?void 0:n.call(t,e))??[]}function q8e(t,e){var n;return((n=t.us)==null?void 0:n.call(t,e))??[]}function S5n(t,e){var n;return((n=t.Xh)==null?void 0:n.call(t,e))??[]}class _fe{constructor(e,n){this.kp=Za({width:0,height:0}),this.hv=null,this.av=null,this.lv=null,this.ov=null,this._v=!1,this.uv=new El,this.cv=new El,this.dv=0,this.fv=!1,this.pv=null,this.vv=!1,this.mv=null,this.wv=null,this.Vp=!1,this.Ip=()=>{this.Vp||this.gv===null||this.ts().ar()},this.Ap=()=>{this.Vp||this.gv===null||this.ts().ar()},this.gp=e,this.gv=n,this.gv.Yo().i(this.Mv.bind(this),this,!0),this.bv=document.createElement("td"),this.bv.style.padding="0",this.bv.style.position="relative";const r=document.createElement("div");r.style.width="100%",r.style.height="100%",r.style.position="relative",r.style.overflow="hidden",this.Sv=document.createElement("td"),this.Sv.style.padding="0",this.xv=document.createElement("td"),this.xv.style.padding="0",this.bv.appendChild(r),this.Np=y5(r,Za({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=y5(r,Za({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 Lz(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),v5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),v5(this.Np.canvasElement),this.Np.dispose(),this.gv!==null&&(this.gv.Yo().u(this),this.gv.m()),this.Pf.m()}Xf(){return Jr(this.gv)}yv(e){var n;this.gv!==null&&this.gv.Yo().u(this),this.gv=e,this.gv!==null&&this.gv.Yo().i(_fe.prototype.Mv.bind(this),this,!0),this.Cv(),this.gp.If().indexOf(this)===this.gp.If().length-1?(this.lv=this.lv??new w5n(this.bv,this.gp),this.lv.kt()):((n=this.lv)==null||n.bp(),this.lv=null)}Bp(){return this.gp}Of(){return this.Af}Cv(){if(this.gv!==null&&(this.kv(),this.ts().js().length!==0)){if(this.hv!==null){const e=this.gv.Bo();this.hv._s(Jr(e))}if(this.av!==null){const e=this.gv.Ao();this.av._s(Jr(e))}}}Pv(){this.hv!==null&&this.hv.kt(),this.av!==null&&this.av.kt()}ko(){return this.gv!==null?this.gv.ko():0}Po(e){this.gv&&this.gv.Po(e)}$d(e){if(!this.gv)return;this.Tv();const n=e.localX,r=e.localY;this.Rv(n,r,e)}_f(e){this.Tv(),this.Dv(),this.Rv(e.localX,e.localY,e)}qd(e){if(!this.gv)return;this.Tv();const n=e.localX,r=e.localY;this.Rv(n,r,e)}ef(e){this.gv!==null&&(this.Tv(),this.Vv(e))}Ld(e){this.gv!==null&&this.Iv(this.cv,e)}Bd(e){this.Ld(e)}Qd(e){this.Tv(),this.Bv(e),this.Rv(e.localX,e.localY,e)}nf(e){this.gv!==null&&(this.Tv(),this.fv=!1,this.Av(e))}sf(e){this.gv!==null&&this.Vv(e)}bf(e){if(this.fv=!0,this.pv===null){const n={x:e.localX,y:e.localY};this.Ev(n,n,e)}}Mf(e){this.gv!==null&&(this.Tv(),this.gv.Qt().Ju(null),this.zv())}Lv(){return this.uv}Ov(){return this.cv}ff(){this.dv=1,this.ts().hn()}pf(e,n){if(!this.gp.N().handleScale.pinch)return;const r=5*(n-this.dv);this.dv=n,this.ts()._c(e._t,r)}af(e){this.fv=!1,this.vv=this.pv!==null,this.Dv();const n=this.ts().sc();this.pv!==null&&n.Vt()&&(this.mv={x:n.si(),y:n.ni()},this.pv={x:e.localX,y:e.localY})}Gd(e){if(this.gv===null)return;const n=e.localX,r=e.localY;if(this.pv===null)this.Bv(e);else{this.vv=!1;const s=Jr(this.mv),a=s.x+(n-this.pv.x),o=s.y+(r-this.pv.y);this.Rv(a,o,e)}}if(e){this.Bp().N().trackingMode.exitMode===0&&(this.vv=!0),this.Nv(),this.Av(e)}jn(e,n){const r=this.gv;return r===null?null:NKe(r,e,n)}Wv(e,n){Jr(n==="left"?this.hv:this.av).Kp(Za({width:e,height:this.kp.height}))}Nf(){return this.kp}Kp(e){I3(this.kp,e)||(this.kp=e,this.Vp=!0,this.Np.resizeCanvasElement(e),this.Wp.resizeCanvasElement(e),this.Vp=!1,this.bv.style.width=e.width+"px",this.bv.style.height=e.height+"px")}Fv(){const e=Jr(this.gv);e.Io(e.Bo()),e.Io(e.Ao());for(const n of e.ba())if(e.Un(n)){const r=n.Wt();r!==null&&e.Io(r),n.Ns()}for(const n of e.Ko())n.Ns()}Wf(){return this.Np.bitmapSize}Ff(e,n,r){const s=this.Wf();s.width>0&&s.height>0&&e.drawImage(this.Np.canvasElement,n,r)}Zp(e){if(e===0||this.gv===null)return;e>1&&this.Fv(),this.hv!==null&&this.hv.Zp(e),this.av!==null&&this.av.Zp(e);const n={colorSpace:this.gp.N().layout.colorSpace};if(e!==1){this.Np.applySuggestedBitmapSize();const s=b5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a)}),this.gv&&(this.Hv(s,C5n),this.Uv(s),this.Hv(s,W8e),this.Hv(s,q8e)))}this.Wp.applySuggestedBitmapSize();const r=b5(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,S5n),this.Hv(r,q8e))}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?Pz(e,0,0,r,s,l):pKe(e,0,0,r,s,o,l)}Uv(e){const n=Jr(this.gv),r=n.jo().lr().Tt(n);r!==null&&r.nt(e,!1)}$v(e){this.jv(e,W8e,PM,this.ts().sc())}Hv(e,n){const r=Jr(this.gv),s=r.Dt(),a=r.Ko();for(const o of a)this.jv(e,n,Gse,o);for(const o of s)this.jv(e,n,Gse,o);for(const o of a)this.jv(e,n,PM,o);for(const o of s)this.jv(e,n,PM,o)}jv(e,n,r,s){const a=Jr(this.gv),o=a.Qt().Gu(),l=o!==null&&o.Xo===s,c=o!==null&&l&&o.Zo!==void 0?o.Zo.Xn:void 0;Kse(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 V8e(this,e.N(),s,"left"),this.Sv.appendChild(this.hv.Of())),r&&this.av===null&&(this.av=new V8e(this,e.N(),s,"right"),this.xv.appendChild(this.av.Of()))}Kv(e){return e.Sf&&this.fv||this.pv!==null}Xv(e){return Math.max(0,Math.min(e,this.kp.width-1))}Zv(e){return Math.max(0,Math.min(e,this.kp.height-1))}Rv(e,n,r){this.ts().wc(this.Xv(e),this.Zv(n),r,Jr(this.gv))}zv(){this.ts().Mc()}Nv(){this.vv&&(this.pv=null,this.zv())}Ev(e,n,r){this.pv=e,this.vv=!1,this.Rv(n.x,n.y,r);const s=this.ts().sc();this.mv={x:s.si(),y:s.ni()}}ts(){return this.gp.Qt()}Av(e){if(!this._v)return;const n=this.ts(),r=this.Xf();if(n.Wo(r,r.Ps()),this.ov=null,this._v=!1,n.fc(),this.wv!==null){const s=performance.now(),a=n.At();this.wv.le(a._u(),s),this.wv.Mu(s)||n._n(this.wv)}}Tv(){this.pv=null}Dv(){if(this.gv){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Jr(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.gv.Ps().Ki()&&this.ts().At().Ki()}}Bv(e){if(this.gv===null)return;const n=this.ts(),r=n.At();if(r.Ki())return;const s=this.gp.N(),a=s.handleScroll,o=s.kineticScroll;if((!a.pressedMouseMove||e.Sf)&&(!a.horzTouchDrag&&!a.vertTouchDrag||!e.Sf))return;const l=this.gv.Ps(),c=performance.now();if(this.ov!==null||this.Kv(e)||(this.ov={x:e.clientX,y:e.clientY,Yc:c,Gv:e.localX,Jv:e.localY}),this.ov!==null&&!this._v&&(this.ov.x!==e.clientX||this.ov.y!==e.clientY)){if(e.Sf&&o.touch||!e.Sf&&o.mouse){const u=r.lu();this.wv=new v5n(.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 G8e{constructor(e,n,r,s,a){this.xt=!0,this.kp=Za({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=y5(this.Ef,Za({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip)}m(){this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),v5(this.Np.canvasElement),this.Np.dispose()}Of(){return this.Ef}Nf(){return this.kp}Kp(e){I3(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=b5(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}){Pz(e,0,0,n.width,n.height,this.tm())}}function Efe(t){return e=>{var n;return((n=e.ia)==null?void 0:n.call(e,t))??[]}}const N5n=Efe("normal"),j5n=Efe("top"),A5n=Efe("bottom");class _5n{constructor(e,n){this.im=null,this.sm=null,this.M=null,this.nm=!1,this.kp=Za({width:0,height:0}),this.rm=new El,this.Tp=new cB(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=y5(this.lm,Za({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=y5(this.lm,Za({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 Lz(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),v5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),v5(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){I3(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(Za({width:n,height:e.height})),this.sm!==null&&this.sm.Kp(Za({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=b5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a),this.Qp(a),this.gm(s,A5n)}),this.iv(s),this.gm(s,N5n)),this.im!==null&&this.im.Zp(e),this.sm!==null&&this.sm.Zp(e)}this.Wp.applySuggestedBitmapSize();const r=b5(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,j5n))}gm(e,n){const r=this.gp.Qt().js();for(const s of r)Kse(n,a=>Gse(a,e,!1,void 0),s,void 0);for(const s of r)Kse(n,a=>PM(a,e,!1,void 0),s,void 0)}Jp({context:e,bitmapSize:n}){Pz(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 lB(this.W(),this.ys.fontFamily)}xm(){return lB(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 cB,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 G8e("left",n,r,s,a),this.hm.appendChild(this.im.Of())),n.rightPriceScale.visible&&this.sm===null&&(this.sm=new G8e("right",n,r,s,a),this.am.appendChild(this.sm.Of()))}}var wAe;const E5n=!!_j&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!_j&&((wAe=navigator==null?void 0:navigator.userAgentData)!=null&&wAe.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);class k5n{constructor(e,n,r){var s;this.Cm=[],this.ym=[],this.km=0,this.tl=0,this.fo=0,this.Pm=0,this.Tm=0,this.Rm=null,this.Dm=!1,this.uv=new El,this.cv=new El,this.Wu=new El,this.Vm=null,this.Im=null,this.wp=e,this.ys=n,this.i_=r,this.pp=document.createElement("div"),this.pp.classList.add("tv-lightweight-charts"),this.pp.style.overflow="hidden",this.pp.style.direction="ltr",this.pp.style.width="100%",this.pp.style.height="100%",(s=this.pp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Bm=document.createElement("table"),this.Bm.setAttribute("cellspacing","0"),this.pp.appendChild(this.Bm),this.Am=this.Em.bind(this),AZ(this.ys)&&this.zm(!0),this.ts=new h5n(this.Hu.bind(this),this.ys,r),this.Qt().nc().i(this.Lm.bind(this),this),this.Om=new _5n(this,this.i_),this.Bm.appendChild(this.Om.Of());const a=n.autoSize&&this.Nm();let o=this.ys.width,l=this.ys.height;if(a||o===0||l===0){const c=e.getBoundingClientRect();o=o||c.width,l=l||c.height}this.Wm(o,l),this.Fm(),e.appendChild(this.pp),this.Hm(),this.ts.At().Cu().i(this.ts.Bh.bind(this.ts),this),this.ts.yo().i(this.ts.Bh.bind(this.ts),this)}Qt(){return this.ts}N(){return this.ys}If(){return this.Cm}Um(){return this.Om}m(){this.zm(!1),this.km!==0&&window.cancelAnimationFrame(this.km),this.ts.nc().u(this),this.ts.At().Cu().u(this),this.ts.yo().u(this),this.ts.m();for(const e of this.Cm)this.Bm.removeChild(e.Of()),e.Lv().u(this),e.Ov().u(this),e.m();this.Cm=[];for(const e of this.ym)this.$m(e);this.ym=[],Jr(this.Om).m(),this.pp.parentElement!==null&&this.pp.parentElement.removeChild(this.pp),this.Wu.m(),this.uv.m(),this.cv.m(),this.qm()}Wm(e,n,r=!1){if(this.tl===n&&this.fo===e)return;const s=function(l){const c=Math.floor(l.width),u=Math.floor(l.height);return Za({width:c-c%2,height:u-u%2})}(Za({width:e,height:n}));this.tl=s.height,this.fo=s.width;const a=this.tl+"px",o=this.fo+"px";Jr(this.pp).style.height=a,Jr(this.pp).style.width=o,this.Bm.style.height=a,this.Bm.style.width=o,r?this.Ym(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=AZ(this.ys);this.ts.hr(e);const r=AZ(this.ys);r!==n&&this.zm(r),(s=e.layout)!=null&&s.panes&&this.jm(),this.Hm(),this.Km(e)}Lv(){return this.uv}Ov(){return this.cv}nc(){return this.Wu}Xm(){this.Rm!==null&&(this.Ym(this.Rm,performance.now()),this.Rm=null);const e=this.Zm(null),n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=Jr(n.getContext("2d"));return this.Zm(r),n}Gm(e){return e==="left"&&!this.Jm()||e==="right"&&!this.Qm()||this.Cm.length===0?0:Jr(e==="left"?this.Cm[0].qv():this.Cm[0].Yv()).Xp()}tw(){return this.ys.autoSize&&this.Vm!==null}Uf(){return this.pp}iw(e){this.Im=e,this.Im?this.Uf().style.setProperty("cursor",e):this.Uf().style.removeProperty("cursor")}sw(){return this.Im}nw(e){return 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=Jr(l==="left"?f.qv():f.Yv()),g=x.Wf();if(e!==null&&x.Ff(e,c,u),u+=g.height,d<this.Cm.length-1){const y=this.ym[d],v=y.Wf();e!==null&&y.Ff(e,c,u),u+=v.height}}};this.Jm()&&(a("left",0),n+=Jr(s.qv()).Wf().width);for(let l=0;l<this.Cm.length;l++){const c=this.Cm[l],u=c.Wf();if(e!==null&&c.Ff(e,n,r),r+=u.height,l<this.Cm.length-1){const d=this.ym[l],f=d.Wf();e!==null&&d.Ff(e,n,r),r+=f.height}}n+=s.Wf().width,this.Qm()&&(a("right",n),n+=Jr(s.Yv()).Wf().width);const o=(l,c,u)=>{Jr(l==="left"?this.Om._m():this.Om.um()).Ff(Jr(e),c,u)};if(this.ys.timeScale.visible){const l=this.Om.Wf();if(e!==null){let c=0;this.Jm()&&(o("left",c,r),c=Jr(s.qv()).Wf().width),this.Om.Ff(e,c,r),c+=l.width,this.Qm()&&o("right",c,r)}r+=l.height}return Za({width:n,height:r})}ew(){let e=0,n=0,r=0;for(const C of this.Cm)this.Jm()&&(n=Math.max(n,Jr(C.qv()).qp(),this.ys.leftPriceScale.minimumWidth)),this.Qm()&&(r=Math.max(r,Jr(C.Yv()).qp(),this.ys.rightPriceScale.minimumWidth)),e+=C.ko();n=qse(n),r=qse(r);const s=this.fo,a=this.tl,o=Math.max(s-n-r,0),l=1*this.ym.length,c=this.ys.timeScale.visible;let u=c?Math.max(this.Om.pm(),this.ys.timeScale.minimumHeight):0;var d;u=(d=u)+d%2;const f=l+u,x=a<f?0:a-f,g=x/e;let y=0;const v=window.devicePixelRatio||1;for(let C=0;C<this.Cm.length;++C){const N=this.Cm[C];N.yv(this.ts.$s()[C]);let I=0,P=0;P=C===this.Cm.length-1?Math.ceil((x-y)*v)/v:Math.round(N.ko()*g*v)/v,I=Math.max(P,2),y+=I,N.Kp(Za({width:o,height:I})),this.Jm()&&N.Wv(n,"left"),this.Qm()&&N.Wv(r,"right"),N.Xf()&&this.ts.ec(N.Xf(),I)}this.Om.fm(Za({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 E5n?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 _fe(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 y5n(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 Rz?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 AZ(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function T5n(t){return t.open===void 0&&t.value===void 0}function I5n(t){return function(e){return e.open!==void 0}(t)||function(e){return e.value!==void 0}(t)}function K8e(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 P5n(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 F5n(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 O5n(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 M5n(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 R5n(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 D7(t){return t.Ft!==void 0}function Y8e(t,e){return e.customValues!==void 0&&(t.bw=e.customValues),t}function $v(t){return(e,n,r,s,a,o)=>function(l,c){return c?c(l):T5n(l)}(r,o)?Y8e({wt:e,Re:n,dw:s},r):Y8e(t(e,n,r,s,a),r)}function X8e(t){return{Candlestick:$v(M5n),Bar:$v(O5n),Area:$v(P5n),Baseline:$v(F5n),Histogram:$v(K8e),Line:$v(K8e),Custom:$v(R5n)}[t]}function Q8e(t){return{Re:0,Sw:new Map,Hh:t}}function Z8e(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 J8e(t){let e;return t.forEach(n=>{e===void 0&&(e=n.dw)}),vf(e)}class L5n{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=X8e(e.Rr()),f=e.da(),x=e.pa();o=n.map((g,y)=>{const v=u(g.time),C=this.i_.key(v);let N=this.yw.get(C);N===void 0&&(N=Q8e(v),this.yw.set(C,N),s=!0);const I=d(v,N.Re,g,c[y],f,x);return N.Sw.set(e,I),I})}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:J8e(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=Z8e(c,d),x=Z8e(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=Q8e(a),this.yw.set(this.i_.key(a),l));const u=X8e(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:D7(x),Aw:r};if(!c)return this.Bw(e,-1,g);const y={timeWeight:0,time:l.Hh,pointData:l,originalTime:J8e(l.Sw)},v=Aj(this.Tw,this.i_.key(y.time),(C,N)=>this.i_.key(C.time)<N);this.Tw.splice(v,0,y);for(let C=v;C<this.Tw.length;++C)_Z(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)?D7(n)&&r.push(n):D7(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=Aj(s,r,(o,l)=>o.Re<l);D7(n)?s[a]=n:s.splice(a,1)}Vw(e,n){n.length!==0?(this.kw.set(e,n.filter(D7)),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,_Z(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)_Z(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 _Z(t,e){t.Re=e,t.Sw.forEach(n=>{n.Re=e})}function D5n(t,e){return t.wt<e}function B5n(t,e){return e<t.wt}function $5n(t,e,n){const r=e.Uh(),s=e.bi(),a=Aj(t,r,D5n),o=vKe(t,s,B5n);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 _Ke{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=$5n(this.qw,r,this.jw),this.tg(e,n,s.Ft),this.ig())}}class U5n{constructor(e,n){this.sg=e,this.Yi=n}nt(e,n,r){this.sg.draw(e,this.Yi,n,r)}}class z5n extends _Ke{constructor(e,n,r){super(e,n,!1),this.sh=r,this.Xw=new U5n(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,Vse(this.Yw))}ig(){this.sh.update({bars:this.qw.map(H5n),barSpacing:this.Qn.At().lu(),visibleRange:this.Yw},this.Jn.N())}}function H5n(t){return{x:t._t,time:t.wt,originalData:t.ng,barColor:t.cr}}const V5n={color:"#2196f3"},W5n=(t,e,n)=>{const r=Fy(n);return new z5n(t,e,r)};function kfe(t){const e={value:t.Ft[3],time:t.dw};return t.bw!==void 0&&(e.customValues=t.bw),e}function eAe(t){const e=kfe(t);return t.R!==void 0&&(e.color=t.R),e}function q5n(t){const e=kfe(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 G5n(t){const e=kfe(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 EKe(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 K5n(t){const e=EKe(t);return t.R!==void 0&&(e.color=t.R),e}function Y5n(t){const e=EKe(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 Yse(t){return{Area:q5n,Line:eAe,Baseline:G5n,Histogram:eAe,Bar:K5n,Candlestick:Y5n,Custom:X5n}[t]}function X5n(t){const e=t.dw;return{...t.se,time:e}}const Q5n={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},Z5n={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},J5n={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:hKe,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},EZ={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},e6n={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 tAe(){return{width:0,height:0,autoSize:!1,layout:J5n,crosshair:Q5n,grid:Z5n,overlayPriceScales:{...EZ},leftPriceScale:{...EZ,visible:!1},rightPriceScale:{...EZ,visible:!0},timeScale:e6n,localization:{locale:_j?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 kKe{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 Oz(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 Jr(this.Df.Qt().tc(this.eg,this.rg)).Wt}}class t6n{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 kKe(this.Df,e,this.paneIndex())}}const n6n={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class nAe{constructor(e){this.ir=e}applyOptions(e){this.ir.hr(e)}options(){return this.ir.N()}lg(){return this.ir}}class r6n{constructor(e,n,r,s,a,o){this.og=new El,this.Jn=e,this._g=n,this.ug=r,this.i_=a,this.ag=s,this.cg=o}m(){this.og.m()}priceFormatter(){return this.Jn.ra()}priceToCoordinate(e){const n=this.Jn.zt();return n===null?null:this.Jn.Wt().Nt(e,n.Ft)}coordinateToPrice(e){const n=this.Jn.zt();return n===null?null:this.Jn.Wt().Ts(e,n.Ft)}barsInLogicalRange(e){if(e===null)return null;const n=new V4(new t_(e.from,e.to)).w_(),r=this.Jn.Xs();if(r.Ki())return null;const s=r.Wr(n.Uh(),1),a=r.Wr(n.bi(),-1),o=Jr(r.Lr()),l=Jr(r.Ks());if(s!==null&&a!==null&&s.Re>a.Re)return{barsBefore:e.from-o,barsAfter:l-e.to};const c={barsBefore:s===null||s.Re===o?e.from-o:s.Re-o,barsAfter:a===null||a.Re===l?l-e.to:l-a.Re};return s!==null&&a!==null&&(c.from=s.dw,c.to=a.dw),c}setData(e){this.i_,this.Jn.Rr(),this._g.dg(this.Jn,e),this.fg("full")}update(e,n=!1){this.Jn.Rr(),this._g.pg(this.Jn,e,n),this.fg("update")}dataByIndex(e,n){const r=this.Jn.Xs().Wr(e,n);return r===null?null:Yse(this.seriesType())(r)}data(){const e=Yse(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 Yg(this.Jn.N())}priceScale(){return this.ug.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(e){const n=nh(Yg(n6n),e),r=this.Jn.Oh(n);return new nAe(r)}removePriceLine(e){this.Jn.Nh(e.lg())}priceLines(){return this.Jn.Wh().map(e=>new nAe(e))}seriesType(){return this.Jn.Rr()}attachPrimitive(e){this.Jn.ua(e),e.attached&&e.attached({chart:this.ag,series:this,requestUpdate:()=>this.Jn.Qt().Bh(),horzScaleBehavior:this.i_})}detachPrimitive(e){this.Jn.ca(e),e.detached&&e.detached(),this.Jn.Qt().Bh()}getPane(){const e=this.Jn,n=Jr(this.Jn.Qt().Hn(e));return this.cg(n)}moveToPane(e){this.Jn.Qt().Rc(this.Jn,e)}seriesOrder(){const e=this.Jn.Qt().Hn(this.Jn);return e===null?-1:e.Do().indexOf(this.Jn)}setSeriesOrder(e){const n=this.Jn.Qt().Hn(this.Jn);n!==null&&n.qo(this.Jn,e)}fg(e){this.og.v()&&this.og.p(e)}}class s6n{constructor(e,n,r){this.vg=new El,this.T_=new El,this.rm=new El,this.ts=e,this.uh=e.At(),this.Om=n,this.uh.Su().i(this.mg.bind(this)),this.uh.xu().i(this.wg.bind(this)),this.Om.dm().i(this.gg.bind(this)),this.i_=r}m(){this.uh.Su().u(this),this.uh.xu().u(this),this.Om.dm().u(this),this.vg.m(),this.T_.m(),this.rm.m()}scrollPosition(){return this.uh._u()}scrollToPosition(e,n){n?this.uh.gu(e,1e3):this.ts.fn(e)}scrollToRealTime(){this.uh.wu()}getVisibleRange(){const e=this.uh.K_();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const n={from:this.i_.convertHorzItemToInternal(e.from),to:this.i_.convertHorzItemToInternal(e.to)},r=this.uh.J_(n);this.ts.Pc(r)}getVisibleLogicalRange(){const e=this.uh.j_();return e===null?null:{from:e.Uh(),to:e.bi()}}setVisibleLogicalRange(e){Fu(e.from<=e.to,"The from index cannot be after the to index."),this.ts.Pc(e)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.ku()}logicalToCoordinate(e){const n=this.ts.At();return n.Ki()?null:n.qt(e)}coordinateToLogical(e){return this.uh.Ki()?null:this.uh.nu(e)}timeToIndex(e,n){const r=this.i_.convertHorzItemToInternal(e);return this.uh.U_(r,n)}timeToCoordinate(e){const n=this.timeToIndex(e,!1);return n===null?null:this.uh.qt(n)}coordinateToTime(e){const n=this.ts.At(),r=n.nu(e),s=n.ss(r);return s===null?null:s.originalTime}width(){return this.Om.Nf().width}height(){return this.Om.Nf().height}subscribeVisibleTimeRangeChange(e){this.vg.i(e)}unsubscribeVisibleTimeRangeChange(e){this.vg._(e)}subscribeVisibleLogicalRangeChange(e){this.T_.i(e)}unsubscribeVisibleLogicalRangeChange(e){this.T_._(e)}subscribeSizeChange(e){this.rm.i(e)}unsubscribeSizeChange(e){this.rm._(e)}applyOptions(e){this.uh.hr(e)}options(){return{...Yg(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 i6n(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 rAe(t){return function(e){if(iO(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;iO(r)&&(e.handleScale.axisPressedMouseMove={time:r,price:r}),iO(s)&&(e.handleScale.axisDoubleClickReset={time:s,price:s})}const n=e.handleScroll;iO(n)&&(e.handleScroll={horzTouchDrag:n,vertTouchDrag:n,mouseWheel:n,pressedMouseMove:n})}(t),t}class a6n{constructor(e,n,r){this.Mg=new Map,this.bg=new Map,this.Sg=new El,this.xg=new El,this.Cg=new El,this.zu=new WeakMap,this.yg=new L5n(n);const s=r===void 0?Yg(tAe()):nh(Yg(tAe()),rAe(r));this.kg=n,this.Df=new k5n(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 s6n(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:{...V5n,...a.defaultOptions()},Rg:W5n,Dg:a}))(Fy(e));return this.Vg(s,n,r)}addSeries(e,n={},r=0){return this.Vg(e,n,r)}removeSeries(e){const n=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 kKe(this.Df,e,n)}timeScale(){return this.Tg}applyOptions(e){this.Df.hr(rAe(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),i6n(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(Yg(dKe),Yg(e.defaultOptions),n),a=e.Rg,o=new Rz(this.Df.Qt(),e.type,s,a,e.Dg);this.Df.Qt().xc(o,r);const l=new r6n(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=Yse(o)(s);if(o!=="Custom")Fu(I5n(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 t6n(this.Df,r=>this.Ag(r),e,this),this.zu.set(e,n)),n}}function o6n(t){if(hI(t)){const e=document.getElementById(t);return Fu(e!==null,`Cannot find element in DOM with id=${t}`),e}return t}function l6n(t,e,n){const r=o6n(t),s=new a6n(r,e,n);return e.setOptions(s.options()),s}function c6n(t,e){return l6n(t,new $8e,$8e.Xc(e))}class TKe extends _Ke{constructor(e,n){super(e,n,!0)}tg(e,n,r){n.su(this.qw,Vse(this.Yw)),e.Hl(this.qw,r,Vse(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 u6n(t,e,n,r,s,a,o){if(e.length===0||r.from>=e.length||r.to<=0)return;const{context:l,horizontalPixelRatio:c,verticalPixelRatio:u}=t,d=e[r.from];let f=a(t,d),x=d;if(r.to-r.from<2){const g=s/2;l.beginPath();const y={_t:d._t-g,ut:d.ut},v={_t:d._t+g,ut:d.ut};l.moveTo(y._t*c,y.ut*u),l.lineTo(v._t*c,v.ut*u),o(t,f,y,v)}else{const g=(v,C)=>{o(t,f,x,C),l.beginPath(),f=v,x=C};let y=x;l.beginPath(),l.moveTo(d._t*c,d.ut*u);for(let v=r.from+1;v<r.to;++v){y=e[v];const C=a(t,y);switch(n){case 0:l.lineTo(y._t*c,y.ut*u);break;case 1:l.lineTo(y._t*c,e[v-1].ut*u),C!==f&&(g(C,y),l.lineTo(y._t*c,e[v-1].ut*u)),l.lineTo(y._t*c,y.ut*u);break;case 2:{const[N,I]=d6n(e,v-1,v);l.bezierCurveTo(N._t*c,N.ut*u,I._t*c,I.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 sAe=6;function kZ(t,e){return{_t:t._t-e._t,ut:t.ut-e.ut}}function iAe(t,e){return{_t:t._t/e,ut:t.ut/e}}function d6n(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=iAe(kZ(t[n],t[r]),sAe),{_t:a._t+o._t,ut:a.ut+o.ut}),kZ(t[n],iAe(kZ(t[s],t[e]),sAe))]}function f6n(t,e){const n=t.context;n.strokeStyle=e,n.stroke()}class h6n extends X5{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,Nj(u,l),u.lineJoin="round";const d=this.Wg.bind(this);a!==void 0&&u6n(e,n,a,r,s,d,f6n),c&&function(f,x,g,y,v){if(y.to-y.from<=0)return;const{horizontalPixelRatio:C,verticalPixelRatio:N,context:I}=f;let P=null;const M=Math.max(1,Math.floor(C))%2/2,F=g*N+M;for(let $=y.to-1;$>=y.from;--$){const L=x[$];if(L){const z=v(f,L);z!==P&&(I.beginPath(),P!==null&&I.fill(),I.fillStyle=z,P=z);const Q=Math.round(L._t*C)+M,se=L.ut*N;I.moveTo(Q,se),I.arc(Q,se,F,0,2*Math.PI)}}I.fill()}(e,n,c,r,d)}}class p6n extends h6n{Wg(e,n){return n.vt}}class m6n extends TKe{constructor(){super(...arguments),this.Xw=new p6n}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 x6n={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 m6n(t,e)};class g6n extends X5{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 b6n extends TKe{constructor(){super(...arguments),this.Xw=new g6n}zg(e,n,r){return{...this.Eg(e,n),...r.Dr(e)}}ig(){const e={ot:this.qw,lu:this.Qn.At().lu(),lt:this.Yw,xM:this.Jn.Wt().Nt(this.Jn.N().base,Jr(this.Jn.zt()).Ft)};this.Xw.ht(e)}}const y6n={type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Rg:(t,e)=>new b6n(t,e)};({...dKe});const v6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_rate_history/",w6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",aAe={ext:"extended",lit:"lighter",hyp:"hyperliquid",var:"variational",ast:"aster",par:"paradex"},oAe={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},$C={extended:"Extended",lighter:"Lighter",hyperliquid:"Hyperliquid",variational:"Variational",aster:"Aster",paradex:"Paradex"},Xse=[{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"}],fO=({exchangeId:t,className:e="w-4 h-4"})=>{const n=Xse.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:uT,alt:n.name,className:`${e} rounded`});case"lighter":return i.jsx(yf,{className:e});case"hyperliquid":return i.jsx("img",{src:bae,alt:n.name,className:e});case"aster":return i.jsx(Uj,{className:e});case"paradex":return i.jsx("img",{src:dT,alt:n.name,className:`${e} rounded`});default:return null}},C6n=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}):"",S6n=()=>{const{pair:t}=g2(),e=Ao(),[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,N]=h.useState(!1),[I,P]=h.useState(!1),M=h.useRef(null),F=h.useRef(null),$=h.useRef(null),L=Ie.useMemo(()=>{if(!t)return null;const K=t.toLowerCase().split("-");if(K.length<3)return null;const re=K[0],de=K[1],G=K.slice(2).join("-").toUpperCase(),ie=aAe[re],ae=aAe[de];return!ie||!ae?null:{longSide:ie,shortSide:ae,ticker:G}},[t]);h.useEffect(()=>{const K=re=>{M.current&&!M.current.contains(re.target)&&v(!1),F.current&&!F.current.contains(re.target)&&N(!1),$.current&&!$.current.contains(re.target)&&P(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const z=(K,re,de)=>{const G=oAe[K],ie=oAe[re];e(`/funding-history/${G}-${ie}-${de.toLowerCase()}`)},Q=()=>{L&&z(L.shortSide,L.longSide,L.ticker)};h.useEffect(()=>{if(!L){l("Invalid URL parameters"),a(!1);return}(async()=>{try{a(!0);const de=await(await fetch(v6n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({long_side:L.longSide,short_side:L.shortSide,ticker:L.ticker})})).json();if(de.success&&Array.isArray(de.data)){const G=[...de.data].sort((ie,ae)=>Number(ie.timestamp)-Number(ae.timestamp));r(G),l(null)}else l("Failed to fetch funding history data")}catch(re){l(re.message||"Failed to fetch data")}finally{a(!1)}})()},[L]),h.useEffect(()=>{if(!L)return;const K=async()=>{var de,G;try{const ae=await(await fetch(w6n)).json();if(ae.success&&Array.isArray(ae.data)){const q=ae.data.map(ne=>ne.ticker).sort();f(q);const W=ae.data.find(ne=>ne.ticker===L.ticker);if(W){const ne=(de=W.marketplaces)==null?void 0:de[L.longSide],oe=(G=W.marketplaces)==null?void 0:G[L.shortSide];if(ne!=null&&ne.available&&(oe!=null&&oe.available)){const he=parseFloat(ne.hourly_rate)||0,_e=parseFloat(oe.hourly_rate)||0,xe=(_e-he)*8760*100;u({apr:xe,longRate:he*100,shortRate:_e*100,updatedAt:ae.updated_at})}else u(null)}else u(null)}}catch(ie){console.error("Failed to fetch live data:",ie)}};K();const re=setInterval(K,5e3);return()=>clearInterval(re)},[L]),h.useEffect(()=>{if(!x.current||s||o||n.length===0)return;const K=x.current,re=c6n(K,{layout:{background:{color:"#0f0f0f"},textColor:"#9ca3af",fontFamily:"system-ui, -apple-system, sans-serif"},grid:{vertLines:{color:"rgba(255, 255, 255, 0.02)"},horzLines:{color:"rgba(255, 255, 255, 0.02)"}},crosshair:{mode:1,vertLine:{color:"rgba(255, 255, 255, 0.1)",width:1,style:0,labelBackgroundColor:"#262626"},horzLine:{color:"rgba(255, 255, 255, 0.1)",width:1,style:0,labelBackgroundColor:"#262626"}},rightPriceScale:{borderVisible:!1},timeScale:{borderVisible:!1,visible:!0,timeVisible:!0,secondsVisible:!1},autoSize:!0,localization:{locale:"en-US",timeFormatter:q=>{const W=new Date(q*1e3);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(W)},priceFormatter:q=>`${q.toFixed(2)}%`}});g.current=re;const de=re.addSeries(y6n,{priceFormat:{type:"custom",formatter:q=>`${q.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!1}),G=n.map(q=>({time:Number(q.timestamp),value:q.total_apr,color:q.total_apr>=0?"rgba(52, 211, 153, 0.6)":"rgba(248, 113, 113, 0.6)"}));de.setData(G);const ie=re.addSeries(x6n,{color:"#9ca3af",lineWidth:1.5,priceFormat:{type:"custom",formatter:q=>`${q.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBackgroundColor:"#ffffff",crosshairMarkerBorderColor:"#0f0f0f"}),ae=n.map(q=>({time:Number(q.timestamp),value:q.total_apr}));return ie.setData(ae),re.priceScale("right").applyOptions({borderColor:"transparent",scaleMargins:{top:.1,bottom:.1}}),re.timeScale().applyOptions({borderColor:"transparent",rightOffset:12,barSpacing:10,minBarSpacing:3,fixLeftEdge:!1,tickMarkFormatter:q=>new Date(q*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),re.timeScale().fitContent(),()=>{re.remove()}},[n,s,o]);const se=Ie.useMemo(()=>{if(n.length===0)return null;const K=n.map(W=>W.total_apr),re=K.reduce((W,ne)=>W+ne,0)/K.length,de=Math.max(...K),G=Math.min(...K),ie=K[K.length-1],ae=K.filter(W=>W>0).length,q=K.filter(W=>W<0).length;return{avg:re,max:de,min:G,latest:ie,positive:ae,negative:q,total:K.length}},[n]);if(!L)return i.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[calc(100vh-5rem)] px-4 bg-[#0a0a0a]",children:[i.jsx("p",{className:"text-neutral-400 text-base mb-4",children:"Invalid URL format"}),i.jsx(Po,{to:"/funding",className:"text-neutral-300 hover:text-white transition-colors text-sm",children:"← Back to Funding Rates"})]});const ee=Ie.useMemo(()=>{if(n.length===0)return null;const K=new Date(Number(n[0].timestamp)*1e3),re=new Date(Number(n[n.length-1].timestamp)*1e3);return{start:K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),end:re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}},[n]);return i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{children:[i.jsxs("title",{children:[L.ticker," Funding History -"," ",$C[L.longSide]," /"," ",$C[L.shortSide]," - Dextrabot"]}),i.jsx("meta",{name:"description",content:`Historical funding rate arbitrage APR for ${L.ticker} between ${$C[L.longSide]} and ${$C[L.shortSide]}`})]})}),i.jsxs("div",{className:"flex flex-col w-full h-[calc(100vh-5rem)] bg-[#0a0a0a]",children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(Po,{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(zcn,{className:"w-3 h-3"}),i.jsx("span",{children:"Back"})]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${L.ticker}.svg`,alt:L.ticker,className:"w-5 h-5 rounded-full",onError:K=>{K.target.style.display="none"}}),i.jsxs("h1",{className:"text-sm text-white tracking-wide",children:[L.ticker,i.jsx("span",{className:"text-gray-400 ml-1.5",children:"Funding History"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[ee&&i.jsxs("span",{className:"text-gray-400 text-[10px]",children:[ee.start," — ",ee.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 ",C6n(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:()=>P(!I),className:"w-full rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5 text-left hover:border-neutral-600 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${L.ticker}.svg`,alt:L.ticker,className:"w-5 h-5 rounded-full",onError:K=>{K.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:L.ticker})]}),i.jsx(W9,{className:`w-4 h-4 text-gray-400 transition-transform ${I?"rotate-180":""}`})]})}),I&&i.jsx("div",{className:"absolute left-0 right-0 mt-1 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 max-h-60 overflow-y-auto",children:d.map(K=>i.jsxs("button",{onClick:()=>{z(L.longSide,L.shortSide,K),P(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K===L.ticker?"bg-neutral-800":""}`,children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${K}.svg`,alt:K,className:"w-5 h-5 rounded-full",onError:re=>{re.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:K})]},K))})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),i.jsxs("div",{className:"relative",ref:M,children:[i.jsx("button",{onClick:()=>v(!y),className:"w-full rounded-lg border border-emerald-800 bg-emerald-950 p-4 text-left hover:border-emerald-700 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500"}),i.jsx("span",{className:"text-emerald-400 text-[10px] uppercase tracking-widest",children:"Long Position"})]}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(fO,{exchangeId:L.longSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:$C[L.longSide]})]}),c&&i.jsxs("p",{className:"text-emerald-400 text-xs mt-2 tabular-nums",children:[c.longRate>=0?"+":"",c.longRate.toFixed(4),"%/h"]})]}),i.jsx(W9,{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:Xse.filter(K=>K.id!==L.shortSide).map(K=>i.jsxs("button",{onClick:()=>{z(K.id,L.shortSide,L.ticker),v(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K.id===L.longSide?"bg-neutral-800":""}`,children:[i.jsx(fO,{exchangeId:K.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:K.name})]},K.id))})]}),i.jsx("div",{className:"flex justify-center",children:i.jsx("button",{onClick:Q,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(Vcn,{className:"w-4 h-4 text-gray-400 rotate-90"})})}),i.jsxs("div",{className:"relative",ref:F,children:[i.jsx("button",{onClick:()=>N(!C),className:"w-full rounded-lg border border-red-800 bg-red-950 p-4 text-left hover:border-red-700 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsx("span",{className:"text-red-400 text-[10px] uppercase tracking-widest",children:"Short Position"})]}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(fO,{exchangeId:L.shortSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:$C[L.shortSide]})]}),c&&i.jsxs("p",{className:"text-red-400 text-xs mt-2 tabular-nums",children:[c.shortRate>=0?"+":"",c.shortRate.toFixed(4),"%/h"]})]}),i.jsx(W9,{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:Xse.filter(K=>K.id!==L.longSide).map(K=>i.jsxs("button",{onClick:()=>{z(L.longSide,K.id,L.ticker),N(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K.id===L.shortSide?"bg-neutral-800":""}`,children:[i.jsx(fO,{exchangeId:K.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:K.name})]},K.id))})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),i.jsx("span",{className:"text-gray-400 text-[10px] uppercase tracking-widest",children:"Live APR"})]}),c?i.jsxs("p",{className:`text-3xl tabular-nums ${c.apr>=0?"text-emerald-400":"text-red-400"}`,children:[c.apr>=0?"+":"",c.apr.toFixed(2),i.jsx("span",{className:"text-xl text-gray-400",children:"%"})]}):i.jsx("p",{className:"text-3xl text-gray-500",children:"—"})]}),se&&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 ${se.avg>=0?"text-emerald-400":"text-red-400"}`,children:[se.avg>=0?"+":"",se.avg.toFixed(2),i.jsx("span",{className:"text-xl text-gray-400",children:"%"})]})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),se&&!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 ${se.latest>=0?"text-emerald-400":"text-red-400"}`,children:[se.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:[se.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:[se.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:[(se.positive/se.total*100).toFixed(0),"%"]})]})]}),!s&&!o&&n.length>0&&i.jsx("div",{className:"mt-4 text-center",children:i.jsxs("p",{className:"text-gray-500 text-[10px] tabular-nums",children:[n.length," data points"]})})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"flex items-center justify-between px-5 py-3 border-b border-neutral-800",children:i.jsx("p",{className:"text-gray-400 text-xs tracking-wide",children:"Historical APR"})}),i.jsx("div",{className:"flex-1 bg-[#0f0f0f] min-h-0 pb-6",children:L&&(L.longSide==="variational"||L.longSide==="paradex"||L.shortSide==="variational"||L.shortSide==="paradex")?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-white text-sm",children:"Funding history is not yet available for Paradex & Variational."})}):s?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("div",{className:"w-5 h-5 border border-neutral-700 border-t-white rounded-full animate-spin"})}):o?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-gray-400 text-xs",children:o})}):n.length===0?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-gray-400 text-xs",children:"No historical data available"})}):i.jsx("div",{ref:x,className:"w-full h-full",style:{minHeight:"300px"}})})]})]})]})]})},N6n=()=>{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(Yr),{address:f}=es(),[x,g]=h.useState(1),[y,v]=h.useState(""),[C,N]=h.useState(!1),[I,P]=h.useState(!1),[M,F]=h.useState(""),[$,L]=h.useState(0),[z,Q]=h.useState(0),[se,ee]=h.useState(!1),[K,re]=h.useState(!1),de=_e=>/^\d*$/.test(_e),G=_e=>{["e","E","+","-"].includes(_e.key)&&_e.preventDefault()},ie=h.useMemo(()=>{if(x==="")return!1;const _e=Number(x);return Number.isInteger(_e)&&_e>=1},[x]),ae=h.useRef($);h.useEffect(()=>{ae.current=$},[$]);const q=h.useRef(0);h.useEffect(()=>{q.current=z},[z]);const W=async()=>{var Se,ge;const _e=window.localStorage.getItem("hyperToken"),xe=window.localStorage.getItem("hyperAddress");if(!(!_e||!xe))try{re(!0);const Ce=await vi(xe.toLowerCase(),_e);Ce!=null&&Ce.success?(e(Ce==null?void 0:Ce.telegram_chat_id),n(Ce==null?void 0:Ce.subscriber_role),r(Ce==null?void 0:Ce.subs_expire_day),s((Se=Ce==null?void 0:Ce.mushboomer_counts)==null?void 0:Se.eth),a((ge=Ce==null?void 0:Ce.mushboomer_counts)==null?void 0:ge.sol),o(Ce==null?void 0:Ce.referral_code),l(Ce==null?void 0:Ce.refcode),c(Ce==null?void 0:Ce.whitelist),u(_e),d(xe),L(Number((Ce==null?void 0:Ce.subs_expire_day)||0)),re(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),re(!1))}catch(Ce){console.error("Token verification error:",Ce),console.error(Ce.message||"An unknown error occurred."),re(!1)}};h.useEffect(()=>{se&&W()},[se]),h.useEffect(()=>{const _e=localStorage.getItem("hyperToken"),xe=localStorage.getItem("hyperAddress");ee(!!(_e&&xe));const Se=setInterval(()=>{const ge=localStorage.getItem("hyperToken"),Ce=localStorage.getItem("hyperAddress");ee(!!(ge&&Ce))},800);return()=>clearInterval(Se)},[]);const ne=async()=>new kl(window.ethereum).eth.getAccounts(xe=>xe),oe=async(_e="subscribe",xe=24,Se=5e3)=>{xe<=0||(await new Promise(ge=>setTimeout(ge,Se)),await W(),_e==="subscribe"&&ae.current===q.current?oe(_e,xe-1,Se):W())},he=async _e=>{const xe=window.localStorage.getItem("hyperToken"),Se=window.localStorage.getItem("hyperAddress");if(!xe||!f){t(!0);return}v(""),Q(ae.current),q.current=ae.current,P(!0),N(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(je){console.error("Failed to switch network",je),N(!1);return}const ge=new kl(window.ethereum);var Ce=await ne();if(Ce.length>0?Ce=Ce[0]:Ce=void 0,Ce){const Oe=_e*.09,$e=ge.utils.toWei(Oe.toString(),"ether"),Ye={from:Ce,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:$e};await ge.eth.sendTransaction(Ye).then(Je=>{console.log("txHash :>> ",Je),N(!1),F(Je.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():Se,token:xe,payment_tx:Je.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),W(),oe("subscribe")}).catch(Je=>{console.log(Je),Je.code===-32003||Je.message.includes("insufficient funds")?v("Insufficient funds."):Je.message==="MetaMask Tx Signature: User denied transaction signature."&&P(!1)})}else await ge.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[I&&_a.createPortal(i.jsx(_d,{open:I,setOpen:P,transactionHash:M,transactionLoading:C,paymentPresaleRole:!($<=z),errorFunds:y,activeMethod:2}),document.body),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>g(_e=>{const xe=Number(_e||0);return xe>1?String(xe-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:_e=>{const xe=_e.target.value.trim();if(xe==="")return g("");de(xe)&&g(xe)},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(_e=>{const xe=Number(_e||0);return String(xe+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:_e=>{_e.preventDefault(),ie&&he(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"})]})},j6n=({open:t,setOpen:e})=>{const{subsExpireDay:n}=h.useContext(Yr),r=()=>{const s=Date.now(),a=localStorage.getItem("hyperAddress");localStorage.setItem(`lighterCopyTradeDismissedAt_${a}`,s.toString()),e(!1)};return i.jsxs(Ca,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{transition:!0,className:"relative transform overflow-hidden bg-[#161616] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsxs("div",{className:"relative flex flex-col justify-start items-center gap-6 w-full min-h-[420px] p-4 sm:p-12 rounded-3xl max-w-[600px]",children:[i.jsx("button",{onClick:r,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Ki,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(N6n,{})]})})]})})})})]})},A6n=({open:t,setOpen:e})=>{const n=()=>{localStorage.setItem("strategySelectorModalDismissedAt",Date.now().toString()),e(!1)},r=()=>{localStorage.setItem("strategySelectorModalDismissedAt",Date.now().toString())},s=[{key:"hyperGrid",title:"Hyperliquid Grid Bot",desc:"Automated grid trading on Hyperliquid futures.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/terminal/hyperliquid/BTC#gridbot"},{key:"hlMaker",title:"Hyperliquid Market Maker Bot",desc:"Liquidity-providing market making with dynamic spreads.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/market-maker"},{key:"lighterMaker",title:"Lighter DCA Bot",desc:"Automate your DCA entries on Lighter. Coming soon.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),comingSoon:!0},{key:"extendedMaker",title:"Extended DCA Bot",desc:"Advanced market making strategies.",icon:"https://app.extended.exchange/assets/logo/extended.svg",badge:"New",highlighted:!0,url:"/dca-bot"},{key:"lighterGrid",title:"Lighter Grid Bot",desc:"Automated grid trading on Lighter futures.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/terminal/lighter/BTC#gridbot"},{key:"extendedGrid",title:"Extended Grid Bot",desc:"Advanced grid logic with dynamic rebalancing.",icon:"https://app.extended.exchange/assets/logo/extended.svg",url:"/terminal/extended/BTC#gridbot",badge:"New",highlighted:!0},{key:"hlCopyTrade",title:"Hyperliquid Copy Trade",desc:"Automatically copy trade best Hyperliquid wallets.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/discover-wallets"},{key:"lgCopyTrade",title:"Lighter Copy Trade",desc:"Automatically copy trade best Hyperliquid wallets on Lighter.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/discover-wallets"},{key:"lgDelta",title:"Lighter Delta Neutral",desc:"Delta-neutral farming on Lighter.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/discover-wallets#lighter-farming"},{key:"asterBot",title:"Aster Farming Bot",desc:"Farm points on Aster exchange.",icon:i.jsx(Uj,{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:uT,url:"/discover-wallets#variational-farming"},{key:"paradexBot",title:"Paradex Farming Bot",desc:"Farm points on Paradex exchange.",icon:dT,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:yae,url:"/discover-wallets#apex-farming"}],a=o=>{if(!o)return null;if(Ie.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(Ca,{open:t,onClose:n,className:"relative z-50",children:[i.jsx(wa,{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(xa,{className:"relative w-full max-w-[780px] max-h-[76vh] sm:max-h-[96vh] rounded-t-[28px] sm:rounded-[28px] border border-white/5 bg-gradient-to-b from-[#191919] via-[#141414] to-[#111111] p-4 sm:py-3 sm:px-6 shadow-[0_22px_60px_rgba(0,0,0,0.9)] overflow-y-auto",children:[i.jsx("button",{onClick:n,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{src:Ua,alt:"close",className:"w-4 h-4"})}),i.jsx("h2",{className:"text-white text-[20px] sm:text-[26px] font-extrabold text-center mb-3 sm:mb-4 tracking-tight",children:"What brings you here?"}),i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5",children:s==null?void 0:s.map(o=>i.jsxs("div",{onClick:()=>{o.url&&(o.url.startsWith("/"),window.open(o.url,"_blank"),r())},className:`relative rounded-2xl p-2.5 transition ${o.highlighted&&!o.comingSoon?"bg-[#111827] border border-[#1c2741] hover:bg-[#202020]":o.highlighted&&o.comingSoon?"bg-[#6B5CFF14] border border-[#6B5CFF59]":"bg-[#181818] border border-[#2a2a2a] hover:bg-[#202020]"} ${o.comingSoon?"cursor-not-allowed":"cursor-pointer"}`,children:[o.badge&&!o.comingSoon&&i.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 z-10",children:i.jsx("div",{className:"px-1 sm:px-2.5 py-0.5 rounded-md text-[9px] sm:text-[10px] font-bold bg-[#3b82f6] text-white shadow-md min-w-max",children:o.badge})}),o.badge&&o.comingSoon&&i.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 z-10",children:i.jsx("div",{className:"px-1.5 sm:px-2.5 py-0.5 rounded-md text-[9px] sm:text-[10px] font-bold bg-[#6B5CFF] text-white shadow-md min-w-max",children:o.badge})}),i.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-black/20 text-2xl",children:a(o.icon)}),i.jsx("div",{className:"text-white font-semibold text-sm",children:o.title}),o.desc&&i.jsx("div",{className:"text-[#9b9b9b] text-[11px] leading-tight",children:o.desc})]})]},o.key))})})]})})]})},_6n=({open:t,setOpen:e})=>null,E6n=({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(Ca,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(wa,{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(xa,{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:Ua})})}),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:Ki,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 k6n(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 TZ={exports:{}};const T6n={},I6n=Object.freeze(Object.defineProperty({__proto__:null,default:T6n},Symbol.toStringTag,{value:"Module"})),P6n=sQe(I6n);var lAe;function F6n(){return lAe||(lAe=1,function(t){(function(e){var n=function(De){var pe,qe=new Float64Array(16);if(De)for(pe=0;pe<De.length;pe++)qe[pe]=De[pe];return qe},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(De,pe,qe,Ae){De[pe]=qe>>24&255,De[pe+1]=qe>>16&255,De[pe+2]=qe>>8&255,De[pe+3]=qe&255,De[pe+4]=Ae>>24&255,De[pe+5]=Ae>>16&255,De[pe+6]=Ae>>8&255,De[pe+7]=Ae&255}function v(De,pe,qe,Ae,ze){var zt,kt=0;for(zt=0;zt<ze;zt++)kt|=De[pe+zt]^qe[Ae+zt];return(1&kt-1>>>8)-1}function C(De,pe,qe,Ae){return v(De,pe,qe,Ae,16)}function N(De,pe,qe,Ae){return v(De,pe,qe,Ae,32)}function I(De,pe,qe,Ae){for(var ze=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,zt=qe[0]&255|(qe[1]&255)<<8|(qe[2]&255)<<16|(qe[3]&255)<<24,kt=qe[4]&255|(qe[5]&255)<<8|(qe[6]&255)<<16|(qe[7]&255)<<24,gt=qe[8]&255|(qe[9]&255)<<8|(qe[10]&255)<<16|(qe[11]&255)<<24,Mt=qe[12]&255|(qe[13]&255)<<8|(qe[14]&255)<<16|(qe[15]&255)<<24,ln=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,vn=pe[0]&255|(pe[1]&255)<<8|(pe[2]&255)<<16|(pe[3]&255)<<24,Wn=pe[4]&255|(pe[5]&255)<<8|(pe[6]&255)<<16|(pe[7]&255)<<24,On=pe[8]&255|(pe[9]&255)<<8|(pe[10]&255)<<16|(pe[11]&255)<<24,$t=pe[12]&255|(pe[13]&255)<<8|(pe[14]&255)<<16|(pe[15]&255)<<24,Nn=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Fn=qe[16]&255|(qe[17]&255)<<8|(qe[18]&255)<<16|(qe[19]&255)<<24,Tt=qe[20]&255|(qe[21]&255)<<8|(qe[22]&255)<<16|(qe[23]&255)<<24,pn=qe[24]&255|(qe[25]&255)<<8|(qe[26]&255)<<16|(qe[27]&255)<<24,ke=qe[28]&255|(qe[29]&255)<<8|(qe[30]&255)<<16|(qe[31]&255)<<24,m=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,p=ze,S=zt,A=kt,k=gt,T=Mt,D=ln,V=vn,X=Wn,le=On,ce=$t,fe=Nn,ye=Fn,Pe=Tt,Me=pn,Ke=ke,we=m,Te,te=0;te<20;te+=2)Te=p+Pe|0,T^=Te<<7|Te>>>25,Te=T+p|0,le^=Te<<9|Te>>>23,Te=le+T|0,Pe^=Te<<13|Te>>>19,Te=Pe+le|0,p^=Te<<18|Te>>>14,Te=D+S|0,ce^=Te<<7|Te>>>25,Te=ce+D|0,Me^=Te<<9|Te>>>23,Te=Me+ce|0,S^=Te<<13|Te>>>19,Te=S+Me|0,D^=Te<<18|Te>>>14,Te=fe+V|0,Ke^=Te<<7|Te>>>25,Te=Ke+fe|0,A^=Te<<9|Te>>>23,Te=A+Ke|0,V^=Te<<13|Te>>>19,Te=V+A|0,fe^=Te<<18|Te>>>14,Te=we+ye|0,k^=Te<<7|Te>>>25,Te=k+we|0,X^=Te<<9|Te>>>23,Te=X+k|0,ye^=Te<<13|Te>>>19,Te=ye+X|0,we^=Te<<18|Te>>>14,Te=p+k|0,S^=Te<<7|Te>>>25,Te=S+p|0,A^=Te<<9|Te>>>23,Te=A+S|0,k^=Te<<13|Te>>>19,Te=k+A|0,p^=Te<<18|Te>>>14,Te=D+T|0,V^=Te<<7|Te>>>25,Te=V+D|0,X^=Te<<9|Te>>>23,Te=X+V|0,T^=Te<<13|Te>>>19,Te=T+X|0,D^=Te<<18|Te>>>14,Te=fe+ce|0,ye^=Te<<7|Te>>>25,Te=ye+fe|0,le^=Te<<9|Te>>>23,Te=le+ye|0,ce^=Te<<13|Te>>>19,Te=ce+le|0,fe^=Te<<18|Te>>>14,Te=we+Ke|0,Pe^=Te<<7|Te>>>25,Te=Pe+we|0,Me^=Te<<9|Te>>>23,Te=Me+Pe|0,Ke^=Te<<13|Te>>>19,Te=Ke+Me|0,we^=Te<<18|Te>>>14;p=p+ze|0,S=S+zt|0,A=A+kt|0,k=k+gt|0,T=T+Mt|0,D=D+ln|0,V=V+vn|0,X=X+Wn|0,le=le+On|0,ce=ce+$t|0,fe=fe+Nn|0,ye=ye+Fn|0,Pe=Pe+Tt|0,Me=Me+pn|0,Ke=Ke+ke|0,we=we+m|0,De[0]=p>>>0&255,De[1]=p>>>8&255,De[2]=p>>>16&255,De[3]=p>>>24&255,De[4]=S>>>0&255,De[5]=S>>>8&255,De[6]=S>>>16&255,De[7]=S>>>24&255,De[8]=A>>>0&255,De[9]=A>>>8&255,De[10]=A>>>16&255,De[11]=A>>>24&255,De[12]=k>>>0&255,De[13]=k>>>8&255,De[14]=k>>>16&255,De[15]=k>>>24&255,De[16]=T>>>0&255,De[17]=T>>>8&255,De[18]=T>>>16&255,De[19]=T>>>24&255,De[20]=D>>>0&255,De[21]=D>>>8&255,De[22]=D>>>16&255,De[23]=D>>>24&255,De[24]=V>>>0&255,De[25]=V>>>8&255,De[26]=V>>>16&255,De[27]=V>>>24&255,De[28]=X>>>0&255,De[29]=X>>>8&255,De[30]=X>>>16&255,De[31]=X>>>24&255,De[32]=le>>>0&255,De[33]=le>>>8&255,De[34]=le>>>16&255,De[35]=le>>>24&255,De[36]=ce>>>0&255,De[37]=ce>>>8&255,De[38]=ce>>>16&255,De[39]=ce>>>24&255,De[40]=fe>>>0&255,De[41]=fe>>>8&255,De[42]=fe>>>16&255,De[43]=fe>>>24&255,De[44]=ye>>>0&255,De[45]=ye>>>8&255,De[46]=ye>>>16&255,De[47]=ye>>>24&255,De[48]=Pe>>>0&255,De[49]=Pe>>>8&255,De[50]=Pe>>>16&255,De[51]=Pe>>>24&255,De[52]=Me>>>0&255,De[53]=Me>>>8&255,De[54]=Me>>>16&255,De[55]=Me>>>24&255,De[56]=Ke>>>0&255,De[57]=Ke>>>8&255,De[58]=Ke>>>16&255,De[59]=Ke>>>24&255,De[60]=we>>>0&255,De[61]=we>>>8&255,De[62]=we>>>16&255,De[63]=we>>>24&255}function P(De,pe,qe,Ae){for(var ze=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,zt=qe[0]&255|(qe[1]&255)<<8|(qe[2]&255)<<16|(qe[3]&255)<<24,kt=qe[4]&255|(qe[5]&255)<<8|(qe[6]&255)<<16|(qe[7]&255)<<24,gt=qe[8]&255|(qe[9]&255)<<8|(qe[10]&255)<<16|(qe[11]&255)<<24,Mt=qe[12]&255|(qe[13]&255)<<8|(qe[14]&255)<<16|(qe[15]&255)<<24,ln=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,vn=pe[0]&255|(pe[1]&255)<<8|(pe[2]&255)<<16|(pe[3]&255)<<24,Wn=pe[4]&255|(pe[5]&255)<<8|(pe[6]&255)<<16|(pe[7]&255)<<24,On=pe[8]&255|(pe[9]&255)<<8|(pe[10]&255)<<16|(pe[11]&255)<<24,$t=pe[12]&255|(pe[13]&255)<<8|(pe[14]&255)<<16|(pe[15]&255)<<24,Nn=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Fn=qe[16]&255|(qe[17]&255)<<8|(qe[18]&255)<<16|(qe[19]&255)<<24,Tt=qe[20]&255|(qe[21]&255)<<8|(qe[22]&255)<<16|(qe[23]&255)<<24,pn=qe[24]&255|(qe[25]&255)<<8|(qe[26]&255)<<16|(qe[27]&255)<<24,ke=qe[28]&255|(qe[29]&255)<<8|(qe[30]&255)<<16|(qe[31]&255)<<24,m=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,p=ze,S=zt,A=kt,k=gt,T=Mt,D=ln,V=vn,X=Wn,le=On,ce=$t,fe=Nn,ye=Fn,Pe=Tt,Me=pn,Ke=ke,we=m,Te,te=0;te<20;te+=2)Te=p+Pe|0,T^=Te<<7|Te>>>25,Te=T+p|0,le^=Te<<9|Te>>>23,Te=le+T|0,Pe^=Te<<13|Te>>>19,Te=Pe+le|0,p^=Te<<18|Te>>>14,Te=D+S|0,ce^=Te<<7|Te>>>25,Te=ce+D|0,Me^=Te<<9|Te>>>23,Te=Me+ce|0,S^=Te<<13|Te>>>19,Te=S+Me|0,D^=Te<<18|Te>>>14,Te=fe+V|0,Ke^=Te<<7|Te>>>25,Te=Ke+fe|0,A^=Te<<9|Te>>>23,Te=A+Ke|0,V^=Te<<13|Te>>>19,Te=V+A|0,fe^=Te<<18|Te>>>14,Te=we+ye|0,k^=Te<<7|Te>>>25,Te=k+we|0,X^=Te<<9|Te>>>23,Te=X+k|0,ye^=Te<<13|Te>>>19,Te=ye+X|0,we^=Te<<18|Te>>>14,Te=p+k|0,S^=Te<<7|Te>>>25,Te=S+p|0,A^=Te<<9|Te>>>23,Te=A+S|0,k^=Te<<13|Te>>>19,Te=k+A|0,p^=Te<<18|Te>>>14,Te=D+T|0,V^=Te<<7|Te>>>25,Te=V+D|0,X^=Te<<9|Te>>>23,Te=X+V|0,T^=Te<<13|Te>>>19,Te=T+X|0,D^=Te<<18|Te>>>14,Te=fe+ce|0,ye^=Te<<7|Te>>>25,Te=ye+fe|0,le^=Te<<9|Te>>>23,Te=le+ye|0,ce^=Te<<13|Te>>>19,Te=ce+le|0,fe^=Te<<18|Te>>>14,Te=we+Ke|0,Pe^=Te<<7|Te>>>25,Te=Pe+we|0,Me^=Te<<9|Te>>>23,Te=Me+Pe|0,Ke^=Te<<13|Te>>>19,Te=Ke+Me|0,we^=Te<<18|Te>>>14;De[0]=p>>>0&255,De[1]=p>>>8&255,De[2]=p>>>16&255,De[3]=p>>>24&255,De[4]=D>>>0&255,De[5]=D>>>8&255,De[6]=D>>>16&255,De[7]=D>>>24&255,De[8]=fe>>>0&255,De[9]=fe>>>8&255,De[10]=fe>>>16&255,De[11]=fe>>>24&255,De[12]=we>>>0&255,De[13]=we>>>8&255,De[14]=we>>>16&255,De[15]=we>>>24&255,De[16]=V>>>0&255,De[17]=V>>>8&255,De[18]=V>>>16&255,De[19]=V>>>24&255,De[20]=X>>>0&255,De[21]=X>>>8&255,De[22]=X>>>16&255,De[23]=X>>>24&255,De[24]=le>>>0&255,De[25]=le>>>8&255,De[26]=le>>>16&255,De[27]=le>>>24&255,De[28]=ce>>>0&255,De[29]=ce>>>8&255,De[30]=ce>>>16&255,De[31]=ce>>>24&255}function M(De,pe,qe,Ae){I(De,pe,qe,Ae)}function F(De,pe,qe,Ae){P(De,pe,qe,Ae)}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(De,pe,qe,Ae,ze,zt,kt){var gt=new Uint8Array(16),Mt=new Uint8Array(64),ln,vn;for(vn=0;vn<16;vn++)gt[vn]=0;for(vn=0;vn<8;vn++)gt[vn]=zt[vn];for(;ze>=64;){for(M(Mt,gt,kt,$),vn=0;vn<64;vn++)De[pe+vn]=qe[Ae+vn]^Mt[vn];for(ln=1,vn=8;vn<16;vn++)ln=ln+(gt[vn]&255)|0,gt[vn]=ln&255,ln>>>=8;ze-=64,pe+=64,Ae+=64}if(ze>0)for(M(Mt,gt,kt,$),vn=0;vn<ze;vn++)De[pe+vn]=qe[Ae+vn]^Mt[vn];return 0}function z(De,pe,qe,Ae,ze){var zt=new Uint8Array(16),kt=new Uint8Array(64),gt,Mt;for(Mt=0;Mt<16;Mt++)zt[Mt]=0;for(Mt=0;Mt<8;Mt++)zt[Mt]=Ae[Mt];for(;qe>=64;){for(M(kt,zt,ze,$),Mt=0;Mt<64;Mt++)De[pe+Mt]=kt[Mt];for(gt=1,Mt=8;Mt<16;Mt++)gt=gt+(zt[Mt]&255)|0,zt[Mt]=gt&255,gt>>>=8;qe-=64,pe+=64}if(qe>0)for(M(kt,zt,ze,$),Mt=0;Mt<qe;Mt++)De[pe+Mt]=kt[Mt];return 0}function Q(De,pe,qe,Ae,ze){var zt=new Uint8Array(32);F(zt,Ae,ze,$);for(var kt=new Uint8Array(8),gt=0;gt<8;gt++)kt[gt]=Ae[gt+16];return z(De,pe,qe,kt,zt)}function se(De,pe,qe,Ae,ze,zt,kt){var gt=new Uint8Array(32);F(gt,zt,kt,$);for(var Mt=new Uint8Array(8),ln=0;ln<8;ln++)Mt[ln]=zt[ln+16];return L(De,pe,qe,Ae,ze,Mt,gt)}var ee=function(De){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 pe,qe,Ae,ze,zt,kt,gt,Mt;pe=De[0]&255|(De[1]&255)<<8,this.r[0]=pe&8191,qe=De[2]&255|(De[3]&255)<<8,this.r[1]=(pe>>>13|qe<<3)&8191,Ae=De[4]&255|(De[5]&255)<<8,this.r[2]=(qe>>>10|Ae<<6)&7939,ze=De[6]&255|(De[7]&255)<<8,this.r[3]=(Ae>>>7|ze<<9)&8191,zt=De[8]&255|(De[9]&255)<<8,this.r[4]=(ze>>>4|zt<<12)&255,this.r[5]=zt>>>1&8190,kt=De[10]&255|(De[11]&255)<<8,this.r[6]=(zt>>>14|kt<<2)&8191,gt=De[12]&255|(De[13]&255)<<8,this.r[7]=(kt>>>11|gt<<5)&8065,Mt=De[14]&255|(De[15]&255)<<8,this.r[8]=(gt>>>8|Mt<<8)&8191,this.r[9]=Mt>>>5&127,this.pad[0]=De[16]&255|(De[17]&255)<<8,this.pad[1]=De[18]&255|(De[19]&255)<<8,this.pad[2]=De[20]&255|(De[21]&255)<<8,this.pad[3]=De[22]&255|(De[23]&255)<<8,this.pad[4]=De[24]&255|(De[25]&255)<<8,this.pad[5]=De[26]&255|(De[27]&255)<<8,this.pad[6]=De[28]&255|(De[29]&255)<<8,this.pad[7]=De[30]&255|(De[31]&255)<<8};ee.prototype.blocks=function(De,pe,qe){for(var Ae=this.fin?0:2048,ze,zt,kt,gt,Mt,ln,vn,Wn,On,$t,Nn,Fn,Tt,pn,ke,m,p,S,A,k=this.h[0],T=this.h[1],D=this.h[2],V=this.h[3],X=this.h[4],le=this.h[5],ce=this.h[6],fe=this.h[7],ye=this.h[8],Pe=this.h[9],Me=this.r[0],Ke=this.r[1],we=this.r[2],Te=this.r[3],te=this.r[4],ve=this.r[5],Be=this.r[6],Ue=this.r[7],Fe=this.r[8],at=this.r[9];qe>=16;)ze=De[pe+0]&255|(De[pe+1]&255)<<8,k+=ze&8191,zt=De[pe+2]&255|(De[pe+3]&255)<<8,T+=(ze>>>13|zt<<3)&8191,kt=De[pe+4]&255|(De[pe+5]&255)<<8,D+=(zt>>>10|kt<<6)&8191,gt=De[pe+6]&255|(De[pe+7]&255)<<8,V+=(kt>>>7|gt<<9)&8191,Mt=De[pe+8]&255|(De[pe+9]&255)<<8,X+=(gt>>>4|Mt<<12)&8191,le+=Mt>>>1&8191,ln=De[pe+10]&255|(De[pe+11]&255)<<8,ce+=(Mt>>>14|ln<<2)&8191,vn=De[pe+12]&255|(De[pe+13]&255)<<8,fe+=(ln>>>11|vn<<5)&8191,Wn=De[pe+14]&255|(De[pe+15]&255)<<8,ye+=(vn>>>8|Wn<<8)&8191,Pe+=Wn>>>5|Ae,On=0,$t=On,$t+=k*Me,$t+=T*(5*at),$t+=D*(5*Fe),$t+=V*(5*Ue),$t+=X*(5*Be),On=$t>>>13,$t&=8191,$t+=le*(5*ve),$t+=ce*(5*te),$t+=fe*(5*Te),$t+=ye*(5*we),$t+=Pe*(5*Ke),On+=$t>>>13,$t&=8191,Nn=On,Nn+=k*Ke,Nn+=T*Me,Nn+=D*(5*at),Nn+=V*(5*Fe),Nn+=X*(5*Ue),On=Nn>>>13,Nn&=8191,Nn+=le*(5*Be),Nn+=ce*(5*ve),Nn+=fe*(5*te),Nn+=ye*(5*Te),Nn+=Pe*(5*we),On+=Nn>>>13,Nn&=8191,Fn=On,Fn+=k*we,Fn+=T*Ke,Fn+=D*Me,Fn+=V*(5*at),Fn+=X*(5*Fe),On=Fn>>>13,Fn&=8191,Fn+=le*(5*Ue),Fn+=ce*(5*Be),Fn+=fe*(5*ve),Fn+=ye*(5*te),Fn+=Pe*(5*Te),On+=Fn>>>13,Fn&=8191,Tt=On,Tt+=k*Te,Tt+=T*we,Tt+=D*Ke,Tt+=V*Me,Tt+=X*(5*at),On=Tt>>>13,Tt&=8191,Tt+=le*(5*Fe),Tt+=ce*(5*Ue),Tt+=fe*(5*Be),Tt+=ye*(5*ve),Tt+=Pe*(5*te),On+=Tt>>>13,Tt&=8191,pn=On,pn+=k*te,pn+=T*Te,pn+=D*we,pn+=V*Ke,pn+=X*Me,On=pn>>>13,pn&=8191,pn+=le*(5*at),pn+=ce*(5*Fe),pn+=fe*(5*Ue),pn+=ye*(5*Be),pn+=Pe*(5*ve),On+=pn>>>13,pn&=8191,ke=On,ke+=k*ve,ke+=T*te,ke+=D*Te,ke+=V*we,ke+=X*Ke,On=ke>>>13,ke&=8191,ke+=le*Me,ke+=ce*(5*at),ke+=fe*(5*Fe),ke+=ye*(5*Ue),ke+=Pe*(5*Be),On+=ke>>>13,ke&=8191,m=On,m+=k*Be,m+=T*ve,m+=D*te,m+=V*Te,m+=X*we,On=m>>>13,m&=8191,m+=le*Ke,m+=ce*Me,m+=fe*(5*at),m+=ye*(5*Fe),m+=Pe*(5*Ue),On+=m>>>13,m&=8191,p=On,p+=k*Ue,p+=T*Be,p+=D*ve,p+=V*te,p+=X*Te,On=p>>>13,p&=8191,p+=le*we,p+=ce*Ke,p+=fe*Me,p+=ye*(5*at),p+=Pe*(5*Fe),On+=p>>>13,p&=8191,S=On,S+=k*Fe,S+=T*Ue,S+=D*Be,S+=V*ve,S+=X*te,On=S>>>13,S&=8191,S+=le*Te,S+=ce*we,S+=fe*Ke,S+=ye*Me,S+=Pe*(5*at),On+=S>>>13,S&=8191,A=On,A+=k*at,A+=T*Fe,A+=D*Ue,A+=V*Be,A+=X*ve,On=A>>>13,A&=8191,A+=le*te,A+=ce*Te,A+=fe*we,A+=ye*Ke,A+=Pe*Me,On+=A>>>13,A&=8191,On=(On<<2)+On|0,On=On+$t|0,$t=On&8191,On=On>>>13,Nn+=On,k=$t,T=Nn,D=Fn,V=Tt,X=pn,le=ke,ce=m,fe=p,ye=S,Pe=A,pe+=16,qe-=16;this.h[0]=k,this.h[1]=T,this.h[2]=D,this.h[3]=V,this.h[4]=X,this.h[5]=le,this.h[6]=ce,this.h[7]=fe,this.h[8]=ye,this.h[9]=Pe},ee.prototype.finish=function(De,pe){var qe=new Uint16Array(10),Ae,ze,zt,kt;if(this.leftover){for(kt=this.leftover,this.buffer[kt++]=1;kt<16;kt++)this.buffer[kt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(Ae=this.h[1]>>>13,this.h[1]&=8191,kt=2;kt<10;kt++)this.h[kt]+=Ae,Ae=this.h[kt]>>>13,this.h[kt]&=8191;for(this.h[0]+=Ae*5,Ae=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=Ae,Ae=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=Ae,qe[0]=this.h[0]+5,Ae=qe[0]>>>13,qe[0]&=8191,kt=1;kt<10;kt++)qe[kt]=this.h[kt]+Ae,Ae=qe[kt]>>>13,qe[kt]&=8191;for(qe[9]-=8192,ze=(Ae^1)-1,kt=0;kt<10;kt++)qe[kt]&=ze;for(ze=~ze,kt=0;kt<10;kt++)this.h[kt]=this.h[kt]&ze|qe[kt];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,zt=this.h[0]+this.pad[0],this.h[0]=zt&65535,kt=1;kt<8;kt++)zt=(this.h[kt]+this.pad[kt]|0)+(zt>>>16)|0,this.h[kt]=zt&65535;De[pe+0]=this.h[0]>>>0&255,De[pe+1]=this.h[0]>>>8&255,De[pe+2]=this.h[1]>>>0&255,De[pe+3]=this.h[1]>>>8&255,De[pe+4]=this.h[2]>>>0&255,De[pe+5]=this.h[2]>>>8&255,De[pe+6]=this.h[3]>>>0&255,De[pe+7]=this.h[3]>>>8&255,De[pe+8]=this.h[4]>>>0&255,De[pe+9]=this.h[4]>>>8&255,De[pe+10]=this.h[5]>>>0&255,De[pe+11]=this.h[5]>>>8&255,De[pe+12]=this.h[6]>>>0&255,De[pe+13]=this.h[6]>>>8&255,De[pe+14]=this.h[7]>>>0&255,De[pe+15]=this.h[7]>>>8&255},ee.prototype.update=function(De,pe,qe){var Ae,ze;if(this.leftover){for(ze=16-this.leftover,ze>qe&&(ze=qe),Ae=0;Ae<ze;Ae++)this.buffer[this.leftover+Ae]=De[pe+Ae];if(qe-=ze,pe+=ze,this.leftover+=ze,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(qe>=16&&(ze=qe-qe%16,this.blocks(De,pe,ze),pe+=ze,qe-=ze),qe){for(Ae=0;Ae<qe;Ae++)this.buffer[this.leftover+Ae]=De[pe+Ae];this.leftover+=qe}};function K(De,pe,qe,Ae,ze,zt){var kt=new ee(zt);return kt.update(qe,Ae,ze),kt.finish(De,pe),0}function re(De,pe,qe,Ae,ze,zt){var kt=new Uint8Array(16);return K(kt,0,qe,Ae,ze,zt),C(De,pe,kt,0)}function de(De,pe,qe,Ae,ze){var zt;if(qe<32)return-1;for(se(De,0,pe,0,qe,Ae,ze),K(De,16,De,32,qe-32,De),zt=0;zt<16;zt++)De[zt]=0;return 0}function G(De,pe,qe,Ae,ze){var zt,kt=new Uint8Array(32);if(qe<32||(Q(kt,0,32,Ae,ze),re(pe,16,pe,32,qe-32,kt)!==0))return-1;for(se(De,0,pe,0,qe,Ae,ze),zt=0;zt<32;zt++)De[zt]=0;return 0}function ie(De,pe){var qe;for(qe=0;qe<16;qe++)De[qe]=pe[qe]|0}function ae(De){var pe,qe,Ae=1;for(pe=0;pe<16;pe++)qe=De[pe]+Ae+65535,Ae=Math.floor(qe/65536),De[pe]=qe-Ae*65536;De[0]+=Ae-1+37*(Ae-1)}function q(De,pe,qe){for(var Ae,ze=~(qe-1),zt=0;zt<16;zt++)Ae=ze&(De[zt]^pe[zt]),De[zt]^=Ae,pe[zt]^=Ae}function W(De,pe){var qe,Ae,ze,zt=n(),kt=n();for(qe=0;qe<16;qe++)kt[qe]=pe[qe];for(ae(kt),ae(kt),ae(kt),Ae=0;Ae<2;Ae++){for(zt[0]=kt[0]-65517,qe=1;qe<15;qe++)zt[qe]=kt[qe]-65535-(zt[qe-1]>>16&1),zt[qe-1]&=65535;zt[15]=kt[15]-32767-(zt[14]>>16&1),ze=zt[15]>>16&1,zt[14]&=65535,q(kt,zt,1-ze)}for(qe=0;qe<16;qe++)De[2*qe]=kt[qe]&255,De[2*qe+1]=kt[qe]>>8}function ne(De,pe){var qe=new Uint8Array(32),Ae=new Uint8Array(32);return W(qe,De),W(Ae,pe),N(qe,0,Ae,0)}function oe(De){var pe=new Uint8Array(32);return W(pe,De),pe[0]&1}function he(De,pe){var qe;for(qe=0;qe<16;qe++)De[qe]=pe[2*qe]+(pe[2*qe+1]<<8);De[15]&=32767}function _e(De,pe,qe){for(var Ae=0;Ae<16;Ae++)De[Ae]=pe[Ae]+qe[Ae]}function xe(De,pe,qe){for(var Ae=0;Ae<16;Ae++)De[Ae]=pe[Ae]-qe[Ae]}function Se(De,pe,qe){var Ae,ze,zt=0,kt=0,gt=0,Mt=0,ln=0,vn=0,Wn=0,On=0,$t=0,Nn=0,Fn=0,Tt=0,pn=0,ke=0,m=0,p=0,S=0,A=0,k=0,T=0,D=0,V=0,X=0,le=0,ce=0,fe=0,ye=0,Pe=0,Me=0,Ke=0,we=0,Te=qe[0],te=qe[1],ve=qe[2],Be=qe[3],Ue=qe[4],Fe=qe[5],at=qe[6],ut=qe[7],yt=qe[8],Lt=qe[9],Gt=qe[10],an=qe[11],et=qe[12],Pt=qe[13],qt=qe[14],ft=qe[15];Ae=pe[0],zt+=Ae*Te,kt+=Ae*te,gt+=Ae*ve,Mt+=Ae*Be,ln+=Ae*Ue,vn+=Ae*Fe,Wn+=Ae*at,On+=Ae*ut,$t+=Ae*yt,Nn+=Ae*Lt,Fn+=Ae*Gt,Tt+=Ae*an,pn+=Ae*et,ke+=Ae*Pt,m+=Ae*qt,p+=Ae*ft,Ae=pe[1],kt+=Ae*Te,gt+=Ae*te,Mt+=Ae*ve,ln+=Ae*Be,vn+=Ae*Ue,Wn+=Ae*Fe,On+=Ae*at,$t+=Ae*ut,Nn+=Ae*yt,Fn+=Ae*Lt,Tt+=Ae*Gt,pn+=Ae*an,ke+=Ae*et,m+=Ae*Pt,p+=Ae*qt,S+=Ae*ft,Ae=pe[2],gt+=Ae*Te,Mt+=Ae*te,ln+=Ae*ve,vn+=Ae*Be,Wn+=Ae*Ue,On+=Ae*Fe,$t+=Ae*at,Nn+=Ae*ut,Fn+=Ae*yt,Tt+=Ae*Lt,pn+=Ae*Gt,ke+=Ae*an,m+=Ae*et,p+=Ae*Pt,S+=Ae*qt,A+=Ae*ft,Ae=pe[3],Mt+=Ae*Te,ln+=Ae*te,vn+=Ae*ve,Wn+=Ae*Be,On+=Ae*Ue,$t+=Ae*Fe,Nn+=Ae*at,Fn+=Ae*ut,Tt+=Ae*yt,pn+=Ae*Lt,ke+=Ae*Gt,m+=Ae*an,p+=Ae*et,S+=Ae*Pt,A+=Ae*qt,k+=Ae*ft,Ae=pe[4],ln+=Ae*Te,vn+=Ae*te,Wn+=Ae*ve,On+=Ae*Be,$t+=Ae*Ue,Nn+=Ae*Fe,Fn+=Ae*at,Tt+=Ae*ut,pn+=Ae*yt,ke+=Ae*Lt,m+=Ae*Gt,p+=Ae*an,S+=Ae*et,A+=Ae*Pt,k+=Ae*qt,T+=Ae*ft,Ae=pe[5],vn+=Ae*Te,Wn+=Ae*te,On+=Ae*ve,$t+=Ae*Be,Nn+=Ae*Ue,Fn+=Ae*Fe,Tt+=Ae*at,pn+=Ae*ut,ke+=Ae*yt,m+=Ae*Lt,p+=Ae*Gt,S+=Ae*an,A+=Ae*et,k+=Ae*Pt,T+=Ae*qt,D+=Ae*ft,Ae=pe[6],Wn+=Ae*Te,On+=Ae*te,$t+=Ae*ve,Nn+=Ae*Be,Fn+=Ae*Ue,Tt+=Ae*Fe,pn+=Ae*at,ke+=Ae*ut,m+=Ae*yt,p+=Ae*Lt,S+=Ae*Gt,A+=Ae*an,k+=Ae*et,T+=Ae*Pt,D+=Ae*qt,V+=Ae*ft,Ae=pe[7],On+=Ae*Te,$t+=Ae*te,Nn+=Ae*ve,Fn+=Ae*Be,Tt+=Ae*Ue,pn+=Ae*Fe,ke+=Ae*at,m+=Ae*ut,p+=Ae*yt,S+=Ae*Lt,A+=Ae*Gt,k+=Ae*an,T+=Ae*et,D+=Ae*Pt,V+=Ae*qt,X+=Ae*ft,Ae=pe[8],$t+=Ae*Te,Nn+=Ae*te,Fn+=Ae*ve,Tt+=Ae*Be,pn+=Ae*Ue,ke+=Ae*Fe,m+=Ae*at,p+=Ae*ut,S+=Ae*yt,A+=Ae*Lt,k+=Ae*Gt,T+=Ae*an,D+=Ae*et,V+=Ae*Pt,X+=Ae*qt,le+=Ae*ft,Ae=pe[9],Nn+=Ae*Te,Fn+=Ae*te,Tt+=Ae*ve,pn+=Ae*Be,ke+=Ae*Ue,m+=Ae*Fe,p+=Ae*at,S+=Ae*ut,A+=Ae*yt,k+=Ae*Lt,T+=Ae*Gt,D+=Ae*an,V+=Ae*et,X+=Ae*Pt,le+=Ae*qt,ce+=Ae*ft,Ae=pe[10],Fn+=Ae*Te,Tt+=Ae*te,pn+=Ae*ve,ke+=Ae*Be,m+=Ae*Ue,p+=Ae*Fe,S+=Ae*at,A+=Ae*ut,k+=Ae*yt,T+=Ae*Lt,D+=Ae*Gt,V+=Ae*an,X+=Ae*et,le+=Ae*Pt,ce+=Ae*qt,fe+=Ae*ft,Ae=pe[11],Tt+=Ae*Te,pn+=Ae*te,ke+=Ae*ve,m+=Ae*Be,p+=Ae*Ue,S+=Ae*Fe,A+=Ae*at,k+=Ae*ut,T+=Ae*yt,D+=Ae*Lt,V+=Ae*Gt,X+=Ae*an,le+=Ae*et,ce+=Ae*Pt,fe+=Ae*qt,ye+=Ae*ft,Ae=pe[12],pn+=Ae*Te,ke+=Ae*te,m+=Ae*ve,p+=Ae*Be,S+=Ae*Ue,A+=Ae*Fe,k+=Ae*at,T+=Ae*ut,D+=Ae*yt,V+=Ae*Lt,X+=Ae*Gt,le+=Ae*an,ce+=Ae*et,fe+=Ae*Pt,ye+=Ae*qt,Pe+=Ae*ft,Ae=pe[13],ke+=Ae*Te,m+=Ae*te,p+=Ae*ve,S+=Ae*Be,A+=Ae*Ue,k+=Ae*Fe,T+=Ae*at,D+=Ae*ut,V+=Ae*yt,X+=Ae*Lt,le+=Ae*Gt,ce+=Ae*an,fe+=Ae*et,ye+=Ae*Pt,Pe+=Ae*qt,Me+=Ae*ft,Ae=pe[14],m+=Ae*Te,p+=Ae*te,S+=Ae*ve,A+=Ae*Be,k+=Ae*Ue,T+=Ae*Fe,D+=Ae*at,V+=Ae*ut,X+=Ae*yt,le+=Ae*Lt,ce+=Ae*Gt,fe+=Ae*an,ye+=Ae*et,Pe+=Ae*Pt,Me+=Ae*qt,Ke+=Ae*ft,Ae=pe[15],p+=Ae*Te,S+=Ae*te,A+=Ae*ve,k+=Ae*Be,T+=Ae*Ue,D+=Ae*Fe,V+=Ae*at,X+=Ae*ut,le+=Ae*yt,ce+=Ae*Lt,fe+=Ae*Gt,ye+=Ae*an,Pe+=Ae*et,Me+=Ae*Pt,Ke+=Ae*qt,we+=Ae*ft,zt+=38*S,kt+=38*A,gt+=38*k,Mt+=38*T,ln+=38*D,vn+=38*V,Wn+=38*X,On+=38*le,$t+=38*ce,Nn+=38*fe,Fn+=38*ye,Tt+=38*Pe,pn+=38*Me,ke+=38*Ke,m+=38*we,ze=1,Ae=zt+ze+65535,ze=Math.floor(Ae/65536),zt=Ae-ze*65536,Ae=kt+ze+65535,ze=Math.floor(Ae/65536),kt=Ae-ze*65536,Ae=gt+ze+65535,ze=Math.floor(Ae/65536),gt=Ae-ze*65536,Ae=Mt+ze+65535,ze=Math.floor(Ae/65536),Mt=Ae-ze*65536,Ae=ln+ze+65535,ze=Math.floor(Ae/65536),ln=Ae-ze*65536,Ae=vn+ze+65535,ze=Math.floor(Ae/65536),vn=Ae-ze*65536,Ae=Wn+ze+65535,ze=Math.floor(Ae/65536),Wn=Ae-ze*65536,Ae=On+ze+65535,ze=Math.floor(Ae/65536),On=Ae-ze*65536,Ae=$t+ze+65535,ze=Math.floor(Ae/65536),$t=Ae-ze*65536,Ae=Nn+ze+65535,ze=Math.floor(Ae/65536),Nn=Ae-ze*65536,Ae=Fn+ze+65535,ze=Math.floor(Ae/65536),Fn=Ae-ze*65536,Ae=Tt+ze+65535,ze=Math.floor(Ae/65536),Tt=Ae-ze*65536,Ae=pn+ze+65535,ze=Math.floor(Ae/65536),pn=Ae-ze*65536,Ae=ke+ze+65535,ze=Math.floor(Ae/65536),ke=Ae-ze*65536,Ae=m+ze+65535,ze=Math.floor(Ae/65536),m=Ae-ze*65536,Ae=p+ze+65535,ze=Math.floor(Ae/65536),p=Ae-ze*65536,zt+=ze-1+37*(ze-1),ze=1,Ae=zt+ze+65535,ze=Math.floor(Ae/65536),zt=Ae-ze*65536,Ae=kt+ze+65535,ze=Math.floor(Ae/65536),kt=Ae-ze*65536,Ae=gt+ze+65535,ze=Math.floor(Ae/65536),gt=Ae-ze*65536,Ae=Mt+ze+65535,ze=Math.floor(Ae/65536),Mt=Ae-ze*65536,Ae=ln+ze+65535,ze=Math.floor(Ae/65536),ln=Ae-ze*65536,Ae=vn+ze+65535,ze=Math.floor(Ae/65536),vn=Ae-ze*65536,Ae=Wn+ze+65535,ze=Math.floor(Ae/65536),Wn=Ae-ze*65536,Ae=On+ze+65535,ze=Math.floor(Ae/65536),On=Ae-ze*65536,Ae=$t+ze+65535,ze=Math.floor(Ae/65536),$t=Ae-ze*65536,Ae=Nn+ze+65535,ze=Math.floor(Ae/65536),Nn=Ae-ze*65536,Ae=Fn+ze+65535,ze=Math.floor(Ae/65536),Fn=Ae-ze*65536,Ae=Tt+ze+65535,ze=Math.floor(Ae/65536),Tt=Ae-ze*65536,Ae=pn+ze+65535,ze=Math.floor(Ae/65536),pn=Ae-ze*65536,Ae=ke+ze+65535,ze=Math.floor(Ae/65536),ke=Ae-ze*65536,Ae=m+ze+65535,ze=Math.floor(Ae/65536),m=Ae-ze*65536,Ae=p+ze+65535,ze=Math.floor(Ae/65536),p=Ae-ze*65536,zt+=ze-1+37*(ze-1),De[0]=zt,De[1]=kt,De[2]=gt,De[3]=Mt,De[4]=ln,De[5]=vn,De[6]=Wn,De[7]=On,De[8]=$t,De[9]=Nn,De[10]=Fn,De[11]=Tt,De[12]=pn,De[13]=ke,De[14]=m,De[15]=p}function ge(De,pe){Se(De,pe,pe)}function Ce(De,pe){var qe=n(),Ae;for(Ae=0;Ae<16;Ae++)qe[Ae]=pe[Ae];for(Ae=253;Ae>=0;Ae--)ge(qe,qe),Ae!==2&&Ae!==4&&Se(qe,qe,pe);for(Ae=0;Ae<16;Ae++)De[Ae]=qe[Ae]}function je(De,pe){var qe=n(),Ae;for(Ae=0;Ae<16;Ae++)qe[Ae]=pe[Ae];for(Ae=250;Ae>=0;Ae--)ge(qe,qe),Ae!==1&&Se(qe,qe,pe);for(Ae=0;Ae<16;Ae++)De[Ae]=qe[Ae]}function Oe(De,pe,qe){var Ae=new Uint8Array(32),ze=new Float64Array(80),zt,kt,gt=n(),Mt=n(),ln=n(),vn=n(),Wn=n(),On=n();for(kt=0;kt<31;kt++)Ae[kt]=pe[kt];for(Ae[31]=pe[31]&127|64,Ae[0]&=248,he(ze,qe),kt=0;kt<16;kt++)Mt[kt]=ze[kt],vn[kt]=gt[kt]=ln[kt]=0;for(gt[0]=vn[0]=1,kt=254;kt>=0;--kt)zt=Ae[kt>>>3]>>>(kt&7)&1,q(gt,Mt,zt),q(ln,vn,zt),_e(Wn,gt,ln),xe(gt,gt,ln),_e(ln,Mt,vn),xe(Mt,Mt,vn),ge(vn,Wn),ge(On,gt),Se(gt,ln,gt),Se(ln,Mt,Wn),_e(Wn,gt,ln),xe(gt,gt,ln),ge(Mt,gt),xe(ln,vn,On),Se(gt,ln,c),_e(gt,gt,vn),Se(ln,ln,gt),Se(gt,vn,On),Se(vn,Mt,ze),ge(Mt,Wn),q(gt,Mt,zt),q(ln,vn,zt);for(kt=0;kt<16;kt++)ze[kt+16]=gt[kt],ze[kt+32]=ln[kt],ze[kt+48]=Mt[kt],ze[kt+64]=vn[kt];var $t=ze.subarray(32),Nn=ze.subarray(16);return Ce($t,$t),Se(Nn,Nn,$t),W(De,Nn),0}function $e(De,pe){return Oe(De,pe,a)}function Ye(De,pe){return r(pe,32),$e(De,pe)}function Je(De,pe,qe){var Ae=new Uint8Array(32);return Oe(Ae,qe,pe),F(De,s,Ae,$)}var ht=de,rt=G;function st(De,pe,qe,Ae,ze,zt){var kt=new Uint8Array(32);return Je(kt,ze,zt),ht(De,pe,qe,Ae,kt)}function He(De,pe,qe,Ae,ze,zt){var kt=new Uint8Array(32);return Je(kt,ze,zt),rt(De,pe,qe,Ae,kt)}var Ve=[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 bt(De,pe,qe,Ae){for(var ze=new Int32Array(16),zt=new Int32Array(16),kt,gt,Mt,ln,vn,Wn,On,$t,Nn,Fn,Tt,pn,ke,m,p,S,A,k,T,D,V,X,le,ce,fe,ye,Pe=De[0],Me=De[1],Ke=De[2],we=De[3],Te=De[4],te=De[5],ve=De[6],Be=De[7],Ue=pe[0],Fe=pe[1],at=pe[2],ut=pe[3],yt=pe[4],Lt=pe[5],Gt=pe[6],an=pe[7],et=0;Ae>=128;){for(T=0;T<16;T++)D=8*T+et,ze[T]=qe[D+0]<<24|qe[D+1]<<16|qe[D+2]<<8|qe[D+3],zt[T]=qe[D+4]<<24|qe[D+5]<<16|qe[D+6]<<8|qe[D+7];for(T=0;T<80;T++)if(kt=Pe,gt=Me,Mt=Ke,ln=we,vn=Te,Wn=te,On=ve,$t=Be,Nn=Ue,Fn=Fe,Tt=at,pn=ut,ke=yt,m=Lt,p=Gt,S=an,V=Be,X=an,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=(Te>>>14|yt<<18)^(Te>>>18|yt<<14)^(yt>>>9|Te<<23),X=(yt>>>14|Te<<18)^(yt>>>18|Te<<14)^(Te>>>9|yt<<23),le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,V=Te&te^~Te&ve,X=yt&Lt^~yt&Gt,le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,V=Ve[T*2],X=Ve[T*2+1],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,V=ze[T%16],X=zt[T%16],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,A=fe&65535|ye<<16,k=le&65535|ce<<16,V=A,X=k,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=(Pe>>>28|Ue<<4)^(Ue>>>2|Pe<<30)^(Ue>>>7|Pe<<25),X=(Ue>>>28|Pe<<4)^(Pe>>>2|Ue<<30)^(Pe>>>7|Ue<<25),le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,V=Pe&Me^Pe&Ke^Me&Ke,X=Ue&Fe^Ue&at^Fe&at,le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,$t=fe&65535|ye<<16,S=le&65535|ce<<16,V=ln,X=pn,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=A,X=k,le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,ln=fe&65535|ye<<16,pn=le&65535|ce<<16,Me=kt,Ke=gt,we=Mt,Te=ln,te=vn,ve=Wn,Be=On,Pe=$t,Fe=Nn,at=Fn,ut=Tt,yt=pn,Lt=ke,Gt=m,an=p,Ue=S,T%16===15)for(D=0;D<16;D++)V=ze[D],X=zt[D],le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=ze[(D+9)%16],X=zt[(D+9)%16],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,A=ze[(D+1)%16],k=zt[(D+1)%16],V=(A>>>1|k<<31)^(A>>>8|k<<24)^A>>>7,X=(k>>>1|A<<31)^(k>>>8|A<<24)^(k>>>7|A<<25),le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,A=ze[(D+14)%16],k=zt[(D+14)%16],V=(A>>>19|k<<13)^(k>>>29|A<<3)^A>>>6,X=(k>>>19|A<<13)^(A>>>29|k<<3)^(k>>>6|A<<26),le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,ze[D]=fe&65535|ye<<16,zt[D]=le&65535|ce<<16;V=Pe,X=Ue,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[0],X=pe[0],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[0]=Pe=fe&65535|ye<<16,pe[0]=Ue=le&65535|ce<<16,V=Me,X=Fe,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[1],X=pe[1],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[1]=Me=fe&65535|ye<<16,pe[1]=Fe=le&65535|ce<<16,V=Ke,X=at,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[2],X=pe[2],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[2]=Ke=fe&65535|ye<<16,pe[2]=at=le&65535|ce<<16,V=we,X=ut,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[3],X=pe[3],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[3]=we=fe&65535|ye<<16,pe[3]=ut=le&65535|ce<<16,V=Te,X=yt,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[4],X=pe[4],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[4]=Te=fe&65535|ye<<16,pe[4]=yt=le&65535|ce<<16,V=te,X=Lt,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[5],X=pe[5],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[5]=te=fe&65535|ye<<16,pe[5]=Lt=le&65535|ce<<16,V=ve,X=Gt,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[6],X=pe[6],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[6]=ve=fe&65535|ye<<16,pe[6]=Gt=le&65535|ce<<16,V=Be,X=an,le=X&65535,ce=X>>>16,fe=V&65535,ye=V>>>16,V=De[7],X=pe[7],le+=X&65535,ce+=X>>>16,fe+=V&65535,ye+=V>>>16,ce+=le>>>16,fe+=ce>>>16,ye+=fe>>>16,De[7]=Be=fe&65535|ye<<16,pe[7]=an=le&65535|ce<<16,et+=128,Ae-=128}return Ae}function xt(De,pe,qe){var Ae=new Int32Array(8),ze=new Int32Array(8),zt=new Uint8Array(256),kt,gt=qe;for(Ae[0]=1779033703,Ae[1]=3144134277,Ae[2]=1013904242,Ae[3]=2773480762,Ae[4]=1359893119,Ae[5]=2600822924,Ae[6]=528734635,Ae[7]=1541459225,ze[0]=4089235720,ze[1]=2227873595,ze[2]=4271175723,ze[3]=1595750129,ze[4]=2917565137,ze[5]=725511199,ze[6]=4215389547,ze[7]=327033209,bt(Ae,ze,pe,qe),qe%=128,kt=0;kt<qe;kt++)zt[kt]=pe[gt-qe+kt];for(zt[qe]=128,qe=256-128*(qe<112?1:0),zt[qe-9]=0,y(zt,qe-8,gt/536870912|0,gt<<3),bt(Ae,ze,zt,qe),kt=0;kt<8;kt++)y(De,8*kt,Ae[kt],ze[kt]);return 0}function Qt(De,pe){var qe=n(),Ae=n(),ze=n(),zt=n(),kt=n(),gt=n(),Mt=n(),ln=n(),vn=n();xe(qe,De[1],De[0]),xe(vn,pe[1],pe[0]),Se(qe,qe,vn),_e(Ae,De[0],De[1]),_e(vn,pe[0],pe[1]),Se(Ae,Ae,vn),Se(ze,De[3],pe[3]),Se(ze,ze,d),Se(zt,De[2],pe[2]),_e(zt,zt,zt),xe(kt,Ae,qe),xe(gt,zt,ze),_e(Mt,zt,ze),_e(ln,Ae,qe),Se(De[0],kt,gt),Se(De[1],ln,Mt),Se(De[2],Mt,gt),Se(De[3],kt,ln)}function St(De,pe,qe){var Ae;for(Ae=0;Ae<4;Ae++)q(De[Ae],pe[Ae],qe)}function on(De,pe){var qe=n(),Ae=n(),ze=n();Ce(ze,pe[2]),Se(qe,pe[0],ze),Se(Ae,pe[1],ze),W(De,Ae),De[31]^=oe(qe)<<7}function cn(De,pe,qe){var Ae,ze;for(ie(De[0],o),ie(De[1],l),ie(De[2],l),ie(De[3],o),ze=255;ze>=0;--ze)Ae=qe[ze/8|0]>>(ze&7)&1,St(De,pe,Ae),Qt(pe,De),Qt(De,De),St(De,pe,Ae)}function Vn(De,pe){var qe=[n(),n(),n(),n()];ie(qe[0],f),ie(qe[1],x),ie(qe[2],l),Se(qe[3],f,x),cn(De,qe,pe)}function tn(De,pe,qe){var Ae=new Uint8Array(64),ze=[n(),n(),n(),n()],zt;for(qe||r(pe,32),xt(Ae,pe,32),Ae[0]&=248,Ae[31]&=127,Ae[31]|=64,Vn(ze,Ae),on(De,ze),zt=0;zt<32;zt++)pe[zt+32]=De[zt];return 0}var fn=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 rn(De,pe){var qe,Ae,ze,zt;for(Ae=63;Ae>=32;--Ae){for(qe=0,ze=Ae-32,zt=Ae-12;ze<zt;++ze)pe[ze]+=qe-16*pe[Ae]*fn[ze-(Ae-32)],qe=Math.floor((pe[ze]+128)/256),pe[ze]-=qe*256;pe[ze]+=qe,pe[Ae]=0}for(qe=0,ze=0;ze<32;ze++)pe[ze]+=qe-(pe[31]>>4)*fn[ze],qe=pe[ze]>>8,pe[ze]&=255;for(ze=0;ze<32;ze++)pe[ze]-=qe*fn[ze];for(Ae=0;Ae<32;Ae++)pe[Ae+1]+=pe[Ae]>>8,De[Ae]=pe[Ae]&255}function nt(De){var pe=new Float64Array(64),qe;for(qe=0;qe<64;qe++)pe[qe]=De[qe];for(qe=0;qe<64;qe++)De[qe]=0;rn(De,pe)}function it(De,pe,qe,Ae){var ze=new Uint8Array(64),zt=new Uint8Array(64),kt=new Uint8Array(64),gt,Mt,ln=new Float64Array(64),vn=[n(),n(),n(),n()];xt(ze,Ae,32),ze[0]&=248,ze[31]&=127,ze[31]|=64;var Wn=qe+64;for(gt=0;gt<qe;gt++)De[64+gt]=pe[gt];for(gt=0;gt<32;gt++)De[32+gt]=ze[32+gt];for(xt(kt,De.subarray(32),qe+32),nt(kt),Vn(vn,kt),on(De,vn),gt=32;gt<64;gt++)De[gt]=Ae[gt];for(xt(zt,De,qe+64),nt(zt),gt=0;gt<64;gt++)ln[gt]=0;for(gt=0;gt<32;gt++)ln[gt]=kt[gt];for(gt=0;gt<32;gt++)for(Mt=0;Mt<32;Mt++)ln[gt+Mt]+=zt[gt]*ze[Mt];return rn(De.subarray(32),ln),Wn}function Ut(De,pe){var qe=n(),Ae=n(),ze=n(),zt=n(),kt=n(),gt=n(),Mt=n();return ie(De[2],l),he(De[1],pe),ge(ze,De[1]),Se(zt,ze,u),xe(ze,ze,De[2]),_e(zt,De[2],zt),ge(kt,zt),ge(gt,kt),Se(Mt,gt,kt),Se(qe,Mt,ze),Se(qe,qe,zt),je(qe,qe),Se(qe,qe,ze),Se(qe,qe,zt),Se(qe,qe,zt),Se(De[0],qe,zt),ge(Ae,De[0]),Se(Ae,Ae,zt),ne(Ae,ze)&&Se(De[0],De[0],g),ge(Ae,De[0]),Se(Ae,Ae,zt),ne(Ae,ze)?-1:(oe(De[0])===pe[31]>>7&&xe(De[0],o,De[0]),Se(De[3],De[0],De[1]),0)}function hn(De,pe,qe,Ae){var ze,zt=new Uint8Array(32),kt=new Uint8Array(64),gt=[n(),n(),n(),n()],Mt=[n(),n(),n(),n()];if(qe<64||Ut(Mt,Ae))return-1;for(ze=0;ze<qe;ze++)De[ze]=pe[ze];for(ze=0;ze<32;ze++)De[ze+32]=Ae[ze];if(xt(kt,De,qe),nt(kt),cn(gt,Mt,kt),Vn(Mt,pe.subarray(32)),Qt(gt,Mt),on(zt,gt),qe-=64,N(pe,0,zt,0)){for(ze=0;ze<qe;ze++)De[ze]=0;return-1}for(ze=0;ze<qe;ze++)De[ze]=pe[ze+64];return qe}var nn=32,Vt=24,pt=32,We=16,It=32,Ge=32,ct=32,vt=32,Ht=32,Rt=Vt,mn=pt,un=We,yn=64,_n=32,In=64,Sn=32,Yn=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:se,crypto_stream:Q,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:z,crypto_onetimeauth:K,crypto_onetimeauth_verify:re,crypto_verify_16:C,crypto_verify_32:N,crypto_secretbox:de,crypto_secretbox_open:G,crypto_scalarmult:Oe,crypto_scalarmult_base:$e,crypto_box_beforenm:Je,crypto_box_afternm:ht,crypto_box:st,crypto_box_open:He,crypto_box_keypair:Ye,crypto_hash:xt,crypto_sign:it,crypto_sign_keypair:tn,crypto_sign_open:hn,crypto_secretbox_KEYBYTES:nn,crypto_secretbox_NONCEBYTES:Vt,crypto_secretbox_ZEROBYTES:pt,crypto_secretbox_BOXZEROBYTES:We,crypto_scalarmult_BYTES:It,crypto_scalarmult_SCALARBYTES:Ge,crypto_box_PUBLICKEYBYTES:ct,crypto_box_SECRETKEYBYTES:vt,crypto_box_BEFORENMBYTES:Ht,crypto_box_NONCEBYTES:Rt,crypto_box_ZEROBYTES:mn,crypto_box_BOXZEROBYTES:un,crypto_sign_BYTES:yn,crypto_sign_PUBLICKEYBYTES:_n,crypto_sign_SECRETKEYBYTES:In,crypto_sign_SEEDBYTES:Sn,crypto_hash_BYTES:Yn,gf:n,D:u,L:fn,pack25519:W,unpack25519:he,M:Se,A:_e,S:ge,Z:xe,pow2523:je,add:Qt,set25519:ie,modL:rn,scalarmult:cn,scalarbase:Vn};function Xn(De,pe){if(De.length!==nn)throw new Error("bad key size");if(pe.length!==Vt)throw new Error("bad nonce size")}function zn(De,pe){if(De.length!==ct)throw new Error("bad public key size");if(pe.length!==vt)throw new Error("bad secret key size")}function Kn(){for(var De=0;De<arguments.length;De++)if(!(arguments[De]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function jn(De){for(var pe=0;pe<De.length;pe++)De[pe]=0}e.randomBytes=function(De){var pe=new Uint8Array(De);return r(pe,De),pe},e.secretbox=function(De,pe,qe){Kn(De,pe,qe),Xn(qe,pe);for(var Ae=new Uint8Array(pt+De.length),ze=new Uint8Array(Ae.length),zt=0;zt<De.length;zt++)Ae[zt+pt]=De[zt];return de(ze,Ae,Ae.length,pe,qe),ze.subarray(We)},e.secretbox.open=function(De,pe,qe){Kn(De,pe,qe),Xn(qe,pe);for(var Ae=new Uint8Array(We+De.length),ze=new Uint8Array(Ae.length),zt=0;zt<De.length;zt++)Ae[zt+We]=De[zt];return Ae.length<32||G(ze,Ae,Ae.length,pe,qe)!==0?null:ze.subarray(pt)},e.secretbox.keyLength=nn,e.secretbox.nonceLength=Vt,e.secretbox.overheadLength=We,e.scalarMult=function(De,pe){if(Kn(De,pe),De.length!==Ge)throw new Error("bad n size");if(pe.length!==It)throw new Error("bad p size");var qe=new Uint8Array(It);return Oe(qe,De,pe),qe},e.scalarMult.base=function(De){if(Kn(De),De.length!==Ge)throw new Error("bad n size");var pe=new Uint8Array(It);return $e(pe,De),pe},e.scalarMult.scalarLength=Ge,e.scalarMult.groupElementLength=It,e.box=function(De,pe,qe,Ae){var ze=e.box.before(qe,Ae);return e.secretbox(De,pe,ze)},e.box.before=function(De,pe){Kn(De,pe),zn(De,pe);var qe=new Uint8Array(Ht);return Je(qe,De,pe),qe},e.box.after=e.secretbox,e.box.open=function(De,pe,qe,Ae){var ze=e.box.before(qe,Ae);return e.secretbox.open(De,pe,ze)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var De=new Uint8Array(ct),pe=new Uint8Array(vt);return Ye(De,pe),{publicKey:De,secretKey:pe}},e.box.keyPair.fromSecretKey=function(De){if(Kn(De),De.length!==vt)throw new Error("bad secret key size");var pe=new Uint8Array(ct);return $e(pe,De),{publicKey:pe,secretKey:new Uint8Array(De)}},e.box.publicKeyLength=ct,e.box.secretKeyLength=vt,e.box.sharedKeyLength=Ht,e.box.nonceLength=Rt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(De,pe){if(Kn(De,pe),pe.length!==In)throw new Error("bad secret key size");var qe=new Uint8Array(yn+De.length);return it(qe,De,De.length,pe),qe},e.sign.open=function(De,pe){if(Kn(De,pe),pe.length!==_n)throw new Error("bad public key size");var qe=new Uint8Array(De.length),Ae=hn(qe,De,De.length,pe);if(Ae<0)return null;for(var ze=new Uint8Array(Ae),zt=0;zt<ze.length;zt++)ze[zt]=qe[zt];return ze},e.sign.detached=function(De,pe){for(var qe=e.sign(De,pe),Ae=new Uint8Array(yn),ze=0;ze<Ae.length;ze++)Ae[ze]=qe[ze];return Ae},e.sign.detached.verify=function(De,pe,qe){if(Kn(De,pe,qe),pe.length!==yn)throw new Error("bad signature size");if(qe.length!==_n)throw new Error("bad public key size");var Ae=new Uint8Array(yn+De.length),ze=new Uint8Array(yn+De.length),zt;for(zt=0;zt<yn;zt++)Ae[zt]=pe[zt];for(zt=0;zt<De.length;zt++)Ae[zt+yn]=De[zt];return hn(ze,Ae,Ae.length,qe)>=0},e.sign.keyPair=function(){var De=new Uint8Array(_n),pe=new Uint8Array(In);return tn(De,pe),{publicKey:De,secretKey:pe}},e.sign.keyPair.fromSecretKey=function(De){if(Kn(De),De.length!==In)throw new Error("bad secret key size");for(var pe=new Uint8Array(_n),qe=0;qe<pe.length;qe++)pe[qe]=De[32+qe];return{publicKey:pe,secretKey:new Uint8Array(De)}},e.sign.keyPair.fromSeed=function(De){if(Kn(De),De.length!==Sn)throw new Error("bad seed size");for(var pe=new Uint8Array(_n),qe=new Uint8Array(In),Ae=0;Ae<32;Ae++)qe[Ae]=De[Ae];return tn(pe,qe,!0),{publicKey:pe,secretKey:qe}},e.sign.publicKeyLength=_n,e.sign.secretKeyLength=In,e.sign.seedLength=Sn,e.sign.signatureLength=yn,e.hash=function(De){Kn(De);var pe=new Uint8Array(Yn);return xt(pe,De,De.length),pe},e.hash.hashLength=Yn,e.verify=function(De,pe){return Kn(De,pe),De.length===0||pe.length===0||De.length!==pe.length?!1:v(De,0,pe,0,De.length)===0},e.setPRNG=function(De){r=De},function(){var De=typeof self<"u"?self.crypto||self.msCrypto:null;if(De&&De.getRandomValues){var pe=65536;e.setPRNG(function(qe,Ae){var ze,zt=new Uint8Array(Ae);for(ze=0;ze<Ae;ze+=pe)De.getRandomValues(zt.subarray(ze,ze+Math.min(Ae-ze,pe)));for(ze=0;ze<Ae;ze++)qe[ze]=zt[ze];jn(zt)})}else typeof k6n<"u"&&(De=P6n,De&&De.randomBytes&&e.setPRNG(function(qe,Ae){var ze,zt=De.randomBytes(Ae);for(ze=0;ze<Ae;ze++)qe[ze]=zt[ze];jn(zt)}))}()})(t.exports?t.exports:self.nacl=self.nacl||{})}(TZ)),TZ.exports}var O6n=F6n();const M6n=Ti(O6n);function R6n(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 I=u[x],P=0;for(let M=y-1;(I!==0||P<f)&&M!==-1;M--,P++)I+=256*v[M]>>>0,v[M]=I%n>>>0,I=I/n>>>0;if(I!==0)throw new Error("Non-zero carry");f=P,x++}let C=y-f;for(;C!==y&&v[C]===0;)C++;let N=r.repeat(d);for(;C<y;++C)N+=t.charAt(v[C]);return N}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 I=u.charCodeAt(d);if(I>255)return;let P=e[I];if(P===255)return;let M=0;for(let F=g-1;(P!==0||M<x)&&F!==-1;F--,M++)P+=n*y[F]>>>0,y[F]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=M,d++}let v=g-x;for(;v!==g&&y[v]===0;)v++;const C=new Uint8Array(f+(g-v));let N=f;for(;v!==g;)C[N++]=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 L6n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const D6n=R6n(L6n),IKe=()=>{const{signMessageAsync:t}=_oe(),{address:e}=es(),[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){dn.error("Wallet not connected");return}await l();const f=M6n.sign.keyPair(),x=D6n.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){dn.error("Failed to prepare signin");return}const N=C.signedData.split(".")[1],I=JSON.parse(atob(N)).message,P=await t({message:I}),M=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:M,signature:P})})).json();if($!=null&&$.token){const L="bsc",z=e.toLowerCase(),Q=`dextrabot_standx_auth_data_${z}`,se=`${L}_${z}`,ee=localStorage.getItem(Q),K=ee?JSON.parse(ee):{};return K[se]={address:e,chain:L,publicKey:$.publicKey,token:$.token,signingKeyHex:y,requestId:x},localStorage.setItem(Q,JSON.stringify(K)),d&&d({token:$.token,signingKeyHex:y,requestId:x}),{token:$.token,signingKeyHex:y,requestId:x}}else dn.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}},B6n=()=>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)"})]})]})]})]}),hO="https://dextrabothypev2.nftinit.io",$6n="https://express-proxy-delta.vercel.app/proxy?url=https://perps.standx.com/api/query_balance",U6n=({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(Yr),{signIn:x,loading:g}=IKe(),[y,v]=h.useState(!1),[C,N]=h.useState(!1),[I,P]=h.useState(!1),[M,F]=h.useState(!1),[$,L]=h.useState(""),[z,Q]=h.useState(""),[se]=h.useState(!1),[ee,K]=h.useState(!1),[re,de]=h.useState(""),[G,ie]=h.useState(!1),[ae,q]=h.useState(!1),[W,ne]=h.useState(null),[oe,he]=h.useState(null),[_e,xe]=h.useState(null),[Se,ge]=h.useState(""),[Ce,je]=h.useState(""),[Oe,$e]=h.useState(null),[Ye,Je]=h.useState(""),[ht,rt]=h.useState(""),[st,He]=h.useState(""),[Ve,bt]=h.useState(""),[xt,Qt]=h.useState(""),[St,on]=h.useState(""),[cn,Vn]=h.useState("size"),[tn,fn]=h.useState(""),[rn,nt]=h.useState(""),[it,Ut]=h.useState("size"),[hn,nn]=h.useState("");h.useState("");const[Vt,pt]=h.useState(!1),[We,It]=h.useState(!1),[Ge,ct]=h.useState(!1),[vt,Ht]=h.useState(null),[Rt,mn]=h.useState(""),[un,yn]=h.useState(""),[_n,In]=h.useState(null),[Sn,Yn]=h.useState({coin:"",spread:"",per_side:"",order_size:"",max_per_side:"",tp_sl:"",budget:"",leverage:""}),Xn=vt?(vt==null?void 0:vt.getTime())<=Date.now():!1;h.useEffect(()=>{Xn?mn("Please click on the refresh button for extending your token."):Rt==="Please click on the refresh button for extending your token."&&mn("")},[Xn]),h.useEffect(()=>{const we=localStorage.getItem("hyperToken"),Te=localStorage.getItem("hyperAddress");v(!!(we&&Te));const te=setInterval(()=>{const ve=localStorage.getItem("hyperToken"),Be=localStorage.getItem("hyperAddress");v(!!(ve&&Be))},800);return()=>clearInterval(te)},[]),h.useEffect(()=>{de("")},[y]);function zn(we){try{const Te=we.split(".");if(Te.length!==3)throw new Error("Invalid JWT format");const ve=Te[1].replace(/-/g,"+").replace(/_/g,"/"),Be=decodeURIComponent(atob(ve).split("").map(Ue=>"%"+("00"+Ue.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Be)}catch{return null}}h.useEffect(()=>{(()=>{var ve;const Te=localStorage.getItem("hyperAddress");if(!Te){Ht(null),mn("");return}const te=localStorage.getItem(`dextrabot_standx_auth_data_${Te.toLowerCase()}`);if(!te){Ht(null),mn("");return}try{const Be=JSON.parse(te),Fe=`bsc_${Te.toLowerCase()}`,at=(ve=Be==null?void 0:Be[Fe])==null?void 0:ve.token;if(yn(at),!at){Ht(null),mn("");return}const ut=zn(at);if(ut&&(ut!=null&&ut.exp)){const yt=new Date(ut.exp*1e3);Ht(yt),yt.getTime()<=Date.now()?mn("Please click on the refresh button for extending your token."):mn("")}else ut?(Ht(null),mn("The token's expiration date could not be found.")):(Ht(null),mn("Invalid token format."))}catch(Be){console.error("Error checking token expiry:",Be),Ht(null),mn("Error checking token.")}})()},[y,g]);const Kn=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}],[]),jn=we=>{var Te;return((Te=Kn.find(te=>te.label===we))==null?void 0:Te.maxLeverage)??100},De=we=>{if(we==null||we==="")return"0.00";const Te=Number(we);return Number.isNaN(Te)?"0.00":Te.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})},pe=we=>/^\d*$/.test(we),qe=(we,Te=4)=>new RegExp(`^(0|[1-9]\\d*)(\\.\\d{0,${Te}})?$`).test(we),Ae=we=>/^(0|[1-9]\d*)(\.\d{0,1})?$/.test(we),ze=we=>{["e","E","+","-"].includes(we.key)&&we.preventDefault()},zt=h.useMemo(()=>$==="BTC"?4:3,[$]);h.useEffect(()=>{if(!Oe||cn!=="size")return;const we=Number(xt);if(Number.isNaN(we)||xt===""){on("");return}const Te=Number(Oe),te=we*Te;on(Number.isFinite(te)&&te>0?te.toFixed(2):"")},[xt,Oe,cn]),h.useEffect(()=>{if(!Oe||cn!=="usd")return;const we=Number(St);if(Number.isNaN(we)||St===""){Qt("");return}const Te=Number(Oe);if(!Te)return;const te=we/Te,ve=te.toFixed(zt);Qt(te===0?"":ve)},[St,Oe,cn,zt]),h.useEffect(()=>{if(!Oe||it!=="size")return;const we=Number(tn);if(Number.isNaN(we)||tn===""){nt("");return}const Te=Number(Oe),te=we*Te;nt(Number.isFinite(te)&&te>0?te.toFixed(2):"")},[tn,Oe,it]),h.useEffect(()=>{if(!Oe||it!=="usd")return;const we=Number(rn);if(Number.isNaN(we)||rn===""){fn("");return}const Te=Number(Oe);if(!Te)return;const te=we/Te,ve=te.toFixed(zt);fn(te===0?"":ve)},[rn,Oe,it,zt]),h.useEffect(()=>{if(!$)return;const we=zt,Te=xt,te=tn;if(Te!==""&&Te.includes(".")){const[ve,Be]=Te.split(".");if(Be&&Be.length>we){const Ue=`${ve}.${Be.slice(0,we)}`;Qt(Ue)}}if(te!==""&&te.includes(".")){const[ve,Be]=te.split(".");if(Be&&Be.length>we){const Ue=`${ve}.${Be.slice(0,we)}`;fn(Ue)}}},[$,zt]),h.useEffect(()=>{if(!$)return;const we=jn($),Te=Number(Ye);!Number.isNaN(Te)&&Te>we&&Je(String(we)),!Number.isNaN(Te)&&Te<1&&Ye!==""&&Je("1")},[$]);const kt=h.useMemo(()=>{if(Ye==="")return!1;const we=Number(Ye),Te=jn($);return Number.isInteger(we)&&we>=1&&we<=Te},[Ye,$]);h.useEffect(()=>{if(!$)return;const we=jn($),Te=Number(Ye);!Number.isNaN(Te)&&Te>we&&Je(String(we)),!Number.isNaN(Te)&&Te<1&&Ye!==""&&Je("1")},[$]);const gt=h.useMemo(()=>{if(ht==="")return!1;const we=Number(ht);if(Number.isNaN(we)||we<.1)return!1;if(W!=null&&W!=="0"){const Te=Number(W);if(!Number.isNaN(Te)&&we>Te)return!1}return!0},[ht,W]);console.log("usdcBalance",W),h.useEffect(()=>{if(W===null||W==="0.00")return;const we=De(W),Te=Number(ht);!Number.isNaN(Te)&&Te>we&&rt(we),!Number.isNaN(Te)&&Te<.1&&rt("")},[W]);const Mt=h.useMemo(()=>{if(st==="")return!1;const we=Number(st);return Number.isNaN(we)?!1:we>=.1&&we<=1e3},[st]),ln=h.useMemo(()=>{if(Ve==="")return!1;const we=Number(Ve);return Number.isNaN(we)?!1:we>=1&&we<=10},[Ve]),vn=h.useMemo(()=>{if(xt==="")return!1;const we=Number(xt);return Number.isNaN(we)?!1:we>=1e-4},[xt]),Wn=h.useMemo(()=>{if(tn==="")return!1;const we=Number(tn);return Number.isNaN(we)?!1:we>=1e-4},[tn]),On=h.useMemo(()=>{if(hn===""||hn==="0.0"||hn==="0."||hn==="0")return!1;const we=Number(hn);if(Number.isNaN(we)||we<.1)return!1;if(st){const Te=Number(st);if(!Number.isNaN(Te)&&we>Te)return!1}return!0},[hn,st]);h.useEffect(()=>{if(!st)return;const we=Number(st),Te=Number(hn);!Number.isNaN(Te)&&Te>we&&nn(we),!Number.isNaN(Te)&&Te<.1&&nn("")},[st]);const $t=h.useMemo(()=>{if(!Oe||!oe||!_e||!xt||!Ve||!Ye)return"";const we=Number(xt)*Number(Oe),Te=Number(_e)/(2*Number(Ve)),te=Te-Te*.05;return we<te?"":"Order size is too large for your available margin. Reduce order size or active orders (per side), or increase leverage."},[Oe,oe,_e,xt,Ve,Ye]),Nn=h.useMemo(()=>{if(!Oe||!_e||!tn)return"";const we=Number(tn)*Number(Oe),Te=_e-_e*.05;return we<Te?"":"Max net position (per side) exceeds your total available margin. Reduce max net position (per side) or increase leverage."},[Oe,_e,tn]),Fn=$!==""&&!Xn&&!Rt&&y&&kt&&Mt&&ln&&vn&&Wn&&(ht===""||gt)&&(hn===""||On);async function Tt(){if(y)try{pt(!0);const we=window.localStorage.getItem("hyperToken"),Te=window.localStorage.getItem("hyperAddress");if(!we||!Te){v(!1),n(!0);return}const ve=await(await fetch(`${hO}/api/hyper/mmbot/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Te.toLowerCase(),token:we})})).json();if(ve!=null&&ve.success&&(ve!=null&&ve.data)){const Be=ve.data[0],Ue=(Be==null?void 0:Be.bot_params)||{};N(!0),In((Be==null?void 0:Be.id)??null),Be!=null&&Be.coin?(L(Be.coin),Q((Ue==null?void 0:Ue.coin)||Be.coin)):Ue!=null&&Ue.coin&&(L(Ue.coin),Q(Ue.coin)),(Ue==null?void 0:Ue.leverage)!=null&&Je(String(Ue.leverage)),(Ue==null?void 0:Ue.bps)!=null&&He(String(Ue.bps)),(Ue==null?void 0:Ue.orders_per_side)!=null&&bt(String(Ue==null?void 0:Ue.orders_per_side)),(Ue==null?void 0:Ue.order_per_size)!=null&&Qt(String(Ue==null?void 0:Ue.order_per_size)),(Ue==null?void 0:Ue.max_pos_size)!=null&&fn(String(Ue==null?void 0:Ue.max_pos_size)),(Ue==null?void 0:Ue.tp_sl_bps)!=null&&nn(String(Ue==null?void 0:Ue.tp_sl_bps)),(Ue==null?void 0:Ue.budget)!=null&&rt(String(Ue==null?void 0:Ue.budget))}}catch(we){console.error("Failed to load saved info:",we)}finally{pt(!1)}}h.useEffect(()=>{un?pn():(ne(null),he(null),ge(""))},[un]),h.useEffect(()=>{y&&(t(),Tt(),ce())},[y]);async function pn({silent:we=!1}={}){try{ge(""),we||(ie(!0),ne(null),he(null));const Te=un;if(!Te)throw new Error("StandX token missing. Please sign in again.");const ve=await(await fetch($6n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Te}`}})).json(),Be=(ve==null?void 0:ve.balance)??null,Ue=(ve==null?void 0:ve.cross_available)??null;if(Be==null||Ue==null)throw new Error("Balance not available.");ne(Be),he(Ue)}catch(Te){ge(Te.message||"Failed to load DUSD balance.")}finally{we||ie(!1)}}h.useEffect(()=>{if(!C||!un)return;pn({silent:!0});const we=setInterval(()=>{pn({silent:!0})},1e4);return()=>clearInterval(we)},[C,un]);async function ke(){try{je(""),q(!0);const we=z;if(!we)return;const te=await(await fetch(`https://express-proxy-delta.vercel.app/proxy?url=https://perps.standx.com/api/query_symbol_price?symbol=${we}-USD`,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),ve=(te==null?void 0:te.mark_price)??null;if(ve==null)throw new Error("Margin not available.");$e(ve)}catch(we){je(we.message||"Failed to load DUSD margin.")}finally{q(!1)}}h.useEffect(()=>{z&&ke()},[z]),h.useEffect(()=>{xe(Ye&&oe?oe*Ye:null)},[Ye,oe]);function m(){un&&pn(),z&&ke()}async function p(){var we,Te,te;if(!y){n(!0);return}if(Fn)try{P(!0),de(""),ct(!0);const ve=window.localStorage.getItem("hyperToken"),Be=window.localStorage.getItem("hyperAddress");if(!ve||!Be){v(!1),n(!0);return}let Ue=null,Fe=null,at=null;try{const an=`dextrabot_standx_auth_data_${Be.toLowerCase()}`,et=window.localStorage.getItem(an);if(et){const Pt=JSON.parse(et),qt=`bsc_${Be.toLowerCase()}`;Ue=((we=Pt==null?void 0:Pt[qt])==null?void 0:we.signingKeyHex)||null,Fe=((Te=Pt==null?void 0:Pt[qt])==null?void 0:Te.token)||null,at=((te=Pt==null?void 0:Pt[qt])==null?void 0:te.requestId)||null}}catch(an){console.warn("StandX auth data parse failed:",an)}const ut={coin:z,leverage:Number(Ye),bps:Number(st),orders_per_side:Number(Ve),order_per_size:Number(xt),max_pos_size:Number(tn),tp_sl_bps:Number(hn),budget:Number(ht),standx_token:Fe,signingKeyHex:Ue,requestId:at},yt={address:Be.toLowerCase(),token:ve,coin:$,wallet_id:0,source_market:"standx",bot_params:ut},Gt=await(await fetch(`${hO}/api/hyper/mmbot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(yt)})).json();Gt!=null&&Gt.success?(t(),Tt(),dn.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"}}),N(!0),localStorage.setItem("standXMarketMakerStart","true")):(de((Gt==null?void 0:Gt.error_message)||"Start failed."),dn.error((Gt==null?void 0:Gt.error_message)||"Save failed."),N(!1))}catch(ve){de(ve.message||"An error occurred while saving.")}finally{P(!1),It(!1),ct(!1),N(!1)}}async function S(){if(!y){n(!0);return}try{F(!0),de("");const we=window.localStorage.getItem("hyperToken"),Te=window.localStorage.getItem("hyperAddress");if(!we||!Te){n(!0);return}const ve=await(await fetch(`${hO}/api/hyper/mmbot/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Te.toLowerCase(),token:we,source_market:"standx",coin:z,wallet_id:0})})).json();ve!=null&&ve.success?(N(!1),Tt(),t(),localStorage.setItem("standXMarketMakerStart","false")):de((ve==null?void 0:ve.error_message)||"Stop failed.")}catch(we){de(we.message||"An error occurred while stopping.")}finally{F(!1),It(!1)}}const A=32,k={control:(we,Te)=>({...we,backgroundColor:"#242424",borderColor:Te.isFocused?"#67FFBD":"#353535",minHeight:A,height:A,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:we=>({...we,height:A,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:we=>({...we,height:A}),input:we=>({...we,color:"#FFFFFF",margin:0,padding:0}),singleValue:we=>({...we,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:we=>({...we,color:"#7F7F7F",fontSize:"12px"}),menu:we=>({...we,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:we=>({...we,paddingTop:0,paddingBottom:0,maxHeight:180}),option:(we,Te)=>({...we,backgroundColor:Te.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:A,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:we=>({...we,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:we=>({...we,backgroundColor:"#353535"})},T=({max:we})=>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:[we,"x"]}),D=we=>{var Te;return i.jsx(ma.Option,{...we,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Te=we.data)!=null&&Te.icon?i.jsx("img",{src:we.data.icon,alt:we.data.label,className:"w-4 h-4",onError:te=>te.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:we.data.label}),i.jsx(T,{max:we.data.maxLeverage})]})})},V=we=>{var Te;return i.jsx(ma.SingleValue,{...we,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Te=we.data)!=null&&Te.icon?i.jsx("img",{src:we.data.icon,alt:we.data.label,className:"w-4 h-4",onError:te=>te.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:we.data.label}),i.jsx(T,{max:we.data.maxLeverage})]})})},X=(we,Te)=>{L(we),Q(Te)},le=Kn,ce=async()=>{var te,ve;const we=window.localStorage.getItem("hyperToken"),Te=window.localStorage.getItem("hyperAddress");if(!(!we||!Te))try{K(!0);const Be=await vi(Te.toLowerCase(),we);Be!=null&&Be.success?(r(Be==null?void 0:Be.telegram_chat_id),s(Be==null?void 0:Be.subscriber_role),a((te=Be==null?void 0:Be.mushboomer_counts)==null?void 0:te.eth),o((ve=Be==null?void 0:Be.mushboomer_counts)==null?void 0:ve.sol),l(Be==null?void 0:Be.referral_code),c(Be==null?void 0:Be.refcode),u(Be==null?void 0:Be.whitelist),d(we),f(Te),K(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),d(""),f(""),K(!1))}catch(Be){console.error("Token verification error:",Be),console.error(Be.message||"An unknown error occurred."),K(!1)}};async function fe({standx_access_token:we,standx_sign_key:Te,standx_request_id:te}){try{const ve=window.localStorage.getItem("hyperToken"),Be=window.localStorage.getItem("hyperAddress");if(!ve||!Be||!_n)return;await fetch(`${hO}/api/hyper/standx/refresh_token/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Be.toLowerCase(),token:ve,standx_bot_id:_n,standx_access_token:we,standx_sign_key:Te,standx_request_id:te})})}catch(ve){console.error("Failed to refresh StandX bot token:",ve)}}const ye=async()=>{const we=await x();we!=null&&we.token&&(yn(we.token),C&&await fe({standx_access_token:we.token,standx_sign_key:we.signingKeyHex,standx_request_id:we.requestId}))},Pe=se||I||M,Me=C&&!M,Ke=jn($);return i.jsxs(i.Fragment,{children:[i.jsx(E6n,{open:We,setOpen:It,makerStatus:C?S:p,isStatusWallet:"",info:"settings",modalLoading:Ge,active:C,modalDataInfo:Sn}),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(Us,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx(Us,{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(Vs,{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 "+(Xn?"text-[#FF797C]":"text-[#F8D4AB]"),children:vt==null?void 0:vt.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),i.jsx("div",{onClick:()=>{g||ye()},className:`flex justify-center items-center cursor-pointer ${g?"opacity-50 cursor-not-allowed":""}`,title:"Refresh / Valid Until",children:i.jsx(Jg,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${g?"animate-spin":""}`})})]})]}),i.jsx("input",{value:un.slice(0,10)+"..."+un.slice(-4),readOnly:!0,autoComplete:"off",type:"password",placeholder:"Wallet address (0x...)",onFocus:we=>we.target.blur(),onCopy:we=>we.preventDefault(),onCut:we=>we.preventDefault(),onPaste:we=>we.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`}),vt&&i.jsxs("div",{className:"text-[12px] pl-[3px] flex justify-start items-center gap-2",children:[Xn&&i.jsx("span",{children:i.jsx("img",{src:Hl,alt:"",className:"w-3.5 h-3.5 min-w-max"})}),Rt&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:Rt})]})]}),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(Us,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]})}),z&&i.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#9B9B9B] font-manrope font-semibold min-w-max",children:[z," Mark Price (DUSD):",i.jsx("span",{className:"text-white",children:ae?"Loading...":Ce?"—":z7(Oe??"0")}),i.jsx("div",{onClick:m,className:"flex justify-center items-center cursor-pointer",title:"Refresh Mark Price",children:i.jsx(Jg,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${G?"animate-spin":""}`})})]})]}),i.jsx(hl,{styles:k,components:{Option:D,SingleValue:V},isDisabled:Pe||Me,options:le,value:le.find(we=>we.label===$)||null,onChange:we=>X((we==null?void 0:we.label)??"",(we==null?void 0:we.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(Us,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("input",{value:Ye,onChange:we=>{let Te=we.target.value.trim();if(Te==="")return Je("");Te.startsWith("0")&&(Te=Te.replace(/^0+/,"")||"0"),pe(Te)&&Je(Te)},onKeyDown:ze,inputMode:"numeric",autoComplete:"off",placeholder:$?`1–${Ke}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]":kt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me}),Ye!==""&&!kt&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Leverage must be between 1 and ",Ke,"."]})]}),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(Us,{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(Vs,{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:st,onChange:we=>{let Te=we.target.value.trim();if(Te==="")return He("");Te.startsWith(".")&&(Te=`0${Te}`),Ae(Te)&&He(Te)},onKeyDown:ze,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] ${st===""?"border-[#353535]":Mt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me})}),st!==""&&!Mt&&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(Us,{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(Vs,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})})})]}),i.jsx("input",{value:Ve,onChange:we=>{let Te=we.target.value.trim();if(Te==="")return bt("");Te.startsWith("0")&&(Te=Te.replace(/^0+/,"")||"0"),pe(Te)&&bt(Te)},onKeyDown:ze,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] ${Ve===""?"border-[#353535]":ln?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me}),Ve!==""&&!ln&&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 ",$?`(${$})`:""]}),i.jsx(Us,{content:"The size of each individual order.",children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(Vs,{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:xt,onChange:we=>{let Te=we.target.value.trim();if(Vn("size"),Te===""){Qt("");return}Te.startsWith(".")&&(Te=`0${Te}`),qe(Te,zt)&&Qt(Te)},onKeyDown:ze,inputMode:"decimal",autoComplete:"off",placeholder:$?`e.g. 0.0001 ${$}`:"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] ${xt===""?"border-[#353535]":vn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me}),$&&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:$})]})]}),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(Us,{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(Vs,{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:we=>{let Te=we.target.value.trim();if(Vn("usd"),Te===""){on("");return}Te.startsWith(".")&&(Te=`0${Te}`),qe(Te,2)&&on(Te)},onKeyDown:ze,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:Pe||Me})]})]})]}),xt!==""&&!vn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:$==="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:$?`Max Net Pos (Per Side) (${$})`:"Max Net Position (Per Side)"}),i.jsx(Us,{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(Vs,{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:tn,onChange:we=>{let Te=we.target.value.trim();if(Ut("size"),Te===""){fn("");return}Te.startsWith(".")&&(Te=`0${Te}`),qe(Te,$==="BTC"?4:3)&&fn(Te)},onKeyDown:ze,inputMode:"decimal",autoComplete:"off",placeholder:$?`e.g. 0.0001 ${$}`:"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] ${tn===""?"border-[#353535]":Wn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me}),$&&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:$})]})]}),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(Us,{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(Vs,{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:rn,onChange:we=>{let Te=we.target.value.trim();if(Ut("usd"),Te===""){nt("");return}Te.startsWith(".")&&(Te=`0${Te}`),qe(Te,2)&&nt(Te)},onKeyDown:ze,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:Pe||Me})]})]})]}),tn!==""&&!Wn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:$==="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(Us,{content:i.jsx(B6n,{}),children:i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(Vs,{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:hn,onChange:we=>{let Te=we.target.value.trim();if(Te==="")return nn("");Te.startsWith(".")&&(Te=`0${Te}`),Ae(Te)&&nn(Te)},onKeyDown:ze,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] ${hn===""?"border-[#353535]":On?"border-[#090808] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me})}),hn!==""&&!On&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:st===""?"Enter a value greater than or equal to 0.1":`Enter a value between 0.1 and ${st}.`})]}),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(Us,{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(Vs,{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:ht,onChange:we=>{let Te=we.target.value.trim();if(Te==="")return rt("");Te.startsWith(".")&&(Te=`0${Te}`),Ae(Te)&&rt(Te)},onKeyDown:ze,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] ${ht===""?"border-[#353535]":gt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Pe||Me})]}),ht!==""&&!gt&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:W===null||W==="0"?"Enter a value greater than or equal to 0.1":`Enter a value between 0.1 and ${De(W)}`})]})]}),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:y&&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:m,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(Jg,{className:`w-4 h-4 text-[#7C7C7C] hover:text-white ${G?"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:G?"Loading...":Se?"—":z7(W??"0")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:["Available Balance (DUSD):",i.jsx("span",{className:"text-white",children:G?"Loading...":Se?"—":z7(oe??"0")})]}),Ye&&i.jsxs("div",{className:"flex items-center gap-2",children:["Total Value (DUSD):",i.jsx("span",{className:"text-white",children:G?"Loading...":Se?"—":z7(_e??"0")})]})]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2",children:[$t&&!C&&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(gN,{className:"w-4 h-4 text-[#F59E0B]"}),i.jsx("div",{className:"text-[#F59E0B] text-[11px]",children:$t})]}),Nn&&!C&&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(gN,{className:"w-4 h-4 text-[#F59E0B]"}),i.jsx("div",{className:"text-[#F59E0B] text-[11px]",children:Nn})]})]})]})})}),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:C?i.jsx("button",{onClick:()=>{It(!0),Yn({coin:$,spread:st,per_side:Ve,order_size:xt,max_per_side:tn,tp_sl:hn,leverage:Ye})},disabled:!Fn||Pe,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Fn||Pe?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#ff4444] border-[#ff6666] hover:bg-[#ff3333] cursor-pointer"}`,children:M?"Stopping...":"Stop"}):i.jsx("button",{onClick:()=>{It(!0),Yn({coin:$,spread:st,per_side:Ve,order_size:xt,max_per_side:tn,tp_sl:hn,budget:ht,leverage:Ye})},disabled:!Fn||Pe,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Fn||Pe?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer"}`,children:I?"Loading...":"Start"})})})]})]})},z6n=({data:t,setData:e,loading:n,error:r,fetchInfoOnOpen:s,isFilterWallet:a})=>{var ge,Ce;h.useContext(Yr);const{isConnected:o,address:l}=es();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,N]=h.useState([]),[I,P]=h.useState(!1),[M,F]=h.useState(!1),[$,L]=h.useState(!1),[z,Q]=h.useState(!1),se=h.useRef(null),ee=h.useRef(null),K=h.useRef(null),re=h.useRef(null),de=h.useRef(new Map),G=h.useRef(new Set);h.useState(!1);const ie="tag",[ae,q]=h.useState(ie),W=je=>{if(!c){let Oe=t;const $e=Oe==null?void 0:Oe.filter(Ye=>{var ht,rt,st,He;const Je=y.trim().toUpperCase();if(Je&&!(((He=(st=(rt=(ht=Ye==null?void 0:Ye.bot)==null?void 0:ht.symbol)==null?void 0:rt.split("-"))==null?void 0:st[0])==null?void 0:He.toUpperCase())||"").includes(Je))return!1;if(C.length>0){const Ve={"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"},bt=C.map(Qt=>Ve[Qt]).filter(Boolean),xt=((Ye==null?void 0:Ye.event)||(Ye==null?void 0:Ye.status)||"").toString().toUpperCase();if(!bt.includes(xt))return!1}return!0});return $e==null?void 0:$e.sort((Ye,Je)=>{var Ve,bt,xt,Qt,St,on,cn,Vn;const ht=((Qt=(xt=(bt=(Ve=Ye==null?void 0:Ye.bot)==null?void 0:Ve.symbol)==null?void 0:bt.split("-"))==null?void 0:xt[0])==null?void 0:Qt.toUpperCase())||"",rt=((Vn=(cn=(on=(St=Je==null?void 0:Je.bot)==null?void 0:St.symbol)==null?void 0:on.split("-"))==null?void 0:cn[0])==null?void 0:Vn.toUpperCase())||"",st=Ye!=null&&Ye.ts?new Date(Ye==null?void 0:Ye.ts).getTime():0,He=Je!=null&&Je.ts?new Date(Je==null?void 0:Je.ts).getTime():0;return je==="coin"?ht<rt?-1:ht>rt?1:0:je==="-coin"?ht>rt?-1:ht<rt?1:0:je==="time"?st-He:je==="-time"?He-st:0})}return t},ne=["User Stopped","Bot Started","Leverage Set","Orders Starting","Max Pos Reached","Budget Exceeded","Token Expiry"],oe=je=>{N(Oe=>Oe.includes(je)?Oe.filter($e=>$e!==je):[...Oe,je])};h.useEffect(()=>{function je(Oe){se.current&&!se.current.contains(Oe.target)&&F(!1),ee.current&&!ee.current.contains(Oe.target)&&L(!1),re.current&&!re.current.contains(Oe.target)&&Q(!1),K.current&&!K.current.contains(Oe.target)&&P(!1)}return document.addEventListener("mousedown",je),()=>document.removeEventListener("mousedown",je)},[]);const he=async()=>{try{const je=window.localStorage.getItem("hyperToken"),Oe=window.localStorage.getItem("hyperAddress");if(!je||!Oe)return;const Je=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():Oe,token:je})})).json();Je.success&&e((Je==null?void 0:Je.data)||[])}catch(je){dn.error(je.message||"Something went wrong")}finally{}},_e=()=>localStorage.getItem("standXMarketMakerStart")==="true";h.useEffect(()=>{let je=null,Oe=null;const $e=()=>{je||(he(),je=setInterval(()=>{he()},1e4))},Ye=()=>{Oe||(Oe=setTimeout(()=>{je&&(clearInterval(je),je=null),Oe=null},4e4))},Je=()=>{Oe&&(clearTimeout(Oe),Oe=null)},ht=setInterval(()=>{_e()?(Je(),$e()):je&&Ye()},1e3);return()=>{je&&clearInterval(je),Oe&&clearTimeout(Oe),clearInterval(ht)}},[]),h.useEffect(()=>()=>{de.current.forEach(je=>clearTimeout(je)),de.current.clear()},[]);const xe=(je,Oe)=>{var $e,Ye;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"}-${(($e=je==null?void 0:je.bot)==null?void 0:$e.symbol)||"symbol"}-${((Ye=je==null?void 0:je.data)==null?void 0:Ye.message_en)||"message"}-${Oe}`};h.useEffect(()=>{const je=new Set((t||[]).map(($e,Ye)=>xe($e,Ye))),Oe=G.current;if(Oe.size>0){const $e=[];je.forEach(Ye=>{Oe.has(Ye)||$e.push(Ye)}),$e.length>0&&(g(Ye=>{const Je=new Set(Ye);return $e.forEach(ht=>Je.add(ht)),Je}),$e.forEach(Ye=>{de.current.has(Ye)&&clearTimeout(de.current.get(Ye));const Je=setTimeout(()=>{g(ht=>{const rt=new Set(ht);return rt.delete(Ye),rt}),de.current.delete(Ye)},3e3);de.current.set(Ye,Je)}))}G.current=je},[t]),h.useEffect(()=>{const je=localStorage.getItem("hyperToken"),Oe=localStorage.getItem("hyperAddress");f(!!(je&&Oe));const $e=setInterval(()=>{const Ye=localStorage.getItem("hyperToken"),Je=localStorage.getItem("hyperAddress");f(!!(Ye&&Je))},800);return()=>clearInterval($e)},[]);const Se={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:ae,setSortOption:q,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>P(!I),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"}`})}),I&&i.jsxs("div",{ref:K,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:ae,setSortOption:q,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:()=>Q(!z),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"}`})}),z&&i.jsxs("div",{ref:re,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:()=>N([]),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"})})]}),ne==null?void 0:ne.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:()=>oe(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(Ba,{})})})}):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(_l,{})})})}):((ge=W(ae))==null?void 0:ge.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:Kl,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."})})]})})})})}):(Ce=W(ae))==null?void 0:Ce.map((je,Oe)=>{var st,He,Ve,bt,xt,Qt,St;const $e=Oe%2===0,Ye=$e?"bg-[#0b100f]":"bg-[#0c1310]",Je=$e?"group-hover:bg-[#111814]":"group-hover:bg-[#141c17]",ht=xe(je,Oe),rt=x.has(ht);return i.jsxs("tr",{className:`relative group h-[42px] border-b border-white/5 text-white transition ${Ye} hover:bg-[#131b18] ${rt?"standx-new-row":""}`,children:[i.jsx("td",{scope:"row",className:`${Ye} sm:sticky sm:left-0 z-[2] ${Je} ${rt?"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 on,cn;window.open(`/terminal/${(cn=(on=je==null?void 0:je.bot)==null?void 0:on.symbol)==null?void 0:cn.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:Se[(He=(st=je==null?void 0:je.bot)==null?void 0:st.symbol)==null?void 0:He.split("-")[0]]||za,alt:(Ve=je==null?void 0:je.bot)==null?void 0:Ve.symbol,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:on=>Qi(on)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:(xt=(bt=je==null?void 0:je.bot)==null?void 0:bt.symbol)==null?void 0:xt.split("-")[0]})]})})})}),i.jsx("td",{scope:"row",className:`${Ye} sm:sticky sm:left-[140px] z-[2] ${Je} ${rt?"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:`${Ye} z-[2] ${Je} ${rt?"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(na,{info1:je!=null&&je.event?je.event.replace(/_/g," "):"--",info1_Color:"text-white",rowTwo:!1})})})}),i.jsx("td",{scope:"row",className:`${Ye} z-[1] ${Je} pr-6 min-w-[200px] sm:min-w-[240px] md:w-[340px] md:max-w-[380px] ${rt?"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:(Qt=je==null?void 0:je.data)!=null&&Qt.message_en?`${(St=je==null?void 0:je.data)==null?void 0:St.message_en}`:"--"})})})})})})]},ht)})})]})})})]})})},H6n="https://dextradata.nftinit.io",V6n=()=>{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(`${H6n}/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(ho.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(U6n,{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(z6n,{data:n,setData:r,loading:t,error:s,fetchInfoOnOpen:c,isFilterWallet:o})})})]})]})},W6n=()=>{const{setSignModalOpen:t}=h.useContext(Yr);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:"StandX Market Maker"}),i.jsx("p",{className:"text-sm font-semibold text-white sm:text-base",children:"Connect your wallet to use StandX Market Maker"}),i.jsx("p",{className:"text-[12px] text-[#9BA1A6] text-center max-w-md",children:"Connect your wallet to start providing liquidity with StandX Market Maker."}),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"})})]})]})})]})},q6n=()=>{const{signIn:t,loading:e}=IKe();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:"StandX Market Maker"}),i.jsx("p",{className:"text-sm font-semibold text-white sm:text-base",children:"Confirm your signature to use StandX Market Maker"}),i.jsx("p",{className:"text-[12px] text-[#9BA1A6] text-center max-w-md",children:"By signing in, you agree to our terms and conditions."}),i.jsx("div",{className:"w-[220px] pt-1",children:i.jsx("button",{disabled:e,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 ${e?"opacity-50 cursor-not-allowed":""}`,children:e?"Signing...":"Confirm"})})]})]})})]})},G6n=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c}=h.useContext(Yr),[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"),N=localStorage.getItem("hyperAddress");d(!!(C&&N))},800);return()=>clearInterval(v)},[]),h.useEffect(()=>{const g=()=>{var v;try{const C=localStorage.getItem("hyperAddress");if(!C)return x(!1);const N=localStorage.getItem(`dextrabot_standx_auth_data_${C.toLowerCase()}`);if(!N)return x(!1);const I=JSON.parse(N),M=`bsc_${C.toLowerCase()}`;x(!!((v=I==null?void 0:I[M])!=null&&v.token))}catch{x(!1)}};g();const y=setInterval(g,500);return()=>clearInterval(y)},[]),h.useEffect(()=>{(async()=>{var C,N;const y=window.localStorage.getItem("hyperToken"),v=window.localStorage.getItem("hyperAddress");if(!(!y||!v))try{const I=await vi(v.toLowerCase(),y);I!=null&&I.success?(t(I==null?void 0:I.telegram_chat_id),e(I==null?void 0:I.subscriber_role),n((C=I==null?void 0:I.mushboomer_counts)==null?void 0:C.eth),s((N=I==null?void 0:I.mushboomer_counts)==null?void 0:N.sol),a(I==null?void 0:I.referral_code),o(I==null?void 0:I.refcode),r(I==null?void 0:I.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""))}catch(I){console.error("Token verification error:",I)}})()},[u]),i.jsxs(i.Fragment,{children:[i.jsx(Ga,{children:i.jsxs(no,{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:u?f?i.jsx(V6n,{}):i.jsx(q6n,{}):i.jsx(W6n,{})})})]})},pO="#basedapp-farming",mO="#aster-farming",xO="#lighter-farming",gO="#apex-farming",bO="#variational-farming",yO="#extended-farming",vO="#paradex-farming",wO="#pacifica-farming";function K6n(){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(Yr),r=Xl(),s=Ao(),[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(!1),[f,x]=h.useState(!1),g=r.hash===pO,y=r.hash===mO,v=r.hash===xO,C=r.hash===gO,N=r.hash===bO,I=r.hash===yO,P=r.hash===vO,M=r.hash===wO,F=Ie.useCallback(re=>{re?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]),$=Ie.useCallback(re=>{re?r.hash!==mO&&s(r.pathname+r.search+mO,{replace:!0}):r.hash===mO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),L=Ie.useCallback(re=>{re?r.hash!==xO&&s(r.pathname+r.search+xO,{replace:!0}):r.hash===xO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),z=Ie.useCallback(re=>{re?r.hash!==gO&&s(r.pathname+r.search+gO,{replace:!0}):r.hash===gO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),Q=Ie.useCallback(re=>{re?r.hash!==bO&&s(r.pathname+r.search+bO,{replace:!0}):r.hash===bO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),se=Ie.useCallback(re=>{re?r.hash!==yO&&s(r.pathname+r.search+yO,{replace:!0}):r.hash===yO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),ee=Ie.useCallback(re=>{re?r.hash!==vO&&s(r.pathname+r.search+vO,{replace:!0}):r.hash===vO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),K=Ie.useCallback(re=>{re?r.hash!==wO&&s(r.pathname+r.search+wO,{replace:!0}):r.hash===wO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]);return h.useEffect(()=>{const re=localStorage.getItem("dailyPicksDismissedAt"),de=localStorage.getItem("dailyPicksBlockedUntil"),G=Date.now();if(de&&G<parseInt(de)){o(!1);return}if(re){const ie=new Date(parseInt(re)).toDateString(),ae=new Date().toDateString();if(ie===ae){o(!1);return}}o(!0)},[r.pathname,e]),h.useEffect(()=>{const re=window.localStorage.getItem("hyperToken"),de=localStorage.getItem("hyperAddress");if(!re||!de)return;if(n===null||n===0||Number(n)>7){c(!1);return}const G=localStorage.getItem(`lighterCopyTradeDismissedAt_${de}`);if(G){const ie=new Date(parseInt(G)).toDateString(),ae=new Date().toDateString();if(ie===ae){window.location.pathname==="/my-profile"?c(!0):c(!1);return}}c(!0)},[r.pathname,e,n]),h.useEffect(()=>{const re=localStorage.getItem("strategySelectorModalDismissedAt");if(re){const de=new Date(parseInt(re)).toDateString(),G=new Date().toDateString();if(de===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(sJe,{})}),i.jsxs("div",{children:[i.jsx(Wln,{}),i.jsxs(tZe,{children:[i.jsx(da,{path:"/",element:i.jsx(dun,{})}),i.jsx(da,{path:"/sitemap",element:i.jsx(xun,{})}),i.jsx(da,{path:"/videos",element:i.jsx(gun,{})}),t.map(({from:re,to:de})=>i.jsx(da,{path:re,element:i.jsx(hhe,{to:de,replace:!0})},re)),i.jsxs(da,{element:i.jsx(Can,{}),children:[i.jsx(da,{path:"/mobile-auth",element:i.jsx(mun,{})}),i.jsx(da,{path:"discover-wallets",element:i.jsx(eln,{})}),i.jsx(da,{path:"/hyperliquid-vaults",element:i.jsx(bun,{})}),i.jsx(da,{path:"/back-testing",element:i.jsx(ewn,{})}),i.jsx(da,{path:"/hyperliquid-whale-trades",element:i.jsx(zvn,{})}),i.jsx(da,{path:"wallet-details/:walletAddress",element:i.jsx(Hln,{})}),i.jsx(da,{path:"tracked-wallets",element:i.jsx(Gln,{})}),i.jsx(da,{path:"tracker",element:i.jsx(dcn,{})}),i.jsx(da,{path:"referral/:code?",element:i.jsx(gcn,{})}),i.jsx(da,{path:"wallet-management",element:i.jsx(Icn,{})}),i.jsx(da,{path:"copy-trade",element:i.jsx(Ocn,{})}),i.jsx(da,{path:"leaderboard",element:i.jsx($cn,{})}),i.jsx(da,{path:"ticker",element:i.jsx(Cun,{})}),i.jsx(da,{path:"terminal",element:i.jsx(hhe,{to:"/terminal/hyperliquid/BTC",replace:!0})}),i.jsx(da,{path:"terminal/:coin",element:i.jsx(Y6n,{})}),i.jsx(da,{path:"terminal/:exchange/:coin",element:i.jsx($1n,{})}),i.jsx(da,{path:"telegram-verify",element:i.jsx(Vvn,{})}),i.jsx(da,{path:"telegram-api-wallet",element:i.jsx(nwn,{})}),i.jsx(da,{path:"subscribe",element:i.jsx(Hwn,{})}),i.jsx(da,{path:"my-profile",element:i.jsx(t3n,{})}),i.jsx(da,{path:"hyperliquid-fee-calculator",element:i.jsx(e8e,{})}),i.jsx(da,{path:"hyperliquid-fee-calculator/:walletAddress",element:i.jsx(e8e,{})}),i.jsx(da,{path:"market-maker",element:i.jsx(Zwn,{})}),i.jsx(da,{path:"dca-bot",element:i.jsx(Uwn,{})}),i.jsx(da,{path:"standx-mm",element:i.jsx(G6n,{})}),i.jsx(da,{path:"funding",element:i.jsx(r3n,{})}),i.jsx(da,{path:"funding-history/:pair",element:i.jsx(S6n,{})})]}),i.jsx(da,{path:"*",element:i.jsx(X6n,{url:"https://dextrabot.com/"})})]}),i.jsx(wce,{open:g,setOpen:F}),i.jsx(j6n,{open:l,setOpen:c}),i.jsx(A6n,{open:u,setOpen:d}),i.jsx(_6n,{open:f,setOpen:x}),i.jsx(Cce,{open:y,setOpen:$}),i.jsx(Sce,{open:v,setOpen:L}),i.jsx(Nce,{open:C,setOpen:z}),i.jsx(jce,{open:N,setOpen:Q}),i.jsx(SU,{open:I,setOpen:se}),i.jsx(Ace,{open:P,setOpen:ee}),i.jsx(_ce,{open:M,setOpen:K})]})]})}function Y6n(){const{coin:t}=g2(),e=Ao();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 X6n({url:t}){return Ie.useEffect(()=>{window.location.replace(t)},[t]),i.jsx(Ga,{children:i.jsxs(no,{children:[i.jsx("meta",{name:"prerender-status-code",content:"301"}),i.jsx("meta",{name:"prerender-header",content:`Location: ${t}`})]})})}const Q6n="4953aed406a7fd4457496250b7e4efbc",Z6n=RBt({appName:"Dextrabot",projectId:Q6n,chains:[LE,qbe,Wbe,Vbe],transports:{[LE.id]:H7(),[qbe.id]:H7(),[Wbe.id]:H7(),[Vbe.id]:H7()},ssr:!1}),J6n=new Eyt,eCn=document.getElementById("root"),tCn=NAe.createRoot(eCn);tCn.render(i.jsx(uZe,{children:i.jsx(nyt,{config:Z6n,children:i.jsx(Xyt,{client:J6n,children:i.jsx(rDt,{modalSize:"compact",theme:JLe({borderRadius:"large",fontStack:"rounded",overlayBlur:"large"}),children:i.jsx(qwt,{children:i.jsx(K6n,{})})})})})}));const cAe=Object.freeze(Object.defineProperty({__proto__:null,default:mne},Symbol.toStringTag,{value:"Module"}));export{Br as B,woe as E,S9 as H,D6n as V,os as _,GCn as a,m1 as b,d$ as c,h0t as d,C2 as e,ix as f,Dae as g,Ti as h,noe as i,sQe as j,Ru as k,Pke as l,P6n as m,zbt as n,cRt as r,Rc as s,x4n as t};