@cetusprotocol/terminal 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(qt,te){typeof exports=="object"&&typeof module<"u"?te(exports,require("react"),require("react-dom"),require("@mysten/dapp-kit")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@mysten/dapp-kit"],te):(qt=typeof globalThis<"u"?globalThis:qt||self,te(qt.CetusSwap={},qt.React,qt.ReactDOM,qt.dappKit))})(this,function(qt,te,kn,Ur){"use strict";var ND=Object.defineProperty;var jD=(qt,te,kn)=>te in qt?ND(qt,te,{enumerable:!0,configurable:!0,writable:!0,value:kn}):qt[te]=kn;var vt=(qt,te,kn)=>(jD(qt,typeof te!="symbol"?te+"":te,kn),kn);function Hh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const P=Hh(te),qh=Hh(kn);function R2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wh={exports:{}},lr=Wh.exports={},Dn,Bn;function el(){throw new Error("setTimeout has not been defined")}function tl(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Dn=setTimeout:Dn=el}catch{Dn=el}try{typeof clearTimeout=="function"?Bn=clearTimeout:Bn=tl}catch{Bn=tl}})();function Gh(e){if(Dn===setTimeout)return setTimeout(e,0);if((Dn===el||!Dn)&&setTimeout)return Dn=setTimeout,setTimeout(e,0);try{return Dn(e,0)}catch{try{return Dn.call(null,e,0)}catch{return Dn.call(this,e,0)}}}function N2(e){if(Bn===clearTimeout)return clearTimeout(e);if((Bn===tl||!Bn)&&clearTimeout)return Bn=clearTimeout,clearTimeout(e);try{return Bn(e)}catch{try{return Bn.call(null,e)}catch{return Bn.call(this,e)}}}var ni=[],Do=!1,io,Va=-1;function j2(){!Do||!io||(Do=!1,io.length?ni=io.concat(ni):Va=-1,ni.length&&Kh())}function Kh(){if(!Do){var e=Gh(j2);Do=!0;for(var t=ni.length;t;){for(io=ni,ni=[];++Va<t;)io&&io[Va].run();Va=-1,t=ni.length}io=null,Do=!1,N2(e)}}lr.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];ni.push(new Yh(e,t)),ni.length===1&&!Do&&Gh(Kh)};function Yh(e,t){this.fun=e,this.array=t}Yh.prototype.run=function(){this.fun.apply(null,this.array)},lr.title="browser",lr.browser=!0,lr.env={},lr.argv=[],lr.version="",lr.versions={};function ii(){}lr.on=ii,lr.addListener=ii,lr.once=ii,lr.off=ii,lr.removeListener=ii,lr.removeAllListeners=ii,lr.emit=ii,lr.prependListener=ii,lr.prependOnceListener=ii,lr.listeners=function(e){return[]},lr.binding=function(e){throw new Error("process.binding is not supported")},lr.cwd=function(){return"/"},lr.chdir=function(e){throw new Error("process.chdir is not supported")},lr.umask=function(){return 0};var k2=Wh.exports;const pn=R2(k2);var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zh(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var rl={exports:{}},Ls={};/**
1
+ (function(qt,ne){typeof exports=="object"&&typeof module<"u"?ne(exports,require("react"),require("react-dom"),require("@mysten/dapp-kit")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@mysten/dapp-kit"],ne):(qt=typeof globalThis<"u"?globalThis:qt||self,ne(qt.CetusSwap={},qt.React,qt.ReactDOM,qt.dappKit))})(this,function(qt,ne,$n,Vr){"use strict";var HB=Object.defineProperty;var qB=(qt,ne,$n)=>ne in qt?HB(qt,ne,{enumerable:!0,configurable:!0,writable:!0,value:$n}):qt[ne]=$n;var vt=(qt,ne,$n)=>(qB(qt,typeof ne!="symbol"?ne+"":ne,$n),$n);function e0(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const P=e0(ne),t0=e0($n);function r6(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r0={exports:{}},fr=r0.exports={},Fn,Un;function sl(){throw new Error("setTimeout has not been defined")}function al(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Fn=setTimeout:Fn=sl}catch{Fn=sl}try{typeof clearTimeout=="function"?Un=clearTimeout:Un=al}catch{Un=al}})();function n0(e){if(Fn===setTimeout)return setTimeout(e,0);if((Fn===sl||!Fn)&&setTimeout)return Fn=setTimeout,setTimeout(e,0);try{return Fn(e,0)}catch{try{return Fn.call(null,e,0)}catch{return Fn.call(this,e,0)}}}function n6(e){if(Un===clearTimeout)return clearTimeout(e);if((Un===al||!Un)&&clearTimeout)return Un=clearTimeout,clearTimeout(e);try{return Un(e)}catch{try{return Un.call(null,e)}catch{return Un.call(this,e)}}}var si=[],Go=!1,uo,Ga=-1;function i6(){!Go||!uo||(Go=!1,uo.length?si=uo.concat(si):Ga=-1,si.length&&i0())}function i0(){if(!Go){var e=n0(i6);Go=!0;for(var t=si.length;t;){for(uo=si,si=[];++Ga<t;)uo&&uo[Ga].run();Ga=-1,t=si.length}uo=null,Go=!1,n6(e)}}fr.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];si.push(new o0(e,t)),si.length===1&&!Go&&n0(i0)};function o0(e,t){this.fun=e,this.array=t}o0.prototype.run=function(){this.fun.apply(null,this.array)},fr.title="browser",fr.browser=!0,fr.env={},fr.argv=[],fr.version="",fr.versions={};function ai(){}fr.on=ai,fr.addListener=ai,fr.once=ai,fr.off=ai,fr.removeListener=ai,fr.removeAllListeners=ai,fr.emit=ai,fr.prependListener=ai,fr.prependOnceListener=ai,fr.listeners=function(e){return[]},fr.binding=function(e){throw new Error("process.binding is not supported")},fr.cwd=function(){return"/"},fr.chdir=function(e){throw new Error("process.chdir is not supported")},fr.umask=function(){return 0};var o6=r0.exports;const wn=r6(o6);var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function s0(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var cl={exports:{}},Vs={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,56 +6,56 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Xh;function D2(){if(Xh)return Ls;Xh=1;var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,c,u){var l,d={},p=null,w=null;u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(w=c.ref);for(l in c)n.call(c,l)&&!o.hasOwnProperty(l)&&(d[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)d[l]===void 0&&(d[l]=c[l]);return{$$typeof:t,type:a,key:p,ref:w,props:d,_owner:i.current}}return Ls.Fragment=r,Ls.jsx=s,Ls.jsxs=s,Ls}var $s={},Jh;function B2(){return Jh||(Jh=1,pn.env.NODE_ENV!=="production"&&function(){var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),b=Symbol.iterator,y="@@iterator";function T(V){if(V===null||typeof V!="object")return null;var se=b&&V[b]||V[y];return typeof se=="function"?se:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(V){{for(var se=arguments.length,fe=new Array(se>1?se-1:0),Oe=1;Oe<se;Oe++)fe[Oe-1]=arguments[Oe];k("error",V,fe)}}function k(V,se,fe){{var Oe=O.ReactDebugCurrentFrame,He=Oe.getStackAddendum();He!==""&&(se+="%s",fe=fe.concat([He]));var Pe=fe.map(function($e){return String($e)});Pe.unshift("Warning: "+se),Function.prototype.apply.call(console[V],console,Pe)}}var F=!1,L=!1,q=!1,H=!1,K=!1,re;re=Symbol.for("react.module.reference");function oe(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===o||K||V===i||V===u||V===l||H||V===w||F||L||q||typeof V=="object"&&V!==null&&(V.$$typeof===p||V.$$typeof===d||V.$$typeof===s||V.$$typeof===a||V.$$typeof===c||V.$$typeof===re||V.getModuleId!==void 0))}function ae(V,se,fe){var Oe=V.displayName;if(Oe)return Oe;var He=se.displayName||se.name||"";return He!==""?fe+"("+He+")":fe}function z(V){return V.displayName||"Context"}function D(V){if(V==null)return null;if(typeof V.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof V=="function")return V.displayName||V.name||null;if(typeof V=="string")return V;switch(V){case n:return"Fragment";case r:return"Portal";case o:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof V=="object")switch(V.$$typeof){case a:var se=V;return z(se)+".Consumer";case s:var fe=V;return z(fe._context)+".Provider";case c:return ae(V,V.render,"ForwardRef");case d:var Oe=V.displayName||null;return Oe!==null?Oe:D(V.type)||"Memo";case p:{var He=V,Pe=He._payload,$e=He._init;try{return D($e(Pe))}catch{return null}}}return null}var h=Object.assign,f=0,m,S,M,_,I,C,g;function v(){}v.__reactDisabledLog=!0;function N(){{if(f===0){m=console.log,S=console.info,M=console.warn,_=console.error,I=console.group,C=console.groupCollapsed,g=console.groupEnd;var V={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:V,log:V,warn:V,error:V,group:V,groupCollapsed:V,groupEnd:V})}f++}}function ee(){{if(f--,f===0){var V={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},V,{value:m}),info:h({},V,{value:S}),warn:h({},V,{value:M}),error:h({},V,{value:_}),group:h({},V,{value:I}),groupCollapsed:h({},V,{value:C}),groupEnd:h({},V,{value:g})})}f<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=O.ReactCurrentDispatcher,le;function me(V,se,fe){{if(le===void 0)try{throw Error()}catch(He){var Oe=He.stack.trim().match(/\n( *(at )?)/);le=Oe&&Oe[1]||""}return`
10
- `+le+V}}var xe=!1,be;{var Ve=typeof WeakMap=="function"?WeakMap:Map;be=new Ve}function Le(V,se){if(!V||xe)return"";{var fe=be.get(V);if(fe!==void 0)return fe}var Oe;xe=!0;var He=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Pe;Pe=ie.current,ie.current=null,N();try{if(se){var $e=function(){throw Error()};if(Object.defineProperty($e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($e,[])}catch(er){Oe=er}Reflect.construct(V,[],$e)}else{try{$e.call()}catch(er){Oe=er}V.call($e.prototype)}}else{try{throw Error()}catch(er){Oe=er}V()}}catch(er){if(er&&Oe&&typeof er.stack=="string"){for(var at=er.stack.split(`
11
- `),Qt=Oe.stack.split(`
12
- `),Dt=at.length-1,Ut=Qt.length-1;Dt>=1&&Ut>=0&&at[Dt]!==Qt[Ut];)Ut--;for(;Dt>=1&&Ut>=0;Dt--,Ut--)if(at[Dt]!==Qt[Ut]){if(Dt!==1||Ut!==1)do if(Dt--,Ut--,Ut<0||at[Dt]!==Qt[Ut]){var ur=`
13
- `+at[Dt].replace(" at new "," at ");return V.displayName&&ur.includes("<anonymous>")&&(ur=ur.replace("<anonymous>",V.displayName)),typeof V=="function"&&be.set(V,ur),ur}while(Dt>=1&&Ut>=0);break}}}finally{xe=!1,ie.current=Pe,ee(),Error.prepareStackTrace=He}var Ar=V?V.displayName||V.name:"",fr=Ar?me(Ar):"";return typeof V=="function"&&be.set(V,fr),fr}function ft(V,se,fe){return Le(V,!1)}function dt(V){var se=V.prototype;return!!(se&&se.isReactComponent)}function je(V,se,fe){if(V==null)return"";if(typeof V=="function")return Le(V,dt(V));if(typeof V=="string")return me(V);switch(V){case u:return me("Suspense");case l:return me("SuspenseList")}if(typeof V=="object")switch(V.$$typeof){case c:return ft(V.render);case d:return je(V.type,se,fe);case p:{var Oe=V,He=Oe._payload,Pe=Oe._init;try{return je(Pe(He),se,fe)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,we={},he=O.ReactDebugCurrentFrame;function Ce(V){if(V){var se=V._owner,fe=je(V.type,V._source,se?se.type:null);he.setExtraStackFrame(fe)}else he.setExtraStackFrame(null)}function Ue(V,se,fe,Oe,He){{var Pe=Function.call.bind(mt);for(var $e in V)if(Pe(V,$e)){var at=void 0;try{if(typeof V[$e]!="function"){var Qt=Error((Oe||"React class")+": "+fe+" type `"+$e+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof V[$e]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Qt.name="Invariant Violation",Qt}at=V[$e](se,$e,Oe,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Dt){at=Dt}at&&!(at instanceof Error)&&(Ce(He),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Oe||"React class",fe,$e,typeof at),Ce(null)),at instanceof Error&&!(at.message in we)&&(we[at.message]=!0,Ce(He),R("Failed %s type: %s",fe,at.message),Ce(null))}}}var Ne=Array.isArray;function Me(V){return Ne(V)}function Te(V){{var se=typeof Symbol=="function"&&Symbol.toStringTag,fe=se&&V[Symbol.toStringTag]||V.constructor.name||"Object";return fe}}function Be(V){try{return ut(V),!1}catch{return!0}}function ut(V){return""+V}function lt(V){if(Be(V))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Te(V)),ut(V)}var ze=O.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},Et,Ze,It;It={};function Ft(V){if(mt.call(V,"ref")){var se=Object.getOwnPropertyDescriptor(V,"ref").get;if(se&&se.isReactWarning)return!1}return V.ref!==void 0}function Qe(V){if(mt.call(V,"key")){var se=Object.getOwnPropertyDescriptor(V,"key").get;if(se&&se.isReactWarning)return!1}return V.key!==void 0}function _t(V,se){if(typeof V.ref=="string"&&ze.current&&se&&ze.current.stateNode!==se){var fe=D(ze.current.type);It[fe]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(ze.current.type),V.ref),It[fe]=!0)}}function Ot(V,se){{var fe=function(){Et||(Et=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};fe.isReactWarning=!0,Object.defineProperty(V,"key",{get:fe,configurable:!0})}}function rt(V,se){{var fe=function(){Ze||(Ze=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};fe.isReactWarning=!0,Object.defineProperty(V,"ref",{get:fe,configurable:!0})}}var kt=function(V,se,fe,Oe,He,Pe,$e){var at={$$typeof:t,type:V,key:se,ref:fe,props:$e,_owner:Pe};return at._store={},Object.defineProperty(at._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(at,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.defineProperty(at,"_source",{configurable:!1,enumerable:!1,writable:!1,value:He}),Object.freeze&&(Object.freeze(at.props),Object.freeze(at)),at};function Pt(V,se,fe,Oe,He){{var Pe,$e={},at=null,Qt=null;fe!==void 0&&(lt(fe),at=""+fe),Qe(se)&&(lt(se.key),at=""+se.key),Ft(se)&&(Qt=se.ref,_t(se,He));for(Pe in se)mt.call(se,Pe)&&!jt.hasOwnProperty(Pe)&&($e[Pe]=se[Pe]);if(V&&V.defaultProps){var Dt=V.defaultProps;for(Pe in Dt)$e[Pe]===void 0&&($e[Pe]=Dt[Pe])}if(at||Qt){var Ut=typeof V=="function"?V.displayName||V.name||"Unknown":V;at&&Ot($e,Ut),Qt&&rt($e,Ut)}return kt(V,at,Qt,He,Oe,ze.current,$e)}}var et=O.ReactCurrentOwner,xt=O.ReactDebugCurrentFrame;function Mt(V){if(V){var se=V._owner,fe=je(V.type,V._source,se?se.type:null);xt.setExtraStackFrame(fe)}else xt.setExtraStackFrame(null)}var Ge;Ge=!1;function gt(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function Rt(){{if(et.current){var V=D(et.current.type);if(V)return`
9
+ */var a0;function s6(){if(a0)return Vs;a0=1;var e=ne,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,c,u){var l,d={},p=null,b=null;u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(b=c.ref);for(l in c)n.call(c,l)&&!o.hasOwnProperty(l)&&(d[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)d[l]===void 0&&(d[l]=c[l]);return{$$typeof:t,type:a,key:p,ref:b,props:d,_owner:i.current}}return Vs.Fragment=r,Vs.jsx=s,Vs.jsxs=s,Vs}var zs={},c0;function a6(){return c0||(c0=1,wn.env.NODE_ENV!=="production"&&function(){var e=ne,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),x=Symbol.iterator,y="@@iterator";function T(V){if(V===null||typeof V!="object")return null;var se=x&&V[x]||V[y];return typeof se=="function"?se:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function N(V){{for(var se=arguments.length,fe=new Array(se>1?se-1:0),Oe=1;Oe<se;Oe++)fe[Oe-1]=arguments[Oe];k("error",V,fe)}}function k(V,se,fe){{var Oe=O.ReactDebugCurrentFrame,He=Oe.getStackAddendum();He!==""&&(se+="%s",fe=fe.concat([He]));var Pe=fe.map(function(Fe){return String(Fe)});Pe.unshift("Warning: "+se),Function.prototype.apply.call(console[V],console,Pe)}}var F=!1,L=!1,W=!1,z=!1,G=!1,re;re=Symbol.for("react.module.reference");function oe(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===o||G||V===i||V===u||V===l||z||V===b||F||L||W||typeof V=="object"&&V!==null&&(V.$$typeof===p||V.$$typeof===d||V.$$typeof===s||V.$$typeof===a||V.$$typeof===c||V.$$typeof===re||V.getModuleId!==void 0))}function ae(V,se,fe){var Oe=V.displayName;if(Oe)return Oe;var He=se.displayName||se.name||"";return He!==""?fe+"("+He+")":fe}function H(V){return V.displayName||"Context"}function D(V){if(V==null)return null;if(typeof V.tag=="number"&&N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof V=="function")return V.displayName||V.name||null;if(typeof V=="string")return V;switch(V){case n:return"Fragment";case r:return"Portal";case o:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof V=="object")switch(V.$$typeof){case a:var se=V;return H(se)+".Consumer";case s:var fe=V;return H(fe._context)+".Provider";case c:return ae(V,V.render,"ForwardRef");case d:var Oe=V.displayName||null;return Oe!==null?Oe:D(V.type)||"Memo";case p:{var He=V,Pe=He._payload,Fe=He._init;try{return D(Fe(Pe))}catch{return null}}}return null}var h=Object.assign,f=0,m,S,A,_,I,C,g;function v(){}v.__reactDisabledLog=!0;function R(){{if(f===0){m=console.log,S=console.info,A=console.warn,_=console.error,I=console.group,C=console.groupCollapsed,g=console.groupEnd;var V={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:V,log:V,warn:V,error:V,group:V,groupCollapsed:V,groupEnd:V})}f++}}function J(){{if(f--,f===0){var V={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},V,{value:m}),info:h({},V,{value:S}),warn:h({},V,{value:A}),error:h({},V,{value:_}),group:h({},V,{value:I}),groupCollapsed:h({},V,{value:C}),groupEnd:h({},V,{value:g})})}f<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=O.ReactCurrentDispatcher,ue;function _e(V,se,fe){{if(ue===void 0)try{throw Error()}catch(He){var Oe=He.stack.trim().match(/\n( *(at )?)/);ue=Oe&&Oe[1]||""}return`
10
+ `+ue+V}}var de=!1,be;{var De=typeof WeakMap=="function"?WeakMap:Map;be=new De}function Ne(V,se){if(!V||de)return"";{var fe=be.get(V);if(fe!==void 0)return fe}var Oe;de=!0;var He=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Pe;Pe=Q.current,Q.current=null,R();try{if(se){var Fe=function(){throw Error()};if(Object.defineProperty(Fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Fe,[])}catch(tr){Oe=tr}Reflect.construct(V,[],Fe)}else{try{Fe.call()}catch(tr){Oe=tr}V.call(Fe.prototype)}}else{try{throw Error()}catch(tr){Oe=tr}V()}}catch(tr){if(tr&&Oe&&typeof tr.stack=="string"){for(var st=tr.stack.split(`
11
+ `),er=Oe.stack.split(`
12
+ `),Lt=st.length-1,Ut=er.length-1;Lt>=1&&Ut>=0&&st[Lt]!==er[Ut];)Ut--;for(;Lt>=1&&Ut>=0;Lt--,Ut--)if(st[Lt]!==er[Ut]){if(Lt!==1||Ut!==1)do if(Lt--,Ut--,Ut<0||st[Lt]!==er[Ut]){var lr=`
13
+ `+st[Lt].replace(" at new "," at ");return V.displayName&&lr.includes("<anonymous>")&&(lr=lr.replace("<anonymous>",V.displayName)),typeof V=="function"&&be.set(V,lr),lr}while(Lt>=1&&Ut>=0);break}}}finally{de=!1,Q.current=Pe,J(),Error.prepareStackTrace=He}var Or=V?V.displayName||V.name:"",dr=Or?_e(Or):"";return typeof V=="function"&&be.set(V,dr),dr}function ft(V,se,fe){return Ne(V,!1)}function dt(V){var se=V.prototype;return!!(se&&se.isReactComponent)}function ke(V,se,fe){if(V==null)return"";if(typeof V=="function")return Ne(V,dt(V));if(typeof V=="string")return _e(V);switch(V){case u:return _e("Suspense");case l:return _e("SuspenseList")}if(typeof V=="object")switch(V.$$typeof){case c:return ft(V.render);case d:return ke(V.type,se,fe);case p:{var Oe=V,He=Oe._payload,Pe=Oe._init;try{return ke(Pe(He),se,fe)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,we={},pe=O.ReactDebugCurrentFrame;function Ce(V){if(V){var se=V._owner,fe=ke(V.type,V._source,se?se.type:null);pe.setExtraStackFrame(fe)}else pe.setExtraStackFrame(null)}function Ve(V,se,fe,Oe,He){{var Pe=Function.call.bind(mt);for(var Fe in V)if(Pe(V,Fe)){var st=void 0;try{if(typeof V[Fe]!="function"){var er=Error((Oe||"React class")+": "+fe+" type `"+Fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof V[Fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw er.name="Invariant Violation",er}st=V[Fe](se,Fe,Oe,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Lt){st=Lt}st&&!(st instanceof Error)&&(Ce(He),N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Oe||"React class",fe,Fe,typeof st),Ce(null)),st instanceof Error&&!(st.message in we)&&(we[st.message]=!0,Ce(He),N("Failed %s type: %s",fe,st.message),Ce(null))}}}var je=Array.isArray;function Ae(V){return je(V)}function Te(V){{var se=typeof Symbol=="function"&&Symbol.toStringTag,fe=se&&V[Symbol.toStringTag]||V.constructor.name||"Object";return fe}}function $e(V){try{return ct(V),!1}catch{return!0}}function ct(V){return""+V}function ut(V){if($e(V))return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Te(V)),ct(V)}var ze=O.ReactCurrentOwner,Dt={key:!0,ref:!0,__self:!0,__source:!0},Et,Ze,Ot;Ot={};function Ft(V){if(mt.call(V,"ref")){var se=Object.getOwnPropertyDescriptor(V,"ref").get;if(se&&se.isReactWarning)return!1}return V.ref!==void 0}function Qe(V){if(mt.call(V,"key")){var se=Object.getOwnPropertyDescriptor(V,"key").get;if(se&&se.isReactWarning)return!1}return V.key!==void 0}function _t(V,se){if(typeof V.ref=="string"&&ze.current&&se&&ze.current.stateNode!==se){var fe=D(ze.current.type);Ot[fe]||(N('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(ze.current.type),V.ref),Ot[fe]=!0)}}function Pt(V,se){{var fe=function(){Et||(Et=!0,N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};fe.isReactWarning=!0,Object.defineProperty(V,"key",{get:fe,configurable:!0})}}function rt(V,se){{var fe=function(){Ze||(Ze=!0,N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};fe.isReactWarning=!0,Object.defineProperty(V,"ref",{get:fe,configurable:!0})}}var Bt=function(V,se,fe,Oe,He,Pe,Fe){var st={$$typeof:t,type:V,key:se,ref:fe,props:Fe,_owner:Pe};return st._store={},Object.defineProperty(st._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(st,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.defineProperty(st,"_source",{configurable:!1,enumerable:!1,writable:!1,value:He}),Object.freeze&&(Object.freeze(st.props),Object.freeze(st)),st};function Rt(V,se,fe,Oe,He){{var Pe,Fe={},st=null,er=null;fe!==void 0&&(ut(fe),st=""+fe),Qe(se)&&(ut(se.key),st=""+se.key),Ft(se)&&(er=se.ref,_t(se,He));for(Pe in se)mt.call(se,Pe)&&!Dt.hasOwnProperty(Pe)&&(Fe[Pe]=se[Pe]);if(V&&V.defaultProps){var Lt=V.defaultProps;for(Pe in Lt)Fe[Pe]===void 0&&(Fe[Pe]=Lt[Pe])}if(st||er){var Ut=typeof V=="function"?V.displayName||V.name||"Unknown":V;st&&Pt(Fe,Ut),er&&rt(Fe,Ut)}return Bt(V,st,er,He,Oe,ze.current,Fe)}}var et=O.ReactCurrentOwner,xt=O.ReactDebugCurrentFrame;function At(V){if(V){var se=V._owner,fe=ke(V.type,V._source,se?se.type:null);xt.setExtraStackFrame(fe)}else xt.setExtraStackFrame(null)}var Ge;Ge=!1;function gt(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function Nt(){{if(et.current){var V=D(et.current.type);if(V)return`
14
14
 
15
15
  Check the render method of \``+V+"`."}return""}}function nt(V){{if(V!==void 0){var se=V.fileName.replace(/^.*[\\\/]/,""),fe=V.lineNumber;return`
16
16
 
17
- Check your code at `+se+":"+fe+"."}return""}}var St={};function zt(V){{var se=Rt();if(!se){var fe=typeof V=="string"?V:V.displayName||V.name;fe&&(se=`
17
+ Check your code at `+se+":"+fe+"."}return""}}var St={};function zt(V){{var se=Nt();if(!se){var fe=typeof V=="string"?V:V.displayName||V.name;fe&&(se=`
18
18
 
19
- Check the top-level render call using <`+fe+">.")}return se}}function j(V,se){{if(!V._store||V._store.validated||V.key!=null)return;V._store.validated=!0;var fe=zt(se);if(St[fe])return;St[fe]=!0;var Oe="";V&&V._owner&&V._owner!==et.current&&(Oe=" It was passed a child from "+D(V._owner.type)+"."),Mt(V),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',fe,Oe),Mt(null)}}function E(V,se){{if(typeof V!="object")return;if(Me(V))for(var fe=0;fe<V.length;fe++){var Oe=V[fe];gt(Oe)&&j(Oe,se)}else if(gt(V))V._store&&(V._store.validated=!0);else if(V){var He=T(V);if(typeof He=="function"&&He!==V.entries)for(var Pe=He.call(V),$e;!($e=Pe.next()).done;)gt($e.value)&&j($e.value,se)}}}function A(V){{var se=V.type;if(se==null||typeof se=="string")return;var fe;if(typeof se=="function")fe=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===c||se.$$typeof===d))fe=se.propTypes;else return;if(fe){var Oe=D(se);Ue(fe,V.props,"prop",Oe,V)}else if(se.PropTypes!==void 0&&!Ge){Ge=!0;var He=D(se);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $(V){{for(var se=Object.keys(V.props),fe=0;fe<se.length;fe++){var Oe=se[fe];if(Oe!=="children"&&Oe!=="key"){Mt(V),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Oe),Mt(null);break}}V.ref!==null&&(Mt(V),R("Invalid attribute `ref` supplied to `React.Fragment`."),Mt(null))}}var Y={};function J(V,se,fe,Oe,He,Pe){{var $e=oe(V);if(!$e){var at="";(V===void 0||typeof V=="object"&&V!==null&&Object.keys(V).length===0)&&(at+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Qt=nt(He);Qt?at+=Qt:at+=Rt();var Dt;V===null?Dt="null":Me(V)?Dt="array":V!==void 0&&V.$$typeof===t?(Dt="<"+(D(V.type)||"Unknown")+" />",at=" Did you accidentally export a JSX literal instead of a component?"):Dt=typeof V,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Dt,at)}var Ut=Pt(V,se,fe,He,Pe);if(Ut==null)return Ut;if($e){var ur=se.children;if(ur!==void 0)if(Oe)if(Me(ur)){for(var Ar=0;Ar<ur.length;Ar++)E(ur[Ar],V);Object.freeze&&Object.freeze(ur)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(ur,V)}if(mt.call(se,"key")){var fr=D(V),er=Object.keys(se).filter(function(Kr){return Kr!=="key"}),xr=er.length>0?"{key: someKey, "+er.join(": ..., ")+": ...}":"{key: someKey}";if(!Y[fr+xr]){var Rn=er.length>0?"{"+er.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
19
+ Check the top-level render call using <`+fe+">.")}return se}}function j(V,se){{if(!V._store||V._store.validated||V.key!=null)return;V._store.validated=!0;var fe=zt(se);if(St[fe])return;St[fe]=!0;var Oe="";V&&V._owner&&V._owner!==et.current&&(Oe=" It was passed a child from "+D(V._owner.type)+"."),At(V),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',fe,Oe),At(null)}}function E(V,se){{if(typeof V!="object")return;if(Ae(V))for(var fe=0;fe<V.length;fe++){var Oe=V[fe];gt(Oe)&&j(Oe,se)}else if(gt(V))V._store&&(V._store.validated=!0);else if(V){var He=T(V);if(typeof He=="function"&&He!==V.entries)for(var Pe=He.call(V),Fe;!(Fe=Pe.next()).done;)gt(Fe.value)&&j(Fe.value,se)}}}function M(V){{var se=V.type;if(se==null||typeof se=="string")return;var fe;if(typeof se=="function")fe=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===c||se.$$typeof===d))fe=se.propTypes;else return;if(fe){var Oe=D(se);Ve(fe,V.props,"prop",Oe,V)}else if(se.PropTypes!==void 0&&!Ge){Ge=!0;var He=D(se);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $(V){{for(var se=Object.keys(V.props),fe=0;fe<se.length;fe++){var Oe=se[fe];if(Oe!=="children"&&Oe!=="key"){At(V),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Oe),At(null);break}}V.ref!==null&&(At(V),N("Invalid attribute `ref` supplied to `React.Fragment`."),At(null))}}var Y={};function ee(V,se,fe,Oe,He,Pe){{var Fe=oe(V);if(!Fe){var st="";(V===void 0||typeof V=="object"&&V!==null&&Object.keys(V).length===0)&&(st+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var er=nt(He);er?st+=er:st+=Nt();var Lt;V===null?Lt="null":Ae(V)?Lt="array":V!==void 0&&V.$$typeof===t?(Lt="<"+(D(V.type)||"Unknown")+" />",st=" Did you accidentally export a JSX literal instead of a component?"):Lt=typeof V,N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Lt,st)}var Ut=Rt(V,se,fe,He,Pe);if(Ut==null)return Ut;if(Fe){var lr=se.children;if(lr!==void 0)if(Oe)if(Ae(lr)){for(var Or=0;Or<lr.length;Or++)E(lr[Or],V);Object.freeze&&Object.freeze(lr)}else N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(lr,V)}if(mt.call(se,"key")){var dr=D(V),tr=Object.keys(se).filter(function(Yr){return Yr!=="key"}),Er=tr.length>0?"{key: someKey, "+tr.join(": ..., ")+": ...}":"{key: someKey}";if(!Y[dr+Er]){var Dn=tr.length>0?"{"+tr.join(": ..., ")+": ...}":"{}";N(`A props object containing a "key" prop is being spread into JSX:
20
20
  let props = %s;
21
21
  <%s {...props} />
22
22
  React keys must be passed directly to JSX without using spread:
23
23
  let props = %s;
24
- <%s key={someKey} {...props} />`,xr,fr,Rn,fr),Y[fr+xr]=!0}}return V===n?$(Ut):A(Ut),Ut}}function ne(V,se,fe){return J(V,se,fe,!0)}function ke(V,se,fe){return J(V,se,fe,!1)}var Je=ke,Re=ne;$s.Fragment=n,$s.jsx=Je,$s.jsxs=Re}()),$s}pn.env.NODE_ENV==="production"?rl.exports=D2():rl.exports=B2();var x=rl.exports;const kD="",DD="",BD="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-link2" viewBox="0 0 1024 1024"><path d="M642.7648 217.6a166.5024 166.5024 0 0 1 166.5024 166.5024v256.256a166.5024 166.5024 0 0 1-166.5024 166.5024H386.5088a92.16 92.16 0 0 1-64.9728-157.5936L506.88 465.2032H429.2096a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h170.8544l1.4336 0.0512c0.8704 0 1.6896 0.1024 2.56 0.1536l-3.9936-0.2048a38.656 38.656 0 0 1 27.2384 11.3664l1.792 1.9456 1.536 1.8944-3.328-3.84a38.6048 38.6048 0 0 1 11.1616 27.0336v170.8544a38.4 38.4 0 0 1-76.8 0l-0.0512-78.592-185.9584 184.6784a15.36 15.36 0 0 0 7.3216 25.9072l3.584 0.4096h256.2048c49.5616 0 89.7024-40.1408 89.7024-89.7024V384.1024c0-49.5104-40.1408-89.7024-89.7024-89.7024H386.5088c-49.5616 0-89.7024 40.192-89.7024 89.7024V563.2a38.4 38.4 0 0 1-76.8 0V384.1024A166.5024 166.5024 0 0 1 386.5088 217.6h256.256z" ></path></symbol><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,o,s,a,c=function(d,p){p.parentNode.insertBefore(d,p)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var d,p=document.createElement("div");p.innerHTML=e._iconfont_svg_string_4776227,(p=p.getElementsByTagName("svg")[0])&&(p.setAttribute("aria-hidden","true"),p.style.position="absolute",p.style.width=0,p.style.height=0,p.style.overflow="hidden",p=p,(d=document.body).firstChild?c(p,d.firstChild):d.appendChild(p))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=n,s=e.document,a=!1,l(),s.onreadystatechange=function(){s.readyState=="complete"&&(s.onreadystatechange=null,u())})}function u(){a||(a=!0,o())}function l(){try{s.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const LD="",$D="",FD="",UD="",L2="1.18.0",$2="1.40.0",F2={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class Qh extends Error{}class e0 extends Qh{constructor(t,r){super(t),this.code=r,this.type=F2[r]??"ServerError"}}class U2 extends Qh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var t0=e=>{throw TypeError(e)},nl=(e,t,r)=>t.has(e)||t0("Cannot "+r),or=(e,t,r)=>(nl(e,t,"read from private field"),r?r.call(e):t.get(e)),oo=(e,t,r)=>t.has(e)?t0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Bo=(e,t,r,n)=>(nl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),r0=(e,t,r)=>(nl(e,t,"access private method"),r),V2=(e,t,r,n)=>({set _(i){Bo(e,t,i,r)},get _(){return or(e,t,n)}}),so,Fs,oi,ao,Us,Lo,za,n0,i0;function z2(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const H2={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class q2{constructor(t,r={}){if(oo(this,za),oo(this,so,0),oo(this,Fs,0),oo(this,oi,null),oo(this,ao,null),oo(this,Us,new Set),oo(this,Lo,new Map),this.endpoint=t,this.options={...H2,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=z2(this.endpoint))}async makeRequest(t,r){const n=await r0(this,za,n0).call(this);return new Promise((i,o)=>{Bo(this,so,or(this,so)+1),or(this,Lo).set(or(this,so),{resolve:i,reject:o,timeout:setTimeout(()=>{or(this,Lo).delete(or(this,so)),o(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:or(this,so),method:t,params:r}))}).then(({error:i,result:o})=>{if(i)throw new e0(i.message,i.code);return o})}async subscribe(t){const r=new W2(t);return or(this,Us).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}so=new WeakMap,Fs=new WeakMap,oi=new WeakMap,ao=new WeakMap,Us=new WeakMap,Lo=new WeakMap,za=new WeakSet,n0=function(){return or(this,ao)?or(this,ao):(Bo(this,ao,new Promise(e=>{var t;(t=or(this,oi))==null||t.close(),Bo(this,oi,new this.options.WebSocketConstructor(this.endpoint)),or(this,oi).addEventListener("open",()=>{Bo(this,Fs,0),e(or(this,oi))}),or(this,oi).addEventListener("close",()=>{V2(this,Fs)._++,or(this,Fs)<=this.options.maxReconnects&&setTimeout(()=>{r0(this,za,i0).call(this)},this.options.reconnectTimeout)}),or(this,oi).addEventListener("message",({data:r})=>{let n;try{n=JSON.parse(r)}catch(i){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:i}));return}if("id"in n&&n.id!=null&&or(this,Lo).has(n.id)){const{resolve:i,timeout:o}=or(this,Lo).get(n.id);clearTimeout(o),i(n)}else if("params"in n){const{params:i}=n;or(this,Us).forEach(o=>{o.subscriptionId===i.subscription&&i.subscription===o.subscriptionId&&o.onMessage(i.result)})}})})),or(this,ao))},i0=async function(){var e;return(e=or(this,oi))==null||e.close(),Bo(this,ao,null),Promise.allSettled([...or(this,Us)].map(t=>t.subscribe(this)))};class W2{constructor(t){this.subscriptionId=null,this.subscribed=!1,this.input=t}onMessage(t){this.subscribed&&this.input.onMessage(t)}async unsubscribe(t){const{subscriptionId:r}=this;return this.subscribed=!1,r==null?!1:(this.subscriptionId=null,t.makeRequest(this.input.unsubscribe,[r]))}async subscribe(t){this.subscriptionId=null,this.subscribed=!0;const r=await t.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=r)}}var o0=e=>{throw TypeError(e)},il=(e,t,r)=>t.has(e)||o0("Cannot "+r),rn=(e,t,r)=>(il(e,t,"read from private field"),r?r.call(e):t.get(e)),Ha=(e,t,r)=>t.has(e)?o0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ol=(e,t,r,n)=>(il(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),G2=(e,t,r)=>(il(e,t,"access private method"),r),Vs,mn,zs,sl,s0;class K2{constructor(t){Ha(this,sl),Ha(this,Vs,0),Ha(this,mn),Ha(this,zs),ol(this,mn,t)}fetch(t,r){const n=rn(this,mn).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(t,r)}async request(t){var i,o;ol(this,Vs,rn(this,Vs)+1);const r=await this.fetch(((i=rn(this,mn).rpc)==null?void 0:i.url)??rn(this,mn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":L2,"Client-Target-Api-Version":$2,"Client-Request-Method":t.method,...(o=rn(this,mn).rpc)==null?void 0:o.headers},body:JSON.stringify({jsonrpc:"2.0",id:rn(this,Vs),method:t.method,params:t.params})});if(!r.ok)throw new U2(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new e0(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await G2(this,sl,s0).call(this).subscribe(t);return async()=>!!await r()}}Vs=new WeakMap,mn=new WeakMap,zs=new WeakMap,sl=new WeakSet,s0=function(){var e;if(!rn(this,zs)){const t=rn(this,mn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");ol(this,zs,new q2(((e=rn(this,mn).websocket)==null?void 0:e.url)??rn(this,mn).url,{WebSocketConstructor:t,...rn(this,mn).websocket}))}return rn(this,zs)};function a0(e){switch(e){case"mainnet":return"https://fullnode.mainnet.sui.io:443";case"testnet":return"https://fullnode.testnet.sui.io:443";case"devnet":return"https://fullnode.devnet.sui.io:443";case"localnet":return"http://127.0.0.1:9000";default:throw new Error(`Unknown network: ${e}`)}}function Y2(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<e.length;u++){const l=e.charAt(u),d=l.charCodeAt(0);if(t[d]!==255)throw new TypeError(l+" is ambiguous");t[d]=u}const r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),o=Math.log(256)/Math.log(r);function s(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 l=0,d=0,p=0;const w=u.length;for(;p!==w&&u[p]===0;)p++,l++;const b=(w-p)*o+1>>>0,y=new Uint8Array(b);for(;p!==w;){let R=u[p],k=0;for(let F=b-1;(R!==0||k<d)&&F!==-1;F--,k++)R+=256*y[F]>>>0,y[F]=R%r>>>0,R=R/r>>>0;if(R!==0)throw new Error("Non-zero carry");d=k,p++}let T=b-d;for(;T!==b&&y[T]===0;)T++;let O=n.repeat(l);for(;T<b;++T)O+=e.charAt(y[T]);return O}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,d=0,p=0;for(;u[l]===n;)d++,l++;const w=(u.length-l)*i+1>>>0,b=new Uint8Array(w);for(;u[l];){let R=t[u.charCodeAt(l)];if(R===255)return;let k=0;for(let F=w-1;(R!==0||k<p)&&F!==-1;F--,k++)R+=r*b[F]>>>0,b[F]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");p=k,l++}let y=w-p;for(;y!==w&&b[y]===0;)y++;const T=new Uint8Array(d+(w-y));let O=d;for(;y!==w;)T[O++]=b[y++];return T}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:s,decodeUnsafe:a,decode:c}}var Z2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const c0=Y2(Z2),co=e=>c0.encode(e),si=e=>c0.decode(e),X2=co,J2=si;function Tr(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const al=8192;function gr(e){if(e.length<al)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=al){const n=e.slice(r,r+al);t+=String.fromCharCode(...n)}return btoa(t)}const u0=gr,l0=Tr;function $o(e){var i;const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=((i=r.match(/[0-9a-fA-F]{2}/g))==null?void 0:i.map(o=>parseInt(o,16)))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function ai(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const f0=ai,d0=$o;function cl(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function Q2(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class h0{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=Q2(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function p0(e,t){switch(t){case"base58":return co(e);case"base64":return gr(e);case"hex":return ai(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function e6(e,t){switch(t){case"base58":return si(e);case"base64":return Tr(e);case"hex":return $o(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ul(e,t=["<",">"]){const[r,n]=t,i=[];let o="",s=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&s++,c===n&&s--,s===0&&c===","){i.push(o.trim()),o="";continue}o+=c}return i.push(o.trim()),i}class m0{constructor({initialSize:t=1024,maxSize:r=1/0,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return ll(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return ll(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return ll(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return cl(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return p0(this.toBytes(),t)}}function ll(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var g0=e=>{throw TypeError(e)},v0=(e,t,r)=>t.has(e)||g0("Cannot "+r),gn=(e,t,r)=>(v0(e,t,"read from private field"),r?r.call(e):t.get(e)),qa=(e,t,r)=>t.has(e)?g0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Wa=(e,t,r,n)=>(v0(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Fo,Hs,Ga,Ni;const t6=class I2{constructor(t){qa(this,Fo),qa(this,Hs),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Wa(this,Fo,t.write),Wa(this,Hs,t.serialize??((r,n)=>{const i=new m0({initialSize:this.serializedSize(r)??void 0,...n});return gn(this,Fo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),gn(this,Fo).call(this,t,r)}serialize(t,r){return this.validate(t),new w0(this,gn(this,Hs).call(this,t,r))}parse(t){const r=new h0(t);return this.read(r)}fromHex(t){return this.parse($o(t))}fromBase58(t){return this.parse(si(t))}fromBase64(t){return this.parse(Tr(t))}transform({name:t,input:r,output:n,validate:i}){return new I2({name:t??this.name,read:o=>n(this.read(o)),write:(o,s)=>gn(this,Fo).call(this,r(o),s),serializedSize:o=>this.serializedSize(r(o)),serialize:(o,s)=>gn(this,Hs).call(this,r(o),s),validate:o=>{i==null||i(o),this.validate(r(o))}})}};Fo=new WeakMap,Hs=new WeakMap;let Ln=t6;const y0=Symbol.for("@mysten/serialized-bcs");function Ka(e){return!!e&&typeof e=="object"&&e[y0]===!0}class w0{constructor(t,r){qa(this,Ga),qa(this,Ni),Wa(this,Ga,t),Wa(this,Ni,r)}get[y0](){return!0}toBytes(){return gn(this,Ni)}toHex(){return ai(gn(this,Ni))}toBase64(){return gr(gn(this,Ni))}toBase58(){return co(gn(this,Ni))}parse(){return gn(this,Ga).parse(gn(this,Ni))}}Ga=new WeakMap,Ni=new WeakMap;function Ya({size:e,...t}){return new Ln({...t,serializedSize:()=>e})}function fl({readMethod:e,writeMethod:t,...r}){return Ya({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function dl({readMethod:e,writeMethod:t,...r}){return Ya({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var o;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(o=r.validate)==null||o.call(r,i)}})}function r6({serialize:e,...t}){const r=new Ln({...t,serialize:e,write:(n,i)=>{for(const o of r.serialize(n).toBytes())i.write8(o)}});return r}function n6({toBytes:e,fromBytes:t,...r}){return new Ln({...r,read:n=>{const i=n.readULEB(),o=n.readBytes(i);return t(o)},write:(n,i)=>{const o=e(n);i.writeULEB(o.length);for(let s=0;s<o.length;s++)i.write8(o[s])},serialize:n=>{const i=e(n),o=cl(i.length),s=new Uint8Array(o.length+i.length);return s.set(o,0),s.set(i,o.length),s},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function i6(e){let t=null;function r(){return t||(t=e()),t}return new Ln({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const W={u8(e){return fl({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return fl({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return fl({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return dl({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return dl({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return dl({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Ya({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return r6({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(cl(t)),...e})},bytes(e,t){return Ya({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{const i=new Uint8Array(r);for(let o=0;o<e;o++)n.write8(i[o]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return n6({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Ln({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let o=0;o<e;o++)i[o]=t.read(n);return i},write:(n,i)=>{for(const o of n)t.write(o,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return W.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})},vector(e,t){return new Ln({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let o=0;o<n;o++)i[o]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Ln({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const o=e[i].serializedSize(r[i]);if(o==null)return null;n+=o}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Ln({name:e,serializedSize:i=>{let o=0;for(const[s,a]of n){const c=a.serializedSize(i[s]);if(c==null)return null;o+=c}return o},read:i=>{const o={};for(const[s,a]of n)o[s]=a.read(i);return o},write:(i,o)=>{for(const[s,a]of n)a.write(i[s],o)},...r,validate:i=>{var o;if((o=r==null?void 0:r.validate)==null||o.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Ln({name:e,read:i=>{const o=i.readULEB(),s=n[o];if(!s)throw new TypeError(`Unknown value ${o} for enum ${e}`);const[a,c]=s;return{[a]:(c==null?void 0:c.read(i))??!0,$kind:a}},write:(i,o)=>{const[s,a]=Object.entries(i).filter(([c])=>Object.hasOwn(t,c))[0];for(let c=0;c<n.length;c++){const[u,l]=n[c];if(u===s){o.writeULEB(c),l==null||l.write(a,o);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const o=Object.keys(i).filter(c=>i[c]!==void 0&&Object.hasOwn(t,c));if(o.length!==1)throw new TypeError(`Expected object with one key, but found ${o.length} for type ${e}}`);const[s]=o;if(!Object.hasOwn(t,s))throw new TypeError(`Invalid enum variant ${s}`)}})},map(e,t){return W.vector(W.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,o]of r)n.set(i,o);return n}})},lazy(e){return i6(e)}},o6=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:h0,BcsType:Ln,BcsWriter:m0,SerializedBcs:w0,bcs:W,decodeStr:e6,encodeStr:p0,fromB58:J2,fromB64:l0,fromBase58:si,fromBase64:Tr,fromHEX:d0,fromHex:$o,isSerializedBcs:Ka,splitGenericParameters:ul,toB58:X2,toB64:u0,toBase58:co,toBase64:gr,toHEX:f0,toHex:ai},Symbol.toStringTag,{value:"Module"})),s6=32;function hl(e){try{return si(e).length===s6}catch{return!1}}const Za=32;function $n(e){return c6(e)&&u6(e)===Za}function qs(e){return $n(e)}function a6(e){return e.includes("::")?pl(e):e}function pl(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,o=n.includes("<")?ul(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(s=>a6(s.trim())):[];return{address:Nt(t),module:r,name:i,typeParams:o}}function b0(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?pl(e):e,o=(i==null?void 0:i.length)>0?`<${i.map(s=>typeof s=="string"?s:b0(s)).join(",")}>`:"";return`${t}::${r}::${n}${o}`}function Nt(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Za*2,"0")}`}function Yr(e,t=!1){return Nt(e,t)}function c6(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function u6(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const l6=/^vector<(.+)>$/,f6=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Xa=class Ds{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(l6);if(n)return{vector:Ds.parseFromStr(n[1],r)};const i=t.match(f6);if(i)return{struct:{address:r?Nt(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Ds.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return ul(t).map(n=>Ds.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Ds.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Ds.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function d6(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function h6(e){return W.enum("Option",{None:null,Some:e})}const nr=W.bytes(Za).transform({validate:e=>{const t=typeof e=="string"?e:ai(e);if(!t||!$n(Nt(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?$o(Nt(e)):e,output:e=>Nt(ai(e))}),vn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>si(e),output:e=>co(new Uint8Array(e)),validate:e=>{if(si(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),nn=W.struct("SuiObjectRef",{objectId:nr,version:W.u64(),digest:vn}),x0=W.struct("SharedObjectRef",{objectId:nr,initialSharedVersion:W.u64(),mutable:W.bool()}),S0=W.enum("ObjectArg",{ImmOrOwnedObject:nn,SharedObject:x0,Receiving:nn}),E0=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?Tr(e):e,output:e=>gr(new Uint8Array(e))})}),Object:S0}),ml=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>ml),struct:W.lazy(()=>I0),u16:null,u32:null,u256:null}),gl=ml.transform({input:e=>typeof e=="string"?Xa.parseFromStr(e,!0):e,output:e=>Xa.tagToString(e)}),Fn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),_0=W.struct("ProgrammableMoveCall",{package:nr,module:W.string(),function:W.string(),typeArguments:W.vector(gl),arguments:W.vector(Fn)}),C0=W.enum("Command",{MoveCall:_0,TransferObjects:W.struct("TransferObjects",{objects:W.vector(Fn),address:Fn}),SplitCoins:W.struct("SplitCoins",{coin:Fn,amounts:W.vector(Fn)}),MergeCoins:W.struct("MergeCoins",{destination:Fn,sources:W.vector(Fn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Tr(e):e,output:e=>gr(new Uint8Array(e))})),dependencies:W.vector(nr)}),MakeMoveVec:W.struct("MakeMoveVec",{type:h6(gl).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(Fn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Tr(e):e,output:e=>gr(new Uint8Array(e))})),dependencies:W.vector(nr),package:nr,ticket:Fn})}),M0=W.struct("ProgrammableTransaction",{inputs:W.vector(E0),commands:W.vector(C0)}),A0=W.enum("TransactionKind",{ProgrammableTransaction:M0,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),T0=W.enum("TransactionExpiration",{None:null,Epoch:d6()}),I0=W.struct("StructTag",{address:nr,module:W.string(),name:W.string(),typeParams:W.vector(ml)}),O0=W.struct("GasData",{payment:W.vector(nn),owner:nr,price:W.u64(),budget:W.u64()}),P0=W.struct("TransactionDataV1",{kind:A0,sender:nr,gasData:O0,expiration:T0}),R0=W.enum("TransactionData",{V1:P0}),N0=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),j0=W.enum("IntentVersion",{V0:null}),k0=W.enum("AppId",{Sui:null}),D0=W.struct("Intent",{scope:N0,version:j0,appId:k0});function B0(e){return W.struct(`IntentMessage<${e.name}>`,{intent:D0,value:e})}const L0=W.enum("CompressedSignature",{ED25519:W.fixedArray(64,W.u8()),Secp256k1:W.fixedArray(64,W.u8()),Secp256r1:W.fixedArray(64,W.u8()),ZkLogin:W.vector(W.u8())}),$0=W.enum("PublicKey",{ED25519:W.fixedArray(32,W.u8()),Secp256k1:W.fixedArray(33,W.u8()),Secp256r1:W.fixedArray(33,W.u8()),ZkLogin:W.vector(W.u8())}),F0=W.struct("MultiSigPkMap",{pubKey:$0,weight:W.u8()}),U0=W.struct("MultiSigPublicKey",{pk_map:W.vector(F0),threshold:W.u16()}),p6=W.struct("MultiSig",{sigs:W.vector(L0),bitmap:W.u16(),multisig_pk:U0}),m6=W.vector(W.u8()).transform({input:e=>typeof e=="string"?Tr(e):e,output:e=>gr(new Uint8Array(e))}),V0=W.struct("SenderSignedTransaction",{intentMessage:B0(R0),txSignatures:W.vector(m6)}),g6=W.vector(V0,{name:"SenderSignedData"}),v6=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),y6=W.enum("PackageUpgradeError",{UnableToFetchPackage:W.struct("UnableToFetchPackage",{packageId:nr}),NotAPackage:W.struct("NotAPackage",{objectId:nr}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:nr,ticketId:nr})}),w6=W.struct("ModuleId",{address:nr,name:W.string()}),z0=W.struct("MoveLocation",{module:w6,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),b6=W.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:W.struct("IndexOutOfBounds",{idx:W.u16()}),SecondaryIndexOutOfBounds:W.struct("SecondaryIndexOutOfBounds",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidResultArity:W.struct("InvalidResultArity",{resultIdx:W.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),x6=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),S6=W.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:W.struct("MoveObjectTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),MovePackageTooBig:W.struct("MovePackageTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),CircularObjectOwnership:W.struct("CircularObjectOwnership",{object:nr}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(z0),MoveAbort:W.tuple([z0,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:b6}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:x6}),UnusedValueWithoutDrop:W.struct("UnusedValueWithoutDrop",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidPublicFunctionReturnType:W.struct("InvalidPublicFunctionReturnType",{idx:W.u16()}),InvalidTransferObject:null,EffectsTooLarge:W.struct("EffectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:W.struct("PackageUpgradeError",{upgradeError:y6}),WrittenObjectsTooLarge:W.struct("WrittenObjectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:W.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:W.vector(nr)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:nr,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),H0=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:S6,command:W.option(W.u64())})}),q0=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),Uo=W.enum("Owner",{AddressOwner:nr,ObjectOwner:nr,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),E6=W.struct("TransactionEffectsV1",{status:H0,executedEpoch:W.u64(),gasUsed:q0,modifiedAtVersions:W.vector(W.tuple([nr,W.u64()])),sharedObjects:W.vector(nn),transactionDigest:vn,created:W.vector(W.tuple([nn,Uo])),mutated:W.vector(W.tuple([nn,Uo])),unwrapped:W.vector(W.tuple([nn,Uo])),deleted:W.vector(nn),unwrappedThenDeleted:W.vector(nn),wrapped:W.vector(nn),gasObject:W.tuple([nn,Uo]),eventsDigest:W.option(vn),dependencies:W.vector(vn)}),vl=W.tuple([W.u64(),vn]),_6=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([vl,Uo])}),C6=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([vn,Uo]),PackageWrite:vl}),M6=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),A6=W.struct("EffectsObjectChange",{inputState:_6,outputState:C6,idOperation:M6}),T6=W.enum("UnchangedSharedKind",{ReadOnlyRoot:vl,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),I6=W.struct("TransactionEffectsV2",{status:H0,executedEpoch:W.u64(),gasUsed:q0,transactionDigest:vn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(vn),dependencies:W.vector(vn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([nr,A6])),unchangedSharedObjects:W.vector(W.tuple([nr,T6])),auxDataDigest:W.option(vn)}),O6=W.enum("TransactionEffects",{V1:E6,V2:I6}),it={...W,U8:W.u8(),U16:W.u16(),U32:W.u32(),U64:W.u64(),U128:W.u128(),U256:W.u256(),ULEB128:W.uleb128(),Bool:W.bool(),String:W.string(),Address:nr,AppId:k0,Argument:Fn,CallArg:E0,CompressedSignature:L0,GasData:O0,Intent:D0,IntentMessage:B0,IntentScope:N0,IntentVersion:j0,MultiSig:p6,MultiSigPkMap:F0,MultiSigPublicKey:U0,ObjectArg:S0,ObjectDigest:vn,ProgrammableMoveCall:_0,ProgrammableTransaction:M0,PublicKey:$0,SenderSignedData:g6,SenderSignedTransaction:V0,SharedObjectRef:x0,StructTag:I0,SuiObjectRef:nn,Command:C0,TransactionData:R0,TransactionDataV1:P0,TransactionExpiration:T0,TransactionKind:A0,TypeTag:gl,TransactionEffects:O6,PasskeyAuthenticator:v6},W0="…";function P6(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${W0}${e.slice(-4)}`}function R6(e){return`${e.slice(0,10)}${W0}`}const G0=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,K0=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,N6=235;function Y0(e){return e.length>N6?!1:e.includes("@")?G0.test(e):K0.test(e)}function Z0(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!G0.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,o]=r.split("@");n=[...i?i.split("."):[],o]}else{if(!K0.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}const j6=9,k6=BigInt(1e9),X0="0x1",Ws="0x2",D6="0x3",J0=Yr("0x6"),B6="sui_system",Ja=`${Ws}::sui::SUI`,L6=Yr("0x5"),$6=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,F6=/^\d+$/,U6=64,Q0="/",ep=e=>{const t=e.split(Q0);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!F6.test(i)||!Y0(r)?!1:$6.test(n)&&n.length<U6},V6=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Q0)&&!ep(r))return!1;return!0};function yl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function z6(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function tp(e,...t){if(!z6(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function rp(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function H6(e,t){tp(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Qa=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),uo=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),np=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,ci=uo?e=>e:e=>np(e);function Vo(e){for(let t=0;t<e.length;t++)e[t]=np(e[t])}function q6(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Gs(e){return typeof e=="string"&&(e=q6(e)),tp(e),e}let W6=class{clone(){return this._cloneInto()}};function G6(e){const t=(n,i)=>e(i).update(Gs(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const K6=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class Y6 extends W6{constructor(t,r,n={},i,o,s){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,yl(t),yl(r),yl(i),r<0||r>i)throw new Error("outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error("key length must be undefined or 1.."+i);if(n.salt!==void 0&&n.salt.length!==o)throw new Error("salt must be undefined or "+o);if(n.personalization!==void 0&&n.personalization.length!==s)throw new Error("personalization must be undefined or "+s);this.buffer=new Uint8Array(t),this.buffer32=Qa(this.buffer)}update(t){rp(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Gs(t);const o=t.length,s=t.byteOffset,a=t.buffer;for(let c=0;c<o;){this.pos===r&&(uo||Vo(i),this.compress(i,0,!1),uo||Vo(i),this.pos=0);const u=Math.min(r-this.pos,o-c),l=s+c;if(u===r&&!(l%4)&&c+u<o){const d=new Uint32Array(a,l,Math.floor((o-c)/4));uo||Vo(d);for(let p=0;c+r<o;p+=i.length,c+=r)this.length+=r,this.compress(d,p,!1);uo||Vo(d);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){rp(this),H6(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),uo||Vo(n),this.compress(n,0,!0),uo||Vo(n);const i=Qa(t);this.get().forEach((o,s)=>i[s]=ci(o))}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){const{buffer:r,length:n,finished:i,destroyed:o,outputLen:s,pos:a}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=o,t.outputLen=s,t.buffer.set(r),t.pos=a,t}}const ec=BigInt(2**32-1),wl=BigInt(32);function ip(e,t=!1){return t?{h:Number(e&ec),l:Number(e>>wl&ec)}:{h:Number(e>>wl&ec)|0,l:Number(e&ec)|0}}function Z6(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=ip(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}const X6=(e,t)=>BigInt(e>>>0)<<wl|BigInt(t>>>0),J6=(e,t,r)=>e>>>r,Q6=(e,t,r)=>e<<32-r|t>>>r,e4=(e,t,r)=>e>>>r|t<<32-r,t4=(e,t,r)=>e<<32-r|t>>>r,r4=(e,t,r)=>e<<64-r|t>>>r-32,n4=(e,t,r)=>e>>>r-32|t<<64-r,i4=(e,t)=>t,o4=(e,t)=>e,s4=(e,t,r)=>e<<r|t>>>32-r,a4=(e,t,r)=>t<<r|e>>>32-r,c4=(e,t,r)=>t<<r-32|e>>>64-r,u4=(e,t,r)=>e<<r-32|t>>>64-r;function l4(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const Br={fromBig:ip,split:Z6,toBig:X6,shrSH:J6,shrSL:Q6,rotrSH:e4,rotrSL:t4,rotrBH:r4,rotrBL:n4,rotr32H:i4,rotr32L:o4,rotlSH:s4,rotlSL:a4,rotlBH:c4,rotlBL:u4,add:l4,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},vr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ie=new Uint32Array(32);function ji(e,t,r,n,i,o){const s=i[o],a=i[o+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],d=Ie[2*t+1],p=Ie[2*r],w=Ie[2*r+1],b=Ie[2*n],y=Ie[2*n+1],T=Br.add3L(c,l,s);u=Br.add3H(T,u,d,a),c=T|0,{Dh:y,Dl:b}={Dh:y^u,Dl:b^c},{Dh:y,Dl:b}={Dh:Br.rotr32H(y,b),Dl:Br.rotr32L(y,b)},{h:w,l:p}=Br.add(w,p,y,b),{Bh:d,Bl:l}={Bh:d^w,Bl:l^p},{Bh:d,Bl:l}={Bh:Br.rotrSH(d,l,24),Bl:Br.rotrSL(d,l,24)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=d,Ie[2*r]=p,Ie[2*r+1]=w,Ie[2*n]=b,Ie[2*n+1]=y}function ki(e,t,r,n,i,o){const s=i[o],a=i[o+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],d=Ie[2*t+1],p=Ie[2*r],w=Ie[2*r+1],b=Ie[2*n],y=Ie[2*n+1],T=Br.add3L(c,l,s);u=Br.add3H(T,u,d,a),c=T|0,{Dh:y,Dl:b}={Dh:y^u,Dl:b^c},{Dh:y,Dl:b}={Dh:Br.rotrSH(y,b,16),Dl:Br.rotrSL(y,b,16)},{h:w,l:p}=Br.add(w,p,y,b),{Bh:d,Bl:l}={Bh:d^w,Bl:l^p},{Bh:d,Bl:l}={Bh:Br.rotrBH(d,l,63),Bl:Br.rotrBL(d,l,63)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=d,Ie[2*r]=p,Ie[2*r+1]=w,Ie[2*n]=b,Ie[2*n+1]=y}class f4 extends Y6{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=vr[0]|0,this.v0h=vr[1]|0,this.v1l=vr[2]|0,this.v1h=vr[3]|0,this.v2l=vr[4]|0,this.v2h=vr[5]|0,this.v3l=vr[6]|0,this.v3h=vr[7]|0,this.v4l=vr[8]|0,this.v4h=vr[9]|0,this.v5l=vr[10]|0,this.v5h=vr[11]|0,this.v6l=vr[12]|0,this.v6h=vr[13]|0,this.v7l=vr[14]|0,this.v7h=vr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=Qa(Gs(t.salt));this.v4l^=ci(n[0]),this.v4h^=ci(n[1]),this.v5l^=ci(n[2]),this.v5h^=ci(n[3])}if(t.personalization){const n=Qa(Gs(t.personalization));this.v6l^=ci(n[0]),this.v6h^=ci(n[1]),this.v7l^=ci(n[2]),this.v7h^=ci(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Gs(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:o,v2h:s,v3l:a,v3h:c,v4l:u,v4h:l,v5l:d,v5h:p,v6l:w,v6h:b,v7l:y,v7h:T}=this;return[t,r,n,i,o,s,a,c,u,l,d,p,w,b,y,T]}set(t,r,n,i,o,s,a,c,u,l,d,p,w,b,y,T){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=o|0,this.v2h=s|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=d|0,this.v5h=p|0,this.v6l=w|0,this.v6h=b|0,this.v7l=y|0,this.v7h=T|0}compress(t,r,n){this.get().forEach((c,u)=>Ie[u]=c),Ie.set(vr,16);let{h:i,l:o}=Br.fromBig(BigInt(this.length));Ie[24]=vr[8]^o,Ie[25]=vr[9]^i,n&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]);let s=0;const a=K6;for(let c=0;c<12;c++)ji(0,4,8,12,t,r+2*a[s++]),ki(0,4,8,12,t,r+2*a[s++]),ji(1,5,9,13,t,r+2*a[s++]),ki(1,5,9,13,t,r+2*a[s++]),ji(2,6,10,14,t,r+2*a[s++]),ki(2,6,10,14,t,r+2*a[s++]),ji(3,7,11,15,t,r+2*a[s++]),ki(3,7,11,15,t,r+2*a[s++]),ji(0,5,10,15,t,r+2*a[s++]),ki(0,5,10,15,t,r+2*a[s++]),ji(1,6,11,12,t,r+2*a[s++]),ki(1,6,11,12,t,r+2*a[s++]),ji(2,7,8,13,t,r+2*a[s++]),ki(2,7,8,13,t,r+2*a[s++]),ji(3,4,9,14,t,r+2*a[s++]),ki(3,4,9,14,t,r+2*a[s++]);this.v0l^=Ie[0]^Ie[16],this.v0h^=Ie[1]^Ie[17],this.v1l^=Ie[2]^Ie[18],this.v1h^=Ie[3]^Ie[19],this.v2l^=Ie[4]^Ie[20],this.v2h^=Ie[5]^Ie[21],this.v3l^=Ie[6]^Ie[22],this.v3h^=Ie[7]^Ie[23],this.v4l^=Ie[8]^Ie[24],this.v4h^=Ie[9]^Ie[25],this.v5l^=Ie[10]^Ie[26],this.v5h^=Ie[11]^Ie[27],this.v6l^=Ie[12]^Ie[28],this.v6h^=Ie[13]^Ie[29],this.v7l^=Ie[14]^Ie[30],this.v7h^=Ie[15]^Ie[31],Ie.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const op=G6(e=>new f4(e));function d4(e,t,r){const n=it.Address.serialize(e).toBytes(),i=it.TypeTag.serialize(t).toBytes(),o=it.u64().serialize(r.length).toBytes(),s=op.create({dkLen:32});return s.update(new Uint8Array([240])),s.update(n),s.update(o),s.update(r),s.update(i),`0x${ai(s.digest().slice(0,32))}`}const h4=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:k6,MOVE_STDLIB_ADDRESS:X0,SUI_ADDRESS_LENGTH:Za,SUI_CLOCK_OBJECT_ID:J0,SUI_DECIMALS:j6,SUI_FRAMEWORK_ADDRESS:Ws,SUI_SYSTEM_ADDRESS:D6,SUI_SYSTEM_MODULE_NAME:B6,SUI_SYSTEM_STATE_OBJECT_ID:L6,SUI_TYPE_ARG:Ja,deriveDynamicFieldID:d4,formatAddress:P6,formatDigest:R6,fromB64:l0,fromBase58:si,fromBase64:Tr,fromHEX:d0,fromHex:$o,isValidNamedPackage:ep,isValidNamedType:V6,isValidSuiAddress:$n,isValidSuiNSName:Y0,isValidSuiObjectId:qs,isValidTransactionDigest:hl,normalizeStructTag:b0,normalizeSuiAddress:Nt,normalizeSuiNSName:Z0,normalizeSuiObjectId:Yr,parseStructTag:pl,toB64:u0,toBase58:co,toBase64:gr,toHEX:f0,toHex:ai},Symbol.toStringTag,{value:"Module"})),p4="object",m4="ID",g4="ascii",v4="String",y4="string",w4="String",b4="option",x4="Option";function S4(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&Nt(t.package)===Nt("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function bl(e){if(typeof e=="string")switch(e){case"address":return it.Address;case"bool":return it.Bool;case"u8":return it.U8;case"u16":return it.U16;case"u32":return it.U32;case"u64":return it.U64;case"u128":return it.U128;case"u256":return it.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return it.vector(it.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=bl(e.vector);return t?it.vector(t):null}if("datatype"in e){const t=Nt(e.datatype.package);if(t===Nt(X0)){if(e.datatype.module===g4&&e.datatype.type===v4||e.datatype.module===y4&&e.datatype.type===w4)return it.String;if(e.datatype.module===b4&&e.datatype.type===x4){const r=bl(e.datatype.typeParameters[0]);return r?it.vector(r):null}}if(t===Nt(Ws)&&e.datatype.module===p4&&e.datatype.type===m4)return it.Address}return null}function E4(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Ks(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Ks(e.MutableReference)}:{ref:null,body:Ks(e)}}function Ks(e){if(typeof e=="string")switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:Ks(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(Ks)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function _4(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?gr(e):e.toBase64()}}}const ui={Pure:_4,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:Nt(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:Nt(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:Nt(e)}}}}};var li;function C4(e){return{lang:(e==null?void 0:e.lang)??(li==null?void 0:li.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(li==null?void 0:li.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(li==null?void 0:li.abortPipeEarly)}}var xl;function M4(e){return xl==null?void 0:xl.get(e)}var Sl;function A4(e){return Sl==null?void 0:Sl.get(e)}var El;function T4(e,t){var r;return(r=El==null?void 0:El.get(e))==null?void 0:r.get(t)}function sp(e){var r,n;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((n=(r=Object.getPrototypeOf(e))==null?void 0:r.constructor)==null?void 0:n.name))??"null":t}function Zr(e,t,r,n,i){const o=i&&"input"in i?i.input:r.value,s=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??sp(o),c={kind:e.kind,type:e.type,input:o,expected:s,received:a,message:`Invalid ${t}: ${s?`Expected ${s} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u=e.kind==="schema",l=(i==null?void 0:i.message)??e.message??T4(e.reference,c.lang)??(u?A4(c.lang):null)??n.message??M4(c.lang);l&&(c.message=typeof l=="function"?l(c):l),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}function I4(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}var O4=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Ys(e,t){return{kind:"validation",type:"check",reference:Ys,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&Zr(this,"input",r,n),r}}}function sr(e){return{kind:"validation",type:"integer",reference:sr,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&Zr(this,"integer",t,r),t}}}function tc(e){return{kind:"transformation",type:"transform",reference:tc,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function _l(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Cl(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function tt(e,t){return{kind:"schema",type:"array",reference:tt,expects:"Array",async:!1,item:e,message:t,_run(r,n){var o;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){const a=i[s],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else Zr(this,"type",r,n);return r}}}function Ml(e){return{kind:"schema",type:"bigint",reference:Ml,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:Zr(this,"type",t,r),t}}}function rc(e){return{kind:"schema",type:"boolean",reference:rc,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:Zr(this,"type",t,r),t}}}function Zs(e){return{kind:"schema",type:"lazy",reference:Zs,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function ct(e,t){return{kind:"schema",type:"literal",reference:ct,expects:sp(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:Zr(this,"type",r,n),r}}}function Bt(e,...t){const r={kind:"schema",type:"nullable",reference:Bt,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=_l(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function zo(e,...t){const r={kind:"schema",type:"nullish",reference:zo,expects:`${e.expects} | null | undefined`,async:!1,wrapped:e,_run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=_l(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function ir(e){return{kind:"schema",type:"number",reference:ir,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:Zr(this,"type",t,r),t}}}function Ae(e,t){return{kind:"schema",type:"object",reference:Ae,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var o;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const s in this.entries){const a=i[s],c=this.entries[s]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||s in i)&&(r.value[s]=c.value)}}else Zr(this,"type",r,n);return r}}}function Ir(e,...t){const r={kind:"schema",type:"optional",reference:Ir,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=_l(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Xs(e,t,r){return{kind:"schema",type:"record",reference:Xs,expects:"Object",async:!1,key:e,value:t,message:r,_run(n,i){var s,a;const o=n.value;if(o&&typeof o=="object"){n.typed=!0,n.value={};for(const c in o)if(I4(o,c)){const u=o[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const p={type:"object",origin:"key",input:o,key:c,value:u};for(const w of l.issues)w.path=[p],(s=n.issues)==null||s.push(w);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const d=this.value._run({typed:!1,value:u},i);if(d.issues){const p={type:"object",origin:"value",input:o,key:c,value:u};for(const w of d.issues)w.path?w.path.unshift(p):w.path=[p],(a=n.issues)==null||a.push(w);if(n.issues||(n.issues=d.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!d.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=d.value)}}else Zr(this,"type",n,i);return n}}}function yt(e){return{kind:"schema",type:"string",reference:yt,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:Zr(this,"type",t,r),t}}}function Al(e,t){return{kind:"schema",type:"tuple",reference:Al,expects:"Array",async:!1,items:e,message:t,_run(r,n){var o;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<this.items.length;s++){const a=i[s],c=this.items[s]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else Zr(this,"type",r,n);return r}}}function ap(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Sr(e,t){return{kind:"schema",type:"union",reference:Sr,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,o,s;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)o?o.push(c):o=[c];else{i=c;break}else s?s.push(c):s=[c]}if(i)return i;if(o){if(o.length===1)return o[0];Zr(this,"type",r,n,{issues:ap(o)}),r.typed=!0}else{if((s==null?void 0:s.length)===1)return s[0];Zr(this,"type",r,n,{issues:ap(s)})}return r}}}function lo(){return{kind:"schema",type:"unknown",reference:lo,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function ar(e,t,r){const n=e._run({typed:!1,value:t},C4(r));if(n.issues)throw new O4(n.issues);return n.value}function Wt(...e){return{...e[0],pipe:e,_run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=e[n]._run(t,r))}return t}}}function fo(e){const t=Object.entries(e).map(([r,n])=>Ae({[r]:n}));return Wt(Sr(t),tc(r=>({...r,$kind:Object.keys(r)[0]})))}const Ho=Wt(yt(),tc(e=>Nt(e)),Ys($n)),Xr=Ho,ho=yt(),Vr=Wt(Sr([yt(),Wt(ir(),sr())]),Ys(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Di=Ae({objectId:Ho,version:Vr,digest:yt()}),tr=Wt(Sr([Ae({GasCoin:ct(!0)}),Ae({Input:Wt(ir(),sr()),type:Ir(ct("pure"))}),Ae({Input:Wt(ir(),sr()),type:Ir(ct("object"))}),Ae({Result:Wt(ir(),sr())}),Ae({NestedResult:Al([Wt(ir(),sr()),Wt(ir(),sr())])})]),tc(e=>({...e,$kind:Object.keys(e)[0]}))),P4=Ae({budget:Bt(Vr),price:Bt(Vr),owner:Bt(Ho),payment:Bt(tt(Di))}),Tl=Sr([ct("address"),ct("bool"),ct("u8"),ct("u16"),ct("u32"),ct("u64"),ct("u128"),ct("u256"),Ae({vector:Zs(()=>Tl)}),Ae({datatype:Ae({package:yt(),module:yt(),type:yt(),typeParameters:tt(Zs(()=>Tl))})}),Ae({typeParameter:Wt(ir(),sr())})]),R4=Ae({ref:Bt(Sr([ct("&"),ct("&mut")])),body:Tl}),N4=Ae({package:Xr,module:yt(),function:yt(),typeArguments:tt(yt()),arguments:tt(tr),_argumentTypes:Ir(Bt(tt(R4)))}),j4=Ae({name:yt(),inputs:Xs(yt(),Sr([tr,tt(tr)])),data:Xs(yt(),lo())}),k4=fo({MoveCall:N4,TransferObjects:Ae({objects:tt(tr),address:tr}),SplitCoins:Ae({coin:tr,amounts:tt(tr)}),MergeCoins:Ae({destination:tr,sources:tt(tr)}),Publish:Ae({modules:tt(ho),dependencies:tt(Xr)}),MakeMoveVec:Ae({type:Bt(yt()),elements:tt(tr)}),Upgrade:Ae({modules:tt(ho),dependencies:tt(Xr),package:Xr,ticket:tr}),$Intent:j4}),cp=fo({ImmOrOwnedObject:Di,SharedObject:Ae({objectId:Xr,initialSharedVersion:Vr,mutable:rc()}),Receiving:Di}),D4=fo({Object:cp,Pure:Ae({bytes:ho}),UnresolvedPure:Ae({value:lo()}),UnresolvedObject:Ae({objectId:Xr,version:Ir(Bt(Vr)),digest:Ir(Bt(yt())),initialSharedVersion:Ir(Bt(Vr))})}),up=fo({Object:cp,Pure:Ae({bytes:ho})}),lp=fo({None:ct(!0),Epoch:Vr}),nc=Ae({version:ct(2),sender:zo(Ho),expiration:zo(lp),gasData:P4,inputs:tt(D4),commands:tt(k4)}),po={MoveCall(e){const[t,r="",n=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:t,module:r,function:n,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects(e,t){return{$kind:"TransferObjects",TransferObjects:{objects:e.map(r=>ar(tr,r)),address:ar(tr,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:ar(tr,e),amounts:t.map(r=>ar(tr,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:ar(tr,e),sources:t.map(r=>ar(tr,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:gr(new Uint8Array(r))),dependencies:t.map(r=>Yr(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:gr(new Uint8Array(i))),dependencies:t.map(i=>Yr(i)),package:r,ticket:ar(tr,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>ar(tr,r))}}},Intent({name:e,inputs:t={},data:r={}}){return{$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(t).map(([n,i])=>[n,Array.isArray(i)?i.map(o=>ar(tr,o)):ar(tr,i)])),data:r}}}},Il=Ae({digest:yt(),objectId:yt(),version:Sr([Wt(ir(),sr()),yt(),Ml()])}),B4=fo({ImmOrOwned:Il,Shared:Ae({objectId:Xr,initialSharedVersion:Vr,mutable:rc()}),Receiving:Il}),fp=fo({Object:B4,Pure:tt(Wt(ir(),sr()))}),dp=Sr([Ae({kind:ct("Input"),index:Wt(ir(),sr()),value:lo(),type:Ir(ct("object"))}),Ae({kind:ct("Input"),index:Wt(ir(),sr()),value:lo(),type:ct("pure")})]),L4=Sr([Ae({Epoch:Wt(ir(),sr())}),Ae({None:Bt(ct(!0))})]),hp=Wt(Sr([ir(),yt(),Ml()]),Ys(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),Ol=Sr([Ae({bool:Bt(ct(!0))}),Ae({u8:Bt(ct(!0))}),Ae({u64:Bt(ct(!0))}),Ae({u128:Bt(ct(!0))}),Ae({address:Bt(ct(!0))}),Ae({signer:Bt(ct(!0))}),Ae({vector:Zs(()=>Ol)}),Ae({struct:Zs(()=>$4)}),Ae({u16:Bt(ct(!0))}),Ae({u32:Bt(ct(!0))}),Ae({u256:Bt(ct(!0))})]),$4=Ae({address:yt(),module:yt(),name:yt(),typeParams:tt(Ol)}),F4=Ae({budget:Ir(hp),price:Ir(hp),payment:Ir(tt(Il)),owner:Ir(yt())}),U4=[dp,Ae({kind:ct("GasCoin")}),Ae({kind:ct("Result"),index:Wt(ir(),sr())}),Ae({kind:ct("NestedResult"),index:Wt(ir(),sr()),resultIndex:Wt(ir(),sr())})],fi=Sr([...U4]),V4=Ae({kind:ct("MoveCall"),target:Wt(yt(),Ys(e=>e.split("::").length===3)),typeArguments:tt(yt()),arguments:tt(fi)}),z4=Ae({kind:ct("TransferObjects"),objects:tt(fi),address:fi}),H4=Ae({kind:ct("SplitCoins"),coin:fi,amounts:tt(fi)}),q4=Ae({kind:ct("MergeCoins"),destination:fi,sources:tt(fi)}),W4=Ae({kind:ct("MakeMoveVec"),type:Sr([Ae({Some:Ol}),Ae({None:Bt(ct(!0))})]),objects:tt(fi)}),G4=Ae({kind:ct("Publish"),modules:tt(tt(Wt(ir(),sr()))),dependencies:tt(yt())}),K4=Ae({kind:ct("Upgrade"),modules:tt(tt(Wt(ir(),sr()))),dependencies:tt(yt()),packageId:yt(),ticket:fi}),Y4=Sr([...[V4,z4,H4,q4,G4,K4,W4]]);Ae({version:ct(1),sender:Ir(yt()),expiration:zo(L4),gasConfig:F4,inputs:tt(dp),transactions:tt(Y4)});function pp(e){var r;const t=e.inputs.map((n,i)=>{if(n.Object)return{kind:"Input",index:i,value:{Object:n.Object.ImmOrOwnedObject?{ImmOrOwned:n.Object.ImmOrOwnedObject}:n.Object.Receiving?{Receiving:{digest:n.Object.Receiving.digest,version:n.Object.Receiving.version,objectId:n.Object.Receiving.objectId}}:{Shared:{mutable:n.Object.SharedObject.mutable,initialSharedVersion:n.Object.SharedObject.initialSharedVersion,objectId:n.Object.SharedObject.objectId}}},type:"object"};if(n.Pure)return{kind:"Input",index:i,value:{Pure:Array.from(Tr(n.Pure.bytes))},type:"pure"};if(n.UnresolvedPure)return{kind:"Input",type:"pure",index:i,value:n.UnresolvedPure.value};if(n.UnresolvedObject)return{kind:"Input",type:"object",index:i,value:n.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:e.sender??void 0,expiration:((r=e.expiration)==null?void 0:r.$kind)==="Epoch"?{Epoch:Number(e.expiration.Epoch)}:e.expiration?{None:!0}:null,gasConfig:{owner:e.gasData.owner??void 0,budget:e.gasData.budget??void 0,price:e.gasData.price??void 0,payment:e.gasData.payment??void 0},inputs:t,transactions:e.commands.map(n=>{if(n.MakeMoveVec)return{kind:"MakeMoveVec",type:n.MakeMoveVec.type===null?{None:!0}:{Some:Xa.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>di(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:di(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>di(i,t))};if(n.MoveCall)return{kind:"MoveCall",target:`${n.MoveCall.package}::${n.MoveCall.module}::${n.MoveCall.function}`,typeArguments:n.MoveCall.typeArguments,arguments:n.MoveCall.arguments.map(i=>di(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from(Tr(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:di(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>di(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>di(i,t)),address:di(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from(Tr(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:di(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function di(e,t){if(e.$kind==="GasCoin")return{kind:"GasCoin"};if(e.$kind==="Result")return{kind:"Result",index:e.Result};if(e.$kind==="NestedResult")return{kind:"NestedResult",index:e.NestedResult[0],resultIndex:e.NestedResult[1]};if(e.$kind==="Input")return t[e.Input];throw new Error(`Invalid argument ${Object.keys(e)}`)}function Z4(e){var t,r,n;return ar(nc,{version:2,sender:e.sender??null,expiration:e.expiration?"Epoch"in e.expiration?{Epoch:e.expiration.Epoch}:{None:!0}:null,gasData:{owner:e.gasConfig.owner??null,budget:((t=e.gasConfig.budget)==null?void 0:t.toString())??null,price:((r=e.gasConfig.price)==null?void 0:r.toString())??null,payment:((n=e.gasConfig.payment)==null?void 0:n.map(i=>({digest:i.digest,objectId:i.objectId,version:i.version.toString()})))??null},inputs:e.inputs.map(i=>{if(i.kind==="Input"){if(Cl(fp,i.value)){const o=ar(fp,i.value);if(o.Object){if(o.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:o.Object.ImmOrOwned.objectId,version:String(o.Object.ImmOrOwned.version),digest:o.Object.ImmOrOwned.digest}}};if(o.Object.Shared)return{Object:{SharedObject:{mutable:o.Object.Shared.mutable??null,initialSharedVersion:o.Object.Shared.initialSharedVersion,objectId:o.Object.Shared.objectId}}};if(o.Object.Receiving)return{Object:{Receiving:{digest:o.Object.Receiving.digest,version:String(o.Object.Receiving.version),objectId:o.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:gr(new Uint8Array(o.Pure))}}}return i.type==="object"?{UnresolvedObject:{objectId:i.value}}:{UnresolvedPure:{value:i.value}}}throw new Error("Invalid input")}),commands:e.transactions.map(i=>{switch(i.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in i.type?Xa.tagToString(i.type.Some):null,elements:i.objects.map(o=>hi(o))}};case"MergeCoins":return{MergeCoins:{destination:hi(i.destination),sources:i.sources.map(o=>hi(o))}};case"MoveCall":{const[o,s,a]=i.target.split("::");return{MoveCall:{package:o,module:s,function:a,typeArguments:i.typeArguments,arguments:i.arguments.map(c=>hi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(o=>gr(Uint8Array.from(o))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:hi(i.coin),amounts:i.amounts.map(o=>hi(o))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(o=>hi(o)),address:hi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(o=>gr(Uint8Array.from(o))),dependencies:i.dependencies,package:i.packageId,ticket:hi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function hi(e){switch(e.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:e.index};case"NestedResult":return{NestedResult:[e.index,e.resultIndex]};case"Input":return{Input:e.index}}}function Js(e){return Sr(Object.entries(e).map(([t,r])=>Ae({[t]:r})))}const yn=Js({GasCoin:ct(!0),Input:Wt(ir(),sr()),Result:Wt(ir(),sr()),NestedResult:Al([Wt(ir(),sr()),Wt(ir(),sr())])}),X4=Ae({budget:Bt(Vr),price:Bt(Vr),owner:Bt(Ho),payment:Bt(tt(Di))}),J4=Ae({package:Xr,module:yt(),function:yt(),typeArguments:tt(yt()),arguments:tt(yn)}),Q4=Ae({name:yt(),inputs:Xs(yt(),Sr([yn,tt(yn)])),data:Xs(yt(),lo())}),e8=Js({MoveCall:J4,TransferObjects:Ae({objects:tt(yn),address:yn}),SplitCoins:Ae({coin:yn,amounts:tt(yn)}),MergeCoins:Ae({destination:yn,sources:tt(yn)}),Publish:Ae({modules:tt(ho),dependencies:tt(Xr)}),MakeMoveVec:Ae({type:Bt(yt()),elements:tt(yn)}),Upgrade:Ae({modules:tt(ho),dependencies:tt(Xr),package:Xr,ticket:yn}),$Intent:Q4}),t8=Js({ImmOrOwnedObject:Di,SharedObject:Ae({objectId:Xr,initialSharedVersion:Vr,mutable:rc()}),Receiving:Di}),r8=Js({Object:t8,Pure:Ae({bytes:ho}),UnresolvedPure:Ae({value:lo()}),UnresolvedObject:Ae({objectId:Xr,version:Ir(Bt(Vr)),digest:Ir(Bt(yt())),initialSharedVersion:Ir(Bt(Vr))})}),n8=Js({None:ct(!0),Epoch:Vr}),i8=Ae({version:ct(2),sender:zo(Ho),expiration:zo(n8),gasData:X4,inputs:tt(r8),commands:tt(e8)}),o8=50,s8=1000n,a8=5e10;async function c8(e,t,r){return await h8(e,t),await d8(e,t),t.onlyTransactionKind||(await u8(e,t),await l8(e,t),await f8(e,t)),await p8(e),await r()}async function u8(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Qs(t).getReferenceGasPrice()))}async function l8(e,t){if(e.gasConfig.budget)return;const r=await Qs(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(a8),payment:[]}}})});if(r.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const n=s8*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+n,o=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(o>i?o:i)}async function f8(e,t){if(!e.gasConfig.payment){const n=(await Qs(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Ja})).data.filter(i=>!e.inputs.find(s=>{var a;return(a=s.Object)!=null&&a.ImmOrOwnedObject?i.coinObjectId===s.Object.ImmOrOwnedObject.objectId:!1})).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!n.length)throw new Error("No valid gas coins found for the transaction.");e.gasConfig.payment=n.map(i=>ar(Di,i))}}async function d8(e,t){const r=e.inputs.filter(l=>{var d;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(d=l.UnresolvedObject)!=null&&d.initialSharedVersion)}),n=[...new Set(r.map(l=>Yr(l.UnresolvedObject.objectId)))],i=n.length?y8(n,o8):[],o=(await Promise.all(i.map(l=>Qs(t).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),s=new Map(n.map((l,d)=>[l,o[d]])),a=Array.from(s).filter(([l,d])=>d.error).map(([l,d])=>JSON.stringify(d.error));if(a.length)throw new Error(`The following input objects are invalid: ${a.join(", ")}`);const c=o.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const d=l.data.owner,p=d&&typeof d=="object"&&"Shared"in d?d.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:p}}),u=new Map(n.map((l,d)=>[l,c[d]]));for(const[l,d]of e.inputs.entries()){if(!d.UnresolvedObject)continue;let p;const w=Nt(d.UnresolvedObject.objectId),b=u.get(w);d.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?p=ui.SharedObjectRef({objectId:w,initialSharedVersion:d.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:m8(e,l)}):g8(e,l)&&(p=ui.ReceivingRef({objectId:w,digest:d.UnresolvedObject.digest??(b==null?void 0:b.digest),version:d.UnresolvedObject.version??(b==null?void 0:b.version)})),e.inputs[e.inputs.indexOf(d)]=p??ui.ObjectRef({objectId:w,digest:d.UnresolvedObject.digest??(b==null?void 0:b.digest),version:d.UnresolvedObject.version??(b==null?void 0:b.version)})}}async function h8(e,t){const{inputs:r,commands:n}=e,i=[],o=new Set;n.forEach(a=>{if(a.MoveCall){if(a.MoveCall._argumentTypes)return;if(a.MoveCall.arguments.map(l=>l.$kind==="Input"?e.inputs[l.Input]:null).some(l=>(l==null?void 0:l.UnresolvedPure)||(l==null?void 0:l.UnresolvedObject))){const l=`${a.MoveCall.package}::${a.MoveCall.module}::${a.MoveCall.function}`;o.add(l),i.push(a.MoveCall)}}switch(a.$kind){case"SplitCoins":a.SplitCoins.amounts.forEach(c=>{mp(c,it.U64,e)});break;case"TransferObjects":mp(a.TransferObjects.address,it.Address,e);break}});const s=new Map;if(o.size>0){const a=Qs(t);await Promise.all([...o].map(async c=>{const[u,l,d]=c.split("::"),p=await a.getNormalizedMoveFunction({package:u,module:l,function:d});s.set(c,p.parameters.map(w=>E4(w)))}))}i.length&&await Promise.all(i.map(async a=>{const c=s.get(`${a.package}::${a.module}::${a.function}`);if(!c)return;const l=c.length>0&&S4(c.at(-1))?c.slice(0,c.length-1):c;a._argumentTypes=l})),n.forEach(a=>{if(!a.MoveCall)return;const c=a.MoveCall,u=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==a.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${u}`);l.forEach((d,p)=>{var R,k;const w=c.arguments[p];if(w.$kind!=="Input")return;const b=r[w.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const y=((R=b.UnresolvedPure)==null?void 0:R.value)??((k=b.UnresolvedObject)==null?void 0:k.objectId),T=bl(d.body);if(T){w.type="pure",r[r.indexOf(b)]=ui.Pure(T.serialize(y));return}if(typeof y!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(y,null,2)}`);w.type="object";const O=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:y}}:b;r[w.Input]=O})}})}function p8(e){e.inputs.forEach((t,r)=>{if(t.$kind!=="Object"&&t.$kind!=="Pure")throw new Error(`Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(t)}`)})}function mp(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=ui.Pure(t.serialize(n.UnresolvedPure.value)))}function m8(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const o=i.MoveCall.arguments.indexOf(n);r=i.MoveCall._argumentTypes[o].ref!=="&"||r}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(r=!0)}),r}function g8(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const o=i.MoveCall.arguments.indexOf(n);r=v8(i.MoveCall._argumentTypes[o])||r}}),r}function v8(e){return typeof e.body!="object"||!("datatype"in e.body)?!1:e.body.datatype.package==="0x2"&&e.body.datatype.module==="transfer"&&e.body.datatype.type==="Receiving"}function Qs(e){if(!e.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function y8(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}function w8(e){function t(r){return e(r)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t.option=({type:r,value:n})=>i=>i.moveCall({typeArguments:[r],target:`0x1::option::${n===null?"none":"some"}`,arguments:n===null?[]:[i.object(n)]}),t}function b8(e){function t(r,n){if(typeof r=="string")return e(ea(r).serialize(n));if(r instanceof Uint8Array||Ka(r))return e(r);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=r=>e(it.U8.serialize(r)),t.u16=r=>e(it.U16.serialize(r)),t.u32=r=>e(it.U32.serialize(r)),t.u64=r=>e(it.U64.serialize(r)),t.u128=r=>e(it.U128.serialize(r)),t.u256=r=>e(it.U256.serialize(r)),t.bool=r=>e(it.Bool.serialize(r)),t.string=r=>e(it.String.serialize(r)),t.address=r=>e(it.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(it.vector(ea(r)).serialize(n)),t.option=(r,n)=>e(it.option(ea(r)).serialize(n)),t}function ea(e){switch(e){case"u8":return it.u8();case"u16":return it.u16();case"u32":return it.u32();case"u64":return it.u64();case"u128":return it.u128();case"u256":return it.u256();case"bool":return it.bool();case"string":return it.string();case"id":case"address":return it.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?it.vector(ea(n)):it.option(ea(n))}throw new Error(`Invalid Pure type name: ${e}`)}function x8(e,t){const r=Array.from(`${e}::`).map(i=>i.charCodeAt(0)),n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),op(n,{dkLen:32})}function gp(e){return Nt(e).replace("0x","")}class wn{constructor(t){this.version=2,this.sender=(t==null?void 0:t.sender)??null,this.expiration=(t==null?void 0:t.expiration)??null,this.inputs=(t==null?void 0:t.inputs)??[],this.commands=(t==null?void 0:t.commands)??[],this.gasData=(t==null?void 0:t.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(t){const n=it.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return wn.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:n.inputs,commands:n.commands})}static fromBytes(t){const r=it.TransactionData.parse(t),n=r==null?void 0:r.V1,i=n.kind.ProgrammableTransaction;if(!n||!i)throw new Error("Unable to deserialize from bytes.");return wn.restore({version:2,sender:n.sender,expiration:n.expiration,gasData:n.gasData,inputs:i.inputs,commands:i.commands})}static restore(t){return t.version===2?new wn(ar(nc,t)):new wn(ar(nc,Z4(t)))}static getDigestFromBytes(t){const r=x8("TransactionData",t);return co(r)}get gasConfig(){return this.gasData}set gasConfig(t){this.gasData=t}build({maxSizeBytes:t=1/0,overrides:r,onlyTransactionKind:n}={}){const i=this.inputs,o=this.commands,s={ProgrammableTransaction:{inputs:i,commands:o}};if(n)return it.TransactionKind.serialize(s,{maxSize:t}).toBytes();const a=(r==null?void 0:r.expiration)??this.expiration,c=(r==null?void 0:r.sender)??this.sender,u={...this.gasData,...r==null?void 0:r.gasConfig,...r==null?void 0:r.gasData};if(!c)throw new Error("Missing transaction sender");if(!u.budget)throw new Error("Missing gas budget");if(!u.payment)throw new Error("Missing gas payment");if(!u.price)throw new Error("Missing gas price");const l={sender:gp(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:gp(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:o}}};return it.TransactionData.serialize({V1:l},{maxSize:t}).toBytes()}addInput(t,r){const n=this.inputs.length;return this.inputs.push(r),{Input:n,type:t,$kind:"Input"}}getInputUses(t,r){this.mapArguments((n,i)=>(n.$kind==="Input"&&n.Input===t&&r(n,i),n))}mapArguments(t){for(const r of this.commands)switch(r.$kind){case"MoveCall":r.MoveCall.arguments=r.MoveCall.arguments.map(i=>t(i,r));break;case"TransferObjects":r.TransferObjects.objects=r.TransferObjects.objects.map(i=>t(i,r)),r.TransferObjects.address=t(r.TransferObjects.address,r);break;case"SplitCoins":r.SplitCoins.coin=t(r.SplitCoins.coin,r),r.SplitCoins.amounts=r.SplitCoins.amounts.map(i=>t(i,r));break;case"MergeCoins":r.MergeCoins.destination=t(r.MergeCoins.destination,r),r.MergeCoins.sources=r.MergeCoins.sources.map(i=>t(i,r));break;case"MakeMoveVec":r.MakeMoveVec.elements=r.MakeMoveVec.elements.map(i=>t(i,r));break;case"Upgrade":r.Upgrade.ticket=t(r.Upgrade.ticket,r);break;case"$Intent":const n=r.$Intent.inputs;r.$Intent.inputs={};for(const[i,o]of Object.entries(n))r.$Intent.inputs[i]=Array.isArray(o)?o.map(s=>t(s,r)):t(o,r);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${r.$kind}`)}}replaceCommand(t,r){if(!Array.isArray(r)){this.commands[t]=r;return}const n=r.length-1;this.commands.splice(t,1,...r),n!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>t&&(i.Result+=n);break;case"NestedResult":i.NestedResult[0]>t&&(i.NestedResult[0]+=n);break}return i})}getDigest(){const t=this.build({onlyTransactionKind:!1});return wn.getDigestFromBytes(t)}snapshot(){return ar(nc,this)}}function vp(e){if(typeof e=="string")return Nt(e);if(e.Object)return e.Object.ImmOrOwnedObject?Nt(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?Nt(e.Object.Receiving.objectId):Nt(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return Nt(e.UnresolvedObject.objectId)}var yp=e=>{throw TypeError(e)},Pl=(e,t,r)=>t.has(e)||yp("Cannot "+r),Ct=(e,t,r)=>(Pl(e,t,"read from private field"),r?r.call(e):t.get(e)),ta=(e,t,r)=>t.has(e)?yp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),mo=(e,t,r,n)=>(Pl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),pi=(e,t,r)=>(Pl(e,t,"access private method"),r),ra,na,go,At,bn,ic,Rl,Nl,jl;function wp(e,t=1/0){const r={$kind:"Result",Result:e},n=[],i=o=>n[o]??(n[o]={$kind:"NestedResult",NestedResult:[e,o]});return new Proxy(r,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(o,s){if(s in o)return Reflect.get(o,s);if(s===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield i(c),c++};if(typeof s=="symbol")return;const a=parseInt(s,10);if(!(Number.isNaN(a)||a<0))return i(a)}})}const bp=Symbol.for("@mysten/transaction");function xp(e){return!!e&&typeof e=="object"&&e[bp]===!0}const Sp={buildPlugins:new Map,serializationPlugins:new Map},kl=Symbol.for("@mysten/transaction/registry");function ia(){try{const e=globalThis;return e[kl]||(e[kl]=Sp),e[kl]}catch{return Sp}}const S8=class zh{constructor(){ta(this,bn),ta(this,ra),ta(this,na),ta(this,go,new Map),ta(this,At),this.object=w8(r=>{var o,s;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&Cl(tr,r))return r;const n=vp(r),i=Ct(this,At).inputs.find(a=>n===vp(a));return(o=i==null?void 0:i.Object)!=null&&o.SharedObject&&typeof r=="object"&&((s=r.Object)!=null&&s.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,At).inputs.indexOf(i),type:"object"}:Ct(this,At).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:Nt(r)}}:r)});const t=ia();mo(this,At,new wn),mo(this,na,[...t.buildPlugins.values()]),mo(this,ra,[...t.serializationPlugins.values()])}static fromKind(t){const r=new zh;return mo(r,At,wn.fromKindBytes(typeof t=="string"?Tr(t):t)),r}static from(t){const r=new zh;return xp(t)?mo(r,At,new wn(t.getData())):typeof t!="string"||!t.startsWith("{")?mo(r,At,wn.fromBytes(typeof t=="string"?Tr(t):t)):mo(r,At,wn.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){ia().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){ia().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){ia().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){ia().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,ra).push(t)}addBuildPlugin(t){Ct(this,na).push(t)}addIntentResolver(t,r){if(Ct(this,go).has(t)&&Ct(this,go).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,go).set(t,r)}setSender(t){Ct(this,At).sender=t}setSenderIfNotSet(t){Ct(this,At).sender||(Ct(this,At).sender=t)}setExpiration(t){Ct(this,At).expiration=t?ar(lp,t):null}setGasPrice(t){Ct(this,At).gasConfig.price=String(t)}setGasBudget(t){Ct(this,At).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,At).gasData.budget==null&&(Ct(this,At).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,At).gasConfig.owner=t}setGasPayment(t){Ct(this,At).gasConfig.payment=t.map(r=>ar(Di,r))}get blockData(){return pp(Ct(this,At).snapshot())}getData(){return Ct(this,At).snapshot()}get[bp](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:b8(t=>Ka(t)?Ct(this,At).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,At).addInput("pure",Cl(up,t)?ar(up,t):t instanceof Uint8Array?ui.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(ui.ObjectRef(...t))}receivingRef(...t){return this.object(ui.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(ui.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,At).commands.push(t);return wp(r-1)}splitCoins(t,r){const n=po.SplitCoins(typeof t=="string"?this.object(t):pi(this,bn,Rl).call(this,t),r.map(o=>typeof o=="number"||typeof o=="bigint"||typeof o=="string"?this.pure.u64(o):pi(this,bn,ic).call(this,o))),i=Ct(this,At).commands.push(n);return wp(i-1,r.length)}mergeCoins(t,r){return this.add(po.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(po.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(po.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(po.MoveCall({...r,arguments:t==null?void 0:t.map(n=>pi(this,bn,ic).call(this,n))}))}transferObjects(t,r){return this.add(po.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):pi(this,bn,ic).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(po.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify(pp(Ct(this,At).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify(ar(i8,Ct(this,At).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await pi(this,bn,Nl).call(this,t),Ct(this,At).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await pi(this,bn,Nl).call(this,t),Ct(this,At).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const o of Ct(this,At).commands)o.$Intent&&r.add(o.$Intent.name);const n=[...Ct(this,ra)];for(const o of r)if(!((i=t.supportedIntents)!=null&&i.includes(o))){if(!Ct(this,go).has(o))throw new Error(`Missing intent resolver for ${o}`);n.push(Ct(this,go).get(o))}await pi(this,bn,jl).call(this,n,t)}};ra=new WeakMap,na=new WeakMap,go=new WeakMap,At=new WeakMap,bn=new WeakSet,ic=function(e){return Ka(e)?this.pure(e):pi(this,bn,Rl).call(this,e)},Rl=function(e){return typeof e=="function"?ar(tr,e(this)):ar(tr,e)},Nl=async function(e){if(!e.onlyTransactionKind&&!Ct(this,At).sender)throw new Error("Missing transaction sender");await pi(this,bn,jl).call(this,[...Ct(this,na),c8],e)},jl=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const o=r(n+1);let s=!1,a=!1;if(await i(Ct(this,At),t,async()=>{if(s)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);s=!0,await o(),a=!0}),!s)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let qo=S8;const E8=Symbol.for("@mysten/SuiClient");class Wo{get[E8](){return!0}constructor(t){this.transport=t.transport??new K2({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[t.owner,t.coinType,t.cursor,t.limit]})}async getAllCoins(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[t.owner,t.cursor,t.limit]})}async getBalance(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[t.owner,t.coinType]})}async getAllBalances(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[t.owner]})}async getCoinMetadata(t){return await this.transport.request({method:"suix_getCoinMetadata",params:[t.coinType]})}async getTotalSupply(t){return await this.transport.request({method:"suix_getTotalSupply",params:[t.coinType]})}async call(t,r){return await this.transport.request({method:t,params:r})}async getMoveFunctionArgTypes(t){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[t.package,t.module,t.function]})}async getNormalizedMoveModulesByPackage(t){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[t.package]})}async getNormalizedMoveModule(t){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[t.package,t.module]})}async getNormalizedMoveFunction(t){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[t.package,t.module,t.function]})}async getNormalizedMoveStruct(t){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[t.package,t.module,t.struct]})}async getOwnedObjects(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[t.owner,{filter:t.filter,options:t.options},t.cursor,t.limit]})}async getObject(t){if(!t.id||!qs(Yr(t.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[t.id,t.options]})}async tryGetPastObject(t){return await this.transport.request({method:"sui_tryGetPastObject",params:[t.id,t.version,t.options]})}async multiGetObjects(t){if(t.ids.forEach(n=>{if(!n||!qs(Yr(n)))throw new Error(`Invalid Sui Object id ${n}`)}),t.ids.length!==new Set(t.ids).size)throw new Error(`Duplicate object ids in batch call ${t.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[t.ids,t.options]})}async queryTransactionBlocks(t){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:t.filter,options:t.options},t.cursor,t.limit,(t.order||"descending")==="descending"]})}async getTransactionBlock(t){if(!hl(t.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[t.digest,t.options]})}async multiGetTransactionBlocks(t){if(t.digests.forEach(n=>{if(!hl(n))throw new Error(`Invalid Transaction digest ${n}`)}),t.digests.length!==new Set(t.digests).size)throw new Error(`Duplicate digests in batch call ${t.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[t.digests,t.options]})}async executeTransactionBlock({transactionBlock:t,signature:r,options:n,requestType:i}){const o=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof t=="string"?t:gr(t),Array.isArray(r)?r:[r],n]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:o.digest})}catch{}return o}async signAndExecuteTransaction({transaction:t,signer:r,...n}){let i;t instanceof Uint8Array?i=t:(t.setSenderIfNotSet(r.toSuiAddress()),i=await t.build({client:this}));const{signature:o,bytes:s}=await r.signTransaction(i);return this.executeTransactionBlock({transactionBlock:s,signature:o,...n})}async getTotalTransactionBlocks(){const t=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(t)}async getReferenceGasPrice(){const t=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(t)}async getStakes(t){if(!t.owner||!$n(Nt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[t.owner]})}async getStakesByIds(t){return t.stakedSuiIds.forEach(r=>{if(!r||!qs(Yr(r)))throw new Error(`Invalid Sui Stake id ${r}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[t.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(t){return await this.transport.request({method:"suix_queryEvents",params:[t.query,t.cursor,t.limit,(t.order||"descending")==="descending"]})}async subscribeEvent(t){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[t.filter],onMessage:t.onMessage})}async subscribeTransaction(t){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[t.filter],onMessage:t.onMessage})}async devInspectTransactionBlock(t){var n;let r;if(xp(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=gr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=gr(t.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[t.sender,r,(n=t.gasPrice)==null?void 0:n.toString(),t.epoch]})}async dryRunTransactionBlock(t){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof t.transactionBlock=="string"?t.transactionBlock:gr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!qs(Yr(t.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[t.parentId,t.cursor,t.limit]})}async getDynamicFieldObject(t){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[t.parentId,t.name]})}async getLatestCheckpointSequenceNumber(){const t=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(t)}async getCheckpoint(t){return await this.transport.request({method:"sui_getCheckpoint",params:[t.id]})}async getCheckpoints(t){return await this.transport.request({method:"sui_getCheckpoints",params:[t.cursor,t==null?void 0:t.limit,t.descendingOrder]})}async getCommitteeInfo(t){return await this.transport.request({method:"suix_getCommitteeInfo",params:[t==null?void 0:t.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(t){return await this.transport.request({method:"suix_getEpochMetrics",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getAllEpochAddressMetrics(t){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[t==null?void 0:t.descendingOrder]})}async getEpochs(t){return await this.transport.request({method:"suix_getEpochs",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const t=await this.getCheckpoint({id:"0"}),r=si(t.digest);return ai(r.slice(0,4))}async resolveNameServiceAddress(t){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[t.name]})}async resolveNameServiceNames({format:t="dot",...r}){const{nextCursor:n,hasNextPage:i,data:o}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[r.address,r.cursor,r.limit]});return{hasNextPage:i,nextCursor:n,data:o.map(s=>Z0(s,t))}}async getProtocolConfig(t){return await this.transport.request({method:"sui_getProtocolConfig",params:[t==null?void 0:t.version]})}async waitForTransaction({signal:t,timeout:r=60*1e3,pollInterval:n=2*1e3,...i}){const o=AbortSignal.timeout(r),s=new Promise((a,c)=>{o.addEventListener("abort",()=>c(o.reason))});for(s.catch(()=>{});!o.aborted;){t==null||t.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),s])}}throw o.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}var Dl={},oc={},Bl={},sc={},Ll={},ac={};Object.defineProperty(ac,"__esModule",{value:!0}),ac.Convert=void 0;class _8{static toPriceFeed(t){return $l(t,gi("PriceFeed"))}static priceFeedToJson(t){return Fl(t,gi("PriceFeed"))}static toPrice(t){return $l(t,gi("Price"))}static priceToJson(t){return Fl(t,gi("Price"))}static toPriceFeedMetadata(t){return $l(t,gi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return Fl(t,gi("PriceFeedMetadata"))}}ac.Convert=_8;function mi(e,t,r=""){throw Error(r?`Invalid value for key "${r}". Expected type ${JSON.stringify(e)} but got ${JSON.stringify(t)}`:`Invalid value ${JSON.stringify(t)} for type ${JSON.stringify(e)}`)}function C8(e){if(e.jsonToJS===void 0){const t={};e.props.forEach(r=>t[r.json]={key:r.js,typ:r.typ}),e.jsonToJS=t}return e.jsonToJS}function M8(e){if(e.jsToJSON===void 0){const t={};e.props.forEach(r=>t[r.js]={key:r.json,typ:r.typ}),e.jsToJSON=t}return e.jsToJSON}function Go(e,t,r,n=""){function i(l,d){return typeof l==typeof d?d:mi(l,d,n)}function o(l,d){const p=l.length;for(let w=0;w<p;w++){const b=l[w];try{return Go(d,b,r)}catch{}}return mi(l,d)}function s(l,d){return l.indexOf(d)!==-1?d:mi(l,d)}function a(l,d){return Array.isArray(d)?d.map(p=>Go(p,l,r)):mi("array",d)}function c(l){if(l===null)return null;const d=new Date(l);return isNaN(d.valueOf())?mi("Date",l):d}function u(l,d,p){if(p===null||typeof p!="object"||Array.isArray(p))return mi("object",p);const w={};return Object.getOwnPropertyNames(l).forEach(b=>{const y=l[b],T=Object.prototype.hasOwnProperty.call(p,b)?p[b]:void 0;w[y.key]=Go(T,y.typ,r,y.key)}),Object.getOwnPropertyNames(p).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(w[b]=Go(p[b],d,r,b))}),w}if(t==="any")return e;if(t===null)return e===null?e:mi(t,e);if(t===!1)return mi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=A8[t.ref];return Array.isArray(t)?s(t,e):typeof t=="object"?t.hasOwnProperty("unionMembers")?o(t.unionMembers,e):t.hasOwnProperty("arrayItems")?a(t.arrayItems,e):t.hasOwnProperty("props")?u(r(t),t.additional,e):mi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function $l(e,t){return Go(e,t,C8)}function Fl(e,t){return Go(e,t,M8)}function vo(...e){return{unionMembers:e}}function Ul(e,t){return{props:e,additional:t}}function gi(e){return{ref:e}}const A8={PriceFeed:Ul([{json:"ema_price",js:"ema_price",typ:gi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:vo(void 0,gi("PriceFeedMetadata"))},{json:"price",js:"price",typ:gi("Price")},{json:"vaa",js:"vaa",typ:vo(void 0,"")}],"any"),Price:Ul([{json:"conf",js:"conf",typ:""},{json:"expo",js:"expo",typ:0},{json:"price",js:"price",typ:""},{json:"publish_time",js:"publish_time",typ:0}],"any"),PriceFeedMetadata:Ul([{json:"attestation_time",js:"attestation_time",typ:vo(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:vo(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:vo(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:vo(void 0,0)},{json:"slot",js:"slot",typ:vo(void 0,0)}],"any")};var Vl={},Ep;function cc(){return Ep||(Ep=1,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=l,r.toByteArray=p,r.fromByteArray=y;for(var n=[],i=[],o=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function u(R){var k=R.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=R.indexOf("=");F===-1&&(F=k);var L=F===k?0:4-F%4;return[F,L]}function l(R){var k=u(R),F=k[0],L=k[1];return(F+L)*3/4-L}function d(R,k,F){return(k+F)*3/4-F}function p(R){var k,F=u(R),L=F[0],q=F[1],H=new o(d(R,L,q)),K=0,re=q>0?L-4:L,oe;for(oe=0;oe<re;oe+=4)k=i[R.charCodeAt(oe)]<<18|i[R.charCodeAt(oe+1)]<<12|i[R.charCodeAt(oe+2)]<<6|i[R.charCodeAt(oe+3)],H[K++]=k>>16&255,H[K++]=k>>8&255,H[K++]=k&255;return q===2&&(k=i[R.charCodeAt(oe)]<<2|i[R.charCodeAt(oe+1)]>>4,H[K++]=k&255),q===1&&(k=i[R.charCodeAt(oe)]<<10|i[R.charCodeAt(oe+1)]<<4|i[R.charCodeAt(oe+2)]>>2,H[K++]=k>>8&255,H[K++]=k&255),H}function w(R){return n[R>>18&63]+n[R>>12&63]+n[R>>6&63]+n[R&63]}function b(R,k,F){for(var L,q=[],H=k;H<F;H+=3)L=(R[H]<<16&16711680)+(R[H+1]<<8&65280)+(R[H+2]&255),q.push(w(L));return q.join("")}function y(R){for(var k,F=R.length,L=F%3,q=[],H=16383,K=0,re=F-L;K<re;K+=H)q.push(b(R,K,K+H>re?re:K+H));return L===1?(k=R[F-1],q.push(n[k>>2]+n[k<<4&63]+"==")):L===2&&(k=(R[F-2]<<8)+R[F-1],q.push(n[k>>10]+n[k>>4&63]+n[k<<2&63]+"=")),q.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(R,k,F,L,q){var H,K,re=q*8-L-1,oe=(1<<re)-1,ae=oe>>1,z=-7,D=F?q-1:0,h=F?-1:1,f=R[k+D];for(D+=h,H=f&(1<<-z)-1,f>>=-z,z+=re;z>0;H=H*256+R[k+D],D+=h,z-=8);for(K=H&(1<<-z)-1,H>>=-z,z+=L;z>0;K=K*256+R[k+D],D+=h,z-=8);if(H===0)H=1-ae;else{if(H===oe)return K?NaN:(f?-1:1)*(1/0);K=K+Math.pow(2,L),H=H-ae}return(f?-1:1)*K*Math.pow(2,H-L)},T.write=function(R,k,F,L,q,H){var K,re,oe,ae=H*8-q-1,z=(1<<ae)-1,D=z>>1,h=q===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=L?0:H-1,m=L?1:-1,S=k<0||k===0&&1/k<0?1:0;for(k=Math.abs(k),isNaN(k)||k===1/0?(re=isNaN(k)?1:0,K=z):(K=Math.floor(Math.log(k)/Math.LN2),k*(oe=Math.pow(2,-K))<1&&(K--,oe*=2),K+D>=1?k+=h/oe:k+=h*Math.pow(2,1-D),k*oe>=2&&(K++,oe/=2),K+D>=z?(re=0,K=z):K+D>=1?(re=(k*oe-1)*Math.pow(2,q),K=K+D):(re=k*Math.pow(2,D-1)*Math.pow(2,q),K=0));q>=8;R[F+f]=re&255,f+=m,re/=256,q-=8);for(K=K<<q|re,ae+=q;ae>0;R[F+f]=K&255,f+=m,K/=256,ae-=8);R[F+f-m]|=S*128};/*!
24
+ <%s key={someKey} {...props} />`,Er,dr,Dn,dr),Y[dr+Er]=!0}}return V===n?$(Ut):M(Ut),Ut}}function ie(V,se,fe){return ee(V,se,fe,!0)}function Be(V,se,fe){return ee(V,se,fe,!1)}var Je=Be,Re=ie;zs.Fragment=n,zs.jsx=Je,zs.jsxs=Re}()),zs}wn.env.NODE_ENV==="production"?cl.exports=s6():cl.exports=a6();var w=cl.exports;const WB="",GB="",KB="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-link2" viewBox="0 0 1024 1024"><path d="M642.7648 217.6a166.5024 166.5024 0 0 1 166.5024 166.5024v256.256a166.5024 166.5024 0 0 1-166.5024 166.5024H386.5088a92.16 92.16 0 0 1-64.9728-157.5936L506.88 465.2032H429.2096a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h170.8544l1.4336 0.0512c0.8704 0 1.6896 0.1024 2.56 0.1536l-3.9936-0.2048a38.656 38.656 0 0 1 27.2384 11.3664l1.792 1.9456 1.536 1.8944-3.328-3.84a38.6048 38.6048 0 0 1 11.1616 27.0336v170.8544a38.4 38.4 0 0 1-76.8 0l-0.0512-78.592-185.9584 184.6784a15.36 15.36 0 0 0 7.3216 25.9072l3.584 0.4096h256.2048c49.5616 0 89.7024-40.1408 89.7024-89.7024V384.1024c0-49.5104-40.1408-89.7024-89.7024-89.7024H386.5088c-49.5616 0-89.7024 40.192-89.7024 89.7024V563.2a38.4 38.4 0 0 1-76.8 0V384.1024A166.5024 166.5024 0 0 1 386.5088 217.6h256.256z" ></path></symbol><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,o,s,a,c=function(d,p){p.parentNode.insertBefore(d,p)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var d,p=document.createElement("div");p.innerHTML=e._iconfont_svg_string_4776227,(p=p.getElementsByTagName("svg")[0])&&(p.setAttribute("aria-hidden","true"),p.style.position="absolute",p.style.width=0,p.style.height=0,p.style.overflow="hidden",p=p,(d=document.body).firstChild?c(p,d.firstChild):d.appendChild(p))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=n,s=e.document,a=!1,l(),s.onreadystatechange=function(){s.readyState=="complete"&&(s.onreadystatechange=null,u())})}function u(){a||(a=!0,o())}function l(){try{s.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const YB="",ZB="",XB="",JB="",c6="1.26.1",u6="1.47.0",l6={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class u0 extends Error{}class l0 extends u0{constructor(t,r){super(t),this.code=r,this.type=l6[r]??"ServerError"}}class f6 extends u0{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var f0=e=>{throw TypeError(e)},ul=(e,t,r)=>t.has(e)||f0("Cannot "+r),sr=(e,t,r)=>(ul(e,t,"read from private field"),r?r.call(e):t.get(e)),lo=(e,t,r)=>t.has(e)?f0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ko=(e,t,r,n)=>(ul(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),d0=(e,t,r)=>(ul(e,t,"access private method"),r),d6=(e,t,r,n)=>({set _(i){Ko(e,t,i,r)},get _(){return sr(e,t,n)}}),fo,Hs,ci,ho,qs,Yo,Ka,h0,p0;function h6(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const p6={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class m6{constructor(t,r={}){if(lo(this,Ka),lo(this,fo,0),lo(this,Hs,0),lo(this,ci,null),lo(this,ho,null),lo(this,qs,new Set),lo(this,Yo,new Map),this.endpoint=t,this.options={...p6,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=h6(this.endpoint))}async makeRequest(t,r){const n=await d0(this,Ka,h0).call(this);return new Promise((i,o)=>{Ko(this,fo,sr(this,fo)+1),sr(this,Yo).set(sr(this,fo),{resolve:i,reject:o,timeout:setTimeout(()=>{sr(this,Yo).delete(sr(this,fo)),o(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:sr(this,fo),method:t,params:r}))}).then(({error:i,result:o})=>{if(i)throw new l0(i.message,i.code);return o})}async subscribe(t){const r=new g6(t);return sr(this,qs).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}fo=new WeakMap,Hs=new WeakMap,ci=new WeakMap,ho=new WeakMap,qs=new WeakMap,Yo=new WeakMap,Ka=new WeakSet,h0=function(){return sr(this,ho)?sr(this,ho):(Ko(this,ho,new Promise(e=>{var t;(t=sr(this,ci))==null||t.close(),Ko(this,ci,new this.options.WebSocketConstructor(this.endpoint)),sr(this,ci).addEventListener("open",()=>{Ko(this,Hs,0),e(sr(this,ci))}),sr(this,ci).addEventListener("close",()=>{d6(this,Hs)._++,sr(this,Hs)<=this.options.maxReconnects&&setTimeout(()=>{d0(this,Ka,p0).call(this)},this.options.reconnectTimeout)}),sr(this,ci).addEventListener("message",({data:r})=>{let n;try{n=JSON.parse(r)}catch(i){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:i}));return}if("id"in n&&n.id!=null&&sr(this,Yo).has(n.id)){const{resolve:i,timeout:o}=sr(this,Yo).get(n.id);clearTimeout(o),i(n)}else if("params"in n){const{params:i}=n;sr(this,qs).forEach(o=>{o.subscriptionId===i.subscription&&i.subscription===o.subscriptionId&&o.onMessage(i.result)})}})})),sr(this,ho))},p0=async function(){var e;return(e=sr(this,ci))==null||e.close(),Ko(this,ho,null),Promise.allSettled([...sr(this,qs)].map(t=>t.subscribe(this)))};class g6{constructor(t){this.subscriptionId=null,this.subscribed=!1,this.input=t}onMessage(t){this.subscribed&&this.input.onMessage(t)}async unsubscribe(t){const{subscriptionId:r}=this;return this.subscribed=!1,r==null?!1:(this.subscriptionId=null,t.makeRequest(this.input.unsubscribe,[r]))}async subscribe(t){this.subscriptionId=null,this.subscribed=!0;const r=await t.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=r)}}var m0=e=>{throw TypeError(e)},ll=(e,t,r)=>t.has(e)||m0("Cannot "+r),on=(e,t,r)=>(ll(e,t,"read from private field"),r?r.call(e):t.get(e)),Ya=(e,t,r)=>t.has(e)?m0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fl=(e,t,r,n)=>(ll(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),v6=(e,t,r)=>(ll(e,t,"access private method"),r),Ws,bn,Gs,dl,g0;class y6{constructor(t){Ya(this,dl),Ya(this,Ws,0),Ya(this,bn),Ya(this,Gs),fl(this,bn,t)}fetch(t,r){const n=on(this,bn).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(t,r)}async request(t){var i,o;fl(this,Ws,on(this,Ws)+1);const r=await this.fetch(((i=on(this,bn).rpc)==null?void 0:i.url)??on(this,bn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":c6,"Client-Target-Api-Version":u6,"Client-Request-Method":t.method,...(o=on(this,bn).rpc)==null?void 0:o.headers},body:JSON.stringify({jsonrpc:"2.0",id:on(this,Ws),method:t.method,params:t.params})});if(!r.ok)throw new f6(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new l0(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await v6(this,dl,g0).call(this).subscribe(t);return async()=>!!await r()}}Ws=new WeakMap,bn=new WeakMap,Gs=new WeakMap,dl=new WeakSet,g0=function(){var e;if(!on(this,Gs)){const t=on(this,bn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");fl(this,Gs,new m6(((e=on(this,bn).websocket)==null?void 0:e.url)??on(this,bn).url,{WebSocketConstructor:t,...on(this,bn).websocket}))}return on(this,Gs)};function v0(e){switch(e){case"mainnet":return"https://fullnode.mainnet.sui.io:443";case"testnet":return"https://fullnode.testnet.sui.io:443";case"devnet":return"https://fullnode.devnet.sui.io:443";case"localnet":return"http://127.0.0.1:9000";default:throw new Error(`Unknown network: ${e}`)}}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function w6(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function y0(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function hl(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function w0(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function pl(e){if(!Array.isArray(e))throw new Error("array expected")}function b0(e,t){if(!y0(!0,t))throw new Error(`${e}: array of strings expected`)}function b6(e,t){if(!y0(!1,t))throw new Error(`${e}: array of numbers expected`)}function x6(...e){const t=o=>o,r=(o,s)=>a=>o(s(a)),n=e.map(o=>o.encode).reduceRight(r,t),i=e.map(o=>o.decode).reduce(r,t);return{encode:n,decode:i}}function S6(e){const t=typeof e=="string"?e.split(""):e,r=t.length;b0("alphabet",t);const n=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(pl(i),i.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:i=>(pl(i),i.map(o=>{hl("alphabet.decode",o);const s=n.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function E6(e=""){return hl("join",e),{encode:t=>(b0("join.decode",t),t.join(e)),decode:t=>(hl("join.decode",t),t.split(e))}}function x0(e,t,r){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(pl(e),!e.length)return[];let n=0;const i=[],o=Array.from(e,a=>{if(w0(a),a<0||a>=t)throw new Error(`invalid integer: ${a}`);return a}),s=o.length;for(;;){let a=0,c=!0;for(let u=n;u<s;u++){const l=o[u],d=t*a,p=d+l;if(!Number.isSafeInteger(p)||d/t!==a||p-l!==d)throw new Error("convertRadix: carry overflow");const b=p/r;a=p%r;const x=Math.floor(b);if(o[u]=x,!Number.isSafeInteger(x)||x*r+a!==p)throw new Error("convertRadix: carry overflow");if(c)x?c=!1:n=u;else continue}if(i.push(a),c)break}for(let a=0;a<e.length-1&&e[a]===0;a++)i.push(0);return i.reverse()}function _6(e){w0(e);const t=2**8;return{encode:r=>{if(!w6(r))throw new Error("radix.encode input should be Uint8Array");return x0(Array.from(r),t,e)},decode:r=>(b6("radix.decode",r),Uint8Array.from(x0(r,e,t)))}}const S0=(e=>x6(_6(58),S6(e),E6("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),po=e=>S0.encode(e),ui=e=>S0.decode(e),C6=po,A6=ui;function xr(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const ml=8192;function gr(e){if(e.length<ml)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=ml){const n=e.slice(r,r+ml);t+=String.fromCharCode(...n)}return btoa(t)}const E0=gr,_0=xr;function Zo(e){var i;const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=((i=r.match(/[0-9a-fA-F]{2}/g))==null?void 0:i.map(o=>parseInt(o,16)))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function li(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const C0=li,A0=Zo;function Za(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function M6(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class M0{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=M6(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function T0(e,t){switch(t){case"base58":return po(e);case"base64":return gr(e);case"hex":return li(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function T6(e,t){switch(t){case"base58":return ui(e);case"base64":return xr(e);case"hex":return Zo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function gl(e,t=["<",">"]){const[r,n]=t,i=[];let o="",s=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&s++,c===n&&s--,s===0&&c===","){i.push(o.trim()),o="";continue}o+=c}return i.push(o.trim()),i}class I0{constructor({initialSize:t=1024,maxSize:r=1/0,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return vl(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return vl(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return vl(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Za(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return T0(this.toBytes(),t)}}function vl(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var O0=e=>{throw TypeError(e)},P0=(e,t,r)=>t.has(e)||O0("Cannot "+r),xn=(e,t,r)=>(P0(e,t,"read from private field"),r?r.call(e):t.get(e)),Xa=(e,t,r)=>t.has(e)?O0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ja=(e,t,r,n)=>(P0(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Xo,Ks,Qa,Bi;const I6=class Q2{constructor(t){Xa(this,Xo),Xa(this,Ks),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Ja(this,Xo,t.write),Ja(this,Ks,t.serialize??((r,n)=>{const i=new I0({initialSize:this.serializedSize(r)??void 0,...n});return xn(this,Xo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),xn(this,Xo).call(this,t,r)}serialize(t,r){return this.validate(t),new N0(this,xn(this,Ks).call(this,t,r))}parse(t){const r=new M0(t);return this.read(r)}fromHex(t){return this.parse(Zo(t))}fromBase58(t){return this.parse(ui(t))}fromBase64(t){return this.parse(xr(t))}transform({name:t,input:r,output:n,validate:i}){return new Q2({name:t??this.name,read:o=>n?n(this.read(o)):this.read(o),write:(o,s)=>xn(this,Xo).call(this,r?r(o):o,s),serializedSize:o=>this.serializedSize(r?r(o):o),serialize:(o,s)=>xn(this,Ks).call(this,r?r(o):o,s),validate:o=>{i==null||i(o),this.validate(r?r(o):o)}})}};Xo=new WeakMap,Ks=new WeakMap;let Sn=I6;const R0=Symbol.for("@mysten/serialized-bcs");function ec(e){return!!e&&typeof e=="object"&&e[R0]===!0}class N0{constructor(t,r){Xa(this,Qa),Xa(this,Bi),Ja(this,Qa,t),Ja(this,Bi,r)}get[R0](){return!0}toBytes(){return xn(this,Bi)}toHex(){return li(xn(this,Bi))}toBase64(){return gr(xn(this,Bi))}toBase58(){return po(xn(this,Bi))}parse(){return xn(this,Qa).parse(xn(this,Bi))}}Qa=new WeakMap,Bi=new WeakMap;function tc({size:e,...t}){return new Sn({...t,serializedSize:()=>e})}function yl({readMethod:e,writeMethod:t,...r}){return tc({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function wl({readMethod:e,writeMethod:t,...r}){return tc({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var o;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(o=r.validate)==null||o.call(r,i)}})}function O6({serialize:e,...t}){const r=new Sn({...t,serialize:e,write:(n,i)=>{for(const o of r.serialize(n).toBytes())i.write8(o)}});return r}function P6({toBytes:e,fromBytes:t,...r}){return new Sn({...r,read:n=>{const i=n.readULEB(),o=n.readBytes(i);return t(o)},write:(n,i)=>{const o=e(n);i.writeULEB(o.length);for(let s=0;s<o.length;s++)i.write8(o[s])},serialize:n=>{const i=e(n),o=Za(i.length),s=new Uint8Array(o.length+i.length);return s.set(o,0),s.set(i,o.length),s},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function R6(e){let t=null;function r(){return t||(t=e()),t}return new Sn({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const q={u8(e){return yl({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return yl({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return yl({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return wl({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return wl({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return wl({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return tc({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return O6({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Za(t)),...e})},bytes(e,t){return tc({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{const i=new Uint8Array(r);for(let o=0;o<e;o++)n.write8(i[o]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},byteVector(e){return new Sn({name:"bytesVector",read:t=>{const r=t.readULEB();return t.readBytes(r)},write:(t,r)=>{const n=new Uint8Array(t);r.writeULEB(n.length);for(let i=0;i<n.length;i++)r.write8(n[i]??0)},...e,serializedSize:t=>{const r="length"in t?t.length:null;return r==null?null:Za(r).length+r},validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),!t||typeof t!="object"||!("length"in t))throw new TypeError(`Expected array, found ${typeof t}`)}})},string(e){return P6({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Sn({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let o=0;o<e;o++)i[o]=t.read(n);return i},write:(n,i)=>{for(const o of n)t.write(o,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return q.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})},vector(e,t){return new Sn({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let o=0;o<n;o++)i[o]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Sn({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const o=e[i].serializedSize(r[i]);if(o==null)return null;n+=o}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Sn({name:e,serializedSize:i=>{let o=0;for(const[s,a]of n){const c=a.serializedSize(i[s]);if(c==null)return null;o+=c}return o},read:i=>{const o={};for(const[s,a]of n)o[s]=a.read(i);return o},write:(i,o)=>{for(const[s,a]of n)a.write(i[s],o)},...r,validate:i=>{var o;if((o=r==null?void 0:r.validate)==null||o.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Sn({name:e,read:i=>{const o=i.readULEB(),s=n[o];if(!s)throw new TypeError(`Unknown value ${o} for enum ${e}`);const[a,c]=s;return{[a]:(c==null?void 0:c.read(i))??!0,$kind:a}},write:(i,o)=>{const[s,a]=Object.entries(i).filter(([c])=>Object.hasOwn(t,c))[0];for(let c=0;c<n.length;c++){const[u,l]=n[c];if(u===s){o.writeULEB(c),l==null||l.write(a,o);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const o=Object.keys(i).filter(c=>i[c]!==void 0&&Object.hasOwn(t,c));if(o.length!==1)throw new TypeError(`Expected object with one key, but found ${o.length} for type ${e}}`);const[s]=o;if(!Object.hasOwn(t,s))throw new TypeError(`Invalid enum variant ${s}`)}})},map(e,t){return q.vector(q.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,o]of r)n.set(i,o);return n}})},lazy(e){return R6(e)}},N6=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:M0,BcsType:Sn,BcsWriter:I0,SerializedBcs:N0,bcs:q,decodeStr:T6,encodeStr:T0,fromB58:A6,fromB64:_0,fromBase58:ui,fromBase64:xr,fromHEX:A0,fromHex:Zo,isSerializedBcs:ec,splitGenericParameters:gl,toB58:C6,toB64:E0,toBase58:po,toBase64:gr,toHEX:C0,toHex:li},Symbol.toStringTag,{value:"Module"}));class j0{constructor({network:t}){this.network=t}$extend(...t){return Object.create(this,Object.fromEntries(t.map(r=>{if("experimental_asClientExtension"in r){const{name:n,register:i}=r.experimental_asClientExtension();return[n,{value:i(this)}]}return[r.name,{value:r.register(this)}]})))}}const k0=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,D0=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,j6=235;function B0(e){return e.length>j6?!1:e.includes("@")?k0.test(e):D0.test(e)}function L0(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!k0.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,o]=r.split("@");n=[...i?i.split("."):[],o]}else{if(!D0.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}const k6=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,D6=/^\d+$/,B6=64,$0="/",bl=e=>{const t=e.split($0);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!D6.test(i)||!B0(r)?!1:k6.test(n)&&n.length<B6},L6=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes($0)&&!bl(r))return!1;return!0},$6=32;function xl(e){try{return ui(e).length===$6}catch{return!1}}const rc=32;function Vn(e){return U6(e)&&V6(e)===rc}function Ys(e){return Vn(e)}function F6(e){return e.includes("::")?Sl(e):e}function Sl(e){const[t,r]=e.split("::"),n=bl(t),i=e.slice(t.length+r.length+4),o=i.includes("<")?i.slice(0,i.indexOf("<")):i,s=i.includes("<")?gl(i.slice(i.indexOf("<")+1,i.lastIndexOf(">"))).map(a=>F6(a.trim())):[];return{address:n?t:jt(t),module:r,name:o,typeParams:s}}function F0(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Sl(e):e,o=(i==null?void 0:i.length)>0?`<${i.map(s=>typeof s=="string"?s:F0(s)).join(",")}>`:"";return`${t}::${r}::${n}${o}`}function jt(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(rc*2,"0")}`}function Zr(e,t=!1){return jt(e,t)}function U6(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function V6(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const z6=/^vector<(.+)>$/,H6=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let nc=class Fs{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(z6);if(n)return{vector:Fs.parseFromStr(n[1],r)};const i=t.match(H6);if(i)return{struct:{address:r?jt(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Fs.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return gl(t).map(n=>Fs.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Fs.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Fs.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function q6(e){return q.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function W6(e){return q.enum("Option",{None:null,Some:e})}const rr=q.bytes(rc).transform({validate:e=>{const t=typeof e=="string"?e:li(e);if(!t||!Vn(jt(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?Zo(jt(e)):e,output:e=>jt(li(e))}),En=q.vector(q.u8()).transform({name:"ObjectDigest",input:e=>ui(e),output:e=>po(new Uint8Array(e)),validate:e=>{if(ui(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),sn=q.struct("SuiObjectRef",{objectId:rr,version:q.u64(),digest:En}),U0=q.struct("SharedObjectRef",{objectId:rr,initialSharedVersion:q.u64(),mutable:q.bool()}),V0=q.enum("ObjectArg",{ImmOrOwnedObject:sn,SharedObject:U0,Receiving:sn}),mo=q.enum("Owner",{AddressOwner:rr,ObjectOwner:rr,Shared:q.struct("Shared",{initialSharedVersion:q.u64()}),Immutable:null,ConsensusV2:q.struct("ConsensusV2",{authenticator:q.struct("Authenticator",{SingleOwner:q.string()}),startVersion:q.string()})}),z0=q.enum("CallArg",{Pure:q.struct("Pure",{bytes:q.vector(q.u8()).transform({input:e=>typeof e=="string"?xr(e):e,output:e=>gr(new Uint8Array(e))})}),Object:V0}),El=q.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:q.lazy(()=>El),struct:q.lazy(()=>Y0),u16:null,u32:null,u256:null}),_l=El.transform({input:e=>typeof e=="string"?nc.parseFromStr(e,!0):e,output:e=>nc.tagToString(e)}),zn=q.enum("Argument",{GasCoin:null,Input:q.u16(),Result:q.u16(),NestedResult:q.tuple([q.u16(),q.u16()])}),H0=q.struct("ProgrammableMoveCall",{package:rr,module:q.string(),function:q.string(),typeArguments:q.vector(_l),arguments:q.vector(zn)}),q0=q.enum("Command",{MoveCall:H0,TransferObjects:q.struct("TransferObjects",{objects:q.vector(zn),address:zn}),SplitCoins:q.struct("SplitCoins",{coin:zn,amounts:q.vector(zn)}),MergeCoins:q.struct("MergeCoins",{destination:zn,sources:q.vector(zn)}),Publish:q.struct("Publish",{modules:q.vector(q.vector(q.u8()).transform({input:e=>typeof e=="string"?xr(e):e,output:e=>gr(new Uint8Array(e))})),dependencies:q.vector(rr)}),MakeMoveVec:q.struct("MakeMoveVec",{type:W6(_l).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:q.vector(zn)}),Upgrade:q.struct("Upgrade",{modules:q.vector(q.vector(q.u8()).transform({input:e=>typeof e=="string"?xr(e):e,output:e=>gr(new Uint8Array(e))})),dependencies:q.vector(rr),package:rr,ticket:zn})}),W0=q.struct("ProgrammableTransaction",{inputs:q.vector(z0),commands:q.vector(q0)}),G0=q.enum("TransactionKind",{ProgrammableTransaction:W0,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),K0=q.enum("TransactionExpiration",{None:null,Epoch:q6()}),Y0=q.struct("StructTag",{address:rr,module:q.string(),name:q.string(),typeParams:q.vector(El)}),Z0=q.struct("GasData",{payment:q.vector(sn),owner:rr,price:q.u64(),budget:q.u64()}),X0=q.struct("TransactionDataV1",{kind:G0,sender:rr,gasData:Z0,expiration:K0}),J0=q.enum("TransactionData",{V1:X0}),Q0=q.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),ep=q.enum("IntentVersion",{V0:null}),tp=q.enum("AppId",{Sui:null}),rp=q.struct("Intent",{scope:Q0,version:ep,appId:tp});function np(e){return q.struct(`IntentMessage<${e.name}>`,{intent:rp,value:e})}const ip=q.enum("CompressedSignature",{ED25519:q.fixedArray(64,q.u8()),Secp256k1:q.fixedArray(64,q.u8()),Secp256r1:q.fixedArray(64,q.u8()),ZkLogin:q.vector(q.u8())}),op=q.enum("PublicKey",{ED25519:q.fixedArray(32,q.u8()),Secp256k1:q.fixedArray(33,q.u8()),Secp256r1:q.fixedArray(33,q.u8()),ZkLogin:q.vector(q.u8())}),sp=q.struct("MultiSigPkMap",{pubKey:op,weight:q.u8()}),ap=q.struct("MultiSigPublicKey",{pk_map:q.vector(sp),threshold:q.u16()}),G6=q.struct("MultiSig",{sigs:q.vector(ip),bitmap:q.u16(),multisig_pk:ap}),K6=q.vector(q.u8()).transform({input:e=>typeof e=="string"?xr(e):e,output:e=>gr(new Uint8Array(e))}),cp=q.struct("SenderSignedTransaction",{intentMessage:np(J0),txSignatures:q.vector(K6)}),Y6=q.vector(cp,{name:"SenderSignedData"}),Z6=q.struct("PasskeyAuthenticator",{authenticatorData:q.vector(q.u8()),clientDataJson:q.string(),userSignature:q.vector(q.u8())}),X6=q.enum("PackageUpgradeError",{UnableToFetchPackage:q.struct("UnableToFetchPackage",{packageId:rr}),NotAPackage:q.struct("NotAPackage",{objectId:rr}),IncompatibleUpgrade:null,DigestDoesNotMatch:q.struct("DigestDoesNotMatch",{digest:q.vector(q.u8())}),UnknownUpgradePolicy:q.struct("UnknownUpgradePolicy",{policy:q.u8()}),PackageIDDoesNotMatch:q.struct("PackageIDDoesNotMatch",{packageId:rr,ticketId:rr})}),J6=q.struct("ModuleId",{address:rr,name:q.string()}),up=q.struct("MoveLocation",{module:J6,function:q.u16(),instruction:q.u16(),functionName:q.option(q.string())}),Q6=q.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:q.struct("IndexOutOfBounds",{idx:q.u16()}),SecondaryIndexOutOfBounds:q.struct("SecondaryIndexOutOfBounds",{resultIdx:q.u16(),secondaryIdx:q.u16()}),InvalidResultArity:q.struct("InvalidResultArity",{resultIdx:q.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),e4=q.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),t4=q.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:q.struct("MoveObjectTooBig",{objectSize:q.u64(),maxObjectSize:q.u64()}),MovePackageTooBig:q.struct("MovePackageTooBig",{objectSize:q.u64(),maxObjectSize:q.u64()}),CircularObjectOwnership:q.struct("CircularObjectOwnership",{object:rr}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:q.option(up),MoveAbort:q.tuple([up,q.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:q.struct("CommandArgumentError",{argIdx:q.u16(),kind:Q6}),TypeArgumentError:q.struct("TypeArgumentError",{argumentIdx:q.u16(),kind:e4}),UnusedValueWithoutDrop:q.struct("UnusedValueWithoutDrop",{resultIdx:q.u16(),secondaryIdx:q.u16()}),InvalidPublicFunctionReturnType:q.struct("InvalidPublicFunctionReturnType",{idx:q.u16()}),InvalidTransferObject:null,EffectsTooLarge:q.struct("EffectsTooLarge",{currentSize:q.u64(),maxSize:q.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:q.struct("PackageUpgradeError",{upgradeError:X6}),WrittenObjectsTooLarge:q.struct("WrittenObjectsTooLarge",{currentSize:q.u64(),maxSize:q.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:q.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:q.vector(rr)}),AddressDeniedForCoin:q.struct("AddressDeniedForCoin",{address:rr,coinType:q.string()}),CoinTypeGlobalPause:q.struct("CoinTypeGlobalPause",{coinType:q.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),lp=q.enum("ExecutionStatus",{Success:null,Failed:q.struct("ExecutionFailed",{error:t4,command:q.option(q.u64())})}),fp=q.struct("GasCostSummary",{computationCost:q.u64(),storageCost:q.u64(),storageRebate:q.u64(),nonRefundableStorageFee:q.u64()}),r4=q.struct("TransactionEffectsV1",{status:lp,executedEpoch:q.u64(),gasUsed:fp,modifiedAtVersions:q.vector(q.tuple([rr,q.u64()])),sharedObjects:q.vector(sn),transactionDigest:En,created:q.vector(q.tuple([sn,mo])),mutated:q.vector(q.tuple([sn,mo])),unwrapped:q.vector(q.tuple([sn,mo])),deleted:q.vector(sn),unwrappedThenDeleted:q.vector(sn),wrapped:q.vector(sn),gasObject:q.tuple([sn,mo]),eventsDigest:q.option(En),dependencies:q.vector(En)}),Cl=q.tuple([q.u64(),En]),n4=q.enum("ObjectIn",{NotExist:null,Exist:q.tuple([Cl,mo])}),i4=q.enum("ObjectOut",{NotExist:null,ObjectWrite:q.tuple([En,mo]),PackageWrite:Cl}),o4=q.enum("IDOperation",{None:null,Created:null,Deleted:null}),s4=q.struct("EffectsObjectChange",{inputState:n4,outputState:i4,idOperation:o4}),a4=q.enum("UnchangedSharedKind",{ReadOnlyRoot:Cl,MutateDeleted:q.u64(),ReadDeleted:q.u64(),Cancelled:q.u64(),PerEpochConfig:null}),c4=q.struct("TransactionEffectsV2",{status:lp,executedEpoch:q.u64(),gasUsed:fp,transactionDigest:En,gasObjectIndex:q.option(q.u32()),eventsDigest:q.option(En),dependencies:q.vector(En),lamportVersion:q.u64(),changedObjects:q.vector(q.tuple([rr,s4])),unchangedSharedObjects:q.vector(q.tuple([rr,a4])),auxDataDigest:q.option(En)}),u4=q.enum("TransactionEffects",{V1:r4,V2:c4});function Zs(e){switch(e){case"u8":return q.u8();case"u16":return q.u16();case"u32":return q.u32();case"u64":return q.u64();case"u128":return q.u128();case"u256":return q.u256();case"bool":return q.bool();case"string":return q.string();case"id":case"address":return rr}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?q.vector(Zs(n)):q.option(Zs(n))}throw new Error(`Invalid Pure type name: ${e}`)}const pt={...q,U8:q.u8(),U16:q.u16(),U32:q.u32(),U64:q.u64(),U128:q.u128(),U256:q.u256(),ULEB128:q.uleb128(),Bool:q.bool(),String:q.string(),Address:rr,AppId:tp,Argument:zn,CallArg:z0,CompressedSignature:ip,GasData:Z0,Intent:rp,IntentMessage:np,IntentScope:Q0,IntentVersion:ep,MultiSig:G6,MultiSigPkMap:sp,MultiSigPublicKey:ap,ObjectArg:V0,ObjectDigest:En,Owner:mo,ProgrammableMoveCall:H0,ProgrammableTransaction:W0,PublicKey:op,SenderSignedData:Y6,SenderSignedTransaction:cp,SharedObjectRef:U0,StructTag:Y0,SuiObjectRef:sn,Command:q0,TransactionData:J0,TransactionDataV1:X0,TransactionExpiration:K0,TransactionKind:G0,TypeTag:_l,TransactionEffects:u4,PasskeyAuthenticator:Z6};function l4(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}var fi;function f4(e){return{lang:(e==null?void 0:e.lang)??(fi==null?void 0:fi.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(fi==null?void 0:fi.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(fi==null?void 0:fi.abortPipeEarly)}}var Al;function d4(e){return Al==null?void 0:Al.get(e)}var Ml;function h4(e){return Ml==null?void 0:Ml.get(e)}var Tl;function p4(e,t){var r;return(r=Tl==null?void 0:Tl.get(e))==null?void 0:r.get(t)}function dp(e){var r,n;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((n=(r=Object.getPrototypeOf(e))==null?void 0:r.constructor)==null?void 0:n.name))??"null":t}function Xr(e,t,r,n,i){const o=i&&"input"in i?i.input:r.value,s=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??dp(o),c={kind:e.kind,type:e.type,input:o,expected:s,received:a,message:`Invalid ${t}: ${s?`Expected ${s} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u=e.kind==="schema",l=(i==null?void 0:i.message)??e.message??p4(e.reference,c.lang)??(u?h4(c.lang):null)??n.message??d4(c.lang);l&&(c.message=typeof l=="function"?l(c):l),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}function m4(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}var g4=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Xs(e,t){return{kind:"validation",type:"check",reference:Xs,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&Xr(this,"input",r,n),r}}}function ar(e){return{kind:"validation",type:"integer",reference:ar,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&Xr(this,"integer",t,r),t}}}function ic(e){return{kind:"transformation",type:"transform",reference:ic,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function Il(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Ol(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function tt(e,t){return{kind:"schema",type:"array",reference:tt,expects:"Array",async:!1,item:e,message:t,_run(r,n){var o;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){const a=i[s],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else Xr(this,"type",r,n);return r}}}function Pl(e){return{kind:"schema",type:"bigint",reference:Pl,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:Xr(this,"type",t,r),t}}}function oc(e){return{kind:"schema",type:"boolean",reference:oc,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:Xr(this,"type",t,r),t}}}function Js(e){return{kind:"schema",type:"lazy",reference:Js,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function at(e,t){return{kind:"schema",type:"literal",reference:at,expects:dp(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:Xr(this,"type",r,n),r}}}function $t(e,...t){const r={kind:"schema",type:"nullable",reference:$t,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=Il(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Jo(e,...t){const r={kind:"schema",type:"nullish",reference:Jo,expects:`${e.expects} | null | undefined`,async:!1,wrapped:e,_run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=Il(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function or(e){return{kind:"schema",type:"number",reference:or,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:Xr(this,"type",t,r),t}}}function Me(e,t){return{kind:"schema",type:"object",reference:Me,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var o;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const s in this.entries){const a=i[s],c=this.entries[s]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||s in i)&&(r.value[s]=c.value)}}else Xr(this,"type",r,n);return r}}}function Pr(e,...t){const r={kind:"schema",type:"optional",reference:Pr,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=Il(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Qs(e,t,r){return{kind:"schema",type:"record",reference:Qs,expects:"Object",async:!1,key:e,value:t,message:r,_run(n,i){var s,a;const o=n.value;if(o&&typeof o=="object"){n.typed=!0,n.value={};for(const c in o)if(m4(o,c)){const u=o[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const p={type:"object",origin:"key",input:o,key:c,value:u};for(const b of l.issues)b.path=[p],(s=n.issues)==null||s.push(b);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const d=this.value._run({typed:!1,value:u},i);if(d.issues){const p={type:"object",origin:"value",input:o,key:c,value:u};for(const b of d.issues)b.path?b.path.unshift(p):b.path=[p],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=d.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!d.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=d.value)}}else Xr(this,"type",n,i);return n}}}function yt(e){return{kind:"schema",type:"string",reference:yt,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:Xr(this,"type",t,r),t}}}function Rl(e,t){return{kind:"schema",type:"tuple",reference:Rl,expects:"Array",async:!1,items:e,message:t,_run(r,n){var o;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<this.items.length;s++){const a=i[s],c=this.items[s]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:s,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(o=r.issues)==null||o.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else Xr(this,"type",r,n);return r}}}function hp(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Cr(e,t){return{kind:"schema",type:"union",reference:Cr,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,o,s;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)o?o.push(c):o=[c];else{i=c;break}else s?s.push(c):s=[c]}if(i)return i;if(o){if(o.length===1)return o[0];Xr(this,"type",r,n,{issues:hp(o)}),r.typed=!0}else{if((s==null?void 0:s.length)===1)return s[0];Xr(this,"type",r,n,{issues:hp(s)})}return r}}}function go(){return{kind:"schema",type:"unknown",reference:go,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function cr(e,t,r){const n=e._run({typed:!1,value:t},f4(r));if(n.issues)throw new g4(n.issues);return n.value}function Wt(...e){return{...e[0],pipe:e,_run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=e[n]._run(t,r))}return t}}}function vo(e){const t=Object.entries(e).map(([r,n])=>Me({[r]:n}));return Wt(Cr(t),ic(r=>({...r,$kind:Object.keys(r)[0]})))}const Qo=Wt(yt(),ic(e=>jt(e)),Xs(Vn)),Jr=Qo,yo=yt(),zr=Wt(Cr([yt(),Wt(or(),ar())]),Xs(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Li=Me({objectId:Qo,version:zr,digest:yt()}),nr=Wt(Cr([Me({GasCoin:at(!0)}),Me({Input:Wt(or(),ar()),type:Pr(at("pure"))}),Me({Input:Wt(or(),ar()),type:Pr(at("object"))}),Me({Result:Wt(or(),ar())}),Me({NestedResult:Rl([Wt(or(),ar()),Wt(or(),ar())])})]),ic(e=>({...e,$kind:Object.keys(e)[0]}))),v4=Me({budget:$t(zr),price:$t(zr),owner:$t(Qo),payment:$t(tt(Li))}),Nl=Cr([at("address"),at("bool"),at("u8"),at("u16"),at("u32"),at("u64"),at("u128"),at("u256"),Me({vector:Js(()=>Nl)}),Me({datatype:Me({package:yt(),module:yt(),type:yt(),typeParameters:tt(Js(()=>Nl))})}),Me({typeParameter:Wt(or(),ar())})]),y4=Me({ref:$t(Cr([at("&"),at("&mut")])),body:Nl}),w4=Me({package:Jr,module:yt(),function:yt(),typeArguments:tt(yt()),arguments:tt(nr),_argumentTypes:Pr($t(tt(y4)))}),b4=Me({name:yt(),inputs:Qs(yt(),Cr([nr,tt(nr)])),data:Qs(yt(),go())}),x4=vo({MoveCall:w4,TransferObjects:Me({objects:tt(nr),address:nr}),SplitCoins:Me({coin:nr,amounts:tt(nr)}),MergeCoins:Me({destination:nr,sources:tt(nr)}),Publish:Me({modules:tt(yo),dependencies:tt(Jr)}),MakeMoveVec:Me({type:$t(yt()),elements:tt(nr)}),Upgrade:Me({modules:tt(yo),dependencies:tt(Jr),package:Jr,ticket:nr}),$Intent:b4}),pp=vo({ImmOrOwnedObject:Li,SharedObject:Me({objectId:Jr,initialSharedVersion:zr,mutable:oc()}),Receiving:Li}),S4=vo({Object:pp,Pure:Me({bytes:yo}),UnresolvedPure:Me({value:go()}),UnresolvedObject:Me({objectId:Jr,version:Pr($t(zr)),digest:Pr($t(yt())),initialSharedVersion:Pr($t(zr))})}),mp=vo({Object:pp,Pure:Me({bytes:yo})}),gp=vo({None:at(!0),Epoch:zr}),sc=Me({version:at(2),sender:Jo(Qo),expiration:Jo(gp),gasData:v4,inputs:tt(S4),commands:tt(x4)}),wo={MoveCall(e){const[t,r="",n=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:t,module:r,function:n,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects(e,t){return{$kind:"TransferObjects",TransferObjects:{objects:e.map(r=>cr(nr,r)),address:cr(nr,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:cr(nr,e),amounts:t.map(r=>cr(nr,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:cr(nr,e),sources:t.map(r=>cr(nr,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:gr(new Uint8Array(r))),dependencies:t.map(r=>Zr(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:gr(new Uint8Array(i))),dependencies:t.map(i=>Zr(i)),package:r,ticket:cr(nr,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>cr(nr,r))}}},Intent({name:e,inputs:t={},data:r={}}){return{$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(t).map(([n,i])=>[n,Array.isArray(i)?i.map(o=>cr(nr,o)):cr(nr,i)])),data:r}}}},jl=Me({digest:yt(),objectId:yt(),version:Cr([Wt(or(),ar()),yt(),Pl()])}),E4=vo({ImmOrOwned:jl,Shared:Me({objectId:Jr,initialSharedVersion:zr,mutable:oc()}),Receiving:jl}),vp=vo({Object:E4,Pure:tt(Wt(or(),ar()))}),yp=Cr([Me({kind:at("Input"),index:Wt(or(),ar()),value:go(),type:Pr(at("object"))}),Me({kind:at("Input"),index:Wt(or(),ar()),value:go(),type:at("pure")})]),_4=Cr([Me({Epoch:Wt(or(),ar())}),Me({None:$t(at(!0))})]),wp=Wt(Cr([or(),yt(),Pl()]),Xs(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),kl=Cr([Me({bool:$t(at(!0))}),Me({u8:$t(at(!0))}),Me({u64:$t(at(!0))}),Me({u128:$t(at(!0))}),Me({address:$t(at(!0))}),Me({signer:$t(at(!0))}),Me({vector:Js(()=>kl)}),Me({struct:Js(()=>C4)}),Me({u16:$t(at(!0))}),Me({u32:$t(at(!0))}),Me({u256:$t(at(!0))})]),C4=Me({address:yt(),module:yt(),name:yt(),typeParams:tt(kl)}),A4=Me({budget:Pr(wp),price:Pr(wp),payment:Pr(tt(jl)),owner:Pr(yt())}),M4=[yp,Me({kind:at("GasCoin")}),Me({kind:at("Result"),index:Wt(or(),ar())}),Me({kind:at("NestedResult"),index:Wt(or(),ar()),resultIndex:Wt(or(),ar())})],di=Cr([...M4]),T4=Me({kind:at("MoveCall"),target:Wt(yt(),Xs(e=>e.split("::").length===3)),typeArguments:tt(yt()),arguments:tt(di)}),I4=Me({kind:at("TransferObjects"),objects:tt(di),address:di}),O4=Me({kind:at("SplitCoins"),coin:di,amounts:tt(di)}),P4=Me({kind:at("MergeCoins"),destination:di,sources:tt(di)}),R4=Me({kind:at("MakeMoveVec"),type:Cr([Me({Some:kl}),Me({None:$t(at(!0))})]),objects:tt(di)}),N4=Me({kind:at("Publish"),modules:tt(tt(Wt(or(),ar()))),dependencies:tt(yt())}),j4=Me({kind:at("Upgrade"),modules:tt(tt(Wt(or(),ar()))),dependencies:tt(yt()),packageId:yt(),ticket:di}),k4=Cr([...[T4,I4,O4,P4,N4,j4,R4]]);Me({version:at(1),sender:Pr(yt()),expiration:Jo(_4),gasConfig:A4,inputs:tt(yp),transactions:tt(k4)});function bp(e){var r;const t=e.inputs.map((n,i)=>{if(n.Object)return{kind:"Input",index:i,value:{Object:n.Object.ImmOrOwnedObject?{ImmOrOwned:n.Object.ImmOrOwnedObject}:n.Object.Receiving?{Receiving:{digest:n.Object.Receiving.digest,version:n.Object.Receiving.version,objectId:n.Object.Receiving.objectId}}:{Shared:{mutable:n.Object.SharedObject.mutable,initialSharedVersion:n.Object.SharedObject.initialSharedVersion,objectId:n.Object.SharedObject.objectId}}},type:"object"};if(n.Pure)return{kind:"Input",index:i,value:{Pure:Array.from(xr(n.Pure.bytes))},type:"pure"};if(n.UnresolvedPure)return{kind:"Input",type:"pure",index:i,value:n.UnresolvedPure.value};if(n.UnresolvedObject)return{kind:"Input",type:"object",index:i,value:n.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:e.sender??void 0,expiration:((r=e.expiration)==null?void 0:r.$kind)==="Epoch"?{Epoch:Number(e.expiration.Epoch)}:e.expiration?{None:!0}:null,gasConfig:{owner:e.gasData.owner??void 0,budget:e.gasData.budget??void 0,price:e.gasData.price??void 0,payment:e.gasData.payment??void 0},inputs:t,transactions:e.commands.map(n=>{if(n.MakeMoveVec)return{kind:"MakeMoveVec",type:n.MakeMoveVec.type===null?{None:!0}:{Some:nc.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>hi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:hi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>hi(i,t))};if(n.MoveCall)return{kind:"MoveCall",target:`${n.MoveCall.package}::${n.MoveCall.module}::${n.MoveCall.function}`,typeArguments:n.MoveCall.typeArguments,arguments:n.MoveCall.arguments.map(i=>hi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from(xr(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:hi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>hi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>hi(i,t)),address:hi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from(xr(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:hi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function hi(e,t){if(e.$kind==="GasCoin")return{kind:"GasCoin"};if(e.$kind==="Result")return{kind:"Result",index:e.Result};if(e.$kind==="NestedResult")return{kind:"NestedResult",index:e.NestedResult[0],resultIndex:e.NestedResult[1]};if(e.$kind==="Input")return t[e.Input];throw new Error(`Invalid argument ${Object.keys(e)}`)}function D4(e){var t,r,n;return cr(sc,{version:2,sender:e.sender??null,expiration:e.expiration?"Epoch"in e.expiration?{Epoch:e.expiration.Epoch}:{None:!0}:null,gasData:{owner:e.gasConfig.owner??null,budget:((t=e.gasConfig.budget)==null?void 0:t.toString())??null,price:((r=e.gasConfig.price)==null?void 0:r.toString())??null,payment:((n=e.gasConfig.payment)==null?void 0:n.map(i=>({digest:i.digest,objectId:i.objectId,version:i.version.toString()})))??null},inputs:e.inputs.map(i=>{if(i.kind==="Input"){if(Ol(vp,i.value)){const o=cr(vp,i.value);if(o.Object){if(o.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:o.Object.ImmOrOwned.objectId,version:String(o.Object.ImmOrOwned.version),digest:o.Object.ImmOrOwned.digest}}};if(o.Object.Shared)return{Object:{SharedObject:{mutable:o.Object.Shared.mutable??null,initialSharedVersion:o.Object.Shared.initialSharedVersion,objectId:o.Object.Shared.objectId}}};if(o.Object.Receiving)return{Object:{Receiving:{digest:o.Object.Receiving.digest,version:String(o.Object.Receiving.version),objectId:o.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:gr(new Uint8Array(o.Pure))}}}return i.type==="object"?{UnresolvedObject:{objectId:i.value}}:{UnresolvedPure:{value:i.value}}}throw new Error("Invalid input")}),commands:e.transactions.map(i=>{switch(i.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in i.type?nc.tagToString(i.type.Some):null,elements:i.objects.map(o=>pi(o))}};case"MergeCoins":return{MergeCoins:{destination:pi(i.destination),sources:i.sources.map(o=>pi(o))}};case"MoveCall":{const[o,s,a]=i.target.split("::");return{MoveCall:{package:o,module:s,function:a,typeArguments:i.typeArguments,arguments:i.arguments.map(c=>pi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(o=>gr(Uint8Array.from(o))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:pi(i.coin),amounts:i.amounts.map(o=>pi(o))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(o=>pi(o)),address:pi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(o=>gr(Uint8Array.from(o))),dependencies:i.dependencies,package:i.packageId,ticket:pi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function pi(e){switch(e.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:e.index};case"NestedResult":return{NestedResult:[e.index,e.resultIndex]};case"Input":return{Input:e.index}}}function ea(e){return Cr(Object.entries(e).map(([t,r])=>Me({[t]:r})))}const _n=ea({GasCoin:at(!0),Input:Wt(or(),ar()),Result:Wt(or(),ar()),NestedResult:Rl([Wt(or(),ar()),Wt(or(),ar())])}),B4=Me({budget:$t(zr),price:$t(zr),owner:$t(Qo),payment:$t(tt(Li))}),L4=Me({package:Jr,module:yt(),function:yt(),typeArguments:tt(yt()),arguments:tt(_n)}),$4=Me({name:yt(),inputs:Qs(yt(),Cr([_n,tt(_n)])),data:Qs(yt(),go())}),F4=ea({MoveCall:L4,TransferObjects:Me({objects:tt(_n),address:_n}),SplitCoins:Me({coin:_n,amounts:tt(_n)}),MergeCoins:Me({destination:_n,sources:tt(_n)}),Publish:Me({modules:tt(yo),dependencies:tt(Jr)}),MakeMoveVec:Me({type:$t(yt()),elements:tt(_n)}),Upgrade:Me({modules:tt(yo),dependencies:tt(Jr),package:Jr,ticket:_n}),$Intent:$4}),U4=ea({ImmOrOwnedObject:Li,SharedObject:Me({objectId:Jr,initialSharedVersion:zr,mutable:oc()}),Receiving:Li}),V4=ea({Object:U4,Pure:Me({bytes:yo}),UnresolvedPure:Me({value:go()}),UnresolvedObject:Me({objectId:Jr,version:Pr($t(zr)),digest:Pr($t(yt())),initialSharedVersion:Pr($t(zr))})}),z4=ea({None:at(!0),Epoch:zr}),H4=Me({version:at(2),sender:Jo(Qo),expiration:Jo(z4),gasData:B4,inputs:tt(V4),commands:tt(F4)});function q4(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?gr(e):e.toBase64()}}}const mi={Pure:q4,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:jt(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:jt(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:jt(e)}}}}},xp="…";function W4(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${xp}${e.slice(-4)}`}function G4(e){return`${e.slice(0,10)}${xp}`}const K4=9,Y4=BigInt(1e9),Sp="0x1",ta="0x2",Z4="0x3",Ep=Zr("0x6"),X4="sui_system",ac=`${ta}::sui::SUI`,J4=Zr("0x5");function Dl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Q4(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _p(e,...t){if(!Q4(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cp(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function e8(e,t){_p(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function cc(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}const bo=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function Ap(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const gi=bo?e=>e:e=>Ap(e);function es(e){for(let t=0;t<e.length;t++)e[t]=Ap(e[t])}function t8(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function ra(e){return typeof e=="string"&&(e=t8(e)),_p(e),e}let r8=class{clone(){return this._cloneInto()}};function n8(e){const t=(n,i)=>e(i).update(ra(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const i8=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);class o8 extends r8{constructor(t,r,n={},i,o,s){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,Dl(t),Dl(r),Dl(i),r<0||r>i)throw new Error("outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error("key length must be undefined or 1.."+i);if(n.salt!==void 0&&n.salt.length!==o)throw new Error("salt must be undefined or "+o);if(n.personalization!==void 0&&n.personalization.length!==s)throw new Error("personalization must be undefined or "+s);this.buffer=new Uint8Array(t),this.buffer32=cc(this.buffer)}update(t){Cp(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=ra(t);const o=t.length,s=t.byteOffset,a=t.buffer;for(let c=0;c<o;){this.pos===r&&(bo||es(i),this.compress(i,0,!1),bo||es(i),this.pos=0);const u=Math.min(r-this.pos,o-c),l=s+c;if(u===r&&!(l%4)&&c+u<o){const d=new Uint32Array(a,l,Math.floor((o-c)/4));bo||es(d);for(let p=0;c+r<o;p+=i.length,c+=r)this.length+=r,this.compress(d,p,!1);bo||es(d);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){Cp(this),e8(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),bo||es(n),this.compress(n,0,!0),bo||es(n);const i=cc(t);this.get().forEach((o,s)=>i[s]=gi(o))}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){const{buffer:r,length:n,finished:i,destroyed:o,outputLen:s,pos:a}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=o,t.outputLen=s,t.buffer.set(r),t.pos=a,t}}const uc=BigInt(2**32-1),Bl=BigInt(32);function Mp(e,t=!1){return t?{h:Number(e&uc),l:Number(e>>Bl&uc)}:{h:Number(e>>Bl&uc)|0,l:Number(e&uc)|0}}function s8(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=Mp(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}const a8=(e,t)=>BigInt(e>>>0)<<Bl|BigInt(t>>>0),c8=(e,t,r)=>e>>>r,u8=(e,t,r)=>e<<32-r|t>>>r,l8=(e,t,r)=>e>>>r|t<<32-r,f8=(e,t,r)=>e<<32-r|t>>>r,d8=(e,t,r)=>e<<64-r|t>>>r-32,h8=(e,t,r)=>e>>>r-32|t<<64-r,p8=(e,t)=>t,m8=(e,t)=>e,g8=(e,t,r)=>e<<r|t>>>32-r,v8=(e,t,r)=>t<<r|e>>>32-r,y8=(e,t,r)=>t<<r-32|e>>>64-r,w8=(e,t,r)=>e<<r-32|t>>>64-r;function b8(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const Lr={fromBig:Mp,split:s8,toBig:a8,shrSH:c8,shrSL:u8,rotrSH:l8,rotrSL:f8,rotrBH:d8,rotrBL:h8,rotr32H:p8,rotr32L:m8,rotlSH:g8,rotlSL:v8,rotlBH:y8,rotlBL:w8,add:b8,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},vr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ie=new Uint32Array(32);function $i(e,t,r,n,i,o){const s=i[o],a=i[o+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],d=Ie[2*t+1],p=Ie[2*r],b=Ie[2*r+1],x=Ie[2*n],y=Ie[2*n+1],T=Lr.add3L(c,l,s);u=Lr.add3H(T,u,d,a),c=T|0,{Dh:y,Dl:x}={Dh:y^u,Dl:x^c},{Dh:y,Dl:x}={Dh:Lr.rotr32H(y,x),Dl:Lr.rotr32L(y,x)},{h:b,l:p}=Lr.add(b,p,y,x),{Bh:d,Bl:l}={Bh:d^b,Bl:l^p},{Bh:d,Bl:l}={Bh:Lr.rotrSH(d,l,24),Bl:Lr.rotrSL(d,l,24)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=d,Ie[2*r]=p,Ie[2*r+1]=b,Ie[2*n]=x,Ie[2*n+1]=y}function Fi(e,t,r,n,i,o){const s=i[o],a=i[o+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],d=Ie[2*t+1],p=Ie[2*r],b=Ie[2*r+1],x=Ie[2*n],y=Ie[2*n+1],T=Lr.add3L(c,l,s);u=Lr.add3H(T,u,d,a),c=T|0,{Dh:y,Dl:x}={Dh:y^u,Dl:x^c},{Dh:y,Dl:x}={Dh:Lr.rotrSH(y,x,16),Dl:Lr.rotrSL(y,x,16)},{h:b,l:p}=Lr.add(b,p,y,x),{Bh:d,Bl:l}={Bh:d^b,Bl:l^p},{Bh:d,Bl:l}={Bh:Lr.rotrBH(d,l,63),Bl:Lr.rotrBL(d,l,63)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=d,Ie[2*r]=p,Ie[2*r+1]=b,Ie[2*n]=x,Ie[2*n+1]=y}class x8 extends o8{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=vr[0]|0,this.v0h=vr[1]|0,this.v1l=vr[2]|0,this.v1h=vr[3]|0,this.v2l=vr[4]|0,this.v2h=vr[5]|0,this.v3l=vr[6]|0,this.v3h=vr[7]|0,this.v4l=vr[8]|0,this.v4h=vr[9]|0,this.v5l=vr[10]|0,this.v5h=vr[11]|0,this.v6l=vr[12]|0,this.v6h=vr[13]|0,this.v7l=vr[14]|0,this.v7h=vr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=cc(ra(t.salt));this.v4l^=gi(n[0]),this.v4h^=gi(n[1]),this.v5l^=gi(n[2]),this.v5h^=gi(n[3])}if(t.personalization){const n=cc(ra(t.personalization));this.v6l^=gi(n[0]),this.v6h^=gi(n[1]),this.v7l^=gi(n[2]),this.v7h^=gi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(ra(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:o,v2h:s,v3l:a,v3h:c,v4l:u,v4h:l,v5l:d,v5h:p,v6l:b,v6h:x,v7l:y,v7h:T}=this;return[t,r,n,i,o,s,a,c,u,l,d,p,b,x,y,T]}set(t,r,n,i,o,s,a,c,u,l,d,p,b,x,y,T){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=o|0,this.v2h=s|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=d|0,this.v5h=p|0,this.v6l=b|0,this.v6h=x|0,this.v7l=y|0,this.v7h=T|0}compress(t,r,n){this.get().forEach((c,u)=>Ie[u]=c),Ie.set(vr,16);let{h:i,l:o}=Lr.fromBig(BigInt(this.length));Ie[24]=vr[8]^o,Ie[25]=vr[9]^i,n&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]);let s=0;const a=i8;for(let c=0;c<12;c++)$i(0,4,8,12,t,r+2*a[s++]),Fi(0,4,8,12,t,r+2*a[s++]),$i(1,5,9,13,t,r+2*a[s++]),Fi(1,5,9,13,t,r+2*a[s++]),$i(2,6,10,14,t,r+2*a[s++]),Fi(2,6,10,14,t,r+2*a[s++]),$i(3,7,11,15,t,r+2*a[s++]),Fi(3,7,11,15,t,r+2*a[s++]),$i(0,5,10,15,t,r+2*a[s++]),Fi(0,5,10,15,t,r+2*a[s++]),$i(1,6,11,12,t,r+2*a[s++]),Fi(1,6,11,12,t,r+2*a[s++]),$i(2,7,8,13,t,r+2*a[s++]),Fi(2,7,8,13,t,r+2*a[s++]),$i(3,4,9,14,t,r+2*a[s++]),Fi(3,4,9,14,t,r+2*a[s++]);this.v0l^=Ie[0]^Ie[16],this.v0h^=Ie[1]^Ie[17],this.v1l^=Ie[2]^Ie[18],this.v1h^=Ie[3]^Ie[19],this.v2l^=Ie[4]^Ie[20],this.v2h^=Ie[5]^Ie[21],this.v3l^=Ie[6]^Ie[22],this.v3h^=Ie[7]^Ie[23],this.v4l^=Ie[8]^Ie[24],this.v4h^=Ie[9]^Ie[25],this.v5l^=Ie[10]^Ie[26],this.v5h^=Ie[11]^Ie[27],this.v6l^=Ie[12]^Ie[28],this.v6h^=Ie[13]^Ie[29],this.v7l^=Ie[14]^Ie[30],this.v7h^=Ie[15]^Ie[31],Ie.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Tp=n8(e=>new x8(e));function S8(e,t,r){const n=pt.Address.serialize(e).toBytes(),i=pt.TypeTag.serialize(t).toBytes(),o=pt.u64().serialize(r.length).toBytes(),s=Tp.create({dkLen:32});return s.update(new Uint8Array([240])),s.update(n),s.update(o),s.update(r),s.update(i),`0x${li(s.digest().slice(0,32))}`}const E8=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:Y4,MOVE_STDLIB_ADDRESS:Sp,SUI_ADDRESS_LENGTH:rc,SUI_CLOCK_OBJECT_ID:Ep,SUI_DECIMALS:K4,SUI_FRAMEWORK_ADDRESS:ta,SUI_SYSTEM_ADDRESS:Z4,SUI_SYSTEM_MODULE_NAME:X4,SUI_SYSTEM_STATE_OBJECT_ID:J4,SUI_TYPE_ARG:ac,deriveDynamicFieldID:S8,formatAddress:W4,formatDigest:G4,fromB64:_0,fromBase58:ui,fromBase64:xr,fromHEX:A0,fromHex:Zo,isValidNamedPackage:bl,isValidNamedType:L6,isValidSuiAddress:Vn,isValidSuiNSName:B0,isValidSuiObjectId:Ys,isValidTransactionDigest:xl,normalizeStructTag:F0,normalizeSuiAddress:jt,normalizeSuiNSName:L0,normalizeSuiObjectId:Zr,parseStructTag:Sl,toB64:E0,toBase58:po,toBase64:gr,toHEX:C0,toHex:li},Symbol.toStringTag,{value:"Module"})),_8="object",C8="ID",A8="ascii",M8="String",T8="string",I8="String",O8="option",P8="Option";function R8(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&jt(t.package)===jt("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function Ll(e){if(typeof e=="string")switch(e){case"address":return pt.Address;case"bool":return pt.Bool;case"u8":return pt.U8;case"u16":return pt.U16;case"u32":return pt.U32;case"u64":return pt.U64;case"u128":return pt.U128;case"u256":return pt.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return pt.vector(pt.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=Ll(e.vector);return t?pt.vector(t):null}if("datatype"in e){const t=jt(e.datatype.package);if(t===jt(Sp)){if(e.datatype.module===A8&&e.datatype.type===M8||e.datatype.module===T8&&e.datatype.type===I8)return pt.String;if(e.datatype.module===O8&&e.datatype.type===P8){const r=Ll(e.datatype.typeParameters[0]);return r?pt.vector(r):null}}if(t===jt(ta)&&e.datatype.module===_8&&e.datatype.type===C8)return pt.Address}return null}function N8(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:na(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:na(e.MutableReference)}:{ref:null,body:na(e)}}function na(e){if(typeof e=="string")switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:na(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(na)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}const j8=50,k8=1000n,D8=5e10;async function B8(e,t,r){return await V8(e,t),await U8(e,t),t.onlyTransactionKind||(await L8(e,t),await $8(e,t),await F8(e,t)),await z8(e),await r()}async function L8(e,t){e.gasConfig.price||(e.gasConfig.price=String(await ia(t).getReferenceGasPrice()))}async function $8(e,t){if(e.gasConfig.budget)return;const r=await ia(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(D8),payment:[]}}})});if(r.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const n=k8*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+n,o=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(o>i?o:i)}async function F8(e,t){if(!e.gasConfig.payment){const n=(await ia(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:ac})).data.filter(i=>!e.inputs.find(s=>{var a;return(a=s.Object)!=null&&a.ImmOrOwnedObject?i.coinObjectId===s.Object.ImmOrOwnedObject.objectId:!1})).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!n.length)throw new Error("No valid gas coins found for the transaction.");e.gasConfig.payment=n.map(i=>cr(Li,i))}}async function U8(e,t){const r=e.inputs.filter(l=>{var d;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(d=l.UnresolvedObject)!=null&&d.initialSharedVersion)}),n=[...new Set(r.map(l=>Zr(l.UnresolvedObject.objectId)))],i=n.length?G8(n,j8):[],o=(await Promise.all(i.map(l=>ia(t).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),s=new Map(n.map((l,d)=>[l,o[d]])),a=Array.from(s).filter(([l,d])=>d.error).map(([l,d])=>JSON.stringify(d.error));if(a.length)throw new Error(`The following input objects are invalid: ${a.join(", ")}`);const c=o.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const d=l.data.owner,p=d&&typeof d=="object"&&"Shared"in d?d.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:p}}),u=new Map(n.map((l,d)=>[l,c[d]]));for(const[l,d]of e.inputs.entries()){if(!d.UnresolvedObject)continue;let p;const b=jt(d.UnresolvedObject.objectId),x=u.get(b);d.UnresolvedObject.initialSharedVersion??(x==null?void 0:x.initialSharedVersion)?p=mi.SharedObjectRef({objectId:b,initialSharedVersion:d.UnresolvedObject.initialSharedVersion||(x==null?void 0:x.initialSharedVersion),mutable:H8(e,l)}):q8(e,l)&&(p=mi.ReceivingRef({objectId:b,digest:d.UnresolvedObject.digest??(x==null?void 0:x.digest),version:d.UnresolvedObject.version??(x==null?void 0:x.version)})),e.inputs[e.inputs.indexOf(d)]=p??mi.ObjectRef({objectId:b,digest:d.UnresolvedObject.digest??(x==null?void 0:x.digest),version:d.UnresolvedObject.version??(x==null?void 0:x.version)})}}async function V8(e,t){const{inputs:r,commands:n}=e,i=[],o=new Set;n.forEach(a=>{if(a.MoveCall){if(a.MoveCall._argumentTypes)return;if(a.MoveCall.arguments.map(l=>l.$kind==="Input"?e.inputs[l.Input]:null).some(l=>(l==null?void 0:l.UnresolvedPure)||(l==null?void 0:l.UnresolvedObject))){const l=`${a.MoveCall.package}::${a.MoveCall.module}::${a.MoveCall.function}`;o.add(l),i.push(a.MoveCall)}}switch(a.$kind){case"SplitCoins":a.SplitCoins.amounts.forEach(c=>{Ip(c,pt.U64,e)});break;case"TransferObjects":Ip(a.TransferObjects.address,pt.Address,e);break}});const s=new Map;if(o.size>0){const a=ia(t);await Promise.all([...o].map(async c=>{const[u,l,d]=c.split("::"),p=await a.getNormalizedMoveFunction({package:u,module:l,function:d});s.set(c,p.parameters.map(b=>N8(b)))}))}i.length&&await Promise.all(i.map(async a=>{const c=s.get(`${a.package}::${a.module}::${a.function}`);if(!c)return;const l=c.length>0&&R8(c.at(-1))?c.slice(0,c.length-1):c;a._argumentTypes=l})),n.forEach(a=>{if(!a.MoveCall)return;const c=a.MoveCall,u=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==a.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${u}`);l.forEach((d,p)=>{var N,k;const b=c.arguments[p];if(b.$kind!=="Input")return;const x=r[b.Input];if(!x.UnresolvedPure&&!x.UnresolvedObject)return;const y=((N=x.UnresolvedPure)==null?void 0:N.value)??((k=x.UnresolvedObject)==null?void 0:k.objectId),T=Ll(d.body);if(T){b.type="pure",r[r.indexOf(x)]=mi.Pure(T.serialize(y));return}if(typeof y!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(y,null,2)}`);b.type="object";const O=x.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:y}}:x;r[b.Input]=O})}})}function z8(e){e.inputs.forEach((t,r)=>{if(t.$kind!=="Object"&&t.$kind!=="Pure")throw new Error(`Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(t)}`)})}function Ip(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=mi.Pure(t.serialize(n.UnresolvedPure.value)))}function H8(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const o=i.MoveCall.arguments.indexOf(n);r=i.MoveCall._argumentTypes[o].ref!=="&"||r}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(r=!0)}),r}function q8(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const o=i.MoveCall.arguments.indexOf(n);r=W8(i.MoveCall._argumentTypes[o])||r}}),r}function W8(e){return typeof e.body!="object"||!("datatype"in e.body)?!1:e.body.datatype.package==="0x2"&&e.body.datatype.module==="transfer"&&e.body.datatype.type==="Receiving"}function ia(e){if(!e.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function G8(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}function K8(e){function t(r){return e(r)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t.option=({type:r,value:n})=>i=>i.moveCall({typeArguments:[r],target:`0x1::option::${n===null?"none":"some"}`,arguments:n===null?[]:[i.object(n)]}),t}function Y8(e){function t(r,n){if(typeof r=="string")return e(Zs(r).serialize(n));if(r instanceof Uint8Array||ec(r))return e(r);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=r=>e(pt.U8.serialize(r)),t.u16=r=>e(pt.U16.serialize(r)),t.u32=r=>e(pt.U32.serialize(r)),t.u64=r=>e(pt.U64.serialize(r)),t.u128=r=>e(pt.U128.serialize(r)),t.u256=r=>e(pt.U256.serialize(r)),t.bool=r=>e(pt.Bool.serialize(r)),t.string=r=>e(pt.String.serialize(r)),t.address=r=>e(pt.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(pt.vector(Zs(r)).serialize(n)),t.option=(r,n)=>e(pt.option(Zs(r)).serialize(n)),t}function Z8(e,t){const r=Array.from(`${e}::`).map(i=>i.charCodeAt(0)),n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),Tp(n,{dkLen:32})}function Op(e){return jt(e).replace("0x","")}class Cn{constructor(t){this.version=2,this.sender=(t==null?void 0:t.sender)??null,this.expiration=(t==null?void 0:t.expiration)??null,this.inputs=(t==null?void 0:t.inputs)??[],this.commands=(t==null?void 0:t.commands)??[],this.gasData=(t==null?void 0:t.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(t){const n=pt.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Cn.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:n.inputs,commands:n.commands})}static fromBytes(t){const r=pt.TransactionData.parse(t),n=r==null?void 0:r.V1,i=n.kind.ProgrammableTransaction;if(!n||!i)throw new Error("Unable to deserialize from bytes.");return Cn.restore({version:2,sender:n.sender,expiration:n.expiration,gasData:n.gasData,inputs:i.inputs,commands:i.commands})}static restore(t){return t.version===2?new Cn(cr(sc,t)):new Cn(cr(sc,D4(t)))}static getDigestFromBytes(t){const r=Z8("TransactionData",t);return po(r)}get gasConfig(){return this.gasData}set gasConfig(t){this.gasData=t}build({maxSizeBytes:t=1/0,overrides:r,onlyTransactionKind:n}={}){const i=this.inputs,o=this.commands,s={ProgrammableTransaction:{inputs:i,commands:o}};if(n)return pt.TransactionKind.serialize(s,{maxSize:t}).toBytes();const a=(r==null?void 0:r.expiration)??this.expiration,c=(r==null?void 0:r.sender)??this.sender,u={...this.gasData,...r==null?void 0:r.gasConfig,...r==null?void 0:r.gasData};if(!c)throw new Error("Missing transaction sender");if(!u.budget)throw new Error("Missing gas budget");if(!u.payment)throw new Error("Missing gas payment");if(!u.price)throw new Error("Missing gas price");const l={sender:Op(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:Op(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:o}}};return pt.TransactionData.serialize({V1:l},{maxSize:t}).toBytes()}addInput(t,r){const n=this.inputs.length;return this.inputs.push(r),{Input:n,type:t,$kind:"Input"}}getInputUses(t,r){this.mapArguments((n,i)=>(n.$kind==="Input"&&n.Input===t&&r(n,i),n))}mapArguments(t){for(const r of this.commands)switch(r.$kind){case"MoveCall":r.MoveCall.arguments=r.MoveCall.arguments.map(i=>t(i,r));break;case"TransferObjects":r.TransferObjects.objects=r.TransferObjects.objects.map(i=>t(i,r)),r.TransferObjects.address=t(r.TransferObjects.address,r);break;case"SplitCoins":r.SplitCoins.coin=t(r.SplitCoins.coin,r),r.SplitCoins.amounts=r.SplitCoins.amounts.map(i=>t(i,r));break;case"MergeCoins":r.MergeCoins.destination=t(r.MergeCoins.destination,r),r.MergeCoins.sources=r.MergeCoins.sources.map(i=>t(i,r));break;case"MakeMoveVec":r.MakeMoveVec.elements=r.MakeMoveVec.elements.map(i=>t(i,r));break;case"Upgrade":r.Upgrade.ticket=t(r.Upgrade.ticket,r);break;case"$Intent":const n=r.$Intent.inputs;r.$Intent.inputs={};for(const[i,o]of Object.entries(n))r.$Intent.inputs[i]=Array.isArray(o)?o.map(s=>t(s,r)):t(o,r);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${r.$kind}`)}}replaceCommand(t,r){if(!Array.isArray(r)){this.commands[t]=r;return}const n=r.length-1;this.commands.splice(t,1,...r),n!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>t&&(i.Result+=n);break;case"NestedResult":i.NestedResult[0]>t&&(i.NestedResult[0]+=n);break}return i})}getDigest(){const t=this.build({onlyTransactionKind:!1});return Cn.getDigestFromBytes(t)}snapshot(){return cr(sc,this)}}function Pp(e){if(typeof e=="string")return jt(e);if(e.Object)return e.Object.ImmOrOwnedObject?jt(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?jt(e.Object.Receiving.objectId):jt(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return jt(e.UnresolvedObject.objectId)}var Rp=e=>{throw TypeError(e)},$l=(e,t,r)=>t.has(e)||Rp("Cannot "+r),Ct=(e,t,r)=>($l(e,t,"read from private field"),r?r.call(e):t.get(e)),oa=(e,t,r)=>t.has(e)?Rp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xo=(e,t,r,n)=>($l(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),vi=(e,t,r)=>($l(e,t,"access private method"),r),sa,aa,So,Tt,An,lc,Fl,Ul,Vl;function Np(e,t=1/0){const r={$kind:"Result",Result:e},n=[],i=o=>n[o]??(n[o]={$kind:"NestedResult",NestedResult:[e,o]});return new Proxy(r,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(o,s){if(s in o)return Reflect.get(o,s);if(s===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield i(c),c++};if(typeof s=="symbol")return;const a=parseInt(s,10);if(!(Number.isNaN(a)||a<0))return i(a)}})}const jp=Symbol.for("@mysten/transaction");function kp(e){return!!e&&typeof e=="object"&&e[jp]===!0}const Dp={buildPlugins:new Map,serializationPlugins:new Map},zl=Symbol.for("@mysten/transaction/registry");function ca(){try{const e=globalThis;return e[zl]||(e[zl]=Dp),e[zl]}catch{return Dp}}const X8=class Qh{constructor(){oa(this,An),oa(this,sa),oa(this,aa),oa(this,So,new Map),oa(this,Tt),this.object=K8(r=>{var o,s;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&Ol(nr,r))return r;const n=Pp(r),i=Ct(this,Tt).inputs.find(a=>n===Pp(a));return(o=i==null?void 0:i.Object)!=null&&o.SharedObject&&typeof r=="object"&&((s=r.Object)!=null&&s.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,Tt).inputs.indexOf(i),type:"object"}:Ct(this,Tt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:jt(r)}}:r)});const t=ca();xo(this,Tt,new Cn),xo(this,aa,[...t.buildPlugins.values()]),xo(this,sa,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Qh;return xo(r,Tt,Cn.fromKindBytes(typeof t=="string"?xr(t):t)),r}static from(t){const r=new Qh;return kp(t)?xo(r,Tt,new Cn(t.getData())):typeof t!="string"||!t.startsWith("{")?xo(r,Tt,Cn.fromBytes(typeof t=="string"?xr(t):t)):xo(r,Tt,Cn.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){ca().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){ca().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){ca().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){ca().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,sa).push(t)}addBuildPlugin(t){Ct(this,aa).push(t)}addIntentResolver(t,r){if(Ct(this,So).has(t)&&Ct(this,So).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,So).set(t,r)}setSender(t){Ct(this,Tt).sender=t}setSenderIfNotSet(t){Ct(this,Tt).sender||(Ct(this,Tt).sender=t)}setExpiration(t){Ct(this,Tt).expiration=t?cr(gp,t):null}setGasPrice(t){Ct(this,Tt).gasConfig.price=String(t)}setGasBudget(t){Ct(this,Tt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,Tt).gasData.budget==null&&(Ct(this,Tt).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,Tt).gasConfig.owner=t}setGasPayment(t){Ct(this,Tt).gasConfig.payment=t.map(r=>cr(Li,r))}get blockData(){return bp(Ct(this,Tt).snapshot())}getData(){return Ct(this,Tt).snapshot()}get[jp](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:Y8(t=>ec(t)?Ct(this,Tt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Tt).addInput("pure",Ol(mp,t)?cr(mp,t):t instanceof Uint8Array?mi.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(mi.ObjectRef(...t))}receivingRef(...t){return this.object(mi.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(mi.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Tt).commands.push(t);return Np(r-1)}splitCoins(t,r){const n=wo.SplitCoins(typeof t=="string"?this.object(t):vi(this,An,Fl).call(this,t),r.map(o=>typeof o=="number"||typeof o=="bigint"||typeof o=="string"?this.pure.u64(o):vi(this,An,lc).call(this,o))),i=Ct(this,Tt).commands.push(n);return Np(i-1,r.length)}mergeCoins(t,r){return this.add(wo.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(wo.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(wo.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(wo.MoveCall({...r,arguments:t==null?void 0:t.map(n=>vi(this,An,lc).call(this,n))}))}transferObjects(t,r){return this.add(wo.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):vi(this,An,lc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(wo.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify(bp(Ct(this,Tt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify(cr(H4,Ct(this,Tt).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await vi(this,An,Ul).call(this,t),Ct(this,Tt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await vi(this,An,Ul).call(this,t),Ct(this,Tt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const o of Ct(this,Tt).commands)o.$Intent&&r.add(o.$Intent.name);const n=[...Ct(this,sa)];for(const o of r)if(!((i=t.supportedIntents)!=null&&i.includes(o))){if(!Ct(this,So).has(o))throw new Error(`Missing intent resolver for ${o}`);n.push(Ct(this,So).get(o))}await vi(this,An,Vl).call(this,n,t)}};sa=new WeakMap,aa=new WeakMap,So=new WeakMap,Tt=new WeakMap,An=new WeakSet,lc=function(e){return ec(e)?this.pure(e):vi(this,An,Fl).call(this,e)},Fl=function(e){return typeof e=="function"?cr(nr,e(this)):cr(nr,e)},Ul=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Tt).sender)throw new Error("Missing transaction sender");await vi(this,An,Vl).call(this,[...Ct(this,aa),B8],e)},Vl=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const o=r(n+1);let s=!1,a=!1;if(await i(Ct(this,Tt),t,async()=>{if(s)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);s=!0,await o(),a=!0}),!s)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let Eo=X8;class J8 extends j0{constructor(){super(...arguments),this.core=this}}class Q8 extends Error{}class Ui extends Q8{constructor(t,r){super(r),this.code=t}static fromResponse(t,r){switch(t.code){case"notExists":return new Ui(t.code,`Object ${t.object_id} does not exist`);case"dynamicFieldNotFound":return new Ui(t.code,`Dynamic field not found for object ${t.parent_object_id}`);case"deleted":return new Ui(t.code,`Object ${t.object_id} has been deleted`);case"displayError":return new Ui(t.code,`Display error: ${t.error}`);case"unknown":default:return new Ui(t.code,`Unknown error while loading object${r?` ${r}`:""}`)}}}var Bp=e=>{throw TypeError(e)},Lp=(e,t,r)=>t.has(e)||Bp("Cannot "+r),yi=(e,t,r)=>(Lp(e,t,"read from private field"),r?r.call(e):t.get(e)),ex=(e,t,r)=>t.has(e)?Bp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),tx=(e,t,r,n)=>(Lp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),an;class rx extends J8{constructor(t){super({network:t.network}),ex(this,an),tx(this,an,t)}async getObjects(t){const r=l4(t.objectIds,50),n=[];for(const i of r){const o=await yi(this,an).multiGetObjects({ids:i,options:{showOwner:!0,showType:!0}});for(const[s,a]of o.entries())a.error?n.push(Ui.fromResponse(a.error,i[s])):n.push($p(a.data))}return{objects:n}}async getOwnedObjects(t){const r=await yi(this,an).getOwnedObjects({owner:t.address,limit:t.limit,cursor:t.cursor});return{objects:r.data.map(n=>{if(n.error)throw Ui.fromResponse(n.error);return $p(n.data)}),hasNextPage:r.hasNextPage,cursor:r.nextCursor??null}}async getCoins(t){const r=await yi(this,an).getCoins({owner:t.address,coinType:t.coinType});return{objects:r.data.map(n=>({id:n.coinObjectId,version:n.version,digest:n.digest,balance:BigInt(n.balance),type:`0x2::coin::Coin<${n.coinType}>`,content:ox.serialize({id:n.coinObjectId,balance:{value:n.balance}}).toBytes(),owner:{$kind:"ObjectOwner",ObjectOwner:t.address}})),hasNextPage:r.hasNextPage,cursor:r.nextCursor??null}}async getBalance(t){const r=await yi(this,an).getBalance({owner:t.address,coinType:t.coinType});return{balance:{coinType:r.coinType,balance:BigInt(r.totalBalance)}}}async getAllBalances(t){return{balances:(await yi(this,an).getAllBalances({owner:t.address})).map(n=>({coinType:n.coinType,balance:BigInt(n.totalBalance)})),hasNextPage:!1,cursor:null}}async getTransaction(t){const r=await yi(this,an).getTransactionBlock({digest:t.digest,options:{showRawInput:!0,showObjectChanges:!0,showRawEffects:!0,showEvents:!0}});return{transaction:Fp(r)}}async executeTransaction(t){const r=await yi(this,an).executeTransactionBlock({transactionBlock:t.transaction,signature:t.signatures,options:{showEffects:!0,showEvents:!0}});return{transaction:Fp(r)}}async dryRunTransaction(t){const r=Eo.from(t.transaction),n=await yi(this,an).dryRunTransactionBlock({transactionBlock:t.transaction});return{transaction:{digest:await r.getDigest(),effects:n.effects,signatures:[],bcs:t.transaction}}}async getReferenceGasPrice(){return{referenceGasPrice:await yi(this,an).getReferenceGasPrice()}}}an=new WeakMap;function $p(e){var t;return{id:e.objectId,version:e.version,digest:e.digest,type:e.type,content:((t=e.bcs)==null?void 0:t.dataType)==="moveObject"?xr(e.bcs.bcsBytes):new Uint8Array,owner:nx(e.owner)}}function nx(e){if(e==="Immutable")return{$kind:"Immutable",Immutable:!0};if("ConsensusV2"in e)return{$kind:"ConsensusV2",ConsensusV2Owner:{authenticator:{$kind:"SingleOwner",SingleOwner:e.ConsensusV2.authenticator.SingleOwner},startVersion:e.ConsensusV2.start_version}};if("AddressOwner"in e)return{$kind:"AddressOwner",AddressOwner:e.AddressOwner};if("ObjectOwner"in e)return{$kind:"ObjectOwner",ObjectOwner:e.ObjectOwner};if("Shared"in e)return{$kind:"Shared",Shared:{initialSharedVersion:e.Shared.initial_shared_version}};throw new Error(`Unknown owner type: ${JSON.stringify(e)}`)}function Fp(e){const t=pt.SenderSignedData.parse(xr(e.rawTransaction))[0];return{digest:e.digest,effects:new Uint8Array(e.rawEffects),bcs:pt.TransactionData.serialize(t.intentMessage.value).toBytes(),signatures:t.txSignatures}}const ix=pt.struct("Balance",{value:pt.u64()}),ox=pt.struct("Coin",{id:pt.Address,balance:ix}),sx=Symbol.for("@mysten/SuiClient");class ts extends j0{constructor(t){super({network:t.network??"unknown"}),this.core=new rx(this),this.transport=t.transport??new y6({url:t.url})}get[sx](){return!0}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[t.owner,t.coinType,t.cursor,t.limit]})}async getAllCoins(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[t.owner,t.cursor,t.limit]})}async getBalance(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[t.owner,t.coinType]})}async getAllBalances(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[t.owner]})}async getCoinMetadata(t){return await this.transport.request({method:"suix_getCoinMetadata",params:[t.coinType]})}async getTotalSupply(t){return await this.transport.request({method:"suix_getTotalSupply",params:[t.coinType]})}async call(t,r){return await this.transport.request({method:t,params:r})}async getMoveFunctionArgTypes(t){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[t.package,t.module,t.function]})}async getNormalizedMoveModulesByPackage(t){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[t.package]})}async getNormalizedMoveModule(t){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[t.package,t.module]})}async getNormalizedMoveFunction(t){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[t.package,t.module,t.function]})}async getNormalizedMoveStruct(t){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[t.package,t.module,t.struct]})}async getOwnedObjects(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[t.owner,{filter:t.filter,options:t.options},t.cursor,t.limit]})}async getObject(t){if(!t.id||!Ys(Zr(t.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[t.id,t.options]})}async tryGetPastObject(t){return await this.transport.request({method:"sui_tryGetPastObject",params:[t.id,t.version,t.options]})}async multiGetObjects(t){if(t.ids.forEach(n=>{if(!n||!Ys(Zr(n)))throw new Error(`Invalid Sui Object id ${n}`)}),t.ids.length!==new Set(t.ids).size)throw new Error(`Duplicate object ids in batch call ${t.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[t.ids,t.options]})}async queryTransactionBlocks(t){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:t.filter,options:t.options},t.cursor,t.limit,(t.order||"descending")==="descending"]})}async getTransactionBlock(t){if(!xl(t.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[t.digest,t.options]})}async multiGetTransactionBlocks(t){if(t.digests.forEach(n=>{if(!xl(n))throw new Error(`Invalid Transaction digest ${n}`)}),t.digests.length!==new Set(t.digests).size)throw new Error(`Duplicate digests in batch call ${t.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[t.digests,t.options]})}async executeTransactionBlock({transactionBlock:t,signature:r,options:n,requestType:i}){const o=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof t=="string"?t:gr(t),Array.isArray(r)?r:[r],n]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:o.digest})}catch{}return o}async signAndExecuteTransaction({transaction:t,signer:r,...n}){let i;t instanceof Uint8Array?i=t:(t.setSenderIfNotSet(r.toSuiAddress()),i=await t.build({client:this}));const{signature:o,bytes:s}=await r.signTransaction(i);return this.executeTransactionBlock({transactionBlock:s,signature:o,...n})}async getTotalTransactionBlocks(){const t=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(t)}async getReferenceGasPrice(){const t=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(t)}async getStakes(t){if(!t.owner||!Vn(jt(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[t.owner]})}async getStakesByIds(t){return t.stakedSuiIds.forEach(r=>{if(!r||!Ys(Zr(r)))throw new Error(`Invalid Sui Stake id ${r}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[t.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(t){return await this.transport.request({method:"suix_queryEvents",params:[t.query,t.cursor,t.limit,(t.order||"descending")==="descending"]})}async subscribeEvent(t){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[t.filter],onMessage:t.onMessage})}async subscribeTransaction(t){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[t.filter],onMessage:t.onMessage})}async devInspectTransactionBlock(t){var n;let r;if(kp(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=gr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=gr(t.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[t.sender,r,(n=t.gasPrice)==null?void 0:n.toString(),t.epoch]})}async dryRunTransactionBlock(t){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof t.transactionBlock=="string"?t.transactionBlock:gr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Ys(Zr(t.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[t.parentId,t.cursor,t.limit]})}async getDynamicFieldObject(t){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[t.parentId,t.name]})}async getLatestCheckpointSequenceNumber(){const t=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(t)}async getCheckpoint(t){return await this.transport.request({method:"sui_getCheckpoint",params:[t.id]})}async getCheckpoints(t){return await this.transport.request({method:"sui_getCheckpoints",params:[t.cursor,t==null?void 0:t.limit,t.descendingOrder]})}async getCommitteeInfo(t){return await this.transport.request({method:"suix_getCommitteeInfo",params:[t==null?void 0:t.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(t){return await this.transport.request({method:"suix_getEpochMetrics",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getAllEpochAddressMetrics(t){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[t==null?void 0:t.descendingOrder]})}async getEpochs(t){return await this.transport.request({method:"suix_getEpochs",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const t=await this.getCheckpoint({id:"0"}),r=ui(t.digest);return li(r.slice(0,4))}async resolveNameServiceAddress(t){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[t.name]})}async resolveNameServiceNames({format:t="dot",...r}){const{nextCursor:n,hasNextPage:i,data:o}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[r.address,r.cursor,r.limit]});return{hasNextPage:i,nextCursor:n,data:o.map(s=>L0(s,t))}}async getProtocolConfig(t){return await this.transport.request({method:"sui_getProtocolConfig",params:[t==null?void 0:t.version]})}async waitForTransaction({signal:t,timeout:r=60*1e3,pollInterval:n=2*1e3,...i}){const o=AbortSignal.timeout(r),s=new Promise((a,c)=>{o.addEventListener("abort",()=>c(o.reason))});for(s.catch(()=>{});!o.aborted;){t==null||t.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),s])}}throw o.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}experimental_asClientExtension(){return{name:"jsonRPC",register:()=>this}}}var Hl={},fc={},ql={},dc={},Wl={},hc={};Object.defineProperty(hc,"__esModule",{value:!0}),hc.Convert=void 0;class ax{static toPriceFeed(t){return Gl(t,bi("PriceFeed"))}static priceFeedToJson(t){return Kl(t,bi("PriceFeed"))}static toPrice(t){return Gl(t,bi("Price"))}static priceToJson(t){return Kl(t,bi("Price"))}static toPriceFeedMetadata(t){return Gl(t,bi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return Kl(t,bi("PriceFeedMetadata"))}}hc.Convert=ax;function wi(e,t,r=""){throw Error(r?`Invalid value for key "${r}". Expected type ${JSON.stringify(e)} but got ${JSON.stringify(t)}`:`Invalid value ${JSON.stringify(t)} for type ${JSON.stringify(e)}`)}function cx(e){if(e.jsonToJS===void 0){const t={};e.props.forEach(r=>t[r.json]={key:r.js,typ:r.typ}),e.jsonToJS=t}return e.jsonToJS}function ux(e){if(e.jsToJSON===void 0){const t={};e.props.forEach(r=>t[r.js]={key:r.json,typ:r.typ}),e.jsToJSON=t}return e.jsToJSON}function rs(e,t,r,n=""){function i(l,d){return typeof l==typeof d?d:wi(l,d,n)}function o(l,d){const p=l.length;for(let b=0;b<p;b++){const x=l[b];try{return rs(d,x,r)}catch{}}return wi(l,d)}function s(l,d){return l.indexOf(d)!==-1?d:wi(l,d)}function a(l,d){return Array.isArray(d)?d.map(p=>rs(p,l,r)):wi("array",d)}function c(l){if(l===null)return null;const d=new Date(l);return isNaN(d.valueOf())?wi("Date",l):d}function u(l,d,p){if(p===null||typeof p!="object"||Array.isArray(p))return wi("object",p);const b={};return Object.getOwnPropertyNames(l).forEach(x=>{const y=l[x],T=Object.prototype.hasOwnProperty.call(p,x)?p[x]:void 0;b[y.key]=rs(T,y.typ,r,y.key)}),Object.getOwnPropertyNames(p).forEach(x=>{Object.prototype.hasOwnProperty.call(l,x)||(b[x]=rs(p[x],d,r,x))}),b}if(t==="any")return e;if(t===null)return e===null?e:wi(t,e);if(t===!1)return wi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=lx[t.ref];return Array.isArray(t)?s(t,e):typeof t=="object"?t.hasOwnProperty("unionMembers")?o(t.unionMembers,e):t.hasOwnProperty("arrayItems")?a(t.arrayItems,e):t.hasOwnProperty("props")?u(r(t),t.additional,e):wi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function Gl(e,t){return rs(e,t,cx)}function Kl(e,t){return rs(e,t,ux)}function _o(...e){return{unionMembers:e}}function Yl(e,t){return{props:e,additional:t}}function bi(e){return{ref:e}}const lx={PriceFeed:Yl([{json:"ema_price",js:"ema_price",typ:bi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:_o(void 0,bi("PriceFeedMetadata"))},{json:"price",js:"price",typ:bi("Price")},{json:"vaa",js:"vaa",typ:_o(void 0,"")}],"any"),Price:Yl([{json:"conf",js:"conf",typ:""},{json:"expo",js:"expo",typ:0},{json:"price",js:"price",typ:""},{json:"publish_time",js:"publish_time",typ:0}],"any"),PriceFeedMetadata:Yl([{json:"attestation_time",js:"attestation_time",typ:_o(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:_o(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:_o(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:_o(void 0,0)},{json:"slot",js:"slot",typ:_o(void 0,0)}],"any")};var ua={};(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=l,r.toByteArray=p,r.fromByteArray=y;for(var n=[],i=[],o=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function u(N){var k=N.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=N.indexOf("=");F===-1&&(F=k);var L=F===k?0:4-F%4;return[F,L]}function l(N){var k=u(N),F=k[0],L=k[1];return(F+L)*3/4-L}function d(N,k,F){return(k+F)*3/4-F}function p(N){var k,F=u(N),L=F[0],W=F[1],z=new o(d(N,L,W)),G=0,re=W>0?L-4:L,oe;for(oe=0;oe<re;oe+=4)k=i[N.charCodeAt(oe)]<<18|i[N.charCodeAt(oe+1)]<<12|i[N.charCodeAt(oe+2)]<<6|i[N.charCodeAt(oe+3)],z[G++]=k>>16&255,z[G++]=k>>8&255,z[G++]=k&255;return W===2&&(k=i[N.charCodeAt(oe)]<<2|i[N.charCodeAt(oe+1)]>>4,z[G++]=k&255),W===1&&(k=i[N.charCodeAt(oe)]<<10|i[N.charCodeAt(oe+1)]<<4|i[N.charCodeAt(oe+2)]>>2,z[G++]=k>>8&255,z[G++]=k&255),z}function b(N){return n[N>>18&63]+n[N>>12&63]+n[N>>6&63]+n[N&63]}function x(N,k,F){for(var L,W=[],z=k;z<F;z+=3)L=(N[z]<<16&16711680)+(N[z+1]<<8&65280)+(N[z+2]&255),W.push(b(L));return W.join("")}function y(N){for(var k,F=N.length,L=F%3,W=[],z=16383,G=0,re=F-L;G<re;G+=z)W.push(x(N,G,G+z>re?re:G+z));return L===1?(k=N[F-1],W.push(n[k>>2]+n[k<<4&63]+"==")):L===2&&(k=(N[F-2]<<8)+N[F-1],W.push(n[k>>10]+n[k>>4&63]+n[k<<2&63]+"=")),W.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(N,k,F,L,W){var z,G,re=W*8-L-1,oe=(1<<re)-1,ae=oe>>1,H=-7,D=F?W-1:0,h=F?-1:1,f=N[k+D];for(D+=h,z=f&(1<<-H)-1,f>>=-H,H+=re;H>0;z=z*256+N[k+D],D+=h,H-=8);for(G=z&(1<<-H)-1,z>>=-H,H+=L;H>0;G=G*256+N[k+D],D+=h,H-=8);if(z===0)z=1-ae;else{if(z===oe)return G?NaN:(f?-1:1)*(1/0);G=G+Math.pow(2,L),z=z-ae}return(f?-1:1)*G*Math.pow(2,z-L)},T.write=function(N,k,F,L,W,z){var G,re,oe,ae=z*8-W-1,H=(1<<ae)-1,D=H>>1,h=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=L?0:z-1,m=L?1:-1,S=k<0||k===0&&1/k<0?1:0;for(k=Math.abs(k),isNaN(k)||k===1/0?(re=isNaN(k)?1:0,G=H):(G=Math.floor(Math.log(k)/Math.LN2),k*(oe=Math.pow(2,-G))<1&&(G--,oe*=2),G+D>=1?k+=h/oe:k+=h*Math.pow(2,1-D),k*oe>=2&&(G++,oe/=2),G+D>=H?(re=0,G=H):G+D>=1?(re=(k*oe-1)*Math.pow(2,W),G=G+D):(re=k*Math.pow(2,D-1)*Math.pow(2,W),G=0));W>=8;N[F+f]=re&255,f+=m,re/=256,W-=8);for(G=G<<W|re,ae+=W;ae>0;N[F+f]=G&255,f+=m,G/=256,ae-=8);N[F+f-m]|=S*128};/*!
25
25
  * The buffer module from node.js, for the browser.
26
26
  *
27
27
  * @author Feross Aboukhadijeh <https://feross.org>
28
28
  * @license MIT
29
- */(function(R){const k=r,F=T,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=z,R.SlowBuffer=v,R.INSPECT_MAX_BYTES=50;const q=2147483647;R.kMaxLength=q;const{Uint8Array:H,ArrayBuffer:K,SharedArrayBuffer:re}=globalThis;z.TYPED_ARRAY_SUPPORT=oe(),!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oe(){try{const j=new H(1),E={foo:function(){return 42}};return Object.setPrototypeOf(E,H.prototype),Object.setPrototypeOf(j,E),j.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}}),Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function ae(j){if(j>q)throw new RangeError('The value "'+j+'" is invalid for option "size"');const E=new H(j);return Object.setPrototypeOf(E,z.prototype),E}function z(j,E,A){if(typeof j=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(j)}return D(j,E,A)}z.poolSize=8192;function D(j,E,A){if(typeof j=="string")return S(j,E);if(K.isView(j))return _(j);if(j==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j);if(gt(j,K)||j&&gt(j.buffer,K)||typeof re<"u"&&(gt(j,re)||j&&gt(j.buffer,re)))return I(j,E,A);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=j.valueOf&&j.valueOf();if($!=null&&$!==j)return z.from($,E,A);const Y=C(j);if(Y)return Y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return z.from(j[Symbol.toPrimitive]("string"),E,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}z.from=function(j,E,A){return D(j,E,A)},Object.setPrototypeOf(z.prototype,H.prototype),Object.setPrototypeOf(z,H);function h(j){if(typeof j!="number")throw new TypeError('"size" argument must be of type number');if(j<0)throw new RangeError('The value "'+j+'" is invalid for option "size"')}function f(j,E,A){return h(j),j<=0?ae(j):E!==void 0?typeof A=="string"?ae(j).fill(E,A):ae(j).fill(E):ae(j)}z.alloc=function(j,E,A){return f(j,E,A)};function m(j){return h(j),ae(j<0?0:g(j)|0)}z.allocUnsafe=function(j){return m(j)},z.allocUnsafeSlow=function(j){return m(j)};function S(j,E){if((typeof E!="string"||E==="")&&(E="utf8"),!z.isEncoding(E))throw new TypeError("Unknown encoding: "+E);const A=N(j,E)|0;let $=ae(A);const Y=$.write(j,E);return Y!==A&&($=$.slice(0,Y)),$}function M(j){const E=j.length<0?0:g(j.length)|0,A=ae(E);for(let $=0;$<E;$+=1)A[$]=j[$]&255;return A}function _(j){if(gt(j,H)){const E=new H(j);return I(E.buffer,E.byteOffset,E.byteLength)}return M(j)}function I(j,E,A){if(E<0||j.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<E+(A||0))throw new RangeError('"length" is outside of buffer bounds');let $;return E===void 0&&A===void 0?$=new H(j):A===void 0?$=new H(j,E):$=new H(j,E,A),Object.setPrototypeOf($,z.prototype),$}function C(j){if(z.isBuffer(j)){const E=g(j.length)|0,A=ae(E);return A.length===0||j.copy(A,0,0,E),A}if(j.length!==void 0)return typeof j.length!="number"||Rt(j.length)?ae(0):M(j);if(j.type==="Buffer"&&Array.isArray(j.data))return M(j.data)}function g(j){if(j>=q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+q.toString(16)+" bytes");return j|0}function v(j){return+j!=j&&(j=0),z.alloc(+j)}z.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==z.prototype},z.compare=function(E,A){if(gt(E,H)&&(E=z.from(E,E.offset,E.byteLength)),gt(A,H)&&(A=z.from(A,A.offset,A.byteLength)),!z.isBuffer(E)||!z.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===A)return 0;let $=E.length,Y=A.length;for(let J=0,ne=Math.min($,Y);J<ne;++J)if(E[J]!==A[J]){$=E[J],Y=A[J];break}return $<Y?-1:Y<$?1:0},z.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},z.concat=function(E,A){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return z.alloc(0);let $;if(A===void 0)for(A=0,$=0;$<E.length;++$)A+=E[$].length;const Y=z.allocUnsafe(A);let J=0;for($=0;$<E.length;++$){let ne=E[$];if(gt(ne,H))J+ne.length>Y.length?(z.isBuffer(ne)||(ne=z.from(ne)),ne.copy(Y,J)):H.prototype.set.call(Y,ne,J);else if(z.isBuffer(ne))ne.copy(Y,J);else throw new TypeError('"list" argument must be an Array of Buffers');J+=ne.length}return Y};function N(j,E){if(z.isBuffer(j))return j.length;if(K.isView(j)||gt(j,K))return j.byteLength;if(typeof j!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof j);const A=j.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&A===0)return 0;let Y=!1;for(;;)switch(E){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return Pt(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return Mt(j).length;default:if(Y)return $?-1:Pt(j).length;E=(""+E).toLowerCase(),Y=!0}}z.byteLength=N;function ee(j,E,A){let $=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,E>>>=0,A<=E))return"";for(j||(j="utf8");;)switch(j){case"hex":return Ue(this,E,A);case"utf8":case"utf-8":return je(this,E,A);case"ascii":return he(this,E,A);case"latin1":case"binary":return Ce(this,E,A);case"base64":return dt(this,E,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ne(this,E,A);default:if($)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),$=!0}}z.prototype._isBuffer=!0;function ie(j,E,A){const $=j[E];j[E]=j[A],j[A]=$}z.prototype.swap16=function(){const E=this.length;if(E%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let A=0;A<E;A+=2)ie(this,A,A+1);return this},z.prototype.swap32=function(){const E=this.length;if(E%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let A=0;A<E;A+=4)ie(this,A,A+3),ie(this,A+1,A+2);return this},z.prototype.swap64=function(){const E=this.length;if(E%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let A=0;A<E;A+=8)ie(this,A,A+7),ie(this,A+1,A+6),ie(this,A+2,A+5),ie(this,A+3,A+4);return this},z.prototype.toString=function(){const E=this.length;return E===0?"":arguments.length===0?je(this,0,E):ee.apply(this,arguments)},z.prototype.toLocaleString=z.prototype.toString,z.prototype.equals=function(E){if(!z.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E?!0:z.compare(this,E)===0},z.prototype.inspect=function(){let E="";const A=R.INSPECT_MAX_BYTES;return E=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(E+=" ... "),"<Buffer "+E+">"},L&&(z.prototype[L]=z.prototype.inspect),z.prototype.compare=function(E,A,$,Y,J){if(gt(E,H)&&(E=z.from(E,E.offset,E.byteLength)),!z.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(A===void 0&&(A=0),$===void 0&&($=E?E.length:0),Y===void 0&&(Y=0),J===void 0&&(J=this.length),A<0||$>E.length||Y<0||J>this.length)throw new RangeError("out of range index");if(Y>=J&&A>=$)return 0;if(Y>=J)return-1;if(A>=$)return 1;if(A>>>=0,$>>>=0,Y>>>=0,J>>>=0,this===E)return 0;let ne=J-Y,ke=$-A;const Je=Math.min(ne,ke),Re=this.slice(Y,J),V=E.slice(A,$);for(let se=0;se<Je;++se)if(Re[se]!==V[se]){ne=Re[se],ke=V[se];break}return ne<ke?-1:ke<ne?1:0};function le(j,E,A,$,Y){if(j.length===0)return-1;if(typeof A=="string"?($=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Rt(A)&&(A=Y?0:j.length-1),A<0&&(A=j.length+A),A>=j.length){if(Y)return-1;A=j.length-1}else if(A<0)if(Y)A=0;else return-1;if(typeof E=="string"&&(E=z.from(E,$)),z.isBuffer(E))return E.length===0?-1:me(j,E,A,$,Y);if(typeof E=="number")return E=E&255,typeof H.prototype.indexOf=="function"?Y?H.prototype.indexOf.call(j,E,A):H.prototype.lastIndexOf.call(j,E,A):me(j,[E],A,$,Y);throw new TypeError("val must be string, number or Buffer")}function me(j,E,A,$,Y){let J=1,ne=j.length,ke=E.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(j.length<2||E.length<2)return-1;J=2,ne/=2,ke/=2,A/=2}function Je(V,se){return J===1?V[se]:V.readUInt16BE(se*J)}let Re;if(Y){let V=-1;for(Re=A;Re<ne;Re++)if(Je(j,Re)===Je(E,V===-1?0:Re-V)){if(V===-1&&(V=Re),Re-V+1===ke)return V*J}else V!==-1&&(Re-=Re-V),V=-1}else for(A+ke>ne&&(A=ne-ke),Re=A;Re>=0;Re--){let V=!0;for(let se=0;se<ke;se++)if(Je(j,Re+se)!==Je(E,se)){V=!1;break}if(V)return Re}return-1}z.prototype.includes=function(E,A,$){return this.indexOf(E,A,$)!==-1},z.prototype.indexOf=function(E,A,$){return le(this,E,A,$,!0)},z.prototype.lastIndexOf=function(E,A,$){return le(this,E,A,$,!1)};function xe(j,E,A,$){A=Number(A)||0;const Y=j.length-A;$?($=Number($),$>Y&&($=Y)):$=Y;const J=E.length;$>J/2&&($=J/2);let ne;for(ne=0;ne<$;++ne){const ke=parseInt(E.substr(ne*2,2),16);if(Rt(ke))return ne;j[A+ne]=ke}return ne}function be(j,E,A,$){return Ge(Pt(E,j.length-A),j,A,$)}function Ve(j,E,A,$){return Ge(et(E),j,A,$)}function Le(j,E,A,$){return Ge(Mt(E),j,A,$)}function ft(j,E,A,$){return Ge(xt(E,j.length-A),j,A,$)}z.prototype.write=function(E,A,$,Y){if(A===void 0)Y="utf8",$=this.length,A=0;else if($===void 0&&typeof A=="string")Y=A,$=this.length,A=0;else if(isFinite(A))A=A>>>0,isFinite($)?($=$>>>0,Y===void 0&&(Y="utf8")):(Y=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const J=this.length-A;if(($===void 0||$>J)&&($=J),E.length>0&&($<0||A<0)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");let ne=!1;for(;;)switch(Y){case"hex":return xe(this,E,A,$);case"utf8":case"utf-8":return be(this,E,A,$);case"ascii":case"latin1":case"binary":return Ve(this,E,A,$);case"base64":return Le(this,E,A,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ft(this,E,A,$);default:if(ne)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),ne=!0}},z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(j,E,A){return E===0&&A===j.length?k.fromByteArray(j):k.fromByteArray(j.slice(E,A))}function je(j,E,A){A=Math.min(j.length,A);const $=[];let Y=E;for(;Y<A;){const J=j[Y];let ne=null,ke=J>239?4:J>223?3:J>191?2:1;if(Y+ke<=A){let Je,Re,V,se;switch(ke){case 1:J<128&&(ne=J);break;case 2:Je=j[Y+1],(Je&192)===128&&(se=(J&31)<<6|Je&63,se>127&&(ne=se));break;case 3:Je=j[Y+1],Re=j[Y+2],(Je&192)===128&&(Re&192)===128&&(se=(J&15)<<12|(Je&63)<<6|Re&63,se>2047&&(se<55296||se>57343)&&(ne=se));break;case 4:Je=j[Y+1],Re=j[Y+2],V=j[Y+3],(Je&192)===128&&(Re&192)===128&&(V&192)===128&&(se=(J&15)<<18|(Je&63)<<12|(Re&63)<<6|V&63,se>65535&&se<1114112&&(ne=se))}}ne===null?(ne=65533,ke=1):ne>65535&&(ne-=65536,$.push(ne>>>10&1023|55296),ne=56320|ne&1023),$.push(ne),Y+=ke}return we($)}const mt=4096;function we(j){const E=j.length;if(E<=mt)return String.fromCharCode.apply(String,j);let A="",$=0;for(;$<E;)A+=String.fromCharCode.apply(String,j.slice($,$+=mt));return A}function he(j,E,A){let $="";A=Math.min(j.length,A);for(let Y=E;Y<A;++Y)$+=String.fromCharCode(j[Y]&127);return $}function Ce(j,E,A){let $="";A=Math.min(j.length,A);for(let Y=E;Y<A;++Y)$+=String.fromCharCode(j[Y]);return $}function Ue(j,E,A){const $=j.length;(!E||E<0)&&(E=0),(!A||A<0||A>$)&&(A=$);let Y="";for(let J=E;J<A;++J)Y+=nt[j[J]];return Y}function Ne(j,E,A){const $=j.slice(E,A);let Y="";for(let J=0;J<$.length-1;J+=2)Y+=String.fromCharCode($[J]+$[J+1]*256);return Y}z.prototype.slice=function(E,A){const $=this.length;E=~~E,A=A===void 0?$:~~A,E<0?(E+=$,E<0&&(E=0)):E>$&&(E=$),A<0?(A+=$,A<0&&(A=0)):A>$&&(A=$),A<E&&(A=E);const Y=this.subarray(E,A);return Object.setPrototypeOf(Y,z.prototype),Y};function Me(j,E,A){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+E>A)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(E,A,$){E=E>>>0,A=A>>>0,$||Me(E,A,this.length);let Y=this[E],J=1,ne=0;for(;++ne<A&&(J*=256);)Y+=this[E+ne]*J;return Y},z.prototype.readUintBE=z.prototype.readUIntBE=function(E,A,$){E=E>>>0,A=A>>>0,$||Me(E,A,this.length);let Y=this[E+--A],J=1;for(;A>0&&(J*=256);)Y+=this[E+--A]*J;return Y},z.prototype.readUint8=z.prototype.readUInt8=function(E,A){return E=E>>>0,A||Me(E,1,this.length),this[E]},z.prototype.readUint16LE=z.prototype.readUInt16LE=function(E,A){return E=E>>>0,A||Me(E,2,this.length),this[E]|this[E+1]<<8},z.prototype.readUint16BE=z.prototype.readUInt16BE=function(E,A){return E=E>>>0,A||Me(E,2,this.length),this[E]<<8|this[E+1]},z.prototype.readUint32LE=z.prototype.readUInt32LE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+this[E+3]*16777216},z.prototype.readUint32BE=z.prototype.readUInt32BE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),this[E]*16777216+(this[E+1]<<16|this[E+2]<<8|this[E+3])},z.prototype.readBigUInt64LE=St(function(E){E=E>>>0,_t(E,"offset");const A=this[E],$=this[E+7];(A===void 0||$===void 0)&&Ot(E,this.length-8);const Y=A+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24,J=this[++E]+this[++E]*2**8+this[++E]*2**16+$*2**24;return BigInt(Y)+(BigInt(J)<<BigInt(32))}),z.prototype.readBigUInt64BE=St(function(E){E=E>>>0,_t(E,"offset");const A=this[E],$=this[E+7];(A===void 0||$===void 0)&&Ot(E,this.length-8);const Y=A*2**24+this[++E]*2**16+this[++E]*2**8+this[++E],J=this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+$;return(BigInt(Y)<<BigInt(32))+BigInt(J)}),z.prototype.readIntLE=function(E,A,$){E=E>>>0,A=A>>>0,$||Me(E,A,this.length);let Y=this[E],J=1,ne=0;for(;++ne<A&&(J*=256);)Y+=this[E+ne]*J;return J*=128,Y>=J&&(Y-=Math.pow(2,8*A)),Y},z.prototype.readIntBE=function(E,A,$){E=E>>>0,A=A>>>0,$||Me(E,A,this.length);let Y=A,J=1,ne=this[E+--Y];for(;Y>0&&(J*=256);)ne+=this[E+--Y]*J;return J*=128,ne>=J&&(ne-=Math.pow(2,8*A)),ne},z.prototype.readInt8=function(E,A){return E=E>>>0,A||Me(E,1,this.length),this[E]&128?(255-this[E]+1)*-1:this[E]},z.prototype.readInt16LE=function(E,A){E=E>>>0,A||Me(E,2,this.length);const $=this[E]|this[E+1]<<8;return $&32768?$|4294901760:$},z.prototype.readInt16BE=function(E,A){E=E>>>0,A||Me(E,2,this.length);const $=this[E+1]|this[E]<<8;return $&32768?$|4294901760:$},z.prototype.readInt32LE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},z.prototype.readInt32BE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},z.prototype.readBigInt64LE=St(function(E){E=E>>>0,_t(E,"offset");const A=this[E],$=this[E+7];(A===void 0||$===void 0)&&Ot(E,this.length-8);const Y=this[E+4]+this[E+5]*2**8+this[E+6]*2**16+($<<24);return(BigInt(Y)<<BigInt(32))+BigInt(A+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24)}),z.prototype.readBigInt64BE=St(function(E){E=E>>>0,_t(E,"offset");const A=this[E],$=this[E+7];(A===void 0||$===void 0)&&Ot(E,this.length-8);const Y=(A<<24)+this[++E]*2**16+this[++E]*2**8+this[++E];return(BigInt(Y)<<BigInt(32))+BigInt(this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+$)}),z.prototype.readFloatLE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),F.read(this,E,!0,23,4)},z.prototype.readFloatBE=function(E,A){return E=E>>>0,A||Me(E,4,this.length),F.read(this,E,!1,23,4)},z.prototype.readDoubleLE=function(E,A){return E=E>>>0,A||Me(E,8,this.length),F.read(this,E,!0,52,8)},z.prototype.readDoubleBE=function(E,A){return E=E>>>0,A||Me(E,8,this.length),F.read(this,E,!1,52,8)};function Te(j,E,A,$,Y,J){if(!z.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>Y||E<J)throw new RangeError('"value" argument is out of bounds');if(A+$>j.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(E,A,$,Y){if(E=+E,A=A>>>0,$=$>>>0,!Y){const ke=Math.pow(2,8*$)-1;Te(this,E,A,$,ke,0)}let J=1,ne=0;for(this[A]=E&255;++ne<$&&(J*=256);)this[A+ne]=E/J&255;return A+$},z.prototype.writeUintBE=z.prototype.writeUIntBE=function(E,A,$,Y){if(E=+E,A=A>>>0,$=$>>>0,!Y){const ke=Math.pow(2,8*$)-1;Te(this,E,A,$,ke,0)}let J=$-1,ne=1;for(this[A+J]=E&255;--J>=0&&(ne*=256);)this[A+J]=E/ne&255;return A+$},z.prototype.writeUint8=z.prototype.writeUInt8=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,1,255,0),this[A]=E&255,A+1},z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,2,65535,0),this[A]=E&255,this[A+1]=E>>>8,A+2},z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,2,65535,0),this[A]=E>>>8,this[A+1]=E&255,A+2},z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,4,4294967295,0),this[A+3]=E>>>24,this[A+2]=E>>>16,this[A+1]=E>>>8,this[A]=E&255,A+4},z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,4,4294967295,0),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=E&255,A+4};function Be(j,E,A,$,Y){Qe(E,$,Y,j,A,7);let J=Number(E&BigInt(4294967295));j[A++]=J,J=J>>8,j[A++]=J,J=J>>8,j[A++]=J,J=J>>8,j[A++]=J;let ne=Number(E>>BigInt(32)&BigInt(4294967295));return j[A++]=ne,ne=ne>>8,j[A++]=ne,ne=ne>>8,j[A++]=ne,ne=ne>>8,j[A++]=ne,A}function ut(j,E,A,$,Y){Qe(E,$,Y,j,A,7);let J=Number(E&BigInt(4294967295));j[A+7]=J,J=J>>8,j[A+6]=J,J=J>>8,j[A+5]=J,J=J>>8,j[A+4]=J;let ne=Number(E>>BigInt(32)&BigInt(4294967295));return j[A+3]=ne,ne=ne>>8,j[A+2]=ne,ne=ne>>8,j[A+1]=ne,ne=ne>>8,j[A]=ne,A+8}z.prototype.writeBigUInt64LE=St(function(E,A=0){return Be(this,E,A,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeBigUInt64BE=St(function(E,A=0){return ut(this,E,A,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeIntLE=function(E,A,$,Y){if(E=+E,A=A>>>0,!Y){const Je=Math.pow(2,8*$-1);Te(this,E,A,$,Je-1,-Je)}let J=0,ne=1,ke=0;for(this[A]=E&255;++J<$&&(ne*=256);)E<0&&ke===0&&this[A+J-1]!==0&&(ke=1),this[A+J]=(E/ne>>0)-ke&255;return A+$},z.prototype.writeIntBE=function(E,A,$,Y){if(E=+E,A=A>>>0,!Y){const Je=Math.pow(2,8*$-1);Te(this,E,A,$,Je-1,-Je)}let J=$-1,ne=1,ke=0;for(this[A+J]=E&255;--J>=0&&(ne*=256);)E<0&&ke===0&&this[A+J+1]!==0&&(ke=1),this[A+J]=(E/ne>>0)-ke&255;return A+$},z.prototype.writeInt8=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,1,127,-128),E<0&&(E=255+E+1),this[A]=E&255,A+1},z.prototype.writeInt16LE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,2,32767,-32768),this[A]=E&255,this[A+1]=E>>>8,A+2},z.prototype.writeInt16BE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,2,32767,-32768),this[A]=E>>>8,this[A+1]=E&255,A+2},z.prototype.writeInt32LE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,4,2147483647,-2147483648),this[A]=E&255,this[A+1]=E>>>8,this[A+2]=E>>>16,this[A+3]=E>>>24,A+4},z.prototype.writeInt32BE=function(E,A,$){return E=+E,A=A>>>0,$||Te(this,E,A,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=E&255,A+4},z.prototype.writeBigInt64LE=St(function(E,A=0){return Be(this,E,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),z.prototype.writeBigInt64BE=St(function(E,A=0){return ut(this,E,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(j,E,A,$,Y,J){if(A+$>j.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function ze(j,E,A,$,Y){return E=+E,A=A>>>0,Y||lt(j,E,A,4),F.write(j,E,A,$,23,4),A+4}z.prototype.writeFloatLE=function(E,A,$){return ze(this,E,A,!0,$)},z.prototype.writeFloatBE=function(E,A,$){return ze(this,E,A,!1,$)};function jt(j,E,A,$,Y){return E=+E,A=A>>>0,Y||lt(j,E,A,8),F.write(j,E,A,$,52,8),A+8}z.prototype.writeDoubleLE=function(E,A,$){return jt(this,E,A,!0,$)},z.prototype.writeDoubleBE=function(E,A,$){return jt(this,E,A,!1,$)},z.prototype.copy=function(E,A,$,Y){if(!z.isBuffer(E))throw new TypeError("argument should be a Buffer");if($||($=0),!Y&&Y!==0&&(Y=this.length),A>=E.length&&(A=E.length),A||(A=0),Y>0&&Y<$&&(Y=$),Y===$||E.length===0||this.length===0)return 0;if(A<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(Y<0)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),E.length-A<Y-$&&(Y=E.length-A+$);const J=Y-$;return this===E&&typeof H.prototype.copyWithin=="function"?this.copyWithin(A,$,Y):H.prototype.set.call(E,this.subarray($,Y),A),J},z.prototype.fill=function(E,A,$,Y){if(typeof E=="string"){if(typeof A=="string"?(Y=A,A=0,$=this.length):typeof $=="string"&&(Y=$,$=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!z.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(E.length===1){const ne=E.charCodeAt(0);(Y==="utf8"&&ne<128||Y==="latin1")&&(E=ne)}}else typeof E=="number"?E=E&255:typeof E=="boolean"&&(E=Number(E));if(A<0||this.length<A||this.length<$)throw new RangeError("Out of range index");if($<=A)return this;A=A>>>0,$=$===void 0?this.length:$>>>0,E||(E=0);let J;if(typeof E=="number")for(J=A;J<$;++J)this[J]=E;else{const ne=z.isBuffer(E)?E:z.from(E,Y),ke=ne.length;if(ke===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(J=0;J<$-A;++J)this[J+A]=ne[J%ke]}return this};const Et={};function Ze(j,E,A){Et[j]=class extends A{constructor(){super(),Object.defineProperty(this,"message",{value:E.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${j}]`,this.stack,delete this.name}get code(){return j}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}Ze("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ze("ERR_INVALID_ARG_TYPE",function(j,E){return`The "${j}" argument must be of type number. Received type ${typeof E}`},TypeError),Ze("ERR_OUT_OF_RANGE",function(j,E,A){let $=`The value of "${j}" is out of range.`,Y=A;return Number.isInteger(A)&&Math.abs(A)>2**32?Y=It(String(A)):typeof A=="bigint"&&(Y=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(Y=It(Y)),Y+="n"),$+=` It must be ${E}. Received ${Y}`,$},RangeError);function It(j){let E="",A=j.length;const $=j[0]==="-"?1:0;for(;A>=$+4;A-=3)E=`_${j.slice(A-3,A)}${E}`;return`${j.slice(0,A)}${E}`}function Ft(j,E,A){_t(E,"offset"),(j[E]===void 0||j[E+A]===void 0)&&Ot(E,j.length-(A+1))}function Qe(j,E,A,$,Y,J){if(j>A||j<E){const ne=typeof E=="bigint"?"n":"";let ke;throw J>3?E===0||E===BigInt(0)?ke=`>= 0${ne} and < 2${ne} ** ${(J+1)*8}${ne}`:ke=`>= -(2${ne} ** ${(J+1)*8-1}${ne}) and < 2 ** ${(J+1)*8-1}${ne}`:ke=`>= ${E}${ne} and <= ${A}${ne}`,new Et.ERR_OUT_OF_RANGE("value",ke,j)}Ft($,Y,J)}function _t(j,E){if(typeof j!="number")throw new Et.ERR_INVALID_ARG_TYPE(E,"number",j)}function Ot(j,E,A){throw Math.floor(j)!==j?(_t(j,A),new Et.ERR_OUT_OF_RANGE(A||"offset","an integer",j)):E<0?new Et.ERR_BUFFER_OUT_OF_BOUNDS:new Et.ERR_OUT_OF_RANGE(A||"offset",`>= ${A?1:0} and <= ${E}`,j)}const rt=/[^+/0-9A-Za-z-_]/g;function kt(j){if(j=j.split("=")[0],j=j.trim().replace(rt,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function Pt(j,E){E=E||1/0;let A;const $=j.length;let Y=null;const J=[];for(let ne=0;ne<$;++ne){if(A=j.charCodeAt(ne),A>55295&&A<57344){if(!Y){if(A>56319){(E-=3)>-1&&J.push(239,191,189);continue}else if(ne+1===$){(E-=3)>-1&&J.push(239,191,189);continue}Y=A;continue}if(A<56320){(E-=3)>-1&&J.push(239,191,189),Y=A;continue}A=(Y-55296<<10|A-56320)+65536}else Y&&(E-=3)>-1&&J.push(239,191,189);if(Y=null,A<128){if((E-=1)<0)break;J.push(A)}else if(A<2048){if((E-=2)<0)break;J.push(A>>6|192,A&63|128)}else if(A<65536){if((E-=3)<0)break;J.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((E-=4)<0)break;J.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return J}function et(j){const E=[];for(let A=0;A<j.length;++A)E.push(j.charCodeAt(A)&255);return E}function xt(j,E){let A,$,Y;const J=[];for(let ne=0;ne<j.length&&!((E-=2)<0);++ne)A=j.charCodeAt(ne),$=A>>8,Y=A%256,J.push(Y),J.push($);return J}function Mt(j){return k.toByteArray(kt(j))}function Ge(j,E,A,$){let Y;for(Y=0;Y<$&&!(Y+A>=E.length||Y>=j.length);++Y)E[Y+A]=j[Y];return Y}function gt(j,E){return j instanceof E||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===E.name}function Rt(j){return j!==j}const nt=function(){const j="0123456789abcdef",E=new Array(256);for(let A=0;A<16;++A){const $=A*16;for(let Y=0;Y<16;++Y)E[$+Y]=j[A]+j[Y]}return E}();function St(j){return typeof BigInt>"u"?zt:j}function zt(){throw new Error("BigInt not supported")}})(t);const O=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=O,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(Vl)),Vl}var T8=cc();const zl=Bs(T8);var on={},Hl={exports:{}};Hl.exports,function(e){(function(t,r){function n(D,h){if(!D)throw new Error(h||"Assertion failed")}function i(D,h){D.super_=h;var f=function(){};f.prototype=h.prototype,D.prototype=new f,D.prototype.constructor=D}function o(D,h,f){if(o.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((h==="le"||h==="be")&&(f=h,h=10),this._init(D||0,h||10,f||"be"))}typeof t=="object"?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=cc().Buffer}catch{}o.isBN=function(h){return h instanceof o?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===o.wordSize&&Array.isArray(h.words)},o.max=function(h,f){return h.cmp(f)>0?h:f},o.min=function(h,f){return h.cmp(f)<0?h:f},o.prototype._init=function(h,f,m){if(typeof h=="number")return this._initNumber(h,f,m);if(typeof h=="object")return this._initArray(h,f,m);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),h=h.toString().replace(/\s+/g,"");var S=0;h[0]==="-"&&(S++,this.negative=1),S<h.length&&(f===16?this._parseHex(h,S,m):(this._parseBase(h,f,S),m==="le"&&this._initArray(this.toArray(),f,m)))},o.prototype._initNumber=function(h,f,m){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(n(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),f,m)},o.prototype._initArray=function(h,f,m){if(n(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var M,_,I=0;if(m==="be")for(S=h.length-1,M=0;S>=0;S-=3)_=h[S]|h[S-1]<<8|h[S-2]<<16,this.words[M]|=_<<I&67108863,this.words[M+1]=_>>>26-I&67108863,I+=24,I>=26&&(I-=26,M++);else if(m==="le")for(S=0,M=0;S<h.length;S+=3)_=h[S]|h[S+1]<<8|h[S+2]<<16,this.words[M]|=_<<I&67108863,this.words[M+1]=_>>>26-I&67108863,I+=24,I>=26&&(I-=26,M++);return this._strip()};function a(D,h){var f=D.charCodeAt(h);if(f>=48&&f<=57)return f-48;if(f>=65&&f<=70)return f-55;if(f>=97&&f<=102)return f-87;n(!1,"Invalid character in "+D)}function c(D,h,f){var m=a(D,f);return f-1>=h&&(m|=a(D,f-1)<<4),m}o.prototype._parseHex=function(h,f,m){this.length=Math.ceil((h.length-f)/6),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var M=0,_=0,I;if(m==="be")for(S=h.length-1;S>=f;S-=2)I=c(h,f,S)<<M,this.words[_]|=I&67108863,M>=18?(M-=18,_+=1,this.words[_]|=I>>>26):M+=8;else{var C=h.length-f;for(S=C%2===0?f+1:f;S<h.length;S+=2)I=c(h,f,S)<<M,this.words[_]|=I&67108863,M>=18?(M-=18,_+=1,this.words[_]|=I>>>26):M+=8}this._strip()};function u(D,h,f,m){for(var S=0,M=0,_=Math.min(D.length,f),I=h;I<_;I++){var C=D.charCodeAt(I)-48;S*=m,C>=49?M=C-49+10:C>=17?M=C-17+10:M=C,n(C>=0&&M<m,"Invalid character"),S+=M}return S}o.prototype._parseBase=function(h,f,m){this.words=[0],this.length=1;for(var S=0,M=1;M<=67108863;M*=f)S++;S--,M=M/f|0;for(var _=h.length-m,I=_%S,C=Math.min(_,_-I)+m,g=0,v=m;v<C;v+=S)g=u(h,v,v+S,f),this.imuln(M),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(I!==0){var N=1;for(g=u(h,v,h.length,f),v=0;v<I;v++)N*=f;this.imuln(N),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},o.prototype.copy=function(h){h.words=new Array(this.length);for(var f=0;f<this.length;f++)h.words[f]=this.words[f];h.length=this.length,h.negative=this.negative,h.red=this.red};function l(D,h){D.words=h.words,D.length=h.length,D.negative=h.negative,D.red=h.red}if(o.prototype._move=function(h){l(h,this)},o.prototype.clone=function(){var h=new o(null);return this.copy(h),h},o.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(h,f){h=h||10,f=f|0||1;var m;if(h===16||h==="hex"){m="";for(var S=0,M=0,_=0;_<this.length;_++){var I=this.words[_],C=((I<<S|M)&16777215).toString(16);M=I>>>24-S&16777215,S+=2,S>=26&&(S-=26,_--),M!==0||_!==this.length-1?m=p[6-C.length]+C+m:m=C+m}for(M!==0&&(m=M.toString(16)+m);m.length%f!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(h===(h|0)&&h>=2&&h<=36){var g=w[h],v=b[h];m="";var N=this.clone();for(N.negative=0;!N.isZero();){var ee=N.modrn(v).toString(h);N=N.idivn(v),N.isZero()?m=ee+m:m=p[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%f!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(h,f){return this.toArrayLike(s,h,f)}),o.prototype.toArray=function(h,f){return this.toArrayLike(Array,h,f)};var y=function(h,f){return h.allocUnsafe?h.allocUnsafe(f):new h(f)};o.prototype.toArrayLike=function(h,f,m){this._strip();var S=this.byteLength(),M=m||Math.max(1,S);n(S<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var _=y(h,M),I=f==="le"?"LE":"BE";return this["_toArrayLike"+I](_,S),_},o.prototype._toArrayLikeLE=function(h,f){for(var m=0,S=0,M=0,_=0;M<this.length;M++){var I=this.words[M]<<_|S;h[m++]=I&255,m<h.length&&(h[m++]=I>>8&255),m<h.length&&(h[m++]=I>>16&255),_===6?(m<h.length&&(h[m++]=I>>24&255),S=0,_=0):(S=I>>>24,_+=2)}if(m<h.length)for(h[m++]=S;m<h.length;)h[m++]=0},o.prototype._toArrayLikeBE=function(h,f){for(var m=h.length-1,S=0,M=0,_=0;M<this.length;M++){var I=this.words[M]<<_|S;h[m--]=I&255,m>=0&&(h[m--]=I>>8&255),m>=0&&(h[m--]=I>>16&255),_===6?(m>=0&&(h[m--]=I>>24&255),S=0,_=0):(S=I>>>24,_+=2)}if(m>=0)for(h[m--]=S;m>=0;)h[m--]=0},Math.clz32?o.prototype._countBits=function(h){return 32-Math.clz32(h)}:o.prototype._countBits=function(h){var f=h,m=0;return f>=4096&&(m+=13,f>>>=13),f>=64&&(m+=7,f>>>=7),f>=8&&(m+=4,f>>>=4),f>=2&&(m+=2,f>>>=2),m+f},o.prototype._zeroBits=function(h){if(h===0)return 26;var f=h,m=0;return f&8191||(m+=13,f>>>=13),f&127||(m+=7,f>>>=7),f&15||(m+=4,f>>>=4),f&3||(m+=2,f>>>=2),f&1||m++,m},o.prototype.bitLength=function(){var h=this.words[this.length-1],f=this._countBits(h);return(this.length-1)*26+f};function T(D){for(var h=new Array(D.bitLength()),f=0;f<h.length;f++){var m=f/26|0,S=f%26;h[f]=D.words[m]>>>S&1}return h}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,f=0;f<this.length;f++){var m=this._zeroBits(this.words[f]);if(h+=m,m!==26)break}return h},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},o.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var f=0;f<h.length;f++)this.words[f]=this.words[f]|h.words[f];return this._strip()},o.prototype.ior=function(h){return n((this.negative|h.negative)===0),this.iuor(h)},o.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},o.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},o.prototype.iuand=function(h){var f;this.length>h.length?f=h:f=this;for(var m=0;m<f.length;m++)this.words[m]=this.words[m]&h.words[m];return this.length=f.length,this._strip()},o.prototype.iand=function(h){return n((this.negative|h.negative)===0),this.iuand(h)},o.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},o.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},o.prototype.iuxor=function(h){var f,m;this.length>h.length?(f=this,m=h):(f=h,m=this);for(var S=0;S<m.length;S++)this.words[S]=f.words[S]^m.words[S];if(this!==f)for(;S<f.length;S++)this.words[S]=f.words[S];return this.length=f.length,this._strip()},o.prototype.ixor=function(h){return n((this.negative|h.negative)===0),this.iuxor(h)},o.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},o.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},o.prototype.inotn=function(h){n(typeof h=="number"&&h>=0);var f=Math.ceil(h/26)|0,m=h%26;this._expand(f),m>0&&f--;for(var S=0;S<f;S++)this.words[S]=~this.words[S]&67108863;return m>0&&(this.words[S]=~this.words[S]&67108863>>26-m),this._strip()},o.prototype.notn=function(h){return this.clone().inotn(h)},o.prototype.setn=function(h,f){n(typeof h=="number"&&h>=0);var m=h/26|0,S=h%26;return this._expand(m+1),f?this.words[m]=this.words[m]|1<<S:this.words[m]=this.words[m]&~(1<<S),this._strip()},o.prototype.iadd=function(h){var f;if(this.negative!==0&&h.negative===0)return this.negative=0,f=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,f=this.isub(h),h.negative=1,f._normSign();var m,S;this.length>h.length?(m=this,S=h):(m=h,S=this);for(var M=0,_=0;_<S.length;_++)f=(m.words[_]|0)+(S.words[_]|0)+M,this.words[_]=f&67108863,M=f>>>26;for(;M!==0&&_<m.length;_++)f=(m.words[_]|0)+M,this.words[_]=f&67108863,M=f>>>26;if(this.length=m.length,M!==0)this.words[this.length]=M,this.length++;else if(m!==this)for(;_<m.length;_++)this.words[_]=m.words[_];return this},o.prototype.add=function(h){var f;return h.negative!==0&&this.negative===0?(h.negative=0,f=this.sub(h),h.negative^=1,f):h.negative===0&&this.negative!==0?(this.negative=0,f=h.sub(this),this.negative=1,f):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},o.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var f=this.iadd(h);return h.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var m=this.cmp(h);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var S,M;m>0?(S=this,M=h):(S=h,M=this);for(var _=0,I=0;I<M.length;I++)f=(S.words[I]|0)-(M.words[I]|0)+_,_=f>>26,this.words[I]=f&67108863;for(;_!==0&&I<S.length;I++)f=(S.words[I]|0)+_,_=f>>26,this.words[I]=f&67108863;if(_===0&&I<S.length&&S!==this)for(;I<S.length;I++)this.words[I]=S.words[I];return this.length=Math.max(this.length,I),S!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(h){return this.clone().isub(h)};function O(D,h,f){f.negative=h.negative^D.negative;var m=D.length+h.length|0;f.length=m,m=m-1|0;var S=D.words[0]|0,M=h.words[0]|0,_=S*M,I=_&67108863,C=_/67108864|0;f.words[0]=I;for(var g=1;g<m;g++){for(var v=C>>>26,N=C&67108863,ee=Math.min(g,h.length-1),ie=Math.max(0,g-D.length+1);ie<=ee;ie++){var le=g-ie|0;S=D.words[le]|0,M=h.words[ie]|0,_=S*M+N,v+=_/67108864|0,N=_&67108863}f.words[g]=N|0,C=v|0}return C!==0?f.words[g]=C|0:f.length--,f._strip()}var R=function(h,f,m){var S=h.words,M=f.words,_=m.words,I=0,C,g,v,N=S[0]|0,ee=N&8191,ie=N>>>13,le=S[1]|0,me=le&8191,xe=le>>>13,be=S[2]|0,Ve=be&8191,Le=be>>>13,ft=S[3]|0,dt=ft&8191,je=ft>>>13,mt=S[4]|0,we=mt&8191,he=mt>>>13,Ce=S[5]|0,Ue=Ce&8191,Ne=Ce>>>13,Me=S[6]|0,Te=Me&8191,Be=Me>>>13,ut=S[7]|0,lt=ut&8191,ze=ut>>>13,jt=S[8]|0,Et=jt&8191,Ze=jt>>>13,It=S[9]|0,Ft=It&8191,Qe=It>>>13,_t=M[0]|0,Ot=_t&8191,rt=_t>>>13,kt=M[1]|0,Pt=kt&8191,et=kt>>>13,xt=M[2]|0,Mt=xt&8191,Ge=xt>>>13,gt=M[3]|0,Rt=gt&8191,nt=gt>>>13,St=M[4]|0,zt=St&8191,j=St>>>13,E=M[5]|0,A=E&8191,$=E>>>13,Y=M[6]|0,J=Y&8191,ne=Y>>>13,ke=M[7]|0,Je=ke&8191,Re=ke>>>13,V=M[8]|0,se=V&8191,fe=V>>>13,Oe=M[9]|0,He=Oe&8191,Pe=Oe>>>13;m.negative=h.negative^f.negative,m.length=19,C=Math.imul(ee,Ot),g=Math.imul(ee,rt),g=g+Math.imul(ie,Ot)|0,v=Math.imul(ie,rt);var $e=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+($e>>>26)|0,$e&=67108863,C=Math.imul(me,Ot),g=Math.imul(me,rt),g=g+Math.imul(xe,Ot)|0,v=Math.imul(xe,rt),C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,et)|0,g=g+Math.imul(ie,Pt)|0,v=v+Math.imul(ie,et)|0;var at=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(at>>>26)|0,at&=67108863,C=Math.imul(Ve,Ot),g=Math.imul(Ve,rt),g=g+Math.imul(Le,Ot)|0,v=Math.imul(Le,rt),C=C+Math.imul(me,Pt)|0,g=g+Math.imul(me,et)|0,g=g+Math.imul(xe,Pt)|0,v=v+Math.imul(xe,et)|0,C=C+Math.imul(ee,Mt)|0,g=g+Math.imul(ee,Ge)|0,g=g+Math.imul(ie,Mt)|0,v=v+Math.imul(ie,Ge)|0;var Qt=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,C=Math.imul(dt,Ot),g=Math.imul(dt,rt),g=g+Math.imul(je,Ot)|0,v=Math.imul(je,rt),C=C+Math.imul(Ve,Pt)|0,g=g+Math.imul(Ve,et)|0,g=g+Math.imul(Le,Pt)|0,v=v+Math.imul(Le,et)|0,C=C+Math.imul(me,Mt)|0,g=g+Math.imul(me,Ge)|0,g=g+Math.imul(xe,Mt)|0,v=v+Math.imul(xe,Ge)|0,C=C+Math.imul(ee,Rt)|0,g=g+Math.imul(ee,nt)|0,g=g+Math.imul(ie,Rt)|0,v=v+Math.imul(ie,nt)|0;var Dt=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,C=Math.imul(we,Ot),g=Math.imul(we,rt),g=g+Math.imul(he,Ot)|0,v=Math.imul(he,rt),C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,et)|0,g=g+Math.imul(je,Pt)|0,v=v+Math.imul(je,et)|0,C=C+Math.imul(Ve,Mt)|0,g=g+Math.imul(Ve,Ge)|0,g=g+Math.imul(Le,Mt)|0,v=v+Math.imul(Le,Ge)|0,C=C+Math.imul(me,Rt)|0,g=g+Math.imul(me,nt)|0,g=g+Math.imul(xe,Rt)|0,v=v+Math.imul(xe,nt)|0,C=C+Math.imul(ee,zt)|0,g=g+Math.imul(ee,j)|0,g=g+Math.imul(ie,zt)|0,v=v+Math.imul(ie,j)|0;var Ut=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,C=Math.imul(Ue,Ot),g=Math.imul(Ue,rt),g=g+Math.imul(Ne,Ot)|0,v=Math.imul(Ne,rt),C=C+Math.imul(we,Pt)|0,g=g+Math.imul(we,et)|0,g=g+Math.imul(he,Pt)|0,v=v+Math.imul(he,et)|0,C=C+Math.imul(dt,Mt)|0,g=g+Math.imul(dt,Ge)|0,g=g+Math.imul(je,Mt)|0,v=v+Math.imul(je,Ge)|0,C=C+Math.imul(Ve,Rt)|0,g=g+Math.imul(Ve,nt)|0,g=g+Math.imul(Le,Rt)|0,v=v+Math.imul(Le,nt)|0,C=C+Math.imul(me,zt)|0,g=g+Math.imul(me,j)|0,g=g+Math.imul(xe,zt)|0,v=v+Math.imul(xe,j)|0,C=C+Math.imul(ee,A)|0,g=g+Math.imul(ee,$)|0,g=g+Math.imul(ie,A)|0,v=v+Math.imul(ie,$)|0;var ur=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(ur>>>26)|0,ur&=67108863,C=Math.imul(Te,Ot),g=Math.imul(Te,rt),g=g+Math.imul(Be,Ot)|0,v=Math.imul(Be,rt),C=C+Math.imul(Ue,Pt)|0,g=g+Math.imul(Ue,et)|0,g=g+Math.imul(Ne,Pt)|0,v=v+Math.imul(Ne,et)|0,C=C+Math.imul(we,Mt)|0,g=g+Math.imul(we,Ge)|0,g=g+Math.imul(he,Mt)|0,v=v+Math.imul(he,Ge)|0,C=C+Math.imul(dt,Rt)|0,g=g+Math.imul(dt,nt)|0,g=g+Math.imul(je,Rt)|0,v=v+Math.imul(je,nt)|0,C=C+Math.imul(Ve,zt)|0,g=g+Math.imul(Ve,j)|0,g=g+Math.imul(Le,zt)|0,v=v+Math.imul(Le,j)|0,C=C+Math.imul(me,A)|0,g=g+Math.imul(me,$)|0,g=g+Math.imul(xe,A)|0,v=v+Math.imul(xe,$)|0,C=C+Math.imul(ee,J)|0,g=g+Math.imul(ee,ne)|0,g=g+Math.imul(ie,J)|0,v=v+Math.imul(ie,ne)|0;var Ar=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,C=Math.imul(lt,Ot),g=Math.imul(lt,rt),g=g+Math.imul(ze,Ot)|0,v=Math.imul(ze,rt),C=C+Math.imul(Te,Pt)|0,g=g+Math.imul(Te,et)|0,g=g+Math.imul(Be,Pt)|0,v=v+Math.imul(Be,et)|0,C=C+Math.imul(Ue,Mt)|0,g=g+Math.imul(Ue,Ge)|0,g=g+Math.imul(Ne,Mt)|0,v=v+Math.imul(Ne,Ge)|0,C=C+Math.imul(we,Rt)|0,g=g+Math.imul(we,nt)|0,g=g+Math.imul(he,Rt)|0,v=v+Math.imul(he,nt)|0,C=C+Math.imul(dt,zt)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(je,zt)|0,v=v+Math.imul(je,j)|0,C=C+Math.imul(Ve,A)|0,g=g+Math.imul(Ve,$)|0,g=g+Math.imul(Le,A)|0,v=v+Math.imul(Le,$)|0,C=C+Math.imul(me,J)|0,g=g+Math.imul(me,ne)|0,g=g+Math.imul(xe,J)|0,v=v+Math.imul(xe,ne)|0,C=C+Math.imul(ee,Je)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(ie,Je)|0,v=v+Math.imul(ie,Re)|0;var fr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(fr>>>26)|0,fr&=67108863,C=Math.imul(Et,Ot),g=Math.imul(Et,rt),g=g+Math.imul(Ze,Ot)|0,v=Math.imul(Ze,rt),C=C+Math.imul(lt,Pt)|0,g=g+Math.imul(lt,et)|0,g=g+Math.imul(ze,Pt)|0,v=v+Math.imul(ze,et)|0,C=C+Math.imul(Te,Mt)|0,g=g+Math.imul(Te,Ge)|0,g=g+Math.imul(Be,Mt)|0,v=v+Math.imul(Be,Ge)|0,C=C+Math.imul(Ue,Rt)|0,g=g+Math.imul(Ue,nt)|0,g=g+Math.imul(Ne,Rt)|0,v=v+Math.imul(Ne,nt)|0,C=C+Math.imul(we,zt)|0,g=g+Math.imul(we,j)|0,g=g+Math.imul(he,zt)|0,v=v+Math.imul(he,j)|0,C=C+Math.imul(dt,A)|0,g=g+Math.imul(dt,$)|0,g=g+Math.imul(je,A)|0,v=v+Math.imul(je,$)|0,C=C+Math.imul(Ve,J)|0,g=g+Math.imul(Ve,ne)|0,g=g+Math.imul(Le,J)|0,v=v+Math.imul(Le,ne)|0,C=C+Math.imul(me,Je)|0,g=g+Math.imul(me,Re)|0,g=g+Math.imul(xe,Je)|0,v=v+Math.imul(xe,Re)|0,C=C+Math.imul(ee,se)|0,g=g+Math.imul(ee,fe)|0,g=g+Math.imul(ie,se)|0,v=v+Math.imul(ie,fe)|0;var er=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(er>>>26)|0,er&=67108863,C=Math.imul(Ft,Ot),g=Math.imul(Ft,rt),g=g+Math.imul(Qe,Ot)|0,v=Math.imul(Qe,rt),C=C+Math.imul(Et,Pt)|0,g=g+Math.imul(Et,et)|0,g=g+Math.imul(Ze,Pt)|0,v=v+Math.imul(Ze,et)|0,C=C+Math.imul(lt,Mt)|0,g=g+Math.imul(lt,Ge)|0,g=g+Math.imul(ze,Mt)|0,v=v+Math.imul(ze,Ge)|0,C=C+Math.imul(Te,Rt)|0,g=g+Math.imul(Te,nt)|0,g=g+Math.imul(Be,Rt)|0,v=v+Math.imul(Be,nt)|0,C=C+Math.imul(Ue,zt)|0,g=g+Math.imul(Ue,j)|0,g=g+Math.imul(Ne,zt)|0,v=v+Math.imul(Ne,j)|0,C=C+Math.imul(we,A)|0,g=g+Math.imul(we,$)|0,g=g+Math.imul(he,A)|0,v=v+Math.imul(he,$)|0,C=C+Math.imul(dt,J)|0,g=g+Math.imul(dt,ne)|0,g=g+Math.imul(je,J)|0,v=v+Math.imul(je,ne)|0,C=C+Math.imul(Ve,Je)|0,g=g+Math.imul(Ve,Re)|0,g=g+Math.imul(Le,Je)|0,v=v+Math.imul(Le,Re)|0,C=C+Math.imul(me,se)|0,g=g+Math.imul(me,fe)|0,g=g+Math.imul(xe,se)|0,v=v+Math.imul(xe,fe)|0,C=C+Math.imul(ee,He)|0,g=g+Math.imul(ee,Pe)|0,g=g+Math.imul(ie,He)|0,v=v+Math.imul(ie,Pe)|0;var xr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(xr>>>26)|0,xr&=67108863,C=Math.imul(Ft,Pt),g=Math.imul(Ft,et),g=g+Math.imul(Qe,Pt)|0,v=Math.imul(Qe,et),C=C+Math.imul(Et,Mt)|0,g=g+Math.imul(Et,Ge)|0,g=g+Math.imul(Ze,Mt)|0,v=v+Math.imul(Ze,Ge)|0,C=C+Math.imul(lt,Rt)|0,g=g+Math.imul(lt,nt)|0,g=g+Math.imul(ze,Rt)|0,v=v+Math.imul(ze,nt)|0,C=C+Math.imul(Te,zt)|0,g=g+Math.imul(Te,j)|0,g=g+Math.imul(Be,zt)|0,v=v+Math.imul(Be,j)|0,C=C+Math.imul(Ue,A)|0,g=g+Math.imul(Ue,$)|0,g=g+Math.imul(Ne,A)|0,v=v+Math.imul(Ne,$)|0,C=C+Math.imul(we,J)|0,g=g+Math.imul(we,ne)|0,g=g+Math.imul(he,J)|0,v=v+Math.imul(he,ne)|0,C=C+Math.imul(dt,Je)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(je,Je)|0,v=v+Math.imul(je,Re)|0,C=C+Math.imul(Ve,se)|0,g=g+Math.imul(Ve,fe)|0,g=g+Math.imul(Le,se)|0,v=v+Math.imul(Le,fe)|0,C=C+Math.imul(me,He)|0,g=g+Math.imul(me,Pe)|0,g=g+Math.imul(xe,He)|0,v=v+Math.imul(xe,Pe)|0;var Rn=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,C=Math.imul(Ft,Mt),g=Math.imul(Ft,Ge),g=g+Math.imul(Qe,Mt)|0,v=Math.imul(Qe,Ge),C=C+Math.imul(Et,Rt)|0,g=g+Math.imul(Et,nt)|0,g=g+Math.imul(Ze,Rt)|0,v=v+Math.imul(Ze,nt)|0,C=C+Math.imul(lt,zt)|0,g=g+Math.imul(lt,j)|0,g=g+Math.imul(ze,zt)|0,v=v+Math.imul(ze,j)|0,C=C+Math.imul(Te,A)|0,g=g+Math.imul(Te,$)|0,g=g+Math.imul(Be,A)|0,v=v+Math.imul(Be,$)|0,C=C+Math.imul(Ue,J)|0,g=g+Math.imul(Ue,ne)|0,g=g+Math.imul(Ne,J)|0,v=v+Math.imul(Ne,ne)|0,C=C+Math.imul(we,Je)|0,g=g+Math.imul(we,Re)|0,g=g+Math.imul(he,Je)|0,v=v+Math.imul(he,Re)|0,C=C+Math.imul(dt,se)|0,g=g+Math.imul(dt,fe)|0,g=g+Math.imul(je,se)|0,v=v+Math.imul(je,fe)|0,C=C+Math.imul(Ve,He)|0,g=g+Math.imul(Ve,Pe)|0,g=g+Math.imul(Le,He)|0,v=v+Math.imul(Le,Pe)|0;var Kr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,C=Math.imul(Ft,Rt),g=Math.imul(Ft,nt),g=g+Math.imul(Qe,Rt)|0,v=Math.imul(Qe,nt),C=C+Math.imul(Et,zt)|0,g=g+Math.imul(Et,j)|0,g=g+Math.imul(Ze,zt)|0,v=v+Math.imul(Ze,j)|0,C=C+Math.imul(lt,A)|0,g=g+Math.imul(lt,$)|0,g=g+Math.imul(ze,A)|0,v=v+Math.imul(ze,$)|0,C=C+Math.imul(Te,J)|0,g=g+Math.imul(Te,ne)|0,g=g+Math.imul(Be,J)|0,v=v+Math.imul(Be,ne)|0,C=C+Math.imul(Ue,Je)|0,g=g+Math.imul(Ue,Re)|0,g=g+Math.imul(Ne,Je)|0,v=v+Math.imul(Ne,Re)|0,C=C+Math.imul(we,se)|0,g=g+Math.imul(we,fe)|0,g=g+Math.imul(he,se)|0,v=v+Math.imul(he,fe)|0,C=C+Math.imul(dt,He)|0,g=g+Math.imul(dt,Pe)|0,g=g+Math.imul(je,He)|0,v=v+Math.imul(je,Pe)|0;var Nn=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,C=Math.imul(Ft,zt),g=Math.imul(Ft,j),g=g+Math.imul(Qe,zt)|0,v=Math.imul(Qe,j),C=C+Math.imul(Et,A)|0,g=g+Math.imul(Et,$)|0,g=g+Math.imul(Ze,A)|0,v=v+Math.imul(Ze,$)|0,C=C+Math.imul(lt,J)|0,g=g+Math.imul(lt,ne)|0,g=g+Math.imul(ze,J)|0,v=v+Math.imul(ze,ne)|0,C=C+Math.imul(Te,Je)|0,g=g+Math.imul(Te,Re)|0,g=g+Math.imul(Be,Je)|0,v=v+Math.imul(Be,Re)|0,C=C+Math.imul(Ue,se)|0,g=g+Math.imul(Ue,fe)|0,g=g+Math.imul(Ne,se)|0,v=v+Math.imul(Ne,fe)|0,C=C+Math.imul(we,He)|0,g=g+Math.imul(we,Pe)|0,g=g+Math.imul(he,He)|0,v=v+Math.imul(he,Pe)|0;var Ii=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,C=Math.imul(Ft,A),g=Math.imul(Ft,$),g=g+Math.imul(Qe,A)|0,v=Math.imul(Qe,$),C=C+Math.imul(Et,J)|0,g=g+Math.imul(Et,ne)|0,g=g+Math.imul(Ze,J)|0,v=v+Math.imul(Ze,ne)|0,C=C+Math.imul(lt,Je)|0,g=g+Math.imul(lt,Re)|0,g=g+Math.imul(ze,Je)|0,v=v+Math.imul(ze,Re)|0,C=C+Math.imul(Te,se)|0,g=g+Math.imul(Te,fe)|0,g=g+Math.imul(Be,se)|0,v=v+Math.imul(Be,fe)|0,C=C+Math.imul(Ue,He)|0,g=g+Math.imul(Ue,Pe)|0,g=g+Math.imul(Ne,He)|0,v=v+Math.imul(Ne,Pe)|0;var Oi=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,C=Math.imul(Ft,J),g=Math.imul(Ft,ne),g=g+Math.imul(Qe,J)|0,v=Math.imul(Qe,ne),C=C+Math.imul(Et,Je)|0,g=g+Math.imul(Et,Re)|0,g=g+Math.imul(Ze,Je)|0,v=v+Math.imul(Ze,Re)|0,C=C+Math.imul(lt,se)|0,g=g+Math.imul(lt,fe)|0,g=g+Math.imul(ze,se)|0,v=v+Math.imul(ze,fe)|0,C=C+Math.imul(Te,He)|0,g=g+Math.imul(Te,Pe)|0,g=g+Math.imul(Be,He)|0,v=v+Math.imul(Be,Pe)|0;var jn=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(jn>>>26)|0,jn&=67108863,C=Math.imul(Ft,Je),g=Math.imul(Ft,Re),g=g+Math.imul(Qe,Je)|0,v=Math.imul(Qe,Re),C=C+Math.imul(Et,se)|0,g=g+Math.imul(Et,fe)|0,g=g+Math.imul(Ze,se)|0,v=v+Math.imul(Ze,fe)|0,C=C+Math.imul(lt,He)|0,g=g+Math.imul(lt,Pe)|0,g=g+Math.imul(ze,He)|0,v=v+Math.imul(ze,Pe)|0;var Pi=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,C=Math.imul(Ft,se),g=Math.imul(Ft,fe),g=g+Math.imul(Qe,se)|0,v=Math.imul(Qe,fe),C=C+Math.imul(Et,He)|0,g=g+Math.imul(Et,Pe)|0,g=g+Math.imul(Ze,He)|0,v=v+Math.imul(Ze,Pe)|0;var Ri=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ri>>>26)|0,Ri&=67108863,C=Math.imul(Ft,He),g=Math.imul(Ft,Pe),g=g+Math.imul(Qe,He)|0,v=Math.imul(Qe,Pe);var B=(I+C|0)+((g&8191)<<13)|0;return I=(v+(g>>>13)|0)+(B>>>26)|0,B&=67108863,_[0]=$e,_[1]=at,_[2]=Qt,_[3]=Dt,_[4]=Ut,_[5]=ur,_[6]=Ar,_[7]=fr,_[8]=er,_[9]=xr,_[10]=Rn,_[11]=Kr,_[12]=Nn,_[13]=Ii,_[14]=Oi,_[15]=jn,_[16]=Pi,_[17]=Ri,_[18]=B,I!==0&&(_[19]=I,m.length++),m};Math.imul||(R=O);function k(D,h,f){f.negative=h.negative^D.negative,f.length=D.length+h.length;for(var m=0,S=0,M=0;M<f.length-1;M++){var _=S;S=0;for(var I=m&67108863,C=Math.min(M,h.length-1),g=Math.max(0,M-D.length+1);g<=C;g++){var v=M-g,N=D.words[v]|0,ee=h.words[g]|0,ie=N*ee,le=ie&67108863;_=_+(ie/67108864|0)|0,le=le+I|0,I=le&67108863,_=_+(le>>>26)|0,S+=_>>>26,_&=67108863}f.words[M]=I,m=_,_=S}return m!==0?f.words[M]=m:f.length--,f._strip()}function F(D,h,f){return k(D,h,f)}o.prototype.mulTo=function(h,f){var m,S=this.length+h.length;return this.length===10&&h.length===10?m=R(this,h,f):S<63?m=O(this,h,f):S<1024?m=k(this,h,f):m=F(this,h,f),m},o.prototype.mul=function(h){var f=new o(null);return f.words=new Array(this.length+h.length),this.mulTo(h,f)},o.prototype.mulf=function(h){var f=new o(null);return f.words=new Array(this.length+h.length),F(this,h,f)},o.prototype.imul=function(h){return this.clone().mulTo(h,this)},o.prototype.imuln=function(h){var f=h<0;f&&(h=-h),n(typeof h=="number"),n(h<67108864);for(var m=0,S=0;S<this.length;S++){var M=(this.words[S]|0)*h,_=(M&67108863)+(m&67108863);m>>=26,m+=M/67108864|0,m+=_>>>26,this.words[S]=_&67108863}return m!==0&&(this.words[S]=m,this.length++),f?this.ineg():this},o.prototype.muln=function(h){return this.clone().imuln(h)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(h){var f=T(h);if(f.length===0)return new o(1);for(var m=this,S=0;S<f.length&&f[S]===0;S++,m=m.sqr());if(++S<f.length)for(var M=m.sqr();S<f.length;S++,M=M.sqr())f[S]!==0&&(m=m.mul(M));return m},o.prototype.iushln=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26,S=67108863>>>26-f<<26-f,M;if(f!==0){var _=0;for(M=0;M<this.length;M++){var I=this.words[M]&S,C=(this.words[M]|0)-I<<f;this.words[M]=C|_,_=I>>>26-f}_&&(this.words[M]=_,this.length++)}if(m!==0){for(M=this.length-1;M>=0;M--)this.words[M+m]=this.words[M];for(M=0;M<m;M++)this.words[M]=0;this.length+=m}return this._strip()},o.prototype.ishln=function(h){return n(this.negative===0),this.iushln(h)},o.prototype.iushrn=function(h,f,m){n(typeof h=="number"&&h>=0);var S;f?S=(f-f%26)/26:S=0;var M=h%26,_=Math.min((h-M)/26,this.length),I=67108863^67108863>>>M<<M,C=m;if(S-=_,S=Math.max(0,S),C){for(var g=0;g<_;g++)C.words[g]=this.words[g];C.length=_}if(_!==0)if(this.length>_)for(this.length-=_,g=0;g<this.length;g++)this.words[g]=this.words[g+_];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=S);g--){var N=this.words[g]|0;this.words[g]=v<<26-M|N>>>M,v=N&I}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(h,f,m){return n(this.negative===0),this.iushrn(h,f,m)},o.prototype.shln=function(h){return this.clone().ishln(h)},o.prototype.ushln=function(h){return this.clone().iushln(h)},o.prototype.shrn=function(h){return this.clone().ishrn(h)},o.prototype.ushrn=function(h){return this.clone().iushrn(h)},o.prototype.testn=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26,S=1<<f;if(this.length<=m)return!1;var M=this.words[m];return!!(M&S)},o.prototype.imaskn=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(f!==0&&m++,this.length=Math.min(m,this.length),f!==0){var S=67108863^67108863>>>f<<f;this.words[this.length-1]&=S}return this._strip()},o.prototype.maskn=function(h){return this.clone().imaskn(h)},o.prototype.iaddn=function(h){return n(typeof h=="number"),n(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},o.prototype._iaddn=function(h){this.words[0]+=h;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},o.prototype.isubn=function(h){if(n(typeof h=="number"),n(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this._strip()},o.prototype.addn=function(h){return this.clone().iaddn(h)},o.prototype.subn=function(h){return this.clone().isubn(h)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(h,f,m){var S=h.length+m,M;this._expand(S);var _,I=0;for(M=0;M<h.length;M++){_=(this.words[M+m]|0)+I;var C=(h.words[M]|0)*f;_-=C&67108863,I=(_>>26)-(C/67108864|0),this.words[M+m]=_&67108863}for(;M<this.length-m;M++)_=(this.words[M+m]|0)+I,I=_>>26,this.words[M+m]=_&67108863;if(I===0)return this._strip();for(n(I===-1),I=0,M=0;M<this.length;M++)_=-(this.words[M]|0)+I,I=_>>26,this.words[M]=_&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(h,f){var m=this.length-h.length,S=this.clone(),M=h,_=M.words[M.length-1]|0,I=this._countBits(_);m=26-I,m!==0&&(M=M.ushln(m),S.iushln(m),_=M.words[M.length-1]|0);var C=S.length-M.length,g;if(f!=="mod"){g=new o(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var N=S.clone()._ishlnsubmul(M,1,C);N.negative===0&&(S=N,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var ie=(S.words[M.length+ee]|0)*67108864+(S.words[M.length+ee-1]|0);for(ie=Math.min(ie/_|0,67108863),S._ishlnsubmul(M,ie,ee);S.negative!==0;)ie--,S.negative=0,S._ishlnsubmul(M,1,ee),S.isZero()||(S.negative^=1);g&&(g.words[ee]=ie)}return g&&g._strip(),S._strip(),f!=="div"&&m!==0&&S.iushrn(m),{div:g||null,mod:S}},o.prototype.divmod=function(h,f,m){if(n(!h.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var S,M,_;return this.negative!==0&&h.negative===0?(_=this.neg().divmod(h,f),f!=="mod"&&(S=_.div.neg()),f!=="div"&&(M=_.mod.neg(),m&&M.negative!==0&&M.iadd(h)),{div:S,mod:M}):this.negative===0&&h.negative!==0?(_=this.divmod(h.neg(),f),f!=="mod"&&(S=_.div.neg()),{div:S,mod:_.mod}):this.negative&h.negative?(_=this.neg().divmod(h.neg(),f),f!=="div"&&(M=_.mod.neg(),m&&M.negative!==0&&M.isub(h)),{div:_.div,mod:M}):h.length>this.length||this.cmp(h)<0?{div:new o(0),mod:this}:h.length===1?f==="div"?{div:this.divn(h.words[0]),mod:null}:f==="mod"?{div:null,mod:new o(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new o(this.modrn(h.words[0]))}:this._wordDiv(h,f)},o.prototype.div=function(h){return this.divmod(h,"div",!1).div},o.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},o.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},o.prototype.divRound=function(h){var f=this.divmod(h);if(f.mod.isZero())return f.div;var m=f.div.negative!==0?f.mod.isub(h):f.mod,S=h.ushrn(1),M=h.andln(1),_=m.cmp(S);return _<0||M===1&&_===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},o.prototype.modrn=function(h){var f=h<0;f&&(h=-h),n(h<=67108863);for(var m=(1<<26)%h,S=0,M=this.length-1;M>=0;M--)S=(m*S+(this.words[M]|0))%h;return f?-S:S},o.prototype.modn=function(h){return this.modrn(h)},o.prototype.idivn=function(h){var f=h<0;f&&(h=-h),n(h<=67108863);for(var m=0,S=this.length-1;S>=0;S--){var M=(this.words[S]|0)+m*67108864;this.words[S]=M/h|0,m=M%h}return this._strip(),f?this.ineg():this},o.prototype.divn=function(h){return this.clone().idivn(h)},o.prototype.egcd=function(h){n(h.negative===0),n(!h.isZero());var f=this,m=h.clone();f.negative!==0?f=f.umod(h):f=f.clone();for(var S=new o(1),M=new o(0),_=new o(0),I=new o(1),C=0;f.isEven()&&m.isEven();)f.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=f.clone();!f.isZero();){for(var N=0,ee=1;!(f.words[0]&ee)&&N<26;++N,ee<<=1);if(N>0)for(f.iushrn(N);N-- >0;)(S.isOdd()||M.isOdd())&&(S.iadd(g),M.isub(v)),S.iushrn(1),M.iushrn(1);for(var ie=0,le=1;!(m.words[0]&le)&&ie<26;++ie,le<<=1);if(ie>0)for(m.iushrn(ie);ie-- >0;)(_.isOdd()||I.isOdd())&&(_.iadd(g),I.isub(v)),_.iushrn(1),I.iushrn(1);f.cmp(m)>=0?(f.isub(m),S.isub(_),M.isub(I)):(m.isub(f),_.isub(S),I.isub(M))}return{a:_,b:I,gcd:m.iushln(C)}},o.prototype._invmp=function(h){n(h.negative===0),n(!h.isZero());var f=this,m=h.clone();f.negative!==0?f=f.umod(h):f=f.clone();for(var S=new o(1),M=new o(0),_=m.clone();f.cmpn(1)>0&&m.cmpn(1)>0;){for(var I=0,C=1;!(f.words[0]&C)&&I<26;++I,C<<=1);if(I>0)for(f.iushrn(I);I-- >0;)S.isOdd()&&S.iadd(_),S.iushrn(1);for(var g=0,v=1;!(m.words[0]&v)&&g<26;++g,v<<=1);if(g>0)for(m.iushrn(g);g-- >0;)M.isOdd()&&M.iadd(_),M.iushrn(1);f.cmp(m)>=0?(f.isub(m),S.isub(M)):(m.isub(f),M.isub(S))}var N;return f.cmpn(1)===0?N=S:N=M,N.cmpn(0)<0&&N.iadd(h),N},o.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var f=this.clone(),m=h.clone();f.negative=0,m.negative=0;for(var S=0;f.isEven()&&m.isEven();S++)f.iushrn(1),m.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;m.isEven();)m.iushrn(1);var M=f.cmp(m);if(M<0){var _=f;f=m,m=_}else if(M===0||m.cmpn(1)===0)break;f.isub(m)}while(!0);return m.iushln(S)},o.prototype.invm=function(h){return this.egcd(h).a.umod(h)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(h){return this.words[0]&h},o.prototype.bincn=function(h){n(typeof h=="number");var f=h%26,m=(h-f)/26,S=1<<f;if(this.length<=m)return this._expand(m+1),this.words[m]|=S,this;for(var M=S,_=m;M!==0&&_<this.length;_++){var I=this.words[_]|0;I+=M,M=I>>>26,I&=67108863,this.words[_]=I}return M!==0&&(this.words[_]=M,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(h){var f=h<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this._strip();var m;if(this.length>1)m=1;else{f&&(h=-h),n(h<=67108863,"Number is too big");var S=this.words[0]|0;m=S===h?0:S<h?-1:1}return this.negative!==0?-m|0:m},o.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var f=this.ucmp(h);return this.negative!==0?-f|0:f},o.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var f=0,m=this.length-1;m>=0;m--){var S=this.words[m]|0,M=h.words[m]|0;if(S!==M){S<M?f=-1:S>M&&(f=1);break}}return f},o.prototype.gtn=function(h){return this.cmpn(h)===1},o.prototype.gt=function(h){return this.cmp(h)===1},o.prototype.gten=function(h){return this.cmpn(h)>=0},o.prototype.gte=function(h){return this.cmp(h)>=0},o.prototype.ltn=function(h){return this.cmpn(h)===-1},o.prototype.lt=function(h){return this.cmp(h)===-1},o.prototype.lten=function(h){return this.cmpn(h)<=0},o.prototype.lte=function(h){return this.cmp(h)<=0},o.prototype.eqn=function(h){return this.cmpn(h)===0},o.prototype.eq=function(h){return this.cmp(h)===0},o.red=function(h){return new ae(h)},o.prototype.toRed=function(h){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(h){return this.red=h,this},o.prototype.forceRed=function(h){return n(!this.red,"Already a number in reduction context"),this._forceRed(h)},o.prototype.redAdd=function(h){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},o.prototype.redIAdd=function(h){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},o.prototype.redSub=function(h){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},o.prototype.redISub=function(h){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},o.prototype.redShl=function(h){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},o.prototype.redMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},o.prototype.redIMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(h){return n(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var L={k256:null,p224:null,p192:null,p25519:null};function q(D,h){this.name=D,this.p=new o(h,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var h=new o(null);return h.words=new Array(Math.ceil(this.n/13)),h},q.prototype.ireduce=function(h){var f=h,m;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),m=f.bitLength();while(m>this.n);var S=m<this.n?-1:f.ucmp(this.p);return S===0?(f.words[0]=0,f.length=1):S>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},q.prototype.split=function(h,f){h.iushrn(this.n,0,f)},q.prototype.imulK=function(h){return h.imul(this.k)};function H(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(H,q),H.prototype.split=function(h,f){for(var m=4194303,S=Math.min(h.length,9),M=0;M<S;M++)f.words[M]=h.words[M];if(f.length=S,h.length<=9){h.words[0]=0,h.length=1;return}var _=h.words[9];for(f.words[f.length++]=_&m,M=10;M<h.length;M++){var I=h.words[M]|0;h.words[M-10]=(I&m)<<4|_>>>22,_=I}_>>>=22,h.words[M-10]=_,_===0&&h.length>10?h.length-=10:h.length-=9},H.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var f=0,m=0;m<h.length;m++){var S=h.words[m]|0;f+=S*977,h.words[m]=f&67108863,f=S*64+(f/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function K(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(K,q);function re(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(re,q);function oe(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(oe,q),oe.prototype.imulK=function(h){for(var f=0,m=0;m<h.length;m++){var S=(h.words[m]|0)*19+f,M=S&67108863;S>>>=26,h.words[m]=M,f=S}return f!==0&&(h.words[h.length++]=f),h},o._prime=function(h){if(L[h])return L[h];var f;if(h==="k256")f=new H;else if(h==="p224")f=new K;else if(h==="p192")f=new re;else if(h==="p25519")f=new oe;else throw new Error("Unknown prime "+h);return L[h]=f,f};function ae(D){if(typeof D=="string"){var h=o._prime(D);this.m=h.p,this.prime=h}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}ae.prototype._verify1=function(h){n(h.negative===0,"red works only with positives"),n(h.red,"red works only with red numbers")},ae.prototype._verify2=function(h,f){n((h.negative|f.negative)===0,"red works only with positives"),n(h.red&&h.red===f.red,"red works only with red numbers")},ae.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(l(h,h.umod(this.m)._forceRed(this)),h)},ae.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},ae.prototype.add=function(h,f){this._verify2(h,f);var m=h.add(f);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ae.prototype.iadd=function(h,f){this._verify2(h,f);var m=h.iadd(f);return m.cmp(this.m)>=0&&m.isub(this.m),m},ae.prototype.sub=function(h,f){this._verify2(h,f);var m=h.sub(f);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ae.prototype.isub=function(h,f){this._verify2(h,f);var m=h.isub(f);return m.cmpn(0)<0&&m.iadd(this.m),m},ae.prototype.shl=function(h,f){return this._verify1(h),this.imod(h.ushln(f))},ae.prototype.imul=function(h,f){return this._verify2(h,f),this.imod(h.imul(f))},ae.prototype.mul=function(h,f){return this._verify2(h,f),this.imod(h.mul(f))},ae.prototype.isqr=function(h){return this.imul(h,h.clone())},ae.prototype.sqr=function(h){return this.mul(h,h)},ae.prototype.sqrt=function(h){if(h.isZero())return h.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var m=this.m.add(new o(1)).iushrn(2);return this.pow(h,m)}for(var S=this.m.subn(1),M=0;!S.isZero()&&S.andln(1)===0;)M++,S.iushrn(1);n(!S.isZero());var _=new o(1).toRed(this),I=_.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new o(2*g*g).toRed(this);this.pow(g,C).cmp(I)!==0;)g.redIAdd(I);for(var v=this.pow(g,S),N=this.pow(h,S.addn(1).iushrn(1)),ee=this.pow(h,S),ie=M;ee.cmp(_)!==0;){for(var le=ee,me=0;le.cmp(_)!==0;me++)le=le.redSqr();n(me<ie);var xe=this.pow(v,new o(1).iushln(ie-me-1));N=N.redMul(xe),v=xe.redSqr(),ee=ee.redMul(v),ie=me}return N},ae.prototype.invm=function(h){var f=h._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},ae.prototype.pow=function(h,f){if(f.isZero())return new o(1).toRed(this);if(f.cmpn(1)===0)return h.clone();var m=4,S=new Array(1<<m);S[0]=new o(1).toRed(this),S[1]=h;for(var M=2;M<S.length;M++)S[M]=this.mul(S[M-1],h);var _=S[0],I=0,C=0,g=f.bitLength()%26;for(g===0&&(g=26),M=f.length-1;M>=0;M--){for(var v=f.words[M],N=g-1;N>=0;N--){var ee=v>>N&1;if(_!==S[0]&&(_=this.sqr(_)),ee===0&&I===0){C=0;continue}I<<=1,I|=ee,C++,!(C!==m&&(M!==0||N!==0))&&(_=this.mul(_,S[I]),C=0,I=0)}g=26}return _},ae.prototype.convertTo=function(h){var f=h.umod(this.m);return f===h?f.clone():f},ae.prototype.convertFrom=function(h){var f=h.clone();return f.red=null,f},o.mont=function(h){return new z(h)};function z(D){ae.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(z,ae),z.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},z.prototype.convertFrom=function(h){var f=this.imod(h.mul(this.rinv));return f.red=null,f},z.prototype.imul=function(h,f){if(h.isZero()||f.isZero())return h.words[0]=0,h.length=1,h;var m=h.imul(f),S=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(S).iushrn(this.shift),_=M;return M.cmp(this.m)>=0?_=M.isub(this.m):M.cmpn(0)<0&&(_=M.iadd(this.m)),_._forceRed(this)},z.prototype.mul=function(h,f){if(h.isZero()||f.isZero())return new o(0)._forceRed(this);var m=h.mul(f),S=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(S).iushrn(this.shift),_=M;return M.cmp(this.m)>=0?_=M.isub(this.m):M.cmpn(0)<0&&(_=M.iadd(this.m)),_._forceRed(this)},z.prototype.invm=function(h){var f=this.imod(h._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Dr)}(Hl);var _p=Hl.exports;const Cp=Bs(_p);var I8=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0}),on.parseAccumulatorUpdateData=on.sliceAccumulatorUpdateData=on.parseTwapMessage=on.parsePriceFeedMessage=on.isAccumulatorUpdateData=void 0;const sn=I8(_p),O8="504e4155",P8=1,R8=0,ql=20,N8=0,j8=1;function Wl(e){return e.toString("hex").slice(0,8)===O8&&e[4]===P8&&e[5]===R8}on.isAccumulatorUpdateData=Wl;function k8(e){let t=0;if(e.readUInt8(t)!==N8)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+8),"be");t+=8;const o=new sn.default(e.subarray(t,t+8),"be");t+=8;const s=e.readInt32BE(t);t+=4;const a=new sn.default(e.subarray(t,t+8),"be");t+=8;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:o,exponent:s,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}on.parsePriceFeedMessage=k8;function D8(e){let t=0;if(e.readUInt8(t)!==j8)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+16),"be");t+=16;const o=new sn.default(e.subarray(t,t+16),"be");t+=16;const s=new sn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:o,numDownSlots:s,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}on.parseTwapMessage=D8;function B8(e,t,r){if(!Wl(e))throw new Error("Invalid accumulator message");let n=6;const i=e.readUint8(n);n+=1+i,n+=1;const o=e.readUint16BE(n);n+=2,n+=o;const s=n,a=[],c=e.readUInt8(n);n+=1;for(let l=0;l<c;l++){const d=n,p=e.readUint16BE(n);n+=2,n+=p;const w=e.readUInt8(n);n+=1,n+=ql*w,a.push(e.subarray(d,n))}if(n!==e.length)throw new Error("Didn't reach the end of the message");const u=a.slice(t,r);return zl.concat([e.subarray(0,s),zl.from([u.length]),...a.slice(t,r)])}on.sliceAccumulatorUpdateData=B8;function L8(e){if(!Wl(e))throw new Error("Invalid accumulator message");let t=6;const r=e.readUint8(t);t+=1+r,t+=1;const n=e.readUint16BE(t);t+=2;const i=e.subarray(t,t+n);t+=n;const o=e.readUInt8(t),s=[];t+=1;for(let a=0;a<o;a++){const c=e.readUint16BE(t);t+=2;const u=e.subarray(t,t+c);t+=c;const l=e.readUInt8(t);t+=1;const d=[];for(let p=0;p<l;p++)d.push(Array.from(e.subarray(t,t+ql))),t+=ql;s.push({message:u,proof:d})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:s}}on.parseAccumulatorUpdateData=L8,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parseTwapMessage=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=ac;var r=on;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let o=class O2{constructor(a){vt(this,"emaPrice");vt(this,"id");vt(this,"metadata");vt(this,"vaa");vt(this,"price");this.emaPrice=a.emaPrice,this.id=a.id,this.metadata=a.metadata,this.vaa=a.vaa,this.price=a.price}static fromJson(a){const c=t.Convert.toPriceFeed(a);return new O2({emaPrice:n.fromJson(c.ema_price),id:c.id,metadata:i.fromJson(c.metadata),vaa:c.vaa,price:n.fromJson(c.price)})}toJson(){var c;const a={ema_price:this.emaPrice.toJson(),id:this.id,metadata:(c=this.metadata)==null?void 0:c.toJson(),price:this.price.toJson()};return t.Convert.priceFeedToJson(a)}getPriceUnchecked(){return this.price}getEmaPriceUnchecked(){return this.emaPrice}getPriceNoOlderThan(a){const c=this.getPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getEmaPriceNoOlderThan(a){const c=this.getEmaPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getMetadata(){return this.metadata}getVAA(){return this.vaa}};e.PriceFeed=o}(Ll);function Mp(e,t){return function(){return e.apply(t,arguments)}}const{toString:$8}=Object.prototype,{getPrototypeOf:Gl}=Object,uc=(e=>t=>{const r=$8.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),xn=e=>(e=e.toLowerCase(),t=>uc(t)===e),lc=e=>t=>typeof t===e,{isArray:Ko}=Array,oa=lc("undefined");function F8(e){return e!==null&&!oa(e)&&e.constructor!==null&&!oa(e.constructor)&&Jr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ap=xn("ArrayBuffer");function U8(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ap(e.buffer),t}const V8=lc("string"),Jr=lc("function"),Tp=lc("number"),fc=e=>e!==null&&typeof e=="object",z8=e=>e===!0||e===!1,dc=e=>{if(uc(e)!=="object")return!1;const t=Gl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},H8=xn("Date"),q8=xn("File"),W8=xn("Blob"),G8=xn("FileList"),K8=e=>fc(e)&&Jr(e.pipe),Y8=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Jr(e.append)&&((t=uc(e))==="formdata"||t==="object"&&Jr(e.toString)&&e.toString()==="[object FormData]"))},Z8=xn("URLSearchParams"),[X8,J8,Q8,ex]=["ReadableStream","Request","Response","Headers"].map(xn),tx=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function sa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ko(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function Ip(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const yo=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Dr)(),Op=e=>!oa(e)&&e!==yo;function Kl(){const{caseless:e}=Op(this)&&this||{},t={},r=(n,i)=>{const o=e&&Ip(t,i)||i;dc(t[o])&&dc(n)?t[o]=Kl(t[o],n):dc(n)?t[o]=Kl({},n):Ko(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&sa(arguments[n],r);return t}const rx=(e,t,r,{allOwnKeys:n}={})=>(sa(t,(i,o)=>{r&&Jr(i)?e[o]=Mp(i,r):e[o]=i},{allOwnKeys:n}),e),nx=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ix=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},ox=(e,t,r,n)=>{let i,o,s;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Gl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},sx=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},ax=e=>{if(!e)return null;if(Ko(e))return e;let t=e.length;if(!Tp(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},cx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Gl(Uint8Array)),ux=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},lx=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},fx=xn("HTMLFormElement"),dx=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Pp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),hx=xn("RegExp"),Rp=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};sa(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},px=e=>{Rp(e,(t,r)=>{if(Jr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Jr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mx=(e,t)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ko(e)?n(e):n(String(e).split(t)),r},gx=()=>{},vx=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Yl="abcdefghijklmnopqrstuvwxyz",Np="0123456789",jp={DIGIT:Np,ALPHA:Yl,ALPHA_DIGIT:Yl+Yl.toUpperCase()+Np},yx=(e=16,t=jp.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function wx(e){return!!(e&&Jr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const bx=e=>{const t=new Array(10),r=(n,i)=>{if(fc(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const o=Ko(n)?[]:{};return sa(n,(s,a)=>{const c=r(s,i+1);!oa(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},xx=xn("AsyncFunction"),Sx=e=>e&&(fc(e)||Jr(e))&&Jr(e.then)&&Jr(e.catch),kp=((e,t)=>e?setImmediate:t?((r,n)=>(yo.addEventListener("message",({source:i,data:o})=>{i===yo&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),yo.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Jr(yo.postMessage)),Ex=typeof queueMicrotask<"u"?queueMicrotask.bind(yo):typeof pn<"u"&&pn.nextTick||kp;var ce={isArray:Ko,isArrayBuffer:Ap,isBuffer:F8,isFormData:Y8,isArrayBufferView:U8,isString:V8,isNumber:Tp,isBoolean:z8,isObject:fc,isPlainObject:dc,isReadableStream:X8,isRequest:J8,isResponse:Q8,isHeaders:ex,isUndefined:oa,isDate:H8,isFile:q8,isBlob:W8,isRegExp:hx,isFunction:Jr,isStream:K8,isURLSearchParams:Z8,isTypedArray:cx,isFileList:G8,forEach:sa,merge:Kl,extend:rx,trim:tx,stripBOM:nx,inherits:ix,toFlatObject:ox,kindOf:uc,kindOfTest:xn,endsWith:sx,toArray:ax,forEachEntry:ux,matchAll:lx,isHTMLForm:fx,hasOwnProperty:Pp,hasOwnProp:Pp,reduceDescriptors:Rp,freezeMethods:px,toObjectSet:mx,toCamelCase:dx,noop:gx,toFiniteNumber:vx,findKey:Ip,global:yo,isContextDefined:Op,ALPHABET:jp,generateString:yx,isSpecCompliantForm:wx,toJSONObject:bx,isAsyncFn:xx,isThenable:Sx,setImmediate:kp,asap:Ex};function ht(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}ce.inherits(ht,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:ce.toJSONObject(this.config),code:this.code,status:this.status}}});const Dp=ht.prototype,Bp={};["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(e=>{Bp[e]={value:e}}),Object.defineProperties(ht,Bp),Object.defineProperty(Dp,"isAxiosError",{value:!0}),ht.from=(e,t,r,n,i,o)=>{const s=Object.create(Dp);return ce.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),ht.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var _x=null;function Zl(e){return ce.isPlainObject(e)||ce.isArray(e)}function Lp(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function $p(e,t,r){return e?e.concat(t).map(function(i,o){return i=Lp(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Cx(e){return ce.isArray(e)&&!e.some(Zl)}const Mx=ce.toFlatObject(ce,{},null,function(t){return/^is[A-Z]/.test(t)});function hc(e,t,r){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=ce.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!ce.isUndefined(T[y])});const n=r.metaTokens,i=r.visitor||l,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(ce.isDate(b))return b.toISOString();if(!c&&ce.isBlob(b))throw new ht("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(b)||ce.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):zl.from(b):b}function l(b,y,T){let O=b;if(b&&!T&&typeof b=="object"){if(ce.endsWith(y,"{}"))y=n?y:y.slice(0,-2),b=JSON.stringify(b);else if(ce.isArray(b)&&Cx(b)||(ce.isFileList(b)||ce.endsWith(y,"[]"))&&(O=ce.toArray(b)))return y=Lp(y),O.forEach(function(k,F){!(ce.isUndefined(k)||k===null)&&t.append(s===!0?$p([y],F,o):s===null?y:y+"[]",u(k))}),!1}return Zl(b)?!0:(t.append($p(T,y,o),u(b)),!1)}const d=[],p=Object.assign(Mx,{defaultVisitor:l,convertValue:u,isVisitable:Zl});function w(b,y){if(!ce.isUndefined(b)){if(d.indexOf(b)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(b),ce.forEach(b,function(O,R){(!(ce.isUndefined(O)||O===null)&&i.call(t,O,ce.isString(R)?R.trim():R,y,p))===!0&&w(O,y?y.concat(R):[R])}),d.pop()}}if(!ce.isObject(e))throw new TypeError("data must be an object");return w(e),t}function Fp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Xl(e,t){this._pairs=[],e&&hc(e,this,t)}const Up=Xl.prototype;Up.append=function(t,r){this._pairs.push([t,r])},Up.toString=function(t){const r=t?function(n){return t.call(this,n,Fp)}:Fp;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Ax(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Vp(e,t,r){if(!t)return e;const n=r&&r.encode||Ax;ce.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let o;if(i?o=i(t,r):o=ce.isURLSearchParams(t)?t.toString():new Xl(t,r).toString(n),o){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Tx{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ce.forEach(this.handlers,function(n){n!==null&&t(n)})}}var zp=Tx,Hp={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ix=typeof URLSearchParams<"u"?URLSearchParams:Xl,Ox=typeof FormData<"u"?FormData:null,Px=typeof Blob<"u"?Blob:null,Rx={isBrowser:!0,classes:{URLSearchParams:Ix,FormData:Ox,Blob:Px},protocols:["http","https","file","blob","url","data"]};const Jl=typeof window<"u"&&typeof document<"u",Ql=typeof navigator=="object"&&navigator||void 0,Nx=Jl&&(!Ql||["ReactNative","NativeScript","NS"].indexOf(Ql.product)<0),jx=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),kx=Jl&&window.location.href||"http://localhost";var Dx=Object.freeze({__proto__:null,hasBrowserEnv:Jl,hasStandardBrowserWebWorkerEnv:jx,hasStandardBrowserEnv:Nx,navigator:Ql,origin:kx}),Or={...Dx,...Rx};function Bx(e,t){return hc(e,new Or.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return Or.isNode&&ce.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Lx(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function $x(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function qp(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;const a=Number.isFinite(+s),c=o>=r.length;return s=!s&&ce.isArray(i)?i.length:s,c?(ce.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!ce.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&ce.isArray(i[s])&&(i[s]=$x(i[s])),!a)}if(ce.isFormData(e)&&ce.isFunction(e.entries)){const r={};return ce.forEachEntry(e,(n,i)=>{t(Lx(n),i,r,0)}),r}return null}function Fx(e,t,r){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ef={transitional:Hp,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=ce.isObject(t);if(o&&ce.isHTMLForm(t)&&(t=new FormData(t)),ce.isFormData(t))return i?JSON.stringify(qp(t)):t;if(ce.isArrayBuffer(t)||ce.isBuffer(t)||ce.isStream(t)||ce.isFile(t)||ce.isBlob(t)||ce.isReadableStream(t))return t;if(ce.isArrayBufferView(t))return t.buffer;if(ce.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Bx(t,this.formSerializer).toString();if((a=ce.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return hc(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Fx(t)):t}],transformResponse:[function(t){const r=this.transitional||ef.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(ce.isResponse(t)||ce.isReadableStream(t))return t;if(t&&ce.isString(t)&&(n&&!this.responseType||i)){const s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?ht.from(a,ht.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Or.classes.FormData,Blob:Or.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],e=>{ef.headers[e]={}});var tf=ef;const Ux=ce.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"]);var Vx=e=>{const t={};let r,n,i;return e&&e.split(`
30
- `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&Ux[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const Wp=Symbol("internals");function aa(e){return e&&String(e).trim().toLowerCase()}function pc(e){return e===!1||e==null?e:ce.isArray(e)?e.map(pc):String(e)}function zx(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Hx=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function rf(e,t,r,n,i){if(ce.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!ce.isString(t)){if(ce.isString(n))return t.indexOf(n)!==-1;if(ce.isRegExp(n))return n.test(t)}}function qx(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Wx(e,t){const r=ce.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}class mc{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function o(a,c,u){const l=aa(c);if(!l)throw new Error("header name must be a non-empty string");const d=ce.findKey(i,l);(!d||i[d]===void 0||u===!0||u===void 0&&i[d]!==!1)&&(i[d||c]=pc(a))}const s=(a,c)=>ce.forEach(a,(u,l)=>o(u,l,c));if(ce.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(ce.isString(t)&&(t=t.trim())&&!Hx(t))s(Vx(t),r);else if(ce.isHeaders(t))for(const[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=aa(t),t){const n=ce.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return zx(i);if(ce.isFunction(r))return r.call(this,i,n);if(ce.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=aa(t),t){const n=ce.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||rf(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function o(s){if(s=aa(s),s){const a=ce.findKey(n,s);a&&(!r||rf(n,n[a],a,r))&&(delete n[a],i=!0)}}return ce.isArray(t)?t.forEach(o):o(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const o=r[n];(!t||rf(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const r=this,n={};return ce.forEach(this,(i,o)=>{const s=ce.findKey(n,o);if(s){r[s]=pc(i),delete r[o];return}const a=t?qx(o):String(o).trim();a!==o&&delete r[o],r[a]=pc(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return ce.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&ce.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
31
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[Wp]=this[Wp]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=aa(s);n[a]||(Wx(i,s),n[a]=!0)}return ce.isArray(t)?t.forEach(o):o(t),this}}mc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ce.reduceDescriptors(mc.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),ce.freezeMethods(mc);var Sn=mc;function nf(e,t){const r=this||tf,n=t||r,i=Sn.from(n.headers);let o=n.data;return ce.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Gp(e){return!!(e&&e.__CANCEL__)}function Yo(e,t,r){ht.call(this,e??"canceled",ht.ERR_CANCELED,t,r),this.name="CanceledError"}ce.inherits(Yo,ht,{__CANCEL__:!0});function Kp(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ht("Request failed with status code "+r.status,[ht.ERR_BAD_REQUEST,ht.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Gx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Kx(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[o];s||(s=u),r[i]=c,n[i]=u;let d=o,p=0;for(;d!==i;)p+=r[d++],d=d%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),u-s<t)return;const w=l&&u-l;return w?Math.round(p*1e3/w):void 0}}function Yx(e,t){let r=0,n=1e3/t,i,o;const s=(u,l=Date.now())=>{r=l,i=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),d=l-r;d>=n?s(u,l):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i)]}const gc=(e,t,r=3)=>{let n=0;const i=Kx(50,250);return Yx(o=>{const s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,u=i(c),l=s<=a;n=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-s)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},Yp=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Zp=e=>(...t)=>ce.asap(()=>e(...t));var Zx=Or.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Or.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Or.origin),Or.navigator&&/(msie|trident)/i.test(Or.navigator.userAgent)):()=>!0,Xx=Or.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];ce.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),ce.isString(n)&&s.push("path="+n),ce.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Jx(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Xp(e,t){return e&&!Jx(t)?Qx(e,t):t}const Jp=e=>e instanceof Sn?{...e}:e;function wo(e,t){t=t||{};const r={};function n(u,l,d,p){return ce.isPlainObject(u)&&ce.isPlainObject(l)?ce.merge.call({caseless:p},u,l):ce.isPlainObject(l)?ce.merge({},l):ce.isArray(l)?l.slice():l}function i(u,l,d,p){if(ce.isUndefined(l)){if(!ce.isUndefined(u))return n(void 0,u,d,p)}else return n(u,l,d,p)}function o(u,l){if(!ce.isUndefined(l))return n(void 0,l)}function s(u,l){if(ce.isUndefined(l)){if(!ce.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,d){if(d in t)return n(u,l);if(d in e)return n(void 0,u)}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,l,d)=>i(Jp(u),Jp(l),d,!0)};return ce.forEach(Object.keys(Object.assign({},e,t)),function(l){const d=c[l]||i,p=d(e[l],t[l],l);ce.isUndefined(p)&&d!==a||(r[l]=p)}),r}var Qp=e=>{const t=wo({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=Sn.from(s),t.url=Vp(Xp(t.baseURL,t.url),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(ce.isFormData(r)){if(Or.hasStandardBrowserEnv||Or.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...l]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Or.hasStandardBrowserEnv&&(n&&ce.isFunction(n)&&(n=n(t)),n||n!==!1&&Zx(t.url))){const u=i&&o&&Xx.read(o);u&&s.set(i,u)}return t},e3=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=Qp(e);let o=i.data;const s=Sn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,d,p,w,b;function y(){w&&w(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function O(){if(!T)return;const k=Sn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:k,config:e,request:T};Kp(function(H){r(H),y()},function(H){n(H),y()},L),T=null}"onloadend"in T?T.onloadend=O:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(O)},T.onabort=function(){T&&(n(new ht("Request aborted",ht.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new ht("Network Error",ht.ERR_NETWORK,e,T)),T=null},T.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||Hp;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new ht(F,L.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,e,T)),T=null},o===void 0&&s.setContentType(null),"setRequestHeader"in T&&ce.forEach(s.toJSON(),function(F,L){T.setRequestHeader(L,F)}),ce.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([p,b]=gc(u,!0),T.addEventListener("progress",p)),c&&T.upload&&([d,w]=gc(c),T.upload.addEventListener("progress",d),T.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(l=k=>{T&&(n(!k||k.type?new Yo(null,e,T):k),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=Gx(i.url);if(R&&Or.protocols.indexOf(R)===-1){n(new ht("Unsupported protocol "+R+":",ht.ERR_BAD_REQUEST,e));return}T.send(o||null)})},t3=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const o=function(u){if(!i){i=!0,a();const l=u instanceof Error?u:this.reason;n.abort(l instanceof ht?l:new Yo(l instanceof Error?l.message:l))}};let s=t&&setTimeout(()=>{s=null,o(new ht(`timeout ${t} of ms exceeded`,ht.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=()=>ce.asap(a),c}};const r3=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},n3=async function*(e,t){for await(const r of i3(e))yield*r3(r,t)},i3=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},em=(e,t,r,n)=>{const i=n3(e,t);let o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await i.next();if(u){a(),c.close();return}let d=l.byteLength;if(r){let p=o+=d;r(p)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},vc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",tm=vc&&typeof ReadableStream=="function",o3=vc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),rm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},s3=tm&&rm(()=>{let e=!1;const t=new Request(Or.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),nm=64*1024,of=tm&&rm(()=>ce.isReadableStream(new Response("").body)),yc={stream:of&&(e=>e.body)};vc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!yc[t]&&(yc[t]=ce.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new ht(`Response type '${t}' is not supported`,ht.ERR_NOT_SUPPORT,n)})})})(new Response);const a3=async e=>{if(e==null)return 0;if(ce.isBlob(e))return e.size;if(ce.isSpecCompliantForm(e))return(await new Request(Or.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ce.isArrayBufferView(e)||ce.isArrayBuffer(e))return e.byteLength;if(ce.isURLSearchParams(e)&&(e=e+""),ce.isString(e))return(await o3(e)).byteLength},c3=async(e,t)=>{const r=ce.toFiniteNumber(e.getContentLength());return r??a3(t)};var u3=vc&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:p}=Qp(e);u=u?(u+"").toLowerCase():"text";let w=t3([i,o&&o.toAbortSignal()],s),b;const y=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let T;try{if(c&&s3&&r!=="get"&&r!=="head"&&(T=await c3(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),q;if(ce.isFormData(n)&&(q=L.headers.get("content-type"))&&l.setContentType(q),L.body){const[H,K]=Yp(T,gc(Zp(c)));n=em(L.body,nm,H,K)}}ce.isString(d)||(d=d?"include":"omit");const O="credentials"in Request.prototype;b=new Request(t,{...p,signal:w,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:O?d:void 0});let R=await fetch(b);const k=of&&(u==="stream"||u==="response");if(of&&(a||k&&y)){const L={};["status","statusText","headers"].forEach(re=>{L[re]=R[re]});const q=ce.toFiniteNumber(R.headers.get("content-length")),[H,K]=a&&Yp(q,gc(Zp(a),!0))||[];R=new Response(em(R.body,nm,H,()=>{K&&K(),y&&y()}),L)}u=u||"text";let F=await yc[ce.findKey(yc,u)||"text"](R,e);return!k&&y&&y(),await new Promise((L,q)=>{Kp(L,q,{data:F,headers:Sn.from(R.headers),status:R.status,statusText:R.statusText,config:e,request:b})})}catch(O){throw y&&y(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new ht("Network Error",ht.ERR_NETWORK,e,b),{cause:O.cause||O}):ht.from(O,O&&O.code,e,b)}});const sf={http:_x,xhr:e3,fetch:u3};ce.forEach(sf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const im=e=>`- ${e}`,l3=e=>ce.isFunction(e)||e===null||e===!1;var om={getAdapter:e=>{e=ce.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!l3(r)&&(n=sf[(s=String(r)).toLowerCase()],n===void 0))throw new ht(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){const o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=t?o.length>1?`since :
32
- `+o.map(im).join(`
33
- `):" "+im(o[0]):"as no adapter specified";throw new ht("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:sf};function af(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yo(null,e)}function sm(e){return af(e),e.headers=Sn.from(e.headers),e.data=nf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),om.getAdapter(e.adapter||tf.adapter)(e).then(function(n){return af(e),n.data=nf.call(e,e.transformResponse,n),n.headers=Sn.from(n.headers),n},function(n){return Gp(n)||(af(e),n&&n.response&&(n.response.data=nf.call(e,e.transformResponse,n.response),n.response.headers=Sn.from(n.response.headers))),Promise.reject(n)})}const am="1.7.9",wc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const cm={};wc.transitional=function(t,r,n){function i(o,s){return"[Axios v"+am+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(t===!1)throw new ht(i(s," has been removed"+(r?" in "+r:"")),ht.ERR_DEPRECATED);return r&&!cm[s]&&(cm[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,a):!0}},wc.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function f3(e,t,r){if(typeof e!="object")throw new ht("options must be an object",ht.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new ht("option "+o+" must be "+c,ht.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ht("Unknown option "+o,ht.ERR_BAD_OPTION)}}var bc={assertOptions:f3,validators:wc};const Un=bc.validators;class xc{constructor(t){this.defaults=t,this.interceptors={request:new zp,response:new zp}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
34
- `+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=wo(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&bc.assertOptions(n,{silentJSONParsing:Un.transitional(Un.boolean),forcedJSONParsing:Un.transitional(Un.boolean),clarifyTimeoutError:Un.transitional(Un.boolean)},!1),i!=null&&(ce.isFunction(i)?r.paramsSerializer={serialize:i}:bc.assertOptions(i,{encode:Un.function,serialize:Un.function},!0)),bc.assertOptions(r,{baseUrl:Un.spelling("baseURL"),withXsrfToken:Un.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&ce.merge(o.common,o[r.method]);o&&ce.forEach(["delete","get","head","post","put","patch","common"],b=>{delete o[b]}),r.headers=Sn.concat(s,o);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let l,d=0,p;if(!c){const b=[sm.bind(this),void 0];for(b.unshift.apply(b,a),b.push.apply(b,u),p=b.length,l=Promise.resolve(r);d<p;)l=l.then(b[d++],b[d++]);return l}p=a.length;let w=r;for(d=0;d<p;){const b=a[d++],y=a[d++];try{w=b(w)}catch(T){y.call(this,T);break}}try{l=sm.call(this,w)}catch(b){return Promise.reject(b)}for(d=0,p=u.length;d<p;)l=l.then(u[d++],u[d++]);return l}getUri(t){t=wo(this.defaults,t);const r=Xp(t.baseURL,t.url);return Vp(r,t.params,t.paramsSerializer)}}ce.forEach(["delete","get","head","options"],function(t){xc.prototype[t]=function(r,n){return this.request(wo(n||{},{method:t,url:r,data:(n||{}).data}))}}),ce.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(wo(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}xc.prototype[t]=r(),xc.prototype[t+"Form"]=r(!0)});var Sc=xc;class cf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new Yo(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new cf(function(i){t=i}),cancel:t}}}var d3=cf;function h3(e){return function(r){return e.apply(null,r)}}function p3(e){return ce.isObject(e)&&e.isAxiosError===!0}const uf={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(uf).forEach(([e,t])=>{uf[t]=e});var m3=uf;function um(e){const t=new Sc(e),r=Mp(Sc.prototype.request,t);return ce.extend(r,Sc.prototype,t,{allOwnKeys:!0}),ce.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return um(wo(e,i))},r}const hr=um(tf);hr.Axios=Sc,hr.CanceledError=Yo,hr.CancelToken=d3,hr.isCancel=Gp,hr.VERSION=am,hr.toFormData=hc,hr.AxiosError=ht,hr.Cancel=hr.CanceledError,hr.all=function(t){return Promise.all(t)},hr.spread=h3,hr.isAxiosError=p3,hr.mergeConfig=wo,hr.AxiosHeaders=Sn,hr.formToJSON=e=>qp(ce.isHTMLForm(e)?new FormData(e):e),hr.getAdapter=om.getAdapter,hr.HttpStatusCode=m3,hr.default=hr;var lm=hr,lf={exports:{}},Qr={},fm={exports:{}};(function(e){function t(r){return r&&r.__esModule?r:{default:r}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(fm);var g3=fm.exports,ff={exports:{}},df={exports:{}},dm;function Ec(){return dm||(dm=1,function(e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(df)),df.exports}var hm;function v3(){return hm||(hm=1,function(e){var t=Ec().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(_,I,C){_[I]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",d=c.toStringTag||"@@toStringTag";function p(_,I,C){return Object.defineProperty(_,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),_[I]}try{p({},"")}catch{p=function(C,g,v){return C[g]=v}}function w(_,I,C,g){var v=I&&I.prototype instanceof F?I:F,N=Object.create(v.prototype),ee=new S(g||[]);return a(N,"_invoke",{value:D(_,C,ee)}),N}function b(_,I,C){try{return{type:"normal",arg:_.call(I,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=w;var y="suspendedStart",T="suspendedYield",O="executing",R="completed",k={};function F(){}function L(){}function q(){}var H={};p(H,u,function(){return this});var K=Object.getPrototypeOf,re=K&&K(K(M([])));re&&re!==o&&s.call(re,u)&&(H=re);var oe=q.prototype=F.prototype=Object.create(H);function ae(_){["next","throw","return"].forEach(function(I){p(_,I,function(C){return this._invoke(I,C)})})}function z(_,I){function C(v,N,ee,ie){var le=b(_[v],_,N);if(le.type!=="throw"){var me=le.arg,xe=me.value;return xe&&t(xe)=="object"&&s.call(xe,"__await")?I.resolve(xe.__await).then(function(be){C("next",be,ee,ie)},function(be){C("throw",be,ee,ie)}):I.resolve(xe).then(function(be){me.value=be,ee(me)},function(be){return C("throw",be,ee,ie)})}ie(le.arg)}var g;a(this,"_invoke",{value:function(N,ee){function ie(){return new I(function(le,me){C(N,ee,le,me)})}return g=g?g.then(ie,ie):ie()}})}function D(_,I,C){var g=y;return function(v,N){if(g===O)throw Error("Generator is already running");if(g===R){if(v==="throw")throw N;return{value:n,done:!0}}for(C.method=v,C.arg=N;;){var ee=C.delegate;if(ee){var ie=h(ee,C);if(ie){if(ie===k)continue;return ie}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===y)throw g=R,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=O;var le=b(_,I,C);if(le.type==="normal"){if(g=C.done?R:T,le.arg===k)continue;return{value:le.arg,done:C.done}}le.type==="throw"&&(g=R,C.method="throw",C.arg=le.arg)}}}function h(_,I){var C=I.method,g=_.iterator[C];if(g===n)return I.delegate=null,C==="throw"&&_.iterator.return&&(I.method="return",I.arg=n,h(_,I),I.method==="throw")||C!=="return"&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),k;var v=b(g,_.iterator,I.arg);if(v.type==="throw")return I.method="throw",I.arg=v.arg,I.delegate=null,k;var N=v.arg;return N?N.done?(I[_.resultName]=N.value,I.next=_.nextLoc,I.method!=="return"&&(I.method="next",I.arg=n),I.delegate=null,k):N:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,k)}function f(_){var I={tryLoc:_[0]};1 in _&&(I.catchLoc=_[1]),2 in _&&(I.finallyLoc=_[2],I.afterLoc=_[3]),this.tryEntries.push(I)}function m(_){var I=_.completion||{};I.type="normal",delete I.arg,_.completion=I}function S(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(f,this),this.reset(!0)}function M(_){if(_||_===""){var I=_[u];if(I)return I.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var C=-1,g=function v(){for(;++C<_.length;)if(s.call(_,C))return v.value=_[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(_)+" is not iterable")}return L.prototype=q,a(oe,"constructor",{value:q,configurable:!0}),a(q,"constructor",{value:L,configurable:!0}),L.displayName=p(q,d,"GeneratorFunction"),i.isGeneratorFunction=function(_){var I=typeof _=="function"&&_.constructor;return!!I&&(I===L||(I.displayName||I.name)==="GeneratorFunction")},i.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,q):(_.__proto__=q,p(_,d,"GeneratorFunction")),_.prototype=Object.create(oe),_},i.awrap=function(_){return{__await:_}},ae(z.prototype),p(z.prototype,l,function(){return this}),i.AsyncIterator=z,i.async=function(_,I,C,g,v){v===void 0&&(v=Promise);var N=new z(w(_,I,C,g),v);return i.isGeneratorFunction(I)?N:N.next().then(function(ee){return ee.done?ee.value:N.next()})},ae(oe),p(oe,d,"Generator"),p(oe,u,function(){return this}),p(oe,"toString",function(){return"[object Generator]"}),i.keys=function(_){var I=Object(_),C=[];for(var g in I)C.push(g);return C.reverse(),function v(){for(;C.length;){var N=C.pop();if(N in I)return v.value=N,v.done=!1,v}return v.done=!0,v}},i.values=M,S.prototype={constructor:S,reset:function(I){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(m),!I)for(var C in this)C.charAt(0)==="t"&&s.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var I=this.tryEntries[0].completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(I){if(this.done)throw I;var C=this;function g(me,xe){return ee.type="throw",ee.arg=I,C.next=me,xe&&(C.method="next",C.arg=n),!!xe}for(var v=this.tryEntries.length-1;v>=0;--v){var N=this.tryEntries[v],ee=N.completion;if(N.tryLoc==="root")return g("end");if(N.tryLoc<=this.prev){var ie=s.call(N,"catchLoc"),le=s.call(N,"finallyLoc");if(ie&&le){if(this.prev<N.catchLoc)return g(N.catchLoc,!0);if(this.prev<N.finallyLoc)return g(N.finallyLoc)}else if(ie){if(this.prev<N.catchLoc)return g(N.catchLoc,!0)}else{if(!le)throw Error("try statement without catch or finally");if(this.prev<N.finallyLoc)return g(N.finallyLoc)}}}},abrupt:function(I,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&s.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var N=v;break}}N&&(I==="break"||I==="continue")&&N.tryLoc<=C&&C<=N.finallyLoc&&(N=null);var ee=N?N.completion:{};return ee.type=I,ee.arg=C,N?(this.method="next",this.next=N.finallyLoc,k):this.complete(ee)},complete:function(I,C){if(I.type==="throw")throw I.arg;return I.type==="break"||I.type==="continue"?this.next=I.arg:I.type==="return"?(this.rval=this.arg=I.arg,this.method="return",this.next="end"):I.type==="normal"&&C&&(this.next=C),k},finish:function(I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===I)return this.complete(g.completion,g.afterLoc),m(g),k}},catch:function(I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===I){var v=g.completion;if(v.type==="throw"){var N=v.arg;m(g)}return N}}throw Error("illegal catch attempt")},delegateYield:function(I,C,g){return this.delegate={iterator:M(I),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),k}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(ff)),ff.exports}var hf,pm;function y3(){if(pm)return hf;pm=1;var e=v3()();hf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return hf}var pf={exports:{}},mm;function w3(){return mm||(mm=1,function(e){function t(n,i,o,s,a,c,u){try{var l=n[c](u),d=l.value}catch(p){return void o(p)}l.done?i(d):Promise.resolve(d).then(s,a)}function r(n){return function(){var i=this,o=arguments;return new Promise(function(s,a){var c=n.apply(i,o);function u(d){t(c,s,a,u,l,"next",d)}function l(d){t(c,s,a,u,l,"throw",d)}u(void 0)})}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(pf)),pf.exports}var mf={exports:{}},gf={exports:{}},vf={exports:{}},gm;function b3(){return gm||(gm=1,function(e){var t=Ec().default;function r(n,i){if(t(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var s=o.call(n,i||"default");if(t(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(vf)),vf.exports}var vm;function x3(){return vm||(vm=1,function(e){var t=Ec().default,r=b3();function n(i){var o=r(i,"string");return t(o)=="symbol"?o:o+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(gf)),gf.exports}var ym;function S3(){return ym||(ym=1,function(e){var t=x3();function r(n,i,o){return(i=t(i))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(mf)),mf.exports}var yf,wm;function E3(){if(wm)return yf;wm=1;const e=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return yf=t=>!e.has(t&&t.code),yf}var ca=g3;Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.isNetworkError=xf,Qr.isRetryableError=Cc,Qr.isSafeRequestError=Em,Qr.isIdempotentRequestError=Sf,Qr.isNetworkOrIdempotentRequestError=Ef,Qr.exponentialDelay=_m,Qr.default=bo,Qr.DEFAULT_OPTIONS=Qr.namespace=void 0;var _c=ca(y3()),_3=ca(Ec()),bm=ca(w3()),C3=ca(S3()),M3=ca(E3());function xm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xm(Object(r),!0).forEach(function(n){(0,C3.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var bf="axios-retry";Qr.namespace=bf;function xf(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,M3.default)(e)}var Sm=["get","head","options"],A3=Sm.concat(["put","delete"]);function Cc(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function Em(e){return e.config?Cc(e)&&Sm.indexOf(e.config.method)!==-1:!1}function Sf(e){return e.config?Cc(e)&&A3.indexOf(e.config.method)!==-1:!1}function Ef(e){return xf(e)||Sf(e)}function T3(){return 0}function _m(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,r=Math.pow(2,e)*t,n=r*.2*Math.random();return r+n}var Cm={retries:3,retryCondition:Ef,retryDelay:T3,shouldResetTimeout:!1,onRetry:function(){}};Qr.DEFAULT_OPTIONS=Cm;function I3(e,t){return wf(wf(wf({},Cm),t),e[bf])}function Mm(e,t){var r=I3(e,t);return r.retryCount=r.retryCount||0,e[bf]=r,r}function O3(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}function P3(e,t){return _f.apply(this,arguments)}function _f(){return _f=(0,bm.default)(_c.default.mark(function e(t,r){var n,i,o,s;return _c.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,o=t.retryCount<n&&i(r),(0,_3.default)(o)!=="object"){c.next=13;break}return c.prev=3,c.next=6,o;case 6:return s=c.sent,c.abrupt("return",s!==!1);case 10:return c.prev=10,c.t0=c.catch(3),c.abrupt("return",!1);case 13:return c.abrupt("return",o);case 14:case"end":return c.stop()}},e,null,[[3,10]])})),_f.apply(this,arguments)}function bo(e,t){var r=e.interceptors.request.use(function(i){var o=Mm(i,t);return o.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,bm.default)(_c.default.mark(function o(s){var a,c,u,l,d,p,w,b;return _c.default.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(a=s.config,a){T.next=3;break}return T.abrupt("return",Promise.reject(s));case 3:return c=Mm(a,t),T.next=6,P3(c,s);case 6:if(!T.sent){T.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,d=c.onRetry,p=u(c.retryCount,s),O3(e,a),!(!l&&a.timeout&&c.lastRequestTime)){T.next=17;break}if(w=Date.now()-c.lastRequestTime,b=a.timeout-w-p,!(b<=0)){T.next=16;break}return T.abrupt("return",Promise.reject(s));case 16:a.timeout=b;case 17:return a.transformRequest=[function(O){return O}],T.next=20,d(c.retryCount,s,a);case 20:return T.abrupt("return",new Promise(function(O){return setTimeout(function(){return O(e(a))},p)}));case 21:return T.abrupt("return",Promise.reject(s));case 22:case"end":return T.stop()}},o)}));return function(o){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}bo.isNetworkError=xf,bo.isSafeRequestError=Em,bo.isIdempotentRequestError=Sf,bo.isNetworkOrIdempotentRequestError=Ef,bo.exponentialDelay=_m,bo.isRetryableError=Cc;const Am=Qr.default;lf.exports=Am,lf.exports.default=Am;var R3=lf.exports,Mc={},Zo=null;typeof WebSocket<"u"?Zo=WebSocket:typeof MozWebSocket<"u"?Zo=MozWebSocket:typeof Dr<"u"?Zo=Dr.WebSocket||Dr.MozWebSocket:typeof window<"u"?Zo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Zo=self.WebSocket||self.MozWebSocket);var N3=Zo,j3=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.ResilientWebSocket=void 0;const k3=j3(N3),D3=3e4+3e3;class B3{constructor(t,r){vt(this,"endpoint");vt(this,"wsClient");vt(this,"wsUserClosed");vt(this,"wsFailedAttempts");vt(this,"pingTimeout");vt(this,"logger");vt(this,"onError");vt(this,"onMessage");vt(this,"onReconnect");this.endpoint=t,this.logger=r,this.wsFailedAttempts=0,this.onError=n=>{var i;(i=this.logger)==null||i.error(n)},this.wsUserClosed=!0,this.onMessage=()=>{},this.onReconnect=()=>{}}async send(t){var r,n,i;(r=this.logger)==null||r.info(`Sending ${t}`),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0?(n=this.logger)==null||n.error("Couldn't connect to the websocket server. Error callback is called."):(i=this.wsClient)==null||i.send(t)}async startWebSocket(){var t;this.wsClient===void 0&&((t=this.logger)==null||t.info("Creating Web Socket client"),this.wsClient=new k3.default(this.endpoint),this.wsUserClosed=!1,this.wsClient.onopen=()=>{this.wsFailedAttempts=0,this.wsClient.on!==void 0&&this.heartbeat()},this.wsClient.onerror=r=>{this.onError(r.error)},this.wsClient.onmessage=r=>{this.onMessage(r.data)},this.wsClient.onclose=async()=>{var r,n;if(this.pingTimeout!==void 0&&clearInterval(this.pingTimeout),this.wsUserClosed===!1){this.wsFailedAttempts+=1,this.wsClient=void 0;const i=L3(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await Tm(i),this.restartUnexpectedClosedWebsocket()}else(n=this.logger)==null||n.info("The connection has been closed successfully.")},this.wsClient.on!==void 0&&this.wsClient.on("ping",this.heartbeat.bind(this)))}heartbeat(){var t;(t=this.logger)==null||t.info("Heartbeat"),this.pingTimeout!==void 0&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n;(r=this.logger)==null||r.warn("Connection timed out. Reconnecting..."),(n=this.wsClient)==null||n.terminate(),this.restartUnexpectedClosedWebsocket()},D3)}async waitForMaybeReadyWebSocket(){let t=0;for(;this.wsClient!==void 0&&this.wsClient.readyState!==this.wsClient.OPEN;)if(t>5e3){this.wsClient.close();return}else t+=10,await Tm(10)}async restartUnexpectedClosedWebsocket(){var t;if(this.wsUserClosed!==!0){if(await this.startWebSocket(),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0){(t=this.logger)==null||t.error("Couldn't reconnect to websocket. Error callback is called.");return}this.onReconnect()}}closeWebSocket(){if(this.wsClient!==void 0){const t=this.wsClient;this.wsClient=void 0,t.close()}this.wsUserClosed=!0}}Mc.ResilientWebSocket=B3;async function Tm(e){return new Promise(t=>setTimeout(t,e))}function L3(e){return 2**e*100}var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.removeLeading0xIfExists=Xo.makeWebsocketUrl=void 0;function $3(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Xo.makeWebsocketUrl=$3;function F3(e){return e.startsWith("0x")?e.substring(2):e}Xo.removeLeading0xIfExists=F3;var Im=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sc,"__esModule",{value:!0}),sc.PriceServiceConnection=void 0;const Cf=Ll,U3=Im(lm),Om=Im(R3),V3=Mc,Mf=Xo;class z3{constructor(t,r){vt(this,"httpClient");vt(this,"priceFeedCallbacks");vt(this,"wsClient");vt(this,"wsEndpoint");vt(this,"logger");vt(this,"priceFeedRequestConfig");vt(this,"onWsError");var n,i,o;this.httpClient=U3.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,Om.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:Om.default.exponentialDelay}),this.priceFeedRequestConfig={binary:(n=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:n.binary,verbose:((i=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:i.verbose)??(r==null?void 0:r.verbose),allowOutOfOrder:(o=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:o.allowOutOfOrder},this.priceFeedCallbacks=new Map,this.logger=(r==null?void 0:r.logger)||{trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error},this.onWsError=s=>{this.logger.error(s),typeof pn<"u"&&typeof pn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),pn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Mf.makeWebsocketUrl)(t)}async getLatestPriceFeeds(t){return t.length===0?[]:(await this.httpClient.get("/api/latest_price_feeds",{params:{ids:t,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}})).data.map(i=>Cf.PriceFeed.fromJson(i))}async getLatestVaas(t){return(await this.httpClient.get("/api/latest_vaas",{params:{ids:t}})).data}async getVaa(t,r){const n=await this.httpClient.get("/api/get_vaa",{params:{id:t,publish_time:r}});return[n.data.vaa,n.data.publishTime]}async getPriceFeed(t,r){const n=await this.httpClient.get("/api/get_price_feed",{params:{id:t,publish_time:r,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}});return Cf.PriceFeed.fromJson(n.data)}async getPriceFeedIds(){return(await this.httpClient.get("/api/price_feed_ids")).data}async subscribePriceFeedUpdates(t,r){var o;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(s=>(0,Mf.removeLeading0xIfExists)(s));const n=[];for(const s of t)this.priceFeedCallbacks.has(s)||(this.priceFeedCallbacks.set(s,new Set),n.push(s)),this.priceFeedCallbacks.get(s).add(r);const i={ids:n,type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};await((o=this.wsClient)==null?void 0:o.send(JSON.stringify(i)))}async unsubscribePriceFeedUpdates(t,r){var o;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(s=>(0,Mf.removeLeading0xIfExists)(s));const n=[];for(const s of t)if(this.priceFeedCallbacks.has(s)){let a=!1;r===void 0?(this.priceFeedCallbacks.delete(s),a=!0):(this.priceFeedCallbacks.get(s).delete(r),this.priceFeedCallbacks.get(s).size===0&&(this.priceFeedCallbacks.delete(s),a=!0)),a&&n.push(s)}const i={ids:n,type:"unsubscribe"};await((o=this.wsClient)==null?void 0:o.send(JSON.stringify(i))),this.priceFeedCallbacks.size===0&&this.closeWebSocket()}async startWebSocket(){if(this.wsEndpoint===void 0)throw new Error("Websocket endpoint is undefined.");this.wsClient=new V3.ResilientWebSocket(this.wsEndpoint,this.logger),this.wsClient.onError=this.onWsError,this.wsClient.onReconnect=()=>{var t;if(this.priceFeedCallbacks.size>0){const r={ids:Array.from(this.priceFeedCallbacks.keys()),type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};this.logger.info("Resubscribing to existing price feeds."),(t=this.wsClient)==null||t.send(JSON.stringify(r))}},this.wsClient.onMessage=t=>{this.logger.info(`Received message ${t.toString()}`);let r;try{r=JSON.parse(t.toString())}catch(n){this.logger.error(`Error parsing message ${t.toString()} as JSON.`),this.logger.error(n),this.onWsError(n);return}if(r.type==="response")r.status==="error"&&(this.logger.error(`Error response from the websocket server ${r.error}.`),this.onWsError(new Error(r.error)));else if(r.type==="price_update"){let n;try{n=Cf.PriceFeed.fromJson(r.price_feed)}catch(i){this.logger.error(`Error parsing price feeds from message ${t.toString()}.`),this.logger.error(i),this.onWsError(i);return}if(this.priceFeedCallbacks.has(n.id))for(const i of this.priceFeedCallbacks.get(n.id))i(n)}else this.logger.warn(`Ignoring unsupported server response ${t.toString()}.`)},await this.wsClient.startWebSocket()}closeWebSocket(){var t;(t=this.wsClient)==null||t.closeWebSocket(),this.wsClient=void 0,this.priceFeedCallbacks.clear()}}sc.PriceServiceConnection=z3,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=sc;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Ll;Object.defineProperty(e,"PriceFeedMetadata",{enumerable:!0,get:function(){return r.PriceFeedMetadata}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return r.PriceFeed}}),Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return r.Price}}),Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}})}(Bl),Object.defineProperty(oc,"__esModule",{value:!0}),oc.SuiPriceServiceConnection=void 0;const H3=Bl,q3=cc();class W3 extends H3.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>q3.Buffer.from(n,"base64"))}}oc.SuiPriceServiceConnection=W3;var Ac={};const G3=Zh(h4),Jo=Zh(o6);var Af=Object.defineProperty,K3=Object.getOwnPropertyDescriptor,Y3=Object.getOwnPropertyNames,Z3=Object.prototype.hasOwnProperty,X3=(e,t)=>{for(var r in t)Af(e,r,{get:t[r],enumerable:!0})},J3=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Y3(t))!Z3.call(e,i)&&i!==r&&Af(e,i,{get:()=>t[i],enumerable:!(n=K3(t,i))||n.enumerable});return e},Q3=e=>J3(Af({},"__esModule",{value:!0}),e),Pm={};X3(Pm,{SUI_ADDRESS_LENGTH:()=>Tf,isValidSuiAddress:()=>jm,isValidSuiObjectId:()=>rS,isValidTransactionDigest:()=>tS,normalizeStructTag:()=>km,normalizeSuiAddress:()=>Of,normalizeSuiObjectId:()=>iS,parseStructTag:()=>If});var Rm=Q3(Pm),Nm=Jo;const eS=32;function tS(e){try{return(0,Nm.fromBase58)(e).length===eS}catch{return!1}}const Tf=32;function jm(e){return oS(e)&&sS(e)===Tf}function rS(e){return jm(e)}function nS(e){return e.includes("::")?If(e):e}function If(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,o=n.includes("<")?(0,Nm.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(s=>nS(s.trim())):[];return{address:Of(t),module:r,name:i,typeParams:o}}function km(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?If(e):e,o=(i==null?void 0:i.length)>0?`<${i.map(s=>typeof s=="string"?s:km(s)).join(",")}>`:"";return`${t}::${r}::${n}${o}`}function Of(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Tf*2,"0")}`}function iS(e,t=!1){return Of(e,t)}function oS(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function sS(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Pf=Object.defineProperty,aS=Object.getOwnPropertyDescriptor,cS=Object.getOwnPropertyNames,uS=Object.prototype.hasOwnProperty,lS=(e,t)=>{for(var r in t)Pf(e,r,{get:t[r],enumerable:!0})},fS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cS(t))!uS.call(e,i)&&i!==r&&Pf(e,i,{get:()=>t[i],enumerable:!(n=aS(t,i))||n.enumerable});return e},dS=e=>fS(Pf({},"__esModule",{value:!0}),e),Dm={};lS(Dm,{TypeTagSerializer:()=>xo});var Bm=dS(Dm),hS=Jo,pS=Rm;const mS=/^vector<(.+)>$/,gS=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class xo{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(mS);if(n)return{vector:xo.parseFromStr(n[1],r)};const i=t.match(gS);if(i)return{struct:{address:r?(0,pS.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:xo.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,hS.splitGenericParameters)(t).map(n=>xo.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${xo.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(xo.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Rf=Object.defineProperty,vS=Object.getOwnPropertyDescriptor,yS=Object.getOwnPropertyNames,wS=Object.prototype.hasOwnProperty,bS=(e,t)=>{for(var r in t)Rf(e,r,{get:t[r],enumerable:!0})},xS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yS(t))!wS.call(e,i)&&i!==r&&Rf(e,i,{get:()=>t[i],enumerable:!(n=vS(t,i))||n.enumerable});return e},SS=e=>xS(Rf({},"__esModule",{value:!0}),e),Lm={};bS(Lm,{Address:()=>Vn,AppId:()=>rg,Argument:()=>zn,CallArg:()=>Hm,Command:()=>Wm,CompressedSignature:()=>og,GasData:()=>Xm,Intent:()=>ng,IntentMessage:()=>ig,IntentScope:()=>eg,IntentVersion:()=>tg,MultiSig:()=>CS,MultiSigPkMap:()=>ag,MultiSigPublicKey:()=>cg,ObjectArg:()=>zm,ObjectDigest:()=>Um,PasskeyAuthenticator:()=>AS,ProgrammableMoveCall:()=>qm,ProgrammableTransaction:()=>Gm,PublicKey:()=>sg,SenderSignedData:()=>MS,SenderSignedTransaction:()=>lg,SharedObjectRef:()=>Vm,StructTag:()=>Zm,SuiObjectRef:()=>Tc,TransactionData:()=>Qm,TransactionDataV1:()=>Jm,TransactionExpiration:()=>Ym,TransactionKind:()=>Km,TypeTag:()=>jf,base64String:()=>ug});var $m=SS(Lm),ue=Jo,ua=Rm,Fm=Bm;function ES(e){return ue.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function _S(e){return ue.bcs.enum("Option",{None:null,Some:e})}const Vn=ue.bcs.bytes(ua.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,ue.toHex)(e);if(!t||!(0,ua.isValidSuiAddress)((0,ua.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,ue.fromHex)((0,ua.normalizeSuiAddress)(e)):e,output:e=>(0,ua.normalizeSuiAddress)((0,ue.toHex)(e))}),Um=ue.bcs.vector(ue.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,ue.fromBase58)(e),output:e=>(0,ue.toBase58)(new Uint8Array(e)),validate:e=>{if((0,ue.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Tc=ue.bcs.struct("SuiObjectRef",{objectId:Vn,version:ue.bcs.u64(),digest:Um}),Vm=ue.bcs.struct("SharedObjectRef",{objectId:Vn,initialSharedVersion:ue.bcs.u64(),mutable:ue.bcs.bool()}),zm=ue.bcs.enum("ObjectArg",{ImmOrOwnedObject:Tc,SharedObject:Vm,Receiving:Tc}),Hm=ue.bcs.enum("CallArg",{Pure:ue.bcs.struct("Pure",{bytes:ue.bcs.vector(ue.bcs.u8()).transform({input:e=>typeof e=="string"?(0,ue.fromBase64)(e):e,output:e=>(0,ue.toBase64)(new Uint8Array(e))})}),Object:zm}),Nf=ue.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:ue.bcs.lazy(()=>Nf),struct:ue.bcs.lazy(()=>Zm),u16:null,u32:null,u256:null}),jf=Nf.transform({input:e=>typeof e=="string"?Fm.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>Fm.TypeTagSerializer.tagToString(e)}),zn=ue.bcs.enum("Argument",{GasCoin:null,Input:ue.bcs.u16(),Result:ue.bcs.u16(),NestedResult:ue.bcs.tuple([ue.bcs.u16(),ue.bcs.u16()])}),qm=ue.bcs.struct("ProgrammableMoveCall",{package:Vn,module:ue.bcs.string(),function:ue.bcs.string(),typeArguments:ue.bcs.vector(jf),arguments:ue.bcs.vector(zn)}),Wm=ue.bcs.enum("Command",{MoveCall:qm,TransferObjects:ue.bcs.struct("TransferObjects",{objects:ue.bcs.vector(zn),address:zn}),SplitCoins:ue.bcs.struct("SplitCoins",{coin:zn,amounts:ue.bcs.vector(zn)}),MergeCoins:ue.bcs.struct("MergeCoins",{destination:zn,sources:ue.bcs.vector(zn)}),Publish:ue.bcs.struct("Publish",{modules:ue.bcs.vector(ue.bcs.vector(ue.bcs.u8()).transform({input:e=>typeof e=="string"?(0,ue.fromBase64)(e):e,output:e=>(0,ue.toBase64)(new Uint8Array(e))})),dependencies:ue.bcs.vector(Vn)}),MakeMoveVec:ue.bcs.struct("MakeMoveVec",{type:_S(jf).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:ue.bcs.vector(zn)}),Upgrade:ue.bcs.struct("Upgrade",{modules:ue.bcs.vector(ue.bcs.vector(ue.bcs.u8()).transform({input:e=>typeof e=="string"?(0,ue.fromBase64)(e):e,output:e=>(0,ue.toBase64)(new Uint8Array(e))})),dependencies:ue.bcs.vector(Vn),package:Vn,ticket:zn})}),Gm=ue.bcs.struct("ProgrammableTransaction",{inputs:ue.bcs.vector(Hm),commands:ue.bcs.vector(Wm)}),Km=ue.bcs.enum("TransactionKind",{ProgrammableTransaction:Gm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Ym=ue.bcs.enum("TransactionExpiration",{None:null,Epoch:ES()}),Zm=ue.bcs.struct("StructTag",{address:Vn,module:ue.bcs.string(),name:ue.bcs.string(),typeParams:ue.bcs.vector(Nf)}),Xm=ue.bcs.struct("GasData",{payment:ue.bcs.vector(Tc),owner:Vn,price:ue.bcs.u64(),budget:ue.bcs.u64()}),Jm=ue.bcs.struct("TransactionDataV1",{kind:Km,sender:Vn,gasData:Xm,expiration:Ym}),Qm=ue.bcs.enum("TransactionData",{V1:Jm}),eg=ue.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),tg=ue.bcs.enum("IntentVersion",{V0:null}),rg=ue.bcs.enum("AppId",{Sui:null}),ng=ue.bcs.struct("Intent",{scope:eg,version:tg,appId:rg});function ig(e){return ue.bcs.struct(`IntentMessage<${e.name}>`,{intent:ng,value:e})}const og=ue.bcs.enum("CompressedSignature",{ED25519:ue.bcs.fixedArray(64,ue.bcs.u8()),Secp256k1:ue.bcs.fixedArray(64,ue.bcs.u8()),Secp256r1:ue.bcs.fixedArray(64,ue.bcs.u8()),ZkLogin:ue.bcs.vector(ue.bcs.u8())}),sg=ue.bcs.enum("PublicKey",{ED25519:ue.bcs.fixedArray(32,ue.bcs.u8()),Secp256k1:ue.bcs.fixedArray(33,ue.bcs.u8()),Secp256r1:ue.bcs.fixedArray(33,ue.bcs.u8()),ZkLogin:ue.bcs.vector(ue.bcs.u8())}),ag=ue.bcs.struct("MultiSigPkMap",{pubKey:sg,weight:ue.bcs.u8()}),cg=ue.bcs.struct("MultiSigPublicKey",{pk_map:ue.bcs.vector(ag),threshold:ue.bcs.u16()}),CS=ue.bcs.struct("MultiSig",{sigs:ue.bcs.vector(og),bitmap:ue.bcs.u16(),multisig_pk:cg}),ug=ue.bcs.vector(ue.bcs.u8()).transform({input:e=>typeof e=="string"?(0,ue.fromBase64)(e):e,output:e=>(0,ue.toBase64)(new Uint8Array(e))}),lg=ue.bcs.struct("SenderSignedTransaction",{intentMessage:ig(Qm),txSignatures:ue.bcs.vector(ug)}),MS=ue.bcs.vector(lg,{name:"SenderSignedData"}),AS=ue.bcs.struct("PasskeyAuthenticator",{authenticatorData:ue.bcs.vector(ue.bcs.u8()),clientDataJson:ue.bcs.string(),userSignature:ue.bcs.vector(ue.bcs.u8())});var kf=Object.defineProperty,TS=Object.getOwnPropertyDescriptor,IS=Object.getOwnPropertyNames,OS=Object.prototype.hasOwnProperty,PS=(e,t)=>{for(var r in t)kf(e,r,{get:t[r],enumerable:!0})},RS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IS(t))!OS.call(e,i)&&i!==r&&kf(e,i,{get:()=>t[i],enumerable:!(n=TS(t,i))||n.enumerable});return e},NS=e=>RS(kf({},"__esModule",{value:!0}),e),fg={};PS(fg,{TransactionEffects:()=>GS});var jS=NS(fg),pe=Jo,Lt=$m;const kS=pe.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:pe.bcs.struct("UnableToFetchPackage",{packageId:Lt.Address}),NotAPackage:pe.bcs.struct("NotAPackage",{objectId:Lt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:pe.bcs.struct("DigestDoesNotMatch",{digest:pe.bcs.vector(pe.bcs.u8())}),UnknownUpgradePolicy:pe.bcs.struct("UnknownUpgradePolicy",{policy:pe.bcs.u8()}),PackageIDDoesNotMatch:pe.bcs.struct("PackageIDDoesNotMatch",{packageId:Lt.Address,ticketId:Lt.Address})}),DS=pe.bcs.struct("ModuleId",{address:Lt.Address,name:pe.bcs.string()}),dg=pe.bcs.struct("MoveLocation",{module:DS,function:pe.bcs.u16(),instruction:pe.bcs.u16(),functionName:pe.bcs.option(pe.bcs.string())}),BS=pe.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:pe.bcs.struct("IndexOutOfBounds",{idx:pe.bcs.u16()}),SecondaryIndexOutOfBounds:pe.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:pe.bcs.u16(),secondaryIdx:pe.bcs.u16()}),InvalidResultArity:pe.bcs.struct("InvalidResultArity",{resultIdx:pe.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),LS=pe.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),$S=pe.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:pe.bcs.struct("MoveObjectTooBig",{objectSize:pe.bcs.u64(),maxObjectSize:pe.bcs.u64()}),MovePackageTooBig:pe.bcs.struct("MovePackageTooBig",{objectSize:pe.bcs.u64(),maxObjectSize:pe.bcs.u64()}),CircularObjectOwnership:pe.bcs.struct("CircularObjectOwnership",{object:Lt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:pe.bcs.option(dg),MoveAbort:pe.bcs.tuple([dg,pe.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:pe.bcs.struct("CommandArgumentError",{argIdx:pe.bcs.u16(),kind:BS}),TypeArgumentError:pe.bcs.struct("TypeArgumentError",{argumentIdx:pe.bcs.u16(),kind:LS}),UnusedValueWithoutDrop:pe.bcs.struct("UnusedValueWithoutDrop",{resultIdx:pe.bcs.u16(),secondaryIdx:pe.bcs.u16()}),InvalidPublicFunctionReturnType:pe.bcs.struct("InvalidPublicFunctionReturnType",{idx:pe.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:pe.bcs.struct("EffectsTooLarge",{currentSize:pe.bcs.u64(),maxSize:pe.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:pe.bcs.struct("PackageUpgradeError",{upgradeError:kS}),WrittenObjectsTooLarge:pe.bcs.struct("WrittenObjectsTooLarge",{currentSize:pe.bcs.u64(),maxSize:pe.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:pe.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:pe.bcs.vector(Lt.Address)}),AddressDeniedForCoin:pe.bcs.struct("AddressDeniedForCoin",{address:Lt.Address,coinType:pe.bcs.string()}),CoinTypeGlobalPause:pe.bcs.struct("CoinTypeGlobalPause",{coinType:pe.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),hg=pe.bcs.enum("ExecutionStatus",{Success:null,Failed:pe.bcs.struct("ExecutionFailed",{error:$S,command:pe.bcs.option(pe.bcs.u64())})}),pg=pe.bcs.struct("GasCostSummary",{computationCost:pe.bcs.u64(),storageCost:pe.bcs.u64(),storageRebate:pe.bcs.u64(),nonRefundableStorageFee:pe.bcs.u64()}),Qo=pe.bcs.enum("Owner",{AddressOwner:Lt.Address,ObjectOwner:Lt.Address,Shared:pe.bcs.struct("Shared",{initialSharedVersion:pe.bcs.u64()}),Immutable:null}),FS=pe.bcs.struct("TransactionEffectsV1",{status:hg,executedEpoch:pe.bcs.u64(),gasUsed:pg,modifiedAtVersions:pe.bcs.vector(pe.bcs.tuple([Lt.Address,pe.bcs.u64()])),sharedObjects:pe.bcs.vector(Lt.SuiObjectRef),transactionDigest:Lt.ObjectDigest,created:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,Qo])),mutated:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,Qo])),unwrapped:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,Qo])),deleted:pe.bcs.vector(Lt.SuiObjectRef),unwrappedThenDeleted:pe.bcs.vector(Lt.SuiObjectRef),wrapped:pe.bcs.vector(Lt.SuiObjectRef),gasObject:pe.bcs.tuple([Lt.SuiObjectRef,Qo]),eventsDigest:pe.bcs.option(Lt.ObjectDigest),dependencies:pe.bcs.vector(Lt.ObjectDigest)}),Df=pe.bcs.tuple([pe.bcs.u64(),Lt.ObjectDigest]),US=pe.bcs.enum("ObjectIn",{NotExist:null,Exist:pe.bcs.tuple([Df,Qo])}),VS=pe.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:pe.bcs.tuple([Lt.ObjectDigest,Qo]),PackageWrite:Df}),zS=pe.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),HS=pe.bcs.struct("EffectsObjectChange",{inputState:US,outputState:VS,idOperation:zS}),qS=pe.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Df,MutateDeleted:pe.bcs.u64(),ReadDeleted:pe.bcs.u64(),Cancelled:pe.bcs.u64(),PerEpochConfig:null}),WS=pe.bcs.struct("TransactionEffectsV2",{status:hg,executedEpoch:pe.bcs.u64(),gasUsed:pg,transactionDigest:Lt.ObjectDigest,gasObjectIndex:pe.bcs.option(pe.bcs.u32()),eventsDigest:pe.bcs.option(Lt.ObjectDigest),dependencies:pe.bcs.vector(Lt.ObjectDigest),lamportVersion:pe.bcs.u64(),changedObjects:pe.bcs.vector(pe.bcs.tuple([Lt.Address,HS])),unchangedSharedObjects:pe.bcs.vector(pe.bcs.tuple([Lt.Address,qS])),auxDataDigest:pe.bcs.option(Lt.ObjectDigest)}),GS=pe.bcs.enum("TransactionEffects",{V1:FS,V2:WS});var Bf=Object.defineProperty,KS=Object.getOwnPropertyDescriptor,YS=Object.getOwnPropertyNames,ZS=Object.prototype.hasOwnProperty,XS=(e,t)=>{for(var r in t)Bf(e,r,{get:t[r],enumerable:!0})},JS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YS(t))!ZS.call(e,i)&&i!==r&&Bf(e,i,{get:()=>t[i],enumerable:!(n=KS(t,i))||n.enumerable});return e},QS=e=>JS(Bf({},"__esModule",{value:!0}),e),mg={};XS(mg,{BcsType:()=>nE.BcsType,TypeTagSerializer:()=>rE.TypeTagSerializer,bcs:()=>iE});var eE=QS(mg),Hn=Jo,$t=$m,tE=jS,rE=Bm,nE=Jo;const iE={...Hn.bcs,U8:Hn.bcs.u8(),U16:Hn.bcs.u16(),U32:Hn.bcs.u32(),U64:Hn.bcs.u64(),U128:Hn.bcs.u128(),U256:Hn.bcs.u256(),ULEB128:Hn.bcs.uleb128(),Bool:Hn.bcs.bool(),String:Hn.bcs.string(),Address:$t.Address,AppId:$t.AppId,Argument:$t.Argument,CallArg:$t.CallArg,CompressedSignature:$t.CompressedSignature,GasData:$t.GasData,Intent:$t.Intent,IntentMessage:$t.IntentMessage,IntentScope:$t.IntentScope,IntentVersion:$t.IntentVersion,MultiSig:$t.MultiSig,MultiSigPkMap:$t.MultiSigPkMap,MultiSigPublicKey:$t.MultiSigPublicKey,ObjectArg:$t.ObjectArg,ObjectDigest:$t.ObjectDigest,ProgrammableMoveCall:$t.ProgrammableMoveCall,ProgrammableTransaction:$t.ProgrammableTransaction,PublicKey:$t.PublicKey,SenderSignedData:$t.SenderSignedData,SenderSignedTransaction:$t.SenderSignedTransaction,SharedObjectRef:$t.SharedObjectRef,StructTag:$t.StructTag,SuiObjectRef:$t.SuiObjectRef,Command:$t.Command,TransactionData:$t.TransactionData,TransactionDataV1:$t.TransactionDataV1,TransactionExpiration:$t.TransactionExpiration,TransactionKind:$t.TransactionKind,TypeTag:$t.TypeTag,TransactionEffects:tE.TransactionEffects,PasskeyAuthenticator:$t.PasskeyAuthenticator};Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.SuiPythClient=void 0;const Ic=G3,es=eE,oE=cc(),Lf=16*1024;class sE{constructor(t,r,n){vt(this,"provider");vt(this,"pythStateId");vt(this,"wormholeStateId");vt(this,"pythPackageId");vt(this,"wormholePackageId");vt(this,"priceTableInfo");vt(this,"priceFeedObjectIdCache",new Map);vt(this,"baseUpdateFee");this.provider=t,this.pythStateId=r,this.wormholeStateId=n,this.pythPackageId=void 0,this.wormholePackageId=void 0}async getBaseUpdateFee(){if(this.baseUpdateFee===void 0){const t=await this.provider.getObject({id:this.pythStateId,options:{showContent:!0}});if(!t.data||!t.data.content||t.data.content.dataType!=="moveObject")throw new Error("Unable to fetch pyth state object");this.baseUpdateFee=t.data.content.fields.base_update_fee}return this.baseUpdateFee}async getPackageId(t){const r=await this.provider.getObject({id:t,options:{showContent:!0}}).then(n=>{var i,o,s;if(((o=(i=n.data)==null?void 0:i.content)==null?void 0:o.dataType)=="moveObject")return n.data.content.fields;throw console.log((s=n.data)==null?void 0:s.content),new Error(`Cannot fetch package id for object ${t}`)});if("upgrade_cap"in r)return r.upgrade_cap.fields.package;throw new Error("upgrade_cap not found")}async verifyVaas(t,r){const n=await this.getWormholePackageId(),i=[];for(const o of t){const[s]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(es.bcs.vector(es.bcs.U8).serialize(Array.from(o),{maxSize:Lf}).toBytes()),r.object(Ic.SUI_CLOCK_OBJECT_ID)]});i.push(s)}return i}async updatePriceFeeds(t,r,n){const i=await this.getPythPackageId();let o;if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const s=this.extractVaaBytesFromAccumulatorMessage(r[0]),a=await this.verifyVaas([s],t);[o]=t.moveCall({target:`${i}::pyth::create_authenticated_price_infos_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(es.bcs.vector(es.bcs.U8).serialize(Array.from(r[0]),{maxSize:Lf}).toBytes()),a[0],t.object(Ic.SUI_CLOCK_OBJECT_ID)]});const c=[],u=await this.getBaseUpdateFee(),l=t.splitCoins(t.gas,n.map(()=>t.pure.u64(u)));let d=0;for(const p of n){const w=await this.getPriceFeedObjectId(p);if(!w)throw new Error(`Price feed ${p} not found, please create it first`);c.push(w),[o]=t.moveCall({target:`${i}::pyth::update_single_price_feed`,arguments:[t.object(this.pythStateId),o,t.object(w),l[d],t.object(Ic.SUI_CLOCK_OBJECT_ID)]}),d++}return t.moveCall({target:`${i}::hot_potato_vector::destroy`,arguments:[o],typeArguments:[`${i}::price_info::PriceInfo`]}),c}async createPriceFeed(t,r){const n=await this.getPythPackageId();if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const i=this.extractVaaBytesFromAccumulatorMessage(r[0]),o=await this.verifyVaas([i],t);t.moveCall({target:`${n}::pyth::create_price_feeds_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(es.bcs.vector(es.bcs.U8).serialize(Array.from(r[0]),{maxSize:Lf}).toBytes()),o[0],t.object(Ic.SUI_CLOCK_OBJECT_ID)]})}async getWormholePackageId(){return this.wormholePackageId||(this.wormholePackageId=await this.getPackageId(this.wormholeStateId)),this.wormholePackageId}async getPythPackageId(){return this.pythPackageId||(this.pythPackageId=await this.getPackageId(this.pythStateId)),this.pythPackageId}async getPriceFeedObjectId(t){const r=t.replace("0x","");if(!this.priceFeedObjectIdCache.has(r)){const{id:n,fieldType:i}=await this.getPriceTableInfo(),o=await this.provider.getDynamicFieldObject({parentId:n,name:{type:`${i}::price_identifier::PriceIdentifier`,value:{bytes:Array.from(oE.Buffer.from(r,"hex"))}}});if(!o.data||!o.data.content)return;if(o.data.content.dataType!=="moveObject")throw new Error("Price feed type mismatch");this.priceFeedObjectIdCache.set(r,o.data.content.fields.value)}return this.priceFeedObjectIdCache.get(r)}async getPriceTableInfo(){if(this.priceTableInfo===void 0){const t=await this.provider.getDynamicFieldObject({parentId:this.pythStateId,name:{type:"vector<u8>",value:"price_info"}});if(!t.data||!t.data.type)throw new Error("Price Table not found, contract may not be initialized");let r=t.data.type.replace("0x2::table::Table<","");r=r.replace("::price_identifier::PriceIdentifier, 0x2::object::ID>",""),this.priceTableInfo={id:t.data.objectId,fieldType:r}}return this.priceTableInfo}extractVaaBytesFromAccumulatorMessage(t){const n=7+t.readUint8(6)+1,i=t.readUint16BE(n),o=n+2;return t.subarray(o,o+i)}}Ac.SuiPythClient=sE,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=oc;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Ac;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=Bl;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(Dl);var aE=Object.create,$f=Object.defineProperty,cE=Object.defineProperties,uE=Object.getOwnPropertyDescriptor,lE=Object.getOwnPropertyDescriptors,gg=Object.getOwnPropertyNames,vg=Object.getOwnPropertySymbols,fE=Object.getPrototypeOf,yg=Object.prototype.hasOwnProperty,dE=Object.prototype.propertyIsEnumerable,wg=(e,t,r)=>t in e?$f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hE=(e,t)=>{for(var r in t||(t={}))yg.call(t,r)&&wg(e,r,t[r]);if(vg)for(var r of vg(t))dE.call(t,r)&&wg(e,r,t[r]);return e},pE=(e,t)=>cE(e,lE(t)),mE=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),gE=(e,t)=>function(){return t||(0,e[gg(e)[0]])((t={exports:{}}).exports,t),t.exports},vE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gg(t))!yg.call(e,i)&&i!==r&&$f(e,i,{get:()=>t[i],enumerable:!(n=uE(t,i))||n.enumerable});return e},ts=(e,t,r)=>(r=e!=null?aE(fE(e)):{},vE(!e||!e.__esModule?$f(r,"default",{value:e,enumerable:!0}):r,e)),pt=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{a(r.next(c))}catch(u){i(u)}},s=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,s);a((r=r.apply(e,t)).next())}),rs=gE({"node_modules/bn.js/lib/bn.js"(e,t){(function(r,n){function i(h,f){if(!h)throw new Error(f||"Assertion failed")}function o(h,f){h.super_=f;var m=function(){};m.prototype=f.prototype,h.prototype=new m,h.prototype.constructor=h}function s(h,f,m){if(s.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(h||0,f||10,m||"be"))}typeof r=="object"?r.exports=s:n.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=mE("buffer").Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,m){return f.cmp(m)>0?f:m},s.min=function(f,m){return f.cmp(m)<0?f:m},s.prototype._init=function(f,m,S){if(typeof f=="number")return this._initNumber(f,m,S);if(typeof f=="object")return this._initArray(f,m,S);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var M=0;f[0]==="-"&&(M++,this.negative=1),M<f.length&&(m===16?this._parseHex(f,M,S):(this._parseBase(f,m,M),S==="le"&&this._initArray(this.toArray(),m,S)))},s.prototype._initNumber=function(f,m,S){f<0&&(this.negative=1,f=-f),f<67108864?(this.words=[f&67108863],this.length=1):f<4503599627370496?(this.words=[f&67108863,f/67108864&67108863],this.length=2):(i(f<9007199254740992),this.words=[f&67108863,f/67108864&67108863,1],this.length=3),S==="le"&&this._initArray(this.toArray(),m,S)},s.prototype._initArray=function(f,m,S){if(i(typeof f.length=="number"),f.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(f.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var _,I,C=0;if(S==="be")for(M=f.length-1,_=0;M>=0;M-=3)I=f[M]|f[M-1]<<8|f[M-2]<<16,this.words[_]|=I<<C&67108863,this.words[_+1]=I>>>26-C&67108863,C+=24,C>=26&&(C-=26,_++);else if(S==="le")for(M=0,_=0;M<f.length;M+=3)I=f[M]|f[M+1]<<8|f[M+2]<<16,this.words[_]|=I<<C&67108863,this.words[_+1]=I>>>26-C&67108863,C+=24,C>=26&&(C-=26,_++);return this._strip()};function c(h,f){var m=h.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;i(!1,"Invalid character in "+h)}function u(h,f,m){var S=c(h,m);return m-1>=f&&(S|=c(h,m-1)<<4),S}s.prototype._parseHex=function(f,m,S){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var _=0,I=0,C;if(S==="be")for(M=f.length-1;M>=m;M-=2)C=u(f,m,M)<<_,this.words[I]|=C&67108863,_>=18?(_-=18,I+=1,this.words[I]|=C>>>26):_+=8;else{var g=f.length-m;for(M=g%2===0?m+1:m;M<f.length;M+=2)C=u(f,m,M)<<_,this.words[I]|=C&67108863,_>=18?(_-=18,I+=1,this.words[I]|=C>>>26):_+=8}this._strip()};function l(h,f,m,S){for(var M=0,_=0,I=Math.min(h.length,m),C=f;C<I;C++){var g=h.charCodeAt(C)-48;M*=S,g>=49?_=g-49+10:g>=17?_=g-17+10:_=g,i(g>=0&&_<S,"Invalid character"),M+=_}return M}s.prototype._parseBase=function(f,m,S){this.words=[0],this.length=1;for(var M=0,_=1;_<=67108863;_*=m)M++;M--,_=_/m|0;for(var I=f.length-S,C=I%M,g=Math.min(I,I-C)+S,v=0,N=S;N<g;N+=M)v=l(f,N,N+M,m),this.imuln(_),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(f,N,f.length,m),N=0;N<C;N++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(f){f.words=new Array(this.length);for(var m=0;m<this.length;m++)f.words[m]=this.words[m];f.length=this.length,f.negative=this.negative,f.red=this.red};function d(h,f){h.words=f.words,h.length=f.length,h.negative=f.negative,h.red=f.red}if(s.prototype._move=function(f){d(f,this)},s.prototype.clone=function(){var f=new s(null);return this.copy(f),f},s.prototype._expand=function(f){for(;this.length<f;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,m){f=f||10,m=m|0||1;var S;if(f===16||f==="hex"){S="";for(var M=0,_=0,I=0;I<this.length;I++){var C=this.words[I],g=((C<<M|_)&16777215).toString(16);_=C>>>24-M&16777215,M+=2,M>=26&&(M-=26,I--),_!==0||I!==this.length-1?S=w[6-g.length]+g+S:S=g+S}for(_!==0&&(S=_.toString(16)+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(f===(f|0)&&f>=2&&f<=36){var v=b[f],N=y[f];S="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var ie=ee.modrn(N).toString(f);ee=ee.idivn(N),ee.isZero()?S=ie+S:S=w[v-ie.length]+ie+S}for(this.isZero()&&(S="0"+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(f,m){return this.toArrayLike(a,f,m)}),s.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var T=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};s.prototype.toArrayLike=function(f,m,S){this._strip();var M=this.byteLength(),_=S||Math.max(1,M);i(M<=_,"byte array longer than desired length"),i(_>0,"Requested array length <= 0");var I=T(f,_),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](I,M),I},s.prototype._toArrayLikeLE=function(f,m){for(var S=0,M=0,_=0,I=0;_<this.length;_++){var C=this.words[_]<<I|M;f[S++]=C&255,S<f.length&&(f[S++]=C>>8&255),S<f.length&&(f[S++]=C>>16&255),I===6?(S<f.length&&(f[S++]=C>>24&255),M=0,I=0):(M=C>>>24,I+=2)}if(S<f.length)for(f[S++]=M;S<f.length;)f[S++]=0},s.prototype._toArrayLikeBE=function(f,m){for(var S=f.length-1,M=0,_=0,I=0;_<this.length;_++){var C=this.words[_]<<I|M;f[S--]=C&255,S>=0&&(f[S--]=C>>8&255),S>=0&&(f[S--]=C>>16&255),I===6?(S>=0&&(f[S--]=C>>24&255),M=0,I=0):(M=C>>>24,I+=2)}if(S>=0)for(f[S--]=M;S>=0;)f[S--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var m=f,S=0;return m>=4096&&(S+=13,m>>>=13),m>=64&&(S+=7,m>>>=7),m>=8&&(S+=4,m>>>=4),m>=2&&(S+=2,m>>>=2),S+m},s.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,S=0;return m&8191||(S+=13,m>>>=13),m&127||(S+=7,m>>>=7),m&15||(S+=4,m>>>=4),m&3||(S+=2,m>>>=2),m&1||S++,S},s.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function O(h){for(var f=new Array(h.bitLength()),m=0;m<f.length;m++){var S=m/26|0,M=m%26;f[m]=h.words[S]>>>M&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;m<this.length;m++){var S=this._zeroBits(this.words[m]);if(f+=S,S!==26)break}return f},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(f){return this.negative!==0?this.abs().inotn(f).iaddn(1):this.clone()},s.prototype.fromTwos=function(f){return this.testn(f-1)?this.notn(f).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(f){for(;this.length<f.length;)this.words[this.length++]=0;for(var m=0;m<f.length;m++)this.words[m]=this.words[m]|f.words[m];return this._strip()},s.prototype.ior=function(f){return i((this.negative|f.negative)===0),this.iuor(f)},s.prototype.or=function(f){return this.length>f.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var S=0;S<m.length;S++)this.words[S]=this.words[S]&f.words[S];return this.length=m.length,this._strip()},s.prototype.iand=function(f){return i((this.negative|f.negative)===0),this.iuand(f)},s.prototype.and=function(f){return this.length>f.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var m,S;this.length>f.length?(m=this,S=f):(m=f,S=this);for(var M=0;M<S.length;M++)this.words[M]=m.words[M]^S.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];return this.length=m.length,this._strip()},s.prototype.ixor=function(f){return i((this.negative|f.negative)===0),this.iuxor(f)},s.prototype.xor=function(f){return this.length>f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){i(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,S=f%26;this._expand(m),S>0&&m--;for(var M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return S>0&&(this.words[M]=~this.words[M]&67108863>>26-S),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,m){i(typeof f=="number"&&f>=0);var S=f/26|0,M=f%26;return this._expand(S+1),m?this.words[S]=this.words[S]|1<<M:this.words[S]=this.words[S]&~(1<<M),this._strip()},s.prototype.iadd=function(f){var m;if(this.negative!==0&&f.negative===0)return this.negative=0,m=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,m=this.isub(f),f.negative=1,m._normSign();var S,M;this.length>f.length?(S=this,M=f):(S=f,M=this);for(var _=0,I=0;I<M.length;I++)m=(S.words[I]|0)+(M.words[I]|0)+_,this.words[I]=m&67108863,_=m>>>26;for(;_!==0&&I<S.length;I++)m=(S.words[I]|0)+_,this.words[I]=m&67108863,_=m>>>26;if(this.length=S.length,_!==0)this.words[this.length]=_,this.length++;else if(S!==this)for(;I<S.length;I++)this.words[I]=S.words[I];return this},s.prototype.add=function(f){var m;return f.negative!==0&&this.negative===0?(f.negative=0,m=this.sub(f),f.negative^=1,m):f.negative===0&&this.negative!==0?(this.negative=0,m=f.sub(this),this.negative=1,m):this.length>f.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var S=this.cmp(f);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,_;S>0?(M=this,_=f):(M=f,_=this);for(var I=0,C=0;C<_.length;C++)m=(M.words[C]|0)-(_.words[C]|0)+I,I=m>>26,this.words[C]=m&67108863;for(;I!==0&&C<M.length;C++)m=(M.words[C]|0)+I,I=m>>26,this.words[C]=m&67108863;if(I===0&&C<M.length&&M!==this)for(;C<M.length;C++)this.words[C]=M.words[C];return this.length=Math.max(this.length,C),M!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function R(h,f,m){m.negative=f.negative^h.negative;var S=h.length+f.length|0;m.length=S,S=S-1|0;var M=h.words[0]|0,_=f.words[0]|0,I=M*_,C=I&67108863,g=I/67108864|0;m.words[0]=C;for(var v=1;v<S;v++){for(var N=g>>>26,ee=g&67108863,ie=Math.min(v,f.length-1),le=Math.max(0,v-h.length+1);le<=ie;le++){var me=v-le|0;M=h.words[me]|0,_=f.words[le]|0,I=M*_+ee,N+=I/67108864|0,ee=I&67108863}m.words[v]=ee|0,g=N|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var k=function(f,m,S){var M=f.words,_=m.words,I=S.words,C=0,g,v,N,ee=M[0]|0,ie=ee&8191,le=ee>>>13,me=M[1]|0,xe=me&8191,be=me>>>13,Ve=M[2]|0,Le=Ve&8191,ft=Ve>>>13,dt=M[3]|0,je=dt&8191,mt=dt>>>13,we=M[4]|0,he=we&8191,Ce=we>>>13,Ue=M[5]|0,Ne=Ue&8191,Me=Ue>>>13,Te=M[6]|0,Be=Te&8191,ut=Te>>>13,lt=M[7]|0,ze=lt&8191,jt=lt>>>13,Et=M[8]|0,Ze=Et&8191,It=Et>>>13,Ft=M[9]|0,Qe=Ft&8191,_t=Ft>>>13,Ot=_[0]|0,rt=Ot&8191,kt=Ot>>>13,Pt=_[1]|0,et=Pt&8191,xt=Pt>>>13,Mt=_[2]|0,Ge=Mt&8191,gt=Mt>>>13,Rt=_[3]|0,nt=Rt&8191,St=Rt>>>13,zt=_[4]|0,j=zt&8191,E=zt>>>13,A=_[5]|0,$=A&8191,Y=A>>>13,J=_[6]|0,ne=J&8191,ke=J>>>13,Je=_[7]|0,Re=Je&8191,V=Je>>>13,se=_[8]|0,fe=se&8191,Oe=se>>>13,He=_[9]|0,Pe=He&8191,$e=He>>>13;S.negative=f.negative^m.negative,S.length=19,g=Math.imul(ie,rt),v=Math.imul(ie,kt),v=v+Math.imul(le,rt)|0,N=Math.imul(le,kt);var at=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(at>>>26)|0,at&=67108863,g=Math.imul(xe,rt),v=Math.imul(xe,kt),v=v+Math.imul(be,rt)|0,N=Math.imul(be,kt),g=g+Math.imul(ie,et)|0,v=v+Math.imul(ie,xt)|0,v=v+Math.imul(le,et)|0,N=N+Math.imul(le,xt)|0;var Qt=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(Le,rt),v=Math.imul(Le,kt),v=v+Math.imul(ft,rt)|0,N=Math.imul(ft,kt),g=g+Math.imul(xe,et)|0,v=v+Math.imul(xe,xt)|0,v=v+Math.imul(be,et)|0,N=N+Math.imul(be,xt)|0,g=g+Math.imul(ie,Ge)|0,v=v+Math.imul(ie,gt)|0,v=v+Math.imul(le,Ge)|0,N=N+Math.imul(le,gt)|0;var Dt=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(je,rt),v=Math.imul(je,kt),v=v+Math.imul(mt,rt)|0,N=Math.imul(mt,kt),g=g+Math.imul(Le,et)|0,v=v+Math.imul(Le,xt)|0,v=v+Math.imul(ft,et)|0,N=N+Math.imul(ft,xt)|0,g=g+Math.imul(xe,Ge)|0,v=v+Math.imul(xe,gt)|0,v=v+Math.imul(be,Ge)|0,N=N+Math.imul(be,gt)|0,g=g+Math.imul(ie,nt)|0,v=v+Math.imul(ie,St)|0,v=v+Math.imul(le,nt)|0,N=N+Math.imul(le,St)|0;var Ut=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(he,rt),v=Math.imul(he,kt),v=v+Math.imul(Ce,rt)|0,N=Math.imul(Ce,kt),g=g+Math.imul(je,et)|0,v=v+Math.imul(je,xt)|0,v=v+Math.imul(mt,et)|0,N=N+Math.imul(mt,xt)|0,g=g+Math.imul(Le,Ge)|0,v=v+Math.imul(Le,gt)|0,v=v+Math.imul(ft,Ge)|0,N=N+Math.imul(ft,gt)|0,g=g+Math.imul(xe,nt)|0,v=v+Math.imul(xe,St)|0,v=v+Math.imul(be,nt)|0,N=N+Math.imul(be,St)|0,g=g+Math.imul(ie,j)|0,v=v+Math.imul(ie,E)|0,v=v+Math.imul(le,j)|0,N=N+Math.imul(le,E)|0;var ur=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(ur>>>26)|0,ur&=67108863,g=Math.imul(Ne,rt),v=Math.imul(Ne,kt),v=v+Math.imul(Me,rt)|0,N=Math.imul(Me,kt),g=g+Math.imul(he,et)|0,v=v+Math.imul(he,xt)|0,v=v+Math.imul(Ce,et)|0,N=N+Math.imul(Ce,xt)|0,g=g+Math.imul(je,Ge)|0,v=v+Math.imul(je,gt)|0,v=v+Math.imul(mt,Ge)|0,N=N+Math.imul(mt,gt)|0,g=g+Math.imul(Le,nt)|0,v=v+Math.imul(Le,St)|0,v=v+Math.imul(ft,nt)|0,N=N+Math.imul(ft,St)|0,g=g+Math.imul(xe,j)|0,v=v+Math.imul(xe,E)|0,v=v+Math.imul(be,j)|0,N=N+Math.imul(be,E)|0,g=g+Math.imul(ie,$)|0,v=v+Math.imul(ie,Y)|0,v=v+Math.imul(le,$)|0,N=N+Math.imul(le,Y)|0;var Ar=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,g=Math.imul(Be,rt),v=Math.imul(Be,kt),v=v+Math.imul(ut,rt)|0,N=Math.imul(ut,kt),g=g+Math.imul(Ne,et)|0,v=v+Math.imul(Ne,xt)|0,v=v+Math.imul(Me,et)|0,N=N+Math.imul(Me,xt)|0,g=g+Math.imul(he,Ge)|0,v=v+Math.imul(he,gt)|0,v=v+Math.imul(Ce,Ge)|0,N=N+Math.imul(Ce,gt)|0,g=g+Math.imul(je,nt)|0,v=v+Math.imul(je,St)|0,v=v+Math.imul(mt,nt)|0,N=N+Math.imul(mt,St)|0,g=g+Math.imul(Le,j)|0,v=v+Math.imul(Le,E)|0,v=v+Math.imul(ft,j)|0,N=N+Math.imul(ft,E)|0,g=g+Math.imul(xe,$)|0,v=v+Math.imul(xe,Y)|0,v=v+Math.imul(be,$)|0,N=N+Math.imul(be,Y)|0,g=g+Math.imul(ie,ne)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(le,ne)|0,N=N+Math.imul(le,ke)|0;var fr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(fr>>>26)|0,fr&=67108863,g=Math.imul(ze,rt),v=Math.imul(ze,kt),v=v+Math.imul(jt,rt)|0,N=Math.imul(jt,kt),g=g+Math.imul(Be,et)|0,v=v+Math.imul(Be,xt)|0,v=v+Math.imul(ut,et)|0,N=N+Math.imul(ut,xt)|0,g=g+Math.imul(Ne,Ge)|0,v=v+Math.imul(Ne,gt)|0,v=v+Math.imul(Me,Ge)|0,N=N+Math.imul(Me,gt)|0,g=g+Math.imul(he,nt)|0,v=v+Math.imul(he,St)|0,v=v+Math.imul(Ce,nt)|0,N=N+Math.imul(Ce,St)|0,g=g+Math.imul(je,j)|0,v=v+Math.imul(je,E)|0,v=v+Math.imul(mt,j)|0,N=N+Math.imul(mt,E)|0,g=g+Math.imul(Le,$)|0,v=v+Math.imul(Le,Y)|0,v=v+Math.imul(ft,$)|0,N=N+Math.imul(ft,Y)|0,g=g+Math.imul(xe,ne)|0,v=v+Math.imul(xe,ke)|0,v=v+Math.imul(be,ne)|0,N=N+Math.imul(be,ke)|0,g=g+Math.imul(ie,Re)|0,v=v+Math.imul(ie,V)|0,v=v+Math.imul(le,Re)|0,N=N+Math.imul(le,V)|0;var er=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(Ze,rt),v=Math.imul(Ze,kt),v=v+Math.imul(It,rt)|0,N=Math.imul(It,kt),g=g+Math.imul(ze,et)|0,v=v+Math.imul(ze,xt)|0,v=v+Math.imul(jt,et)|0,N=N+Math.imul(jt,xt)|0,g=g+Math.imul(Be,Ge)|0,v=v+Math.imul(Be,gt)|0,v=v+Math.imul(ut,Ge)|0,N=N+Math.imul(ut,gt)|0,g=g+Math.imul(Ne,nt)|0,v=v+Math.imul(Ne,St)|0,v=v+Math.imul(Me,nt)|0,N=N+Math.imul(Me,St)|0,g=g+Math.imul(he,j)|0,v=v+Math.imul(he,E)|0,v=v+Math.imul(Ce,j)|0,N=N+Math.imul(Ce,E)|0,g=g+Math.imul(je,$)|0,v=v+Math.imul(je,Y)|0,v=v+Math.imul(mt,$)|0,N=N+Math.imul(mt,Y)|0,g=g+Math.imul(Le,ne)|0,v=v+Math.imul(Le,ke)|0,v=v+Math.imul(ft,ne)|0,N=N+Math.imul(ft,ke)|0,g=g+Math.imul(xe,Re)|0,v=v+Math.imul(xe,V)|0,v=v+Math.imul(be,Re)|0,N=N+Math.imul(be,V)|0,g=g+Math.imul(ie,fe)|0,v=v+Math.imul(ie,Oe)|0,v=v+Math.imul(le,fe)|0,N=N+Math.imul(le,Oe)|0;var xr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,g=Math.imul(Qe,rt),v=Math.imul(Qe,kt),v=v+Math.imul(_t,rt)|0,N=Math.imul(_t,kt),g=g+Math.imul(Ze,et)|0,v=v+Math.imul(Ze,xt)|0,v=v+Math.imul(It,et)|0,N=N+Math.imul(It,xt)|0,g=g+Math.imul(ze,Ge)|0,v=v+Math.imul(ze,gt)|0,v=v+Math.imul(jt,Ge)|0,N=N+Math.imul(jt,gt)|0,g=g+Math.imul(Be,nt)|0,v=v+Math.imul(Be,St)|0,v=v+Math.imul(ut,nt)|0,N=N+Math.imul(ut,St)|0,g=g+Math.imul(Ne,j)|0,v=v+Math.imul(Ne,E)|0,v=v+Math.imul(Me,j)|0,N=N+Math.imul(Me,E)|0,g=g+Math.imul(he,$)|0,v=v+Math.imul(he,Y)|0,v=v+Math.imul(Ce,$)|0,N=N+Math.imul(Ce,Y)|0,g=g+Math.imul(je,ne)|0,v=v+Math.imul(je,ke)|0,v=v+Math.imul(mt,ne)|0,N=N+Math.imul(mt,ke)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,V)|0,v=v+Math.imul(ft,Re)|0,N=N+Math.imul(ft,V)|0,g=g+Math.imul(xe,fe)|0,v=v+Math.imul(xe,Oe)|0,v=v+Math.imul(be,fe)|0,N=N+Math.imul(be,Oe)|0,g=g+Math.imul(ie,Pe)|0,v=v+Math.imul(ie,$e)|0,v=v+Math.imul(le,Pe)|0,N=N+Math.imul(le,$e)|0;var Rn=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,g=Math.imul(Qe,et),v=Math.imul(Qe,xt),v=v+Math.imul(_t,et)|0,N=Math.imul(_t,xt),g=g+Math.imul(Ze,Ge)|0,v=v+Math.imul(Ze,gt)|0,v=v+Math.imul(It,Ge)|0,N=N+Math.imul(It,gt)|0,g=g+Math.imul(ze,nt)|0,v=v+Math.imul(ze,St)|0,v=v+Math.imul(jt,nt)|0,N=N+Math.imul(jt,St)|0,g=g+Math.imul(Be,j)|0,v=v+Math.imul(Be,E)|0,v=v+Math.imul(ut,j)|0,N=N+Math.imul(ut,E)|0,g=g+Math.imul(Ne,$)|0,v=v+Math.imul(Ne,Y)|0,v=v+Math.imul(Me,$)|0,N=N+Math.imul(Me,Y)|0,g=g+Math.imul(he,ne)|0,v=v+Math.imul(he,ke)|0,v=v+Math.imul(Ce,ne)|0,N=N+Math.imul(Ce,ke)|0,g=g+Math.imul(je,Re)|0,v=v+Math.imul(je,V)|0,v=v+Math.imul(mt,Re)|0,N=N+Math.imul(mt,V)|0,g=g+Math.imul(Le,fe)|0,v=v+Math.imul(Le,Oe)|0,v=v+Math.imul(ft,fe)|0,N=N+Math.imul(ft,Oe)|0,g=g+Math.imul(xe,Pe)|0,v=v+Math.imul(xe,$e)|0,v=v+Math.imul(be,Pe)|0,N=N+Math.imul(be,$e)|0;var Kr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,g=Math.imul(Qe,Ge),v=Math.imul(Qe,gt),v=v+Math.imul(_t,Ge)|0,N=Math.imul(_t,gt),g=g+Math.imul(Ze,nt)|0,v=v+Math.imul(Ze,St)|0,v=v+Math.imul(It,nt)|0,N=N+Math.imul(It,St)|0,g=g+Math.imul(ze,j)|0,v=v+Math.imul(ze,E)|0,v=v+Math.imul(jt,j)|0,N=N+Math.imul(jt,E)|0,g=g+Math.imul(Be,$)|0,v=v+Math.imul(Be,Y)|0,v=v+Math.imul(ut,$)|0,N=N+Math.imul(ut,Y)|0,g=g+Math.imul(Ne,ne)|0,v=v+Math.imul(Ne,ke)|0,v=v+Math.imul(Me,ne)|0,N=N+Math.imul(Me,ke)|0,g=g+Math.imul(he,Re)|0,v=v+Math.imul(he,V)|0,v=v+Math.imul(Ce,Re)|0,N=N+Math.imul(Ce,V)|0,g=g+Math.imul(je,fe)|0,v=v+Math.imul(je,Oe)|0,v=v+Math.imul(mt,fe)|0,N=N+Math.imul(mt,Oe)|0,g=g+Math.imul(Le,Pe)|0,v=v+Math.imul(Le,$e)|0,v=v+Math.imul(ft,Pe)|0,N=N+Math.imul(ft,$e)|0;var Nn=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,g=Math.imul(Qe,nt),v=Math.imul(Qe,St),v=v+Math.imul(_t,nt)|0,N=Math.imul(_t,St),g=g+Math.imul(Ze,j)|0,v=v+Math.imul(Ze,E)|0,v=v+Math.imul(It,j)|0,N=N+Math.imul(It,E)|0,g=g+Math.imul(ze,$)|0,v=v+Math.imul(ze,Y)|0,v=v+Math.imul(jt,$)|0,N=N+Math.imul(jt,Y)|0,g=g+Math.imul(Be,ne)|0,v=v+Math.imul(Be,ke)|0,v=v+Math.imul(ut,ne)|0,N=N+Math.imul(ut,ke)|0,g=g+Math.imul(Ne,Re)|0,v=v+Math.imul(Ne,V)|0,v=v+Math.imul(Me,Re)|0,N=N+Math.imul(Me,V)|0,g=g+Math.imul(he,fe)|0,v=v+Math.imul(he,Oe)|0,v=v+Math.imul(Ce,fe)|0,N=N+Math.imul(Ce,Oe)|0,g=g+Math.imul(je,Pe)|0,v=v+Math.imul(je,$e)|0,v=v+Math.imul(mt,Pe)|0,N=N+Math.imul(mt,$e)|0;var Ii=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,g=Math.imul(Qe,j),v=Math.imul(Qe,E),v=v+Math.imul(_t,j)|0,N=Math.imul(_t,E),g=g+Math.imul(Ze,$)|0,v=v+Math.imul(Ze,Y)|0,v=v+Math.imul(It,$)|0,N=N+Math.imul(It,Y)|0,g=g+Math.imul(ze,ne)|0,v=v+Math.imul(ze,ke)|0,v=v+Math.imul(jt,ne)|0,N=N+Math.imul(jt,ke)|0,g=g+Math.imul(Be,Re)|0,v=v+Math.imul(Be,V)|0,v=v+Math.imul(ut,Re)|0,N=N+Math.imul(ut,V)|0,g=g+Math.imul(Ne,fe)|0,v=v+Math.imul(Ne,Oe)|0,v=v+Math.imul(Me,fe)|0,N=N+Math.imul(Me,Oe)|0,g=g+Math.imul(he,Pe)|0,v=v+Math.imul(he,$e)|0,v=v+Math.imul(Ce,Pe)|0,N=N+Math.imul(Ce,$e)|0;var Oi=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,g=Math.imul(Qe,$),v=Math.imul(Qe,Y),v=v+Math.imul(_t,$)|0,N=Math.imul(_t,Y),g=g+Math.imul(Ze,ne)|0,v=v+Math.imul(Ze,ke)|0,v=v+Math.imul(It,ne)|0,N=N+Math.imul(It,ke)|0,g=g+Math.imul(ze,Re)|0,v=v+Math.imul(ze,V)|0,v=v+Math.imul(jt,Re)|0,N=N+Math.imul(jt,V)|0,g=g+Math.imul(Be,fe)|0,v=v+Math.imul(Be,Oe)|0,v=v+Math.imul(ut,fe)|0,N=N+Math.imul(ut,Oe)|0,g=g+Math.imul(Ne,Pe)|0,v=v+Math.imul(Ne,$e)|0,v=v+Math.imul(Me,Pe)|0,N=N+Math.imul(Me,$e)|0;var jn=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(jn>>>26)|0,jn&=67108863,g=Math.imul(Qe,ne),v=Math.imul(Qe,ke),v=v+Math.imul(_t,ne)|0,N=Math.imul(_t,ke),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,V)|0,v=v+Math.imul(It,Re)|0,N=N+Math.imul(It,V)|0,g=g+Math.imul(ze,fe)|0,v=v+Math.imul(ze,Oe)|0,v=v+Math.imul(jt,fe)|0,N=N+Math.imul(jt,Oe)|0,g=g+Math.imul(Be,Pe)|0,v=v+Math.imul(Be,$e)|0,v=v+Math.imul(ut,Pe)|0,N=N+Math.imul(ut,$e)|0;var Pi=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,g=Math.imul(Qe,Re),v=Math.imul(Qe,V),v=v+Math.imul(_t,Re)|0,N=Math.imul(_t,V),g=g+Math.imul(Ze,fe)|0,v=v+Math.imul(Ze,Oe)|0,v=v+Math.imul(It,fe)|0,N=N+Math.imul(It,Oe)|0,g=g+Math.imul(ze,Pe)|0,v=v+Math.imul(ze,$e)|0,v=v+Math.imul(jt,Pe)|0,N=N+Math.imul(jt,$e)|0;var Ri=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ri>>>26)|0,Ri&=67108863,g=Math.imul(Qe,fe),v=Math.imul(Qe,Oe),v=v+Math.imul(_t,fe)|0,N=Math.imul(_t,Oe),g=g+Math.imul(Ze,Pe)|0,v=v+Math.imul(Ze,$e)|0,v=v+Math.imul(It,Pe)|0,N=N+Math.imul(It,$e)|0;var B=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(B>>>26)|0,B&=67108863,g=Math.imul(Qe,Pe),v=Math.imul(Qe,$e),v=v+Math.imul(_t,Pe)|0,N=Math.imul(_t,$e);var G=(C+g|0)+((v&8191)<<13)|0;return C=(N+(v>>>13)|0)+(G>>>26)|0,G&=67108863,I[0]=at,I[1]=Qt,I[2]=Dt,I[3]=Ut,I[4]=ur,I[5]=Ar,I[6]=fr,I[7]=er,I[8]=xr,I[9]=Rn,I[10]=Kr,I[11]=Nn,I[12]=Ii,I[13]=Oi,I[14]=jn,I[15]=Pi,I[16]=Ri,I[17]=B,I[18]=G,C!==0&&(I[19]=C,S.length++),S};Math.imul||(k=R);function F(h,f,m){m.negative=f.negative^h.negative,m.length=h.length+f.length;for(var S=0,M=0,_=0;_<m.length-1;_++){var I=M;M=0;for(var C=S&67108863,g=Math.min(_,f.length-1),v=Math.max(0,_-h.length+1);v<=g;v++){var N=_-v,ee=h.words[N]|0,ie=f.words[v]|0,le=ee*ie,me=le&67108863;I=I+(le/67108864|0)|0,me=me+C|0,C=me&67108863,I=I+(me>>>26)|0,M+=I>>>26,I&=67108863}m.words[_]=C,S=I,I=M}return S!==0?m.words[_]=S:m.length--,m._strip()}function L(h,f,m){return F(h,f,m)}s.prototype.mulTo=function(f,m){var S,M=this.length+f.length;return this.length===10&&f.length===10?S=k(this,f,m):M<63?S=R(this,f,m):M<1024?S=F(this,f,m):S=L(this,f,m),S},s.prototype.mul=function(f){var m=new s(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},s.prototype.mulf=function(f){var m=new s(null);return m.words=new Array(this.length+f.length),L(this,f,m)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var m=f<0;m&&(f=-f),i(typeof f=="number"),i(f<67108864);for(var S=0,M=0;M<this.length;M++){var _=(this.words[M]|0)*f,I=(_&67108863)+(S&67108863);S>>=26,S+=_/67108864|0,S+=I>>>26,this.words[M]=I&67108863}return S!==0&&(this.words[M]=S,this.length++),m?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var m=O(f);if(m.length===0)return new s(1);for(var S=this,M=0;M<m.length&&m[M]===0;M++,S=S.sqr());if(++M<m.length)for(var _=S.sqr();M<m.length;M++,_=_.sqr())m[M]!==0&&(S=S.mul(_));return S},s.prototype.iushln=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26,M=67108863>>>26-m<<26-m,_;if(m!==0){var I=0;for(_=0;_<this.length;_++){var C=this.words[_]&M,g=(this.words[_]|0)-C<<m;this.words[_]=g|I,I=C>>>26-m}I&&(this.words[_]=I,this.length++)}if(S!==0){for(_=this.length-1;_>=0;_--)this.words[_+S]=this.words[_];for(_=0;_<S;_++)this.words[_]=0;this.length+=S}return this._strip()},s.prototype.ishln=function(f){return i(this.negative===0),this.iushln(f)},s.prototype.iushrn=function(f,m,S){i(typeof f=="number"&&f>=0);var M;m?M=(m-m%26)/26:M=0;var _=f%26,I=Math.min((f-_)/26,this.length),C=67108863^67108863>>>_<<_,g=S;if(M-=I,M=Math.max(0,M),g){for(var v=0;v<I;v++)g.words[v]=this.words[v];g.length=I}if(I!==0)if(this.length>I)for(this.length-=I,v=0;v<this.length;v++)this.words[v]=this.words[v+I];else this.words[0]=0,this.length=1;var N=0;for(v=this.length-1;v>=0&&(N!==0||v>=M);v--){var ee=this.words[v]|0;this.words[v]=N<<26-_|ee>>>_,N=ee&C}return g&&N!==0&&(g.words[g.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,m,S){return i(this.negative===0),this.iushrn(f,m,S)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26,M=1<<m;if(this.length<=S)return!1;var _=this.words[S];return!!(_&M)},s.prototype.imaskn=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(m!==0&&S++,this.length=Math.min(S,this.length),m!==0){var M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}return this._strip()},s.prototype.maskn=function(f){return this.clone().imaskn(f)},s.prototype.iaddn=function(f){return i(typeof f=="number"),i(f<67108864),f<0?this.isubn(-f):this.negative!==0?this.length===1&&(this.words[0]|0)<=f?(this.words[0]=f-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(f),this.negative=1,this):this._iaddn(f)},s.prototype._iaddn=function(f){this.words[0]+=f;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(f){if(i(typeof f=="number"),i(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},s.prototype.addn=function(f){return this.clone().iaddn(f)},s.prototype.subn=function(f){return this.clone().isubn(f)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(f,m,S){var M=f.length+S,_;this._expand(M);var I,C=0;for(_=0;_<f.length;_++){I=(this.words[_+S]|0)+C;var g=(f.words[_]|0)*m;I-=g&67108863,C=(I>>26)-(g/67108864|0),this.words[_+S]=I&67108863}for(;_<this.length-S;_++)I=(this.words[_+S]|0)+C,C=I>>26,this.words[_+S]=I&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,_=0;_<this.length;_++)I=-(this.words[_]|0)+C,C=I>>26,this.words[_]=I&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,m){var S=this.length-f.length,M=this.clone(),_=f,I=_.words[_.length-1]|0,C=this._countBits(I);S=26-C,S!==0&&(_=_.ushln(S),M.iushln(S),I=_.words[_.length-1]|0);var g=M.length-_.length,v;if(m!=="mod"){v=new s(null),v.length=g+1,v.words=new Array(v.length);for(var N=0;N<v.length;N++)v.words[N]=0}var ee=M.clone()._ishlnsubmul(_,1,g);ee.negative===0&&(M=ee,v&&(v.words[g]=1));for(var ie=g-1;ie>=0;ie--){var le=(M.words[_.length+ie]|0)*67108864+(M.words[_.length+ie-1]|0);for(le=Math.min(le/I|0,67108863),M._ishlnsubmul(_,le,ie);M.negative!==0;)le--,M.negative=0,M._ishlnsubmul(_,1,ie),M.isZero()||(M.negative^=1);v&&(v.words[ie]=le)}return v&&v._strip(),M._strip(),m!=="div"&&S!==0&&M.iushrn(S),{div:v||null,mod:M}},s.prototype.divmod=function(f,m,S){if(i(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var M,_,I;return this.negative!==0&&f.negative===0?(I=this.neg().divmod(f,m),m!=="mod"&&(M=I.div.neg()),m!=="div"&&(_=I.mod.neg(),S&&_.negative!==0&&_.iadd(f)),{div:M,mod:_}):this.negative===0&&f.negative!==0?(I=this.divmod(f.neg(),m),m!=="mod"&&(M=I.div.neg()),{div:M,mod:I.mod}):this.negative&f.negative?(I=this.neg().divmod(f.neg(),m),m!=="div"&&(_=I.mod.neg(),S&&_.negative!==0&&_.isub(f)),{div:I.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,m)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var S=m.div.negative!==0?m.mod.isub(f):m.mod,M=f.ushrn(1),_=f.andln(1),I=S.cmp(M);return I<0||_===1&&I===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modrn=function(f){var m=f<0;m&&(f=-f),i(f<=67108863);for(var S=(1<<26)%f,M=0,_=this.length-1;_>=0;_--)M=(S*M+(this.words[_]|0))%f;return m?-M:M},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var m=f<0;m&&(f=-f),i(f<=67108863);for(var S=0,M=this.length-1;M>=0;M--){var _=(this.words[M]|0)+S*67108864;this.words[M]=_/f|0,S=_%f}return this._strip(),m?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){i(f.negative===0),i(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var M=new s(1),_=new s(0),I=new s(0),C=new s(1),g=0;m.isEven()&&S.isEven();)m.iushrn(1),S.iushrn(1),++g;for(var v=S.clone(),N=m.clone();!m.isZero();){for(var ee=0,ie=1;!(m.words[0]&ie)&&ee<26;++ee,ie<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(M.isOdd()||_.isOdd())&&(M.iadd(v),_.isub(N)),M.iushrn(1),_.iushrn(1);for(var le=0,me=1;!(S.words[0]&me)&&le<26;++le,me<<=1);if(le>0)for(S.iushrn(le);le-- >0;)(I.isOdd()||C.isOdd())&&(I.iadd(v),C.isub(N)),I.iushrn(1),C.iushrn(1);m.cmp(S)>=0?(m.isub(S),M.isub(I),_.isub(C)):(S.isub(m),I.isub(M),C.isub(_))}return{a:I,b:C,gcd:S.iushln(g)}},s.prototype._invmp=function(f){i(f.negative===0),i(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var M=new s(1),_=new s(0),I=S.clone();m.cmpn(1)>0&&S.cmpn(1)>0;){for(var C=0,g=1;!(m.words[0]&g)&&C<26;++C,g<<=1);if(C>0)for(m.iushrn(C);C-- >0;)M.isOdd()&&M.iadd(I),M.iushrn(1);for(var v=0,N=1;!(S.words[0]&N)&&v<26;++v,N<<=1);if(v>0)for(S.iushrn(v);v-- >0;)_.isOdd()&&_.iadd(I),_.iushrn(1);m.cmp(S)>=0?(m.isub(S),M.isub(_)):(S.isub(m),_.isub(M))}var ee;return m.cmpn(1)===0?ee=M:ee=_,ee.cmpn(0)<0&&ee.iadd(f),ee},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),S=f.clone();m.negative=0,S.negative=0;for(var M=0;m.isEven()&&S.isEven();M++)m.iushrn(1),S.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;S.isEven();)S.iushrn(1);var _=m.cmp(S);if(_<0){var I=m;m=S,S=I}else if(_===0||S.cmpn(1)===0)break;m.isub(S)}while(!0);return S.iushln(M)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){i(typeof f=="number");var m=f%26,S=(f-m)/26,M=1<<m;if(this.length<=S)return this._expand(S+1),this.words[S]|=M,this;for(var _=M,I=S;_!==0&&I<this.length;I++){var C=this.words[I]|0;C+=_,_=C>>>26,C&=67108863,this.words[I]=C}return _!==0&&(this.words[I]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var S;if(this.length>1)S=1;else{m&&(f=-f),i(f<=67108863,"Number is too big");var M=this.words[0]|0;S=M===f?0:M<f?-1:1}return this.negative!==0?-S|0:S},s.prototype.cmp=function(f){if(this.negative!==0&&f.negative===0)return-1;if(this.negative===0&&f.negative!==0)return 1;var m=this.ucmp(f);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(f){if(this.length>f.length)return 1;if(this.length<f.length)return-1;for(var m=0,S=this.length-1;S>=0;S--){var M=this.words[S]|0,_=f.words[S]|0;if(M!==_){M<_?m=-1:M>_&&(m=1);break}}return m},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new z(f)},s.prototype.toRed=function(f){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return i(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return i(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var q={k256:null,p224:null,p192:null,p25519:null};function H(h,f){this.name=h,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}H.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},H.prototype.ireduce=function(f){var m=f,S;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),S=m.bitLength();while(S>this.n);var M=S<this.n?-1:m.ucmp(this.p);return M===0?(m.words[0]=0,m.length=1):M>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},H.prototype.split=function(f,m){f.iushrn(this.n,0,m)},H.prototype.imulK=function(f){return f.imul(this.k)};function K(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(K,H),K.prototype.split=function(f,m){for(var S=4194303,M=Math.min(f.length,9),_=0;_<M;_++)m.words[_]=f.words[_];if(m.length=M,f.length<=9){f.words[0]=0,f.length=1;return}var I=f.words[9];for(m.words[m.length++]=I&S,_=10;_<f.length;_++){var C=f.words[_]|0;f.words[_-10]=(C&S)<<4|I>>>22,I=C}I>>>=22,f.words[_-10]=I,I===0&&f.length>10?f.length-=10:f.length-=9},K.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,S=0;S<f.length;S++){var M=f.words[S]|0;m+=M*977,f.words[S]=m&67108863,m=M*64+(m/67108864|0)}return f.words[f.length-1]===0&&(f.length--,f.words[f.length-1]===0&&f.length--),f};function re(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(re,H);function oe(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(oe,H);function ae(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ae,H),ae.prototype.imulK=function(f){for(var m=0,S=0;S<f.length;S++){var M=(f.words[S]|0)*19+m,_=M&67108863;M>>>=26,f.words[S]=_,m=M}return m!==0&&(f.words[f.length++]=m),f},s._prime=function(f){if(q[f])return q[f];var m;if(f==="k256")m=new K;else if(f==="p224")m=new re;else if(f==="p192")m=new oe;else if(f==="p25519")m=new ae;else throw new Error("Unknown prime "+f);return q[f]=m,m};function z(h){if(typeof h=="string"){var f=s._prime(h);this.m=f.p,this.prime=f}else i(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}z.prototype._verify1=function(f){i(f.negative===0,"red works only with positives"),i(f.red,"red works only with red numbers")},z.prototype._verify2=function(f,m){i((f.negative|m.negative)===0,"red works only with positives"),i(f.red&&f.red===m.red,"red works only with red numbers")},z.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},z.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},z.prototype.add=function(f,m){this._verify2(f,m);var S=f.add(m);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},z.prototype.iadd=function(f,m){this._verify2(f,m);var S=f.iadd(m);return S.cmp(this.m)>=0&&S.isub(this.m),S},z.prototype.sub=function(f,m){this._verify2(f,m);var S=f.sub(m);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},z.prototype.isub=function(f,m){this._verify2(f,m);var S=f.isub(m);return S.cmpn(0)<0&&S.iadd(this.m),S},z.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},z.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},z.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},z.prototype.isqr=function(f){return this.imul(f,f.clone())},z.prototype.sqr=function(f){return this.mul(f,f)},z.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var S=this.m.add(new s(1)).iushrn(2);return this.pow(f,S)}for(var M=this.m.subn(1),_=0;!M.isZero()&&M.andln(1)===0;)_++,M.iushrn(1);i(!M.isZero());var I=new s(1).toRed(this),C=I.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var N=this.pow(v,M),ee=this.pow(f,M.addn(1).iushrn(1)),ie=this.pow(f,M),le=_;ie.cmp(I)!==0;){for(var me=ie,xe=0;me.cmp(I)!==0;xe++)me=me.redSqr();i(xe<le);var be=this.pow(N,new s(1).iushln(le-xe-1));ee=ee.redMul(be),N=be.redSqr(),ie=ie.redMul(N),le=xe}return ee},z.prototype.invm=function(f){var m=f._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},z.prototype.pow=function(f,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return f.clone();var S=4,M=new Array(1<<S);M[0]=new s(1).toRed(this),M[1]=f;for(var _=2;_<M.length;_++)M[_]=this.mul(M[_-1],f);var I=M[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),_=m.length-1;_>=0;_--){for(var N=m.words[_],ee=v-1;ee>=0;ee--){var ie=N>>ee&1;if(I!==M[0]&&(I=this.sqr(I)),ie===0&&C===0){g=0;continue}C<<=1,C|=ie,g++,!(g!==S&&(_!==0||ee!==0))&&(I=this.mul(I,M[C]),g=0,C=0)}v=26}return I},z.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},z.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},s.mont=function(f){return new D(f)};function D(h){z.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(D,z),D.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},D.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var S=f.imul(m),M=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=S.isub(M).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},D.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new s(0)._forceRed(this);var S=f.mul(m),M=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=S.isub(M).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},D.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),ns=9e15,Bi=1e9,Ff="0123456789abcdef",Oc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Pc="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Uf={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ns,maxE:ns,crypto:!1},bg,vi,ot=!0,Rc="[DecimalError] ",Li=Rc+"Invalid argument: ",xg=Rc+"Precision limit exceeded",Sg=Rc+"crypto unavailable",Eg="[object Decimal]",Pr=Math.floor,yr=Math.pow,yE=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,wE=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,bE=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,_g=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,En=1e7,Ke=7,xE=9007199254740991,SE=Oc.length-1,Vf=Pc.length-1,ge={toStringTag:Eg};ge.absoluteValue=ge.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),qe(e)},ge.ceil=function(){return qe(new this.constructor(this),this.e+1,2)},ge.clampedTo=ge.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Li+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},ge.comparedTo=ge.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},ge.cosine=ge.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ke,n.rounding=1,r=EE(n,Og(n,r)),n.precision=e,n.rounding=t,qe(vi==2||vi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},ge.cubeRoot=ge.cbrt=function(){var e,t,r,n,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(ot=!1,o=l.s*yr(l.s*l,1/3),!o||Math.abs(o)==1/0?(r=Er(l.d),e=l.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=yr(r,1/3),e=Pr((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new d(r),n.s=l.s):n=new d(o.toString()),s=(e=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Gt(u.plus(l).times(a),u.plus(c),s+2,1),Er(a.d).slice(0,s)===(r=Er(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(qe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(qe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ot=!0,qe(n,e,d.rounding,t)},ge.decimalPlaces=ge.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Pr(this.e/Ke))*Ke,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ge.dividedBy=ge.div=function(e){return Gt(this,new this.constructor(e))},ge.dividedToIntegerBy=ge.divToInt=function(e){var t=this,r=t.constructor;return qe(Gt(t,new r(e),0,1,1),r.precision,r.rounding)},ge.equals=ge.eq=function(e){return this.cmp(e)===0},ge.floor=function(){return qe(new this.constructor(this),this.e+1,3)},ge.greaterThan=ge.gt=function(e){return this.cmp(e)>0},ge.greaterThanOrEqualTo=ge.gte=function(e){var t=this.cmp(e);return t==1||t===0},ge.hyperbolicCosine=ge.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Dc(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=is(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return qe(o,s.precision=r,s.rounding=n,!0)},ge.hyperbolicSine=ge.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=is(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Dc(5,e)),i=is(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=r,qe(i,t,r,!0)},ge.hyperbolicTangent=ge.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Gt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},ge.inverseCosine=ge.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return n!==-1?n===0?t.isNeg()?_n(r,i,o):new r(0):new r(NaN):t.isZero()?_n(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=_n(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},ge.inverseHyperbolicCosine=ge.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ot=!1,r=r.times(r).minus(1).sqrt().plus(r),ot=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},ge.inverseHyperbolicSine=ge.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ot=!1,r=r.times(r).plus(1).sqrt().plus(r),ot=!0,n.precision=e,n.rounding=t,r.ln())},ge.inverseHyperbolicTangent=ge.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?qe(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Gt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},ge.inverseSine=ge.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=_n(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},ge.inverseTangent=ge.atan=function(){var e,t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=Vf)return s=_n(l,d+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=Vf)return s=_n(l,d+4,p).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,r=Math.min(28,a/Ke+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ot=!1,t=Math.ceil(a/Ke),n=1,c=u.times(u),s=new l(u),i=u;e!==-1;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),ot=!0,qe(s,l.precision=d,l.rounding=p,!0)},ge.isFinite=function(){return!!this.d},ge.isInteger=ge.isInt=function(){return!!this.d&&Pr(this.e/Ke)>this.d.length-2},ge.isNaN=function(){return!this.s},ge.isNegative=ge.isNeg=function(){return this.s<0},ge.isPositive=ge.isPos=function(){return this.s>0},ge.isZero=function(){return!!this.d&&this.d[0]===0},ge.lessThan=ge.lt=function(e){return this.cmp(e)<0},ge.lessThanOrEqualTo=ge.lte=function(e){return this.cmp(e)<1},ge.logarithm=ge.log=function(e){var t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding,w=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(ot=!1,a=d+w,s=Fi(u,a),n=t?kc(l,a+10):Fi(e,a),c=Gt(s,n,a,1),la(c.d,i=d,p))do if(a+=10,s=Fi(u,a),n=t?kc(l,a+10):Fi(e,a),c=Gt(s,n,a,1),!o){+Er(c.d).slice(i+1,i+15)+1==1e14&&(c=qe(c,d+1,0));break}while(la(c.d,i+=10,p));return ot=!0,qe(c,d,p)},ge.minus=ge.sub=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,w=this,b=w.constructor;if(e=new b(e),!w.d||!e.d)return!w.s||!e.s?e=new b(NaN):w.d?e.s=-e.s:e=new b(e.d||w.s!==e.s?w:NaN),e;if(w.s!=e.s)return e.s=-e.s,w.plus(e);if(u=w.d,p=e.d,a=b.precision,c=b.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new b(w);else return new b(c===3?-0:0);return ot?qe(e,a,c):e}if(r=Pr(e.e/Ke),l=Pr(w.e/Ke),u=u.slice(),o=l-r,o){for(d=o<0,d?(t=u,o=-o,s=p.length):(t=p,r=l,s=u.length),n=Math.max(Math.ceil(a/Ke),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=p.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=p[n]){d=u[n]<p[n];break}o=0}for(d&&(t=u,u=p,p=t,e.s=-e.s),s=u.length,n=p.length-s;n>0;--n)u[s++]=0;for(n=p.length;n>o;){if(u[--n]<p[n]){for(i=n;i&&u[--i]===0;)u[i]=En-1;--u[i],u[n]+=En}u[n]-=p[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=jc(u,r),ot?qe(e,a,c):e):new b(c===3?-0:0)},ge.modulo=ge.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?qe(new n(r),n.precision,n.rounding):(ot=!1,n.modulo==9?(t=Gt(r,e.abs(),0,3,1),t.s*=e.s):t=Gt(r,e,0,n.modulo,1),t=t.times(e),ot=!0,r.minus(t))},ge.naturalExponential=ge.exp=function(){return zf(this)},ge.naturalLogarithm=ge.ln=function(){return Fi(this)},ge.negated=ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s,qe(e)},ge.plus=ge.add=function(e){var t,r,n,i,o,s,a,c,u,l,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return!d.s||!e.s?e=new p(NaN):d.d||(e=new p(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(u=d.d,l=e.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(e=new p(d)),ot?qe(e,a,c):e;if(o=Pr(d.e/Ke),n=Pr(e.e/Ke),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=l.length):(r=l,n=o,s=u.length),o=Math.ceil(a/Ke),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/En|0,u[i]%=En;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=jc(u,n),ot?qe(e,a,c):e},ge.precision=ge.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Li+e);return r.d?(t=Cg(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ge.round=function(){var e=this,t=e.constructor;return qe(new t(e),e.e+1,t.rounding)},ge.sine=ge.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ke,n.rounding=1,r=CE(n,Og(n,r)),n.precision=e,n.rounding=t,qe(vi>2?r.neg():r,e,t,!0)):new n(NaN)},ge.squareRoot=ge.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(ot=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=Er(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Pr((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(o=n,n=o.plus(Gt(s,o,r+2,1)).times(.5),Er(o.d).slice(0,r)===(t=Er(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(qe(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(qe(n,c+1,1),e=!n.times(n).eq(s));break}return ot=!0,qe(n,c,l.rounding,e)},ge.tangent=ge.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Gt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,qe(vi==2||vi==4?r.neg():r,e,t,!0)):new n(NaN)},ge.times=ge.mul=function(e){var t,r,n,i,o,s,a,c,u,l=this,d=l.constructor,p=l.d,w=(e=new d(e)).d;if(e.s*=l.s,!p||!p[0]||!w||!w[0])return new d(!e.s||p&&!p[0]&&!w||w&&!w[0]&&!p?NaN:!p||!w?e.s/0:e.s*0);for(r=Pr(l.e/Ke)+Pr(e.e/Ke),c=p.length,u=w.length,c<u&&(o=p,p=w,w=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=o[i]+w[n]*p[i-n-1]+t,o[i--]=a%En|0,t=a/En|0;o[i]=(o[i]+t)%En|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=jc(o,r),ot?qe(e,d.precision,d.rounding):e},ge.toBinary=function(e,t){return qf(this,2,e,t)},ge.toDecimalPlaces=ge.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(zr(e,0,Bi),t===void 0?t=n.rounding:zr(t,0,8),qe(r,e+r.e+1,t))},ge.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=qn(n,!0):(zr(e,0,Bi),t===void 0?t=i.rounding:zr(t,0,8),n=qe(new i(n),e+1,t),r=qn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},ge.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=qn(i):(zr(e,0,Bi),t===void 0?t=o.rounding:zr(t,0,8),n=qe(new o(i),e+i.e+1,t),r=qn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},ge.toFraction=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,w=this,b=w.d,y=w.constructor;if(!b)return new y(w);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=Cg(b)-w.e-1,s=o%Ke,t.d[0]=yr(10,s<0?Ke+s:s),e==null)e=o>0?t:u;else{if(a=new y(e),!a.isInt()||a.lt(u))throw Error(Li+a);e=a.gt(t)?o>0?t:u:a}for(ot=!1,a=new y(Er(b)),l=y.precision,y.precision=o=b.length*Ke*2;d=Gt(a,t,0,1,1),i=r.plus(d.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(d.times(i)),c=i,i=t,t=a.minus(d.times(i)),a=i;return i=Gt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=w.s,p=Gt(u,n,o,1).minus(w).abs().cmp(Gt(c,r,o,1).minus(w).abs())<1?[u,n]:[c,r],y.precision=l,ot=!0,p},ge.toHexadecimal=ge.toHex=function(e,t){return qf(this,16,e,t)},ge.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:zr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(ot=!1,r=Gt(r,e,0,t,1).times(e),ot=!0,qe(r)):(e.s=r.s,r=e),r},ge.toNumber=function(){return+this},ge.toOctal=function(e,t){return qf(this,8,e,t)},ge.toPower=ge.pow=function(e){var t,r,n,i,o,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(yr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return qe(a,n,o);if(t=Pr(e.e/Ke),t>=e.d.length-1&&(r=u<0?-u:u)<=xE)return i=Mg(c,a,r,n),e.s<0?new c(1).div(i):qe(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=yr(+a,u),t=r==0||!isFinite(r)?Pr(u*(Math.log("0."+Er(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(ot=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=zf(e.times(Fi(a,n+r)),n),i.d&&(i=qe(i,n+5,1),la(i.d,n,o)&&(t=n+10,i=qe(zf(e.times(Fi(a,t+r)),t),t+5,1),+Er(i.d).slice(n+1,n+15)+1==1e14&&(i=qe(i,n+1,0)))),i.s=s,ot=!0,c.rounding=o,qe(i,n,o))},ge.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=qn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(zr(e,1,Bi),t===void 0?t=i.rounding:zr(t,0,8),n=qe(new i(n),e,t),r=qn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},ge.toSignificantDigits=ge.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(zr(e,1,Bi),t===void 0?t=n.rounding:zr(t,0,8)),qe(new n(r),e,t)},ge.toString=function(){var e=this,t=e.constructor,r=qn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ge.truncated=ge.trunc=function(){return qe(new this.constructor(this),this.e+1,1)},ge.valueOf=ge.toJSON=function(){var e=this,t=e.constructor,r=qn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function Er(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=Ke-n.length,r&&(o+=$i(r)),o+=n;s=e[t],n=s+"",r=Ke-n.length,r&&(o+=$i(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function zr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Li+e)}function la(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Ke,i=0):(i=Math.ceil((t+1)/Ke),t%=Ke),o=yr(10,Ke-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==yr(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==yr(10,t-3)-1,s}function Nc(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=Ff.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function EE(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Dc(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=is(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var Gt=function(){function e(n,i,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,c){var u,l,d,p,w,b,y,T,O,R,k,F,L,q,H,K,re,oe,ae,z,D=n.constructor,h=n.s==i.s?1:-1,f=n.d,m=i.d;if(!f||!f[0]||!m||!m[0])return new D(!n.s||!i.s||(f?m&&f[0]==m[0]:!m)?NaN:f&&f[0]==0||!m?h*0:h/0);for(c?(w=1,l=n.e-i.e):(c=En,w=Ke,l=Pr(n.e/w)-Pr(i.e/w)),ae=m.length,re=f.length,O=new D(h),R=O.d=[],d=0;m[d]==(f[d]||0);d++);if(m[d]>(f[d]||0)&&l--,o==null?(q=o=D.precision,s=D.rounding):a?q=o+(n.e-i.e)+1:q=o,q<0)R.push(1),b=!0;else{if(q=q/w+2|0,d=0,ae==1){for(p=0,m=m[0],q++;(d<re||p)&&q--;d++)H=p*c+(f[d]||0),R[d]=H/m|0,p=H%m|0;b=p||d<re}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,re=f.length),K=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;z=m.slice(),z.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do p=0,u=t(m,k,ae,F),u<0?(L=k[0],ae!=F&&(L=L*c+(k[1]||0)),p=L/oe|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),T=y.length,F=k.length,u=t(y,k,T,F),u==1&&(p--,r(y,ae<T?z:m,T,c))):(p==0&&(u=p=1),y=m.slice()),T=y.length,T<F&&y.unshift(0),r(k,y,F,c),u==-1&&(F=k.length,u=t(m,k,ae,F),u<1&&(p++,r(k,ae<F?z:m,F,c))),F=k.length):u===0&&(p++,k=[0]),R[d++]=p,u&&k[0]?k[F++]=f[K]||0:(k=[f[K]],F=1);while((K++<re||k[0]!==void 0)&&q--);b=k[0]!==void 0}R[0]||R.shift()}if(w==1)O.e=l,bg=b;else{for(d=1,p=R[0];p>=10;p/=10)d++;O.e=d+l*w-1,qe(O,a?o+O.e+1:o,s,b)}return O}}();function qe(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor;e:if(t!=null){if(d=e.d,!d)return e;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=Ke,s=t,l=d[p=0],c=l/yr(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/Ke),a=d.length,p>=a)if(n){for(;a++<=p;)d.push(0);l=c=0,i=1,o%=Ke,s=o-Ke+1}else break e;else{for(l=a=d[p],i=1;a>=10;a/=10)i++;o%=Ke,s=o-Ke+i,c=s<0?0:l/yr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%yr(10,i-s-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(o>0?s>0?l/yr(10,i-s):0:d[p-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,u?(t-=e.e+1,d[0]=yr(10,(Ke-t%Ke)%Ke),e.e=-t||0):d[0]=e.e=0,e;if(o==0?(d.length=p,a=1,p--):(d.length=p+1,a=yr(10,Ke-o),d[p]=s>0?(l/yr(10,i-s)%yr(10,s)|0)*a:0),u)for(;;)if(p==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,d[0]==En&&(d[0]=1));break}else{if(d[p]+=a,d[p]!=En)break;d[p--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return ot&&(e.e>w.maxE?(e.d=null,e.e=NaN):e.e<w.minE&&(e.e=0,e.d=[0])),e}function qn(e,t,r){if(!e.isFinite())return Ig(e);var n,i=e.e,o=Er(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+$i(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+$i(-i-1)+o,r&&(n=r-s)>0&&(o+=$i(n))):i>=s?(o+=$i(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+$i(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=$i(n))),o}function jc(e,t){var r=e[0];for(t*=Ke;r>=10;r/=10)t++;return t}function kc(e,t,r){if(t>SE)throw ot=!0,r&&(e.precision=r),Error(xg);return qe(new e(Oc),t,1,!0)}function _n(e,t,r){if(t>Vf)throw Error(xg);return qe(new e(Pc),t,r,!0)}function Cg(e){var t=e.length-1,r=t*Ke+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function $i(e){for(var t="";e--;)t+="0";return t}function Mg(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/Ke+4);for(ot=!1;;){if(r%2&&(o=o.times(t),Pg(o.d,s)&&(i=!0)),r=Pr(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),Pg(t.d,s)}return ot=!0,o}function Ag(e){return e.d[e.d.length-1]&1}function Tg(e,t,r){for(var n,i=new e(t[0]),o=0;++o<t.length;)if(n=new e(t[o]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function zf(e,t){var r,n,i,o,s,a,c,u=0,l=0,d=0,p=e.constructor,w=p.rounding,b=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ot=!1,c=b):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),d+=5;for(n=Math.log(yr(2,d))/Math.LN10*2+5|0,c+=n,r=o=s=new p(1),p.precision=c;;){if(o=qe(o.times(e),c,1),r=r.times(++l),a=s.plus(Gt(o,r,c,1)),Er(a.d).slice(0,c)===Er(s.d).slice(0,c)){for(i=d;i--;)s=qe(s.times(s),c,1);if(t==null)if(u<3&&la(s.d,c-n,w,u))p.precision=c+=10,r=o=a=new p(1),l=0,u++;else return qe(s,p.precision=b,w,ot=!0);else return p.precision=b,s}s=a}}function Fi(e,t){var r,n,i,o,s,a,c,u,l,d,p,w=1,b=10,y=e,T=y.d,O=y.constructor,R=O.rounding,k=O.precision;if(y.s<0||!T||!T[0]||!y.e&&T[0]==1&&T.length==1)return new O(T&&!T[0]?-1/0:y.s!=1?NaN:T?0:y);if(t==null?(ot=!1,l=k):l=t,O.precision=l+=b,r=Er(T),n=r.charAt(0),Math.abs(o=y.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)y=y.times(e),r=Er(y.d),n=r.charAt(0),w++;o=y.e,n>1?(y=new O("0."+r),o++):y=new O(n+"."+r.slice(1))}else return u=kc(O,l+2,k).times(o+""),y=Fi(new O(n+"."+r.slice(1)),l-b).plus(u),O.precision=k,t==null?qe(y,k,R,ot=!0):y;for(d=y,c=s=y=Gt(y.minus(1),y.plus(1),l,1),p=qe(y.times(y),l,1),i=3;;){if(s=qe(s.times(p),l,1),u=c.plus(Gt(s,new O(i),l,1)),Er(u.d).slice(0,l)===Er(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(kc(O,l+2,k).times(o+""))),c=Gt(c,new O(w),l,1),t==null)if(la(c.d,l-b,R,a))O.precision=l+=b,u=s=y=Gt(d.minus(1),d.plus(1),l,1),p=qe(y.times(y),l,1),i=a=1;else return qe(c,O.precision=k,R,ot=!0);else return O.precision=k,c;c=u,i+=2}}function Ig(e){return String(e.s*e.s/0)}function Hf(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ke,r<0&&(n+=Ke),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ke;n<i;)e.d.push(+t.slice(n,n+=Ke));t=t.slice(n),n=Ke-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ot&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function _E(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),_g.test(t))return Hf(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(wE.test(t))r=16,t=t.toLowerCase();else if(yE.test(t))r=2;else if(bE.test(t))r=8;else throw Error(Li+t);for(o=t.search(/p/i),o>0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=Mg(n,new n(r),o,o*2)),u=Nc(t,r,En),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=jc(u,l),e.d=u,ot=!1,s&&(e=Gt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?yr(2,c):fa.pow(2,c))),ot=!0,e)}function CE(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:is(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Dc(5,r)),t=is(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function is(e,t,r,n,i){var o,s,a,c,u=e.precision,l=Math.ceil(u/Ke);for(ot=!1,c=r.times(r),a=new e(n);;){if(s=Gt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(s):n.minus(s),n=Gt(s.times(c),new e(t++*t++),u,1),s=a.plus(n),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o}return ot=!0,s.d.length=l+1,s}function Dc(e,t){for(var r=e;--t;)r*=e;return r}function Og(e,t){var r,n=t.s<0,i=_n(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return vi=n?4:1,t;if(r=t.divToInt(i),r.isZero())vi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return vi=Ag(r)?n?2:3:n?4:1,t;vi=Ag(r)?n?1:4:n?3:2}return t.minus(i).abs()}function qf(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor,b=r!==void 0;if(b?(zr(r,1,Bi),n===void 0?n=w.rounding:zr(n,0,8)):(r=w.precision,n=w.rounding),!e.isFinite())l=Ig(e);else{for(l=qn(e),s=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(l=l.replace(".",""),p=new w(1),p.e=l.length-s,p.d=Nc(qn(p),10,i),p.e=p.d.length),d=Nc(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=b?"0p+0":"0";else{if(s<0?o--:(e=new w(e),e.d=d,e.e=o,e=Gt(e,p,r,n,0,i),d=e.d,o=e.e,u=bg),s=d[r],a=i/2,u=u||d[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[r-1]&1||n===(e.s<0?8:7)),d.length=r,u)for(;++d[--r]>i-1;)d[r]=0,r||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=Ff.charAt(d[s]);if(b){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(d=Nc(l,i,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Ff.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Pg(e,t){if(e.length>t)return e.length=t,!0}function ME(e){return new this(e).abs()}function AE(e){return new this(e).acos()}function TE(e){return new this(e).acosh()}function IE(e,t){return new this(e).plus(t)}function OE(e){return new this(e).asin()}function PE(e){return new this(e).asinh()}function RE(e){return new this(e).atan()}function NE(e){return new this(e).atanh()}function jE(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=_n(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?_n(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=_n(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Gt(e,t,o,1)),t=_n(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Gt(e,t,o,1)),r}function kE(e){return new this(e).cbrt()}function DE(e){return qe(e=new this(e),e.e+1,2)}function BE(e,t,r){return new this(e).clamp(t,r)}function LE(e){if(!e||typeof e!="object")throw Error(Rc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,Bi,"rounding",0,8,"toExpNeg",-ns,0,"toExpPos",0,ns,"maxE",0,ns,"minE",-ns,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=Uf[r]),(n=e[r])!==void 0)if(Pr(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(Li+r+": "+n);if(r="crypto",i&&(this[r]=Uf[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(Sg);else this[r]=!1;else throw Error(Li+r+": "+n);return this}function $E(e){return new this(e).cos()}function FE(e){return new this(e).cosh()}function Rg(e){var t,r,n;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,Ng(o)){u.s=o.s,ot?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;ot?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}else if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Hf(u,o.toString())}else if(c!=="string")throw Error(Li+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),_g.test(o)?Hf(u,o):_E(u,o)}if(i.prototype=ge,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=LE,i.clone=Rg,i.isDecimal=Ng,i.abs=ME,i.acos=AE,i.acosh=TE,i.add=IE,i.asin=OE,i.asinh=PE,i.atan=RE,i.atanh=NE,i.atan2=jE,i.cbrt=kE,i.ceil=DE,i.clamp=BE,i.cos=$E,i.cosh=FE,i.div=UE,i.exp=VE,i.floor=zE,i.hypot=HE,i.ln=qE,i.log=WE,i.log10=KE,i.log2=GE,i.max=YE,i.min=ZE,i.mod=XE,i.mul=JE,i.pow=QE,i.random=e_,i.round=t_,i.sign=r_,i.sin=n_,i.sinh=i_,i.sqrt=o_,i.sub=s_,i.sum=a_,i.tan=c_,i.tanh=u_,i.trunc=l_,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function UE(e,t){return new this(e).div(t)}function VE(e){return new this(e).exp()}function zE(e){return qe(e=new this(e),e.e+1,3)}function HE(){var e,t,r=new this(0);for(ot=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return ot=!0,new this(1/0);r=t}return ot=!0,r.sqrt()}function Ng(e){return e instanceof fa||e&&e.toStringTag===Eg||!1}function qE(e){return new this(e).ln()}function WE(e,t){return new this(e).log(t)}function GE(e){return new this(e).log(2)}function KE(e){return new this(e).log(10)}function YE(){return Tg(this,arguments,"lt")}function ZE(){return Tg(this,arguments,"gt")}function XE(e,t){return new this(e).mod(t)}function JE(e,t){return new this(e).mul(t)}function QE(e,t){return new this(e).pow(t)}function e_(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:zr(e,1,Bi),n=Math.ceil(e/Ke),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(Sg);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ke,n&&e&&(i=yr(10,Ke-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ke)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ke&&(r-=Ke-n)}return s.e=r,s.d=a,s}function t_(e){return qe(e=new this(e),e.e+1,this.rounding)}function r_(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function n_(e){return new this(e).sin()}function i_(e){return new this(e).sinh()}function o_(e){return new this(e).sqrt()}function s_(e,t){return new this(e).sub(t)}function a_(){var e=0,t=arguments,r=new this(t[e]);for(ot=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ot=!0,qe(r,this.precision,this.rounding)}function c_(e){return new this(e).tan()}function u_(e){return new this(e).tanh()}function l_(e){return qe(e=new this(e),e.e+1,1)}ge[Symbol.for("nodejs.util.inspect.custom")]=ge.toString,ge[Symbol.toStringTag]="Decimal";var fa=ge.constructor=Rg(Uf);Oc=new fa(Oc),Pc=new fa(Pc);var Bc=fa,Wn=ts(rs()),Wf=ts(rs()),f_=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet");this.slippage="900000000000000000",this.poolRegistry="0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",this.protocolFeeVault="0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",this.treasury="0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",this.insuranceFund="0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",this.referrealVault="0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278"}amountLimit(e){return new Wf.default(e).mul(new Wf.default(this.slippage)).div(new Wf.default("1000000000000000000")).toString()}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.aftermathLpSupplyType==null)throw new Error("LP supply type not supported");const d=[t.object(r.id),t.object(this.poolRegistry),t.object(this.protocolFeeVault),t.object(this.treasury),t.object(this.insuranceFund),t.object(this.referrealVault),t.pure.u64(this.amountLimit(r.amountOut)),t.pure.u64(this.slippage),n],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::aftermath::${c}`,typeArguments:[u,l,r.extendedDetails.aftermathLpSupplyType],arguments:d})})}},jg="0x000000000000000000000000000000000000000000000000000000000000dee9",d_=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return pt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:jg,module:"custodian_v2"}}});if(i!=null&&i.data!=null){if(i.data.length!==0)return i.data[0].data.objectId;if(i.data.length<50)break}else break}return null})}getOrCreateAccountCap(e,t,r){return pt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${jg}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=yield this.getOrCreateAccountCap(t,e.client,e.signer),p=[t.object(r.id),n,d.accountCap,t.object(Hr)],w=pr(e.publishedAtV2(),i),b=t.moveCall({target:`${w}::deepbook::${c}`,typeArguments:[u,l],arguments:p});return d.isCreate&&t.transferObjects([d.accountCap],e.signer),b})}},h_=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(r.id),n],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_amm::${c}`,typeArguments:[u,l],arguments:d})})}},p_=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(r.id),n,t.object(this.version),t.object(Hr)],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},m_=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.container),n],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_amm::${c}`,typeArguments:[u,l],arguments:d})})}},g_=class{constructor(e){if(e!==0)throw new Error("Flowx clmm only supported on mainnet");this.versioned="0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",this.poolRegistry="0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(Hr)],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},v_=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.turbosFeeType==null)throw new Error("Turbos fee type not supported");const d=[t.object(r.id),n,t.object(Hr),t.object(this.versioned)],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::turbos::${c}`,typeArguments:[u,l,r.extendedDetails.turbosFeeType],arguments:d})})}},kg=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n,i){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["flash_swap_a2b",s,a]:["flash_swap_b2a",a,s];let d=n?r.amountIn:r.amountOut;const p=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(d),t.pure.bool(n),t.object(Hr)],w=pr(e.publishedAtV2(),i),b=t.moveCall({target:`${w}::cetus::${c}`,typeArguments:[u,l],arguments:p});return{targetCoin:b[0],flashReceipt:b[1],payAmount:b[2]}}repay_flash_swap(e,t,r,n,i,o){const{direction:s,from:a,target:c}=r,[u,l,d]=s?["repay_flash_swap_a2b",a,c]:["repay_flash_swap_b2a",c,a],p=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i],w=pr(e.publishedAtV2(),o);return t.moveCall({target:`${w}::cetus::${u}`,typeArguments:[l,d],arguments:p})[0]}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(Hr)],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::cetus::${c}`,typeArguments:[u,l],arguments:d})})}};function Dg(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function Bg(e){return e.split("::")[0]}function Cn(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const c=Cn(r),u=pE(hE({},c),{type_arguments:i.map(l=>Cn(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Gn.isSuiCoin(l)?l:Cn(l).source_address),u.source_address=Dg(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===$g||r===b_?"0x2":Yr(o[0]),module:o[1],name:o[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=Dg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function Lg(e){return Cn(e).source_address}var y_="0x2::coin::Coin",w_=/^0x2::coin::Coin<(.+)>$/,$g="0x2::sui::SUI",b_="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Gn=class no{static getCoinTypeArg(t){const r=t.type.match(w_);return r?r[1]:null}static isSUI(t){const r=no.getCoinTypeArg(t);return r?no.getCoinSymbol(r)==="SUI":!1}static getCoinSymbol(t){return t.substring(t.lastIndexOf(":")+1)}static getBalance(t){return BigInt(t.fields.balance)}static totalBalance(t,r){let n=BigInt(0);return t.forEach(i=>{r===i.coinAddress&&(n+=BigInt(i.balance))}),n}static getID(t){return t.fields.id.id}static getCoinTypeFromArg(t){return`${y_}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{Lg(i.coinAddress)===Lg(t)&&n.push(i)}),n}static isSuiCoin(t){return Cn(t).full_address===$g}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=no.selectCoinAssetGreaterThanOrEqual(t,r,n),o=i.selectedCoins.map(c=>c.coinObjectId),s=i.remainingCoins,a=i.selectedCoins.map(c=>c.balance.toString());return{objectArray:o,remainCoins:s,amountArray:a}}static selectCoinAssetGreaterThanOrEqual(t,r,n=[]){const i=no.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),o=no.calculateTotalBalance(i);if(o<r)return{selectedCoins:[],remainingCoins:i};if(o===r)return{selectedCoins:i,remainingCoins:[]};let s=BigInt(0);const a=[],c=[...i];for(;s<o;){const u=r-s,l=c.findIndex(p=>p.balance>=u);if(l!==-1){a.push(c[l]),c.splice(l,1);break}const d=c.pop();d.balance>0&&(a.push(d),s+=d.balance)}return{selectedCoins:no.sortByBalance(a),remainingCoins:no.sortByBalance(c)}}static sortByBalance(t){return t.sort((r,n)=>r.balance<n.balance?-1:r.balance>n.balance?1:0)}static sortByBalanceDes(t){return t.sort((r,n)=>r.balance>n.balance?-1:r.balance<n.balance?0:1)}static calculateTotalBalance(t){return t.reduce((r,n)=>r+n.balance,BigInt(0))}};function Gf(e){switch(e){case 1e4:return"Calculate error";case 10001:return"Input number too large can not fit in target type";case 10002:return"No router";case 10003:return"Insufficient Liquidity";case 10004:return"Target token is detected as a HoneyPot scam";case 10005:return"Too many requests. Please try again later";default:return"Unknown error"}}function Ui(e){const t=e.indexOf("::");if(t===-1)return e;const r=e.substring(0,t),n=e.substring(t);if(!r.startsWith("0x"))return e;const i=r.substring(2);return i.length>64?e:`0x${i.padStart(64,"0")}${n}`}function x_(e,t){e=Ui(e),t=Ui(t);const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]>t[n])return!0;if(e[n]<t[n])return!1}return!0}function Fg(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Kf(e,t,r,n){const i=Gn.getCoinAssets(n,t);if(r===BigInt(0))return Gn.isSuiCoin(n)||i.length===0&&!Gn.isSuiCoin(n)?{targetCoin:Fg(e,n),isMintZeroCoin:!0,targetCoinAmount:0}:{targetCoin:e.object(i[0].coinObjectId),isMintZeroCoin:!1,targetCoinAmount:Number(i[0].balance.toString())};if(Gn.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Gn.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let s=Gn.sortByBalance(i);s.slice(0,3).reduce((p,w)=>p+w.balance,BigInt(0))<BigInt(r)&&(s=Gn.sortByBalanceDes(i));let c=Gn.selectCoinObjectIdGreaterThanOrEqual(s,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(p=>e.object(p))),{targetCoin:e.splitCoins(e.object(u),[e.pure.u64(r.toString())]),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function S_(e){return!(!e.startsWith("0x")||e.length!==66)}var os=ts(rs()),Vi=ts(rs()),da=ts(rs()),yi=new da.default(0);new da.default(1);var E_=new da.default(2);E_.pow(new da.default(128));var __=new da.default("18446744073709551615"),an=1e9;function C_(e,t,r){let n=yi;return t?n=e.mul(new Vi.default(an-r*an)).div(new Vi.default(an)):n=e.mul(new Vi.default(an+r*an)).div(new Vi.default(an)),Number(n.toString())}function Ug(e,t,r){let n=yi;return t?n=e.mul(new Vi.default(an-r*an)).div(new Vi.default(an)):n=e.mul(new Vi.default(an+r*an)).div(new Vi.default(an)),n}function M_(e,t,r){return new Bc(e).mul(Bc.pow(2,-64)).pow(2).mul(Bc.pow(10,t-r))}function A_(e,t,r,n){return pt(this,null,function*(){var i,o,s,a,c;const{from:u,target:l,amount:d,byAmountIn:p,pools:w}=t,b=Ui(u),y=Ui(l),T=new qo,O=x_(b,y),R=n===0?"0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4":"0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6",k=O?b:y,F=O?y:b,L=[k,F];for(let C=0;C<w.length;C++){const g=[T.object(w[C]),T.pure.bool(O),T.pure.bool(p),T.pure.u64(d.toString())];T.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!S_(r))throw new AggregateError("Aggregator package not set","InvalidWallet");const q=yield e.devInspectTransactionBlock({transactionBlock:T,sender:r});if(q.error!=null)throw console.log("simulateRes.error",q.error),new AggregateError("Aggregator package not set","SimulateError");const H=(i=q.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(H.length===0||H.length!==w.length)throw new AggregateError("Simulate event result error","simulateEventError");let K=p?yi:__,re=0;for(let C=0;C<H.length;C+=1)if(!H[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new os.BN(H[C].parsedJson.data.amount_out);g.gt(K)&&(re=C,K=g)}else{const g=new os.BN(H[C].parsedJson.data.amount_out);g.lt(K)&&(re=C,K=g)}const oe=H[re].parsedJson.data,ae=oe.step_results[0].current_sqrt_price,[z,D]=yield Promise.all([e.getCoinMetadata({coinType:k}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(z==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const h=M_(ae,z,D),f=Number(oe.fee_rate)/1e6,m=new os.BN((o=oe.amount_in)!=null?o:0),S=new os.BN((s=oe.fee_amount)!=null?s:0),M=m.add(S),_={amountIn:M,amountOut:new os.BN((a=oe.amount_out)!=null?a:0),routes:[{path:[{id:w[re],direction:O,provider:"CETUS",from:b,target:y,feeRate:f,amountIn:oe.amount_in,amountOut:oe.amount_out,extendedDetails:{afterSqrtPrice:oe.after_sqrt_price}}],amountIn:M,amountOut:new os.BN((c=oe.amount_out)!=null?c:0),initialPrice:h}],insufficientLiquidity:!1,byAmountIn:t.byAmountIn};return{isExceed:oe.is_exceed,routeData:_}})}var T_=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o}=r,s=o?"swap_a2b":"swap_b2a",a=[t.object(r.id),t.object("0x5"),n],c=pr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::haedal::${s}`,typeArguments:[],arguments:a})})}},I_=class{constructor(e){if(e!==0)throw new Error("Afsui only supported on mainnet");this.stakedSuiVault="0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",this.safe="0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",this.referVault="0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",this.validator="0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o}=r;if(!o)throw new Error("Afsui not support b2a swap");const s="swap_a2b",a=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n],c=pr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::afsui::${s}`,typeArguments:[],arguments:a})})}},O_=class{constructor(e){if(e!==0)throw new Error("Volo only supported on mainnet");this.nativePool="0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf",this.metadata="0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o}=r;if(!o)throw new Error("Volo not support b2a swap");const s="swap_a2b",a=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n],c=pr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::volo::${s}`,typeArguments:[],arguments:a})})}},P_=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.dexInfo),n],p=pr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::bluemove::${c}`,typeArguments:[u,l],arguments:d})})}},R_=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i,o){return pt(this,null,function*(){const{direction:s,from:a,target:c}=r,[u,l,d]=s?["swap_a2b",a,c]:["swap_b2a",c,a];let p;o?p=o:p=Fg(t,e.deepbookv3DeepFeeType());const w=[t.object(this.deepbookV3Config),t.object(r.id),n,p,t.object(Hr)],b=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${b}::deepbookv3::${u}`,typeArguments:[l,d],arguments:w})})}},N_=class{constructor(e){if(e!==0)throw new Error("Scallop only supported on mainnet");this.version=e===0?"0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7":"0x0",this.market=e===0?"0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9":"0x0"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",s,a];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.scallopScoinTreasury==null)throw new Error("Scallop coin treasury not supported");const d=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(Hr)],p=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::scallop::${c}`,typeArguments:[u,l],arguments:d})})}},Vg=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u]=o?["swap_a2b",a]:["swap_b2a",s],l=[t.object(r.id),t.object(this.sui_system_state),n],d=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::suilend::${c}`,typeArguments:[u],arguments:l})})}},j_=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.globalConfig),t.object(r.id),n,t.object(Hr)],p=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::bluefin::${c}`,typeArguments:[u,l],arguments:d})})}},k_=class{constructor(e,t){if(e===1)throw new Error("HaedalPmm is not supported on testnet");this.pythPriceIDs=t}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];let d,p;if(r.extendedDetails==null)throw new Error("Extended details not supported haedal pmm");if(!r.extendedDetails.haedalPmmBasePriceSeed||!r.extendedDetails.haedalPmmQuotePriceSeed)throw new Error("Base price seed or quote price seed not supported");d=r.extendedDetails.haedalPmmBasePriceSeed,p=r.extendedDetails.haedalPmmQuotePriceSeed;const w=this.pythPriceIDs.get(d),b=this.pythPriceIDs.get(p);if(!w||!b)throw new Error("Base price info object id or quote price info object id not found");const y=[t.object(r.id),t.object(w),t.object(b),n,t.object(Hr)],T=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${T}::haedalpmm::${c}`,typeArguments:[u,l],arguments:y})})}},D_=class{constructor(e){if(e!==0)throw new Error("Alphafi only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u]=o?["swap_a2b",a]:["swap_b2a",s],l=[t.object(r.id),t.object(this.sui_system_state),n],d=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::alphafi::${c}`,typeArguments:[u],arguments:l})})}},B_=class{constructor(e){if(e!==0)throw new Error("Steamm only supported on mainnet")}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.steammBankA==null)throw new Error("Steamm bank a type not supported");if(r.extendedDetails.steammBankB==null)throw new Error("Steamm bank b type not supported");if(r.extendedDetails.steammLendingMarket==null)throw new Error("Steamm lending market not supported");if(r.extendedDetails.steammLendingMarketType==null)throw new Error("Steamm lending market type not supported");if(r.extendedDetails.steammBCoinAType==null)throw new Error("Steamm b coin a type not supported");if(r.extendedDetails.steammBCoinBType==null)throw new Error("Steamm b coin b type not supported");if(r.extendedDetails.steammLPToken==null)throw new Error("Steamm lp token not supported");const d=[t.object(r.id),t.object(r.extendedDetails.steammBankA),t.object(r.extendedDetails.steammBankB),t.object(r.extendedDetails.steammLendingMarket),n,t.object(Hr)],p=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::steammfe::${c}`,typeArguments:[r.extendedDetails.steammLendingMarketType,u,l,r.extendedDetails.steammBCoinAType,r.extendedDetails.steammBCoinBType,r.extendedDetails.steammLPToken],arguments:d})})}},L_="0x790f258062909e3a0ffc78b3c53ac2f62d7084c3bab95644bdeb05add7250001::super_sui::SUPER_SUI",$_="0xe44df51c0b21a27ab915fa1fe2ca610cd3eaa6d9666fe5e62b988bf7f0bd8722::musd::MUSD",F_="0xccd628c2334c5ed33e6c47d6c21bb664f8b6307b2ac32c2462a61f69a31ebcee::meth::METH",U_=class{constructor(e,t){if(e!==0)throw new Error("Metastable only supported on mainnet");this.versionID="0x4696559327b35ff2ab26904e7426a1646312e9c836d5c6cff6709a5ccc30915c",this.pythPriceIDs=t}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l,d]=o?["swap_a2b","create_deposit_cap",s,a]:["swap_b2a","create_withdraw_cap",a,s];let p="",w="pyth",b="";if(r.extendedDetails==null)throw new Error("Extended details not supported metastable");if(!r.extendedDetails.metastableCreateCapPkgId||!r.extendedDetails.metastableCreateCapModule||!r.extendedDetails.metastableRegistryId||!r.extendedDetails.metastableWhitelistedAppId)throw new Error("CreateCapPkgId or CreateCapModule or RegistryId or WhitelistedAppId or CreateCapAllTypeParams not supported");p=r.extendedDetails.metastableCreateCapPkgId,w=r.extendedDetails.metastableCreateCapModule,b=r.extendedDetails.metastableWhitelistedAppId;const y=[d];r.extendedDetails.metastableCreateCapAllTypeParams&&y.push(l);const T=[t.object(b),t.object(r.id)];switch(d){case L_:{if(!r.extendedDetails.metastableRegistryId)throw new Error("Not found registry id for super sui");T.push(t.object(r.extendedDetails.metastableRegistryId));break}case $_:{if(r.extendedDetails.metastablePriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastablePriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastablePriceSeed);T.push(t.object(L))}if(r.extendedDetails.metastableETHPriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastableETHPriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastableETHPriceSeed);T.push(t.object(L))}T.push(t.object(Hr));break}case F_:{if(r.extendedDetails.metastablePriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastablePriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastablePriceSeed);T.push(t.object(L))}if(r.extendedDetails.metastableETHPriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastableETHPriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastableETHPriceSeed);T.push(t.object(L))}T.push(t.object(Hr));break}default:throw new Error("Invalid Metacoin: "+d)}const O=t.moveCall({target:`${p}::${w}::${u}`,typeArguments:y,arguments:T}),R=[t.object(r.id),t.object(this.versionID),O,n],k=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${k}::metastable::${c}`,typeArguments:[l,d],arguments:R})})}},V_=class{constructor(e,t){if(e===1)throw new Error("Obric is not supported on testnet");this.pythPriceIDs=t,this.pythStateObjectId="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"}swap(e,t,r,n,i){return pt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];let d,p,w,b;if(r.extendedDetails==null)throw new Error("Extended details not supported in obric");if(r.extendedDetails.obricCoinAPriceSeed&&r.extendedDetails.obricCoinBPriceSeed)d=r.extendedDetails.obricCoinAPriceSeed,w=this.pythPriceIDs.get(d),p=r.extendedDetails.obricCoinBPriceSeed,b=this.pythPriceIDs.get(p);else{if(!r.extendedDetails.obricCoinAPriceId||!r.extendedDetails.obricCoinBPriceId)throw new Error("Base price id or quote price id not supported");w=r.extendedDetails.obricCoinAPriceId,b=r.extendedDetails.obricCoinBPriceId}if(!w||!b)throw new Error("Base price info object id or quote price info object id not found");const y=[t.object(r.id),n,t.object(this.pythStateObjectId),t.object(w),t.object(b),t.object(Hr)],T=wi(e.publishedAtV2Extend(),i);return t.moveCall({target:`${T}::obric::${c}`,typeArguments:[u,l],arguments:y})})}},zg="CETUS",z_="DEEPBOOK",H_="KRIYA",q_="FLOWX",W_="FLOWXV3",G_="KRIYAV3",Hg="TURBOS",Yf="AFTERMATH",K_="HAEDAL",Y_="VOLO",Z_="AFSUI",X_="BLUEMOVE",qg="DEEPBOOKV3",Wg="SCALLOP",J_="SUILEND",Q_="BLUEFIN",Zf="HAEDALPMM",eC="ALPHAFI",tC="SPRINGSUI",Gg="STEAMM",Xf="METASTABLE",Jf="OBRIC",rC="https://api-sui.cetus.zone/router_v2";function Qf(e){return Array.isArray(e.routers)}function ed(e){return Array.isArray(e.routers)}var Kg=class P2{constructor(t){var r;this.endpoint=t.endpoint?sC(t.endpoint):rC,this.client=t.client||new Wo({url:a0("mainnet")}),this.signer=t.signer||"",this.env=t.env||0,this.allCoins=new Map;const n=P2.CONFIG[this.env];this.pythConnections=this.newPythClients((r=t.pythUrls)!=null?r:[]),this.pythClient=new Dl.SuiPythClient(this.client,n.pythStateId,n.wormholeStateId),this.apiKey=t.apiKey||""}newPythClients(t){return t.includes("https://hermes.pyth.network")||t.push("https://hermes.pyth.network"),t.map(n=>new Dl.SuiPriceServiceConnection(n,{timeout:3e3}))}getCoins(t,r=!0){return pt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let n=null,i=50;if(!r){const s=this.allCoins.get(t);if(s)return s}const o=[];for(;;)try{const s=yield this.client.getCoins({owner:this.signer,coinType:t,cursor:n,limit:i});for(const a of s.data)o.push({coinAddress:Cn(a.coinType).source_address,coinObjectId:a.coinObjectId,balance:BigInt(a.balance)});if(!s.hasNextPage)break;n=s.nextCursor}catch(s){console.error("getCoins error:",s);break}return this.allCoins.set(t,o),o})}findRouters(t){return pt(this,null,function*(){return aC(this.endpoint,this.apiKey,t)})}executeFlexibleInputSwap(t,r,n,i,o,s,a,c){return pt(this,null,function*(){if(n.length===0)throw new Error("No router found");const u=n[0].path[n[0].path.length-1].target,l=[];for(let b=0;b<n.length-1;b++){if(n[b].path.length===0)throw new Error("Empty path");let T=t.splitCoins(r,[n[b].amountIn.toString()])[0];for(const O of n[b].path)T=yield this.newDex(O.provider,o,s).swap(this,t,O,T,c,a);l.push(T)}if(n[n.length-1].path.length===0)throw new Error("Empty path");let d=r;for(const b of n[n.length-1].path)d=yield this.newDex(b.provider,o,s).swap(this,t,b,d,c,a);l.push(d);const p=pr(this.publishedAtV2(),c);return this.checkCoinThresholdAndMergeCoin(t,l,u,i,p)})}expectInputSwap(t,r,n,i,o,s,a,c){return pt(this,null,function*(){if(n.length===0)throw new Error("No router found");const u=n.map(T=>T.amountIn.toString()),l=n[0].path[0].from,d=n[0].path[n[0].path.length-1].target,p=t.splitCoins(r,u),w=[];for(let T=0;T<n.length;T++){if(n[T].path.length===0)throw new Error("Empty path");let O=p[T];for(const R of n[T].path)O=yield this.newDex(R.provider,o,s).swap(this,t,R,O,c,a);w.push(O)}const b=pr(this.publishedAtV2(),c);return this.transferOrDestoryCoin(t,r,l,this.publishedAtV2()),this.checkCoinThresholdAndMergeCoin(t,w,d,i,b)})}expectOutputSwap(t,r,n,i,o){return pt(this,null,function*(){const s=[],a=[],c=[],u=new kg(this.env,i),l=pr(this.publishedAtV2(),o);for(let p=0;p<n.length;p++){const w=n[p];for(let y=w.path.length-1;y>=0;y--){const T=w.path[y],O=u.flash_swap(this,t,T,!1);s.unshift(O.targetCoin),a.unshift(O.flashReceipt)}let b=r;for(let y=0;y<w.path.length;y++){const T=w.path[y],O=u.repay_flash_swap(this,t,T,b,a[y]);b=s[y],y===0?r=O:this.transferOrDestoryCoin(t,O,T.from,l),y===w.path.length-1&&c.push(b)}}const d=n[0].path[0].from;if(this.transferOrDestoryCoin(t,r,d,l),c.length>1){const p=t.makeMoveVec({elements:c.slice(1)});t.moveCall({target:`${Ws}::pay::join_vec`,typeArguments:[n[0].path[n[0].path.length-1].target],arguments:[c[0],p]})}return c[0]})}swapInPools(t){return pt(this,null,function*(){let r;try{r=yield A_(this.client,t,this.signer,this.env)}catch(n){return console.error("swapInPools error:",n),null}return r})}routerSwap(t){return pt(this,null,function*(){const{routers:r,inputCoin:n,slippage:i,txb:o,partner:s,deepbookv3DeepFee:a}=t,c=Array.isArray(r)?r:r.routes,u=Qf(t)?t.byAmountIn:t.routers.byAmountIn,l=c.reduce((k,F)=>k.add(F.amountIn),new Wn.default(0)),d=c.reduce((k,F)=>k.add(F.amountOut),new Wn.default(0)),p=Ug(u?d:l,u,i),w=Qf(t)?void 0:t.routers.packages,b=pr(this.publishedAtV2(),w),y=Zg(c),T=y.length>0?yield this.updatePythPriceIDs(y,o):new Map;if(u)return yield this.expectInputSwap(o,n,c,p,T,s,a,w);const O=o.splitCoins(n,[p.toString()]);return this.transferOrDestoryCoin(o,n,c[0].path[0].from,b),yield this.expectOutputSwap(o,O[0],c,s)})}fixableRouterSwap(t){return pt(this,null,function*(){const{routers:r,inputCoin:n,slippage:i,txb:o,partner:s,deepbookv3DeepFee:a}=t,c=Array.isArray(r)?r:r.routes,u=t.routers.byAmountIn,l=c.reduce((O,R)=>O.add(R.amountIn),new Wn.default(0)),d=c.reduce((O,R)=>O.add(R.amountOut),new Wn.default(0)),p=Ug(u?d:l,u,i),w=Qf(t)?void 0:t.routers.packages;pr(this.publishedAtV2(),w);const b=Zg(c),y=b.length>0?yield this.updatePythPriceIDs(b,o):new Map;return u?yield this.executeFlexibleInputSwap(o,n,c,p,y,s,a,w):yield this.expectOutputSwap(o,n,c,s)})}fastRouterSwap(t){return pt(this,null,function*(){const{routers:r,slippage:n,txb:i,partner:o,refreshAllCoins:s,payDeepFeeAmount:a}=t,c=Array.isArray(r)?r:r.routes,u=c[0].path[0].from;let l=yield this.getCoins(u,s);const d=c[0].path[c[0].path.length-1].target,p=c.reduce((L,q)=>L.add(q.amountIn),new Wn.default(0)),w=c.reduce((L,q)=>L.add(q.amountOut),new Wn.default(0)),b=ed(t)?t.byAmountIn:t.routers.byAmountIn,y=C_(b?w:p,b,n),O=Kf(i,l,BigInt((b?p:y).toString()),u);let R;if(a&&a>0){let L=yield this.getCoins(this.deepbookv3DeepFeeType());R=Kf(i,L,BigInt(a),this.deepbookv3DeepFeeType()).targetCoin}const k=ed(t)?{routers:c,inputCoin:O.targetCoin,slippage:n,byAmountIn:b,txb:i,partner:o,deepbookv3DeepFee:R}:{routers:t.routers,inputCoin:O.targetCoin,slippage:n,byAmountIn:b,txb:i,partner:o,deepbookv3DeepFee:R},F=yield this.routerSwap(k);if(Gn.isSuiCoin(d))i.mergeCoins(i.gas,[F]);else{let L=yield this.getCoins(d,s);const q=Kf(i,L,BigInt(0),d),H=ed(t)?void 0:t.routers.packages,K=pr(this.publishedAtV2(),H);i.mergeCoins(q.targetCoin,[F]),q.isMintZeroCoin&&this.transferOrDestoryCoin(i,q.targetCoin,d,K)}})}publishedAtV2(){return this.env===0?"0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2Extend(){return this.env===0?"0x200e762fa2c49f3dc150813038fbf22fd4f894ac6f23ebe1085c62f2ef97f1ca":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(t,r,n,i){t.moveCall({target:`${i}::utils::transfer_or_destroy_coin`,typeArguments:[n],arguments:[r]})}checkCoinThresholdAndMergeCoin(t,r,n,i,o){let s=r[0];if(r.length>1){let a=t.makeMoveVec({elements:r.slice(1)});t.moveCall({target:`${Ws}::pay::join_vec`,typeArguments:[n],arguments:[r[0],a]}),s=r[0]}return t.moveCall({target:`${o}::utils::check_coin_threshold`,typeArguments:[n],arguments:[s,t.pure.u64(i.toString())]}),s}newDex(t,r,n){switch(t){case zg:return new kg(this.env,n);case z_:return new d_(this.env);case qg:return new R_(this.env);case H_:return new h_(this.env);case G_:return new p_(this.env);case q_:return new m_(this.env);case W_:return new g_(this.env);case Hg:return new v_(this.env);case Yf:return new f_(this.env);case K_:return new T_(this.env);case Z_:return new I_(this.env);case Y_:return new O_(this.env);case X_:return new P_(this.env);case Wg:return new N_(this.env);case J_:return new Vg(this.env);case tC:return new Vg(this.env);case Q_:return new j_(this.env);case Zf:return new k_(this.env,r);case eC:return new D_(this.env);case Gg:return new B_(this.env);case Xf:return new U_(this.env,r);case Jf:return new V_(this.env,r);default:throw new Error(`Unsupported dex ${t}`)}}signAndExecuteTransaction(t,r){return pt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(t){return pt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:t,sender:this.signer})})}sendTransaction(t,r){return pt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r})})}getDeepbookV3Config(){return pt(this,null,function*(){const t=yield lC(this.endpoint);return t?t.data:null})}updatePythPriceIDs(t,r){return pt(this,null,function*(){let n=null,i=null;for(const a of this.pythConnections)try{n=yield a.getPriceFeedsUpdateData(t);break}catch(c){i=c,console.log("Error: ",c);continue}if(n==null)throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes. Detailed error: ${i==null?void 0:i.message}`);let o=[];try{o=yield this.pythClient.updatePriceFeeds(r,n,t)}catch(a){throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${a}`)}let s=new Map;for(let a=0;a<t.length;a++)s.set(t[a],o[a]);return s})}};Kg.CONFIG={1:{wormholeStateId:"0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",pythStateId:"0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c"},0:{wormholeStateId:"0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",pythStateId:"0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"}};var Yg=Kg;function Zg(e){const t=new Set;for(const r of e)for(const n of r.path)n.provider===Zf&&n.extendedDetails&&n.extendedDetails.haedalPmmBasePriceSeed&&n.extendedDetails.haedalPmmQuotePriceSeed&&(t.add(n.extendedDetails.haedalPmmBasePriceSeed),t.add(n.extendedDetails.haedalPmmQuotePriceSeed)),n.provider===Xf&&(n.extendedDetails&&n.extendedDetails.metastablePriceSeed&&t.add(n.extendedDetails.metastablePriceSeed),n.extendedDetails&&n.extendedDetails.metastableETHPriceSeed&&t.add(n.extendedDetails.metastableETHPriceSeed)),n.provider===Jf&&(n.extendedDetails&&n.extendedDetails.obricCoinAPriceSeed&&t.add(n.extendedDetails.obricCoinAPriceSeed),n.extendedDetails&&n.extendedDetails.obricCoinBPriceSeed&&t.add(n.extendedDetails.obricCoinBPriceSeed));return Array.from(t)}function nC(e,t){let r=0;for(const o of e.routes)for(const s of o.path)s.extended_details&&s.extended_details.deepbookv3_deep_fee&&(r+=Number(s.extended_details.deepbookv3_deep_fee));let n;if(e.packages!=null){n=new Map;for(const[o,s]of Object.entries(e.packages))n.set(o,s)}return{amountIn:new Wn.default(e.amount_in.toString()),amountOut:new Wn.default(e.amount_out.toString()),byAmountIn:t,insufficientLiquidity:!1,routes:e.routes.map(o=>({path:o.path.map(s=>{var a,c,u,l,d,p,w,b,y,T,O,R,k,F,L,q,H,K,re,oe,ae,z,D,h,f;let m;s.provider===Yf&&(m=s.extended_details.aftermath_pool_flatness===0?"v2":"v3");let S;return(s.provider===Hg||s.provider===Yf||s.provider===zg||s.provider===qg||s.provider===Wg||s.provider===Zf||s.provider===Gg||s.provider===Xf||s.provider===Jf)&&(S={aftermathLpSupplyType:(a=s.extended_details)==null?void 0:a.aftermath_lp_supply_type,turbosFeeType:(c=s.extended_details)==null?void 0:c.turbos_fee_type,afterSqrtPrice:(u=s.extended_details)==null?void 0:u.after_sqrt_price,deepbookv3DeepFee:(l=s.extended_details)==null?void 0:l.deepbookv3_deep_fee,scallopScoinTreasury:(d=s.extended_details)==null?void 0:d.scallop_scoin_treasury,haedalPmmBasePriceSeed:(p=s.extended_details)==null?void 0:p.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(w=s.extended_details)==null?void 0:w.haedal_pmm_quote_price_seed,steammBankA:(b=s.extended_details)==null?void 0:b.steamm_bank_a,steammBankB:(y=s.extended_details)==null?void 0:y.steamm_bank_b,steammLendingMarket:(T=s.extended_details)==null?void 0:T.steamm_lending_market,steammLendingMarketType:(O=s.extended_details)==null?void 0:O.steamm_lending_market_type,steammBCoinAType:(R=s.extended_details)==null?void 0:R.steamm_btoken_a_type,steammBCoinBType:(k=s.extended_details)==null?void 0:k.steamm_btoken_b_type,steammLPToken:(F=s.extended_details)==null?void 0:F.steamm_lp_token_type,metastablePriceSeed:(L=s.extended_details)==null?void 0:L.metastable_price_seed,metastableETHPriceSeed:(q=s.extended_details)==null?void 0:q.metastable_eth_price_seed,metastableWhitelistedAppId:(H=s.extended_details)==null?void 0:H.metastable_whitelisted_app_id,metastableCreateCapPkgId:(K=s.extended_details)==null?void 0:K.metastable_create_cap_pkg_id,metastableCreateCapModule:(re=s.extended_details)==null?void 0:re.metastable_create_cap_module,metastableCreateCapAllTypeParams:(oe=s.extended_details)==null?void 0:oe.metastable_create_cap_all_type_params,metastableRegistryId:(ae=s.extended_details)==null?void 0:ae.metastable_registry_id,obricCoinAPriceSeed:(z=s.extended_details)==null?void 0:z.obric_coin_a_price_seed,obricCoinBPriceSeed:(D=s.extended_details)==null?void 0:D.obric_coin_b_price_seed,obricCoinAPriceId:(h=s.extended_details)==null?void 0:h.obric_coin_a_price_id,obricCoinBPriceId:(f=s.extended_details)==null?void 0:f.obric_coin_b_price_id}),{id:s.id,direction:s.direction,provider:s.provider,from:s.from,target:s.target,feeRate:s.fee_rate,amountIn:s.amount_in,amountOut:s.amount_out,extendedDetails:S,version:m}}),amountIn:new Wn.default(o.amount_in.toString()),amountOut:new Wn.default(o.amount_out.toString()),initialPrice:new Bc(o.initial_price.toString())})),totalDeepFee:r,packages:n}}var Hr=J0,iC="aggregator_v2",oC="aggregator_v2_extend";function pr(e,t){var r;return t instanceof Map&&(r=t.get(iC))!=null?r:e}function wi(e,t){var r;return t instanceof Map&&(r=t.get(oC))!=null?r:e}ts(rs());function sC(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}var Xg=1000404;function aC(e,t,r){return pt(this,null,function*(){let n;if(r.liquidityChanges&&r.liquidityChanges.length>0?n=yield uC(e,r):n=yield cC(e,t,r),!n)return null;if(!n.ok){let s=10001;return n.status===429&&(s=10005),{amountIn:yi,amountOut:yi,routes:[],byAmountIn:r.byAmountIn,insufficientLiquidity:!1,error:{code:s,msg:Gf(s)}}}const i=yield n.json(),o=i.msg==="liquidity is not enough";return i.msg&&i.msg.indexOf("HoneyPot scam")>-1?{amountIn:yi,amountOut:yi,routes:[],byAmountIn:r.byAmountIn,insufficientLiquidity:o,error:{code:10004,msg:Gf(10004)}}:i.data!=null?nC(i.data,r.byAmountIn):{amountIn:yi,amountOut:yi,routes:[],insufficientLiquidity:o,byAmountIn:r.byAmountIn,error:{code:10003,msg:Gf(10003)}}})}function cC(e,t,r){return pt(this,null,function*(){try{const{from:n,target:i,amount:o,byAmountIn:s,depth:a,splitAlgorithm:c,splitFactor:u,splitCount:l,providers:d}=r,p=Ui(n),w=Ui(i);let b=`${e}/find_routes?from=${p}&target=${w}&amount=${o.toString()}&by_amount_in=${s}`;return a&&(b+=`&depth=${a}`),c&&(b+=`&split_algorithm=${c}`),u&&(b+=`&split_factor=${u}`),l&&(b+=`&split_count=${l}`),d&&d.length>0&&(b+=`&providers=${d.join(",")}`),t.length>0&&(b+=`&apiKey=${t}`),b+=`&v=${Xg}`,yield fetch(b)}catch(n){return console.error(n),null}})}function uC(e,t){return pt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:o,depth:s,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:d}=t,p=Ui(r),w=Ui(n),b=`${e}/find_routes`,y=l==null?void 0:l.join(","),T={from:p,target:w,amount:Number(i.toString()),by_amount_in:o,depth:s,split_algorithm:a,split_factor:c,split_count:u,providers:y,liquidity_changes:d.map(O=>({pool:O.poolID,tick_lower:O.ticklower,tick_upper:O.tickUpper,delta_liquidity:O.deltaLiquidity})),v:Xg};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}catch(O){return console.error("Error:",O),null}})}function lC(e){return pt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var td=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(td||{});const Jg="0x2::sui::SUI",fC="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function Qg(e){return Rr(e).full_address===Jg}function e1(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function Rr(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const u={...Rr(r),type_arguments:i.map(l=>Rr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>Qg(l)?l:Rr(l).source_address),u.source_address=e1(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===Jg||r===fC?"0x2":Yr(o[0]),module:o[1],name:o[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=e1(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function dC(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const bi=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Yr(n);return t&&(i=dC(i)),`${i}::${r.join("::")}`};/*!
35
- * decimal.js v10.4.3
29
+ */(function(N){const k=r,F=T,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=H,N.SlowBuffer=v,N.INSPECT_MAX_BYTES=50;const W=2147483647;N.kMaxLength=W;const{Uint8Array:z,ArrayBuffer:G,SharedArrayBuffer:re}=globalThis;H.TYPED_ARRAY_SUPPORT=oe(),!H.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oe(){try{const j=new z(1),E={foo:function(){return 42}};return Object.setPrototypeOf(E,z.prototype),Object.setPrototypeOf(j,E),j.foo()===42}catch{return!1}}Object.defineProperty(H.prototype,"parent",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.buffer}}),Object.defineProperty(H.prototype,"offset",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.byteOffset}});function ae(j){if(j>W)throw new RangeError('The value "'+j+'" is invalid for option "size"');const E=new z(j);return Object.setPrototypeOf(E,H.prototype),E}function H(j,E,M){if(typeof j=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(j)}return D(j,E,M)}H.poolSize=8192;function D(j,E,M){if(typeof j=="string")return S(j,E);if(G.isView(j))return _(j);if(j==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j);if(gt(j,G)||j&&gt(j.buffer,G)||typeof re<"u"&&(gt(j,re)||j&&gt(j.buffer,re)))return I(j,E,M);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=j.valueOf&&j.valueOf();if($!=null&&$!==j)return H.from($,E,M);const Y=C(j);if(Y)return Y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return H.from(j[Symbol.toPrimitive]("string"),E,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}H.from=function(j,E,M){return D(j,E,M)},Object.setPrototypeOf(H.prototype,z.prototype),Object.setPrototypeOf(H,z);function h(j){if(typeof j!="number")throw new TypeError('"size" argument must be of type number');if(j<0)throw new RangeError('The value "'+j+'" is invalid for option "size"')}function f(j,E,M){return h(j),j<=0?ae(j):E!==void 0?typeof M=="string"?ae(j).fill(E,M):ae(j).fill(E):ae(j)}H.alloc=function(j,E,M){return f(j,E,M)};function m(j){return h(j),ae(j<0?0:g(j)|0)}H.allocUnsafe=function(j){return m(j)},H.allocUnsafeSlow=function(j){return m(j)};function S(j,E){if((typeof E!="string"||E==="")&&(E="utf8"),!H.isEncoding(E))throw new TypeError("Unknown encoding: "+E);const M=R(j,E)|0;let $=ae(M);const Y=$.write(j,E);return Y!==M&&($=$.slice(0,Y)),$}function A(j){const E=j.length<0?0:g(j.length)|0,M=ae(E);for(let $=0;$<E;$+=1)M[$]=j[$]&255;return M}function _(j){if(gt(j,z)){const E=new z(j);return I(E.buffer,E.byteOffset,E.byteLength)}return A(j)}function I(j,E,M){if(E<0||j.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<E+(M||0))throw new RangeError('"length" is outside of buffer bounds');let $;return E===void 0&&M===void 0?$=new z(j):M===void 0?$=new z(j,E):$=new z(j,E,M),Object.setPrototypeOf($,H.prototype),$}function C(j){if(H.isBuffer(j)){const E=g(j.length)|0,M=ae(E);return M.length===0||j.copy(M,0,0,E),M}if(j.length!==void 0)return typeof j.length!="number"||Nt(j.length)?ae(0):A(j);if(j.type==="Buffer"&&Array.isArray(j.data))return A(j.data)}function g(j){if(j>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return j|0}function v(j){return+j!=j&&(j=0),H.alloc(+j)}H.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==H.prototype},H.compare=function(E,M){if(gt(E,z)&&(E=H.from(E,E.offset,E.byteLength)),gt(M,z)&&(M=H.from(M,M.offset,M.byteLength)),!H.isBuffer(E)||!H.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===M)return 0;let $=E.length,Y=M.length;for(let ee=0,ie=Math.min($,Y);ee<ie;++ee)if(E[ee]!==M[ee]){$=E[ee],Y=M[ee];break}return $<Y?-1:Y<$?1:0},H.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},H.concat=function(E,M){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return H.alloc(0);let $;if(M===void 0)for(M=0,$=0;$<E.length;++$)M+=E[$].length;const Y=H.allocUnsafe(M);let ee=0;for($=0;$<E.length;++$){let ie=E[$];if(gt(ie,z))ee+ie.length>Y.length?(H.isBuffer(ie)||(ie=H.from(ie)),ie.copy(Y,ee)):z.prototype.set.call(Y,ie,ee);else if(H.isBuffer(ie))ie.copy(Y,ee);else throw new TypeError('"list" argument must be an Array of Buffers');ee+=ie.length}return Y};function R(j,E){if(H.isBuffer(j))return j.length;if(G.isView(j)||gt(j,G))return j.byteLength;if(typeof j!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof j);const M=j.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&M===0)return 0;let Y=!1;for(;;)switch(E){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return Rt(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return At(j).length;default:if(Y)return $?-1:Rt(j).length;E=(""+E).toLowerCase(),Y=!0}}H.byteLength=R;function J(j,E,M){let $=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((M===void 0||M>this.length)&&(M=this.length),M<=0)||(M>>>=0,E>>>=0,M<=E))return"";for(j||(j="utf8");;)switch(j){case"hex":return Ve(this,E,M);case"utf8":case"utf-8":return ke(this,E,M);case"ascii":return pe(this,E,M);case"latin1":case"binary":return Ce(this,E,M);case"base64":return dt(this,E,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return je(this,E,M);default:if($)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),$=!0}}H.prototype._isBuffer=!0;function Q(j,E,M){const $=j[E];j[E]=j[M],j[M]=$}H.prototype.swap16=function(){const E=this.length;if(E%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let M=0;M<E;M+=2)Q(this,M,M+1);return this},H.prototype.swap32=function(){const E=this.length;if(E%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let M=0;M<E;M+=4)Q(this,M,M+3),Q(this,M+1,M+2);return this},H.prototype.swap64=function(){const E=this.length;if(E%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let M=0;M<E;M+=8)Q(this,M,M+7),Q(this,M+1,M+6),Q(this,M+2,M+5),Q(this,M+3,M+4);return this},H.prototype.toString=function(){const E=this.length;return E===0?"":arguments.length===0?ke(this,0,E):J.apply(this,arguments)},H.prototype.toLocaleString=H.prototype.toString,H.prototype.equals=function(E){if(!H.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E?!0:H.compare(this,E)===0},H.prototype.inspect=function(){let E="";const M=N.INSPECT_MAX_BYTES;return E=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(E+=" ... "),"<Buffer "+E+">"},L&&(H.prototype[L]=H.prototype.inspect),H.prototype.compare=function(E,M,$,Y,ee){if(gt(E,z)&&(E=H.from(E,E.offset,E.byteLength)),!H.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(M===void 0&&(M=0),$===void 0&&($=E?E.length:0),Y===void 0&&(Y=0),ee===void 0&&(ee=this.length),M<0||$>E.length||Y<0||ee>this.length)throw new RangeError("out of range index");if(Y>=ee&&M>=$)return 0;if(Y>=ee)return-1;if(M>=$)return 1;if(M>>>=0,$>>>=0,Y>>>=0,ee>>>=0,this===E)return 0;let ie=ee-Y,Be=$-M;const Je=Math.min(ie,Be),Re=this.slice(Y,ee),V=E.slice(M,$);for(let se=0;se<Je;++se)if(Re[se]!==V[se]){ie=Re[se],Be=V[se];break}return ie<Be?-1:Be<ie?1:0};function ue(j,E,M,$,Y){if(j.length===0)return-1;if(typeof M=="string"?($=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,Nt(M)&&(M=Y?0:j.length-1),M<0&&(M=j.length+M),M>=j.length){if(Y)return-1;M=j.length-1}else if(M<0)if(Y)M=0;else return-1;if(typeof E=="string"&&(E=H.from(E,$)),H.isBuffer(E))return E.length===0?-1:_e(j,E,M,$,Y);if(typeof E=="number")return E=E&255,typeof z.prototype.indexOf=="function"?Y?z.prototype.indexOf.call(j,E,M):z.prototype.lastIndexOf.call(j,E,M):_e(j,[E],M,$,Y);throw new TypeError("val must be string, number or Buffer")}function _e(j,E,M,$,Y){let ee=1,ie=j.length,Be=E.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(j.length<2||E.length<2)return-1;ee=2,ie/=2,Be/=2,M/=2}function Je(V,se){return ee===1?V[se]:V.readUInt16BE(se*ee)}let Re;if(Y){let V=-1;for(Re=M;Re<ie;Re++)if(Je(j,Re)===Je(E,V===-1?0:Re-V)){if(V===-1&&(V=Re),Re-V+1===Be)return V*ee}else V!==-1&&(Re-=Re-V),V=-1}else for(M+Be>ie&&(M=ie-Be),Re=M;Re>=0;Re--){let V=!0;for(let se=0;se<Be;se++)if(Je(j,Re+se)!==Je(E,se)){V=!1;break}if(V)return Re}return-1}H.prototype.includes=function(E,M,$){return this.indexOf(E,M,$)!==-1},H.prototype.indexOf=function(E,M,$){return ue(this,E,M,$,!0)},H.prototype.lastIndexOf=function(E,M,$){return ue(this,E,M,$,!1)};function de(j,E,M,$){M=Number(M)||0;const Y=j.length-M;$?($=Number($),$>Y&&($=Y)):$=Y;const ee=E.length;$>ee/2&&($=ee/2);let ie;for(ie=0;ie<$;++ie){const Be=parseInt(E.substr(ie*2,2),16);if(Nt(Be))return ie;j[M+ie]=Be}return ie}function be(j,E,M,$){return Ge(Rt(E,j.length-M),j,M,$)}function De(j,E,M,$){return Ge(et(E),j,M,$)}function Ne(j,E,M,$){return Ge(At(E),j,M,$)}function ft(j,E,M,$){return Ge(xt(E,j.length-M),j,M,$)}H.prototype.write=function(E,M,$,Y){if(M===void 0)Y="utf8",$=this.length,M=0;else if($===void 0&&typeof M=="string")Y=M,$=this.length,M=0;else if(isFinite(M))M=M>>>0,isFinite($)?($=$>>>0,Y===void 0&&(Y="utf8")):(Y=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ee=this.length-M;if(($===void 0||$>ee)&&($=ee),E.length>0&&($<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");let ie=!1;for(;;)switch(Y){case"hex":return de(this,E,M,$);case"utf8":case"utf-8":return be(this,E,M,$);case"ascii":case"latin1":case"binary":return De(this,E,M,$);case"base64":return Ne(this,E,M,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ft(this,E,M,$);default:if(ie)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),ie=!0}},H.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(j,E,M){return E===0&&M===j.length?k.fromByteArray(j):k.fromByteArray(j.slice(E,M))}function ke(j,E,M){M=Math.min(j.length,M);const $=[];let Y=E;for(;Y<M;){const ee=j[Y];let ie=null,Be=ee>239?4:ee>223?3:ee>191?2:1;if(Y+Be<=M){let Je,Re,V,se;switch(Be){case 1:ee<128&&(ie=ee);break;case 2:Je=j[Y+1],(Je&192)===128&&(se=(ee&31)<<6|Je&63,se>127&&(ie=se));break;case 3:Je=j[Y+1],Re=j[Y+2],(Je&192)===128&&(Re&192)===128&&(se=(ee&15)<<12|(Je&63)<<6|Re&63,se>2047&&(se<55296||se>57343)&&(ie=se));break;case 4:Je=j[Y+1],Re=j[Y+2],V=j[Y+3],(Je&192)===128&&(Re&192)===128&&(V&192)===128&&(se=(ee&15)<<18|(Je&63)<<12|(Re&63)<<6|V&63,se>65535&&se<1114112&&(ie=se))}}ie===null?(ie=65533,Be=1):ie>65535&&(ie-=65536,$.push(ie>>>10&1023|55296),ie=56320|ie&1023),$.push(ie),Y+=Be}return we($)}const mt=4096;function we(j){const E=j.length;if(E<=mt)return String.fromCharCode.apply(String,j);let M="",$=0;for(;$<E;)M+=String.fromCharCode.apply(String,j.slice($,$+=mt));return M}function pe(j,E,M){let $="";M=Math.min(j.length,M);for(let Y=E;Y<M;++Y)$+=String.fromCharCode(j[Y]&127);return $}function Ce(j,E,M){let $="";M=Math.min(j.length,M);for(let Y=E;Y<M;++Y)$+=String.fromCharCode(j[Y]);return $}function Ve(j,E,M){const $=j.length;(!E||E<0)&&(E=0),(!M||M<0||M>$)&&(M=$);let Y="";for(let ee=E;ee<M;++ee)Y+=nt[j[ee]];return Y}function je(j,E,M){const $=j.slice(E,M);let Y="";for(let ee=0;ee<$.length-1;ee+=2)Y+=String.fromCharCode($[ee]+$[ee+1]*256);return Y}H.prototype.slice=function(E,M){const $=this.length;E=~~E,M=M===void 0?$:~~M,E<0?(E+=$,E<0&&(E=0)):E>$&&(E=$),M<0?(M+=$,M<0&&(M=0)):M>$&&(M=$),M<E&&(M=E);const Y=this.subarray(E,M);return Object.setPrototypeOf(Y,H.prototype),Y};function Ae(j,E,M){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+E>M)throw new RangeError("Trying to access beyond buffer length")}H.prototype.readUintLE=H.prototype.readUIntLE=function(E,M,$){E=E>>>0,M=M>>>0,$||Ae(E,M,this.length);let Y=this[E],ee=1,ie=0;for(;++ie<M&&(ee*=256);)Y+=this[E+ie]*ee;return Y},H.prototype.readUintBE=H.prototype.readUIntBE=function(E,M,$){E=E>>>0,M=M>>>0,$||Ae(E,M,this.length);let Y=this[E+--M],ee=1;for(;M>0&&(ee*=256);)Y+=this[E+--M]*ee;return Y},H.prototype.readUint8=H.prototype.readUInt8=function(E,M){return E=E>>>0,M||Ae(E,1,this.length),this[E]},H.prototype.readUint16LE=H.prototype.readUInt16LE=function(E,M){return E=E>>>0,M||Ae(E,2,this.length),this[E]|this[E+1]<<8},H.prototype.readUint16BE=H.prototype.readUInt16BE=function(E,M){return E=E>>>0,M||Ae(E,2,this.length),this[E]<<8|this[E+1]},H.prototype.readUint32LE=H.prototype.readUInt32LE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+this[E+3]*16777216},H.prototype.readUint32BE=H.prototype.readUInt32BE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),this[E]*16777216+(this[E+1]<<16|this[E+2]<<8|this[E+3])},H.prototype.readBigUInt64LE=St(function(E){E=E>>>0,_t(E,"offset");const M=this[E],$=this[E+7];(M===void 0||$===void 0)&&Pt(E,this.length-8);const Y=M+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24,ee=this[++E]+this[++E]*2**8+this[++E]*2**16+$*2**24;return BigInt(Y)+(BigInt(ee)<<BigInt(32))}),H.prototype.readBigUInt64BE=St(function(E){E=E>>>0,_t(E,"offset");const M=this[E],$=this[E+7];(M===void 0||$===void 0)&&Pt(E,this.length-8);const Y=M*2**24+this[++E]*2**16+this[++E]*2**8+this[++E],ee=this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+$;return(BigInt(Y)<<BigInt(32))+BigInt(ee)}),H.prototype.readIntLE=function(E,M,$){E=E>>>0,M=M>>>0,$||Ae(E,M,this.length);let Y=this[E],ee=1,ie=0;for(;++ie<M&&(ee*=256);)Y+=this[E+ie]*ee;return ee*=128,Y>=ee&&(Y-=Math.pow(2,8*M)),Y},H.prototype.readIntBE=function(E,M,$){E=E>>>0,M=M>>>0,$||Ae(E,M,this.length);let Y=M,ee=1,ie=this[E+--Y];for(;Y>0&&(ee*=256);)ie+=this[E+--Y]*ee;return ee*=128,ie>=ee&&(ie-=Math.pow(2,8*M)),ie},H.prototype.readInt8=function(E,M){return E=E>>>0,M||Ae(E,1,this.length),this[E]&128?(255-this[E]+1)*-1:this[E]},H.prototype.readInt16LE=function(E,M){E=E>>>0,M||Ae(E,2,this.length);const $=this[E]|this[E+1]<<8;return $&32768?$|4294901760:$},H.prototype.readInt16BE=function(E,M){E=E>>>0,M||Ae(E,2,this.length);const $=this[E+1]|this[E]<<8;return $&32768?$|4294901760:$},H.prototype.readInt32LE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},H.prototype.readInt32BE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},H.prototype.readBigInt64LE=St(function(E){E=E>>>0,_t(E,"offset");const M=this[E],$=this[E+7];(M===void 0||$===void 0)&&Pt(E,this.length-8);const Y=this[E+4]+this[E+5]*2**8+this[E+6]*2**16+($<<24);return(BigInt(Y)<<BigInt(32))+BigInt(M+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24)}),H.prototype.readBigInt64BE=St(function(E){E=E>>>0,_t(E,"offset");const M=this[E],$=this[E+7];(M===void 0||$===void 0)&&Pt(E,this.length-8);const Y=(M<<24)+this[++E]*2**16+this[++E]*2**8+this[++E];return(BigInt(Y)<<BigInt(32))+BigInt(this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+$)}),H.prototype.readFloatLE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),F.read(this,E,!0,23,4)},H.prototype.readFloatBE=function(E,M){return E=E>>>0,M||Ae(E,4,this.length),F.read(this,E,!1,23,4)},H.prototype.readDoubleLE=function(E,M){return E=E>>>0,M||Ae(E,8,this.length),F.read(this,E,!0,52,8)},H.prototype.readDoubleBE=function(E,M){return E=E>>>0,M||Ae(E,8,this.length),F.read(this,E,!1,52,8)};function Te(j,E,M,$,Y,ee){if(!H.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>Y||E<ee)throw new RangeError('"value" argument is out of bounds');if(M+$>j.length)throw new RangeError("Index out of range")}H.prototype.writeUintLE=H.prototype.writeUIntLE=function(E,M,$,Y){if(E=+E,M=M>>>0,$=$>>>0,!Y){const Be=Math.pow(2,8*$)-1;Te(this,E,M,$,Be,0)}let ee=1,ie=0;for(this[M]=E&255;++ie<$&&(ee*=256);)this[M+ie]=E/ee&255;return M+$},H.prototype.writeUintBE=H.prototype.writeUIntBE=function(E,M,$,Y){if(E=+E,M=M>>>0,$=$>>>0,!Y){const Be=Math.pow(2,8*$)-1;Te(this,E,M,$,Be,0)}let ee=$-1,ie=1;for(this[M+ee]=E&255;--ee>=0&&(ie*=256);)this[M+ee]=E/ie&255;return M+$},H.prototype.writeUint8=H.prototype.writeUInt8=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,1,255,0),this[M]=E&255,M+1},H.prototype.writeUint16LE=H.prototype.writeUInt16LE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,2,65535,0),this[M]=E&255,this[M+1]=E>>>8,M+2},H.prototype.writeUint16BE=H.prototype.writeUInt16BE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,2,65535,0),this[M]=E>>>8,this[M+1]=E&255,M+2},H.prototype.writeUint32LE=H.prototype.writeUInt32LE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,4,4294967295,0),this[M+3]=E>>>24,this[M+2]=E>>>16,this[M+1]=E>>>8,this[M]=E&255,M+4},H.prototype.writeUint32BE=H.prototype.writeUInt32BE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,4,4294967295,0),this[M]=E>>>24,this[M+1]=E>>>16,this[M+2]=E>>>8,this[M+3]=E&255,M+4};function $e(j,E,M,$,Y){Qe(E,$,Y,j,M,7);let ee=Number(E&BigInt(4294967295));j[M++]=ee,ee=ee>>8,j[M++]=ee,ee=ee>>8,j[M++]=ee,ee=ee>>8,j[M++]=ee;let ie=Number(E>>BigInt(32)&BigInt(4294967295));return j[M++]=ie,ie=ie>>8,j[M++]=ie,ie=ie>>8,j[M++]=ie,ie=ie>>8,j[M++]=ie,M}function ct(j,E,M,$,Y){Qe(E,$,Y,j,M,7);let ee=Number(E&BigInt(4294967295));j[M+7]=ee,ee=ee>>8,j[M+6]=ee,ee=ee>>8,j[M+5]=ee,ee=ee>>8,j[M+4]=ee;let ie=Number(E>>BigInt(32)&BigInt(4294967295));return j[M+3]=ie,ie=ie>>8,j[M+2]=ie,ie=ie>>8,j[M+1]=ie,ie=ie>>8,j[M]=ie,M+8}H.prototype.writeBigUInt64LE=St(function(E,M=0){return $e(this,E,M,BigInt(0),BigInt("0xffffffffffffffff"))}),H.prototype.writeBigUInt64BE=St(function(E,M=0){return ct(this,E,M,BigInt(0),BigInt("0xffffffffffffffff"))}),H.prototype.writeIntLE=function(E,M,$,Y){if(E=+E,M=M>>>0,!Y){const Je=Math.pow(2,8*$-1);Te(this,E,M,$,Je-1,-Je)}let ee=0,ie=1,Be=0;for(this[M]=E&255;++ee<$&&(ie*=256);)E<0&&Be===0&&this[M+ee-1]!==0&&(Be=1),this[M+ee]=(E/ie>>0)-Be&255;return M+$},H.prototype.writeIntBE=function(E,M,$,Y){if(E=+E,M=M>>>0,!Y){const Je=Math.pow(2,8*$-1);Te(this,E,M,$,Je-1,-Je)}let ee=$-1,ie=1,Be=0;for(this[M+ee]=E&255;--ee>=0&&(ie*=256);)E<0&&Be===0&&this[M+ee+1]!==0&&(Be=1),this[M+ee]=(E/ie>>0)-Be&255;return M+$},H.prototype.writeInt8=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,1,127,-128),E<0&&(E=255+E+1),this[M]=E&255,M+1},H.prototype.writeInt16LE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,2,32767,-32768),this[M]=E&255,this[M+1]=E>>>8,M+2},H.prototype.writeInt16BE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,2,32767,-32768),this[M]=E>>>8,this[M+1]=E&255,M+2},H.prototype.writeInt32LE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,4,2147483647,-2147483648),this[M]=E&255,this[M+1]=E>>>8,this[M+2]=E>>>16,this[M+3]=E>>>24,M+4},H.prototype.writeInt32BE=function(E,M,$){return E=+E,M=M>>>0,$||Te(this,E,M,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[M]=E>>>24,this[M+1]=E>>>16,this[M+2]=E>>>8,this[M+3]=E&255,M+4},H.prototype.writeBigInt64LE=St(function(E,M=0){return $e(this,E,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),H.prototype.writeBigInt64BE=St(function(E,M=0){return ct(this,E,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ut(j,E,M,$,Y,ee){if(M+$>j.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function ze(j,E,M,$,Y){return E=+E,M=M>>>0,Y||ut(j,E,M,4),F.write(j,E,M,$,23,4),M+4}H.prototype.writeFloatLE=function(E,M,$){return ze(this,E,M,!0,$)},H.prototype.writeFloatBE=function(E,M,$){return ze(this,E,M,!1,$)};function Dt(j,E,M,$,Y){return E=+E,M=M>>>0,Y||ut(j,E,M,8),F.write(j,E,M,$,52,8),M+8}H.prototype.writeDoubleLE=function(E,M,$){return Dt(this,E,M,!0,$)},H.prototype.writeDoubleBE=function(E,M,$){return Dt(this,E,M,!1,$)},H.prototype.copy=function(E,M,$,Y){if(!H.isBuffer(E))throw new TypeError("argument should be a Buffer");if($||($=0),!Y&&Y!==0&&(Y=this.length),M>=E.length&&(M=E.length),M||(M=0),Y>0&&Y<$&&(Y=$),Y===$||E.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(Y<0)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),E.length-M<Y-$&&(Y=E.length-M+$);const ee=Y-$;return this===E&&typeof z.prototype.copyWithin=="function"?this.copyWithin(M,$,Y):z.prototype.set.call(E,this.subarray($,Y),M),ee},H.prototype.fill=function(E,M,$,Y){if(typeof E=="string"){if(typeof M=="string"?(Y=M,M=0,$=this.length):typeof $=="string"&&(Y=$,$=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!H.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(E.length===1){const ie=E.charCodeAt(0);(Y==="utf8"&&ie<128||Y==="latin1")&&(E=ie)}}else typeof E=="number"?E=E&255:typeof E=="boolean"&&(E=Number(E));if(M<0||this.length<M||this.length<$)throw new RangeError("Out of range index");if($<=M)return this;M=M>>>0,$=$===void 0?this.length:$>>>0,E||(E=0);let ee;if(typeof E=="number")for(ee=M;ee<$;++ee)this[ee]=E;else{const ie=H.isBuffer(E)?E:H.from(E,Y),Be=ie.length;if(Be===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(ee=0;ee<$-M;++ee)this[ee+M]=ie[ee%Be]}return this};const Et={};function Ze(j,E,M){Et[j]=class extends M{constructor(){super(),Object.defineProperty(this,"message",{value:E.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${j}]`,this.stack,delete this.name}get code(){return j}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}Ze("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ze("ERR_INVALID_ARG_TYPE",function(j,E){return`The "${j}" argument must be of type number. Received type ${typeof E}`},TypeError),Ze("ERR_OUT_OF_RANGE",function(j,E,M){let $=`The value of "${j}" is out of range.`,Y=M;return Number.isInteger(M)&&Math.abs(M)>2**32?Y=Ot(String(M)):typeof M=="bigint"&&(Y=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(Y=Ot(Y)),Y+="n"),$+=` It must be ${E}. Received ${Y}`,$},RangeError);function Ot(j){let E="",M=j.length;const $=j[0]==="-"?1:0;for(;M>=$+4;M-=3)E=`_${j.slice(M-3,M)}${E}`;return`${j.slice(0,M)}${E}`}function Ft(j,E,M){_t(E,"offset"),(j[E]===void 0||j[E+M]===void 0)&&Pt(E,j.length-(M+1))}function Qe(j,E,M,$,Y,ee){if(j>M||j<E){const ie=typeof E=="bigint"?"n":"";let Be;throw ee>3?E===0||E===BigInt(0)?Be=`>= 0${ie} and < 2${ie} ** ${(ee+1)*8}${ie}`:Be=`>= -(2${ie} ** ${(ee+1)*8-1}${ie}) and < 2 ** ${(ee+1)*8-1}${ie}`:Be=`>= ${E}${ie} and <= ${M}${ie}`,new Et.ERR_OUT_OF_RANGE("value",Be,j)}Ft($,Y,ee)}function _t(j,E){if(typeof j!="number")throw new Et.ERR_INVALID_ARG_TYPE(E,"number",j)}function Pt(j,E,M){throw Math.floor(j)!==j?(_t(j,M),new Et.ERR_OUT_OF_RANGE(M||"offset","an integer",j)):E<0?new Et.ERR_BUFFER_OUT_OF_BOUNDS:new Et.ERR_OUT_OF_RANGE(M||"offset",`>= ${M?1:0} and <= ${E}`,j)}const rt=/[^+/0-9A-Za-z-_]/g;function Bt(j){if(j=j.split("=")[0],j=j.trim().replace(rt,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function Rt(j,E){E=E||1/0;let M;const $=j.length;let Y=null;const ee=[];for(let ie=0;ie<$;++ie){if(M=j.charCodeAt(ie),M>55295&&M<57344){if(!Y){if(M>56319){(E-=3)>-1&&ee.push(239,191,189);continue}else if(ie+1===$){(E-=3)>-1&&ee.push(239,191,189);continue}Y=M;continue}if(M<56320){(E-=3)>-1&&ee.push(239,191,189),Y=M;continue}M=(Y-55296<<10|M-56320)+65536}else Y&&(E-=3)>-1&&ee.push(239,191,189);if(Y=null,M<128){if((E-=1)<0)break;ee.push(M)}else if(M<2048){if((E-=2)<0)break;ee.push(M>>6|192,M&63|128)}else if(M<65536){if((E-=3)<0)break;ee.push(M>>12|224,M>>6&63|128,M&63|128)}else if(M<1114112){if((E-=4)<0)break;ee.push(M>>18|240,M>>12&63|128,M>>6&63|128,M&63|128)}else throw new Error("Invalid code point")}return ee}function et(j){const E=[];for(let M=0;M<j.length;++M)E.push(j.charCodeAt(M)&255);return E}function xt(j,E){let M,$,Y;const ee=[];for(let ie=0;ie<j.length&&!((E-=2)<0);++ie)M=j.charCodeAt(ie),$=M>>8,Y=M%256,ee.push(Y),ee.push($);return ee}function At(j){return k.toByteArray(Bt(j))}function Ge(j,E,M,$){let Y;for(Y=0;Y<$&&!(Y+M>=E.length||Y>=j.length);++Y)E[Y+M]=j[Y];return Y}function gt(j,E){return j instanceof E||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===E.name}function Nt(j){return j!==j}const nt=function(){const j="0123456789abcdef",E=new Array(256);for(let M=0;M<16;++M){const $=M*16;for(let Y=0;Y<16;++Y)E[$+Y]=j[M]+j[Y]}return E}();function St(j){return typeof BigInt>"u"?zt:j}function zt(){throw new Error("BigInt not supported")}})(t);const O=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=O,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode})(ua);const Zl=Us(ua);var cn={},Xl={exports:{}};Xl.exports,function(e){(function(t,r){function n(D,h){if(!D)throw new Error(h||"Assertion failed")}function i(D,h){D.super_=h;var f=function(){};f.prototype=h.prototype,D.prototype=new f,D.prototype.constructor=D}function o(D,h,f){if(o.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((h==="le"||h==="be")&&(f=h,h=10),this._init(D||0,h||10,f||"be"))}typeof t=="object"?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=ua.Buffer}catch{}o.isBN=function(h){return h instanceof o?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===o.wordSize&&Array.isArray(h.words)},o.max=function(h,f){return h.cmp(f)>0?h:f},o.min=function(h,f){return h.cmp(f)<0?h:f},o.prototype._init=function(h,f,m){if(typeof h=="number")return this._initNumber(h,f,m);if(typeof h=="object")return this._initArray(h,f,m);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),h=h.toString().replace(/\s+/g,"");var S=0;h[0]==="-"&&(S++,this.negative=1),S<h.length&&(f===16?this._parseHex(h,S,m):(this._parseBase(h,f,S),m==="le"&&this._initArray(this.toArray(),f,m)))},o.prototype._initNumber=function(h,f,m){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(n(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),f,m)},o.prototype._initArray=function(h,f,m){if(n(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var A,_,I=0;if(m==="be")for(S=h.length-1,A=0;S>=0;S-=3)_=h[S]|h[S-1]<<8|h[S-2]<<16,this.words[A]|=_<<I&67108863,this.words[A+1]=_>>>26-I&67108863,I+=24,I>=26&&(I-=26,A++);else if(m==="le")for(S=0,A=0;S<h.length;S+=3)_=h[S]|h[S+1]<<8|h[S+2]<<16,this.words[A]|=_<<I&67108863,this.words[A+1]=_>>>26-I&67108863,I+=24,I>=26&&(I-=26,A++);return this._strip()};function a(D,h){var f=D.charCodeAt(h);if(f>=48&&f<=57)return f-48;if(f>=65&&f<=70)return f-55;if(f>=97&&f<=102)return f-87;n(!1,"Invalid character in "+D)}function c(D,h,f){var m=a(D,f);return f-1>=h&&(m|=a(D,f-1)<<4),m}o.prototype._parseHex=function(h,f,m){this.length=Math.ceil((h.length-f)/6),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var A=0,_=0,I;if(m==="be")for(S=h.length-1;S>=f;S-=2)I=c(h,f,S)<<A,this.words[_]|=I&67108863,A>=18?(A-=18,_+=1,this.words[_]|=I>>>26):A+=8;else{var C=h.length-f;for(S=C%2===0?f+1:f;S<h.length;S+=2)I=c(h,f,S)<<A,this.words[_]|=I&67108863,A>=18?(A-=18,_+=1,this.words[_]|=I>>>26):A+=8}this._strip()};function u(D,h,f,m){for(var S=0,A=0,_=Math.min(D.length,f),I=h;I<_;I++){var C=D.charCodeAt(I)-48;S*=m,C>=49?A=C-49+10:C>=17?A=C-17+10:A=C,n(C>=0&&A<m,"Invalid character"),S+=A}return S}o.prototype._parseBase=function(h,f,m){this.words=[0],this.length=1;for(var S=0,A=1;A<=67108863;A*=f)S++;S--,A=A/f|0;for(var _=h.length-m,I=_%S,C=Math.min(_,_-I)+m,g=0,v=m;v<C;v+=S)g=u(h,v,v+S,f),this.imuln(A),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(I!==0){var R=1;for(g=u(h,v,h.length,f),v=0;v<I;v++)R*=f;this.imuln(R),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},o.prototype.copy=function(h){h.words=new Array(this.length);for(var f=0;f<this.length;f++)h.words[f]=this.words[f];h.length=this.length,h.negative=this.negative,h.red=this.red};function l(D,h){D.words=h.words,D.length=h.length,D.negative=h.negative,D.red=h.red}if(o.prototype._move=function(h){l(h,this)},o.prototype.clone=function(){var h=new o(null);return this.copy(h),h},o.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(h,f){h=h||10,f=f|0||1;var m;if(h===16||h==="hex"){m="";for(var S=0,A=0,_=0;_<this.length;_++){var I=this.words[_],C=((I<<S|A)&16777215).toString(16);A=I>>>24-S&16777215,S+=2,S>=26&&(S-=26,_--),A!==0||_!==this.length-1?m=p[6-C.length]+C+m:m=C+m}for(A!==0&&(m=A.toString(16)+m);m.length%f!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(h===(h|0)&&h>=2&&h<=36){var g=b[h],v=x[h];m="";var R=this.clone();for(R.negative=0;!R.isZero();){var J=R.modrn(v).toString(h);R=R.idivn(v),R.isZero()?m=J+m:m=p[g-J.length]+J+m}for(this.isZero()&&(m="0"+m);m.length%f!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(h,f){return this.toArrayLike(s,h,f)}),o.prototype.toArray=function(h,f){return this.toArrayLike(Array,h,f)};var y=function(h,f){return h.allocUnsafe?h.allocUnsafe(f):new h(f)};o.prototype.toArrayLike=function(h,f,m){this._strip();var S=this.byteLength(),A=m||Math.max(1,S);n(S<=A,"byte array longer than desired length"),n(A>0,"Requested array length <= 0");var _=y(h,A),I=f==="le"?"LE":"BE";return this["_toArrayLike"+I](_,S),_},o.prototype._toArrayLikeLE=function(h,f){for(var m=0,S=0,A=0,_=0;A<this.length;A++){var I=this.words[A]<<_|S;h[m++]=I&255,m<h.length&&(h[m++]=I>>8&255),m<h.length&&(h[m++]=I>>16&255),_===6?(m<h.length&&(h[m++]=I>>24&255),S=0,_=0):(S=I>>>24,_+=2)}if(m<h.length)for(h[m++]=S;m<h.length;)h[m++]=0},o.prototype._toArrayLikeBE=function(h,f){for(var m=h.length-1,S=0,A=0,_=0;A<this.length;A++){var I=this.words[A]<<_|S;h[m--]=I&255,m>=0&&(h[m--]=I>>8&255),m>=0&&(h[m--]=I>>16&255),_===6?(m>=0&&(h[m--]=I>>24&255),S=0,_=0):(S=I>>>24,_+=2)}if(m>=0)for(h[m--]=S;m>=0;)h[m--]=0},Math.clz32?o.prototype._countBits=function(h){return 32-Math.clz32(h)}:o.prototype._countBits=function(h){var f=h,m=0;return f>=4096&&(m+=13,f>>>=13),f>=64&&(m+=7,f>>>=7),f>=8&&(m+=4,f>>>=4),f>=2&&(m+=2,f>>>=2),m+f},o.prototype._zeroBits=function(h){if(h===0)return 26;var f=h,m=0;return f&8191||(m+=13,f>>>=13),f&127||(m+=7,f>>>=7),f&15||(m+=4,f>>>=4),f&3||(m+=2,f>>>=2),f&1||m++,m},o.prototype.bitLength=function(){var h=this.words[this.length-1],f=this._countBits(h);return(this.length-1)*26+f};function T(D){for(var h=new Array(D.bitLength()),f=0;f<h.length;f++){var m=f/26|0,S=f%26;h[f]=D.words[m]>>>S&1}return h}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,f=0;f<this.length;f++){var m=this._zeroBits(this.words[f]);if(h+=m,m!==26)break}return h},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},o.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var f=0;f<h.length;f++)this.words[f]=this.words[f]|h.words[f];return this._strip()},o.prototype.ior=function(h){return n((this.negative|h.negative)===0),this.iuor(h)},o.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},o.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},o.prototype.iuand=function(h){var f;this.length>h.length?f=h:f=this;for(var m=0;m<f.length;m++)this.words[m]=this.words[m]&h.words[m];return this.length=f.length,this._strip()},o.prototype.iand=function(h){return n((this.negative|h.negative)===0),this.iuand(h)},o.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},o.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},o.prototype.iuxor=function(h){var f,m;this.length>h.length?(f=this,m=h):(f=h,m=this);for(var S=0;S<m.length;S++)this.words[S]=f.words[S]^m.words[S];if(this!==f)for(;S<f.length;S++)this.words[S]=f.words[S];return this.length=f.length,this._strip()},o.prototype.ixor=function(h){return n((this.negative|h.negative)===0),this.iuxor(h)},o.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},o.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},o.prototype.inotn=function(h){n(typeof h=="number"&&h>=0);var f=Math.ceil(h/26)|0,m=h%26;this._expand(f),m>0&&f--;for(var S=0;S<f;S++)this.words[S]=~this.words[S]&67108863;return m>0&&(this.words[S]=~this.words[S]&67108863>>26-m),this._strip()},o.prototype.notn=function(h){return this.clone().inotn(h)},o.prototype.setn=function(h,f){n(typeof h=="number"&&h>=0);var m=h/26|0,S=h%26;return this._expand(m+1),f?this.words[m]=this.words[m]|1<<S:this.words[m]=this.words[m]&~(1<<S),this._strip()},o.prototype.iadd=function(h){var f;if(this.negative!==0&&h.negative===0)return this.negative=0,f=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,f=this.isub(h),h.negative=1,f._normSign();var m,S;this.length>h.length?(m=this,S=h):(m=h,S=this);for(var A=0,_=0;_<S.length;_++)f=(m.words[_]|0)+(S.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;for(;A!==0&&_<m.length;_++)f=(m.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;if(this.length=m.length,A!==0)this.words[this.length]=A,this.length++;else if(m!==this)for(;_<m.length;_++)this.words[_]=m.words[_];return this},o.prototype.add=function(h){var f;return h.negative!==0&&this.negative===0?(h.negative=0,f=this.sub(h),h.negative^=1,f):h.negative===0&&this.negative!==0?(this.negative=0,f=h.sub(this),this.negative=1,f):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},o.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var f=this.iadd(h);return h.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var m=this.cmp(h);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var S,A;m>0?(S=this,A=h):(S=h,A=this);for(var _=0,I=0;I<A.length;I++)f=(S.words[I]|0)-(A.words[I]|0)+_,_=f>>26,this.words[I]=f&67108863;for(;_!==0&&I<S.length;I++)f=(S.words[I]|0)+_,_=f>>26,this.words[I]=f&67108863;if(_===0&&I<S.length&&S!==this)for(;I<S.length;I++)this.words[I]=S.words[I];return this.length=Math.max(this.length,I),S!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(h){return this.clone().isub(h)};function O(D,h,f){f.negative=h.negative^D.negative;var m=D.length+h.length|0;f.length=m,m=m-1|0;var S=D.words[0]|0,A=h.words[0]|0,_=S*A,I=_&67108863,C=_/67108864|0;f.words[0]=I;for(var g=1;g<m;g++){for(var v=C>>>26,R=C&67108863,J=Math.min(g,h.length-1),Q=Math.max(0,g-D.length+1);Q<=J;Q++){var ue=g-Q|0;S=D.words[ue]|0,A=h.words[Q]|0,_=S*A+R,v+=_/67108864|0,R=_&67108863}f.words[g]=R|0,C=v|0}return C!==0?f.words[g]=C|0:f.length--,f._strip()}var N=function(h,f,m){var S=h.words,A=f.words,_=m.words,I=0,C,g,v,R=S[0]|0,J=R&8191,Q=R>>>13,ue=S[1]|0,_e=ue&8191,de=ue>>>13,be=S[2]|0,De=be&8191,Ne=be>>>13,ft=S[3]|0,dt=ft&8191,ke=ft>>>13,mt=S[4]|0,we=mt&8191,pe=mt>>>13,Ce=S[5]|0,Ve=Ce&8191,je=Ce>>>13,Ae=S[6]|0,Te=Ae&8191,$e=Ae>>>13,ct=S[7]|0,ut=ct&8191,ze=ct>>>13,Dt=S[8]|0,Et=Dt&8191,Ze=Dt>>>13,Ot=S[9]|0,Ft=Ot&8191,Qe=Ot>>>13,_t=A[0]|0,Pt=_t&8191,rt=_t>>>13,Bt=A[1]|0,Rt=Bt&8191,et=Bt>>>13,xt=A[2]|0,At=xt&8191,Ge=xt>>>13,gt=A[3]|0,Nt=gt&8191,nt=gt>>>13,St=A[4]|0,zt=St&8191,j=St>>>13,E=A[5]|0,M=E&8191,$=E>>>13,Y=A[6]|0,ee=Y&8191,ie=Y>>>13,Be=A[7]|0,Je=Be&8191,Re=Be>>>13,V=A[8]|0,se=V&8191,fe=V>>>13,Oe=A[9]|0,He=Oe&8191,Pe=Oe>>>13;m.negative=h.negative^f.negative,m.length=19,C=Math.imul(J,Pt),g=Math.imul(J,rt),g=g+Math.imul(Q,Pt)|0,v=Math.imul(Q,rt);var Fe=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,C=Math.imul(_e,Pt),g=Math.imul(_e,rt),g=g+Math.imul(de,Pt)|0,v=Math.imul(de,rt),C=C+Math.imul(J,Rt)|0,g=g+Math.imul(J,et)|0,g=g+Math.imul(Q,Rt)|0,v=v+Math.imul(Q,et)|0;var st=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(st>>>26)|0,st&=67108863,C=Math.imul(De,Pt),g=Math.imul(De,rt),g=g+Math.imul(Ne,Pt)|0,v=Math.imul(Ne,rt),C=C+Math.imul(_e,Rt)|0,g=g+Math.imul(_e,et)|0,g=g+Math.imul(de,Rt)|0,v=v+Math.imul(de,et)|0,C=C+Math.imul(J,At)|0,g=g+Math.imul(J,Ge)|0,g=g+Math.imul(Q,At)|0,v=v+Math.imul(Q,Ge)|0;var er=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(er>>>26)|0,er&=67108863,C=Math.imul(dt,Pt),g=Math.imul(dt,rt),g=g+Math.imul(ke,Pt)|0,v=Math.imul(ke,rt),C=C+Math.imul(De,Rt)|0,g=g+Math.imul(De,et)|0,g=g+Math.imul(Ne,Rt)|0,v=v+Math.imul(Ne,et)|0,C=C+Math.imul(_e,At)|0,g=g+Math.imul(_e,Ge)|0,g=g+Math.imul(de,At)|0,v=v+Math.imul(de,Ge)|0,C=C+Math.imul(J,Nt)|0,g=g+Math.imul(J,nt)|0,g=g+Math.imul(Q,Nt)|0,v=v+Math.imul(Q,nt)|0;var Lt=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,C=Math.imul(we,Pt),g=Math.imul(we,rt),g=g+Math.imul(pe,Pt)|0,v=Math.imul(pe,rt),C=C+Math.imul(dt,Rt)|0,g=g+Math.imul(dt,et)|0,g=g+Math.imul(ke,Rt)|0,v=v+Math.imul(ke,et)|0,C=C+Math.imul(De,At)|0,g=g+Math.imul(De,Ge)|0,g=g+Math.imul(Ne,At)|0,v=v+Math.imul(Ne,Ge)|0,C=C+Math.imul(_e,Nt)|0,g=g+Math.imul(_e,nt)|0,g=g+Math.imul(de,Nt)|0,v=v+Math.imul(de,nt)|0,C=C+Math.imul(J,zt)|0,g=g+Math.imul(J,j)|0,g=g+Math.imul(Q,zt)|0,v=v+Math.imul(Q,j)|0;var Ut=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,C=Math.imul(Ve,Pt),g=Math.imul(Ve,rt),g=g+Math.imul(je,Pt)|0,v=Math.imul(je,rt),C=C+Math.imul(we,Rt)|0,g=g+Math.imul(we,et)|0,g=g+Math.imul(pe,Rt)|0,v=v+Math.imul(pe,et)|0,C=C+Math.imul(dt,At)|0,g=g+Math.imul(dt,Ge)|0,g=g+Math.imul(ke,At)|0,v=v+Math.imul(ke,Ge)|0,C=C+Math.imul(De,Nt)|0,g=g+Math.imul(De,nt)|0,g=g+Math.imul(Ne,Nt)|0,v=v+Math.imul(Ne,nt)|0,C=C+Math.imul(_e,zt)|0,g=g+Math.imul(_e,j)|0,g=g+Math.imul(de,zt)|0,v=v+Math.imul(de,j)|0,C=C+Math.imul(J,M)|0,g=g+Math.imul(J,$)|0,g=g+Math.imul(Q,M)|0,v=v+Math.imul(Q,$)|0;var lr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(lr>>>26)|0,lr&=67108863,C=Math.imul(Te,Pt),g=Math.imul(Te,rt),g=g+Math.imul($e,Pt)|0,v=Math.imul($e,rt),C=C+Math.imul(Ve,Rt)|0,g=g+Math.imul(Ve,et)|0,g=g+Math.imul(je,Rt)|0,v=v+Math.imul(je,et)|0,C=C+Math.imul(we,At)|0,g=g+Math.imul(we,Ge)|0,g=g+Math.imul(pe,At)|0,v=v+Math.imul(pe,Ge)|0,C=C+Math.imul(dt,Nt)|0,g=g+Math.imul(dt,nt)|0,g=g+Math.imul(ke,Nt)|0,v=v+Math.imul(ke,nt)|0,C=C+Math.imul(De,zt)|0,g=g+Math.imul(De,j)|0,g=g+Math.imul(Ne,zt)|0,v=v+Math.imul(Ne,j)|0,C=C+Math.imul(_e,M)|0,g=g+Math.imul(_e,$)|0,g=g+Math.imul(de,M)|0,v=v+Math.imul(de,$)|0,C=C+Math.imul(J,ee)|0,g=g+Math.imul(J,ie)|0,g=g+Math.imul(Q,ee)|0,v=v+Math.imul(Q,ie)|0;var Or=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Or>>>26)|0,Or&=67108863,C=Math.imul(ut,Pt),g=Math.imul(ut,rt),g=g+Math.imul(ze,Pt)|0,v=Math.imul(ze,rt),C=C+Math.imul(Te,Rt)|0,g=g+Math.imul(Te,et)|0,g=g+Math.imul($e,Rt)|0,v=v+Math.imul($e,et)|0,C=C+Math.imul(Ve,At)|0,g=g+Math.imul(Ve,Ge)|0,g=g+Math.imul(je,At)|0,v=v+Math.imul(je,Ge)|0,C=C+Math.imul(we,Nt)|0,g=g+Math.imul(we,nt)|0,g=g+Math.imul(pe,Nt)|0,v=v+Math.imul(pe,nt)|0,C=C+Math.imul(dt,zt)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(ke,zt)|0,v=v+Math.imul(ke,j)|0,C=C+Math.imul(De,M)|0,g=g+Math.imul(De,$)|0,g=g+Math.imul(Ne,M)|0,v=v+Math.imul(Ne,$)|0,C=C+Math.imul(_e,ee)|0,g=g+Math.imul(_e,ie)|0,g=g+Math.imul(de,ee)|0,v=v+Math.imul(de,ie)|0,C=C+Math.imul(J,Je)|0,g=g+Math.imul(J,Re)|0,g=g+Math.imul(Q,Je)|0,v=v+Math.imul(Q,Re)|0;var dr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(dr>>>26)|0,dr&=67108863,C=Math.imul(Et,Pt),g=Math.imul(Et,rt),g=g+Math.imul(Ze,Pt)|0,v=Math.imul(Ze,rt),C=C+Math.imul(ut,Rt)|0,g=g+Math.imul(ut,et)|0,g=g+Math.imul(ze,Rt)|0,v=v+Math.imul(ze,et)|0,C=C+Math.imul(Te,At)|0,g=g+Math.imul(Te,Ge)|0,g=g+Math.imul($e,At)|0,v=v+Math.imul($e,Ge)|0,C=C+Math.imul(Ve,Nt)|0,g=g+Math.imul(Ve,nt)|0,g=g+Math.imul(je,Nt)|0,v=v+Math.imul(je,nt)|0,C=C+Math.imul(we,zt)|0,g=g+Math.imul(we,j)|0,g=g+Math.imul(pe,zt)|0,v=v+Math.imul(pe,j)|0,C=C+Math.imul(dt,M)|0,g=g+Math.imul(dt,$)|0,g=g+Math.imul(ke,M)|0,v=v+Math.imul(ke,$)|0,C=C+Math.imul(De,ee)|0,g=g+Math.imul(De,ie)|0,g=g+Math.imul(Ne,ee)|0,v=v+Math.imul(Ne,ie)|0,C=C+Math.imul(_e,Je)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(de,Je)|0,v=v+Math.imul(de,Re)|0,C=C+Math.imul(J,se)|0,g=g+Math.imul(J,fe)|0,g=g+Math.imul(Q,se)|0,v=v+Math.imul(Q,fe)|0;var tr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(tr>>>26)|0,tr&=67108863,C=Math.imul(Ft,Pt),g=Math.imul(Ft,rt),g=g+Math.imul(Qe,Pt)|0,v=Math.imul(Qe,rt),C=C+Math.imul(Et,Rt)|0,g=g+Math.imul(Et,et)|0,g=g+Math.imul(Ze,Rt)|0,v=v+Math.imul(Ze,et)|0,C=C+Math.imul(ut,At)|0,g=g+Math.imul(ut,Ge)|0,g=g+Math.imul(ze,At)|0,v=v+Math.imul(ze,Ge)|0,C=C+Math.imul(Te,Nt)|0,g=g+Math.imul(Te,nt)|0,g=g+Math.imul($e,Nt)|0,v=v+Math.imul($e,nt)|0,C=C+Math.imul(Ve,zt)|0,g=g+Math.imul(Ve,j)|0,g=g+Math.imul(je,zt)|0,v=v+Math.imul(je,j)|0,C=C+Math.imul(we,M)|0,g=g+Math.imul(we,$)|0,g=g+Math.imul(pe,M)|0,v=v+Math.imul(pe,$)|0,C=C+Math.imul(dt,ee)|0,g=g+Math.imul(dt,ie)|0,g=g+Math.imul(ke,ee)|0,v=v+Math.imul(ke,ie)|0,C=C+Math.imul(De,Je)|0,g=g+Math.imul(De,Re)|0,g=g+Math.imul(Ne,Je)|0,v=v+Math.imul(Ne,Re)|0,C=C+Math.imul(_e,se)|0,g=g+Math.imul(_e,fe)|0,g=g+Math.imul(de,se)|0,v=v+Math.imul(de,fe)|0,C=C+Math.imul(J,He)|0,g=g+Math.imul(J,Pe)|0,g=g+Math.imul(Q,He)|0,v=v+Math.imul(Q,Pe)|0;var Er=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Er>>>26)|0,Er&=67108863,C=Math.imul(Ft,Rt),g=Math.imul(Ft,et),g=g+Math.imul(Qe,Rt)|0,v=Math.imul(Qe,et),C=C+Math.imul(Et,At)|0,g=g+Math.imul(Et,Ge)|0,g=g+Math.imul(Ze,At)|0,v=v+Math.imul(Ze,Ge)|0,C=C+Math.imul(ut,Nt)|0,g=g+Math.imul(ut,nt)|0,g=g+Math.imul(ze,Nt)|0,v=v+Math.imul(ze,nt)|0,C=C+Math.imul(Te,zt)|0,g=g+Math.imul(Te,j)|0,g=g+Math.imul($e,zt)|0,v=v+Math.imul($e,j)|0,C=C+Math.imul(Ve,M)|0,g=g+Math.imul(Ve,$)|0,g=g+Math.imul(je,M)|0,v=v+Math.imul(je,$)|0,C=C+Math.imul(we,ee)|0,g=g+Math.imul(we,ie)|0,g=g+Math.imul(pe,ee)|0,v=v+Math.imul(pe,ie)|0,C=C+Math.imul(dt,Je)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(ke,Je)|0,v=v+Math.imul(ke,Re)|0,C=C+Math.imul(De,se)|0,g=g+Math.imul(De,fe)|0,g=g+Math.imul(Ne,se)|0,v=v+Math.imul(Ne,fe)|0,C=C+Math.imul(_e,He)|0,g=g+Math.imul(_e,Pe)|0,g=g+Math.imul(de,He)|0,v=v+Math.imul(de,Pe)|0;var Dn=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,C=Math.imul(Ft,At),g=Math.imul(Ft,Ge),g=g+Math.imul(Qe,At)|0,v=Math.imul(Qe,Ge),C=C+Math.imul(Et,Nt)|0,g=g+Math.imul(Et,nt)|0,g=g+Math.imul(Ze,Nt)|0,v=v+Math.imul(Ze,nt)|0,C=C+Math.imul(ut,zt)|0,g=g+Math.imul(ut,j)|0,g=g+Math.imul(ze,zt)|0,v=v+Math.imul(ze,j)|0,C=C+Math.imul(Te,M)|0,g=g+Math.imul(Te,$)|0,g=g+Math.imul($e,M)|0,v=v+Math.imul($e,$)|0,C=C+Math.imul(Ve,ee)|0,g=g+Math.imul(Ve,ie)|0,g=g+Math.imul(je,ee)|0,v=v+Math.imul(je,ie)|0,C=C+Math.imul(we,Je)|0,g=g+Math.imul(we,Re)|0,g=g+Math.imul(pe,Je)|0,v=v+Math.imul(pe,Re)|0,C=C+Math.imul(dt,se)|0,g=g+Math.imul(dt,fe)|0,g=g+Math.imul(ke,se)|0,v=v+Math.imul(ke,fe)|0,C=C+Math.imul(De,He)|0,g=g+Math.imul(De,Pe)|0,g=g+Math.imul(Ne,He)|0,v=v+Math.imul(Ne,Pe)|0;var Yr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,C=Math.imul(Ft,Nt),g=Math.imul(Ft,nt),g=g+Math.imul(Qe,Nt)|0,v=Math.imul(Qe,nt),C=C+Math.imul(Et,zt)|0,g=g+Math.imul(Et,j)|0,g=g+Math.imul(Ze,zt)|0,v=v+Math.imul(Ze,j)|0,C=C+Math.imul(ut,M)|0,g=g+Math.imul(ut,$)|0,g=g+Math.imul(ze,M)|0,v=v+Math.imul(ze,$)|0,C=C+Math.imul(Te,ee)|0,g=g+Math.imul(Te,ie)|0,g=g+Math.imul($e,ee)|0,v=v+Math.imul($e,ie)|0,C=C+Math.imul(Ve,Je)|0,g=g+Math.imul(Ve,Re)|0,g=g+Math.imul(je,Je)|0,v=v+Math.imul(je,Re)|0,C=C+Math.imul(we,se)|0,g=g+Math.imul(we,fe)|0,g=g+Math.imul(pe,se)|0,v=v+Math.imul(pe,fe)|0,C=C+Math.imul(dt,He)|0,g=g+Math.imul(dt,Pe)|0,g=g+Math.imul(ke,He)|0,v=v+Math.imul(ke,Pe)|0;var Bn=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,C=Math.imul(Ft,zt),g=Math.imul(Ft,j),g=g+Math.imul(Qe,zt)|0,v=Math.imul(Qe,j),C=C+Math.imul(Et,M)|0,g=g+Math.imul(Et,$)|0,g=g+Math.imul(Ze,M)|0,v=v+Math.imul(Ze,$)|0,C=C+Math.imul(ut,ee)|0,g=g+Math.imul(ut,ie)|0,g=g+Math.imul(ze,ee)|0,v=v+Math.imul(ze,ie)|0,C=C+Math.imul(Te,Je)|0,g=g+Math.imul(Te,Re)|0,g=g+Math.imul($e,Je)|0,v=v+Math.imul($e,Re)|0,C=C+Math.imul(Ve,se)|0,g=g+Math.imul(Ve,fe)|0,g=g+Math.imul(je,se)|0,v=v+Math.imul(je,fe)|0,C=C+Math.imul(we,He)|0,g=g+Math.imul(we,Pe)|0,g=g+Math.imul(pe,He)|0,v=v+Math.imul(pe,Pe)|0;var Ni=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ni>>>26)|0,Ni&=67108863,C=Math.imul(Ft,M),g=Math.imul(Ft,$),g=g+Math.imul(Qe,M)|0,v=Math.imul(Qe,$),C=C+Math.imul(Et,ee)|0,g=g+Math.imul(Et,ie)|0,g=g+Math.imul(Ze,ee)|0,v=v+Math.imul(Ze,ie)|0,C=C+Math.imul(ut,Je)|0,g=g+Math.imul(ut,Re)|0,g=g+Math.imul(ze,Je)|0,v=v+Math.imul(ze,Re)|0,C=C+Math.imul(Te,se)|0,g=g+Math.imul(Te,fe)|0,g=g+Math.imul($e,se)|0,v=v+Math.imul($e,fe)|0,C=C+Math.imul(Ve,He)|0,g=g+Math.imul(Ve,Pe)|0,g=g+Math.imul(je,He)|0,v=v+Math.imul(je,Pe)|0;var ji=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(ji>>>26)|0,ji&=67108863,C=Math.imul(Ft,ee),g=Math.imul(Ft,ie),g=g+Math.imul(Qe,ee)|0,v=Math.imul(Qe,ie),C=C+Math.imul(Et,Je)|0,g=g+Math.imul(Et,Re)|0,g=g+Math.imul(Ze,Je)|0,v=v+Math.imul(Ze,Re)|0,C=C+Math.imul(ut,se)|0,g=g+Math.imul(ut,fe)|0,g=g+Math.imul(ze,se)|0,v=v+Math.imul(ze,fe)|0,C=C+Math.imul(Te,He)|0,g=g+Math.imul(Te,Pe)|0,g=g+Math.imul($e,He)|0,v=v+Math.imul($e,Pe)|0;var Ln=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,C=Math.imul(Ft,Je),g=Math.imul(Ft,Re),g=g+Math.imul(Qe,Je)|0,v=Math.imul(Qe,Re),C=C+Math.imul(Et,se)|0,g=g+Math.imul(Et,fe)|0,g=g+Math.imul(Ze,se)|0,v=v+Math.imul(Ze,fe)|0,C=C+Math.imul(ut,He)|0,g=g+Math.imul(ut,Pe)|0,g=g+Math.imul(ze,He)|0,v=v+Math.imul(ze,Pe)|0;var ki=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(ki>>>26)|0,ki&=67108863,C=Math.imul(Ft,se),g=Math.imul(Ft,fe),g=g+Math.imul(Qe,se)|0,v=Math.imul(Qe,fe),C=C+Math.imul(Et,He)|0,g=g+Math.imul(Et,Pe)|0,g=g+Math.imul(Ze,He)|0,v=v+Math.imul(Ze,Pe)|0;var Di=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Di>>>26)|0,Di&=67108863,C=Math.imul(Ft,He),g=Math.imul(Ft,Pe),g=g+Math.imul(Qe,He)|0,v=Math.imul(Qe,Pe);var B=(I+C|0)+((g&8191)<<13)|0;return I=(v+(g>>>13)|0)+(B>>>26)|0,B&=67108863,_[0]=Fe,_[1]=st,_[2]=er,_[3]=Lt,_[4]=Ut,_[5]=lr,_[6]=Or,_[7]=dr,_[8]=tr,_[9]=Er,_[10]=Dn,_[11]=Yr,_[12]=Bn,_[13]=Ni,_[14]=ji,_[15]=Ln,_[16]=ki,_[17]=Di,_[18]=B,I!==0&&(_[19]=I,m.length++),m};Math.imul||(N=O);function k(D,h,f){f.negative=h.negative^D.negative,f.length=D.length+h.length;for(var m=0,S=0,A=0;A<f.length-1;A++){var _=S;S=0;for(var I=m&67108863,C=Math.min(A,h.length-1),g=Math.max(0,A-D.length+1);g<=C;g++){var v=A-g,R=D.words[v]|0,J=h.words[g]|0,Q=R*J,ue=Q&67108863;_=_+(Q/67108864|0)|0,ue=ue+I|0,I=ue&67108863,_=_+(ue>>>26)|0,S+=_>>>26,_&=67108863}f.words[A]=I,m=_,_=S}return m!==0?f.words[A]=m:f.length--,f._strip()}function F(D,h,f){return k(D,h,f)}o.prototype.mulTo=function(h,f){var m,S=this.length+h.length;return this.length===10&&h.length===10?m=N(this,h,f):S<63?m=O(this,h,f):S<1024?m=k(this,h,f):m=F(this,h,f),m},o.prototype.mul=function(h){var f=new o(null);return f.words=new Array(this.length+h.length),this.mulTo(h,f)},o.prototype.mulf=function(h){var f=new o(null);return f.words=new Array(this.length+h.length),F(this,h,f)},o.prototype.imul=function(h){return this.clone().mulTo(h,this)},o.prototype.imuln=function(h){var f=h<0;f&&(h=-h),n(typeof h=="number"),n(h<67108864);for(var m=0,S=0;S<this.length;S++){var A=(this.words[S]|0)*h,_=(A&67108863)+(m&67108863);m>>=26,m+=A/67108864|0,m+=_>>>26,this.words[S]=_&67108863}return m!==0&&(this.words[S]=m,this.length++),f?this.ineg():this},o.prototype.muln=function(h){return this.clone().imuln(h)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(h){var f=T(h);if(f.length===0)return new o(1);for(var m=this,S=0;S<f.length&&f[S]===0;S++,m=m.sqr());if(++S<f.length)for(var A=m.sqr();S<f.length;S++,A=A.sqr())f[S]!==0&&(m=m.mul(A));return m},o.prototype.iushln=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26,S=67108863>>>26-f<<26-f,A;if(f!==0){var _=0;for(A=0;A<this.length;A++){var I=this.words[A]&S,C=(this.words[A]|0)-I<<f;this.words[A]=C|_,_=I>>>26-f}_&&(this.words[A]=_,this.length++)}if(m!==0){for(A=this.length-1;A>=0;A--)this.words[A+m]=this.words[A];for(A=0;A<m;A++)this.words[A]=0;this.length+=m}return this._strip()},o.prototype.ishln=function(h){return n(this.negative===0),this.iushln(h)},o.prototype.iushrn=function(h,f,m){n(typeof h=="number"&&h>=0);var S;f?S=(f-f%26)/26:S=0;var A=h%26,_=Math.min((h-A)/26,this.length),I=67108863^67108863>>>A<<A,C=m;if(S-=_,S=Math.max(0,S),C){for(var g=0;g<_;g++)C.words[g]=this.words[g];C.length=_}if(_!==0)if(this.length>_)for(this.length-=_,g=0;g<this.length;g++)this.words[g]=this.words[g+_];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=S);g--){var R=this.words[g]|0;this.words[g]=v<<26-A|R>>>A,v=R&I}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(h,f,m){return n(this.negative===0),this.iushrn(h,f,m)},o.prototype.shln=function(h){return this.clone().ishln(h)},o.prototype.ushln=function(h){return this.clone().iushln(h)},o.prototype.shrn=function(h){return this.clone().ishrn(h)},o.prototype.ushrn=function(h){return this.clone().iushrn(h)},o.prototype.testn=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26,S=1<<f;if(this.length<=m)return!1;var A=this.words[m];return!!(A&S)},o.prototype.imaskn=function(h){n(typeof h=="number"&&h>=0);var f=h%26,m=(h-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(f!==0&&m++,this.length=Math.min(m,this.length),f!==0){var S=67108863^67108863>>>f<<f;this.words[this.length-1]&=S}return this._strip()},o.prototype.maskn=function(h){return this.clone().imaskn(h)},o.prototype.iaddn=function(h){return n(typeof h=="number"),n(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},o.prototype._iaddn=function(h){this.words[0]+=h;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},o.prototype.isubn=function(h){if(n(typeof h=="number"),n(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this._strip()},o.prototype.addn=function(h){return this.clone().iaddn(h)},o.prototype.subn=function(h){return this.clone().isubn(h)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(h,f,m){var S=h.length+m,A;this._expand(S);var _,I=0;for(A=0;A<h.length;A++){_=(this.words[A+m]|0)+I;var C=(h.words[A]|0)*f;_-=C&67108863,I=(_>>26)-(C/67108864|0),this.words[A+m]=_&67108863}for(;A<this.length-m;A++)_=(this.words[A+m]|0)+I,I=_>>26,this.words[A+m]=_&67108863;if(I===0)return this._strip();for(n(I===-1),I=0,A=0;A<this.length;A++)_=-(this.words[A]|0)+I,I=_>>26,this.words[A]=_&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(h,f){var m=this.length-h.length,S=this.clone(),A=h,_=A.words[A.length-1]|0,I=this._countBits(_);m=26-I,m!==0&&(A=A.ushln(m),S.iushln(m),_=A.words[A.length-1]|0);var C=S.length-A.length,g;if(f!=="mod"){g=new o(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var R=S.clone()._ishlnsubmul(A,1,C);R.negative===0&&(S=R,g&&(g.words[C]=1));for(var J=C-1;J>=0;J--){var Q=(S.words[A.length+J]|0)*67108864+(S.words[A.length+J-1]|0);for(Q=Math.min(Q/_|0,67108863),S._ishlnsubmul(A,Q,J);S.negative!==0;)Q--,S.negative=0,S._ishlnsubmul(A,1,J),S.isZero()||(S.negative^=1);g&&(g.words[J]=Q)}return g&&g._strip(),S._strip(),f!=="div"&&m!==0&&S.iushrn(m),{div:g||null,mod:S}},o.prototype.divmod=function(h,f,m){if(n(!h.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var S,A,_;return this.negative!==0&&h.negative===0?(_=this.neg().divmod(h,f),f!=="mod"&&(S=_.div.neg()),f!=="div"&&(A=_.mod.neg(),m&&A.negative!==0&&A.iadd(h)),{div:S,mod:A}):this.negative===0&&h.negative!==0?(_=this.divmod(h.neg(),f),f!=="mod"&&(S=_.div.neg()),{div:S,mod:_.mod}):this.negative&h.negative?(_=this.neg().divmod(h.neg(),f),f!=="div"&&(A=_.mod.neg(),m&&A.negative!==0&&A.isub(h)),{div:_.div,mod:A}):h.length>this.length||this.cmp(h)<0?{div:new o(0),mod:this}:h.length===1?f==="div"?{div:this.divn(h.words[0]),mod:null}:f==="mod"?{div:null,mod:new o(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new o(this.modrn(h.words[0]))}:this._wordDiv(h,f)},o.prototype.div=function(h){return this.divmod(h,"div",!1).div},o.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},o.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},o.prototype.divRound=function(h){var f=this.divmod(h);if(f.mod.isZero())return f.div;var m=f.div.negative!==0?f.mod.isub(h):f.mod,S=h.ushrn(1),A=h.andln(1),_=m.cmp(S);return _<0||A===1&&_===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},o.prototype.modrn=function(h){var f=h<0;f&&(h=-h),n(h<=67108863);for(var m=(1<<26)%h,S=0,A=this.length-1;A>=0;A--)S=(m*S+(this.words[A]|0))%h;return f?-S:S},o.prototype.modn=function(h){return this.modrn(h)},o.prototype.idivn=function(h){var f=h<0;f&&(h=-h),n(h<=67108863);for(var m=0,S=this.length-1;S>=0;S--){var A=(this.words[S]|0)+m*67108864;this.words[S]=A/h|0,m=A%h}return this._strip(),f?this.ineg():this},o.prototype.divn=function(h){return this.clone().idivn(h)},o.prototype.egcd=function(h){n(h.negative===0),n(!h.isZero());var f=this,m=h.clone();f.negative!==0?f=f.umod(h):f=f.clone();for(var S=new o(1),A=new o(0),_=new o(0),I=new o(1),C=0;f.isEven()&&m.isEven();)f.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=f.clone();!f.isZero();){for(var R=0,J=1;!(f.words[0]&J)&&R<26;++R,J<<=1);if(R>0)for(f.iushrn(R);R-- >0;)(S.isOdd()||A.isOdd())&&(S.iadd(g),A.isub(v)),S.iushrn(1),A.iushrn(1);for(var Q=0,ue=1;!(m.words[0]&ue)&&Q<26;++Q,ue<<=1);if(Q>0)for(m.iushrn(Q);Q-- >0;)(_.isOdd()||I.isOdd())&&(_.iadd(g),I.isub(v)),_.iushrn(1),I.iushrn(1);f.cmp(m)>=0?(f.isub(m),S.isub(_),A.isub(I)):(m.isub(f),_.isub(S),I.isub(A))}return{a:_,b:I,gcd:m.iushln(C)}},o.prototype._invmp=function(h){n(h.negative===0),n(!h.isZero());var f=this,m=h.clone();f.negative!==0?f=f.umod(h):f=f.clone();for(var S=new o(1),A=new o(0),_=m.clone();f.cmpn(1)>0&&m.cmpn(1)>0;){for(var I=0,C=1;!(f.words[0]&C)&&I<26;++I,C<<=1);if(I>0)for(f.iushrn(I);I-- >0;)S.isOdd()&&S.iadd(_),S.iushrn(1);for(var g=0,v=1;!(m.words[0]&v)&&g<26;++g,v<<=1);if(g>0)for(m.iushrn(g);g-- >0;)A.isOdd()&&A.iadd(_),A.iushrn(1);f.cmp(m)>=0?(f.isub(m),S.isub(A)):(m.isub(f),A.isub(S))}var R;return f.cmpn(1)===0?R=S:R=A,R.cmpn(0)<0&&R.iadd(h),R},o.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var f=this.clone(),m=h.clone();f.negative=0,m.negative=0;for(var S=0;f.isEven()&&m.isEven();S++)f.iushrn(1),m.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;m.isEven();)m.iushrn(1);var A=f.cmp(m);if(A<0){var _=f;f=m,m=_}else if(A===0||m.cmpn(1)===0)break;f.isub(m)}while(!0);return m.iushln(S)},o.prototype.invm=function(h){return this.egcd(h).a.umod(h)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(h){return this.words[0]&h},o.prototype.bincn=function(h){n(typeof h=="number");var f=h%26,m=(h-f)/26,S=1<<f;if(this.length<=m)return this._expand(m+1),this.words[m]|=S,this;for(var A=S,_=m;A!==0&&_<this.length;_++){var I=this.words[_]|0;I+=A,A=I>>>26,I&=67108863,this.words[_]=I}return A!==0&&(this.words[_]=A,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(h){var f=h<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this._strip();var m;if(this.length>1)m=1;else{f&&(h=-h),n(h<=67108863,"Number is too big");var S=this.words[0]|0;m=S===h?0:S<h?-1:1}return this.negative!==0?-m|0:m},o.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var f=this.ucmp(h);return this.negative!==0?-f|0:f},o.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var f=0,m=this.length-1;m>=0;m--){var S=this.words[m]|0,A=h.words[m]|0;if(S!==A){S<A?f=-1:S>A&&(f=1);break}}return f},o.prototype.gtn=function(h){return this.cmpn(h)===1},o.prototype.gt=function(h){return this.cmp(h)===1},o.prototype.gten=function(h){return this.cmpn(h)>=0},o.prototype.gte=function(h){return this.cmp(h)>=0},o.prototype.ltn=function(h){return this.cmpn(h)===-1},o.prototype.lt=function(h){return this.cmp(h)===-1},o.prototype.lten=function(h){return this.cmpn(h)<=0},o.prototype.lte=function(h){return this.cmp(h)<=0},o.prototype.eqn=function(h){return this.cmpn(h)===0},o.prototype.eq=function(h){return this.cmp(h)===0},o.red=function(h){return new ae(h)},o.prototype.toRed=function(h){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(h){return this.red=h,this},o.prototype.forceRed=function(h){return n(!this.red,"Already a number in reduction context"),this._forceRed(h)},o.prototype.redAdd=function(h){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},o.prototype.redIAdd=function(h){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},o.prototype.redSub=function(h){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},o.prototype.redISub=function(h){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},o.prototype.redShl=function(h){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},o.prototype.redMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},o.prototype.redIMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(h){return n(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var L={k256:null,p224:null,p192:null,p25519:null};function W(D,h){this.name=D,this.p=new o(h,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var h=new o(null);return h.words=new Array(Math.ceil(this.n/13)),h},W.prototype.ireduce=function(h){var f=h,m;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),m=f.bitLength();while(m>this.n);var S=m<this.n?-1:f.ucmp(this.p);return S===0?(f.words[0]=0,f.length=1):S>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},W.prototype.split=function(h,f){h.iushrn(this.n,0,f)},W.prototype.imulK=function(h){return h.imul(this.k)};function z(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(z,W),z.prototype.split=function(h,f){for(var m=4194303,S=Math.min(h.length,9),A=0;A<S;A++)f.words[A]=h.words[A];if(f.length=S,h.length<=9){h.words[0]=0,h.length=1;return}var _=h.words[9];for(f.words[f.length++]=_&m,A=10;A<h.length;A++){var I=h.words[A]|0;h.words[A-10]=(I&m)<<4|_>>>22,_=I}_>>>=22,h.words[A-10]=_,_===0&&h.length>10?h.length-=10:h.length-=9},z.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var f=0,m=0;m<h.length;m++){var S=h.words[m]|0;f+=S*977,h.words[m]=f&67108863,f=S*64+(f/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function G(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(G,W);function re(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(re,W);function oe(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(oe,W),oe.prototype.imulK=function(h){for(var f=0,m=0;m<h.length;m++){var S=(h.words[m]|0)*19+f,A=S&67108863;S>>>=26,h.words[m]=A,f=S}return f!==0&&(h.words[h.length++]=f),h},o._prime=function(h){if(L[h])return L[h];var f;if(h==="k256")f=new z;else if(h==="p224")f=new G;else if(h==="p192")f=new re;else if(h==="p25519")f=new oe;else throw new Error("Unknown prime "+h);return L[h]=f,f};function ae(D){if(typeof D=="string"){var h=o._prime(D);this.m=h.p,this.prime=h}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}ae.prototype._verify1=function(h){n(h.negative===0,"red works only with positives"),n(h.red,"red works only with red numbers")},ae.prototype._verify2=function(h,f){n((h.negative|f.negative)===0,"red works only with positives"),n(h.red&&h.red===f.red,"red works only with red numbers")},ae.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(l(h,h.umod(this.m)._forceRed(this)),h)},ae.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},ae.prototype.add=function(h,f){this._verify2(h,f);var m=h.add(f);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ae.prototype.iadd=function(h,f){this._verify2(h,f);var m=h.iadd(f);return m.cmp(this.m)>=0&&m.isub(this.m),m},ae.prototype.sub=function(h,f){this._verify2(h,f);var m=h.sub(f);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ae.prototype.isub=function(h,f){this._verify2(h,f);var m=h.isub(f);return m.cmpn(0)<0&&m.iadd(this.m),m},ae.prototype.shl=function(h,f){return this._verify1(h),this.imod(h.ushln(f))},ae.prototype.imul=function(h,f){return this._verify2(h,f),this.imod(h.imul(f))},ae.prototype.mul=function(h,f){return this._verify2(h,f),this.imod(h.mul(f))},ae.prototype.isqr=function(h){return this.imul(h,h.clone())},ae.prototype.sqr=function(h){return this.mul(h,h)},ae.prototype.sqrt=function(h){if(h.isZero())return h.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var m=this.m.add(new o(1)).iushrn(2);return this.pow(h,m)}for(var S=this.m.subn(1),A=0;!S.isZero()&&S.andln(1)===0;)A++,S.iushrn(1);n(!S.isZero());var _=new o(1).toRed(this),I=_.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new o(2*g*g).toRed(this);this.pow(g,C).cmp(I)!==0;)g.redIAdd(I);for(var v=this.pow(g,S),R=this.pow(h,S.addn(1).iushrn(1)),J=this.pow(h,S),Q=A;J.cmp(_)!==0;){for(var ue=J,_e=0;ue.cmp(_)!==0;_e++)ue=ue.redSqr();n(_e<Q);var de=this.pow(v,new o(1).iushln(Q-_e-1));R=R.redMul(de),v=de.redSqr(),J=J.redMul(v),Q=_e}return R},ae.prototype.invm=function(h){var f=h._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},ae.prototype.pow=function(h,f){if(f.isZero())return new o(1).toRed(this);if(f.cmpn(1)===0)return h.clone();var m=4,S=new Array(1<<m);S[0]=new o(1).toRed(this),S[1]=h;for(var A=2;A<S.length;A++)S[A]=this.mul(S[A-1],h);var _=S[0],I=0,C=0,g=f.bitLength()%26;for(g===0&&(g=26),A=f.length-1;A>=0;A--){for(var v=f.words[A],R=g-1;R>=0;R--){var J=v>>R&1;if(_!==S[0]&&(_=this.sqr(_)),J===0&&I===0){C=0;continue}I<<=1,I|=J,C++,!(C!==m&&(A!==0||R!==0))&&(_=this.mul(_,S[I]),C=0,I=0)}g=26}return _},ae.prototype.convertTo=function(h){var f=h.umod(this.m);return f===h?f.clone():f},ae.prototype.convertFrom=function(h){var f=h.clone();return f.red=null,f},o.mont=function(h){return new H(h)};function H(D){ae.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(H,ae),H.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},H.prototype.convertFrom=function(h){var f=this.imod(h.mul(this.rinv));return f.red=null,f},H.prototype.imul=function(h,f){if(h.isZero()||f.isZero())return h.words[0]=0,h.length=1,h;var m=h.imul(f),S=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(S).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},H.prototype.mul=function(h,f){if(h.isZero()||f.isZero())return new o(0)._forceRed(this);var m=h.mul(f),S=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(S).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},H.prototype.invm=function(h){var f=this.imod(h._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,_r)}(Xl);var Up=Xl.exports;const Vp=Us(Up);var fx=_r&&_r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cn,"__esModule",{value:!0}),cn.parseAccumulatorUpdateData=cn.sliceAccumulatorUpdateData=cn.parseTwapMessage=cn.parsePriceFeedMessage=cn.isAccumulatorUpdateData=void 0;const un=fx(Up),dx="504e4155",hx=1,px=0,Jl=20,mx=0,gx=1;function Ql(e){return e.toString("hex").slice(0,8)===dx&&e[4]===hx&&e[5]===px}cn.isAccumulatorUpdateData=Ql;function vx(e){let t=0;if(e.readUInt8(t)!==mx)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new un.default(e.subarray(t,t+8),"be");t+=8;const o=new un.default(e.subarray(t,t+8),"be");t+=8;const s=e.readInt32BE(t);t+=4;const a=new un.default(e.subarray(t,t+8),"be");t+=8;const c=new un.default(e.subarray(t,t+8),"be");t+=8;const u=new un.default(e.subarray(t,t+8),"be");t+=8;const l=new un.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:o,exponent:s,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}cn.parsePriceFeedMessage=vx;function yx(e){let t=0;if(e.readUInt8(t)!==gx)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new un.default(e.subarray(t,t+16),"be");t+=16;const o=new un.default(e.subarray(t,t+16),"be");t+=16;const s=new un.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new un.default(e.subarray(t,t+8),"be");t+=8;const u=new un.default(e.subarray(t,t+8),"be");t+=8;const l=new un.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:o,numDownSlots:s,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}cn.parseTwapMessage=yx;function wx(e,t,r){if(!Ql(e))throw new Error("Invalid accumulator message");let n=6;const i=e.readUint8(n);n+=1+i,n+=1;const o=e.readUint16BE(n);n+=2,n+=o;const s=n,a=[],c=e.readUInt8(n);n+=1;for(let l=0;l<c;l++){const d=n,p=e.readUint16BE(n);n+=2,n+=p;const b=e.readUInt8(n);n+=1,n+=Jl*b,a.push(e.subarray(d,n))}if(n!==e.length)throw new Error("Didn't reach the end of the message");const u=a.slice(t,r);return Zl.concat([e.subarray(0,s),Zl.from([u.length]),...a.slice(t,r)])}cn.sliceAccumulatorUpdateData=wx;function bx(e){if(!Ql(e))throw new Error("Invalid accumulator message");let t=6;const r=e.readUint8(t);t+=1+r,t+=1;const n=e.readUint16BE(t);t+=2;const i=e.subarray(t,t+n);t+=n;const o=e.readUInt8(t),s=[];t+=1;for(let a=0;a<o;a++){const c=e.readUint16BE(t);t+=2;const u=e.subarray(t,t+c);t+=c;const l=e.readUInt8(t);t+=1;const d=[];for(let p=0;p<l;p++)d.push(Array.from(e.subarray(t,t+Jl))),t+=Jl;s.push({message:u,proof:d})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:s}}cn.parseAccumulatorUpdateData=bx,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parseTwapMessage=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=hc;var r=cn;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let o=class e6{constructor(a){vt(this,"emaPrice");vt(this,"id");vt(this,"metadata");vt(this,"vaa");vt(this,"price");this.emaPrice=a.emaPrice,this.id=a.id,this.metadata=a.metadata,this.vaa=a.vaa,this.price=a.price}static fromJson(a){const c=t.Convert.toPriceFeed(a);return new e6({emaPrice:n.fromJson(c.ema_price),id:c.id,metadata:i.fromJson(c.metadata),vaa:c.vaa,price:n.fromJson(c.price)})}toJson(){var c;const a={ema_price:this.emaPrice.toJson(),id:this.id,metadata:(c=this.metadata)==null?void 0:c.toJson(),price:this.price.toJson()};return t.Convert.priceFeedToJson(a)}getPriceUnchecked(){return this.price}getEmaPriceUnchecked(){return this.emaPrice}getPriceNoOlderThan(a){const c=this.getPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getEmaPriceNoOlderThan(a){const c=this.getEmaPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getMetadata(){return this.metadata}getVAA(){return this.vaa}};e.PriceFeed=o}(Wl);function zp(e,t){return function(){return e.apply(t,arguments)}}const{toString:xx}=Object.prototype,{getPrototypeOf:ef}=Object,pc=(e=>t=>{const r=xx.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Mn=e=>(e=e.toLowerCase(),t=>pc(t)===e),mc=e=>t=>typeof t===e,{isArray:ns}=Array,la=mc("undefined");function Sx(e){return e!==null&&!la(e)&&e.constructor!==null&&!la(e.constructor)&&Qr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Hp=Mn("ArrayBuffer");function Ex(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Hp(e.buffer),t}const _x=mc("string"),Qr=mc("function"),qp=mc("number"),gc=e=>e!==null&&typeof e=="object",Cx=e=>e===!0||e===!1,vc=e=>{if(pc(e)!=="object")return!1;const t=ef(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Ax=Mn("Date"),Mx=Mn("File"),Tx=Mn("Blob"),Ix=Mn("FileList"),Ox=e=>gc(e)&&Qr(e.pipe),Px=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Qr(e.append)&&((t=pc(e))==="formdata"||t==="object"&&Qr(e.toString)&&e.toString()==="[object FormData]"))},Rx=Mn("URLSearchParams"),[Nx,jx,kx,Dx]=["ReadableStream","Request","Response","Headers"].map(Mn),Bx=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),ns(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function Wp(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const Co=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:_r)(),Gp=e=>!la(e)&&e!==Co;function tf(){const{caseless:e}=Gp(this)&&this||{},t={},r=(n,i)=>{const o=e&&Wp(t,i)||i;vc(t[o])&&vc(n)?t[o]=tf(t[o],n):vc(n)?t[o]=tf({},n):ns(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&fa(arguments[n],r);return t}const Lx=(e,t,r,{allOwnKeys:n}={})=>(fa(t,(i,o)=>{r&&Qr(i)?e[o]=zp(i,r):e[o]=i},{allOwnKeys:n}),e),$x=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Fx=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Ux=(e,t,r,n)=>{let i,o,s;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&ef(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Vx=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},zx=e=>{if(!e)return null;if(ns(e))return e;let t=e.length;if(!qp(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Hx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ef(Uint8Array)),qx=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},Wx=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Gx=Mn("HTMLFormElement"),Kx=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Kp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Yx=Mn("RegExp"),Yp=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};fa(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Zx=e=>{Yp(e,(t,r)=>{if(Qr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Qr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Xx=(e,t)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return ns(e)?n(e):n(String(e).split(t)),r},Jx=()=>{},Qx=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function e3(e){return!!(e&&Qr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const t3=e=>{const t=new Array(10),r=(n,i)=>{if(gc(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const o=ns(n)?[]:{};return fa(n,(s,a)=>{const c=r(s,i+1);!la(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},r3=Mn("AsyncFunction"),n3=e=>e&&(gc(e)||Qr(e))&&Qr(e.then)&&Qr(e.catch),Zp=((e,t)=>e?setImmediate:t?((r,n)=>(Co.addEventListener("message",({source:i,data:o})=>{i===Co&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Co.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Qr(Co.postMessage)),i3=typeof queueMicrotask<"u"?queueMicrotask.bind(Co):typeof wn<"u"&&wn.nextTick||Zp;var ce={isArray:ns,isArrayBuffer:Hp,isBuffer:Sx,isFormData:Px,isArrayBufferView:Ex,isString:_x,isNumber:qp,isBoolean:Cx,isObject:gc,isPlainObject:vc,isReadableStream:Nx,isRequest:jx,isResponse:kx,isHeaders:Dx,isUndefined:la,isDate:Ax,isFile:Mx,isBlob:Tx,isRegExp:Yx,isFunction:Qr,isStream:Ox,isURLSearchParams:Rx,isTypedArray:Hx,isFileList:Ix,forEach:fa,merge:tf,extend:Lx,trim:Bx,stripBOM:$x,inherits:Fx,toFlatObject:Ux,kindOf:pc,kindOfTest:Mn,endsWith:Vx,toArray:zx,forEachEntry:qx,matchAll:Wx,isHTMLForm:Gx,hasOwnProperty:Kp,hasOwnProp:Kp,reduceDescriptors:Yp,freezeMethods:Zx,toObjectSet:Xx,toCamelCase:Kx,noop:Jx,toFiniteNumber:Qx,findKey:Wp,global:Co,isContextDefined:Gp,isSpecCompliantForm:e3,toJSONObject:t3,isAsyncFn:r3,isThenable:n3,setImmediate:Zp,asap:i3};function ht(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}ce.inherits(ht,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:ce.toJSONObject(this.config),code:this.code,status:this.status}}});const Xp=ht.prototype,Jp={};["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(e=>{Jp[e]={value:e}}),Object.defineProperties(ht,Jp),Object.defineProperty(Xp,"isAxiosError",{value:!0}),ht.from=(e,t,r,n,i,o)=>{const s=Object.create(Xp);return ce.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),ht.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var o3=null;function rf(e){return ce.isPlainObject(e)||ce.isArray(e)}function Qp(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function em(e,t,r){return e?e.concat(t).map(function(i,o){return i=Qp(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function s3(e){return ce.isArray(e)&&!e.some(rf)}const a3=ce.toFlatObject(ce,{},null,function(t){return/^is[A-Z]/.test(t)});function yc(e,t,r){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=ce.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!ce.isUndefined(T[y])});const n=r.metaTokens,i=r.visitor||l,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(i))throw new TypeError("visitor must be a function");function u(x){if(x===null)return"";if(ce.isDate(x))return x.toISOString();if(!c&&ce.isBlob(x))throw new ht("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(x)||ce.isTypedArray(x)?c&&typeof Blob=="function"?new Blob([x]):Zl.from(x):x}function l(x,y,T){let O=x;if(x&&!T&&typeof x=="object"){if(ce.endsWith(y,"{}"))y=n?y:y.slice(0,-2),x=JSON.stringify(x);else if(ce.isArray(x)&&s3(x)||(ce.isFileList(x)||ce.endsWith(y,"[]"))&&(O=ce.toArray(x)))return y=Qp(y),O.forEach(function(k,F){!(ce.isUndefined(k)||k===null)&&t.append(s===!0?em([y],F,o):s===null?y:y+"[]",u(k))}),!1}return rf(x)?!0:(t.append(em(T,y,o),u(x)),!1)}const d=[],p=Object.assign(a3,{defaultVisitor:l,convertValue:u,isVisitable:rf});function b(x,y){if(!ce.isUndefined(x)){if(d.indexOf(x)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(x),ce.forEach(x,function(O,N){(!(ce.isUndefined(O)||O===null)&&i.call(t,O,ce.isString(N)?N.trim():N,y,p))===!0&&b(O,y?y.concat(N):[N])}),d.pop()}}if(!ce.isObject(e))throw new TypeError("data must be an object");return b(e),t}function tm(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function nf(e,t){this._pairs=[],e&&yc(e,this,t)}const rm=nf.prototype;rm.append=function(t,r){this._pairs.push([t,r])},rm.toString=function(t){const r=t?function(n){return t.call(this,n,tm)}:tm;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function c3(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nm(e,t,r){if(!t)return e;const n=r&&r.encode||c3;ce.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let o;if(i?o=i(t,r):o=ce.isURLSearchParams(t)?t.toString():new nf(t,r).toString(n),o){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class u3{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ce.forEach(this.handlers,function(n){n!==null&&t(n)})}}var im=u3,om={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},l3=typeof URLSearchParams<"u"?URLSearchParams:nf,f3=typeof FormData<"u"?FormData:null,d3=typeof Blob<"u"?Blob:null,h3={isBrowser:!0,classes:{URLSearchParams:l3,FormData:f3,Blob:d3},protocols:["http","https","file","blob","url","data"]};const of=typeof window<"u"&&typeof document<"u",sf=typeof navigator=="object"&&navigator||void 0,p3=of&&(!sf||["ReactNative","NativeScript","NS"].indexOf(sf.product)<0),m3=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),g3=of&&window.location.href||"http://localhost";var v3=Object.freeze({__proto__:null,hasBrowserEnv:of,hasStandardBrowserWebWorkerEnv:m3,hasStandardBrowserEnv:p3,navigator:sf,origin:g3}),Rr={...v3,...h3};function y3(e,t){return yc(e,new Rr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return Rr.isNode&&ce.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function w3(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function b3(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function sm(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;const a=Number.isFinite(+s),c=o>=r.length;return s=!s&&ce.isArray(i)?i.length:s,c?(ce.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!ce.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&ce.isArray(i[s])&&(i[s]=b3(i[s])),!a)}if(ce.isFormData(e)&&ce.isFunction(e.entries)){const r={};return ce.forEachEntry(e,(n,i)=>{t(w3(n),i,r,0)}),r}return null}function x3(e,t,r){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const af={transitional:om,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=ce.isObject(t);if(o&&ce.isHTMLForm(t)&&(t=new FormData(t)),ce.isFormData(t))return i?JSON.stringify(sm(t)):t;if(ce.isArrayBuffer(t)||ce.isBuffer(t)||ce.isStream(t)||ce.isFile(t)||ce.isBlob(t)||ce.isReadableStream(t))return t;if(ce.isArrayBufferView(t))return t.buffer;if(ce.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return y3(t,this.formSerializer).toString();if((a=ce.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return yc(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),x3(t)):t}],transformResponse:[function(t){const r=this.transitional||af.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(ce.isResponse(t)||ce.isReadableStream(t))return t;if(t&&ce.isString(t)&&(n&&!this.responseType||i)){const s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?ht.from(a,ht.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rr.classes.FormData,Blob:Rr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],e=>{af.headers[e]={}});var cf=af;const S3=ce.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"]);var E3=e=>{const t={};let r,n,i;return e&&e.split(`
30
+ `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&S3[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const am=Symbol("internals");function da(e){return e&&String(e).trim().toLowerCase()}function wc(e){return e===!1||e==null?e:ce.isArray(e)?e.map(wc):String(e)}function _3(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const C3=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function uf(e,t,r,n,i){if(ce.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!ce.isString(t)){if(ce.isString(n))return t.indexOf(n)!==-1;if(ce.isRegExp(n))return n.test(t)}}function A3(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function M3(e,t){const r=ce.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}class bc{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function o(a,c,u){const l=da(c);if(!l)throw new Error("header name must be a non-empty string");const d=ce.findKey(i,l);(!d||i[d]===void 0||u===!0||u===void 0&&i[d]!==!1)&&(i[d||c]=wc(a))}const s=(a,c)=>ce.forEach(a,(u,l)=>o(u,l,c));if(ce.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(ce.isString(t)&&(t=t.trim())&&!C3(t))s(E3(t),r);else if(ce.isHeaders(t))for(const[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=da(t),t){const n=ce.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return _3(i);if(ce.isFunction(r))return r.call(this,i,n);if(ce.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=da(t),t){const n=ce.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||uf(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function o(s){if(s=da(s),s){const a=ce.findKey(n,s);a&&(!r||uf(n,n[a],a,r))&&(delete n[a],i=!0)}}return ce.isArray(t)?t.forEach(o):o(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const o=r[n];(!t||uf(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const r=this,n={};return ce.forEach(this,(i,o)=>{const s=ce.findKey(n,o);if(s){r[s]=wc(i),delete r[o];return}const a=t?A3(o):String(o).trim();a!==o&&delete r[o],r[a]=wc(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return ce.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&ce.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
31
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[am]=this[am]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=da(s);n[a]||(M3(i,s),n[a]=!0)}return ce.isArray(t)?t.forEach(o):o(t),this}}bc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ce.reduceDescriptors(bc.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),ce.freezeMethods(bc);var Tn=bc;function lf(e,t){const r=this||cf,n=t||r,i=Tn.from(n.headers);let o=n.data;return ce.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function cm(e){return!!(e&&e.__CANCEL__)}function is(e,t,r){ht.call(this,e??"canceled",ht.ERR_CANCELED,t,r),this.name="CanceledError"}ce.inherits(is,ht,{__CANCEL__:!0});function um(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ht("Request failed with status code "+r.status,[ht.ERR_BAD_REQUEST,ht.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function T3(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function I3(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[o];s||(s=u),r[i]=c,n[i]=u;let d=o,p=0;for(;d!==i;)p+=r[d++],d=d%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),u-s<t)return;const b=l&&u-l;return b?Math.round(p*1e3/b):void 0}}function O3(e,t){let r=0,n=1e3/t,i,o;const s=(u,l=Date.now())=>{r=l,i=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),d=l-r;d>=n?s(u,l):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i)]}const xc=(e,t,r=3)=>{let n=0;const i=I3(50,250);return O3(o=>{const s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,u=i(c),l=s<=a;n=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-s)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},lm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},fm=e=>(...t)=>ce.asap(()=>e(...t));var P3=Rr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Rr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Rr.origin),Rr.navigator&&/(msie|trident)/i.test(Rr.navigator.userAgent)):()=>!0,R3=Rr.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];ce.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),ce.isString(n)&&s.push("path="+n),ce.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function N3(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function j3(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function dm(e,t,r){let n=!N3(t);return e&&(n||r==!1)?j3(e,t):t}const hm=e=>e instanceof Tn?{...e}:e;function Ao(e,t){t=t||{};const r={};function n(u,l,d,p){return ce.isPlainObject(u)&&ce.isPlainObject(l)?ce.merge.call({caseless:p},u,l):ce.isPlainObject(l)?ce.merge({},l):ce.isArray(l)?l.slice():l}function i(u,l,d,p){if(ce.isUndefined(l)){if(!ce.isUndefined(u))return n(void 0,u,d,p)}else return n(u,l,d,p)}function o(u,l){if(!ce.isUndefined(l))return n(void 0,l)}function s(u,l){if(ce.isUndefined(l)){if(!ce.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,d){if(d in t)return n(u,l);if(d in e)return n(void 0,u)}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,l,d)=>i(hm(u),hm(l),d,!0)};return ce.forEach(Object.keys(Object.assign({},e,t)),function(l){const d=c[l]||i,p=d(e[l],t[l],l);ce.isUndefined(p)&&d!==a||(r[l]=p)}),r}var pm=e=>{const t=Ao({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=Tn.from(s),t.url=nm(dm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(ce.isFormData(r)){if(Rr.hasStandardBrowserEnv||Rr.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...l]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Rr.hasStandardBrowserEnv&&(n&&ce.isFunction(n)&&(n=n(t)),n||n!==!1&&P3(t.url))){const u=i&&o&&R3.read(o);u&&s.set(i,u)}return t},k3=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=pm(e);let o=i.data;const s=Tn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,d,p,b,x;function y(){b&&b(),x&&x(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function O(){if(!T)return;const k=Tn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:k,config:e,request:T};um(function(z){r(z),y()},function(z){n(z),y()},L),T=null}"onloadend"in T?T.onloadend=O:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(O)},T.onabort=function(){T&&(n(new ht("Request aborted",ht.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new ht("Network Error",ht.ERR_NETWORK,e,T)),T=null},T.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||om;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new ht(F,L.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,e,T)),T=null},o===void 0&&s.setContentType(null),"setRequestHeader"in T&&ce.forEach(s.toJSON(),function(F,L){T.setRequestHeader(L,F)}),ce.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([p,x]=xc(u,!0),T.addEventListener("progress",p)),c&&T.upload&&([d,b]=xc(c),T.upload.addEventListener("progress",d),T.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(l=k=>{T&&(n(!k||k.type?new is(null,e,T):k),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const N=T3(i.url);if(N&&Rr.protocols.indexOf(N)===-1){n(new ht("Unsupported protocol "+N+":",ht.ERR_BAD_REQUEST,e));return}T.send(o||null)})},D3=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const o=function(u){if(!i){i=!0,a();const l=u instanceof Error?u:this.reason;n.abort(l instanceof ht?l:new is(l instanceof Error?l.message:l))}};let s=t&&setTimeout(()=>{s=null,o(new ht(`timeout ${t} of ms exceeded`,ht.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=()=>ce.asap(a),c}};const B3=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},L3=async function*(e,t){for await(const r of $3(e))yield*B3(r,t)},$3=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},mm=(e,t,r,n)=>{const i=L3(e,t);let o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await i.next();if(u){a(),c.close();return}let d=l.byteLength;if(r){let p=o+=d;r(p)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Sc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",gm=Sc&&typeof ReadableStream=="function",F3=Sc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),vm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},U3=gm&&vm(()=>{let e=!1;const t=new Request(Rr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),ym=64*1024,ff=gm&&vm(()=>ce.isReadableStream(new Response("").body)),Ec={stream:ff&&(e=>e.body)};Sc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ec[t]&&(Ec[t]=ce.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new ht(`Response type '${t}' is not supported`,ht.ERR_NOT_SUPPORT,n)})})})(new Response);const V3=async e=>{if(e==null)return 0;if(ce.isBlob(e))return e.size;if(ce.isSpecCompliantForm(e))return(await new Request(Rr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ce.isArrayBufferView(e)||ce.isArrayBuffer(e))return e.byteLength;if(ce.isURLSearchParams(e)&&(e=e+""),ce.isString(e))return(await F3(e)).byteLength},z3=async(e,t)=>{const r=ce.toFiniteNumber(e.getContentLength());return r??V3(t)};var H3=Sc&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:p}=pm(e);u=u?(u+"").toLowerCase():"text";let b=D3([i,o&&o.toAbortSignal()],s),x;const y=b&&b.unsubscribe&&(()=>{b.unsubscribe()});let T;try{if(c&&U3&&r!=="get"&&r!=="head"&&(T=await z3(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(ce.isFormData(n)&&(W=L.headers.get("content-type"))&&l.setContentType(W),L.body){const[z,G]=lm(T,xc(fm(c)));n=mm(L.body,ym,z,G)}}ce.isString(d)||(d=d?"include":"omit");const O="credentials"in Request.prototype;x=new Request(t,{...p,signal:b,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:O?d:void 0});let N=await fetch(x);const k=ff&&(u==="stream"||u==="response");if(ff&&(a||k&&y)){const L={};["status","statusText","headers"].forEach(re=>{L[re]=N[re]});const W=ce.toFiniteNumber(N.headers.get("content-length")),[z,G]=a&&lm(W,xc(fm(a),!0))||[];N=new Response(mm(N.body,ym,z,()=>{G&&G(),y&&y()}),L)}u=u||"text";let F=await Ec[ce.findKey(Ec,u)||"text"](N,e);return!k&&y&&y(),await new Promise((L,W)=>{um(L,W,{data:F,headers:Tn.from(N.headers),status:N.status,statusText:N.statusText,config:e,request:x})})}catch(O){throw y&&y(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new ht("Network Error",ht.ERR_NETWORK,e,x),{cause:O.cause||O}):ht.from(O,O&&O.code,e,x)}});const df={http:o3,xhr:k3,fetch:H3};ce.forEach(df,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const wm=e=>`- ${e}`,q3=e=>ce.isFunction(e)||e===null||e===!1;var bm={getAdapter:e=>{e=ce.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!q3(r)&&(n=df[(s=String(r)).toLowerCase()],n===void 0))throw new ht(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){const o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=t?o.length>1?`since :
32
+ `+o.map(wm).join(`
33
+ `):" "+wm(o[0]):"as no adapter specified";throw new ht("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:df};function hf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new is(null,e)}function xm(e){return hf(e),e.headers=Tn.from(e.headers),e.data=lf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),bm.getAdapter(e.adapter||cf.adapter)(e).then(function(n){return hf(e),n.data=lf.call(e,e.transformResponse,n),n.headers=Tn.from(n.headers),n},function(n){return cm(n)||(hf(e),n&&n.response&&(n.response.data=lf.call(e,e.transformResponse,n.response),n.response.headers=Tn.from(n.response.headers))),Promise.reject(n)})}const Sm="1.8.4",_c={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{_c[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Em={};_c.transitional=function(t,r,n){function i(o,s){return"[Axios v"+Sm+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(t===!1)throw new ht(i(s," has been removed"+(r?" in "+r:"")),ht.ERR_DEPRECATED);return r&&!Em[s]&&(Em[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,a):!0}},_c.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function W3(e,t,r){if(typeof e!="object")throw new ht("options must be an object",ht.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new ht("option "+o+" must be "+c,ht.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ht("Unknown option "+o,ht.ERR_BAD_OPTION)}}var Cc={assertOptions:W3,validators:_c};const Hn=Cc.validators;class Ac{constructor(t){this.defaults=t,this.interceptors={request:new im,response:new im}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
34
+ `+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ao(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&Cc.assertOptions(n,{silentJSONParsing:Hn.transitional(Hn.boolean),forcedJSONParsing:Hn.transitional(Hn.boolean),clarifyTimeoutError:Hn.transitional(Hn.boolean)},!1),i!=null&&(ce.isFunction(i)?r.paramsSerializer={serialize:i}:Cc.assertOptions(i,{encode:Hn.function,serialize:Hn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Cc.assertOptions(r,{baseUrl:Hn.spelling("baseURL"),withXsrfToken:Hn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&ce.merge(o.common,o[r.method]);o&&ce.forEach(["delete","get","head","post","put","patch","common"],x=>{delete o[x]}),r.headers=Tn.concat(s,o);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let l,d=0,p;if(!c){const x=[xm.bind(this),void 0];for(x.unshift.apply(x,a),x.push.apply(x,u),p=x.length,l=Promise.resolve(r);d<p;)l=l.then(x[d++],x[d++]);return l}p=a.length;let b=r;for(d=0;d<p;){const x=a[d++],y=a[d++];try{b=x(b)}catch(T){y.call(this,T);break}}try{l=xm.call(this,b)}catch(x){return Promise.reject(x)}for(d=0,p=u.length;d<p;)l=l.then(u[d++],u[d++]);return l}getUri(t){t=Ao(this.defaults,t);const r=dm(t.baseURL,t.url,t.allowAbsoluteUrls);return nm(r,t.params,t.paramsSerializer)}}ce.forEach(["delete","get","head","options"],function(t){Ac.prototype[t]=function(r,n){return this.request(Ao(n||{},{method:t,url:r,data:(n||{}).data}))}}),ce.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(Ao(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}Ac.prototype[t]=r(),Ac.prototype[t+"Form"]=r(!0)});var Mc=Ac;class pf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new is(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new pf(function(i){t=i}),cancel:t}}}var G3=pf;function K3(e){return function(r){return e.apply(null,r)}}function Y3(e){return ce.isObject(e)&&e.isAxiosError===!0}const mf={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(mf).forEach(([e,t])=>{mf[t]=e});var Z3=mf;function _m(e){const t=new Mc(e),r=zp(Mc.prototype.request,t);return ce.extend(r,Mc.prototype,t,{allOwnKeys:!0}),ce.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return _m(Ao(e,i))},r}const pr=_m(cf);pr.Axios=Mc,pr.CanceledError=is,pr.CancelToken=G3,pr.isCancel=cm,pr.VERSION=Sm,pr.toFormData=yc,pr.AxiosError=ht,pr.Cancel=pr.CanceledError,pr.all=function(t){return Promise.all(t)},pr.spread=K3,pr.isAxiosError=Y3,pr.mergeConfig=Ao,pr.AxiosHeaders=Tn,pr.formToJSON=e=>sm(ce.isHTMLForm(e)?new FormData(e):e),pr.getAdapter=bm.getAdapter,pr.HttpStatusCode=Z3,pr.default=pr;var Cm=pr,gf={exports:{}},en={},Am={exports:{}};(function(e){function t(r){return r&&r.__esModule?r:{default:r}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(Am);var X3=Am.exports,vf={exports:{}},yf={exports:{}},Mm;function Tc(){return Mm||(Mm=1,function(e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(yf)),yf.exports}var Tm;function J3(){return Tm||(Tm=1,function(e){var t=Tc().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(_,I,C){_[I]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",d=c.toStringTag||"@@toStringTag";function p(_,I,C){return Object.defineProperty(_,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),_[I]}try{p({},"")}catch{p=function(C,g,v){return C[g]=v}}function b(_,I,C,g){var v=I&&I.prototype instanceof F?I:F,R=Object.create(v.prototype),J=new S(g||[]);return a(R,"_invoke",{value:D(_,C,J)}),R}function x(_,I,C){try{return{type:"normal",arg:_.call(I,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=b;var y="suspendedStart",T="suspendedYield",O="executing",N="completed",k={};function F(){}function L(){}function W(){}var z={};p(z,u,function(){return this});var G=Object.getPrototypeOf,re=G&&G(G(A([])));re&&re!==o&&s.call(re,u)&&(z=re);var oe=W.prototype=F.prototype=Object.create(z);function ae(_){["next","throw","return"].forEach(function(I){p(_,I,function(C){return this._invoke(I,C)})})}function H(_,I){function C(v,R,J,Q){var ue=x(_[v],_,R);if(ue.type!=="throw"){var _e=ue.arg,de=_e.value;return de&&t(de)=="object"&&s.call(de,"__await")?I.resolve(de.__await).then(function(be){C("next",be,J,Q)},function(be){C("throw",be,J,Q)}):I.resolve(de).then(function(be){_e.value=be,J(_e)},function(be){return C("throw",be,J,Q)})}Q(ue.arg)}var g;a(this,"_invoke",{value:function(R,J){function Q(){return new I(function(ue,_e){C(R,J,ue,_e)})}return g=g?g.then(Q,Q):Q()}})}function D(_,I,C){var g=y;return function(v,R){if(g===O)throw Error("Generator is already running");if(g===N){if(v==="throw")throw R;return{value:n,done:!0}}for(C.method=v,C.arg=R;;){var J=C.delegate;if(J){var Q=h(J,C);if(Q){if(Q===k)continue;return Q}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===y)throw g=N,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=O;var ue=x(_,I,C);if(ue.type==="normal"){if(g=C.done?N:T,ue.arg===k)continue;return{value:ue.arg,done:C.done}}ue.type==="throw"&&(g=N,C.method="throw",C.arg=ue.arg)}}}function h(_,I){var C=I.method,g=_.iterator[C];if(g===n)return I.delegate=null,C==="throw"&&_.iterator.return&&(I.method="return",I.arg=n,h(_,I),I.method==="throw")||C!=="return"&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),k;var v=x(g,_.iterator,I.arg);if(v.type==="throw")return I.method="throw",I.arg=v.arg,I.delegate=null,k;var R=v.arg;return R?R.done?(I[_.resultName]=R.value,I.next=_.nextLoc,I.method!=="return"&&(I.method="next",I.arg=n),I.delegate=null,k):R:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,k)}function f(_){var I={tryLoc:_[0]};1 in _&&(I.catchLoc=_[1]),2 in _&&(I.finallyLoc=_[2],I.afterLoc=_[3]),this.tryEntries.push(I)}function m(_){var I=_.completion||{};I.type="normal",delete I.arg,_.completion=I}function S(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(f,this),this.reset(!0)}function A(_){if(_||_===""){var I=_[u];if(I)return I.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var C=-1,g=function v(){for(;++C<_.length;)if(s.call(_,C))return v.value=_[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(_)+" is not iterable")}return L.prototype=W,a(oe,"constructor",{value:W,configurable:!0}),a(W,"constructor",{value:L,configurable:!0}),L.displayName=p(W,d,"GeneratorFunction"),i.isGeneratorFunction=function(_){var I=typeof _=="function"&&_.constructor;return!!I&&(I===L||(I.displayName||I.name)==="GeneratorFunction")},i.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,W):(_.__proto__=W,p(_,d,"GeneratorFunction")),_.prototype=Object.create(oe),_},i.awrap=function(_){return{__await:_}},ae(H.prototype),p(H.prototype,l,function(){return this}),i.AsyncIterator=H,i.async=function(_,I,C,g,v){v===void 0&&(v=Promise);var R=new H(b(_,I,C,g),v);return i.isGeneratorFunction(I)?R:R.next().then(function(J){return J.done?J.value:R.next()})},ae(oe),p(oe,d,"Generator"),p(oe,u,function(){return this}),p(oe,"toString",function(){return"[object Generator]"}),i.keys=function(_){var I=Object(_),C=[];for(var g in I)C.push(g);return C.reverse(),function v(){for(;C.length;){var R=C.pop();if(R in I)return v.value=R,v.done=!1,v}return v.done=!0,v}},i.values=A,S.prototype={constructor:S,reset:function(I){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(m),!I)for(var C in this)C.charAt(0)==="t"&&s.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var I=this.tryEntries[0].completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(I){if(this.done)throw I;var C=this;function g(_e,de){return J.type="throw",J.arg=I,C.next=_e,de&&(C.method="next",C.arg=n),!!de}for(var v=this.tryEntries.length-1;v>=0;--v){var R=this.tryEntries[v],J=R.completion;if(R.tryLoc==="root")return g("end");if(R.tryLoc<=this.prev){var Q=s.call(R,"catchLoc"),ue=s.call(R,"finallyLoc");if(Q&&ue){if(this.prev<R.catchLoc)return g(R.catchLoc,!0);if(this.prev<R.finallyLoc)return g(R.finallyLoc)}else if(Q){if(this.prev<R.catchLoc)return g(R.catchLoc,!0)}else{if(!ue)throw Error("try statement without catch or finally");if(this.prev<R.finallyLoc)return g(R.finallyLoc)}}}},abrupt:function(I,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&s.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var R=v;break}}R&&(I==="break"||I==="continue")&&R.tryLoc<=C&&C<=R.finallyLoc&&(R=null);var J=R?R.completion:{};return J.type=I,J.arg=C,R?(this.method="next",this.next=R.finallyLoc,k):this.complete(J)},complete:function(I,C){if(I.type==="throw")throw I.arg;return I.type==="break"||I.type==="continue"?this.next=I.arg:I.type==="return"?(this.rval=this.arg=I.arg,this.method="return",this.next="end"):I.type==="normal"&&C&&(this.next=C),k},finish:function(I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===I)return this.complete(g.completion,g.afterLoc),m(g),k}},catch:function(I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===I){var v=g.completion;if(v.type==="throw"){var R=v.arg;m(g)}return R}}throw Error("illegal catch attempt")},delegateYield:function(I,C,g){return this.delegate={iterator:A(I),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),k}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(vf)),vf.exports}var wf,Im;function Q3(){if(Im)return wf;Im=1;var e=J3()();wf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return wf}var bf={exports:{}},Om;function eS(){return Om||(Om=1,function(e){function t(n,i,o,s,a,c,u){try{var l=n[c](u),d=l.value}catch(p){return void o(p)}l.done?i(d):Promise.resolve(d).then(s,a)}function r(n){return function(){var i=this,o=arguments;return new Promise(function(s,a){var c=n.apply(i,o);function u(d){t(c,s,a,u,l,"next",d)}function l(d){t(c,s,a,u,l,"throw",d)}u(void 0)})}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(bf)),bf.exports}var xf={exports:{}},Sf={exports:{}},Ef={exports:{}},Pm;function tS(){return Pm||(Pm=1,function(e){var t=Tc().default;function r(n,i){if(t(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var s=o.call(n,i||"default");if(t(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Ef)),Ef.exports}var Rm;function rS(){return Rm||(Rm=1,function(e){var t=Tc().default,r=tS();function n(i){var o=r(i,"string");return t(o)=="symbol"?o:o+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Sf)),Sf.exports}var Nm;function nS(){return Nm||(Nm=1,function(e){var t=rS();function r(n,i,o){return(i=t(i))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(xf)),xf.exports}var _f,jm;function iS(){if(jm)return _f;jm=1;const e=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return _f=t=>!e.has(t&&t.code),_f}var ha=X3;Object.defineProperty(en,"__esModule",{value:!0}),en.isNetworkError=Mf,en.isRetryableError=Oc,en.isSafeRequestError=Lm,en.isIdempotentRequestError=Tf,en.isNetworkOrIdempotentRequestError=If,en.exponentialDelay=$m,en.default=Mo,en.DEFAULT_OPTIONS=en.namespace=void 0;var Ic=ha(Q3()),oS=ha(Tc()),km=ha(eS()),sS=ha(nS()),aS=ha(iS());function Dm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Cf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dm(Object(r),!0).forEach(function(n){(0,sS.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Af="axios-retry";en.namespace=Af;function Mf(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,aS.default)(e)}var Bm=["get","head","options"],cS=Bm.concat(["put","delete"]);function Oc(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function Lm(e){return e.config?Oc(e)&&Bm.indexOf(e.config.method)!==-1:!1}function Tf(e){return e.config?Oc(e)&&cS.indexOf(e.config.method)!==-1:!1}function If(e){return Mf(e)||Tf(e)}function uS(){return 0}function $m(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,r=Math.pow(2,e)*t,n=r*.2*Math.random();return r+n}var Fm={retries:3,retryCondition:If,retryDelay:uS,shouldResetTimeout:!1,onRetry:function(){}};en.DEFAULT_OPTIONS=Fm;function lS(e,t){return Cf(Cf(Cf({},Fm),t),e[Af])}function Um(e,t){var r=lS(e,t);return r.retryCount=r.retryCount||0,e[Af]=r,r}function fS(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}function dS(e,t){return Of.apply(this,arguments)}function Of(){return Of=(0,km.default)(Ic.default.mark(function e(t,r){var n,i,o,s;return Ic.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,o=t.retryCount<n&&i(r),(0,oS.default)(o)!=="object"){c.next=13;break}return c.prev=3,c.next=6,o;case 6:return s=c.sent,c.abrupt("return",s!==!1);case 10:return c.prev=10,c.t0=c.catch(3),c.abrupt("return",!1);case 13:return c.abrupt("return",o);case 14:case"end":return c.stop()}},e,null,[[3,10]])})),Of.apply(this,arguments)}function Mo(e,t){var r=e.interceptors.request.use(function(i){var o=Um(i,t);return o.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,km.default)(Ic.default.mark(function o(s){var a,c,u,l,d,p,b,x;return Ic.default.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(a=s.config,a){T.next=3;break}return T.abrupt("return",Promise.reject(s));case 3:return c=Um(a,t),T.next=6,dS(c,s);case 6:if(!T.sent){T.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,d=c.onRetry,p=u(c.retryCount,s),fS(e,a),!(!l&&a.timeout&&c.lastRequestTime)){T.next=17;break}if(b=Date.now()-c.lastRequestTime,x=a.timeout-b-p,!(x<=0)){T.next=16;break}return T.abrupt("return",Promise.reject(s));case 16:a.timeout=x;case 17:return a.transformRequest=[function(O){return O}],T.next=20,d(c.retryCount,s,a);case 20:return T.abrupt("return",new Promise(function(O){return setTimeout(function(){return O(e(a))},p)}));case 21:return T.abrupt("return",Promise.reject(s));case 22:case"end":return T.stop()}},o)}));return function(o){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Mo.isNetworkError=Mf,Mo.isSafeRequestError=Lm,Mo.isIdempotentRequestError=Tf,Mo.isNetworkOrIdempotentRequestError=If,Mo.exponentialDelay=$m,Mo.isRetryableError=Oc;const Vm=en.default;gf.exports=Vm,gf.exports.default=Vm;var hS=gf.exports,Pc={},os=null;typeof WebSocket<"u"?os=WebSocket:typeof MozWebSocket<"u"?os=MozWebSocket:typeof _r<"u"?os=_r.WebSocket||_r.MozWebSocket:typeof window<"u"?os=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(os=self.WebSocket||self.MozWebSocket);var pS=os,mS=_r&&_r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.ResilientWebSocket=void 0;const gS=mS(pS),vS=3e4+3e3;class yS{constructor(t,r){vt(this,"endpoint");vt(this,"wsClient");vt(this,"wsUserClosed");vt(this,"wsFailedAttempts");vt(this,"pingTimeout");vt(this,"logger");vt(this,"onError");vt(this,"onMessage");vt(this,"onReconnect");this.endpoint=t,this.logger=r,this.wsFailedAttempts=0,this.onError=n=>{var i;(i=this.logger)==null||i.error(n)},this.wsUserClosed=!0,this.onMessage=()=>{},this.onReconnect=()=>{}}async send(t){var r,n,i;(r=this.logger)==null||r.info(`Sending ${t}`),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0?(n=this.logger)==null||n.error("Couldn't connect to the websocket server. Error callback is called."):(i=this.wsClient)==null||i.send(t)}async startWebSocket(){var t;this.wsClient===void 0&&((t=this.logger)==null||t.info("Creating Web Socket client"),this.wsClient=new gS.default(this.endpoint),this.wsUserClosed=!1,this.wsClient.onopen=()=>{this.wsFailedAttempts=0,this.wsClient.on!==void 0&&this.heartbeat()},this.wsClient.onerror=r=>{this.onError(r.error)},this.wsClient.onmessage=r=>{this.onMessage(r.data)},this.wsClient.onclose=async()=>{var r,n;if(this.pingTimeout!==void 0&&clearInterval(this.pingTimeout),this.wsUserClosed===!1){this.wsFailedAttempts+=1,this.wsClient=void 0;const i=wS(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await zm(i),this.restartUnexpectedClosedWebsocket()}else(n=this.logger)==null||n.info("The connection has been closed successfully.")},this.wsClient.on!==void 0&&this.wsClient.on("ping",this.heartbeat.bind(this)))}heartbeat(){var t;(t=this.logger)==null||t.info("Heartbeat"),this.pingTimeout!==void 0&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n;(r=this.logger)==null||r.warn("Connection timed out. Reconnecting..."),(n=this.wsClient)==null||n.terminate(),this.restartUnexpectedClosedWebsocket()},vS)}async waitForMaybeReadyWebSocket(){let t=0;for(;this.wsClient!==void 0&&this.wsClient.readyState!==this.wsClient.OPEN;)if(t>5e3){this.wsClient.close();return}else t+=10,await zm(10)}async restartUnexpectedClosedWebsocket(){var t;if(this.wsUserClosed!==!0){if(await this.startWebSocket(),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0){(t=this.logger)==null||t.error("Couldn't reconnect to websocket. Error callback is called.");return}this.onReconnect()}}closeWebSocket(){if(this.wsClient!==void 0){const t=this.wsClient;this.wsClient=void 0,t.close()}this.wsUserClosed=!0}}Pc.ResilientWebSocket=yS;async function zm(e){return new Promise(t=>setTimeout(t,e))}function wS(e){return 2**e*100}var ss={};Object.defineProperty(ss,"__esModule",{value:!0}),ss.removeLeading0xIfExists=ss.makeWebsocketUrl=void 0;function bS(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}ss.makeWebsocketUrl=bS;function xS(e){return e.startsWith("0x")?e.substring(2):e}ss.removeLeading0xIfExists=xS;var Hm=_r&&_r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dc,"__esModule",{value:!0}),dc.PriceServiceConnection=void 0;const Pf=Wl,SS=Hm(Cm),qm=Hm(hS),ES=Pc,Rf=ss;class _S{constructor(t,r){vt(this,"httpClient");vt(this,"priceFeedCallbacks");vt(this,"wsClient");vt(this,"wsEndpoint");vt(this,"logger");vt(this,"priceFeedRequestConfig");vt(this,"onWsError");var n,i,o;this.httpClient=SS.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,qm.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:qm.default.exponentialDelay}),this.priceFeedRequestConfig={binary:(n=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:n.binary,verbose:((i=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:i.verbose)??(r==null?void 0:r.verbose),allowOutOfOrder:(o=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:o.allowOutOfOrder},this.priceFeedCallbacks=new Map,this.logger=(r==null?void 0:r.logger)||{trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error},this.onWsError=s=>{this.logger.error(s),typeof wn<"u"&&typeof wn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),wn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Rf.makeWebsocketUrl)(t)}async getLatestPriceFeeds(t){return t.length===0?[]:(await this.httpClient.get("/api/latest_price_feeds",{params:{ids:t,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}})).data.map(i=>Pf.PriceFeed.fromJson(i))}async getLatestVaas(t){return(await this.httpClient.get("/api/latest_vaas",{params:{ids:t}})).data}async getVaa(t,r){const n=await this.httpClient.get("/api/get_vaa",{params:{id:t,publish_time:r}});return[n.data.vaa,n.data.publishTime]}async getPriceFeed(t,r){const n=await this.httpClient.get("/api/get_price_feed",{params:{id:t,publish_time:r,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}});return Pf.PriceFeed.fromJson(n.data)}async getPriceFeedIds(){return(await this.httpClient.get("/api/price_feed_ids")).data}async subscribePriceFeedUpdates(t,r){var o;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(s=>(0,Rf.removeLeading0xIfExists)(s));const n=[];for(const s of t)this.priceFeedCallbacks.has(s)||(this.priceFeedCallbacks.set(s,new Set),n.push(s)),this.priceFeedCallbacks.get(s).add(r);const i={ids:n,type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};await((o=this.wsClient)==null?void 0:o.send(JSON.stringify(i)))}async unsubscribePriceFeedUpdates(t,r){var o;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(s=>(0,Rf.removeLeading0xIfExists)(s));const n=[];for(const s of t)if(this.priceFeedCallbacks.has(s)){let a=!1;r===void 0?(this.priceFeedCallbacks.delete(s),a=!0):(this.priceFeedCallbacks.get(s).delete(r),this.priceFeedCallbacks.get(s).size===0&&(this.priceFeedCallbacks.delete(s),a=!0)),a&&n.push(s)}const i={ids:n,type:"unsubscribe"};await((o=this.wsClient)==null?void 0:o.send(JSON.stringify(i))),this.priceFeedCallbacks.size===0&&this.closeWebSocket()}async startWebSocket(){if(this.wsEndpoint===void 0)throw new Error("Websocket endpoint is undefined.");this.wsClient=new ES.ResilientWebSocket(this.wsEndpoint,this.logger),this.wsClient.onError=this.onWsError,this.wsClient.onReconnect=()=>{var t;if(this.priceFeedCallbacks.size>0){const r={ids:Array.from(this.priceFeedCallbacks.keys()),type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};this.logger.info("Resubscribing to existing price feeds."),(t=this.wsClient)==null||t.send(JSON.stringify(r))}},this.wsClient.onMessage=t=>{this.logger.info(`Received message ${t.toString()}`);let r;try{r=JSON.parse(t.toString())}catch(n){this.logger.error(`Error parsing message ${t.toString()} as JSON.`),this.logger.error(n),this.onWsError(n);return}if(r.type==="response")r.status==="error"&&(this.logger.error(`Error response from the websocket server ${r.error}.`),this.onWsError(new Error(r.error)));else if(r.type==="price_update"){let n;try{n=Pf.PriceFeed.fromJson(r.price_feed)}catch(i){this.logger.error(`Error parsing price feeds from message ${t.toString()}.`),this.logger.error(i),this.onWsError(i);return}if(this.priceFeedCallbacks.has(n.id))for(const i of this.priceFeedCallbacks.get(n.id))i(n)}else this.logger.warn(`Ignoring unsupported server response ${t.toString()}.`)},await this.wsClient.startWebSocket()}closeWebSocket(){var t;(t=this.wsClient)==null||t.closeWebSocket(),this.wsClient=void 0,this.priceFeedCallbacks.clear()}}dc.PriceServiceConnection=_S,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=dc;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Wl;Object.defineProperty(e,"PriceFeedMetadata",{enumerable:!0,get:function(){return r.PriceFeedMetadata}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return r.PriceFeed}}),Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return r.Price}}),Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}})}(ql),Object.defineProperty(fc,"__esModule",{value:!0}),fc.SuiPriceServiceConnection=void 0;const CS=ql,AS=ua;class MS extends CS.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>AS.Buffer.from(n,"base64"))}}fc.SuiPriceServiceConnection=MS;var Rc={};const TS=s0(E8),To=s0(N6);var Nf=Object.defineProperty,IS=Object.getOwnPropertyDescriptor,OS=Object.getOwnPropertyNames,PS=Object.prototype.hasOwnProperty,RS=(e,t)=>{for(var r in t)Nf(e,r,{get:t[r],enumerable:!0})},NS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OS(t))!PS.call(e,i)&&i!==r&&Nf(e,i,{get:()=>t[i],enumerable:!(n=IS(t,i))||n.enumerable});return e},jS=e=>NS(Nf({},"__esModule",{value:!0}),e),Wm={};RS(Wm,{isValidSuiNSName:()=>BS,normalizeSuiNSName:()=>LS});var kS=jS(Wm);const Gm=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Km=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,DS=235;function BS(e){return e.length>DS?!1:e.includes("@")?Gm.test(e):Km.test(e)}function LS(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!Gm.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,o]=r.split("@");n=[...i?i.split("."):[],o]}else{if(!Km.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}var jf=Object.defineProperty,$S=Object.getOwnPropertyDescriptor,FS=Object.getOwnPropertyNames,US=Object.prototype.hasOwnProperty,VS=(e,t)=>{for(var r in t)jf(e,r,{get:t[r],enumerable:!0})},zS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FS(t))!US.call(e,i)&&i!==r&&jf(e,i,{get:()=>t[i],enumerable:!(n=$S(t,i))||n.enumerable});return e},HS=e=>zS(jf({},"__esModule",{value:!0}),e),Ym={};VS(Ym,{isValidNamedPackage:()=>Xm,isValidNamedType:()=>ZS});var qS=HS(Ym),WS=kS;const GS=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,KS=/^\d+$/,YS=64,Zm="/",Xm=e=>{const t=e.split(Zm);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!KS.test(i)||!(0,WS.isValidSuiNSName)(r)?!1:GS.test(n)&&n.length<YS},ZS=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Zm)&&!Xm(r))return!1;return!0};var kf=Object.defineProperty,XS=Object.getOwnPropertyDescriptor,JS=Object.getOwnPropertyNames,QS=Object.prototype.hasOwnProperty,eE=(e,t)=>{for(var r in t)kf(e,r,{get:t[r],enumerable:!0})},tE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JS(t))!QS.call(e,i)&&i!==r&&kf(e,i,{get:()=>t[i],enumerable:!(n=XS(t,i))||n.enumerable});return e},rE=e=>tE(kf({},"__esModule",{value:!0}),e),Jm={};eE(Jm,{SUI_ADDRESS_LENGTH:()=>Df,isValidSuiAddress:()=>tg,isValidSuiObjectId:()=>sE,isValidTransactionDigest:()=>oE,normalizeStructTag:()=>rg,normalizeSuiAddress:()=>Lf,normalizeSuiObjectId:()=>cE,parseStructTag:()=>Bf});var Qm=rE(Jm),eg=To,nE=qS;const iE=32;function oE(e){try{return(0,eg.fromBase58)(e).length===iE}catch{return!1}}const Df=32;function tg(e){return uE(e)&&lE(e)===Df}function sE(e){return tg(e)}function aE(e){return e.includes("::")?Bf(e):e}function Bf(e){const[t,r]=e.split("::"),n=(0,nE.isValidNamedPackage)(t),i=e.slice(t.length+r.length+4),o=i.includes("<")?i.slice(0,i.indexOf("<")):i,s=i.includes("<")?(0,eg.splitGenericParameters)(i.slice(i.indexOf("<")+1,i.lastIndexOf(">"))).map(a=>aE(a.trim())):[];return{address:n?t:Lf(t),module:r,name:o,typeParams:s}}function rg(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Bf(e):e,o=(i==null?void 0:i.length)>0?`<${i.map(s=>typeof s=="string"?s:rg(s)).join(",")}>`:"";return`${t}::${r}::${n}${o}`}function Lf(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Df*2,"0")}`}function cE(e,t=!1){return Lf(e,t)}function uE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function lE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var $f=Object.defineProperty,fE=Object.getOwnPropertyDescriptor,dE=Object.getOwnPropertyNames,hE=Object.prototype.hasOwnProperty,pE=(e,t)=>{for(var r in t)$f(e,r,{get:t[r],enumerable:!0})},mE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dE(t))!hE.call(e,i)&&i!==r&&$f(e,i,{get:()=>t[i],enumerable:!(n=fE(t,i))||n.enumerable});return e},gE=e=>mE($f({},"__esModule",{value:!0}),e),ng={};pE(ng,{TypeTagSerializer:()=>Io});var ig=gE(ng),vE=To,yE=Qm;const wE=/^vector<(.+)>$/,bE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Io{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(wE);if(n)return{vector:Io.parseFromStr(n[1],r)};const i=t.match(bE);if(i)return{struct:{address:r?(0,yE.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Io.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,vE.splitGenericParameters)(t).map(n=>Io.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Io.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Io.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Ff=Object.defineProperty,xE=Object.getOwnPropertyDescriptor,SE=Object.getOwnPropertyNames,EE=Object.prototype.hasOwnProperty,_E=(e,t)=>{for(var r in t)Ff(e,r,{get:t[r],enumerable:!0})},CE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SE(t))!EE.call(e,i)&&i!==r&&Ff(e,i,{get:()=>t[i],enumerable:!(n=xE(t,i))||n.enumerable});return e},AE=e=>CE(Ff({},"__esModule",{value:!0}),e),og={};_E(og,{Address:()=>ln,AppId:()=>Sg,Argument:()=>qn,CallArg:()=>lg,Command:()=>dg,CompressedSignature:()=>Cg,GasData:()=>vg,Intent:()=>Eg,IntentMessage:()=>_g,IntentScope:()=>bg,IntentVersion:()=>xg,MultiSig:()=>OE,MultiSigPkMap:()=>Mg,MultiSigPublicKey:()=>Tg,ObjectArg:()=>ug,ObjectDigest:()=>ag,Owner:()=>IE,PasskeyAuthenticator:()=>RE,ProgrammableMoveCall:()=>fg,ProgrammableTransaction:()=>hg,PublicKey:()=>Ag,SenderSignedData:()=>PE,SenderSignedTransaction:()=>Og,SharedObjectRef:()=>cg,StructTag:()=>gg,SuiObjectRef:()=>Nc,TransactionData:()=>wg,TransactionDataV1:()=>yg,TransactionExpiration:()=>mg,TransactionKind:()=>pg,TypeTag:()=>zf,base64String:()=>Ig});var Uf=AE(og),le=To,pa=Qm,sg=ig;function ME(e){return le.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function TE(e){return le.bcs.enum("Option",{None:null,Some:e})}const ln=le.bcs.bytes(pa.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,le.toHex)(e);if(!t||!(0,pa.isValidSuiAddress)((0,pa.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,le.fromHex)((0,pa.normalizeSuiAddress)(e)):e,output:e=>(0,pa.normalizeSuiAddress)((0,le.toHex)(e))}),ag=le.bcs.vector(le.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,le.fromBase58)(e),output:e=>(0,le.toBase58)(new Uint8Array(e)),validate:e=>{if((0,le.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Nc=le.bcs.struct("SuiObjectRef",{objectId:ln,version:le.bcs.u64(),digest:ag}),cg=le.bcs.struct("SharedObjectRef",{objectId:ln,initialSharedVersion:le.bcs.u64(),mutable:le.bcs.bool()}),ug=le.bcs.enum("ObjectArg",{ImmOrOwnedObject:Nc,SharedObject:cg,Receiving:Nc}),IE=le.bcs.enum("Owner",{AddressOwner:ln,ObjectOwner:ln,Shared:le.bcs.struct("Shared",{initialSharedVersion:le.bcs.u64()}),Immutable:null,ConsensusV2:le.bcs.struct("ConsensusV2",{authenticator:le.bcs.struct("Authenticator",{SingleOwner:le.bcs.string()}),startVersion:le.bcs.string()})}),lg=le.bcs.enum("CallArg",{Pure:le.bcs.struct("Pure",{bytes:le.bcs.vector(le.bcs.u8()).transform({input:e=>typeof e=="string"?(0,le.fromBase64)(e):e,output:e=>(0,le.toBase64)(new Uint8Array(e))})}),Object:ug}),Vf=le.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:le.bcs.lazy(()=>Vf),struct:le.bcs.lazy(()=>gg),u16:null,u32:null,u256:null}),zf=Vf.transform({input:e=>typeof e=="string"?sg.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>sg.TypeTagSerializer.tagToString(e)}),qn=le.bcs.enum("Argument",{GasCoin:null,Input:le.bcs.u16(),Result:le.bcs.u16(),NestedResult:le.bcs.tuple([le.bcs.u16(),le.bcs.u16()])}),fg=le.bcs.struct("ProgrammableMoveCall",{package:ln,module:le.bcs.string(),function:le.bcs.string(),typeArguments:le.bcs.vector(zf),arguments:le.bcs.vector(qn)}),dg=le.bcs.enum("Command",{MoveCall:fg,TransferObjects:le.bcs.struct("TransferObjects",{objects:le.bcs.vector(qn),address:qn}),SplitCoins:le.bcs.struct("SplitCoins",{coin:qn,amounts:le.bcs.vector(qn)}),MergeCoins:le.bcs.struct("MergeCoins",{destination:qn,sources:le.bcs.vector(qn)}),Publish:le.bcs.struct("Publish",{modules:le.bcs.vector(le.bcs.vector(le.bcs.u8()).transform({input:e=>typeof e=="string"?(0,le.fromBase64)(e):e,output:e=>(0,le.toBase64)(new Uint8Array(e))})),dependencies:le.bcs.vector(ln)}),MakeMoveVec:le.bcs.struct("MakeMoveVec",{type:TE(zf).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:le.bcs.vector(qn)}),Upgrade:le.bcs.struct("Upgrade",{modules:le.bcs.vector(le.bcs.vector(le.bcs.u8()).transform({input:e=>typeof e=="string"?(0,le.fromBase64)(e):e,output:e=>(0,le.toBase64)(new Uint8Array(e))})),dependencies:le.bcs.vector(ln),package:ln,ticket:qn})}),hg=le.bcs.struct("ProgrammableTransaction",{inputs:le.bcs.vector(lg),commands:le.bcs.vector(dg)}),pg=le.bcs.enum("TransactionKind",{ProgrammableTransaction:hg,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),mg=le.bcs.enum("TransactionExpiration",{None:null,Epoch:ME()}),gg=le.bcs.struct("StructTag",{address:ln,module:le.bcs.string(),name:le.bcs.string(),typeParams:le.bcs.vector(Vf)}),vg=le.bcs.struct("GasData",{payment:le.bcs.vector(Nc),owner:ln,price:le.bcs.u64(),budget:le.bcs.u64()}),yg=le.bcs.struct("TransactionDataV1",{kind:pg,sender:ln,gasData:vg,expiration:mg}),wg=le.bcs.enum("TransactionData",{V1:yg}),bg=le.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),xg=le.bcs.enum("IntentVersion",{V0:null}),Sg=le.bcs.enum("AppId",{Sui:null}),Eg=le.bcs.struct("Intent",{scope:bg,version:xg,appId:Sg});function _g(e){return le.bcs.struct(`IntentMessage<${e.name}>`,{intent:Eg,value:e})}const Cg=le.bcs.enum("CompressedSignature",{ED25519:le.bcs.fixedArray(64,le.bcs.u8()),Secp256k1:le.bcs.fixedArray(64,le.bcs.u8()),Secp256r1:le.bcs.fixedArray(64,le.bcs.u8()),ZkLogin:le.bcs.vector(le.bcs.u8())}),Ag=le.bcs.enum("PublicKey",{ED25519:le.bcs.fixedArray(32,le.bcs.u8()),Secp256k1:le.bcs.fixedArray(33,le.bcs.u8()),Secp256r1:le.bcs.fixedArray(33,le.bcs.u8()),ZkLogin:le.bcs.vector(le.bcs.u8())}),Mg=le.bcs.struct("MultiSigPkMap",{pubKey:Ag,weight:le.bcs.u8()}),Tg=le.bcs.struct("MultiSigPublicKey",{pk_map:le.bcs.vector(Mg),threshold:le.bcs.u16()}),OE=le.bcs.struct("MultiSig",{sigs:le.bcs.vector(Cg),bitmap:le.bcs.u16(),multisig_pk:Tg}),Ig=le.bcs.vector(le.bcs.u8()).transform({input:e=>typeof e=="string"?(0,le.fromBase64)(e):e,output:e=>(0,le.toBase64)(new Uint8Array(e))}),Og=le.bcs.struct("SenderSignedTransaction",{intentMessage:_g(wg),txSignatures:le.bcs.vector(Ig)}),PE=le.bcs.vector(Og,{name:"SenderSignedData"}),RE=le.bcs.struct("PasskeyAuthenticator",{authenticatorData:le.bcs.vector(le.bcs.u8()),clientDataJson:le.bcs.string(),userSignature:le.bcs.vector(le.bcs.u8())});var Hf=Object.defineProperty,NE=Object.getOwnPropertyDescriptor,jE=Object.getOwnPropertyNames,kE=Object.prototype.hasOwnProperty,DE=(e,t)=>{for(var r in t)Hf(e,r,{get:t[r],enumerable:!0})},BE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jE(t))!kE.call(e,i)&&i!==r&&Hf(e,i,{get:()=>t[i],enumerable:!(n=NE(t,i))||n.enumerable});return e},LE=e=>BE(Hf({},"__esModule",{value:!0}),e),Pg={};DE(Pg,{TransactionEffects:()=>JE});var $E=LE(Pg),me=To,Mt=Uf;const FE=me.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:me.bcs.struct("UnableToFetchPackage",{packageId:Mt.Address}),NotAPackage:me.bcs.struct("NotAPackage",{objectId:Mt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:me.bcs.struct("DigestDoesNotMatch",{digest:me.bcs.vector(me.bcs.u8())}),UnknownUpgradePolicy:me.bcs.struct("UnknownUpgradePolicy",{policy:me.bcs.u8()}),PackageIDDoesNotMatch:me.bcs.struct("PackageIDDoesNotMatch",{packageId:Mt.Address,ticketId:Mt.Address})}),UE=me.bcs.struct("ModuleId",{address:Mt.Address,name:me.bcs.string()}),Rg=me.bcs.struct("MoveLocation",{module:UE,function:me.bcs.u16(),instruction:me.bcs.u16(),functionName:me.bcs.option(me.bcs.string())}),VE=me.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:me.bcs.struct("IndexOutOfBounds",{idx:me.bcs.u16()}),SecondaryIndexOutOfBounds:me.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:me.bcs.u16(),secondaryIdx:me.bcs.u16()}),InvalidResultArity:me.bcs.struct("InvalidResultArity",{resultIdx:me.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),zE=me.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),HE=me.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:me.bcs.struct("MoveObjectTooBig",{objectSize:me.bcs.u64(),maxObjectSize:me.bcs.u64()}),MovePackageTooBig:me.bcs.struct("MovePackageTooBig",{objectSize:me.bcs.u64(),maxObjectSize:me.bcs.u64()}),CircularObjectOwnership:me.bcs.struct("CircularObjectOwnership",{object:Mt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:me.bcs.option(Rg),MoveAbort:me.bcs.tuple([Rg,me.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:me.bcs.struct("CommandArgumentError",{argIdx:me.bcs.u16(),kind:VE}),TypeArgumentError:me.bcs.struct("TypeArgumentError",{argumentIdx:me.bcs.u16(),kind:zE}),UnusedValueWithoutDrop:me.bcs.struct("UnusedValueWithoutDrop",{resultIdx:me.bcs.u16(),secondaryIdx:me.bcs.u16()}),InvalidPublicFunctionReturnType:me.bcs.struct("InvalidPublicFunctionReturnType",{idx:me.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:me.bcs.struct("EffectsTooLarge",{currentSize:me.bcs.u64(),maxSize:me.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:me.bcs.struct("PackageUpgradeError",{upgradeError:FE}),WrittenObjectsTooLarge:me.bcs.struct("WrittenObjectsTooLarge",{currentSize:me.bcs.u64(),maxSize:me.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:me.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:me.bcs.vector(Mt.Address)}),AddressDeniedForCoin:me.bcs.struct("AddressDeniedForCoin",{address:Mt.Address,coinType:me.bcs.string()}),CoinTypeGlobalPause:me.bcs.struct("CoinTypeGlobalPause",{coinType:me.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Ng=me.bcs.enum("ExecutionStatus",{Success:null,Failed:me.bcs.struct("ExecutionFailed",{error:HE,command:me.bcs.option(me.bcs.u64())})}),jg=me.bcs.struct("GasCostSummary",{computationCost:me.bcs.u64(),storageCost:me.bcs.u64(),storageRebate:me.bcs.u64(),nonRefundableStorageFee:me.bcs.u64()}),qE=me.bcs.struct("TransactionEffectsV1",{status:Ng,executedEpoch:me.bcs.u64(),gasUsed:jg,modifiedAtVersions:me.bcs.vector(me.bcs.tuple([Mt.Address,me.bcs.u64()])),sharedObjects:me.bcs.vector(Mt.SuiObjectRef),transactionDigest:Mt.ObjectDigest,created:me.bcs.vector(me.bcs.tuple([Mt.SuiObjectRef,Mt.Owner])),mutated:me.bcs.vector(me.bcs.tuple([Mt.SuiObjectRef,Mt.Owner])),unwrapped:me.bcs.vector(me.bcs.tuple([Mt.SuiObjectRef,Mt.Owner])),deleted:me.bcs.vector(Mt.SuiObjectRef),unwrappedThenDeleted:me.bcs.vector(Mt.SuiObjectRef),wrapped:me.bcs.vector(Mt.SuiObjectRef),gasObject:me.bcs.tuple([Mt.SuiObjectRef,Mt.Owner]),eventsDigest:me.bcs.option(Mt.ObjectDigest),dependencies:me.bcs.vector(Mt.ObjectDigest)}),qf=me.bcs.tuple([me.bcs.u64(),Mt.ObjectDigest]),WE=me.bcs.enum("ObjectIn",{NotExist:null,Exist:me.bcs.tuple([qf,Mt.Owner])}),GE=me.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:me.bcs.tuple([Mt.ObjectDigest,Mt.Owner]),PackageWrite:qf}),KE=me.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),YE=me.bcs.struct("EffectsObjectChange",{inputState:WE,outputState:GE,idOperation:KE}),ZE=me.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:qf,MutateDeleted:me.bcs.u64(),ReadDeleted:me.bcs.u64(),Cancelled:me.bcs.u64(),PerEpochConfig:null}),XE=me.bcs.struct("TransactionEffectsV2",{status:Ng,executedEpoch:me.bcs.u64(),gasUsed:jg,transactionDigest:Mt.ObjectDigest,gasObjectIndex:me.bcs.option(me.bcs.u32()),eventsDigest:me.bcs.option(Mt.ObjectDigest),dependencies:me.bcs.vector(Mt.ObjectDigest),lamportVersion:me.bcs.u64(),changedObjects:me.bcs.vector(me.bcs.tuple([Mt.Address,YE])),unchangedSharedObjects:me.bcs.vector(me.bcs.tuple([Mt.Address,ZE])),auxDataDigest:me.bcs.option(Mt.ObjectDigest)}),JE=me.bcs.enum("TransactionEffects",{V1:qE,V2:XE});var Wf=Object.defineProperty,QE=Object.getOwnPropertyDescriptor,e_=Object.getOwnPropertyNames,t_=Object.prototype.hasOwnProperty,r_=(e,t)=>{for(var r in t)Wf(e,r,{get:t[r],enumerable:!0})},n_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of e_(t))!t_.call(e,i)&&i!==r&&Wf(e,i,{get:()=>t[i],enumerable:!(n=QE(t,i))||n.enumerable});return e},i_=e=>n_(Wf({},"__esModule",{value:!0}),e),kg={};r_(kg,{pureBcsSchemaFromTypeName:()=>Gf});var o_=i_(kg),Wn=To,s_=Uf;function Gf(e){switch(e){case"u8":return Wn.bcs.u8();case"u16":return Wn.bcs.u16();case"u32":return Wn.bcs.u32();case"u64":return Wn.bcs.u64();case"u128":return Wn.bcs.u128();case"u256":return Wn.bcs.u256();case"bool":return Wn.bcs.bool();case"string":return Wn.bcs.string();case"id":case"address":return s_.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?Wn.bcs.vector(Gf(n)):Wn.bcs.option(Gf(n))}throw new Error(`Invalid Pure type name: ${e}`)}var Kf=Object.defineProperty,a_=Object.getOwnPropertyDescriptor,c_=Object.getOwnPropertyNames,u_=Object.prototype.hasOwnProperty,l_=(e,t)=>{for(var r in t)Kf(e,r,{get:t[r],enumerable:!0})},f_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of c_(t))!u_.call(e,i)&&i!==r&&Kf(e,i,{get:()=>t[i],enumerable:!(n=a_(t,i))||n.enumerable});return e},d_=e=>f_(Kf({},"__esModule",{value:!0}),e),Dg={};l_(Dg,{BcsType:()=>g_.BcsType,TypeTagSerializer:()=>m_.TypeTagSerializer,bcs:()=>y_,pureBcsSchemaFromTypeName:()=>v_.pureBcsSchemaFromTypeName});var h_=d_(Dg),Gn=To,kt=Uf,p_=$E,m_=ig,g_=To,v_=o_;const y_={...Gn.bcs,U8:Gn.bcs.u8(),U16:Gn.bcs.u16(),U32:Gn.bcs.u32(),U64:Gn.bcs.u64(),U128:Gn.bcs.u128(),U256:Gn.bcs.u256(),ULEB128:Gn.bcs.uleb128(),Bool:Gn.bcs.bool(),String:Gn.bcs.string(),Address:kt.Address,AppId:kt.AppId,Argument:kt.Argument,CallArg:kt.CallArg,CompressedSignature:kt.CompressedSignature,GasData:kt.GasData,Intent:kt.Intent,IntentMessage:kt.IntentMessage,IntentScope:kt.IntentScope,IntentVersion:kt.IntentVersion,MultiSig:kt.MultiSig,MultiSigPkMap:kt.MultiSigPkMap,MultiSigPublicKey:kt.MultiSigPublicKey,ObjectArg:kt.ObjectArg,ObjectDigest:kt.ObjectDigest,Owner:kt.Owner,ProgrammableMoveCall:kt.ProgrammableMoveCall,ProgrammableTransaction:kt.ProgrammableTransaction,PublicKey:kt.PublicKey,SenderSignedData:kt.SenderSignedData,SenderSignedTransaction:kt.SenderSignedTransaction,SharedObjectRef:kt.SharedObjectRef,StructTag:kt.StructTag,SuiObjectRef:kt.SuiObjectRef,Command:kt.Command,TransactionData:kt.TransactionData,TransactionDataV1:kt.TransactionDataV1,TransactionExpiration:kt.TransactionExpiration,TransactionKind:kt.TransactionKind,TypeTag:kt.TypeTag,TransactionEffects:p_.TransactionEffects,PasskeyAuthenticator:kt.PasskeyAuthenticator};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.SuiPythClient=void 0;const jc=TS,as=h_,w_=ua,Yf=16*1024;class b_{constructor(t,r,n){vt(this,"provider");vt(this,"pythStateId");vt(this,"wormholeStateId");vt(this,"pythPackageId");vt(this,"wormholePackageId");vt(this,"priceTableInfo");vt(this,"priceFeedObjectIdCache",new Map);vt(this,"baseUpdateFee");this.provider=t,this.pythStateId=r,this.wormholeStateId=n,this.pythPackageId=void 0,this.wormholePackageId=void 0}async getBaseUpdateFee(){if(this.baseUpdateFee===void 0){const t=await this.provider.getObject({id:this.pythStateId,options:{showContent:!0}});if(!t.data||!t.data.content||t.data.content.dataType!=="moveObject")throw new Error("Unable to fetch pyth state object");this.baseUpdateFee=t.data.content.fields.base_update_fee}return this.baseUpdateFee}async getPackageId(t){const r=await this.provider.getObject({id:t,options:{showContent:!0}}).then(n=>{var i,o,s;if(((o=(i=n.data)==null?void 0:i.content)==null?void 0:o.dataType)=="moveObject")return n.data.content.fields;throw console.log((s=n.data)==null?void 0:s.content),new Error(`Cannot fetch package id for object ${t}`)});if("upgrade_cap"in r)return r.upgrade_cap.fields.package;throw new Error("upgrade_cap not found")}async verifyVaas(t,r){const n=await this.getWormholePackageId(),i=[];for(const o of t){const[s]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(as.bcs.vector(as.bcs.U8).serialize(Array.from(o),{maxSize:Yf}).toBytes()),r.object(jc.SUI_CLOCK_OBJECT_ID)]});i.push(s)}return i}async updatePriceFeeds(t,r,n){const i=await this.getPythPackageId();let o;if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const s=this.extractVaaBytesFromAccumulatorMessage(r[0]),a=await this.verifyVaas([s],t);[o]=t.moveCall({target:`${i}::pyth::create_authenticated_price_infos_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(as.bcs.vector(as.bcs.U8).serialize(Array.from(r[0]),{maxSize:Yf}).toBytes()),a[0],t.object(jc.SUI_CLOCK_OBJECT_ID)]});const c=[],u=await this.getBaseUpdateFee(),l=t.splitCoins(t.gas,n.map(()=>t.pure.u64(u)));let d=0;for(const p of n){const b=await this.getPriceFeedObjectId(p);if(!b)throw new Error(`Price feed ${p} not found, please create it first`);c.push(b),[o]=t.moveCall({target:`${i}::pyth::update_single_price_feed`,arguments:[t.object(this.pythStateId),o,t.object(b),l[d],t.object(jc.SUI_CLOCK_OBJECT_ID)]}),d++}return t.moveCall({target:`${i}::hot_potato_vector::destroy`,arguments:[o],typeArguments:[`${i}::price_info::PriceInfo`]}),c}async createPriceFeed(t,r){const n=await this.getPythPackageId();if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const i=this.extractVaaBytesFromAccumulatorMessage(r[0]),o=await this.verifyVaas([i],t);t.moveCall({target:`${n}::pyth::create_price_feeds_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(as.bcs.vector(as.bcs.U8).serialize(Array.from(r[0]),{maxSize:Yf}).toBytes()),o[0],t.object(jc.SUI_CLOCK_OBJECT_ID)]})}async getWormholePackageId(){return this.wormholePackageId||(this.wormholePackageId=await this.getPackageId(this.wormholeStateId)),this.wormholePackageId}async getPythPackageId(){return this.pythPackageId||(this.pythPackageId=await this.getPackageId(this.pythStateId)),this.pythPackageId}async getPriceFeedObjectId(t){const r=t.replace("0x","");if(!this.priceFeedObjectIdCache.has(r)){const{id:n,fieldType:i}=await this.getPriceTableInfo(),o=await this.provider.getDynamicFieldObject({parentId:n,name:{type:`${i}::price_identifier::PriceIdentifier`,value:{bytes:Array.from(w_.Buffer.from(r,"hex"))}}});if(!o.data||!o.data.content)return;if(o.data.content.dataType!=="moveObject")throw new Error("Price feed type mismatch");this.priceFeedObjectIdCache.set(r,o.data.content.fields.value)}return this.priceFeedObjectIdCache.get(r)}async getPriceTableInfo(){if(this.priceTableInfo===void 0){const t=await this.provider.getDynamicFieldObject({parentId:this.pythStateId,name:{type:"vector<u8>",value:"price_info"}});if(!t.data||!t.data.type)throw new Error("Price Table not found, contract may not be initialized");let r=t.data.type.replace("0x2::table::Table<","");r=r.replace("::price_identifier::PriceIdentifier, 0x2::object::ID>",""),this.priceTableInfo={id:t.data.objectId,fieldType:r}}return this.priceTableInfo}extractVaaBytesFromAccumulatorMessage(t){const n=7+t.readUint8(6)+1,i=t.readUint16BE(n),o=n+2;return t.subarray(o,o+i)}}Rc.SuiPythClient=b_,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=fc;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Rc;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=ql;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(Hl);var x_=Object.create,Zf=Object.defineProperty,S_=Object.defineProperties,E_=Object.getOwnPropertyDescriptor,__=Object.getOwnPropertyDescriptors,Bg=Object.getOwnPropertyNames,Lg=Object.getOwnPropertySymbols,C_=Object.getPrototypeOf,$g=Object.prototype.hasOwnProperty,A_=Object.prototype.propertyIsEnumerable,Fg=(e,t,r)=>t in e?Zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M_=(e,t)=>{for(var r in t||(t={}))$g.call(t,r)&&Fg(e,r,t[r]);if(Lg)for(var r of Lg(t))A_.call(t,r)&&Fg(e,r,t[r]);return e},T_=(e,t)=>S_(e,__(t)),I_=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),O_=(e,t)=>function(){return t||(0,e[Bg(e)[0]])((t={exports:{}}).exports,t),t.exports},P_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bg(t))!$g.call(e,i)&&i!==r&&Zf(e,i,{get:()=>t[i],enumerable:!(n=E_(t,i))||n.enumerable});return e},Oo=(e,t,r)=>(r=e!=null?x_(C_(e)):{},P_(!e||!e.__esModule?Zf(r,"default",{value:e,enumerable:!0}):r,e)),lt=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{a(r.next(c))}catch(u){i(u)}},s=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,s);a((r=r.apply(e,t)).next())}),Po=O_({"node_modules/bn.js/lib/bn.js"(e,t){(function(r,n){function i(h,f){if(!h)throw new Error(f||"Assertion failed")}function o(h,f){h.super_=f;var m=function(){};m.prototype=f.prototype,h.prototype=new m,h.prototype.constructor=h}function s(h,f,m){if(s.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(h||0,f||10,m||"be"))}typeof r=="object"?r.exports=s:n.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=I_("buffer").Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,m){return f.cmp(m)>0?f:m},s.min=function(f,m){return f.cmp(m)<0?f:m},s.prototype._init=function(f,m,S){if(typeof f=="number")return this._initNumber(f,m,S);if(typeof f=="object")return this._initArray(f,m,S);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var A=0;f[0]==="-"&&(A++,this.negative=1),A<f.length&&(m===16?this._parseHex(f,A,S):(this._parseBase(f,m,A),S==="le"&&this._initArray(this.toArray(),m,S)))},s.prototype._initNumber=function(f,m,S){f<0&&(this.negative=1,f=-f),f<67108864?(this.words=[f&67108863],this.length=1):f<4503599627370496?(this.words=[f&67108863,f/67108864&67108863],this.length=2):(i(f<9007199254740992),this.words=[f&67108863,f/67108864&67108863,1],this.length=3),S==="le"&&this._initArray(this.toArray(),m,S)},s.prototype._initArray=function(f,m,S){if(i(typeof f.length=="number"),f.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(f.length/3),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var _,I,C=0;if(S==="be")for(A=f.length-1,_=0;A>=0;A-=3)I=f[A]|f[A-1]<<8|f[A-2]<<16,this.words[_]|=I<<C&67108863,this.words[_+1]=I>>>26-C&67108863,C+=24,C>=26&&(C-=26,_++);else if(S==="le")for(A=0,_=0;A<f.length;A+=3)I=f[A]|f[A+1]<<8|f[A+2]<<16,this.words[_]|=I<<C&67108863,this.words[_+1]=I>>>26-C&67108863,C+=24,C>=26&&(C-=26,_++);return this._strip()};function c(h,f){var m=h.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;i(!1,"Invalid character in "+h)}function u(h,f,m){var S=c(h,m);return m-1>=f&&(S|=c(h,m-1)<<4),S}s.prototype._parseHex=function(f,m,S){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var _=0,I=0,C;if(S==="be")for(A=f.length-1;A>=m;A-=2)C=u(f,m,A)<<_,this.words[I]|=C&67108863,_>=18?(_-=18,I+=1,this.words[I]|=C>>>26):_+=8;else{var g=f.length-m;for(A=g%2===0?m+1:m;A<f.length;A+=2)C=u(f,m,A)<<_,this.words[I]|=C&67108863,_>=18?(_-=18,I+=1,this.words[I]|=C>>>26):_+=8}this._strip()};function l(h,f,m,S){for(var A=0,_=0,I=Math.min(h.length,m),C=f;C<I;C++){var g=h.charCodeAt(C)-48;A*=S,g>=49?_=g-49+10:g>=17?_=g-17+10:_=g,i(g>=0&&_<S,"Invalid character"),A+=_}return A}s.prototype._parseBase=function(f,m,S){this.words=[0],this.length=1;for(var A=0,_=1;_<=67108863;_*=m)A++;A--,_=_/m|0;for(var I=f.length-S,C=I%A,g=Math.min(I,I-C)+S,v=0,R=S;R<g;R+=A)v=l(f,R,R+A,m),this.imuln(_),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var J=1;for(v=l(f,R,f.length,m),R=0;R<C;R++)J*=m;this.imuln(J),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(f){f.words=new Array(this.length);for(var m=0;m<this.length;m++)f.words[m]=this.words[m];f.length=this.length,f.negative=this.negative,f.red=this.red};function d(h,f){h.words=f.words,h.length=f.length,h.negative=f.negative,h.red=f.red}if(s.prototype._move=function(f){d(f,this)},s.prototype.clone=function(){var f=new s(null);return this.copy(f),f},s.prototype._expand=function(f){for(;this.length<f;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var b=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],x=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,m){f=f||10,m=m|0||1;var S;if(f===16||f==="hex"){S="";for(var A=0,_=0,I=0;I<this.length;I++){var C=this.words[I],g=((C<<A|_)&16777215).toString(16);_=C>>>24-A&16777215,A+=2,A>=26&&(A-=26,I--),_!==0||I!==this.length-1?S=b[6-g.length]+g+S:S=g+S}for(_!==0&&(S=_.toString(16)+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(f===(f|0)&&f>=2&&f<=36){var v=x[f],R=y[f];S="";var J=this.clone();for(J.negative=0;!J.isZero();){var Q=J.modrn(R).toString(f);J=J.idivn(R),J.isZero()?S=Q+S:S=b[v-Q.length]+Q+S}for(this.isZero()&&(S="0"+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(f,m){return this.toArrayLike(a,f,m)}),s.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var T=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};s.prototype.toArrayLike=function(f,m,S){this._strip();var A=this.byteLength(),_=S||Math.max(1,A);i(A<=_,"byte array longer than desired length"),i(_>0,"Requested array length <= 0");var I=T(f,_),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](I,A),I},s.prototype._toArrayLikeLE=function(f,m){for(var S=0,A=0,_=0,I=0;_<this.length;_++){var C=this.words[_]<<I|A;f[S++]=C&255,S<f.length&&(f[S++]=C>>8&255),S<f.length&&(f[S++]=C>>16&255),I===6?(S<f.length&&(f[S++]=C>>24&255),A=0,I=0):(A=C>>>24,I+=2)}if(S<f.length)for(f[S++]=A;S<f.length;)f[S++]=0},s.prototype._toArrayLikeBE=function(f,m){for(var S=f.length-1,A=0,_=0,I=0;_<this.length;_++){var C=this.words[_]<<I|A;f[S--]=C&255,S>=0&&(f[S--]=C>>8&255),S>=0&&(f[S--]=C>>16&255),I===6?(S>=0&&(f[S--]=C>>24&255),A=0,I=0):(A=C>>>24,I+=2)}if(S>=0)for(f[S--]=A;S>=0;)f[S--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var m=f,S=0;return m>=4096&&(S+=13,m>>>=13),m>=64&&(S+=7,m>>>=7),m>=8&&(S+=4,m>>>=4),m>=2&&(S+=2,m>>>=2),S+m},s.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,S=0;return m&8191||(S+=13,m>>>=13),m&127||(S+=7,m>>>=7),m&15||(S+=4,m>>>=4),m&3||(S+=2,m>>>=2),m&1||S++,S},s.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function O(h){for(var f=new Array(h.bitLength()),m=0;m<f.length;m++){var S=m/26|0,A=m%26;f[m]=h.words[S]>>>A&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;m<this.length;m++){var S=this._zeroBits(this.words[m]);if(f+=S,S!==26)break}return f},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(f){return this.negative!==0?this.abs().inotn(f).iaddn(1):this.clone()},s.prototype.fromTwos=function(f){return this.testn(f-1)?this.notn(f).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(f){for(;this.length<f.length;)this.words[this.length++]=0;for(var m=0;m<f.length;m++)this.words[m]=this.words[m]|f.words[m];return this._strip()},s.prototype.ior=function(f){return i((this.negative|f.negative)===0),this.iuor(f)},s.prototype.or=function(f){return this.length>f.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var S=0;S<m.length;S++)this.words[S]=this.words[S]&f.words[S];return this.length=m.length,this._strip()},s.prototype.iand=function(f){return i((this.negative|f.negative)===0),this.iuand(f)},s.prototype.and=function(f){return this.length>f.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var m,S;this.length>f.length?(m=this,S=f):(m=f,S=this);for(var A=0;A<S.length;A++)this.words[A]=m.words[A]^S.words[A];if(this!==m)for(;A<m.length;A++)this.words[A]=m.words[A];return this.length=m.length,this._strip()},s.prototype.ixor=function(f){return i((this.negative|f.negative)===0),this.iuxor(f)},s.prototype.xor=function(f){return this.length>f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){i(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,S=f%26;this._expand(m),S>0&&m--;for(var A=0;A<m;A++)this.words[A]=~this.words[A]&67108863;return S>0&&(this.words[A]=~this.words[A]&67108863>>26-S),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,m){i(typeof f=="number"&&f>=0);var S=f/26|0,A=f%26;return this._expand(S+1),m?this.words[S]=this.words[S]|1<<A:this.words[S]=this.words[S]&~(1<<A),this._strip()},s.prototype.iadd=function(f){var m;if(this.negative!==0&&f.negative===0)return this.negative=0,m=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,m=this.isub(f),f.negative=1,m._normSign();var S,A;this.length>f.length?(S=this,A=f):(S=f,A=this);for(var _=0,I=0;I<A.length;I++)m=(S.words[I]|0)+(A.words[I]|0)+_,this.words[I]=m&67108863,_=m>>>26;for(;_!==0&&I<S.length;I++)m=(S.words[I]|0)+_,this.words[I]=m&67108863,_=m>>>26;if(this.length=S.length,_!==0)this.words[this.length]=_,this.length++;else if(S!==this)for(;I<S.length;I++)this.words[I]=S.words[I];return this},s.prototype.add=function(f){var m;return f.negative!==0&&this.negative===0?(f.negative=0,m=this.sub(f),f.negative^=1,m):f.negative===0&&this.negative!==0?(this.negative=0,m=f.sub(this),this.negative=1,m):this.length>f.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var S=this.cmp(f);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,_;S>0?(A=this,_=f):(A=f,_=this);for(var I=0,C=0;C<_.length;C++)m=(A.words[C]|0)-(_.words[C]|0)+I,I=m>>26,this.words[C]=m&67108863;for(;I!==0&&C<A.length;C++)m=(A.words[C]|0)+I,I=m>>26,this.words[C]=m&67108863;if(I===0&&C<A.length&&A!==this)for(;C<A.length;C++)this.words[C]=A.words[C];return this.length=Math.max(this.length,C),A!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function N(h,f,m){m.negative=f.negative^h.negative;var S=h.length+f.length|0;m.length=S,S=S-1|0;var A=h.words[0]|0,_=f.words[0]|0,I=A*_,C=I&67108863,g=I/67108864|0;m.words[0]=C;for(var v=1;v<S;v++){for(var R=g>>>26,J=g&67108863,Q=Math.min(v,f.length-1),ue=Math.max(0,v-h.length+1);ue<=Q;ue++){var _e=v-ue|0;A=h.words[_e]|0,_=f.words[ue]|0,I=A*_+J,R+=I/67108864|0,J=I&67108863}m.words[v]=J|0,g=R|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var k=function(f,m,S){var A=f.words,_=m.words,I=S.words,C=0,g,v,R,J=A[0]|0,Q=J&8191,ue=J>>>13,_e=A[1]|0,de=_e&8191,be=_e>>>13,De=A[2]|0,Ne=De&8191,ft=De>>>13,dt=A[3]|0,ke=dt&8191,mt=dt>>>13,we=A[4]|0,pe=we&8191,Ce=we>>>13,Ve=A[5]|0,je=Ve&8191,Ae=Ve>>>13,Te=A[6]|0,$e=Te&8191,ct=Te>>>13,ut=A[7]|0,ze=ut&8191,Dt=ut>>>13,Et=A[8]|0,Ze=Et&8191,Ot=Et>>>13,Ft=A[9]|0,Qe=Ft&8191,_t=Ft>>>13,Pt=_[0]|0,rt=Pt&8191,Bt=Pt>>>13,Rt=_[1]|0,et=Rt&8191,xt=Rt>>>13,At=_[2]|0,Ge=At&8191,gt=At>>>13,Nt=_[3]|0,nt=Nt&8191,St=Nt>>>13,zt=_[4]|0,j=zt&8191,E=zt>>>13,M=_[5]|0,$=M&8191,Y=M>>>13,ee=_[6]|0,ie=ee&8191,Be=ee>>>13,Je=_[7]|0,Re=Je&8191,V=Je>>>13,se=_[8]|0,fe=se&8191,Oe=se>>>13,He=_[9]|0,Pe=He&8191,Fe=He>>>13;S.negative=f.negative^m.negative,S.length=19,g=Math.imul(Q,rt),v=Math.imul(Q,Bt),v=v+Math.imul(ue,rt)|0,R=Math.imul(ue,Bt);var st=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(st>>>26)|0,st&=67108863,g=Math.imul(de,rt),v=Math.imul(de,Bt),v=v+Math.imul(be,rt)|0,R=Math.imul(be,Bt),g=g+Math.imul(Q,et)|0,v=v+Math.imul(Q,xt)|0,v=v+Math.imul(ue,et)|0,R=R+Math.imul(ue,xt)|0;var er=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(Ne,rt),v=Math.imul(Ne,Bt),v=v+Math.imul(ft,rt)|0,R=Math.imul(ft,Bt),g=g+Math.imul(de,et)|0,v=v+Math.imul(de,xt)|0,v=v+Math.imul(be,et)|0,R=R+Math.imul(be,xt)|0,g=g+Math.imul(Q,Ge)|0,v=v+Math.imul(Q,gt)|0,v=v+Math.imul(ue,Ge)|0,R=R+Math.imul(ue,gt)|0;var Lt=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,g=Math.imul(ke,rt),v=Math.imul(ke,Bt),v=v+Math.imul(mt,rt)|0,R=Math.imul(mt,Bt),g=g+Math.imul(Ne,et)|0,v=v+Math.imul(Ne,xt)|0,v=v+Math.imul(ft,et)|0,R=R+Math.imul(ft,xt)|0,g=g+Math.imul(de,Ge)|0,v=v+Math.imul(de,gt)|0,v=v+Math.imul(be,Ge)|0,R=R+Math.imul(be,gt)|0,g=g+Math.imul(Q,nt)|0,v=v+Math.imul(Q,St)|0,v=v+Math.imul(ue,nt)|0,R=R+Math.imul(ue,St)|0;var Ut=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(pe,rt),v=Math.imul(pe,Bt),v=v+Math.imul(Ce,rt)|0,R=Math.imul(Ce,Bt),g=g+Math.imul(ke,et)|0,v=v+Math.imul(ke,xt)|0,v=v+Math.imul(mt,et)|0,R=R+Math.imul(mt,xt)|0,g=g+Math.imul(Ne,Ge)|0,v=v+Math.imul(Ne,gt)|0,v=v+Math.imul(ft,Ge)|0,R=R+Math.imul(ft,gt)|0,g=g+Math.imul(de,nt)|0,v=v+Math.imul(de,St)|0,v=v+Math.imul(be,nt)|0,R=R+Math.imul(be,St)|0,g=g+Math.imul(Q,j)|0,v=v+Math.imul(Q,E)|0,v=v+Math.imul(ue,j)|0,R=R+Math.imul(ue,E)|0;var lr=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(je,rt),v=Math.imul(je,Bt),v=v+Math.imul(Ae,rt)|0,R=Math.imul(Ae,Bt),g=g+Math.imul(pe,et)|0,v=v+Math.imul(pe,xt)|0,v=v+Math.imul(Ce,et)|0,R=R+Math.imul(Ce,xt)|0,g=g+Math.imul(ke,Ge)|0,v=v+Math.imul(ke,gt)|0,v=v+Math.imul(mt,Ge)|0,R=R+Math.imul(mt,gt)|0,g=g+Math.imul(Ne,nt)|0,v=v+Math.imul(Ne,St)|0,v=v+Math.imul(ft,nt)|0,R=R+Math.imul(ft,St)|0,g=g+Math.imul(de,j)|0,v=v+Math.imul(de,E)|0,v=v+Math.imul(be,j)|0,R=R+Math.imul(be,E)|0,g=g+Math.imul(Q,$)|0,v=v+Math.imul(Q,Y)|0,v=v+Math.imul(ue,$)|0,R=R+Math.imul(ue,Y)|0;var Or=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Or>>>26)|0,Or&=67108863,g=Math.imul($e,rt),v=Math.imul($e,Bt),v=v+Math.imul(ct,rt)|0,R=Math.imul(ct,Bt),g=g+Math.imul(je,et)|0,v=v+Math.imul(je,xt)|0,v=v+Math.imul(Ae,et)|0,R=R+Math.imul(Ae,xt)|0,g=g+Math.imul(pe,Ge)|0,v=v+Math.imul(pe,gt)|0,v=v+Math.imul(Ce,Ge)|0,R=R+Math.imul(Ce,gt)|0,g=g+Math.imul(ke,nt)|0,v=v+Math.imul(ke,St)|0,v=v+Math.imul(mt,nt)|0,R=R+Math.imul(mt,St)|0,g=g+Math.imul(Ne,j)|0,v=v+Math.imul(Ne,E)|0,v=v+Math.imul(ft,j)|0,R=R+Math.imul(ft,E)|0,g=g+Math.imul(de,$)|0,v=v+Math.imul(de,Y)|0,v=v+Math.imul(be,$)|0,R=R+Math.imul(be,Y)|0,g=g+Math.imul(Q,ie)|0,v=v+Math.imul(Q,Be)|0,v=v+Math.imul(ue,ie)|0,R=R+Math.imul(ue,Be)|0;var dr=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(ze,rt),v=Math.imul(ze,Bt),v=v+Math.imul(Dt,rt)|0,R=Math.imul(Dt,Bt),g=g+Math.imul($e,et)|0,v=v+Math.imul($e,xt)|0,v=v+Math.imul(ct,et)|0,R=R+Math.imul(ct,xt)|0,g=g+Math.imul(je,Ge)|0,v=v+Math.imul(je,gt)|0,v=v+Math.imul(Ae,Ge)|0,R=R+Math.imul(Ae,gt)|0,g=g+Math.imul(pe,nt)|0,v=v+Math.imul(pe,St)|0,v=v+Math.imul(Ce,nt)|0,R=R+Math.imul(Ce,St)|0,g=g+Math.imul(ke,j)|0,v=v+Math.imul(ke,E)|0,v=v+Math.imul(mt,j)|0,R=R+Math.imul(mt,E)|0,g=g+Math.imul(Ne,$)|0,v=v+Math.imul(Ne,Y)|0,v=v+Math.imul(ft,$)|0,R=R+Math.imul(ft,Y)|0,g=g+Math.imul(de,ie)|0,v=v+Math.imul(de,Be)|0,v=v+Math.imul(be,ie)|0,R=R+Math.imul(be,Be)|0,g=g+Math.imul(Q,Re)|0,v=v+Math.imul(Q,V)|0,v=v+Math.imul(ue,Re)|0,R=R+Math.imul(ue,V)|0;var tr=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(Ze,rt),v=Math.imul(Ze,Bt),v=v+Math.imul(Ot,rt)|0,R=Math.imul(Ot,Bt),g=g+Math.imul(ze,et)|0,v=v+Math.imul(ze,xt)|0,v=v+Math.imul(Dt,et)|0,R=R+Math.imul(Dt,xt)|0,g=g+Math.imul($e,Ge)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(ct,Ge)|0,R=R+Math.imul(ct,gt)|0,g=g+Math.imul(je,nt)|0,v=v+Math.imul(je,St)|0,v=v+Math.imul(Ae,nt)|0,R=R+Math.imul(Ae,St)|0,g=g+Math.imul(pe,j)|0,v=v+Math.imul(pe,E)|0,v=v+Math.imul(Ce,j)|0,R=R+Math.imul(Ce,E)|0,g=g+Math.imul(ke,$)|0,v=v+Math.imul(ke,Y)|0,v=v+Math.imul(mt,$)|0,R=R+Math.imul(mt,Y)|0,g=g+Math.imul(Ne,ie)|0,v=v+Math.imul(Ne,Be)|0,v=v+Math.imul(ft,ie)|0,R=R+Math.imul(ft,Be)|0,g=g+Math.imul(de,Re)|0,v=v+Math.imul(de,V)|0,v=v+Math.imul(be,Re)|0,R=R+Math.imul(be,V)|0,g=g+Math.imul(Q,fe)|0,v=v+Math.imul(Q,Oe)|0,v=v+Math.imul(ue,fe)|0,R=R+Math.imul(ue,Oe)|0;var Er=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(Qe,rt),v=Math.imul(Qe,Bt),v=v+Math.imul(_t,rt)|0,R=Math.imul(_t,Bt),g=g+Math.imul(Ze,et)|0,v=v+Math.imul(Ze,xt)|0,v=v+Math.imul(Ot,et)|0,R=R+Math.imul(Ot,xt)|0,g=g+Math.imul(ze,Ge)|0,v=v+Math.imul(ze,gt)|0,v=v+Math.imul(Dt,Ge)|0,R=R+Math.imul(Dt,gt)|0,g=g+Math.imul($e,nt)|0,v=v+Math.imul($e,St)|0,v=v+Math.imul(ct,nt)|0,R=R+Math.imul(ct,St)|0,g=g+Math.imul(je,j)|0,v=v+Math.imul(je,E)|0,v=v+Math.imul(Ae,j)|0,R=R+Math.imul(Ae,E)|0,g=g+Math.imul(pe,$)|0,v=v+Math.imul(pe,Y)|0,v=v+Math.imul(Ce,$)|0,R=R+Math.imul(Ce,Y)|0,g=g+Math.imul(ke,ie)|0,v=v+Math.imul(ke,Be)|0,v=v+Math.imul(mt,ie)|0,R=R+Math.imul(mt,Be)|0,g=g+Math.imul(Ne,Re)|0,v=v+Math.imul(Ne,V)|0,v=v+Math.imul(ft,Re)|0,R=R+Math.imul(ft,V)|0,g=g+Math.imul(de,fe)|0,v=v+Math.imul(de,Oe)|0,v=v+Math.imul(be,fe)|0,R=R+Math.imul(be,Oe)|0,g=g+Math.imul(Q,Pe)|0,v=v+Math.imul(Q,Fe)|0,v=v+Math.imul(ue,Pe)|0,R=R+Math.imul(ue,Fe)|0;var Dn=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,g=Math.imul(Qe,et),v=Math.imul(Qe,xt),v=v+Math.imul(_t,et)|0,R=Math.imul(_t,xt),g=g+Math.imul(Ze,Ge)|0,v=v+Math.imul(Ze,gt)|0,v=v+Math.imul(Ot,Ge)|0,R=R+Math.imul(Ot,gt)|0,g=g+Math.imul(ze,nt)|0,v=v+Math.imul(ze,St)|0,v=v+Math.imul(Dt,nt)|0,R=R+Math.imul(Dt,St)|0,g=g+Math.imul($e,j)|0,v=v+Math.imul($e,E)|0,v=v+Math.imul(ct,j)|0,R=R+Math.imul(ct,E)|0,g=g+Math.imul(je,$)|0,v=v+Math.imul(je,Y)|0,v=v+Math.imul(Ae,$)|0,R=R+Math.imul(Ae,Y)|0,g=g+Math.imul(pe,ie)|0,v=v+Math.imul(pe,Be)|0,v=v+Math.imul(Ce,ie)|0,R=R+Math.imul(Ce,Be)|0,g=g+Math.imul(ke,Re)|0,v=v+Math.imul(ke,V)|0,v=v+Math.imul(mt,Re)|0,R=R+Math.imul(mt,V)|0,g=g+Math.imul(Ne,fe)|0,v=v+Math.imul(Ne,Oe)|0,v=v+Math.imul(ft,fe)|0,R=R+Math.imul(ft,Oe)|0,g=g+Math.imul(de,Pe)|0,v=v+Math.imul(de,Fe)|0,v=v+Math.imul(be,Pe)|0,R=R+Math.imul(be,Fe)|0;var Yr=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,g=Math.imul(Qe,Ge),v=Math.imul(Qe,gt),v=v+Math.imul(_t,Ge)|0,R=Math.imul(_t,gt),g=g+Math.imul(Ze,nt)|0,v=v+Math.imul(Ze,St)|0,v=v+Math.imul(Ot,nt)|0,R=R+Math.imul(Ot,St)|0,g=g+Math.imul(ze,j)|0,v=v+Math.imul(ze,E)|0,v=v+Math.imul(Dt,j)|0,R=R+Math.imul(Dt,E)|0,g=g+Math.imul($e,$)|0,v=v+Math.imul($e,Y)|0,v=v+Math.imul(ct,$)|0,R=R+Math.imul(ct,Y)|0,g=g+Math.imul(je,ie)|0,v=v+Math.imul(je,Be)|0,v=v+Math.imul(Ae,ie)|0,R=R+Math.imul(Ae,Be)|0,g=g+Math.imul(pe,Re)|0,v=v+Math.imul(pe,V)|0,v=v+Math.imul(Ce,Re)|0,R=R+Math.imul(Ce,V)|0,g=g+Math.imul(ke,fe)|0,v=v+Math.imul(ke,Oe)|0,v=v+Math.imul(mt,fe)|0,R=R+Math.imul(mt,Oe)|0,g=g+Math.imul(Ne,Pe)|0,v=v+Math.imul(Ne,Fe)|0,v=v+Math.imul(ft,Pe)|0,R=R+Math.imul(ft,Fe)|0;var Bn=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,g=Math.imul(Qe,nt),v=Math.imul(Qe,St),v=v+Math.imul(_t,nt)|0,R=Math.imul(_t,St),g=g+Math.imul(Ze,j)|0,v=v+Math.imul(Ze,E)|0,v=v+Math.imul(Ot,j)|0,R=R+Math.imul(Ot,E)|0,g=g+Math.imul(ze,$)|0,v=v+Math.imul(ze,Y)|0,v=v+Math.imul(Dt,$)|0,R=R+Math.imul(Dt,Y)|0,g=g+Math.imul($e,ie)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(ct,ie)|0,R=R+Math.imul(ct,Be)|0,g=g+Math.imul(je,Re)|0,v=v+Math.imul(je,V)|0,v=v+Math.imul(Ae,Re)|0,R=R+Math.imul(Ae,V)|0,g=g+Math.imul(pe,fe)|0,v=v+Math.imul(pe,Oe)|0,v=v+Math.imul(Ce,fe)|0,R=R+Math.imul(Ce,Oe)|0,g=g+Math.imul(ke,Pe)|0,v=v+Math.imul(ke,Fe)|0,v=v+Math.imul(mt,Pe)|0,R=R+Math.imul(mt,Fe)|0;var Ni=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Ni>>>26)|0,Ni&=67108863,g=Math.imul(Qe,j),v=Math.imul(Qe,E),v=v+Math.imul(_t,j)|0,R=Math.imul(_t,E),g=g+Math.imul(Ze,$)|0,v=v+Math.imul(Ze,Y)|0,v=v+Math.imul(Ot,$)|0,R=R+Math.imul(Ot,Y)|0,g=g+Math.imul(ze,ie)|0,v=v+Math.imul(ze,Be)|0,v=v+Math.imul(Dt,ie)|0,R=R+Math.imul(Dt,Be)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,V)|0,v=v+Math.imul(ct,Re)|0,R=R+Math.imul(ct,V)|0,g=g+Math.imul(je,fe)|0,v=v+Math.imul(je,Oe)|0,v=v+Math.imul(Ae,fe)|0,R=R+Math.imul(Ae,Oe)|0,g=g+Math.imul(pe,Pe)|0,v=v+Math.imul(pe,Fe)|0,v=v+Math.imul(Ce,Pe)|0,R=R+Math.imul(Ce,Fe)|0;var ji=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(ji>>>26)|0,ji&=67108863,g=Math.imul(Qe,$),v=Math.imul(Qe,Y),v=v+Math.imul(_t,$)|0,R=Math.imul(_t,Y),g=g+Math.imul(Ze,ie)|0,v=v+Math.imul(Ze,Be)|0,v=v+Math.imul(Ot,ie)|0,R=R+Math.imul(Ot,Be)|0,g=g+Math.imul(ze,Re)|0,v=v+Math.imul(ze,V)|0,v=v+Math.imul(Dt,Re)|0,R=R+Math.imul(Dt,V)|0,g=g+Math.imul($e,fe)|0,v=v+Math.imul($e,Oe)|0,v=v+Math.imul(ct,fe)|0,R=R+Math.imul(ct,Oe)|0,g=g+Math.imul(je,Pe)|0,v=v+Math.imul(je,Fe)|0,v=v+Math.imul(Ae,Pe)|0,R=R+Math.imul(Ae,Fe)|0;var Ln=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,g=Math.imul(Qe,ie),v=Math.imul(Qe,Be),v=v+Math.imul(_t,ie)|0,R=Math.imul(_t,Be),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,V)|0,v=v+Math.imul(Ot,Re)|0,R=R+Math.imul(Ot,V)|0,g=g+Math.imul(ze,fe)|0,v=v+Math.imul(ze,Oe)|0,v=v+Math.imul(Dt,fe)|0,R=R+Math.imul(Dt,Oe)|0,g=g+Math.imul($e,Pe)|0,v=v+Math.imul($e,Fe)|0,v=v+Math.imul(ct,Pe)|0,R=R+Math.imul(ct,Fe)|0;var ki=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(ki>>>26)|0,ki&=67108863,g=Math.imul(Qe,Re),v=Math.imul(Qe,V),v=v+Math.imul(_t,Re)|0,R=Math.imul(_t,V),g=g+Math.imul(Ze,fe)|0,v=v+Math.imul(Ze,Oe)|0,v=v+Math.imul(Ot,fe)|0,R=R+Math.imul(Ot,Oe)|0,g=g+Math.imul(ze,Pe)|0,v=v+Math.imul(ze,Fe)|0,v=v+Math.imul(Dt,Pe)|0,R=R+Math.imul(Dt,Fe)|0;var Di=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(Di>>>26)|0,Di&=67108863,g=Math.imul(Qe,fe),v=Math.imul(Qe,Oe),v=v+Math.imul(_t,fe)|0,R=Math.imul(_t,Oe),g=g+Math.imul(Ze,Pe)|0,v=v+Math.imul(Ze,Fe)|0,v=v+Math.imul(Ot,Pe)|0,R=R+Math.imul(Ot,Fe)|0;var B=(C+g|0)+((v&8191)<<13)|0;C=(R+(v>>>13)|0)+(B>>>26)|0,B&=67108863,g=Math.imul(Qe,Pe),v=Math.imul(Qe,Fe),v=v+Math.imul(_t,Pe)|0,R=Math.imul(_t,Fe);var K=(C+g|0)+((v&8191)<<13)|0;return C=(R+(v>>>13)|0)+(K>>>26)|0,K&=67108863,I[0]=st,I[1]=er,I[2]=Lt,I[3]=Ut,I[4]=lr,I[5]=Or,I[6]=dr,I[7]=tr,I[8]=Er,I[9]=Dn,I[10]=Yr,I[11]=Bn,I[12]=Ni,I[13]=ji,I[14]=Ln,I[15]=ki,I[16]=Di,I[17]=B,I[18]=K,C!==0&&(I[19]=C,S.length++),S};Math.imul||(k=N);function F(h,f,m){m.negative=f.negative^h.negative,m.length=h.length+f.length;for(var S=0,A=0,_=0;_<m.length-1;_++){var I=A;A=0;for(var C=S&67108863,g=Math.min(_,f.length-1),v=Math.max(0,_-h.length+1);v<=g;v++){var R=_-v,J=h.words[R]|0,Q=f.words[v]|0,ue=J*Q,_e=ue&67108863;I=I+(ue/67108864|0)|0,_e=_e+C|0,C=_e&67108863,I=I+(_e>>>26)|0,A+=I>>>26,I&=67108863}m.words[_]=C,S=I,I=A}return S!==0?m.words[_]=S:m.length--,m._strip()}function L(h,f,m){return F(h,f,m)}s.prototype.mulTo=function(f,m){var S,A=this.length+f.length;return this.length===10&&f.length===10?S=k(this,f,m):A<63?S=N(this,f,m):A<1024?S=F(this,f,m):S=L(this,f,m),S},s.prototype.mul=function(f){var m=new s(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},s.prototype.mulf=function(f){var m=new s(null);return m.words=new Array(this.length+f.length),L(this,f,m)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var m=f<0;m&&(f=-f),i(typeof f=="number"),i(f<67108864);for(var S=0,A=0;A<this.length;A++){var _=(this.words[A]|0)*f,I=(_&67108863)+(S&67108863);S>>=26,S+=_/67108864|0,S+=I>>>26,this.words[A]=I&67108863}return S!==0&&(this.words[A]=S,this.length++),m?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var m=O(f);if(m.length===0)return new s(1);for(var S=this,A=0;A<m.length&&m[A]===0;A++,S=S.sqr());if(++A<m.length)for(var _=S.sqr();A<m.length;A++,_=_.sqr())m[A]!==0&&(S=S.mul(_));return S},s.prototype.iushln=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26,A=67108863>>>26-m<<26-m,_;if(m!==0){var I=0;for(_=0;_<this.length;_++){var C=this.words[_]&A,g=(this.words[_]|0)-C<<m;this.words[_]=g|I,I=C>>>26-m}I&&(this.words[_]=I,this.length++)}if(S!==0){for(_=this.length-1;_>=0;_--)this.words[_+S]=this.words[_];for(_=0;_<S;_++)this.words[_]=0;this.length+=S}return this._strip()},s.prototype.ishln=function(f){return i(this.negative===0),this.iushln(f)},s.prototype.iushrn=function(f,m,S){i(typeof f=="number"&&f>=0);var A;m?A=(m-m%26)/26:A=0;var _=f%26,I=Math.min((f-_)/26,this.length),C=67108863^67108863>>>_<<_,g=S;if(A-=I,A=Math.max(0,A),g){for(var v=0;v<I;v++)g.words[v]=this.words[v];g.length=I}if(I!==0)if(this.length>I)for(this.length-=I,v=0;v<this.length;v++)this.words[v]=this.words[v+I];else this.words[0]=0,this.length=1;var R=0;for(v=this.length-1;v>=0&&(R!==0||v>=A);v--){var J=this.words[v]|0;this.words[v]=R<<26-_|J>>>_,R=J&C}return g&&R!==0&&(g.words[g.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,m,S){return i(this.negative===0),this.iushrn(f,m,S)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26,A=1<<m;if(this.length<=S)return!1;var _=this.words[S];return!!(_&A)},s.prototype.imaskn=function(f){i(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(m!==0&&S++,this.length=Math.min(S,this.length),m!==0){var A=67108863^67108863>>>m<<m;this.words[this.length-1]&=A}return this._strip()},s.prototype.maskn=function(f){return this.clone().imaskn(f)},s.prototype.iaddn=function(f){return i(typeof f=="number"),i(f<67108864),f<0?this.isubn(-f):this.negative!==0?this.length===1&&(this.words[0]|0)<=f?(this.words[0]=f-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(f),this.negative=1,this):this._iaddn(f)},s.prototype._iaddn=function(f){this.words[0]+=f;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(f){if(i(typeof f=="number"),i(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},s.prototype.addn=function(f){return this.clone().iaddn(f)},s.prototype.subn=function(f){return this.clone().isubn(f)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(f,m,S){var A=f.length+S,_;this._expand(A);var I,C=0;for(_=0;_<f.length;_++){I=(this.words[_+S]|0)+C;var g=(f.words[_]|0)*m;I-=g&67108863,C=(I>>26)-(g/67108864|0),this.words[_+S]=I&67108863}for(;_<this.length-S;_++)I=(this.words[_+S]|0)+C,C=I>>26,this.words[_+S]=I&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,_=0;_<this.length;_++)I=-(this.words[_]|0)+C,C=I>>26,this.words[_]=I&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,m){var S=this.length-f.length,A=this.clone(),_=f,I=_.words[_.length-1]|0,C=this._countBits(I);S=26-C,S!==0&&(_=_.ushln(S),A.iushln(S),I=_.words[_.length-1]|0);var g=A.length-_.length,v;if(m!=="mod"){v=new s(null),v.length=g+1,v.words=new Array(v.length);for(var R=0;R<v.length;R++)v.words[R]=0}var J=A.clone()._ishlnsubmul(_,1,g);J.negative===0&&(A=J,v&&(v.words[g]=1));for(var Q=g-1;Q>=0;Q--){var ue=(A.words[_.length+Q]|0)*67108864+(A.words[_.length+Q-1]|0);for(ue=Math.min(ue/I|0,67108863),A._ishlnsubmul(_,ue,Q);A.negative!==0;)ue--,A.negative=0,A._ishlnsubmul(_,1,Q),A.isZero()||(A.negative^=1);v&&(v.words[Q]=ue)}return v&&v._strip(),A._strip(),m!=="div"&&S!==0&&A.iushrn(S),{div:v||null,mod:A}},s.prototype.divmod=function(f,m,S){if(i(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var A,_,I;return this.negative!==0&&f.negative===0?(I=this.neg().divmod(f,m),m!=="mod"&&(A=I.div.neg()),m!=="div"&&(_=I.mod.neg(),S&&_.negative!==0&&_.iadd(f)),{div:A,mod:_}):this.negative===0&&f.negative!==0?(I=this.divmod(f.neg(),m),m!=="mod"&&(A=I.div.neg()),{div:A,mod:I.mod}):this.negative&f.negative?(I=this.neg().divmod(f.neg(),m),m!=="div"&&(_=I.mod.neg(),S&&_.negative!==0&&_.isub(f)),{div:I.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,m)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var S=m.div.negative!==0?m.mod.isub(f):m.mod,A=f.ushrn(1),_=f.andln(1),I=S.cmp(A);return I<0||_===1&&I===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modrn=function(f){var m=f<0;m&&(f=-f),i(f<=67108863);for(var S=(1<<26)%f,A=0,_=this.length-1;_>=0;_--)A=(S*A+(this.words[_]|0))%f;return m?-A:A},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var m=f<0;m&&(f=-f),i(f<=67108863);for(var S=0,A=this.length-1;A>=0;A--){var _=(this.words[A]|0)+S*67108864;this.words[A]=_/f|0,S=_%f}return this._strip(),m?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){i(f.negative===0),i(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var A=new s(1),_=new s(0),I=new s(0),C=new s(1),g=0;m.isEven()&&S.isEven();)m.iushrn(1),S.iushrn(1),++g;for(var v=S.clone(),R=m.clone();!m.isZero();){for(var J=0,Q=1;!(m.words[0]&Q)&&J<26;++J,Q<<=1);if(J>0)for(m.iushrn(J);J-- >0;)(A.isOdd()||_.isOdd())&&(A.iadd(v),_.isub(R)),A.iushrn(1),_.iushrn(1);for(var ue=0,_e=1;!(S.words[0]&_e)&&ue<26;++ue,_e<<=1);if(ue>0)for(S.iushrn(ue);ue-- >0;)(I.isOdd()||C.isOdd())&&(I.iadd(v),C.isub(R)),I.iushrn(1),C.iushrn(1);m.cmp(S)>=0?(m.isub(S),A.isub(I),_.isub(C)):(S.isub(m),I.isub(A),C.isub(_))}return{a:I,b:C,gcd:S.iushln(g)}},s.prototype._invmp=function(f){i(f.negative===0),i(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var A=new s(1),_=new s(0),I=S.clone();m.cmpn(1)>0&&S.cmpn(1)>0;){for(var C=0,g=1;!(m.words[0]&g)&&C<26;++C,g<<=1);if(C>0)for(m.iushrn(C);C-- >0;)A.isOdd()&&A.iadd(I),A.iushrn(1);for(var v=0,R=1;!(S.words[0]&R)&&v<26;++v,R<<=1);if(v>0)for(S.iushrn(v);v-- >0;)_.isOdd()&&_.iadd(I),_.iushrn(1);m.cmp(S)>=0?(m.isub(S),A.isub(_)):(S.isub(m),_.isub(A))}var J;return m.cmpn(1)===0?J=A:J=_,J.cmpn(0)<0&&J.iadd(f),J},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),S=f.clone();m.negative=0,S.negative=0;for(var A=0;m.isEven()&&S.isEven();A++)m.iushrn(1),S.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;S.isEven();)S.iushrn(1);var _=m.cmp(S);if(_<0){var I=m;m=S,S=I}else if(_===0||S.cmpn(1)===0)break;m.isub(S)}while(!0);return S.iushln(A)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){i(typeof f=="number");var m=f%26,S=(f-m)/26,A=1<<m;if(this.length<=S)return this._expand(S+1),this.words[S]|=A,this;for(var _=A,I=S;_!==0&&I<this.length;I++){var C=this.words[I]|0;C+=_,_=C>>>26,C&=67108863,this.words[I]=C}return _!==0&&(this.words[I]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var S;if(this.length>1)S=1;else{m&&(f=-f),i(f<=67108863,"Number is too big");var A=this.words[0]|0;S=A===f?0:A<f?-1:1}return this.negative!==0?-S|0:S},s.prototype.cmp=function(f){if(this.negative!==0&&f.negative===0)return-1;if(this.negative===0&&f.negative!==0)return 1;var m=this.ucmp(f);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(f){if(this.length>f.length)return 1;if(this.length<f.length)return-1;for(var m=0,S=this.length-1;S>=0;S--){var A=this.words[S]|0,_=f.words[S]|0;if(A!==_){A<_?m=-1:A>_&&(m=1);break}}return m},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new H(f)},s.prototype.toRed=function(f){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return i(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return i(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var W={k256:null,p224:null,p192:null,p25519:null};function z(h,f){this.name=h,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},z.prototype.ireduce=function(f){var m=f,S;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),S=m.bitLength();while(S>this.n);var A=S<this.n?-1:m.ucmp(this.p);return A===0?(m.words[0]=0,m.length=1):A>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},z.prototype.split=function(f,m){f.iushrn(this.n,0,m)},z.prototype.imulK=function(f){return f.imul(this.k)};function G(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(G,z),G.prototype.split=function(f,m){for(var S=4194303,A=Math.min(f.length,9),_=0;_<A;_++)m.words[_]=f.words[_];if(m.length=A,f.length<=9){f.words[0]=0,f.length=1;return}var I=f.words[9];for(m.words[m.length++]=I&S,_=10;_<f.length;_++){var C=f.words[_]|0;f.words[_-10]=(C&S)<<4|I>>>22,I=C}I>>>=22,f.words[_-10]=I,I===0&&f.length>10?f.length-=10:f.length-=9},G.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,S=0;S<f.length;S++){var A=f.words[S]|0;m+=A*977,f.words[S]=m&67108863,m=A*64+(m/67108864|0)}return f.words[f.length-1]===0&&(f.length--,f.words[f.length-1]===0&&f.length--),f};function re(){z.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(re,z);function oe(){z.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(oe,z);function ae(){z.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ae,z),ae.prototype.imulK=function(f){for(var m=0,S=0;S<f.length;S++){var A=(f.words[S]|0)*19+m,_=A&67108863;A>>>=26,f.words[S]=_,m=A}return m!==0&&(f.words[f.length++]=m),f},s._prime=function(f){if(W[f])return W[f];var m;if(f==="k256")m=new G;else if(f==="p224")m=new re;else if(f==="p192")m=new oe;else if(f==="p25519")m=new ae;else throw new Error("Unknown prime "+f);return W[f]=m,m};function H(h){if(typeof h=="string"){var f=s._prime(h);this.m=f.p,this.prime=f}else i(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}H.prototype._verify1=function(f){i(f.negative===0,"red works only with positives"),i(f.red,"red works only with red numbers")},H.prototype._verify2=function(f,m){i((f.negative|m.negative)===0,"red works only with positives"),i(f.red&&f.red===m.red,"red works only with red numbers")},H.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},H.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},H.prototype.add=function(f,m){this._verify2(f,m);var S=f.add(m);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},H.prototype.iadd=function(f,m){this._verify2(f,m);var S=f.iadd(m);return S.cmp(this.m)>=0&&S.isub(this.m),S},H.prototype.sub=function(f,m){this._verify2(f,m);var S=f.sub(m);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},H.prototype.isub=function(f,m){this._verify2(f,m);var S=f.isub(m);return S.cmpn(0)<0&&S.iadd(this.m),S},H.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},H.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},H.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},H.prototype.isqr=function(f){return this.imul(f,f.clone())},H.prototype.sqr=function(f){return this.mul(f,f)},H.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var S=this.m.add(new s(1)).iushrn(2);return this.pow(f,S)}for(var A=this.m.subn(1),_=0;!A.isZero()&&A.andln(1)===0;)_++,A.iushrn(1);i(!A.isZero());var I=new s(1).toRed(this),C=I.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var R=this.pow(v,A),J=this.pow(f,A.addn(1).iushrn(1)),Q=this.pow(f,A),ue=_;Q.cmp(I)!==0;){for(var _e=Q,de=0;_e.cmp(I)!==0;de++)_e=_e.redSqr();i(de<ue);var be=this.pow(R,new s(1).iushln(ue-de-1));J=J.redMul(be),R=be.redSqr(),Q=Q.redMul(R),ue=de}return J},H.prototype.invm=function(f){var m=f._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},H.prototype.pow=function(f,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return f.clone();var S=4,A=new Array(1<<S);A[0]=new s(1).toRed(this),A[1]=f;for(var _=2;_<A.length;_++)A[_]=this.mul(A[_-1],f);var I=A[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),_=m.length-1;_>=0;_--){for(var R=m.words[_],J=v-1;J>=0;J--){var Q=R>>J&1;if(I!==A[0]&&(I=this.sqr(I)),Q===0&&C===0){g=0;continue}C<<=1,C|=Q,g++,!(g!==S&&(_!==0||J!==0))&&(I=this.mul(I,A[C]),g=0,C=0)}v=26}return I},H.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},H.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},s.mont=function(f){return new D(f)};function D(h){H.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(D,H),D.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},D.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var S=f.imul(m),A=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=S.isub(A).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},D.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new s(0)._forceRed(this);var S=f.mul(m),A=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=S.isub(A).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},D.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),cs=9e15,Vi=1e9,Xf="0123456789abcdef",kc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Dc="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Jf={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-cs,maxE:cs,crypto:!1},Ug,xi,it=!0,Bc="[DecimalError] ",zi=Bc+"Invalid argument: ",Vg=Bc+"Precision limit exceeded",zg=Bc+"crypto unavailable",Hg="[object Decimal]",Nr=Math.floor,yr=Math.pow,R_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,N_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,j_=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,qg=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,In=1e7,Ke=7,k_=9007199254740991,D_=kc.length-1,Qf=Dc.length-1,ge={toStringTag:Hg};ge.absoluteValue=ge.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),qe(e)},ge.ceil=function(){return qe(new this.constructor(this),this.e+1,2)},ge.clampedTo=ge.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(zi+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},ge.comparedTo=ge.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},ge.cosine=ge.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ke,n.rounding=1,r=B_(n,Xg(n,r)),n.precision=e,n.rounding=t,qe(xi==2||xi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},ge.cubeRoot=ge.cbrt=function(){var e,t,r,n,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(it=!1,o=l.s*yr(l.s*l,1/3),!o||Math.abs(o)==1/0?(r=Ar(l.d),e=l.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=yr(r,1/3),e=Nr((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new d(r),n.s=l.s):n=new d(o.toString()),s=(e=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Gt(u.plus(l).times(a),u.plus(c),s+2,1),Ar(a.d).slice(0,s)===(r=Ar(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(qe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(qe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return it=!0,qe(n,e,d.rounding,t)},ge.decimalPlaces=ge.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Nr(this.e/Ke))*Ke,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ge.dividedBy=ge.div=function(e){return Gt(this,new this.constructor(e))},ge.dividedToIntegerBy=ge.divToInt=function(e){var t=this,r=t.constructor;return qe(Gt(t,new r(e),0,1,1),r.precision,r.rounding)},ge.equals=ge.eq=function(e){return this.cmp(e)===0},ge.floor=function(){return qe(new this.constructor(this),this.e+1,3)},ge.greaterThan=ge.gt=function(e){return this.cmp(e)>0},ge.greaterThanOrEqualTo=ge.gte=function(e){var t=this.cmp(e);return t==1||t===0},ge.hyperbolicCosine=ge.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Uc(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=us(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return qe(o,s.precision=r,s.rounding=n,!0)},ge.hyperbolicSine=ge.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=us(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Uc(5,e)),i=us(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=r,qe(i,t,r,!0)},ge.hyperbolicTangent=ge.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Gt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},ge.inverseCosine=ge.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return n!==-1?n===0?t.isNeg()?On(r,i,o):new r(0):new r(NaN):t.isZero()?On(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=On(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},ge.inverseHyperbolicCosine=ge.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,it=!1,r=r.times(r).minus(1).sqrt().plus(r),it=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},ge.inverseHyperbolicSine=ge.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,it=!1,r=r.times(r).plus(1).sqrt().plus(r),it=!0,n.precision=e,n.rounding=t,r.ln())},ge.inverseHyperbolicTangent=ge.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?qe(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Gt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},ge.inverseSine=ge.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=On(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},ge.inverseTangent=ge.atan=function(){var e,t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=Qf)return s=On(l,d+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=Qf)return s=On(l,d+4,p).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,r=Math.min(28,a/Ke+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(it=!1,t=Math.ceil(a/Ke),n=1,c=u.times(u),s=new l(u),i=u;e!==-1;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),it=!0,qe(s,l.precision=d,l.rounding=p,!0)},ge.isFinite=function(){return!!this.d},ge.isInteger=ge.isInt=function(){return!!this.d&&Nr(this.e/Ke)>this.d.length-2},ge.isNaN=function(){return!this.s},ge.isNegative=ge.isNeg=function(){return this.s<0},ge.isPositive=ge.isPos=function(){return this.s>0},ge.isZero=function(){return!!this.d&&this.d[0]===0},ge.lessThan=ge.lt=function(e){return this.cmp(e)<0},ge.lessThanOrEqualTo=ge.lte=function(e){return this.cmp(e)<1},ge.logarithm=ge.log=function(e){var t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding,b=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(it=!1,a=d+b,s=qi(u,a),n=t?Fc(l,a+10):qi(e,a),c=Gt(s,n,a,1),ma(c.d,i=d,p))do if(a+=10,s=qi(u,a),n=t?Fc(l,a+10):qi(e,a),c=Gt(s,n,a,1),!o){+Ar(c.d).slice(i+1,i+15)+1==1e14&&(c=qe(c,d+1,0));break}while(ma(c.d,i+=10,p));return it=!0,qe(c,d,p)},ge.minus=ge.sub=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,b=this,x=b.constructor;if(e=new x(e),!b.d||!e.d)return!b.s||!e.s?e=new x(NaN):b.d?e.s=-e.s:e=new x(e.d||b.s!==e.s?b:NaN),e;if(b.s!=e.s)return e.s=-e.s,b.plus(e);if(u=b.d,p=e.d,a=x.precision,c=x.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new x(b);else return new x(c===3?-0:0);return it?qe(e,a,c):e}if(r=Nr(e.e/Ke),l=Nr(b.e/Ke),u=u.slice(),o=l-r,o){for(d=o<0,d?(t=u,o=-o,s=p.length):(t=p,r=l,s=u.length),n=Math.max(Math.ceil(a/Ke),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=p.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=p[n]){d=u[n]<p[n];break}o=0}for(d&&(t=u,u=p,p=t,e.s=-e.s),s=u.length,n=p.length-s;n>0;--n)u[s++]=0;for(n=p.length;n>o;){if(u[--n]<p[n]){for(i=n;i&&u[--i]===0;)u[i]=In-1;--u[i],u[n]+=In}u[n]-=p[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=$c(u,r),it?qe(e,a,c):e):new x(c===3?-0:0)},ge.modulo=ge.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?qe(new n(r),n.precision,n.rounding):(it=!1,n.modulo==9?(t=Gt(r,e.abs(),0,3,1),t.s*=e.s):t=Gt(r,e,0,n.modulo,1),t=t.times(e),it=!0,r.minus(t))},ge.naturalExponential=ge.exp=function(){return ed(this)},ge.naturalLogarithm=ge.ln=function(){return qi(this)},ge.negated=ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s,qe(e)},ge.plus=ge.add=function(e){var t,r,n,i,o,s,a,c,u,l,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return!d.s||!e.s?e=new p(NaN):d.d||(e=new p(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(u=d.d,l=e.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(e=new p(d)),it?qe(e,a,c):e;if(o=Nr(d.e/Ke),n=Nr(e.e/Ke),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=l.length):(r=l,n=o,s=u.length),o=Math.ceil(a/Ke),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/In|0,u[i]%=In;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=$c(u,n),it?qe(e,a,c):e},ge.precision=ge.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(zi+e);return r.d?(t=Wg(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ge.round=function(){var e=this,t=e.constructor;return qe(new t(e),e.e+1,t.rounding)},ge.sine=ge.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ke,n.rounding=1,r=$_(n,Xg(n,r)),n.precision=e,n.rounding=t,qe(xi>2?r.neg():r,e,t,!0)):new n(NaN)},ge.squareRoot=ge.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(it=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=Ar(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Nr((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(o=n,n=o.plus(Gt(s,o,r+2,1)).times(.5),Ar(o.d).slice(0,r)===(t=Ar(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(qe(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(qe(n,c+1,1),e=!n.times(n).eq(s));break}return it=!0,qe(n,c,l.rounding,e)},ge.tangent=ge.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Gt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,qe(xi==2||xi==4?r.neg():r,e,t,!0)):new n(NaN)},ge.times=ge.mul=function(e){var t,r,n,i,o,s,a,c,u,l=this,d=l.constructor,p=l.d,b=(e=new d(e)).d;if(e.s*=l.s,!p||!p[0]||!b||!b[0])return new d(!e.s||p&&!p[0]&&!b||b&&!b[0]&&!p?NaN:!p||!b?e.s/0:e.s*0);for(r=Nr(l.e/Ke)+Nr(e.e/Ke),c=p.length,u=b.length,c<u&&(o=p,p=b,b=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=o[i]+b[n]*p[i-n-1]+t,o[i--]=a%In|0,t=a/In|0;o[i]=(o[i]+t)%In|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=$c(o,r),it?qe(e,d.precision,d.rounding):e},ge.toBinary=function(e,t){return rd(this,2,e,t)},ge.toDecimalPlaces=ge.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Hr(e,0,Vi),t===void 0?t=n.rounding:Hr(t,0,8),qe(r,e+r.e+1,t))},ge.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,!0):(Hr(e,0,Vi),t===void 0?t=i.rounding:Hr(t,0,8),n=qe(new i(n),e+1,t),r=Kn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},ge.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=Kn(i):(Hr(e,0,Vi),t===void 0?t=o.rounding:Hr(t,0,8),n=qe(new o(i),e+i.e+1,t),r=Kn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},ge.toFraction=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,b=this,x=b.d,y=b.constructor;if(!x)return new y(b);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=Wg(x)-b.e-1,s=o%Ke,t.d[0]=yr(10,s<0?Ke+s:s),e==null)e=o>0?t:u;else{if(a=new y(e),!a.isInt()||a.lt(u))throw Error(zi+a);e=a.gt(t)?o>0?t:u:a}for(it=!1,a=new y(Ar(x)),l=y.precision,y.precision=o=x.length*Ke*2;d=Gt(a,t,0,1,1),i=r.plus(d.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(d.times(i)),c=i,i=t,t=a.minus(d.times(i)),a=i;return i=Gt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=b.s,p=Gt(u,n,o,1).minus(b).abs().cmp(Gt(c,r,o,1).minus(b).abs())<1?[u,n]:[c,r],y.precision=l,it=!0,p},ge.toHexadecimal=ge.toHex=function(e,t){return rd(this,16,e,t)},ge.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Hr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(it=!1,r=Gt(r,e,0,t,1).times(e),it=!0,qe(r)):(e.s=r.s,r=e),r},ge.toNumber=function(){return+this},ge.toOctal=function(e,t){return rd(this,8,e,t)},ge.toPower=ge.pow=function(e){var t,r,n,i,o,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(yr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return qe(a,n,o);if(t=Nr(e.e/Ke),t>=e.d.length-1&&(r=u<0?-u:u)<=k_)return i=Gg(c,a,r,n),e.s<0?new c(1).div(i):qe(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=yr(+a,u),t=r==0||!isFinite(r)?Nr(u*(Math.log("0."+Ar(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(it=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=ed(e.times(qi(a,n+r)),n),i.d&&(i=qe(i,n+5,1),ma(i.d,n,o)&&(t=n+10,i=qe(ed(e.times(qi(a,t+r)),t),t+5,1),+Ar(i.d).slice(n+1,n+15)+1==1e14&&(i=qe(i,n+1,0)))),i.s=s,it=!0,c.rounding=o,qe(i,n,o))},ge.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Hr(e,1,Vi),t===void 0?t=i.rounding:Hr(t,0,8),n=qe(new i(n),e,t),r=Kn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},ge.toSignificantDigits=ge.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Hr(e,1,Vi),t===void 0?t=n.rounding:Hr(t,0,8)),qe(new n(r),e,t)},ge.toString=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ge.truncated=ge.trunc=function(){return qe(new this.constructor(this),this.e+1,1)},ge.valueOf=ge.toJSON=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function Ar(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=Ke-n.length,r&&(o+=Hi(r)),o+=n;s=e[t],n=s+"",r=Ke-n.length,r&&(o+=Hi(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Hr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(zi+e)}function ma(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Ke,i=0):(i=Math.ceil((t+1)/Ke),t%=Ke),o=yr(10,Ke-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==yr(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==yr(10,t-3)-1,s}function Lc(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=Xf.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function B_(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Uc(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=us(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var Gt=function(){function e(n,i,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,c){var u,l,d,p,b,x,y,T,O,N,k,F,L,W,z,G,re,oe,ae,H,D=n.constructor,h=n.s==i.s?1:-1,f=n.d,m=i.d;if(!f||!f[0]||!m||!m[0])return new D(!n.s||!i.s||(f?m&&f[0]==m[0]:!m)?NaN:f&&f[0]==0||!m?h*0:h/0);for(c?(b=1,l=n.e-i.e):(c=In,b=Ke,l=Nr(n.e/b)-Nr(i.e/b)),ae=m.length,re=f.length,O=new D(h),N=O.d=[],d=0;m[d]==(f[d]||0);d++);if(m[d]>(f[d]||0)&&l--,o==null?(W=o=D.precision,s=D.rounding):a?W=o+(n.e-i.e)+1:W=o,W<0)N.push(1),x=!0;else{if(W=W/b+2|0,d=0,ae==1){for(p=0,m=m[0],W++;(d<re||p)&&W--;d++)z=p*c+(f[d]||0),N[d]=z/m|0,p=z%m|0;x=p||d<re}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,re=f.length),G=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;H=m.slice(),H.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do p=0,u=t(m,k,ae,F),u<0?(L=k[0],ae!=F&&(L=L*c+(k[1]||0)),p=L/oe|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),T=y.length,F=k.length,u=t(y,k,T,F),u==1&&(p--,r(y,ae<T?H:m,T,c))):(p==0&&(u=p=1),y=m.slice()),T=y.length,T<F&&y.unshift(0),r(k,y,F,c),u==-1&&(F=k.length,u=t(m,k,ae,F),u<1&&(p++,r(k,ae<F?H:m,F,c))),F=k.length):u===0&&(p++,k=[0]),N[d++]=p,u&&k[0]?k[F++]=f[G]||0:(k=[f[G]],F=1);while((G++<re||k[0]!==void 0)&&W--);x=k[0]!==void 0}N[0]||N.shift()}if(b==1)O.e=l,Ug=x;else{for(d=1,p=N[0];p>=10;p/=10)d++;O.e=d+l*b-1,qe(O,a?o+O.e+1:o,s,x)}return O}}();function qe(e,t,r,n){var i,o,s,a,c,u,l,d,p,b=e.constructor;e:if(t!=null){if(d=e.d,!d)return e;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=Ke,s=t,l=d[p=0],c=l/yr(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/Ke),a=d.length,p>=a)if(n){for(;a++<=p;)d.push(0);l=c=0,i=1,o%=Ke,s=o-Ke+1}else break e;else{for(l=a=d[p],i=1;a>=10;a/=10)i++;o%=Ke,s=o-Ke+i,c=s<0?0:l/yr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%yr(10,i-s-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(o>0?s>0?l/yr(10,i-s):0:d[p-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,u?(t-=e.e+1,d[0]=yr(10,(Ke-t%Ke)%Ke),e.e=-t||0):d[0]=e.e=0,e;if(o==0?(d.length=p,a=1,p--):(d.length=p+1,a=yr(10,Ke-o),d[p]=s>0?(l/yr(10,i-s)%yr(10,s)|0)*a:0),u)for(;;)if(p==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,d[0]==In&&(d[0]=1));break}else{if(d[p]+=a,d[p]!=In)break;d[p--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return it&&(e.e>b.maxE?(e.d=null,e.e=NaN):e.e<b.minE&&(e.e=0,e.d=[0])),e}function Kn(e,t,r){if(!e.isFinite())return Zg(e);var n,i=e.e,o=Ar(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+Hi(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Hi(-i-1)+o,r&&(n=r-s)>0&&(o+=Hi(n))):i>=s?(o+=Hi(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+Hi(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=Hi(n))),o}function $c(e,t){var r=e[0];for(t*=Ke;r>=10;r/=10)t++;return t}function Fc(e,t,r){if(t>D_)throw it=!0,r&&(e.precision=r),Error(Vg);return qe(new e(kc),t,1,!0)}function On(e,t,r){if(t>Qf)throw Error(Vg);return qe(new e(Dc),t,r,!0)}function Wg(e){var t=e.length-1,r=t*Ke+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Hi(e){for(var t="";e--;)t+="0";return t}function Gg(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/Ke+4);for(it=!1;;){if(r%2&&(o=o.times(t),Jg(o.d,s)&&(i=!0)),r=Nr(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),Jg(t.d,s)}return it=!0,o}function Kg(e){return e.d[e.d.length-1]&1}function Yg(e,t,r){for(var n,i=new e(t[0]),o=0;++o<t.length;)if(n=new e(t[o]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function ed(e,t){var r,n,i,o,s,a,c,u=0,l=0,d=0,p=e.constructor,b=p.rounding,x=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(it=!1,c=x):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),d+=5;for(n=Math.log(yr(2,d))/Math.LN10*2+5|0,c+=n,r=o=s=new p(1),p.precision=c;;){if(o=qe(o.times(e),c,1),r=r.times(++l),a=s.plus(Gt(o,r,c,1)),Ar(a.d).slice(0,c)===Ar(s.d).slice(0,c)){for(i=d;i--;)s=qe(s.times(s),c,1);if(t==null)if(u<3&&ma(s.d,c-n,b,u))p.precision=c+=10,r=o=a=new p(1),l=0,u++;else return qe(s,p.precision=x,b,it=!0);else return p.precision=x,s}s=a}}function qi(e,t){var r,n,i,o,s,a,c,u,l,d,p,b=1,x=10,y=e,T=y.d,O=y.constructor,N=O.rounding,k=O.precision;if(y.s<0||!T||!T[0]||!y.e&&T[0]==1&&T.length==1)return new O(T&&!T[0]?-1/0:y.s!=1?NaN:T?0:y);if(t==null?(it=!1,l=k):l=t,O.precision=l+=x,r=Ar(T),n=r.charAt(0),Math.abs(o=y.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)y=y.times(e),r=Ar(y.d),n=r.charAt(0),b++;o=y.e,n>1?(y=new O("0."+r),o++):y=new O(n+"."+r.slice(1))}else return u=Fc(O,l+2,k).times(o+""),y=qi(new O(n+"."+r.slice(1)),l-x).plus(u),O.precision=k,t==null?qe(y,k,N,it=!0):y;for(d=y,c=s=y=Gt(y.minus(1),y.plus(1),l,1),p=qe(y.times(y),l,1),i=3;;){if(s=qe(s.times(p),l,1),u=c.plus(Gt(s,new O(i),l,1)),Ar(u.d).slice(0,l)===Ar(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Fc(O,l+2,k).times(o+""))),c=Gt(c,new O(b),l,1),t==null)if(ma(c.d,l-x,N,a))O.precision=l+=x,u=s=y=Gt(d.minus(1),d.plus(1),l,1),p=qe(y.times(y),l,1),i=a=1;else return qe(c,O.precision=k,N,it=!0);else return O.precision=k,c;c=u,i+=2}}function Zg(e){return String(e.s*e.s/0)}function td(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ke,r<0&&(n+=Ke),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ke;n<i;)e.d.push(+t.slice(n,n+=Ke));t=t.slice(n),n=Ke-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),it&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function L_(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),qg.test(t))return td(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(N_.test(t))r=16,t=t.toLowerCase();else if(R_.test(t))r=2;else if(j_.test(t))r=8;else throw Error(zi+t);for(o=t.search(/p/i),o>0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=Gg(n,new n(r),o,o*2)),u=Lc(t,r,In),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=$c(u,l),e.d=u,it=!1,s&&(e=Gt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?yr(2,c):ga.pow(2,c))),it=!0,e)}function $_(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:us(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Uc(5,r)),t=us(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function us(e,t,r,n,i){var o,s,a,c,u=e.precision,l=Math.ceil(u/Ke);for(it=!1,c=r.times(r),a=new e(n);;){if(s=Gt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(s):n.minus(s),n=Gt(s.times(c),new e(t++*t++),u,1),s=a.plus(n),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o}return it=!0,s.d.length=l+1,s}function Uc(e,t){for(var r=e;--t;)r*=e;return r}function Xg(e,t){var r,n=t.s<0,i=On(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return xi=n?4:1,t;if(r=t.divToInt(i),r.isZero())xi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return xi=Kg(r)?n?2:3:n?4:1,t;xi=Kg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function rd(e,t,r,n){var i,o,s,a,c,u,l,d,p,b=e.constructor,x=r!==void 0;if(x?(Hr(r,1,Vi),n===void 0?n=b.rounding:Hr(n,0,8)):(r=b.precision,n=b.rounding),!e.isFinite())l=Zg(e);else{for(l=Kn(e),s=l.indexOf("."),x?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(l=l.replace(".",""),p=new b(1),p.e=l.length-s,p.d=Lc(Kn(p),10,i),p.e=p.d.length),d=Lc(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=x?"0p+0":"0";else{if(s<0?o--:(e=new b(e),e.d=d,e.e=o,e=Gt(e,p,r,n,0,i),d=e.d,o=e.e,u=Ug),s=d[r],a=i/2,u=u||d[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[r-1]&1||n===(e.s<0?8:7)),d.length=r,u)for(;++d[--r]>i-1;)d[r]=0,r||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=Xf.charAt(d[s]);if(x){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(d=Lc(l,i,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Xf.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Jg(e,t){if(e.length>t)return e.length=t,!0}function F_(e){return new this(e).abs()}function U_(e){return new this(e).acos()}function V_(e){return new this(e).acosh()}function z_(e,t){return new this(e).plus(t)}function H_(e){return new this(e).asin()}function q_(e){return new this(e).asinh()}function W_(e){return new this(e).atan()}function G_(e){return new this(e).atanh()}function K_(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=On(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?On(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=On(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Gt(e,t,o,1)),t=On(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Gt(e,t,o,1)),r}function Y_(e){return new this(e).cbrt()}function Z_(e){return qe(e=new this(e),e.e+1,2)}function X_(e,t,r){return new this(e).clamp(t,r)}function J_(e){if(!e||typeof e!="object")throw Error(Bc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,Vi,"rounding",0,8,"toExpNeg",-cs,0,"toExpPos",0,cs,"maxE",0,cs,"minE",-cs,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=Jf[r]),(n=e[r])!==void 0)if(Nr(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(zi+r+": "+n);if(r="crypto",i&&(this[r]=Jf[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(zg);else this[r]=!1;else throw Error(zi+r+": "+n);return this}function Q_(e){return new this(e).cos()}function eC(e){return new this(e).cosh()}function Qg(e){var t,r,n;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,e1(o)){u.s=o.s,it?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;it?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}else if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return td(u,o.toString())}else if(c!=="string")throw Error(zi+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),qg.test(o)?td(u,o):L_(u,o)}if(i.prototype=ge,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=J_,i.clone=Qg,i.isDecimal=e1,i.abs=F_,i.acos=U_,i.acosh=V_,i.add=z_,i.asin=H_,i.asinh=q_,i.atan=W_,i.atanh=G_,i.atan2=K_,i.cbrt=Y_,i.ceil=Z_,i.clamp=X_,i.cos=Q_,i.cosh=eC,i.div=tC,i.exp=rC,i.floor=nC,i.hypot=iC,i.ln=oC,i.log=sC,i.log10=cC,i.log2=aC,i.max=uC,i.min=lC,i.mod=fC,i.mul=dC,i.pow=hC,i.random=pC,i.round=mC,i.sign=gC,i.sin=vC,i.sinh=yC,i.sqrt=wC,i.sub=bC,i.sum=xC,i.tan=SC,i.tanh=EC,i.trunc=_C,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function tC(e,t){return new this(e).div(t)}function rC(e){return new this(e).exp()}function nC(e){return qe(e=new this(e),e.e+1,3)}function iC(){var e,t,r=new this(0);for(it=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return it=!0,new this(1/0);r=t}return it=!0,r.sqrt()}function e1(e){return e instanceof ga||e&&e.toStringTag===Hg||!1}function oC(e){return new this(e).ln()}function sC(e,t){return new this(e).log(t)}function aC(e){return new this(e).log(2)}function cC(e){return new this(e).log(10)}function uC(){return Yg(this,arguments,"lt")}function lC(){return Yg(this,arguments,"gt")}function fC(e,t){return new this(e).mod(t)}function dC(e,t){return new this(e).mul(t)}function hC(e,t){return new this(e).pow(t)}function pC(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Hr(e,1,Vi),n=Math.ceil(e/Ke),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(zg);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ke,n&&e&&(i=yr(10,Ke-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ke)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ke&&(r-=Ke-n)}return s.e=r,s.d=a,s}function mC(e){return qe(e=new this(e),e.e+1,this.rounding)}function gC(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function vC(e){return new this(e).sin()}function yC(e){return new this(e).sinh()}function wC(e){return new this(e).sqrt()}function bC(e,t){return new this(e).sub(t)}function xC(){var e=0,t=arguments,r=new this(t[e]);for(it=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return it=!0,qe(r,this.precision,this.rounding)}function SC(e){return new this(e).tan()}function EC(e){return new this(e).tanh()}function _C(e){return qe(e=new this(e),e.e+1,1)}ge[Symbol.for("nodejs.util.inspect.custom")]=ge.toString,ge[Symbol.toStringTag]="Decimal";var ga=ge.constructor=Qg(Jf);kc=new ga(kc),Dc=new ga(Dc);var Vc=ga,Kt=Oo(Po()),nd=Oo(Po()),CC=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet");this.slippage="900000000000000000",this.poolRegistry="0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",this.protocolFeeVault="0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",this.treasury="0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",this.insuranceFund="0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",this.referrealVault="0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278"}amountLimit(e){return new nd.default(e).mul(new nd.default(this.slippage)).div(new nd.default("1000000000000000000")).toString()}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.aftermathLpSupplyType==null)throw new Error("LP supply type not supported");const d=[t.object(r.id),t.object(this.poolRegistry),t.object(this.protocolFeeVault),t.object(this.treasury),t.object(this.insuranceFund),t.object(this.referrealVault),t.pure.u64(this.amountLimit(r.amountOut)),t.pure.u64(this.slippage),n],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::aftermath::${c}`,typeArguments:[u,l,r.extendedDetails.aftermathLpSupplyType],arguments:d})})}},t1="0x000000000000000000000000000000000000000000000000000000000000dee9",AC=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return lt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:t1,module:"custodian_v2"}}});if(i!=null&&i.data!=null){if(i.data.length!==0)return i.data[0].data.objectId;if(i.data.length<50)break}else break}return null})}getOrCreateAccountCap(e,t,r){return lt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${t1}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=yield this.getOrCreateAccountCap(t,e.client,e.signer),p=[t.object(r.id),n,d.accountCap,t.object(qr)],b=Sr(e.publishedAtV2(),i),x=t.moveCall({target:`${b}::deepbook::${c}`,typeArguments:[u,l],arguments:p});return d.isCreate&&t.transferObjects([d.accountCap],e.signer),x})}},MC=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(r.id),n],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_amm::${c}`,typeArguments:[u,l],arguments:d})})}},TC=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(r.id),n,t.object(this.version),t.object(qr)],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},IC=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.container),n],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_amm::${c}`,typeArguments:[u,l],arguments:d})})}},OC=class{constructor(e){if(e!==0)throw new Error("Flowx clmm only supported on mainnet");this.versioned="0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",this.poolRegistry="0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(qr)],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},PC=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.turbosFeeType==null)throw new Error("Turbos fee type not supported");const d=[t.object(r.id),n,t.object(qr),t.object(this.versioned)],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::turbos::${c}`,typeArguments:[u,l,r.extendedDetails.turbosFeeType],arguments:d})})}},r1=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n,i){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["flash_swap_a2b",s,a]:["flash_swap_b2a",a,s];let d=n?r.amountIn:r.amountOut;const p=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(d),t.pure.bool(n),t.object(qr)],b=Sr(e.publishedAtV2(),i),x=t.moveCall({target:`${b}::cetus::${c}`,typeArguments:[u,l],arguments:p});return{targetCoin:x[0],flashReceipt:x[1],payAmount:x[2]}}repay_flash_swap(e,t,r,n,i,o){const{direction:s,from:a,target:c}=r,[u,l,d]=s?["repay_flash_swap_a2b",a,c]:["repay_flash_swap_b2a",c,a],p=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i],b=Sr(e.publishedAtV2(),o);return t.moveCall({target:`${b}::cetus::${u}`,typeArguments:[l,d],arguments:p})[0]}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(qr)],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::cetus::${c}`,typeArguments:[u,l],arguments:d})})}};function n1(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function i1(e){return e.split("::")[0]}function Pn(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const c=Pn(r),u=T_(M_({},c),{type_arguments:i.map(l=>Pn(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Yn.isSuiCoin(l)?l:Pn(l).source_address),u.source_address=n1(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===s1||r===jC?"0x2":Zr(o[0]),module:o[1],name:o[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=n1(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function o1(e){return Pn(e).source_address}var RC="0x2::coin::Coin",NC=/^0x2::coin::Coin<(.+)>$/,s1="0x2::sui::SUI",jC="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Yn=class co{static getCoinTypeArg(t){const r=t.type.match(NC);return r?r[1]:null}static isSUI(t){const r=co.getCoinTypeArg(t);return r?co.getCoinSymbol(r)==="SUI":!1}static getCoinSymbol(t){return t.substring(t.lastIndexOf(":")+1)}static getBalance(t){return BigInt(t.fields.balance)}static totalBalance(t,r){let n=BigInt(0);return t.forEach(i=>{r===i.coinAddress&&(n+=BigInt(i.balance))}),n}static getID(t){return t.fields.id.id}static getCoinTypeFromArg(t){return`${RC}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{o1(i.coinAddress)===o1(t)&&n.push(i)}),n}static isSuiCoin(t){return Pn(t).full_address===s1}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=co.selectCoinAssetGreaterThanOrEqual(t,r,n),o=i.selectedCoins.map(c=>c.coinObjectId),s=i.remainingCoins,a=i.selectedCoins.map(c=>c.balance.toString());return{objectArray:o,remainCoins:s,amountArray:a}}static selectCoinAssetGreaterThanOrEqual(t,r,n=[]){const i=co.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),o=co.calculateTotalBalance(i);if(o<r)return{selectedCoins:[],remainingCoins:i};if(o===r)return{selectedCoins:i,remainingCoins:[]};let s=BigInt(0);const a=[],c=[...i];for(;s<o;){const u=r-s,l=c.findIndex(p=>p.balance>=u);if(l!==-1){a.push(c[l]),c.splice(l,1);break}const d=c.pop();d.balance>0&&(a.push(d),s+=d.balance)}return{selectedCoins:co.sortByBalance(a),remainingCoins:co.sortByBalance(c)}}static sortByBalance(t){return t.sort((r,n)=>r.balance<n.balance?-1:r.balance>n.balance?1:0)}static sortByBalanceDes(t){return t.sort((r,n)=>r.balance>n.balance?-1:r.balance<n.balance?0:1)}static calculateTotalBalance(t){return t.reduce((r,n)=>r+n.balance,BigInt(0))}};function id(e){switch(e){case 1e4:return"Calculate error";case 10001:return"Input number too large can not fit in target type";case 10002:return"No router";case 10003:return"Insufficient Liquidity";case 10004:return"Target token is detected as a HoneyPot scam";case 10005:return"Too many requests. Please try again later";default:return"Unknown error"}}function Wi(e){const t=e.indexOf("::");if(t===-1)return e;const r=e.substring(0,t),n=e.substring(t);if(!r.startsWith("0x"))return e;const i=r.substring(2);return i.length>64?e:`0x${i.padStart(64,"0")}${n}`}function kC(e,t){e=Wi(e),t=Wi(t);const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]>t[n])return!0;if(e[n]<t[n])return!1}return!0}function a1(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function od(e,t,r,n){const i=Yn.getCoinAssets(n,t);if(r===BigInt(0))return Yn.isSuiCoin(n)||i.length===0&&!Yn.isSuiCoin(n)?{targetCoin:a1(e,n),isMintZeroCoin:!0,targetCoinAmount:0}:{targetCoin:e.object(i[0].coinObjectId),isMintZeroCoin:!1,targetCoinAmount:Number(i[0].balance.toString())};if(Yn.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Yn.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let s=Yn.sortByBalance(i);s.slice(0,3).reduce((p,b)=>p+b.balance,BigInt(0))<BigInt(r)&&(s=Yn.sortByBalanceDes(i));let c=Yn.selectCoinObjectIdGreaterThanOrEqual(s,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(p=>e.object(p))),{targetCoin:e.splitCoins(e.object(u),[e.pure.u64(r.toString())]),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function DC(e){return!(!e.startsWith("0x")||e.length!==66)}var ls=Oo(Po()),Gi=Oo(Po()),va=Oo(Po()),Si=new va.default(0);new va.default(1);var BC=new va.default(2);BC.pow(new va.default(128));var LC=new va.default("18446744073709551615"),fn=1e9;function $C(e,t,r){let n=Si;return t?n=e.mul(new Gi.default(fn-r*fn)).div(new Gi.default(fn)):n=e.mul(new Gi.default(fn+r*fn)).div(new Gi.default(fn)),Number(n.toString())}function c1(e,t,r){let n=Si;return t?n=e.mul(new Gi.default(fn-r*fn)).div(new Gi.default(fn)):n=e.mul(new Gi.default(fn+r*fn)).div(new Gi.default(fn)),n}function FC(e,t,r){return new Vc(e).mul(Vc.pow(2,-64)).pow(2).mul(Vc.pow(10,t-r))}function UC(e,t,r,n){return lt(this,null,function*(){var i,o,s,a,c;const{from:u,target:l,amount:d,byAmountIn:p,pools:b}=t,x=Wi(u),y=Wi(l),T=new Eo,O=kC(x,y),N=n===0?"0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4":"0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6",k=O?x:y,F=O?y:x,L=[k,F];for(let C=0;C<b.length;C++){const g=[T.object(b[C]),T.pure.bool(O),T.pure.bool(p),T.pure.u64(d.toString())];T.moveCall({target:`${N}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!DC(r))throw new AggregateError("Aggregator package not set","InvalidWallet");const W=yield e.devInspectTransactionBlock({transactionBlock:T,sender:r});if(W.error!=null)throw console.log("simulateRes.error",W.error),new AggregateError("Aggregator package not set","SimulateError");const z=(i=W.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(z.length===0||z.length!==b.length)throw new AggregateError("Simulate event result error","simulateEventError");let G=p?Si:LC,re=0;for(let C=0;C<z.length;C+=1)if(!z[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new ls.BN(z[C].parsedJson.data.amount_out);g.gt(G)&&(re=C,G=g)}else{const g=new ls.BN(z[C].parsedJson.data.amount_out);g.lt(G)&&(re=C,G=g)}const oe=z[re].parsedJson.data,ae=oe.step_results[0].current_sqrt_price,[H,D]=yield Promise.all([e.getCoinMetadata({coinType:k}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(H==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const h=FC(ae,H,D),f=Number(oe.fee_rate)/1e6,m=new ls.BN((o=oe.amount_in)!=null?o:0),S=new ls.BN((s=oe.fee_amount)!=null?s:0),A=m.add(S),_={amountIn:A,amountOut:new ls.BN((a=oe.amount_out)!=null?a:0),routes:[{path:[{id:b[re],direction:O,provider:"CETUS",from:x,target:y,feeRate:f,amountIn:oe.amount_in,amountOut:oe.amount_out,extendedDetails:{afterSqrtPrice:oe.after_sqrt_price}}],amountIn:A,amountOut:new ls.BN((c=oe.amount_out)!=null?c:0),initialPrice:h}],insufficientLiquidity:!1,byAmountIn:t.byAmountIn};return{isExceed:oe.is_exceed,routeData:_}})}var VC=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o}=r,s=o?"swap_a2b":"swap_b2a",a=[t.object(r.id),t.object("0x5"),n],c=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::haedal::${s}`,typeArguments:[],arguments:a})})}},zC=class{constructor(e){if(e!==0)throw new Error("Afsui only supported on mainnet");this.stakedSuiVault="0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",this.safe="0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",this.referVault="0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",this.validator="0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o}=r;if(!o)throw new Error("Afsui not support b2a swap");const s="swap_a2b",a=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n],c=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::afsui::${s}`,typeArguments:[],arguments:a})})}},HC=class{constructor(e){if(e!==0)throw new Error("Volo only supported on mainnet");this.nativePool="0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf",this.metadata="0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o}=r;if(!o)throw new Error("Volo not support b2a swap");const s="swap_a2b",a=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n],c=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::volo::${s}`,typeArguments:[],arguments:a})})}},qC=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.dexInfo),n],p=Sr(e.publishedAtV2(),i);return t.moveCall({target:`${p}::bluemove::${c}`,typeArguments:[u,l],arguments:d})})}},WC=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i,o){return lt(this,null,function*(){const{direction:s,from:a,target:c}=r,[u,l,d]=s?["swap_a2b",a,c]:["swap_b2a",c,a];let p;o?p=o:p=a1(t,e.deepbookv3DeepFeeType());const b=[t.object(this.deepbookV3Config),t.object(r.id),n,p,t.object(qr)],x=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${x}::deepbookv3::${u}`,typeArguments:[l,d],arguments:b})})}},GC=class{constructor(e){if(e!==0)throw new Error("Scallop only supported on mainnet");this.version=e===0?"0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7":"0x0",this.market=e===0?"0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9":"0x0"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",s,a];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.scallopScoinTreasury==null)throw new Error("Scallop coin treasury not supported");const d=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(qr)],p=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::scallop::${c}`,typeArguments:[u,l],arguments:d})})}},u1=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u]=o?["swap_a2b",a]:["swap_b2a",s],l=[t.object(r.id),t.object(this.sui_system_state),n],d=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::suilend::${c}`,typeArguments:[u],arguments:l})})}},KC=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s],d=[t.object(this.globalConfig),t.object(r.id),n,t.object(qr)],p=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::bluefin::${c}`,typeArguments:[u,l],arguments:d})})}},YC=class{constructor(e,t){if(e===1)throw new Error("HaedalPmm is not supported on testnet");this.pythPriceIDs=t}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];let d,p;if(r.extendedDetails==null)throw new Error("Extended details not supported haedal pmm");if(!r.extendedDetails.haedalPmmBasePriceSeed||!r.extendedDetails.haedalPmmQuotePriceSeed)throw new Error("Base price seed or quote price seed not supported");d=r.extendedDetails.haedalPmmBasePriceSeed,p=r.extendedDetails.haedalPmmQuotePriceSeed;const b=this.pythPriceIDs.get(d),x=this.pythPriceIDs.get(p);if(!b||!x)throw new Error("Base price info object id or quote price info object id not found");const y=[t.object(r.id),t.object(b),t.object(x),n,t.object(qr)],T=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${T}::haedalpmm::${c}`,typeArguments:[u,l],arguments:y})})}},ZC=class{constructor(e){if(e!==0)throw new Error("Alphafi only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u]=o?["swap_a2b",a]:["swap_b2a",s],l=[t.object(r.id),t.object(this.sui_system_state),n],d=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::alphafi::${c}`,typeArguments:[u],arguments:l})})}},XC=class{constructor(e){if(e!==0)throw new Error("Steamm only supported on mainnet")}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.steammBankA==null)throw new Error("Steamm bank a type not supported");if(r.extendedDetails.steammBankB==null)throw new Error("Steamm bank b type not supported");if(r.extendedDetails.steammLendingMarket==null)throw new Error("Steamm lending market not supported");if(r.extendedDetails.steammLendingMarketType==null)throw new Error("Steamm lending market type not supported");if(r.extendedDetails.steammBCoinAType==null)throw new Error("Steamm b coin a type not supported");if(r.extendedDetails.steammBCoinBType==null)throw new Error("Steamm b coin b type not supported");if(r.extendedDetails.steammLPToken==null)throw new Error("Steamm lp token not supported");const d=[t.object(r.id),t.object(r.extendedDetails.steammBankA),t.object(r.extendedDetails.steammBankB),t.object(r.extendedDetails.steammLendingMarket),n,t.object(qr)],p=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::steammfe::${c}`,typeArguments:[r.extendedDetails.steammLendingMarketType,u,l,r.extendedDetails.steammBCoinAType,r.extendedDetails.steammBCoinBType,r.extendedDetails.steammLPToken],arguments:d})})}},JC="0x790f258062909e3a0ffc78b3c53ac2f62d7084c3bab95644bdeb05add7250001::super_sui::SUPER_SUI",QC="0xe44df51c0b21a27ab915fa1fe2ca610cd3eaa6d9666fe5e62b988bf7f0bd8722::musd::MUSD",e5="0xccd628c2334c5ed33e6c47d6c21bb664f8b6307b2ac32c2462a61f69a31ebcee::meth::METH",t5=class{constructor(e,t){if(e!==0)throw new Error("Metastable only supported on mainnet");this.versionID="0x4696559327b35ff2ab26904e7426a1646312e9c836d5c6cff6709a5ccc30915c",this.pythPriceIDs=t}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l,d]=o?["swap_a2b","create_deposit_cap",s,a]:["swap_b2a","create_withdraw_cap",a,s];let p="",b="pyth",x="";if(r.extendedDetails==null)throw new Error("Extended details not supported metastable");if(!r.extendedDetails.metastableCreateCapPkgId||!r.extendedDetails.metastableCreateCapModule||!r.extendedDetails.metastableRegistryId||!r.extendedDetails.metastableWhitelistedAppId)throw new Error("CreateCapPkgId or CreateCapModule or RegistryId or WhitelistedAppId or CreateCapAllTypeParams not supported");p=r.extendedDetails.metastableCreateCapPkgId,b=r.extendedDetails.metastableCreateCapModule,x=r.extendedDetails.metastableWhitelistedAppId;const y=[d];r.extendedDetails.metastableCreateCapAllTypeParams&&y.push(l);const T=[t.object(x),t.object(r.id)];switch(d){case JC:{if(!r.extendedDetails.metastableRegistryId)throw new Error("Not found registry id for super sui");T.push(t.object(r.extendedDetails.metastableRegistryId));break}case QC:{if(r.extendedDetails.metastablePriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastablePriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastablePriceSeed);T.push(t.object(L))}if(r.extendedDetails.metastableETHPriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastableETHPriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastableETHPriceSeed);T.push(t.object(L))}T.push(t.object(qr));break}case e5:{if(r.extendedDetails.metastablePriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastablePriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastablePriceSeed);T.push(t.object(L))}if(r.extendedDetails.metastableETHPriceSeed!=null){const L=this.pythPriceIDs.get(r.extendedDetails.metastableETHPriceSeed);if(L==null)throw new Error("Invalid Pyth price feed: "+r.extendedDetails.metastableETHPriceSeed);T.push(t.object(L))}T.push(t.object(qr));break}default:throw new Error("Invalid Metacoin: "+d)}const O=t.moveCall({target:`${p}::${b}::${u}`,typeArguments:y,arguments:T}),N=[t.object(r.id),t.object(this.versionID),O,n],k=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${k}::metastable::${c}`,typeArguments:[l,d],arguments:N})})}},r5=class{constructor(e,t){if(e===1)throw new Error("Obric is not supported on testnet");this.pythPriceIDs=t,this.pythStateObjectId="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o,from:s,target:a}=r,[c,u,l]=o?["swap_a2b",s,a]:["swap_b2a",a,s];let d,p,b,x;if(r.extendedDetails==null)throw new Error("Extended details not supported in obric");if(r.extendedDetails.obricCoinAPriceSeed&&r.extendedDetails.obricCoinBPriceSeed)d=r.extendedDetails.obricCoinAPriceSeed,b=this.pythPriceIDs.get(d),p=r.extendedDetails.obricCoinBPriceSeed,x=this.pythPriceIDs.get(p);else{if(!r.extendedDetails.obricCoinAPriceId||!r.extendedDetails.obricCoinBPriceId)throw new Error("Base price id or quote price id not supported");b=r.extendedDetails.obricCoinAPriceId,x=r.extendedDetails.obricCoinBPriceId}if(!b||!x)throw new Error("Base price info object id or quote price info object id not found");const y=[t.object(r.id),n,t.object(this.pythStateObjectId),t.object(b),t.object(x),t.object(qr)],T=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${T}::obric::${c}`,typeArguments:[u,l],arguments:y})})}},n5=class{constructor(e){if(e!==0)throw new Error("HaWAL only supported on mainnet");this.staking=e===0?"0x10b9d30c28448939ce6c4d6c6e0ffce4a7f8a4ada8248bdad09ef8b70e4a3904":"0x0",this.validator=e===0?"0x7b3ba6de2ae58283f60d5b8dc04bb9e90e4796b3b2e0dea75569f491275242e7":"0x0"}swap(e,t,r,n,i){return lt(this,null,function*(){const{direction:o}=r,s=o?"swap_a2b":"swap_b2a",a=[t.object(this.staking),t.object(r.id),n,t.object(this.validator)],c=dn(e.publishedAtV2Extend(),i);return t.moveCall({target:`${c}::hawal::${s}`,typeArguments:[],arguments:a})})}},l1="CETUS",i5="DEEPBOOK",o5="KRIYA",s5="FLOWX",a5="FLOWXV3",c5="KRIYAV3",f1="TURBOS",sd="AFTERMATH",u5="HAEDAL",l5="VOLO",f5="AFSUI",d5="BLUEMOVE",d1="DEEPBOOKV3",h1="SCALLOP",h5="SUILEND",p5="BLUEFIN",ad="HAEDALPMM",m5="ALPHAFI",g5="SPRINGSUI",p1="STEAMM",cd="METASTABLE",ud="OBRIC",v5="HAWAL",y5="https://api-sui.cetus.zone/router_v2";function ld(e){return Array.isArray(e.routers)}function fd(e){return Array.isArray(e.routers)}var m1=class t6{constructor(t){var r,n;this.endpoint=t.endpoint?S5(t.endpoint):y5,this.client=t.client||new ts({url:v0("mainnet")}),this.signer=t.signer||"",this.env=t.env||0,this.allCoins=new Map;const i=t6.CONFIG[this.env];if(this.pythConnections=this.newPythClients((r=t.pythUrls)!=null?r:[]),this.pythClient=new Hl.SuiPythClient(this.client,i.pythStateId,i.wormholeStateId),this.apiKey=t.apiKey||"",this.partner=t.partner,t.overlayFeeRate)if(t.overlayFeeRate>0&&t.overlayFeeRate<=.01)this.overlayFeeRate=t.overlayFeeRate*1e6;else throw new Error("Overlay fee rate must be between 0 and 0.01");else this.overlayFeeRate=0;this.overlayFeeReceiver=(n=t.overlayFeeReceiver)!=null?n:"0x0"}newPythClients(t){return t.includes("https://hermes.pyth.network")||t.push("https://hermes.pyth.network"),t.map(n=>new Hl.SuiPriceServiceConnection(n,{timeout:3e3}))}getCoins(t,r=!0){return lt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let n=null,i=50;if(!r){const s=this.allCoins.get(t);if(s)return s}const o=[];for(;;)try{const s=yield this.client.getCoins({owner:this.signer,coinType:t,cursor:n,limit:i});for(const a of s.data)o.push({coinAddress:Pn(a.coinType).source_address,coinObjectId:a.coinObjectId,balance:BigInt(a.balance)});if(!s.hasNextPage)break;n=s.nextCursor}catch(s){console.error("getCoins error:",s);break}return this.allCoins.set(t,o),o})}findRouters(t){return lt(this,null,function*(){return E5(this.endpoint,this.apiKey,t,this.overlayFeeRate,this.overlayFeeReceiver)})}executeFlexibleInputSwap(t,r,n,i,o,s,a,c,u){return lt(this,null,function*(){if(n.length===0)throw new Error("No router found");const l=n[0].path[n[0].path.length-1].target,d=[];for(let y=0;y<n.length-1;y++){if(n[y].path.length===0)throw new Error("Empty path");let O=t.splitCoins(r,[n[y].amountIn.toString()])[0];for(const N of n[y].path)O=yield this.newDex(N.provider,s,a).swap(this,t,N,O,u,c);d.push(O)}if(n[n.length-1].path.length===0)throw new Error("Empty path");let p=r;for(const y of n[n.length-1].path)p=yield this.newDex(y.provider,s,a).swap(this,t,y,p,u,c);d.push(p);const b=dn(this.publishedAtV2Extend(),u);return this.checkCoinThresholdAndMergeCoin(t,d,l,i,o,b)})}expectInputSwap(t,r,n,i,o,s,a,c,u){return lt(this,null,function*(){if(n.length===0)throw new Error("No router found");const l=n.map(N=>N.amountIn.toString()),d=n[0].path[0].from,p=n[0].path[n[0].path.length-1].target,b=t.splitCoins(r,l),x=[];for(let N=0;N<n.length;N++){if(n[N].path.length===0)throw new Error("Empty path");let k=b[N];for(const F of n[N].path)k=yield this.newDex(F.provider,s,a).swap(this,t,F,k,u,c);x.push(k)}const y=Sr(this.publishedAtV2(),u),T=dn(this.publishedAtV2Extend(),u);return this.transferOrDestoryCoin(t,r,d,y),this.checkCoinThresholdAndMergeCoin(t,x,p,i,o,T)})}expectOutputSwap(t,r,n,i,o){return lt(this,null,function*(){const s=[],a=[],c=[],u=new r1(this.env,i),l=Sr(this.publishedAtV2(),o);for(let p=0;p<n.length;p++){const b=n[p];for(let y=b.path.length-1;y>=0;y--){const T=b.path[y],O=u.flash_swap(this,t,T,!1);s.unshift(O.targetCoin),a.unshift(O.flashReceipt)}let x=r;for(let y=0;y<b.path.length;y++){const T=b.path[y],O=u.repay_flash_swap(this,t,T,x,a[y]);x=s[y],y===0?r=O:this.transferOrDestoryCoin(t,O,T.from,l),y===b.path.length-1&&c.push(x)}}const d=n[0].path[0].from;if(this.transferOrDestoryCoin(t,r,d,l),c.length>1){const p=t.makeMoveVec({elements:c.slice(1)});t.moveCall({target:`${ta}::pay::join_vec`,typeArguments:[n[0].path[n[0].path.length-1].target],arguments:[c[0],p]})}return c[0]})}swapInPools(t){return lt(this,null,function*(){let r;try{r=yield UC(this.client,t,this.signer,this.env)}catch(n){return console.error("swapInPools error:",n),null}return r})}routerSwap(t){return lt(this,null,function*(){const{routers:r,inputCoin:n,slippage:i,txb:o,deepbookv3DeepFee:s,partner:a}=t;if(i>1||i<0)throw new Error("Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)");const c=Array.isArray(r)?r:r.routes,u=ld(t)?t.byAmountIn:t.routers.byAmountIn,l=c.reduce((z,G)=>z.add(G.amountIn),new Kt.default(0)),d=c.reduce((z,G)=>z.add(G.amountOut),new Kt.default(0));let p=new Kt.default(0);this.overlayFeeRate>0&&this.overlayFeeReceiver!=="0x0"&&(u?p=d.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)):p=l.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)));const b=u?d.sub(p):d,x=u?l:l.add(p),y=c1(u?b:x,u,i),T=ld(t)?void 0:t.routers.packages,O=Sr(this.publishedAtV2(),T),N=v1(c),k=N.length>0?yield this.updatePythPriceIDs(N,o):new Map;if(u)return yield this.expectInputSwap(o,n,c,d.toString(),y.toString(),k,a??this.partner,s,T);const F=o.splitCoins(n,[p.toString()]);this.overlayFeeRate>0&&this.overlayFeeReceiver!=="0x0"&&o.transferObjects([F],this.overlayFeeReceiver);const L=o.splitCoins(n,[y.sub(p).toString()]);return this.transferOrDestoryCoin(o,n,c[0].path[0].from,O),yield this.expectOutputSwap(o,L[0],c,a??this.partner)})}fixableRouterSwap(t){return lt(this,null,function*(){const{routers:r,inputCoin:n,slippage:i,txb:o,deepbookv3DeepFee:s,partner:a}=t,c=Array.isArray(r)?r:r.routes,u=t.routers.byAmountIn,l=c.reduce((F,L)=>F.add(L.amountIn),new Kt.default(0)),d=c.reduce((F,L)=>F.add(L.amountOut),new Kt.default(0));let p=0;this.overlayFeeRate>0&&this.overlayFeeReceiver!=="0x0"&&(u?p=Number(d.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)).toString()):p=Number(l.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)).toString()));const b=u?d.sub(new Kt.default(p)):d,x=u?l:l.add(new Kt.default(p)),y=c1(u?b:x,u,i),T=ld(t)?void 0:t.routers.packages,O=v1(c),N=O.length>0?yield this.updatePythPriceIDs(O,o):new Map;return u?yield this.executeFlexibleInputSwap(o,n,c,b.toString(),y.toString(),N,a??this.partner,s,T):yield this.expectOutputSwap(o,n,c,a??this.partner)})}fastRouterSwap(t){return lt(this,null,function*(){const{routers:r,slippage:n,txb:i,partner:o,refreshAllCoins:s,payDeepFeeAmount:a}=t,c=Array.isArray(r)?r:r.routes,u=c[0].path[0].from;let l=yield this.getCoins(u,s);const d=c[0].path[c[0].path.length-1].target,p=c.reduce((G,re)=>G.add(re.amountIn),new Kt.default(0)),b=c.reduce((G,re)=>G.add(re.amountOut),new Kt.default(0)),x=fd(t)?t.byAmountIn:t.routers.byAmountIn;let y=0;this.overlayFeeRate>0&&this.overlayFeeReceiver!=="0x0"&&(x?y=Number(b.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)).toString()):y=Number(p.mul(new Kt.default(this.overlayFeeRate)).div(new Kt.default(1e6)).toString()));const T=x?b.sub(new Kt.default(y)):b,O=x?p:p.add(new Kt.default(y)),N=$C(x?T:O,x,n),F=od(i,l,BigInt((x?O:N).toString()),u);let L;if(a&&a>0){let G=yield this.getCoins(this.deepbookv3DeepFeeType());L=od(i,G,BigInt(a),this.deepbookv3DeepFeeType()).targetCoin}const W=fd(t)?{routers:c,inputCoin:F.targetCoin,slippage:n,byAmountIn:x,txb:i,partner:o??this.partner,deepbookv3DeepFee:L}:{routers:t.routers,inputCoin:F.targetCoin,slippage:n,byAmountIn:x,txb:i,partner:o??this.partner,deepbookv3DeepFee:L},z=yield this.routerSwap(W);if(Yn.isSuiCoin(d))i.mergeCoins(i.gas,[z]);else{let G=yield this.getCoins(d,s);const re=od(i,G,BigInt(0),d),oe=fd(t)?void 0:t.routers.packages,ae=Sr(this.publishedAtV2(),oe);i.mergeCoins(re.targetCoin,[z]),re.isMintZeroCoin&&this.transferOrDestoryCoin(i,re.targetCoin,d,ae)}})}publishedAtV2(){return this.env===0?"0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2Extend(){return this.env===0?"0x3b6239bc9bccfdc6b702fd971f5f1999a724d6335f0146d7d5a0ff8dcadcefb8":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(t,r,n,i){t.moveCall({target:`${i}::utils::transfer_or_destroy_coin`,typeArguments:[n],arguments:[r]})}checkCoinThresholdAndMergeCoin(t,r,n,i,o,s){let a=r[0];if(r.length>1){let c=t.makeMoveVec({elements:r.slice(1)});t.moveCall({target:`${ta}::pay::join_vec`,typeArguments:[n],arguments:[r[0],c]}),a=r[0]}return this.overlayFeeRate===0||this.overlayFeeReceiver==="0x0"?t.moveCall({target:`${s}::utils::check_coin_threshold_v1`,typeArguments:[n],arguments:[a,t.pure.u64(i),t.pure.u64(o)]}):t.moveCall({target:`${s}::utils::check_coin_threshold_v2`,typeArguments:[n],arguments:[a,t.pure.u64(i),t.pure.u64(o),t.pure.u64(this.overlayFeeRate),t.pure.address(this.overlayFeeReceiver)]}),a}newDex(t,r,n){switch(t){case l1:return new r1(this.env,n);case i5:return new AC(this.env);case d1:return new WC(this.env);case o5:return new MC(this.env);case c5:return new TC(this.env);case s5:return new IC(this.env);case a5:return new OC(this.env);case f1:return new PC(this.env);case sd:return new CC(this.env);case u5:return new VC(this.env);case f5:return new zC(this.env);case l5:return new HC(this.env);case d5:return new qC(this.env);case h1:return new GC(this.env);case h5:return new u1(this.env);case g5:return new u1(this.env);case p5:return new KC(this.env);case ad:return new YC(this.env,r);case m5:return new ZC(this.env);case p1:return new XC(this.env);case cd:return new t5(this.env,r);case ud:return new r5(this.env,r);case v5:return new n5(this.env);default:throw new Error(`Unsupported dex ${t}`)}}signAndExecuteTransaction(t,r){return lt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(t){return lt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:t,sender:this.signer})})}sendTransaction(t,r){return lt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r})})}getDeepbookV3Config(){return lt(this,null,function*(){const t=yield A5(this.endpoint);return t?t.data:null})}updatePythPriceIDs(t,r){return lt(this,null,function*(){let n=null,i=null;for(const a of this.pythConnections)try{n=yield a.getPriceFeedsUpdateData(t);break}catch(c){i=c,console.log("Error: ",c);continue}if(n==null)throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes. Detailed error: ${i==null?void 0:i.message}`);let o=[];try{o=yield this.pythClient.updatePriceFeeds(r,n,t)}catch(a){throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${a}`)}let s=new Map;for(let a=0;a<t.length;a++)s.set(t[a],o[a]);return s})}};m1.CONFIG={1:{wormholeStateId:"0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",pythStateId:"0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c"},0:{wormholeStateId:"0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",pythStateId:"0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"}};var g1=m1;function v1(e){const t=new Set;for(const r of e)for(const n of r.path)n.provider===ad&&n.extendedDetails&&n.extendedDetails.haedalPmmBasePriceSeed&&n.extendedDetails.haedalPmmQuotePriceSeed&&(t.add(n.extendedDetails.haedalPmmBasePriceSeed),t.add(n.extendedDetails.haedalPmmQuotePriceSeed)),n.provider===cd&&(n.extendedDetails&&n.extendedDetails.metastablePriceSeed&&t.add(n.extendedDetails.metastablePriceSeed),n.extendedDetails&&n.extendedDetails.metastableETHPriceSeed&&t.add(n.extendedDetails.metastableETHPriceSeed)),n.provider===ud&&(n.extendedDetails&&n.extendedDetails.obricCoinAPriceSeed&&t.add(n.extendedDetails.obricCoinAPriceSeed),n.extendedDetails&&n.extendedDetails.obricCoinBPriceSeed&&t.add(n.extendedDetails.obricCoinBPriceSeed));return Array.from(t)}function w5(e,t){let r=0;for(const o of e.routes)for(const s of o.path)s.extended_details&&s.extended_details.deepbookv3_deep_fee&&(r+=Number(s.extended_details.deepbookv3_deep_fee));let n;if(e.packages!=null){n=new Map;for(const[o,s]of Object.entries(e.packages))n.set(o,s)}return{amountIn:new Kt.default(e.amount_in.toString()),amountOut:new Kt.default(e.amount_out.toString()),byAmountIn:t,insufficientLiquidity:!1,routes:e.routes.map(o=>({path:o.path.map(s=>{var a,c,u,l,d,p,b,x,y,T,O,N,k,F,L,W,z,G,re,oe,ae,H,D,h,f;let m;s.provider===sd&&(m=s.extended_details.aftermath_pool_flatness===0?"v2":"v3");let S;return(s.provider===f1||s.provider===sd||s.provider===l1||s.provider===d1||s.provider===h1||s.provider===ad||s.provider===p1||s.provider===cd||s.provider===ud)&&(S={aftermathLpSupplyType:(a=s.extended_details)==null?void 0:a.aftermath_lp_supply_type,turbosFeeType:(c=s.extended_details)==null?void 0:c.turbos_fee_type,afterSqrtPrice:(u=s.extended_details)==null?void 0:u.after_sqrt_price,deepbookv3DeepFee:(l=s.extended_details)==null?void 0:l.deepbookv3_deep_fee,scallopScoinTreasury:(d=s.extended_details)==null?void 0:d.scallop_scoin_treasury,haedalPmmBasePriceSeed:(p=s.extended_details)==null?void 0:p.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(b=s.extended_details)==null?void 0:b.haedal_pmm_quote_price_seed,steammBankA:(x=s.extended_details)==null?void 0:x.steamm_bank_a,steammBankB:(y=s.extended_details)==null?void 0:y.steamm_bank_b,steammLendingMarket:(T=s.extended_details)==null?void 0:T.steamm_lending_market,steammLendingMarketType:(O=s.extended_details)==null?void 0:O.steamm_lending_market_type,steammBCoinAType:(N=s.extended_details)==null?void 0:N.steamm_btoken_a_type,steammBCoinBType:(k=s.extended_details)==null?void 0:k.steamm_btoken_b_type,steammLPToken:(F=s.extended_details)==null?void 0:F.steamm_lp_token_type,metastablePriceSeed:(L=s.extended_details)==null?void 0:L.metastable_price_seed,metastableETHPriceSeed:(W=s.extended_details)==null?void 0:W.metastable_eth_price_seed,metastableWhitelistedAppId:(z=s.extended_details)==null?void 0:z.metastable_whitelisted_app_id,metastableCreateCapPkgId:(G=s.extended_details)==null?void 0:G.metastable_create_cap_pkg_id,metastableCreateCapModule:(re=s.extended_details)==null?void 0:re.metastable_create_cap_module,metastableCreateCapAllTypeParams:(oe=s.extended_details)==null?void 0:oe.metastable_create_cap_all_type_params,metastableRegistryId:(ae=s.extended_details)==null?void 0:ae.metastable_registry_id,obricCoinAPriceSeed:(H=s.extended_details)==null?void 0:H.obric_coin_a_price_seed,obricCoinBPriceSeed:(D=s.extended_details)==null?void 0:D.obric_coin_b_price_seed,obricCoinAPriceId:(h=s.extended_details)==null?void 0:h.obric_coin_a_price_id,obricCoinBPriceId:(f=s.extended_details)==null?void 0:f.obric_coin_b_price_id}),{id:s.id,direction:s.direction,provider:s.provider,from:s.from,target:s.target,feeRate:s.fee_rate,amountIn:s.amount_in,amountOut:s.amount_out,extendedDetails:S,version:m}}),amountIn:new Kt.default(o.amount_in.toString()),amountOut:new Kt.default(o.amount_out.toString()),initialPrice:new Vc(o.initial_price.toString())})),totalDeepFee:r,packages:n}}var qr=Ep,b5="aggregator_v2",x5="aggregator_v2_extend";function Sr(e,t){var r;return t instanceof Map&&(r=t.get(b5))!=null?r:e}function dn(e,t){var r;return t instanceof Map&&(r=t.get(x5))!=null?r:e}Oo(Po());function S5(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}var zc=Oo(Po()),y1=1000500;function E5(e,t,r,n,i){return lt(this,null,function*(){let o;if(r.liquidityChanges&&r.liquidityChanges.length>0?o=yield C5(e,r):o=yield _5(e,t,r),!o)return null;if(!o.ok){let c=10001;return o.status===429&&(c=10005),{amountIn:Si,amountOut:Si,routes:[],byAmountIn:r.byAmountIn,insufficientLiquidity:!1,error:{code:c,msg:id(c)}}}const s=yield o.json(),a=s.msg==="liquidity is not enough";if(s.msg&&s.msg.indexOf("HoneyPot scam")>-1)return{amountIn:Si,amountOut:Si,routes:[],byAmountIn:r.byAmountIn,insufficientLiquidity:a,error:{code:10004,msg:id(10004)}};if(s.data!=null){const c=w5(s.data,r.byAmountIn);if(n>0&&i!=="0x0")if(r.byAmountIn){const u=c.amountOut.mul(new zc.default(n)).div(new zc.default(1e6));c.overlayFee=Number(u.toString()),c.amountOut=c.amountOut.sub(u)}else{const u=c.amountIn.mul(new zc.default(n)).div(new zc.default(1e6));c.overlayFee=Number(u.toString()),c.amountIn=c.amountIn.add(u)}return c}return{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:a,byAmountIn:r.byAmountIn,error:{code:10003,msg:id(10003)}}})}function _5(e,t,r){return lt(this,null,function*(){try{const{from:n,target:i,amount:o,byAmountIn:s,depth:a,splitAlgorithm:c,splitFactor:u,splitCount:l,providers:d}=r,p=Wi(n),b=Wi(i);let x=`${e}/find_routes?from=${p}&target=${b}&amount=${o.toString()}&by_amount_in=${s}`;return a&&(x+=`&depth=${a}`),c&&(x+=`&split_algorithm=${c}`),u&&(x+=`&split_factor=${u}`),l&&(x+=`&split_count=${l}`),d&&d.length>0&&(x+=`&providers=${d.join(",")}`),t.length>0&&(x+=`&apiKey=${t}`),x+=`&v=${y1}`,yield fetch(x)}catch(n){return console.error(n),null}})}function C5(e,t){return lt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:o,depth:s,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:d}=t,p=Wi(r),b=Wi(n),x=`${e}/find_routes`,y=l==null?void 0:l.join(","),T={from:p,target:b,amount:Number(i.toString()),by_amount_in:o,depth:s,split_algorithm:a,split_factor:c,split_count:u,providers:y,liquidity_changes:d.map(O=>({pool:O.poolID,tick_lower:O.ticklower,tick_upper:O.tickUpper,delta_liquidity:O.deltaLiquidity})),v:y1};try{return yield fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}catch(O){return console.error("Error:",O),null}})}function A5(e){return lt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var dd=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(dd||{});const w1="0x2::sui::SUI",M5="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function b1(e){return jr(e).full_address===w1}function x1(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function jr(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const u={...jr(r),type_arguments:i.map(l=>jr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>b1(l)?l:jr(l).source_address),u.source_address=x1(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===w1||r===M5?"0x2":Zr(o[0]),module:o[1],name:o[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=x1(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function T5(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const Ei=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Zr(n);return t&&(i=T5(i)),`${i}::${r.join("::")}`};/*!
35
+ * decimal.js v10.5.0
36
36
  * An arbitrary-precision Decimal type for JavaScript.
37
37
  * https://github.com/MikeMcl/decimal.js
38
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
38
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
39
39
  * MIT Licence
40
- */var ss=9e15,zi=1e9,rd="0123456789abcdef",Lc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$c="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",nd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ss,maxE:ss,crypto:!1},t1,xi,st=!0,Fc="[DecimalError] ",Hi=Fc+"Invalid argument: ",r1=Fc+"Precision limit exceeded",n1=Fc+"crypto unavailable",i1="[object Decimal]",Nr=Math.floor,wr=Math.pow,hC=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,pC=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,mC=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,o1=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mn=1e7,Ye=7,gC=9007199254740991,vC=Lc.length-1,id=$c.length-1,ve={toStringTag:i1};ve.absoluteValue=ve.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),We(e)},ve.ceil=function(){return We(new this.constructor(this),this.e+1,2)},ve.clampedTo=ve.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Hi+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},ve.comparedTo=ve.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},ve.cosine=ve.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ye,n.rounding=1,r=yC(n,f1(n,r)),n.precision=e,n.rounding=t,We(xi==2||xi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},ve.cubeRoot=ve.cbrt=function(){var e,t,r,n,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(st=!1,o=l.s*wr(l.s*l,1/3),!o||Math.abs(o)==1/0?(r=_r(l.d),e=l.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=wr(r,1/3),e=Nr((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new d(r),n.s=l.s):n=new d(o.toString()),s=(e=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Kt(u.plus(l).times(a),u.plus(c),s+2,1),_r(a.d).slice(0,s)===(r=_r(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(We(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(We(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return st=!0,We(n,e,d.rounding,t)},ve.decimalPlaces=ve.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Nr(this.e/Ye))*Ye,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ve.dividedBy=ve.div=function(e){return Kt(this,new this.constructor(e))},ve.dividedToIntegerBy=ve.divToInt=function(e){var t=this,r=t.constructor;return We(Kt(t,new r(e),0,1,1),r.precision,r.rounding)},ve.equals=ve.eq=function(e){return this.cmp(e)===0},ve.floor=function(){return We(new this.constructor(this),this.e+1,3)},ve.greaterThan=ve.gt=function(e){return this.cmp(e)>0},ve.greaterThanOrEqualTo=ve.gte=function(e){var t=this.cmp(e);return t==1||t===0},ve.hyperbolicCosine=ve.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Hc(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=as(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return We(o,s.precision=r,s.rounding=n,!0)},ve.hyperbolicSine=ve.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=as(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Hc(5,e)),i=as(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=r,We(i,t,r,!0)},ve.hyperbolicTangent=ve.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Kt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},ve.inverseCosine=ve.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return n!==-1?n===0?t.isNeg()?An(r,i,o):new r(0):new r(NaN):t.isZero()?An(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=An(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},ve.inverseHyperbolicCosine=ve.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,st=!1,r=r.times(r).minus(1).sqrt().plus(r),st=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},ve.inverseHyperbolicSine=ve.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,st=!1,r=r.times(r).plus(1).sqrt().plus(r),st=!0,n.precision=e,n.rounding=t,r.ln())},ve.inverseHyperbolicTangent=ve.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?We(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Kt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},ve.inverseSine=ve.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=An(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},ve.inverseTangent=ve.atan=function(){var e,t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=id)return s=An(l,d+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=id)return s=An(l,d+4,p).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,r=Math.min(28,a/Ye+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(st=!1,t=Math.ceil(a/Ye),n=1,c=u.times(u),s=new l(u),i=u;e!==-1;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),st=!0,We(s,l.precision=d,l.rounding=p,!0)},ve.isFinite=function(){return!!this.d},ve.isInteger=ve.isInt=function(){return!!this.d&&Nr(this.e/Ye)>this.d.length-2},ve.isNaN=function(){return!this.s},ve.isNegative=ve.isNeg=function(){return this.s<0},ve.isPositive=ve.isPos=function(){return this.s>0},ve.isZero=function(){return!!this.d&&this.d[0]===0},ve.lessThan=ve.lt=function(e){return this.cmp(e)<0},ve.lessThanOrEqualTo=ve.lte=function(e){return this.cmp(e)<1},ve.logarithm=ve.log=function(e){var t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding,w=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(st=!1,a=d+w,s=Wi(u,a),n=t?zc(l,a+10):Wi(e,a),c=Kt(s,n,a,1),ha(c.d,i=d,p))do if(a+=10,s=Wi(u,a),n=t?zc(l,a+10):Wi(e,a),c=Kt(s,n,a,1),!o){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=We(c,d+1,0));break}while(ha(c.d,i+=10,p));return st=!0,We(c,d,p)},ve.minus=ve.sub=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,w=this,b=w.constructor;if(e=new b(e),!w.d||!e.d)return!w.s||!e.s?e=new b(NaN):w.d?e.s=-e.s:e=new b(e.d||w.s!==e.s?w:NaN),e;if(w.s!=e.s)return e.s=-e.s,w.plus(e);if(u=w.d,p=e.d,a=b.precision,c=b.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new b(w);else return new b(c===3?-0:0);return st?We(e,a,c):e}if(r=Nr(e.e/Ye),l=Nr(w.e/Ye),u=u.slice(),o=l-r,o){for(d=o<0,d?(t=u,o=-o,s=p.length):(t=p,r=l,s=u.length),n=Math.max(Math.ceil(a/Ye),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=p.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=p[n]){d=u[n]<p[n];break}o=0}for(d&&(t=u,u=p,p=t,e.s=-e.s),s=u.length,n=p.length-s;n>0;--n)u[s++]=0;for(n=p.length;n>o;){if(u[--n]<p[n]){for(i=n;i&&u[--i]===0;)u[i]=Mn-1;--u[i],u[n]+=Mn}u[n]-=p[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Vc(u,r),st?We(e,a,c):e):new b(c===3?-0:0)},ve.modulo=ve.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?We(new n(r),n.precision,n.rounding):(st=!1,n.modulo==9?(t=Kt(r,e.abs(),0,3,1),t.s*=e.s):t=Kt(r,e,0,n.modulo,1),t=t.times(e),st=!0,r.minus(t))},ve.naturalExponential=ve.exp=function(){return od(this)},ve.naturalLogarithm=ve.ln=function(){return Wi(this)},ve.negated=ve.neg=function(){var e=new this.constructor(this);return e.s=-e.s,We(e)},ve.plus=ve.add=function(e){var t,r,n,i,o,s,a,c,u,l,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return!d.s||!e.s?e=new p(NaN):d.d||(e=new p(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(u=d.d,l=e.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(e=new p(d)),st?We(e,a,c):e;if(o=Nr(d.e/Ye),n=Nr(e.e/Ye),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=l.length):(r=l,n=o,s=u.length),o=Math.ceil(a/Ye),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Mn|0,u[i]%=Mn;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=Vc(u,n),st?We(e,a,c):e},ve.precision=ve.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Hi+e);return r.d?(t=s1(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ve.round=function(){var e=this,t=e.constructor;return We(new t(e),e.e+1,t.rounding)},ve.sine=ve.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ye,n.rounding=1,r=bC(n,f1(n,r)),n.precision=e,n.rounding=t,We(xi>2?r.neg():r,e,t,!0)):new n(NaN)},ve.squareRoot=ve.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(st=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=_r(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Nr((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(o=n,n=o.plus(Kt(s,o,r+2,1)).times(.5),_r(o.d).slice(0,r)===(t=_r(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(We(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(We(n,c+1,1),e=!n.times(n).eq(s));break}return st=!0,We(n,c,l.rounding,e)},ve.tangent=ve.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Kt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,We(xi==2||xi==4?r.neg():r,e,t,!0)):new n(NaN)},ve.times=ve.mul=function(e){var t,r,n,i,o,s,a,c,u,l=this,d=l.constructor,p=l.d,w=(e=new d(e)).d;if(e.s*=l.s,!p||!p[0]||!w||!w[0])return new d(!e.s||p&&!p[0]&&!w||w&&!w[0]&&!p?NaN:!p||!w?e.s/0:e.s*0);for(r=Nr(l.e/Ye)+Nr(e.e/Ye),c=p.length,u=w.length,c<u&&(o=p,p=w,w=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=o[i]+w[n]*p[i-n-1]+t,o[i--]=a%Mn|0,t=a/Mn|0;o[i]=(o[i]+t)%Mn|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=Vc(o,r),st?We(e,d.precision,d.rounding):e},ve.toBinary=function(e,t){return ad(this,2,e,t)},ve.toDecimalPlaces=ve.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(qr(e,0,zi),t===void 0?t=n.rounding:qr(t,0,8),We(r,e+r.e+1,t))},ve.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,!0):(qr(e,0,zi),t===void 0?t=i.rounding:qr(t,0,8),n=We(new i(n),e+1,t),r=Kn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},ve.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=Kn(i):(qr(e,0,zi),t===void 0?t=o.rounding:qr(t,0,8),n=We(new o(i),e+i.e+1,t),r=Kn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},ve.toFraction=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,w=this,b=w.d,y=w.constructor;if(!b)return new y(w);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=s1(b)-w.e-1,s=o%Ye,t.d[0]=wr(10,s<0?Ye+s:s),e==null)e=o>0?t:u;else{if(a=new y(e),!a.isInt()||a.lt(u))throw Error(Hi+a);e=a.gt(t)?o>0?t:u:a}for(st=!1,a=new y(_r(b)),l=y.precision,y.precision=o=b.length*Ye*2;d=Kt(a,t,0,1,1),i=r.plus(d.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(d.times(i)),c=i,i=t,t=a.minus(d.times(i)),a=i;return i=Kt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=w.s,p=Kt(u,n,o,1).minus(w).abs().cmp(Kt(c,r,o,1).minus(w).abs())<1?[u,n]:[c,r],y.precision=l,st=!0,p},ve.toHexadecimal=ve.toHex=function(e,t){return ad(this,16,e,t)},ve.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:qr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(st=!1,r=Kt(r,e,0,t,1).times(e),st=!0,We(r)):(e.s=r.s,r=e),r},ve.toNumber=function(){return+this},ve.toOctal=function(e,t){return ad(this,8,e,t)},ve.toPower=ve.pow=function(e){var t,r,n,i,o,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(wr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return We(a,n,o);if(t=Nr(e.e/Ye),t>=e.d.length-1&&(r=u<0?-u:u)<=gC)return i=a1(c,a,r,n),e.s<0?new c(1).div(i):We(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=wr(+a,u),t=r==0||!isFinite(r)?Nr(u*(Math.log("0."+_r(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(st=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=od(e.times(Wi(a,n+r)),n),i.d&&(i=We(i,n+5,1),ha(i.d,n,o)&&(t=n+10,i=We(od(e.times(Wi(a,t+r)),t),t+5,1),+_r(i.d).slice(n+1,n+15)+1==1e14&&(i=We(i,n+1,0)))),i.s=s,st=!0,c.rounding=o,We(i,n,o))},ve.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(qr(e,1,zi),t===void 0?t=i.rounding:qr(t,0,8),n=We(new i(n),e,t),r=Kn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},ve.toSignificantDigits=ve.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(qr(e,1,zi),t===void 0?t=n.rounding:qr(t,0,8)),We(new n(r),e,t)},ve.toString=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ve.truncated=ve.trunc=function(){return We(new this.constructor(this),this.e+1,1)},ve.valueOf=ve.toJSON=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function _r(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=Ye-n.length,r&&(o+=qi(r)),o+=n;s=e[t],n=s+"",r=Ye-n.length,r&&(o+=qi(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function qr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Hi+e)}function ha(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Ye,i=0):(i=Math.ceil((t+1)/Ye),t%=Ye),o=wr(10,Ye-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==wr(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==wr(10,t-3)-1,s}function Uc(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=rd.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function yC(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Hc(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=as(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var Kt=function(){function e(n,i,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,c){var u,l,d,p,w,b,y,T,O,R,k,F,L,q,H,K,re,oe,ae,z,D=n.constructor,h=n.s==i.s?1:-1,f=n.d,m=i.d;if(!f||!f[0]||!m||!m[0])return new D(!n.s||!i.s||(f?m&&f[0]==m[0]:!m)?NaN:f&&f[0]==0||!m?h*0:h/0);for(c?(w=1,l=n.e-i.e):(c=Mn,w=Ye,l=Nr(n.e/w)-Nr(i.e/w)),ae=m.length,re=f.length,O=new D(h),R=O.d=[],d=0;m[d]==(f[d]||0);d++);if(m[d]>(f[d]||0)&&l--,o==null?(q=o=D.precision,s=D.rounding):a?q=o+(n.e-i.e)+1:q=o,q<0)R.push(1),b=!0;else{if(q=q/w+2|0,d=0,ae==1){for(p=0,m=m[0],q++;(d<re||p)&&q--;d++)H=p*c+(f[d]||0),R[d]=H/m|0,p=H%m|0;b=p||d<re}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,re=f.length),K=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;z=m.slice(),z.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do p=0,u=t(m,k,ae,F),u<0?(L=k[0],ae!=F&&(L=L*c+(k[1]||0)),p=L/oe|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),T=y.length,F=k.length,u=t(y,k,T,F),u==1&&(p--,r(y,ae<T?z:m,T,c))):(p==0&&(u=p=1),y=m.slice()),T=y.length,T<F&&y.unshift(0),r(k,y,F,c),u==-1&&(F=k.length,u=t(m,k,ae,F),u<1&&(p++,r(k,ae<F?z:m,F,c))),F=k.length):u===0&&(p++,k=[0]),R[d++]=p,u&&k[0]?k[F++]=f[K]||0:(k=[f[K]],F=1);while((K++<re||k[0]!==void 0)&&q--);b=k[0]!==void 0}R[0]||R.shift()}if(w==1)O.e=l,t1=b;else{for(d=1,p=R[0];p>=10;p/=10)d++;O.e=d+l*w-1,We(O,a?o+O.e+1:o,s,b)}return O}}();function We(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor;e:if(t!=null){if(d=e.d,!d)return e;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=Ye,s=t,l=d[p=0],c=l/wr(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/Ye),a=d.length,p>=a)if(n){for(;a++<=p;)d.push(0);l=c=0,i=1,o%=Ye,s=o-Ye+1}else break e;else{for(l=a=d[p],i=1;a>=10;a/=10)i++;o%=Ye,s=o-Ye+i,c=s<0?0:l/wr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%wr(10,i-s-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(o>0?s>0?l/wr(10,i-s):0:d[p-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,u?(t-=e.e+1,d[0]=wr(10,(Ye-t%Ye)%Ye),e.e=-t||0):d[0]=e.e=0,e;if(o==0?(d.length=p,a=1,p--):(d.length=p+1,a=wr(10,Ye-o),d[p]=s>0?(l/wr(10,i-s)%wr(10,s)|0)*a:0),u)for(;;)if(p==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,d[0]==Mn&&(d[0]=1));break}else{if(d[p]+=a,d[p]!=Mn)break;d[p--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return st&&(e.e>w.maxE?(e.d=null,e.e=NaN):e.e<w.minE&&(e.e=0,e.d=[0])),e}function Kn(e,t,r){if(!e.isFinite())return l1(e);var n,i=e.e,o=_r(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+qi(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+qi(-i-1)+o,r&&(n=r-s)>0&&(o+=qi(n))):i>=s?(o+=qi(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+qi(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=qi(n))),o}function Vc(e,t){var r=e[0];for(t*=Ye;r>=10;r/=10)t++;return t}function zc(e,t,r){if(t>vC)throw st=!0,r&&(e.precision=r),Error(r1);return We(new e(Lc),t,1,!0)}function An(e,t,r){if(t>id)throw Error(r1);return We(new e($c),t,r,!0)}function s1(e){var t=e.length-1,r=t*Ye+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function qi(e){for(var t="";e--;)t+="0";return t}function a1(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/Ye+4);for(st=!1;;){if(r%2&&(o=o.times(t),d1(o.d,s)&&(i=!0)),r=Nr(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),d1(t.d,s)}return st=!0,o}function c1(e){return e.d[e.d.length-1]&1}function u1(e,t,r){for(var n,i=new e(t[0]),o=0;++o<t.length;)if(n=new e(t[o]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function od(e,t){var r,n,i,o,s,a,c,u=0,l=0,d=0,p=e.constructor,w=p.rounding,b=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(st=!1,c=b):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),d+=5;for(n=Math.log(wr(2,d))/Math.LN10*2+5|0,c+=n,r=o=s=new p(1),p.precision=c;;){if(o=We(o.times(e),c,1),r=r.times(++l),a=s.plus(Kt(o,r,c,1)),_r(a.d).slice(0,c)===_r(s.d).slice(0,c)){for(i=d;i--;)s=We(s.times(s),c,1);if(t==null)if(u<3&&ha(s.d,c-n,w,u))p.precision=c+=10,r=o=a=new p(1),l=0,u++;else return We(s,p.precision=b,w,st=!0);else return p.precision=b,s}s=a}}function Wi(e,t){var r,n,i,o,s,a,c,u,l,d,p,w=1,b=10,y=e,T=y.d,O=y.constructor,R=O.rounding,k=O.precision;if(y.s<0||!T||!T[0]||!y.e&&T[0]==1&&T.length==1)return new O(T&&!T[0]?-1/0:y.s!=1?NaN:T?0:y);if(t==null?(st=!1,l=k):l=t,O.precision=l+=b,r=_r(T),n=r.charAt(0),Math.abs(o=y.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)y=y.times(e),r=_r(y.d),n=r.charAt(0),w++;o=y.e,n>1?(y=new O("0."+r),o++):y=new O(n+"."+r.slice(1))}else return u=zc(O,l+2,k).times(o+""),y=Wi(new O(n+"."+r.slice(1)),l-b).plus(u),O.precision=k,t==null?We(y,k,R,st=!0):y;for(d=y,c=s=y=Kt(y.minus(1),y.plus(1),l,1),p=We(y.times(y),l,1),i=3;;){if(s=We(s.times(p),l,1),u=c.plus(Kt(s,new O(i),l,1)),_r(u.d).slice(0,l)===_r(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(zc(O,l+2,k).times(o+""))),c=Kt(c,new O(w),l,1),t==null)if(ha(c.d,l-b,R,a))O.precision=l+=b,u=s=y=Kt(d.minus(1),d.plus(1),l,1),p=We(y.times(y),l,1),i=a=1;else return We(c,O.precision=k,R,st=!0);else return O.precision=k,c;c=u,i+=2}}function l1(e){return String(e.s*e.s/0)}function sd(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ye,r<0&&(n+=Ye),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ye;n<i;)e.d.push(+t.slice(n,n+=Ye));t=t.slice(n),n=Ye-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),st&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function wC(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),o1.test(t))return sd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(pC.test(t))r=16,t=t.toLowerCase();else if(hC.test(t))r=2;else if(mC.test(t))r=8;else throw Error(Hi+t);for(o=t.search(/p/i),o>0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=a1(n,new n(r),o,o*2)),u=Uc(t,r,Mn),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=Vc(u,l),e.d=u,st=!1,s&&(e=Kt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?wr(2,c):Lr.pow(2,c))),st=!0,e)}function bC(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:as(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Hc(5,r)),t=as(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function as(e,t,r,n,i){var o,s,a,c,u=e.precision,l=Math.ceil(u/Ye);for(st=!1,c=r.times(r),a=new e(n);;){if(s=Kt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(s):n.minus(s),n=Kt(s.times(c),new e(t++*t++),u,1),s=a.plus(n),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o}return st=!0,s.d.length=l+1,s}function Hc(e,t){for(var r=e;--t;)r*=e;return r}function f1(e,t){var r,n=t.s<0,i=An(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return xi=n?4:1,t;if(r=t.divToInt(i),r.isZero())xi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return xi=c1(r)?n?2:3:n?4:1,t;xi=c1(r)?n?1:4:n?3:2}return t.minus(i).abs()}function ad(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor,b=r!==void 0;if(b?(qr(r,1,zi),n===void 0?n=w.rounding:qr(n,0,8)):(r=w.precision,n=w.rounding),!e.isFinite())l=l1(e);else{for(l=Kn(e),s=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(l=l.replace(".",""),p=new w(1),p.e=l.length-s,p.d=Uc(Kn(p),10,i),p.e=p.d.length),d=Uc(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=b?"0p+0":"0";else{if(s<0?o--:(e=new w(e),e.d=d,e.e=o,e=Kt(e,p,r,n,0,i),d=e.d,o=e.e,u=t1),s=d[r],a=i/2,u=u||d[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[r-1]&1||n===(e.s<0?8:7)),d.length=r,u)for(;++d[--r]>i-1;)d[r]=0,r||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=rd.charAt(d[s]);if(b){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(d=Uc(l,i,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=rd.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function d1(e,t){if(e.length>t)return e.length=t,!0}function xC(e){return new this(e).abs()}function SC(e){return new this(e).acos()}function EC(e){return new this(e).acosh()}function _C(e,t){return new this(e).plus(t)}function CC(e){return new this(e).asin()}function MC(e){return new this(e).asinh()}function AC(e){return new this(e).atan()}function TC(e){return new this(e).atanh()}function IC(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=An(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?An(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=An(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Kt(e,t,o,1)),t=An(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Kt(e,t,o,1)),r}function OC(e){return new this(e).cbrt()}function PC(e){return We(e=new this(e),e.e+1,2)}function RC(e,t,r){return new this(e).clamp(t,r)}function NC(e){if(!e||typeof e!="object")throw Error(Fc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,zi,"rounding",0,8,"toExpNeg",-ss,0,"toExpPos",0,ss,"maxE",0,ss,"minE",-ss,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=nd[r]),(n=e[r])!==void 0)if(Nr(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(Hi+r+": "+n);if(r="crypto",i&&(this[r]=nd[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(n1);else this[r]=!1;else throw Error(Hi+r+": "+n);return this}function jC(e){return new this(e).cos()}function kC(e){return new this(e).cosh()}function h1(e){var t,r,n;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,p1(o)){u.s=o.s,st?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;st?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}else if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return sd(u,o.toString())}else if(c!=="string")throw Error(Hi+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),o1.test(o)?sd(u,o):wC(u,o)}if(i.prototype=ve,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=NC,i.clone=h1,i.isDecimal=p1,i.abs=xC,i.acos=SC,i.acosh=EC,i.add=_C,i.asin=CC,i.asinh=MC,i.atan=AC,i.atanh=TC,i.atan2=IC,i.cbrt=OC,i.ceil=PC,i.clamp=RC,i.cos=jC,i.cosh=kC,i.div=DC,i.exp=BC,i.floor=LC,i.hypot=$C,i.ln=FC,i.log=UC,i.log10=zC,i.log2=VC,i.max=HC,i.min=qC,i.mod=WC,i.mul=GC,i.pow=KC,i.random=YC,i.round=ZC,i.sign=XC,i.sin=JC,i.sinh=QC,i.sqrt=e5,i.sub=t5,i.sum=r5,i.tan=n5,i.tanh=i5,i.trunc=o5,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function DC(e,t){return new this(e).div(t)}function BC(e){return new this(e).exp()}function LC(e){return We(e=new this(e),e.e+1,3)}function $C(){var e,t,r=new this(0);for(st=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return st=!0,new this(1/0);r=t}return st=!0,r.sqrt()}function p1(e){return e instanceof Lr||e&&e.toStringTag===i1||!1}function FC(e){return new this(e).ln()}function UC(e,t){return new this(e).log(t)}function VC(e){return new this(e).log(2)}function zC(e){return new this(e).log(10)}function HC(){return u1(this,arguments,"lt")}function qC(){return u1(this,arguments,"gt")}function WC(e,t){return new this(e).mod(t)}function GC(e,t){return new this(e).mul(t)}function KC(e,t){return new this(e).pow(t)}function YC(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:qr(e,1,zi),n=Math.ceil(e/Ye),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(n1);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ye,n&&e&&(i=wr(10,Ye-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ye)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ye&&(r-=Ye-n)}return s.e=r,s.d=a,s}function ZC(e){return We(e=new this(e),e.e+1,this.rounding)}function XC(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function JC(e){return new this(e).sin()}function QC(e){return new this(e).sinh()}function e5(e){return new this(e).sqrt()}function t5(e,t){return new this(e).sub(t)}function r5(){var e=0,t=arguments,r=new this(t[e]);for(st=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return st=!0,We(r,this.precision,this.rounding)}function n5(e){return new this(e).tan()}function i5(e){return new this(e).tanh()}function o5(e){return We(e=new this(e),e.e+1,1)}ve[Symbol.for("nodejs.util.inspect.custom")]=ve.toString,ve[Symbol.toStringTag]="Decimal";var Lr=ve.constructor=h1(nd);Lc=new Lr(Lc),$c=new Lr($c),Lr.config({precision:256,rounding:Lr.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const jr=(e,t,r,n=Lr.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||De(e).equals(0))return"0";if(t!==void 0){const u=So(e,t,n);if(!De(u).equals(0))return r?u:cs(u)}const i=De(e).toString(),o=i.split("."),s=o[0],a=o[1];let c;if(De(s).gt(0))!a||De(s.length).gte(9)?c=So(i,0,n):De(s.length).gte(4)?c=So(i,2,n):c=So(i,4,n);else{So(i,6,n);const u=c5(a);if(u<6)c=So(i,u+6,n);else{if(u>30)return"0";c=So(i,9+(u-6),n)}}return r||De(s).lt(1)?c:cs(c)},m1=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=jr(e,t,!0,Lr.ROUND_DOWN).toString();if(De(i).equals(0))return"$0";const o=i.startsWith("-");let s=n?i:cs(i).toString();return s.includes("e")&&(s=n?i:cs(i).toString()),!r&&Number(i)<Math.pow(10,-t)?o?`-$${s.slice(1)}`:`<$${Math.pow(10,-t).toFixed(t)}`:o?`-$${s.slice(1)}`:`$${s}`}catch{return"$--"}},s5=(e,t,r=!0)=>{if(`${e}`=="0")return!parseFloat(t)||!r?"0":"0.".padEnd(t+2,"0");if(!e)return"--";const n=parseFloat(e),i=e.toString(),o=n<0;let s=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],d=a[4];let p="",w=u?u.substr(d):"";if(w&&(w=`.${w}`),l!=="-"){for(let b=0;b<d;b+=1){const y=u[b]||"0";p+=y}s=c+p+w}else{let b="0";for(let y=0;y<d;y+=1)p=(c[c.length-y-1]||"0")+p;c.length>d&&(b=c.substr(0,c.length-d)),s=`${b}.${p}${u}`}}if(t&&r){let a=`${s.split(".")[0]}.`;const c=s.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";s=a}if(s.length>14){const a=s.split(".");a[0].length>14?s=`${a[0].slice(0,14)}+`:(s=s.slice(0,13),s.indexOf(".")===12&&(s=s.slice(0,12)))}return`${o?"-":""}${s}`},De=e=>Lr.isDecimal(e)?e:new Lr(typeof e>"u"||e==="undefined"||!e?0:e);function a5(e,t){return t===void 0?"":De(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const So=(e,t,r)=>De(e).toDP(t,r).toString(),cs=e=>{const[t,r]=e.split(".");let n="";for(let i=t.length-1,o=0;i>=0;i--,o++)n=t[i]+n,o%3===2&&i!==0&&(n=","+n);return r?`${n}.${r}`:n};function c5(e){let t=0;if(e)for(;t<e.length;){if(De(e[t]).gt(0))return t+1;t++}return 0}function u5(e,t){const r=g1(De(t));return Number(De(e).mul(r))}function l5(e,t){const r=g1(De(t));return Number(De(e).div(r))}function g1(e){return De(10).pow(De(e).abs())}function cd(e,t){const r=l5(e,t);return f5(r.toString(),Number(t))}function f5(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return s5(r,t);const[n,i]=r.split("e");let o=n;const s=Math.abs(parseInt(i,10));let a="",c=o.length;if(n.includes(".")){const[u,l]=n.split(".");o=u+l,c=u.length}for(let u=0;u<s-c;u++)a+="0";return`0.${a}${o}`.slice(0,t+2)}return e}function qc(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Eo=(e,t="")=>t=="long"?e&&e.length>40?e.substring(0,40)+"...":e&&e.length<40?e:"":e?e.substring(0,6)+"..."+e.substring(e.length-4):"",ud=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r)if(!ud(e[i],t[i]))return!1;return!0};function v1(e){return!e||Object.keys(e).length===0}function y1(e){var t;return((t=e.split("::"))==null?void 0:t.length)===3}const w1=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function d5(e,t,r=!1){var a;const n=e.balanceChanges,i=(a=e.effects)==null?void 0:a.gasUsed,o={};let s="0";return i&&(s=De(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=Cn(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Ja;let d=c.amount;l&&(d=r?d:De(d).sub(s).toFixed(0));const p={coinType:u,amount:d};o[u]=p}}),o}function b1(e,t){if(t){const r=e[Cn(t.coin_type).full_address];if(r)return cd(De(r.amount).abs().toFixed(0),t.decimals)}}function Tt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const cn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&De(t).gt(0)?`${e.slice(0,t)}...`:e,Wc=(e,t)=>bi(e||"")===bi(t||""),h5=async function(e,t,r=3e4){const n=[];let i="";if(t){for(const c in t){const u=`${c}=${t[c]}`;n.push(u)}const a=n.join("&");i=`${e}?${a}`}else i=e;const o=new AbortController,s=setTimeout(()=>{o.abort()},r);try{const a=await fetch(i,{signal:o.signal});if(clearTimeout(s),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(s),a.name==="AbortError"?new Error("request time out"):a}},p5=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const o=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!o.ok)throw new Error("Request failed");return o.json()}catch(o){throw clearTimeout(i),o.name==="AbortError"?new Error("request time out"):o}},ld="tokenMap",x1="trustedTokenList",S1="collectTokenMap",E1="importTokenList";function Gc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _1={exports:{}};/*!
40
+ */var fs=9e15,Ki=1e9,hd="0123456789abcdef",Hc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",qc="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",pd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-fs,maxE:fs,crypto:!1},S1,_i,ot=!0,Wc="[DecimalError] ",Yi=Wc+"Invalid argument: ",E1=Wc+"Precision limit exceeded",_1=Wc+"crypto unavailable",C1="[object Decimal]",kr=Math.floor,wr=Math.pow,I5=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,O5=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,P5=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,A1=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Rn=1e7,Ye=7,R5=9007199254740991,N5=Hc.length-1,md=qc.length-1,ve={toStringTag:C1};ve.absoluteValue=ve.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),We(e)},ve.ceil=function(){return We(new this.constructor(this),this.e+1,2)},ve.clampedTo=ve.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Yi+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},ve.comparedTo=ve.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},ve.cosine=ve.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ye,n.rounding=1,r=j5(n,R1(n,r)),n.precision=e,n.rounding=t,We(_i==2||_i==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},ve.cubeRoot=ve.cbrt=function(){var e,t,r,n,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(ot=!1,o=l.s*wr(l.s*l,1/3),!o||Math.abs(o)==1/0?(r=Mr(l.d),e=l.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=wr(r,1/3),e=kr((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new d(r),n.s=l.s):n=new d(o.toString()),s=(e=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Yt(u.plus(l).times(a),u.plus(c),s+2,1),Mr(a.d).slice(0,s)===(r=Mr(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(We(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(We(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ot=!0,We(n,e,d.rounding,t)},ve.decimalPlaces=ve.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-kr(this.e/Ye))*Ye,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ve.dividedBy=ve.div=function(e){return Yt(this,new this.constructor(e))},ve.dividedToIntegerBy=ve.divToInt=function(e){var t=this,r=t.constructor;return We(Yt(t,new r(e),0,1,1),r.precision,r.rounding)},ve.equals=ve.eq=function(e){return this.cmp(e)===0},ve.floor=function(){return We(new this.constructor(this),this.e+1,3)},ve.greaterThan=ve.gt=function(e){return this.cmp(e)>0},ve.greaterThanOrEqualTo=ve.gte=function(e){var t=this.cmp(e);return t==1||t===0},ve.hyperbolicCosine=ve.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Xc(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=ds(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return We(o,s.precision=r,s.rounding=n,!0)},ve.hyperbolicSine=ve.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=ds(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Xc(5,e)),i=ds(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=r,We(i,t,r,!0)},ve.hyperbolicTangent=ve.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Yt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},ve.inverseCosine=ve.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?Xn(t,n,i):new t(0):new t(NaN):e.isZero()?Xn(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},ve.inverseHyperbolicCosine=ve.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ot=!1,r=r.times(r).minus(1).sqrt().plus(r),ot=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},ve.inverseHyperbolicSine=ve.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ot=!1,r=r.times(r).plus(1).sqrt().plus(r),ot=!0,n.precision=e,n.rounding=t,r.ln())},ve.inverseHyperbolicTangent=ve.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?We(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Yt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},ve.inverseSine=ve.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=Xn(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},ve.inverseTangent=ve.atan=function(){var e,t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=md)return s=Xn(l,d+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=md)return s=Xn(l,d+4,p).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,r=Math.min(28,a/Ye+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ot=!1,t=Math.ceil(a/Ye),n=1,c=u.times(u),s=new l(u),i=u;e!==-1;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),ot=!0,We(s,l.precision=d,l.rounding=p,!0)},ve.isFinite=function(){return!!this.d},ve.isInteger=ve.isInt=function(){return!!this.d&&kr(this.e/Ye)>this.d.length-2},ve.isNaN=function(){return!this.s},ve.isNegative=ve.isNeg=function(){return this.s<0},ve.isPositive=ve.isPos=function(){return this.s>0},ve.isZero=function(){return!!this.d&&this.d[0]===0},ve.lessThan=ve.lt=function(e){return this.cmp(e)<0},ve.lessThanOrEqualTo=ve.lte=function(e){return this.cmp(e)<1},ve.logarithm=ve.log=function(e){var t,r,n,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,p=l.rounding,b=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(ot=!1,a=d+b,s=Xi(u,a),n=t?Yc(l,a+10):Xi(e,a),c=Yt(s,n,a,1),ya(c.d,i=d,p))do if(a+=10,s=Xi(u,a),n=t?Yc(l,a+10):Xi(e,a),c=Yt(s,n,a,1),!o){+Mr(c.d).slice(i+1,i+15)+1==1e14&&(c=We(c,d+1,0));break}while(ya(c.d,i+=10,p));return ot=!0,We(c,d,p)},ve.minus=ve.sub=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,b=this,x=b.constructor;if(e=new x(e),!b.d||!e.d)return!b.s||!e.s?e=new x(NaN):b.d?e.s=-e.s:e=new x(e.d||b.s!==e.s?b:NaN),e;if(b.s!=e.s)return e.s=-e.s,b.plus(e);if(u=b.d,p=e.d,a=x.precision,c=x.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new x(b);else return new x(c===3?-0:0);return ot?We(e,a,c):e}if(r=kr(e.e/Ye),l=kr(b.e/Ye),u=u.slice(),o=l-r,o){for(d=o<0,d?(t=u,o=-o,s=p.length):(t=p,r=l,s=u.length),n=Math.max(Math.ceil(a/Ye),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=p.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=p[n]){d=u[n]<p[n];break}o=0}for(d&&(t=u,u=p,p=t,e.s=-e.s),s=u.length,n=p.length-s;n>0;--n)u[s++]=0;for(n=p.length;n>o;){if(u[--n]<p[n]){for(i=n;i&&u[--i]===0;)u[i]=Rn-1;--u[i],u[n]+=Rn}u[n]-=p[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Kc(u,r),ot?We(e,a,c):e):new x(c===3?-0:0)},ve.modulo=ve.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?We(new n(r),n.precision,n.rounding):(ot=!1,n.modulo==9?(t=Yt(r,e.abs(),0,3,1),t.s*=e.s):t=Yt(r,e,0,n.modulo,1),t=t.times(e),ot=!0,r.minus(t))},ve.naturalExponential=ve.exp=function(){return gd(this)},ve.naturalLogarithm=ve.ln=function(){return Xi(this)},ve.negated=ve.neg=function(){var e=new this.constructor(this);return e.s=-e.s,We(e)},ve.plus=ve.add=function(e){var t,r,n,i,o,s,a,c,u,l,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return!d.s||!e.s?e=new p(NaN):d.d||(e=new p(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(u=d.d,l=e.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(e=new p(d)),ot?We(e,a,c):e;if(o=kr(d.e/Ye),n=kr(e.e/Ye),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=l.length):(r=l,n=o,s=u.length),o=Math.ceil(a/Ye),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Rn|0,u[i]%=Rn;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=Kc(u,n),ot?We(e,a,c):e},ve.precision=ve.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Yi+e);return r.d?(t=M1(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ve.round=function(){var e=this,t=e.constructor;return We(new t(e),e.e+1,t.rounding)},ve.sine=ve.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ye,n.rounding=1,r=D5(n,R1(n,r)),n.precision=e,n.rounding=t,We(_i>2?r.neg():r,e,t,!0)):new n(NaN)},ve.squareRoot=ve.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(ot=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=Mr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=kr((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(o=n,n=o.plus(Yt(s,o,r+2,1)).times(.5),Mr(o.d).slice(0,r)===(t=Mr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(We(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(We(n,c+1,1),e=!n.times(n).eq(s));break}return ot=!0,We(n,c,l.rounding,e)},ve.tangent=ve.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Yt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,We(_i==2||_i==4?r.neg():r,e,t,!0)):new n(NaN)},ve.times=ve.mul=function(e){var t,r,n,i,o,s,a,c,u,l=this,d=l.constructor,p=l.d,b=(e=new d(e)).d;if(e.s*=l.s,!p||!p[0]||!b||!b[0])return new d(!e.s||p&&!p[0]&&!b||b&&!b[0]&&!p?NaN:!p||!b?e.s/0:e.s*0);for(r=kr(l.e/Ye)+kr(e.e/Ye),c=p.length,u=b.length,c<u&&(o=p,p=b,b=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=o[i]+b[n]*p[i-n-1]+t,o[i--]=a%Rn|0,t=a/Rn|0;o[i]=(o[i]+t)%Rn|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=Kc(o,r),ot?We(e,d.precision,d.rounding):e},ve.toBinary=function(e,t){return vd(this,2,e,t)},ve.toDecimalPlaces=ve.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Wr(e,0,Ki),t===void 0?t=n.rounding:Wr(t,0,8),We(r,e+r.e+1,t))},ve.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Zn(n,!0):(Wr(e,0,Ki),t===void 0?t=i.rounding:Wr(t,0,8),n=We(new i(n),e+1,t),r=Zn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},ve.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=Zn(i):(Wr(e,0,Ki),t===void 0?t=o.rounding:Wr(t,0,8),n=We(new o(i),e+i.e+1,t),r=Zn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},ve.toFraction=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,b=this,x=b.d,y=b.constructor;if(!x)return new y(b);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=M1(x)-b.e-1,s=o%Ye,t.d[0]=wr(10,s<0?Ye+s:s),e==null)e=o>0?t:u;else{if(a=new y(e),!a.isInt()||a.lt(u))throw Error(Yi+a);e=a.gt(t)?o>0?t:u:a}for(ot=!1,a=new y(Mr(x)),l=y.precision,y.precision=o=x.length*Ye*2;d=Yt(a,t,0,1,1),i=r.plus(d.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(d.times(i)),c=i,i=t,t=a.minus(d.times(i)),a=i;return i=Yt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=b.s,p=Yt(u,n,o,1).minus(b).abs().cmp(Yt(c,r,o,1).minus(b).abs())<1?[u,n]:[c,r],y.precision=l,ot=!0,p},ve.toHexadecimal=ve.toHex=function(e,t){return vd(this,16,e,t)},ve.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Wr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(ot=!1,r=Yt(r,e,0,t,1).times(e),ot=!0,We(r)):(e.s=r.s,r=e),r},ve.toNumber=function(){return+this},ve.toOctal=function(e,t){return vd(this,8,e,t)},ve.toPower=ve.pow=function(e){var t,r,n,i,o,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(wr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return We(a,n,o);if(t=kr(e.e/Ye),t>=e.d.length-1&&(r=u<0?-u:u)<=R5)return i=T1(c,a,r,n),e.s<0?new c(1).div(i):We(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=wr(+a,u),t=r==0||!isFinite(r)?kr(u*(Math.log("0."+Mr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(ot=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=gd(e.times(Xi(a,n+r)),n),i.d&&(i=We(i,n+5,1),ya(i.d,n,o)&&(t=n+10,i=We(gd(e.times(Xi(a,t+r)),t),t+5,1),+Mr(i.d).slice(n+1,n+15)+1==1e14&&(i=We(i,n+1,0)))),i.s=s,ot=!0,c.rounding=o,We(i,n,o))},ve.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Zn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Wr(e,1,Ki),t===void 0?t=i.rounding:Wr(t,0,8),n=We(new i(n),e,t),r=Zn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},ve.toSignificantDigits=ve.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Wr(e,1,Ki),t===void 0?t=n.rounding:Wr(t,0,8)),We(new n(r),e,t)},ve.toString=function(){var e=this,t=e.constructor,r=Zn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ve.truncated=ve.trunc=function(){return We(new this.constructor(this),this.e+1,1)},ve.valueOf=ve.toJSON=function(){var e=this,t=e.constructor,r=Zn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function Mr(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=Ye-n.length,r&&(o+=Zi(r)),o+=n;s=e[t],n=s+"",r=Ye-n.length,r&&(o+=Zi(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Wr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Yi+e)}function ya(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Ye,i=0):(i=Math.ceil((t+1)/Ye),t%=Ye),o=wr(10,Ye-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==wr(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==wr(10,t-3)-1,s}function Gc(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=hd.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function j5(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Xc(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=ds(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var Yt=function(){function e(n,i,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,c){var u,l,d,p,b,x,y,T,O,N,k,F,L,W,z,G,re,oe,ae,H,D=n.constructor,h=n.s==i.s?1:-1,f=n.d,m=i.d;if(!f||!f[0]||!m||!m[0])return new D(!n.s||!i.s||(f?m&&f[0]==m[0]:!m)?NaN:f&&f[0]==0||!m?h*0:h/0);for(c?(b=1,l=n.e-i.e):(c=Rn,b=Ye,l=kr(n.e/b)-kr(i.e/b)),ae=m.length,re=f.length,O=new D(h),N=O.d=[],d=0;m[d]==(f[d]||0);d++);if(m[d]>(f[d]||0)&&l--,o==null?(W=o=D.precision,s=D.rounding):a?W=o+(n.e-i.e)+1:W=o,W<0)N.push(1),x=!0;else{if(W=W/b+2|0,d=0,ae==1){for(p=0,m=m[0],W++;(d<re||p)&&W--;d++)z=p*c+(f[d]||0),N[d]=z/m|0,p=z%m|0;x=p||d<re}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,re=f.length),G=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;H=m.slice(),H.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do p=0,u=t(m,k,ae,F),u<0?(L=k[0],ae!=F&&(L=L*c+(k[1]||0)),p=L/oe|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),T=y.length,F=k.length,u=t(y,k,T,F),u==1&&(p--,r(y,ae<T?H:m,T,c))):(p==0&&(u=p=1),y=m.slice()),T=y.length,T<F&&y.unshift(0),r(k,y,F,c),u==-1&&(F=k.length,u=t(m,k,ae,F),u<1&&(p++,r(k,ae<F?H:m,F,c))),F=k.length):u===0&&(p++,k=[0]),N[d++]=p,u&&k[0]?k[F++]=f[G]||0:(k=[f[G]],F=1);while((G++<re||k[0]!==void 0)&&W--);x=k[0]!==void 0}N[0]||N.shift()}if(b==1)O.e=l,S1=x;else{for(d=1,p=N[0];p>=10;p/=10)d++;O.e=d+l*b-1,We(O,a?o+O.e+1:o,s,x)}return O}}();function We(e,t,r,n){var i,o,s,a,c,u,l,d,p,b=e.constructor;e:if(t!=null){if(d=e.d,!d)return e;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=Ye,s=t,l=d[p=0],c=l/wr(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/Ye),a=d.length,p>=a)if(n){for(;a++<=p;)d.push(0);l=c=0,i=1,o%=Ye,s=o-Ye+1}else break e;else{for(l=a=d[p],i=1;a>=10;a/=10)i++;o%=Ye,s=o-Ye+i,c=s<0?0:l/wr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%wr(10,i-s-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(o>0?s>0?l/wr(10,i-s):0:d[p-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,u?(t-=e.e+1,d[0]=wr(10,(Ye-t%Ye)%Ye),e.e=-t||0):d[0]=e.e=0,e;if(o==0?(d.length=p,a=1,p--):(d.length=p+1,a=wr(10,Ye-o),d[p]=s>0?(l/wr(10,i-s)%wr(10,s)|0)*a:0),u)for(;;)if(p==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,d[0]==Rn&&(d[0]=1));break}else{if(d[p]+=a,d[p]!=Rn)break;d[p--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return ot&&(e.e>b.maxE?(e.d=null,e.e=NaN):e.e<b.minE&&(e.e=0,e.d=[0])),e}function Zn(e,t,r){if(!e.isFinite())return P1(e);var n,i=e.e,o=Mr(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+Zi(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Zi(-i-1)+o,r&&(n=r-s)>0&&(o+=Zi(n))):i>=s?(o+=Zi(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+Zi(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=Zi(n))),o}function Kc(e,t){var r=e[0];for(t*=Ye;r>=10;r/=10)t++;return t}function Yc(e,t,r){if(t>N5)throw ot=!0,r&&(e.precision=r),Error(E1);return We(new e(Hc),t,1,!0)}function Xn(e,t,r){if(t>md)throw Error(E1);return We(new e(qc),t,r,!0)}function M1(e){var t=e.length-1,r=t*Ye+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Zi(e){for(var t="";e--;)t+="0";return t}function T1(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/Ye+4);for(ot=!1;;){if(r%2&&(o=o.times(t),N1(o.d,s)&&(i=!0)),r=kr(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),N1(t.d,s)}return ot=!0,o}function I1(e){return e.d[e.d.length-1]&1}function O1(e,t,r){for(var n,i,o=new e(t[0]),s=0;++s<t.length;){if(i=new e(t[s]),!i.s){o=i;break}n=o.cmp(i),(n===r||n===0&&o.s===r)&&(o=i)}return o}function gd(e,t){var r,n,i,o,s,a,c,u=0,l=0,d=0,p=e.constructor,b=p.rounding,x=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ot=!1,c=x):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),d+=5;for(n=Math.log(wr(2,d))/Math.LN10*2+5|0,c+=n,r=o=s=new p(1),p.precision=c;;){if(o=We(o.times(e),c,1),r=r.times(++l),a=s.plus(Yt(o,r,c,1)),Mr(a.d).slice(0,c)===Mr(s.d).slice(0,c)){for(i=d;i--;)s=We(s.times(s),c,1);if(t==null)if(u<3&&ya(s.d,c-n,b,u))p.precision=c+=10,r=o=a=new p(1),l=0,u++;else return We(s,p.precision=x,b,ot=!0);else return p.precision=x,s}s=a}}function Xi(e,t){var r,n,i,o,s,a,c,u,l,d,p,b=1,x=10,y=e,T=y.d,O=y.constructor,N=O.rounding,k=O.precision;if(y.s<0||!T||!T[0]||!y.e&&T[0]==1&&T.length==1)return new O(T&&!T[0]?-1/0:y.s!=1?NaN:T?0:y);if(t==null?(ot=!1,l=k):l=t,O.precision=l+=x,r=Mr(T),n=r.charAt(0),Math.abs(o=y.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)y=y.times(e),r=Mr(y.d),n=r.charAt(0),b++;o=y.e,n>1?(y=new O("0."+r),o++):y=new O(n+"."+r.slice(1))}else return u=Yc(O,l+2,k).times(o+""),y=Xi(new O(n+"."+r.slice(1)),l-x).plus(u),O.precision=k,t==null?We(y,k,N,ot=!0):y;for(d=y,c=s=y=Yt(y.minus(1),y.plus(1),l,1),p=We(y.times(y),l,1),i=3;;){if(s=We(s.times(p),l,1),u=c.plus(Yt(s,new O(i),l,1)),Mr(u.d).slice(0,l)===Mr(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Yc(O,l+2,k).times(o+""))),c=Yt(c,new O(b),l,1),t==null)if(ya(c.d,l-x,N,a))O.precision=l+=x,u=s=y=Yt(d.minus(1),d.plus(1),l,1),p=We(y.times(y),l,1),i=a=1;else return We(c,O.precision=k,N,ot=!0);else return O.precision=k,c;c=u,i+=2}}function P1(e){return String(e.s*e.s/0)}function Zc(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ye,r<0&&(n+=Ye),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ye;n<i;)e.d.push(+t.slice(n,n+=Ye));t=t.slice(n),n=Ye-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ot&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function k5(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),A1.test(t))return Zc(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(O5.test(t))r=16,t=t.toLowerCase();else if(I5.test(t))r=2;else if(P5.test(t))r=8;else throw Error(Yi+t);for(o=t.search(/p/i),o>0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=T1(n,new n(r),o,o*2)),u=Gc(t,r,Rn),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=Kc(u,l),e.d=u,ot=!1,s&&(e=Yt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?wr(2,c):$r.pow(2,c))),ot=!0,e)}function D5(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:ds(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Xc(5,r)),t=ds(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function ds(e,t,r,n,i){var o,s,a,c,u=e.precision,l=Math.ceil(u/Ye);for(ot=!1,c=r.times(r),a=new e(n);;){if(s=Yt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(s):n.minus(s),n=Yt(s.times(c),new e(t++*t++),u,1),s=a.plus(n),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o}return ot=!0,s.d.length=l+1,s}function Xc(e,t){for(var r=e;--t;)r*=e;return r}function R1(e,t){var r,n=t.s<0,i=Xn(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return _i=n?4:1,t;if(r=t.divToInt(i),r.isZero())_i=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return _i=I1(r)?n?2:3:n?4:1,t;_i=I1(r)?n?1:4:n?3:2}return t.minus(i).abs()}function vd(e,t,r,n){var i,o,s,a,c,u,l,d,p,b=e.constructor,x=r!==void 0;if(x?(Wr(r,1,Ki),n===void 0?n=b.rounding:Wr(n,0,8)):(r=b.precision,n=b.rounding),!e.isFinite())l=P1(e);else{for(l=Zn(e),s=l.indexOf("."),x?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(l=l.replace(".",""),p=new b(1),p.e=l.length-s,p.d=Gc(Zn(p),10,i),p.e=p.d.length),d=Gc(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=x?"0p+0":"0";else{if(s<0?o--:(e=new b(e),e.d=d,e.e=o,e=Yt(e,p,r,n,0,i),d=e.d,o=e.e,u=S1),s=d[r],a=i/2,u=u||d[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[r-1]&1||n===(e.s<0?8:7)),d.length=r,u)for(;++d[--r]>i-1;)d[r]=0,r||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=hd.charAt(d[s]);if(x){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(d=Gc(l,i,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=hd.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function N1(e,t){if(e.length>t)return e.length=t,!0}function B5(e){return new this(e).abs()}function L5(e){return new this(e).acos()}function $5(e){return new this(e).acosh()}function F5(e,t){return new this(e).plus(t)}function U5(e){return new this(e).asin()}function V5(e){return new this(e).asinh()}function z5(e){return new this(e).atan()}function H5(e){return new this(e).atanh()}function q5(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=Xn(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Xn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Xn(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Yt(e,t,o,1)),t=Xn(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Yt(e,t,o,1)),r}function W5(e){return new this(e).cbrt()}function G5(e){return We(e=new this(e),e.e+1,2)}function K5(e,t,r){return new this(e).clamp(t,r)}function Y5(e){if(!e||typeof e!="object")throw Error(Wc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,Ki,"rounding",0,8,"toExpNeg",-fs,0,"toExpPos",0,fs,"maxE",0,fs,"minE",-fs,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=pd[r]),(n=e[r])!==void 0)if(kr(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(Yi+r+": "+n);if(r="crypto",i&&(this[r]=pd[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(_1);else this[r]=!1;else throw Error(Yi+r+": "+n);return this}function Z5(e){return new this(e).cos()}function X5(e){return new this(e).cosh()}function j1(e){var t,r,n;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,k1(o)){u.s=o.s,ot?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;ot?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Zc(u,o.toString())}if(c==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),A1.test(o)?Zc(u,o):k5(u,o);if(c==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Zc(u,o.toString());throw Error(Yi+o)}if(i.prototype=ve,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Y5,i.clone=j1,i.isDecimal=k1,i.abs=B5,i.acos=L5,i.acosh=$5,i.add=F5,i.asin=U5,i.asinh=V5,i.atan=z5,i.atanh=H5,i.atan2=q5,i.cbrt=W5,i.ceil=G5,i.clamp=K5,i.cos=Z5,i.cosh=X5,i.div=J5,i.exp=Q5,i.floor=eA,i.hypot=tA,i.ln=rA,i.log=nA,i.log10=oA,i.log2=iA,i.max=sA,i.min=aA,i.mod=cA,i.mul=uA,i.pow=lA,i.random=fA,i.round=dA,i.sign=hA,i.sin=pA,i.sinh=mA,i.sqrt=gA,i.sub=vA,i.sum=yA,i.tan=wA,i.tanh=bA,i.trunc=xA,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function J5(e,t){return new this(e).div(t)}function Q5(e){return new this(e).exp()}function eA(e){return We(e=new this(e),e.e+1,3)}function tA(){var e,t,r=new this(0);for(ot=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return ot=!0,new this(1/0);r=t}return ot=!0,r.sqrt()}function k1(e){return e instanceof $r||e&&e.toStringTag===C1||!1}function rA(e){return new this(e).ln()}function nA(e,t){return new this(e).log(t)}function iA(e){return new this(e).log(2)}function oA(e){return new this(e).log(10)}function sA(){return O1(this,arguments,-1)}function aA(){return O1(this,arguments,1)}function cA(e,t){return new this(e).mod(t)}function uA(e,t){return new this(e).mul(t)}function lA(e,t){return new this(e).pow(t)}function fA(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Wr(e,1,Ki),n=Math.ceil(e/Ye),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(_1);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ye,n&&e&&(i=wr(10,Ye-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ye)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ye&&(r-=Ye-n)}return s.e=r,s.d=a,s}function dA(e){return We(e=new this(e),e.e+1,this.rounding)}function hA(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function pA(e){return new this(e).sin()}function mA(e){return new this(e).sinh()}function gA(e){return new this(e).sqrt()}function vA(e,t){return new this(e).sub(t)}function yA(){var e=0,t=arguments,r=new this(t[e]);for(ot=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ot=!0,We(r,this.precision,this.rounding)}function wA(e){return new this(e).tan()}function bA(e){return new this(e).tanh()}function xA(e){return We(e=new this(e),e.e+1,1)}ve[Symbol.for("nodejs.util.inspect.custom")]=ve.toString,ve[Symbol.toStringTag]="Decimal";var $r=ve.constructor=j1(pd);Hc=new $r(Hc),qc=new $r(qc),$r.config({precision:256,rounding:$r.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const Dr=(e,t,r,n=$r.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=Ro(e,t,n);if(!Le(u).equals(0))return r?u:hs(u)}const i=Le(e).toString(),o=i.split("."),s=o[0],a=o[1];let c;if(Le(s).gt(0))!a||Le(s.length).gte(9)?c=Ro(i,0,n):Le(s.length).gte(4)?c=Ro(i,2,n):c=Ro(i,4,n);else{Ro(i,6,n);const u=_A(a);if(u<6)c=Ro(i,u+6,n);else{if(u>30)return"0";c=Ro(i,9+(u-6),n)}}return r||Le(s).lt(1)?c:hs(c)},D1=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=Dr(e,t,!0,$r.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const o=i.startsWith("-");let s=n?i:hs(i).toString();return s.includes("e")&&(s=n?i:hs(i).toString()),!r&&Number(i)<Math.pow(10,-t)?o?`-$${s.slice(1)}`:`<$${Math.pow(10,-t).toFixed(t)}`:o?`-$${s.slice(1)}`:`$${s}`}catch{return"$--"}},SA=(e,t,r=!0)=>{if(`${e}`=="0")return!parseFloat(t)||!r?"0":"0.".padEnd(t+2,"0");if(!e)return"--";const n=parseFloat(e),i=e.toString(),o=n<0;let s=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],d=a[4];let p="",b=u?u.substr(d):"";if(b&&(b=`.${b}`),l!=="-"){for(let x=0;x<d;x+=1){const y=u[x]||"0";p+=y}s=c+p+b}else{let x="0";for(let y=0;y<d;y+=1)p=(c[c.length-y-1]||"0")+p;c.length>d&&(x=c.substr(0,c.length-d)),s=`${x}.${p}${u}`}}if(t&&r){let a=`${s.split(".")[0]}.`;const c=s.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";s=a}if(s.length>14){const a=s.split(".");a[0].length>14?s=`${a[0].slice(0,14)}+`:(s=s.slice(0,13),s.indexOf(".")===12&&(s=s.slice(0,12)))}return`${o?"-":""}${s}`},Le=e=>$r.isDecimal(e)?e:new $r(typeof e>"u"||e==="undefined"||!e?0:e);function EA(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Ro=(e,t,r)=>Le(e).toDP(t,r).toString(),hs=e=>{const[t,r]=e.split(".");let n="";for(let i=t.length-1,o=0;i>=0;i--,o++)n=t[i]+n,o%3===2&&i!==0&&(n=","+n);return r?`${n}.${r}`:n};function _A(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function CA(e,t){const r=B1(Le(t));return Number(Le(e).mul(r))}function AA(e,t){const r=B1(Le(t));return Number(Le(e).div(r))}function B1(e){return Le(10).pow(Le(e).abs())}function yd(e,t){const r=AA(e,t);return MA(r.toString(),Number(t))}function MA(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return SA(r,t);const[n,i]=r.split("e");let o=n;const s=Math.abs(parseInt(i,10));let a="",c=o.length;if(n.includes(".")){const[u,l]=n.split(".");o=u+l,c=u.length}for(let u=0;u<s-c;u++)a+="0";return`0.${a}${o}`.slice(0,t+2)}return e}function Jc(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const No=(e,t="")=>t=="long"?e&&e.length>40?e.substring(0,40)+"...":e&&e.length<40?e:"":e?e.substring(0,6)+"..."+e.substring(e.length-4):"",wd=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r)if(!wd(e[i],t[i]))return!1;return!0};function L1(e){return!e||Object.keys(e).length===0}function $1(e){var t;return((t=e.split("::"))==null?void 0:t.length)===3}const F1=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function TA(e,t,r=!1){var a;const n=e.balanceChanges,i=(a=e.effects)==null?void 0:a.gasUsed,o={};let s="0";return i&&(s=Le(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=Pn(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===ac;let d=c.amount;l&&(d=r?d:Le(d).sub(s).toFixed(0));const p={coinType:u,amount:d};o[u]=p}}),o}function U1(e,t){if(t){const r=e[Pn(t.coin_type).full_address];if(r)return yd(Le(r.amount).abs().toFixed(0),t.decimals)}}function It(e){return`https://archive.cetus.zone/assets/terminal${e}`}const hn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,Qc=(e,t)=>Ei(e||"")===Ei(t||""),V1=e=>e===null||typeof e!="object"||Array.isArray(e)?!1:Object.keys(e).length>0,IA=async function(e,t,r=3e4){const n=[];let i="";if(t){for(const c in t){const u=`${c}=${t[c]}`;n.push(u)}const a=n.join("&");i=`${e}?${a}`}else i=e;const o=new AbortController,s=setTimeout(()=>{o.abort()},r);try{const a=await fetch(i,{signal:o.signal});if(clearTimeout(s),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(s),a.name==="AbortError"?new Error("request time out"):a}},OA=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const o=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!o.ok)throw new Error("Request failed");return o.json()}catch(o){throw clearTimeout(i),o.name==="AbortError"?new Error("request time out"):o}},bd="tokenMap",z1="trustedTokenList",H1="collectTokenMap",q1="importTokenList";function eu(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var W1={exports:{}};/*!
41
41
  localForage -- Offline Storage, Improved
42
42
  Version 1.10.0
43
43
  https://localforage.github.io/localForage
44
44
  (c) 2013-2017 Mozilla, Apache License 2.0
45
- */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,o){function s(u,l){if(!i[u]){if(!n[u]){var d=typeof Gc=="function"&&Gc;if(!l&&d)return d(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var w=i[u]={exports:{}};n[u][0].call(w.exports,function(b){var y=n[u][1][b];return s(y||b)},w,w.exports,r,n,i,o)}return i[u].exports}for(var a=typeof Gc=="function"&&Gc,c=0;c<o.length;c++)s(o[c]);return s}({1:[function(r,n,i){(function(o){var s=o.MutationObserver||o.WebKitMutationObserver,a;if(s){var c=0,u=new s(b),l=o.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel<"u"){var d=new o.MessageChannel;d.port1.onmessage=b,a=function(){d.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?a=function(){var T=o.document.createElement("script");T.onreadystatechange=function(){b(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},o.document.documentElement.appendChild(T)}:a=function(){setTimeout(b,0)};var p,w=[];function b(){p=!0;for(var T,O,R=w.length;R;){for(O=w,w=[],T=-1;++T<R;)O[T]();R=w.length}p=!1}n.exports=y;function y(T){w.push(T)===1&&!p&&a()}}).call(this,typeof Dr<"u"?Dr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var o=r(1);function s(){}var a={},c=["REJECTED"],u=["FULFILLED"],l=["PENDING"];n.exports=d;function d(L){if(typeof L!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,L!==s&&y(this,L)}d.prototype.catch=function(L){return this.then(null,L)},d.prototype.then=function(L,q){if(typeof L!="function"&&this.state===u||typeof q!="function"&&this.state===c)return this;var H=new this.constructor(s);if(this.state!==l){var K=this.state===u?L:q;w(H,K,this.outcome)}else this.queue.push(new p(H,L,q));return H};function p(L,q,H){this.promise=L,typeof q=="function"&&(this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled),typeof H=="function"&&(this.onRejected=H,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(L){a.resolve(this.promise,L)},p.prototype.otherCallFulfilled=function(L){w(this.promise,this.onFulfilled,L)},p.prototype.callRejected=function(L){a.reject(this.promise,L)},p.prototype.otherCallRejected=function(L){w(this.promise,this.onRejected,L)};function w(L,q,H){o(function(){var K;try{K=q(H)}catch(re){return a.reject(L,re)}K===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,K)})}a.resolve=function(L,q){var H=T(b,q);if(H.status==="error")return a.reject(L,H.value);var K=H.value;if(K)y(L,K);else{L.state=u,L.outcome=q;for(var re=-1,oe=L.queue.length;++re<oe;)L.queue[re].callFulfilled(q)}return L},a.reject=function(L,q){L.state=c,L.outcome=q;for(var H=-1,K=L.queue.length;++H<K;)L.queue[H].callRejected(q);return L};function b(L){var q=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof q=="function")return function(){q.apply(L,arguments)}}function y(L,q){var H=!1;function K(z){H||(H=!0,a.reject(L,z))}function re(z){H||(H=!0,a.resolve(L,z))}function oe(){q(re,K)}var ae=T(oe);ae.status==="error"&&K(ae.value)}function T(L,q){var H={};try{H.value=L(q),H.status="success"}catch(K){H.status="error",H.value=K}return H}d.resolve=O;function O(L){return L instanceof this?L:a.resolve(new this(s),L)}d.reject=R;function R(L){var q=new this(s);return a.reject(q,L)}d.all=k;function k(L){var q=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=L.length,K=!1;if(!H)return this.resolve([]);for(var re=new Array(H),oe=0,ae=-1,z=new this(s);++ae<H;)D(L[ae],ae);return z;function D(h,f){q.resolve(h).then(m,function(S){K||(K=!0,a.reject(z,S))});function m(S){re[f]=S,++oe===H&&!K&&(K=!0,a.resolve(z,re))}}}d.race=F;function F(L){var q=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=L.length,K=!1;if(!H)return this.resolve([]);for(var re=-1,oe=new this(s);++re<H;)ae(L[re]);return oe;function ae(z){q.resolve(z).then(function(D){K||(K=!0,a.resolve(oe,D))},function(D){K||(K=!0,a.reject(oe,D))})}}},{1:1}],3:[function(r,n,i){(function(o){typeof o.Promise!="function"&&(o.Promise=r(2))}).call(this,typeof Dr<"u"?Dr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(B){return typeof B}:function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B};function s(B,G){if(!(B instanceof G))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var B=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),G=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!B||G)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(B,G){B=B||[],G=G||{};try{return new Blob(B,G)}catch(Z){if(Z.name!=="TypeError")throw Z;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,X=new U,Q=0;Q<B.length;Q+=1)X.append(B[Q]);return X.getBlob(G.type)}}typeof Promise>"u"&&r(3);var d=Promise;function p(B,G){G&&B.then(function(U){G(null,U)},function(U){G(U)})}function w(B,G,U){typeof G=="function"&&B.then(G),typeof U=="function"&&B.catch(U)}function b(B){return typeof B!="string"&&(console.warn(B+" used as a key, but it is not a string."),B=String(B)),B}function y(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",O=void 0,R={},k=Object.prototype.toString,F="readonly",L="readwrite";function q(B){for(var G=B.length,U=new ArrayBuffer(G),X=new Uint8Array(U),Q=0;Q<G;Q++)X[Q]=B.charCodeAt(Q);return U}function H(B){return new d(function(G){var U=B.transaction(T,L),X=l([""]);U.objectStore(T).put(X,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),G(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),Z=navigator.userAgent.match(/Edge\//);G(Z||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function K(B){return typeof O=="boolean"?d.resolve(O):H(B).then(function(G){return O=G,O})}function re(B){var G=R[B.name],U={};U.promise=new d(function(X,Q){U.resolve=X,U.reject=Q}),G.deferredOperations.push(U),G.dbReady?G.dbReady=G.dbReady.then(function(){return U.promise}):G.dbReady=U.promise}function oe(B){var G=R[B.name],U=G.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ae(B,G){var U=R[B.name],X=U.deferredOperations.pop();if(X)return X.reject(G),X.promise}function z(B,G){return new d(function(U,X){if(R[B.name]=R[B.name]||g(),B.db)if(G)re(B),B.db.close();else return U(B.db);var Q=[B.name];G&&Q.push(B.version);var Z=c.open.apply(c,Q);G&&(Z.onupgradeneeded=function(de){var ye=Z.result;try{ye.createObjectStore(B.storeName),de.oldVersion<=1&&ye.createObjectStore(T)}catch(Se){if(Se.name==="ConstraintError")console.warn('The database "'+B.name+'" has been upgraded from version '+de.oldVersion+" to version "+de.newVersion+', but the storage "'+B.storeName+'" already exists.');else throw Se}}),Z.onerror=function(de){de.preventDefault(),X(Z.error)},Z.onsuccess=function(){var de=Z.result;de.onversionchange=function(ye){ye.target.close()},U(de),oe(B)}})}function D(B){return z(B,!1)}function h(B){return z(B,!0)}function f(B,G){if(!B.db)return!0;var U=!B.db.objectStoreNames.contains(B.storeName),X=B.version<B.db.version,Q=B.version>B.db.version;if(X&&(B.version!==G&&console.warn('The database "'+B.name+`" can't be downgraded from version `+B.db.version+" to version "+B.version+"."),B.version=B.db.version),Q||U){if(U){var Z=B.db.version+1;Z>B.version&&(B.version=Z)}return!0}return!1}function m(B){return new d(function(G,U){var X=new FileReader;X.onerror=U,X.onloadend=function(Q){var Z=btoa(Q.target.result||"");G({__local_forage_encoded_blob:!0,data:Z,type:B.type})},X.readAsBinaryString(B)})}function S(B){var G=q(atob(B.data));return l([G],{type:B.type})}function M(B){return B&&B.__local_forage_encoded_blob}function _(B){var G=this,U=G._initReady().then(function(){var X=R[G._dbInfo.name];if(X&&X.dbReady)return X.dbReady});return w(U,B,B),U}function I(B){re(B);for(var G=R[B.name],U=G.forages,X=0;X<U.length;X++){var Q=U[X];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return B.db=null,D(B).then(function(Z){return B.db=Z,f(B)?h(B):Z}).then(function(Z){B.db=G.db=Z;for(var de=0;de<U.length;de++)U[de]._dbInfo.db=Z}).catch(function(Z){throw ae(B,Z),Z})}function C(B,G,U,X){X===void 0&&(X=1);try{var Q=B.db.transaction(B.storeName,G);U(null,Q)}catch(Z){if(X>0&&(!B.db||Z.name==="InvalidStateError"||Z.name==="NotFoundError"))return d.resolve().then(function(){if(!B.db||Z.name==="NotFoundError"&&!B.db.objectStoreNames.contains(B.storeName)&&B.version<=B.db.version)return B.db&&(B.version=B.db.version+1),h(B)}).then(function(){return I(B).then(function(){C(B,G,U,X-1)})}).catch(U);U(Z)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(B){var G=this,U={db:null};if(B)for(var X in B)U[X]=B[X];var Q=R[U.name];Q||(Q=g(),R[U.name]=Q),Q.forages.push(G),G._initReady||(G._initReady=G.ready,G.ready=_);var Z=[];function de(){return d.resolve()}for(var ye=0;ye<Q.forages.length;ye++){var Se=Q.forages[ye];Se!==G&&Z.push(Se._initReady().catch(de))}var Ee=Q.forages.slice(0);return d.all(Z).then(function(){return U.db=Q.db,D(U)}).then(function(_e){return U.db=_e,f(U,G._defaultConfig.version)?h(U):_e}).then(function(_e){U.db=Q.db=_e,G._dbInfo=U;for(var Fe=0;Fe<Ee.length;Fe++){var wt=Ee[Fe];wt!==G&&(wt._dbInfo.db=U.db,wt._dbInfo.version=U.version)}})}function N(B,G){var U=this;B=b(B);var X=new d(function(Q,Z){U.ready().then(function(){C(U._dbInfo,F,function(de,ye){if(de)return Z(de);try{var Se=ye.objectStore(U._dbInfo.storeName),Ee=Se.get(B);Ee.onsuccess=function(){var _e=Ee.result;_e===void 0&&(_e=null),M(_e)&&(_e=S(_e)),Q(_e)},Ee.onerror=function(){Z(Ee.error)}}catch(_e){Z(_e)}})}).catch(Z)});return p(X,G),X}function ee(B,G){var U=this,X=new d(function(Q,Z){U.ready().then(function(){C(U._dbInfo,F,function(de,ye){if(de)return Z(de);try{var Se=ye.objectStore(U._dbInfo.storeName),Ee=Se.openCursor(),_e=1;Ee.onsuccess=function(){var Fe=Ee.result;if(Fe){var wt=Fe.value;M(wt)&&(wt=S(wt));var Vt=B(wt,Fe.key,_e++);Vt!==void 0?Q(Vt):Fe.continue()}else Q()},Ee.onerror=function(){Z(Ee.error)}}catch(Fe){Z(Fe)}})}).catch(Z)});return p(X,G),X}function ie(B,G,U){var X=this;B=b(B);var Q=new d(function(Z,de){var ye;X.ready().then(function(){return ye=X._dbInfo,k.call(G)==="[object Blob]"?K(ye.db).then(function(Se){return Se?G:m(G)}):G}).then(function(Se){C(X._dbInfo,L,function(Ee,_e){if(Ee)return de(Ee);try{var Fe=_e.objectStore(X._dbInfo.storeName);Se===null&&(Se=void 0);var wt=Fe.put(Se,B);_e.oncomplete=function(){Se===void 0&&(Se=null),Z(Se)},_e.onabort=_e.onerror=function(){var Vt=wt.error?wt.error:wt.transaction.error;de(Vt)}}catch(Vt){de(Vt)}})}).catch(de)});return p(Q,U),Q}function le(B,G){var U=this;B=b(B);var X=new d(function(Q,Z){U.ready().then(function(){C(U._dbInfo,L,function(de,ye){if(de)return Z(de);try{var Se=ye.objectStore(U._dbInfo.storeName),Ee=Se.delete(B);ye.oncomplete=function(){Q()},ye.onerror=function(){Z(Ee.error)},ye.onabort=function(){var _e=Ee.error?Ee.error:Ee.transaction.error;Z(_e)}}catch(_e){Z(_e)}})}).catch(Z)});return p(X,G),X}function me(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){C(G._dbInfo,L,function(Z,de){if(Z)return Q(Z);try{var ye=de.objectStore(G._dbInfo.storeName),Se=ye.clear();de.oncomplete=function(){X()},de.onabort=de.onerror=function(){var Ee=Se.error?Se.error:Se.transaction.error;Q(Ee)}}catch(Ee){Q(Ee)}})}).catch(Q)});return p(U,B),U}function xe(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){C(G._dbInfo,F,function(Z,de){if(Z)return Q(Z);try{var ye=de.objectStore(G._dbInfo.storeName),Se=ye.count();Se.onsuccess=function(){X(Se.result)},Se.onerror=function(){Q(Se.error)}}catch(Ee){Q(Ee)}})}).catch(Q)});return p(U,B),U}function be(B,G){var U=this,X=new d(function(Q,Z){if(B<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(de,ye){if(de)return Z(de);try{var Se=ye.objectStore(U._dbInfo.storeName),Ee=!1,_e=Se.openKeyCursor();_e.onsuccess=function(){var Fe=_e.result;if(!Fe){Q(null);return}B===0||Ee?Q(Fe.key):(Ee=!0,Fe.advance(B))},_e.onerror=function(){Z(_e.error)}}catch(Fe){Z(Fe)}})}).catch(Z)});return p(X,G),X}function Ve(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){C(G._dbInfo,F,function(Z,de){if(Z)return Q(Z);try{var ye=de.objectStore(G._dbInfo.storeName),Se=ye.openKeyCursor(),Ee=[];Se.onsuccess=function(){var _e=Se.result;if(!_e){X(Ee);return}Ee.push(_e.key),_e.continue()},Se.onerror=function(){Q(Se.error)}}catch(_e){Q(_e)}})}).catch(Q)});return p(U,B),U}function Le(B,G){G=y.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var X=this,Q;if(!B.name)Q=d.reject("Invalid arguments");else{var Z=B.name===U.name&&X._dbInfo.db,de=Z?d.resolve(X._dbInfo.db):D(B).then(function(ye){var Se=R[B.name],Ee=Se.forages;Se.db=ye;for(var _e=0;_e<Ee.length;_e++)Ee[_e]._dbInfo.db=ye;return ye});B.storeName?Q=de.then(function(ye){if(ye.objectStoreNames.contains(B.storeName)){var Se=ye.version+1;re(B);var Ee=R[B.name],_e=Ee.forages;ye.close();for(var Fe=0;Fe<_e.length;Fe++){var wt=_e[Fe];wt._dbInfo.db=null,wt._dbInfo.version=Se}var Vt=new d(function(Ht,mr){var dr=c.open(B.name,Se);dr.onerror=function(hn){var Ua=dr.result;Ua.close(),mr(hn)},dr.onupgradeneeded=function(){var hn=dr.result;hn.deleteObjectStore(B.storeName)},dr.onsuccess=function(){var hn=dr.result;hn.close(),Ht(hn)}});return Vt.then(function(Ht){Ee.db=Ht;for(var mr=0;mr<_e.length;mr++){var dr=_e[mr];dr._dbInfo.db=Ht,oe(dr._dbInfo)}}).catch(function(Ht){throw(ae(B,Ht)||d.resolve()).catch(function(){}),Ht})}}):Q=de.then(function(ye){re(B);var Se=R[B.name],Ee=Se.forages;ye.close();for(var _e=0;_e<Ee.length;_e++){var Fe=Ee[_e];Fe._dbInfo.db=null}var wt=new d(function(Vt,Ht){var mr=c.deleteDatabase(B.name);mr.onerror=function(){var dr=mr.result;dr&&dr.close(),Ht(mr.error)},mr.onblocked=function(){console.warn('dropInstance blocked for database "'+B.name+'" until all open connections are closed')},mr.onsuccess=function(){var dr=mr.result;dr&&dr.close(),Vt(dr)}});return wt.then(function(Vt){Se.db=Vt;for(var Ht=0;Ht<Ee.length;Ht++){var mr=Ee[Ht];oe(mr._dbInfo)}}).catch(function(Vt){throw(ae(B,Vt)||d.resolve()).catch(function(){}),Vt})})}return p(Q,G),Q}var ft={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:N,setItem:ie,removeItem:le,clear:me,length:xe,key:be,keys:Ve,dropInstance:Le};function dt(){return typeof openDatabase=="function"}var je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,he="__lfsc__:",Ce=he.length,Ue="arbf",Ne="blob",Me="si08",Te="ui08",Be="uic8",ut="si16",lt="si32",ze="ur16",jt="ui32",Et="fl32",Ze="fl64",It=Ce+Ue.length,Ft=Object.prototype.toString;function Qe(B){var G=B.length*.75,U=B.length,X,Q=0,Z,de,ye,Se;B[B.length-1]==="="&&(G--,B[B.length-2]==="="&&G--);var Ee=new ArrayBuffer(G),_e=new Uint8Array(Ee);for(X=0;X<U;X+=4)Z=je.indexOf(B[X]),de=je.indexOf(B[X+1]),ye=je.indexOf(B[X+2]),Se=je.indexOf(B[X+3]),_e[Q++]=Z<<2|de>>4,_e[Q++]=(de&15)<<4|ye>>2,_e[Q++]=(ye&3)<<6|Se&63;return Ee}function _t(B){var G=new Uint8Array(B),U="",X;for(X=0;X<G.length;X+=3)U+=je[G[X]>>2],U+=je[(G[X]&3)<<4|G[X+1]>>4],U+=je[(G[X+1]&15)<<2|G[X+2]>>6],U+=je[G[X+2]&63];return G.length%3===2?U=U.substring(0,U.length-1)+"=":G.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Ot(B,G){var U="";if(B&&(U=Ft.call(B)),B&&(U==="[object ArrayBuffer]"||B.buffer&&Ft.call(B.buffer)==="[object ArrayBuffer]")){var X,Q=he;B instanceof ArrayBuffer?(X=B,Q+=Ue):(X=B.buffer,U==="[object Int8Array]"?Q+=Me:U==="[object Uint8Array]"?Q+=Te:U==="[object Uint8ClampedArray]"?Q+=Be:U==="[object Int16Array]"?Q+=ut:U==="[object Uint16Array]"?Q+=ze:U==="[object Int32Array]"?Q+=lt:U==="[object Uint32Array]"?Q+=jt:U==="[object Float32Array]"?Q+=Et:U==="[object Float64Array]"?Q+=Ze:G(new Error("Failed to get type for BinaryArray"))),G(Q+_t(X))}else if(U==="[object Blob]"){var Z=new FileReader;Z.onload=function(){var de=mt+B.type+"~"+_t(this.result);G(he+Ne+de)},Z.readAsArrayBuffer(B)}else try{G(JSON.stringify(B))}catch(de){console.error("Couldn't convert value into a JSON string: ",B),G(null,de)}}function rt(B){if(B.substring(0,Ce)!==he)return JSON.parse(B);var G=B.substring(It),U=B.substring(Ce,It),X;if(U===Ne&&we.test(G)){var Q=G.match(we);X=Q[1],G=G.substring(Q[0].length)}var Z=Qe(G);switch(U){case Ue:return Z;case Ne:return l([Z],{type:X});case Me:return new Int8Array(Z);case Te:return new Uint8Array(Z);case Be:return new Uint8ClampedArray(Z);case ut:return new Int16Array(Z);case ze:return new Uint16Array(Z);case lt:return new Int32Array(Z);case jt:return new Uint32Array(Z);case Et:return new Float32Array(Z);case Ze:return new Float64Array(Z);default:throw new Error("Unkown type: "+U)}}var kt={serialize:Ot,deserialize:rt,stringToBuffer:Qe,bufferToString:_t};function Pt(B,G,U,X){B.executeSql("CREATE TABLE IF NOT EXISTS "+G.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,X)}function et(B){var G=this,U={db:null};if(B)for(var X in B)U[X]=typeof B[X]!="string"?B[X].toString():B[X];var Q=new d(function(Z,de){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(ye){return de(ye)}U.db.transaction(function(ye){Pt(ye,U,function(){G._dbInfo=U,Z()},function(Se,Ee){de(Ee)})},de)});return U.serializer=kt,Q}function xt(B,G,U,X,Q,Z){B.executeSql(U,X,Q,function(de,ye){ye.code===ye.SYNTAX_ERR?de.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[G.storeName],function(Se,Ee){Ee.rows.length?Z(Se,ye):Pt(Se,G,function(){Se.executeSql(U,X,Q,Z)},Z)},Z):Z(de,ye)},Z)}function Mt(B,G){var U=this;B=b(B);var X=new d(function(Q,Z){U.ready().then(function(){var de=U._dbInfo;de.db.transaction(function(ye){xt(ye,de,"SELECT * FROM "+de.storeName+" WHERE key = ? LIMIT 1",[B],function(Se,Ee){var _e=Ee.rows.length?Ee.rows.item(0).value:null;_e&&(_e=de.serializer.deserialize(_e)),Q(_e)},function(Se,Ee){Z(Ee)})})}).catch(Z)});return p(X,G),X}function Ge(B,G){var U=this,X=new d(function(Q,Z){U.ready().then(function(){var de=U._dbInfo;de.db.transaction(function(ye){xt(ye,de,"SELECT * FROM "+de.storeName,[],function(Se,Ee){for(var _e=Ee.rows,Fe=_e.length,wt=0;wt<Fe;wt++){var Vt=_e.item(wt),Ht=Vt.value;if(Ht&&(Ht=de.serializer.deserialize(Ht)),Ht=B(Ht,Vt.key,wt+1),Ht!==void 0){Q(Ht);return}}Q()},function(Se,Ee){Z(Ee)})})}).catch(Z)});return p(X,G),X}function gt(B,G,U,X){var Q=this;B=b(B);var Z=new d(function(de,ye){Q.ready().then(function(){G===void 0&&(G=null);var Se=G,Ee=Q._dbInfo;Ee.serializer.serialize(G,function(_e,Fe){Fe?ye(Fe):Ee.db.transaction(function(wt){xt(wt,Ee,"INSERT OR REPLACE INTO "+Ee.storeName+" (key, value) VALUES (?, ?)",[B,_e],function(){de(Se)},function(Vt,Ht){ye(Ht)})},function(wt){if(wt.code===wt.QUOTA_ERR){if(X>0){de(gt.apply(Q,[B,Se,U,X-1]));return}ye(wt)}})})}).catch(ye)});return p(Z,U),Z}function Rt(B,G,U){return gt.apply(this,[B,G,U,1])}function nt(B,G){var U=this;B=b(B);var X=new d(function(Q,Z){U.ready().then(function(){var de=U._dbInfo;de.db.transaction(function(ye){xt(ye,de,"DELETE FROM "+de.storeName+" WHERE key = ?",[B],function(){Q()},function(Se,Ee){Z(Ee)})})}).catch(Z)});return p(X,G),X}function St(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){var Z=G._dbInfo;Z.db.transaction(function(de){xt(de,Z,"DELETE FROM "+Z.storeName,[],function(){X()},function(ye,Se){Q(Se)})})}).catch(Q)});return p(U,B),U}function zt(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){var Z=G._dbInfo;Z.db.transaction(function(de){xt(de,Z,"SELECT COUNT(key) as c FROM "+Z.storeName,[],function(ye,Se){var Ee=Se.rows.item(0).c;X(Ee)},function(ye,Se){Q(Se)})})}).catch(Q)});return p(U,B),U}function j(B,G){var U=this,X=new d(function(Q,Z){U.ready().then(function(){var de=U._dbInfo;de.db.transaction(function(ye){xt(ye,de,"SELECT key FROM "+de.storeName+" WHERE id = ? LIMIT 1",[B+1],function(Se,Ee){var _e=Ee.rows.length?Ee.rows.item(0).key:null;Q(_e)},function(Se,Ee){Z(Ee)})})}).catch(Z)});return p(X,G),X}function E(B){var G=this,U=new d(function(X,Q){G.ready().then(function(){var Z=G._dbInfo;Z.db.transaction(function(de){xt(de,Z,"SELECT key FROM "+Z.storeName,[],function(ye,Se){for(var Ee=[],_e=0;_e<Se.rows.length;_e++)Ee.push(Se.rows.item(_e).key);X(Ee)},function(ye,Se){Q(Se)})})}).catch(Q)});return p(U,B),U}function A(B){return new d(function(G,U){B.transaction(function(X){X.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,Z){for(var de=[],ye=0;ye<Z.rows.length;ye++)de.push(Z.rows.item(ye).name);G({db:B,storeNames:de})},function(Q,Z){U(Z)})},function(X){U(X)})})}function $(B,G){G=y.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var X=this,Q;return B.name?Q=new d(function(Z){var de;B.name===U.name?de=X._dbInfo.db:de=openDatabase(B.name,"","",0),B.storeName?Z({db:de,storeNames:[B.storeName]}):Z(A(de))}).then(function(Z){return new d(function(de,ye){Z.db.transaction(function(Se){function Ee(Vt){return new d(function(Ht,mr){Se.executeSql("DROP TABLE IF EXISTS "+Vt,[],function(){Ht()},function(dr,hn){mr(hn)})})}for(var _e=[],Fe=0,wt=Z.storeNames.length;Fe<wt;Fe++)_e.push(Ee(Z.storeNames[Fe]));d.all(_e).then(function(){de()}).catch(function(Vt){ye(Vt)})},function(Se){ye(Se)})})}):Q=d.reject("Invalid arguments"),p(Q,G),Q}var Y={_driver:"webSQLStorage",_initStorage:et,_support:dt(),iterate:Ge,getItem:Mt,setItem:Rt,removeItem:nt,clear:St,length:zt,key:j,keys:E,dropInstance:$};function J(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function ne(B,G){var U=B.name+"/";return B.storeName!==G.storeName&&(U+=B.storeName+"/"),U}function ke(){var B="_localforage_support_test";try{return localStorage.setItem(B,!0),localStorage.removeItem(B),!1}catch{return!0}}function Je(){return!ke()||localStorage.length>0}function Re(B){var G=this,U={};if(B)for(var X in B)U[X]=B[X];return U.keyPrefix=ne(B,G._defaultConfig),Je()?(G._dbInfo=U,U.serializer=kt,d.resolve()):d.reject()}function V(B){var G=this,U=G.ready().then(function(){for(var X=G._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var Z=localStorage.key(Q);Z.indexOf(X)===0&&localStorage.removeItem(Z)}});return p(U,B),U}function se(B,G){var U=this;B=b(B);var X=U.ready().then(function(){var Q=U._dbInfo,Z=localStorage.getItem(Q.keyPrefix+B);return Z&&(Z=Q.serializer.deserialize(Z)),Z});return p(X,G),X}function fe(B,G){var U=this,X=U.ready().then(function(){for(var Q=U._dbInfo,Z=Q.keyPrefix,de=Z.length,ye=localStorage.length,Se=1,Ee=0;Ee<ye;Ee++){var _e=localStorage.key(Ee);if(_e.indexOf(Z)===0){var Fe=localStorage.getItem(_e);if(Fe&&(Fe=Q.serializer.deserialize(Fe)),Fe=B(Fe,_e.substring(de),Se++),Fe!==void 0)return Fe}}});return p(X,G),X}function Oe(B,G){var U=this,X=U.ready().then(function(){var Q=U._dbInfo,Z;try{Z=localStorage.key(B)}catch{Z=null}return Z&&(Z=Z.substring(Q.keyPrefix.length)),Z});return p(X,G),X}function He(B){var G=this,U=G.ready().then(function(){for(var X=G._dbInfo,Q=localStorage.length,Z=[],de=0;de<Q;de++){var ye=localStorage.key(de);ye.indexOf(X.keyPrefix)===0&&Z.push(ye.substring(X.keyPrefix.length))}return Z});return p(U,B),U}function Pe(B){var G=this,U=G.keys().then(function(X){return X.length});return p(U,B),U}function $e(B,G){var U=this;B=b(B);var X=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+B)});return p(X,G),X}function at(B,G,U){var X=this;B=b(B);var Q=X.ready().then(function(){G===void 0&&(G=null);var Z=G;return new d(function(de,ye){var Se=X._dbInfo;Se.serializer.serialize(G,function(Ee,_e){if(_e)ye(_e);else try{localStorage.setItem(Se.keyPrefix+B,Ee),de(Z)}catch(Fe){(Fe.name==="QuotaExceededError"||Fe.name==="NS_ERROR_DOM_QUOTA_REACHED")&&ye(Fe),ye(Fe)}})})});return p(Q,U),Q}function Qt(B,G){if(G=y.apply(this,arguments),B=typeof B!="function"&&B||{},!B.name){var U=this.config();B.name=B.name||U.name,B.storeName=B.storeName||U.storeName}var X=this,Q;return B.name?Q=new d(function(Z){B.storeName?Z(ne(B,X._defaultConfig)):Z(B.name+"/")}).then(function(Z){for(var de=localStorage.length-1;de>=0;de--){var ye=localStorage.key(de);ye.indexOf(Z)===0&&localStorage.removeItem(ye)}}):Q=d.reject("Invalid arguments"),p(Q,G),Q}var Dt={_driver:"localStorageWrapper",_initStorage:Re,_support:J(),iterate:fe,getItem:se,setItem:at,removeItem:$e,clear:V,length:Pe,key:Oe,keys:He,dropInstance:Qt},Ut=function(G,U){return G===U||typeof G=="number"&&typeof U=="number"&&isNaN(G)&&isNaN(U)},ur=function(G,U){for(var X=G.length,Q=0;Q<X;){if(Ut(G[Q],U))return!0;Q++}return!1},Ar=Array.isArray||function(B){return Object.prototype.toString.call(B)==="[object Array]"},fr={},er={},xr={INDEXEDDB:ft,WEBSQL:Y,LOCALSTORAGE:Dt},Rn=[xr.INDEXEDDB._driver,xr.WEBSQL._driver,xr.LOCALSTORAGE._driver],Kr=["dropInstance"],Nn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Kr),Ii={description:"",driver:Rn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Oi(B,G){B[G]=function(){var U=arguments;return B.ready().then(function(){return B[G].apply(B,U)})}}function jn(){for(var B=1;B<arguments.length;B++){var G=arguments[B];if(G)for(var U in G)G.hasOwnProperty(U)&&(Ar(G[U])?arguments[0][U]=G[U].slice():arguments[0][U]=G[U])}return arguments[0]}var Pi=function(){function B(G){s(this,B);for(var U in xr)if(xr.hasOwnProperty(U)){var X=xr[U],Q=X._driver;this[U]=Q,fr[Q]||this.defineDriver(X)}this._defaultConfig=jn({},Ii),this._config=jn({},this._defaultConfig,G),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return B.prototype.config=function(U){if((typeof U>"u"?"undefined":o(U))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var X in U){if(X==="storeName"&&(U[X]=U[X].replace(/\W/g,"_")),X==="version"&&typeof U[X]!="number")return new Error("Database version must be a number.");this._config[X]=U[X]}return"driver"in U&&U.driver?this.setDriver(this._config.driver):!0}else return typeof U=="string"?this._config[U]:this._config},B.prototype.defineDriver=function(U,X,Q){var Z=new d(function(de,ye){try{var Se=U._driver,Ee=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){ye(Ee);return}for(var _e=Nn.concat("_initStorage"),Fe=0,wt=_e.length;Fe<wt;Fe++){var Vt=_e[Fe],Ht=!ur(Kr,Vt);if((Ht||U[Vt])&&typeof U[Vt]!="function"){ye(Ee);return}}var mr=function(){for(var Ua=function(PD){return function(){var RD=new Error("Method "+PD+" is not implemented by the current driver"),T2=d.reject(RD);return p(T2,arguments[arguments.length-1]),T2}},Uh=0,OD=Kr.length;Uh<OD;Uh++){var Vh=Kr[Uh];U[Vh]||(U[Vh]=Ua(Vh))}};mr();var dr=function(Ua){fr[Se]&&console.info("Redefining LocalForage driver: "+Se),fr[Se]=U,er[Se]=Ua,de()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(dr,ye):dr(!!U._support):dr(!0)}catch(hn){ye(hn)}});return w(Z,X,Q),Z},B.prototype.driver=function(){return this._driver||null},B.prototype.getDriver=function(U,X,Q){var Z=fr[U]?d.resolve(fr[U]):d.reject(new Error("Driver not found."));return w(Z,X,Q),Z},B.prototype.getSerializer=function(U){var X=d.resolve(kt);return w(X,U),X},B.prototype.ready=function(U){var X=this,Q=X._driverSet.then(function(){return X._ready===null&&(X._ready=X._initDriver()),X._ready});return w(Q,U,U),Q},B.prototype.setDriver=function(U,X,Q){var Z=this;Ar(U)||(U=[U]);var de=this._getSupportedDrivers(U);function ye(){Z._config.driver=Z.driver()}function Se(Fe){return Z._extend(Fe),ye(),Z._ready=Z._initStorage(Z._config),Z._ready}function Ee(Fe){return function(){var wt=0;function Vt(){for(;wt<Fe.length;){var Ht=Fe[wt];return wt++,Z._dbInfo=null,Z._ready=null,Z.getDriver(Ht).then(Se).catch(Vt)}ye();var mr=new Error("No available storage method found.");return Z._driverSet=d.reject(mr),Z._driverSet}return Vt()}}var _e=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=_e.then(function(){var Fe=de[0];return Z._dbInfo=null,Z._ready=null,Z.getDriver(Fe).then(function(wt){Z._driver=wt._driver,ye(),Z._wrapLibraryMethodsWithReady(),Z._initDriver=Ee(de)})}).catch(function(){ye();var Fe=new Error("No available storage method found.");return Z._driverSet=d.reject(Fe),Z._driverSet}),w(this._driverSet,X,Q),this._driverSet},B.prototype.supports=function(U){return!!er[U]},B.prototype._extend=function(U){jn(this,U)},B.prototype._getSupportedDrivers=function(U){for(var X=[],Q=0,Z=U.length;Q<Z;Q++){var de=U[Q];this.supports(de)&&X.push(de)}return X},B.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,X=Nn.length;U<X;U++)Oi(this,Nn[U])},B.prototype.createInstance=function(U){return new B(U)},B}(),Ri=new Pi;n.exports=Ri},{3:3}]},{},[4])(4)})})(_1);var m5=_1.exports;const pa=Bs(m5);pa.config({name:"CetusSite",storeName:"tokens"});class Si{static async setItem(t,r){try{await pa.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await pa.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await pa.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await pa.clear()}catch(t){console.error("Failed to clear storage",t)}}}const Kc=[{name:"SuiVision",link:"https://suivision.xyz",img:Tt("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:Tt("/images/logo_suiscan@2x.png"),isCustom:!1}],Yc=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],g5=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],us={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],v5="0x45f3c0814d7be4aa5fbd32d7e3c40f3c062a2b63eaf5ec4f8c1539b5987b11af",y5=Tt("/images/birdeye-logo.png"),w5=Tt("/images/img-logo@2x.png"),b5=Tt("/images/logo_CoinGecko@2x.png"),x5=Tt("/images/logo_pyth.png");var ma=(e=>(e.CETUS="CETUS",e.KRIYA="KRIYA",e.KRIYAV3="KRIYAV3",e.FLOWX="FLOWX",e.FLOWXV3="FLOWXV3",e.AFTERMATH="AFTERMATH",e.HAEDAL="HAEDAL",e.VOLO="VOLO",e.AFSUI="AFSUI",e.DEEPBOOKV3="DEEPBOOKV3",e.SCALLOP="SCALLOP",e.BLUEMOVE="BLUEMOVE",e.TURBOS="TURBOS",e.SPRINGSUI="SPRINGSUI",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e.ALPHAFI="ALPHAFI",e.STEAMM="STEAMM",e.OBRIC="OBRIC",e.METASTABLE="METASTABLE",e))(ma||{});const C1={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},S5={pyth:x5,coingecko:b5,birdeye:y5,Cetus:w5},cr={CETUS:Tt("/images/aggregator-source/cetus.png"),KRIYA:Tt("/images/aggregator-source/kriya.png"),FLOWX:Tt("/images/aggregator-source/flowx.png"),AFTERMATH:Tt("/images/aggregator-source/aftermath.png"),TURBOS:Tt("/images/aggregator-source/turbos.png"),HAEDAL:Tt("/images/aggregator-source/haedal.png"),VOLO:Tt("/images/aggregator-source/volo.png"),AFSUI:Tt("/images/aggregator-source/aftermath.png"),BLUEMOVE:Tt("/images/aggregator-source/bluemove.png"),KRIYAV3:Tt("/images/aggregator-source/kriya.png"),FLOWXV3:Tt("/images/aggregator-source/flowx.png"),DEEPBOOKV3:Tt("/images/aggregator-source/deepbook.png"),SCALLOP:Tt("/images/aggregator-source/scallop.png"),SPRINGSUI:Tt("/images/aggregator-source/suilend.png"),BLUEFIN:Tt("/images/aggregator-source/bluefin.png"),HAEDALPMM:Tt("/images/aggregator-source/haedal.png"),ALPHAFI:Tt("/images/aggregator-source/stSui.png"),STEAMM:Tt("/images/aggregator-source/steamm.png"),OBRIC:Tt("/images/aggregator-source/obric.png"),METASTABLE:Tt("/images/aggregator-source/metastable.png")},M1={CETUS:{name:"Cetus",id:"CETUS",logo:cr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:cr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:cr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:cr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:cr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:cr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:cr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:cr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:cr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:cr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:cr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:cr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:cr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:cr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:cr.SCALLOP,type:"other",sort:70},SPRINGSUI:{name:"SpringSui",id:"SPRINGSUI",logo:cr.SPRINGSUI,type:"other",sort:60},ALPHAFI:{name:"stSUI",id:"ALPHAFI",logo:cr.ALPHAFI,type:"other",sort:50},STEAMM:{name:"STEAMM",id:"STEAMM",logo:cr.STEAMM,sort:78,type:"dex"},METASTABLE:{name:"Metastable",id:"METASTABLE",logo:cr.METASTABLE,sort:77,type:"dex"},OBRIC:{name:"Obric",id:"OBRIC",logo:cr.OBRIC,sort:76,type:"dex"}},A1=e=>{let t;const r=new Set,n=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(w=>w(t,p))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,i,a);return a},E5=e=>e?A1(e):A1,_5=e=>e;function C5(e,t=_5){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const T1=e=>{const t=E5(e),r=n=>C5(t,n);return Object.assign(r,t),r},Ei=e=>e?T1(e):T1;function M5(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var o;const s=c=>c===null?null:JSON.parse(c,t==null?void 0:t.reviver),a=(o=r.getItem(i))!=null?o:null;return a instanceof Promise?a.then(s):s(a)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const fd=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return fd(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return fd(n)(r)}}}},$r=Ei(((e,t)=>(r,n,i)=>{let o={storage:M5(()=>localStorage),partialize:y=>y,version:0,merge:(y,T)=>({...T,...y}),...t},s=!1;const a=new Set,c=new Set;let u=o.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...y)},n,i);const l=()=>{const y=o.partialize({...n()});return u.setItem(o.name,{state:y,version:o.version})},d=i.setState;i.setState=(y,T)=>{d(y,T),l()};const p=e((...y)=>{r(...y),l()},n,i);i.getInitialState=()=>p;let w;const b=()=>{var y,T;if(!u)return;s=!1,a.forEach(R=>{var k;return R((k=n())!=null?k:p)});const O=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(y=n())!=null?y:p))||void 0;return fd(u.getItem.bind(u))(o.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==o.version){if(o.migrate){const k=o.migrate(R.state,R.version);return k instanceof Promise?k.then(F=>[!0,F]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,R.state];return[!1,void 0]}).then(R=>{var k;const[F,L]=R;if(w=o.merge(L,(k=n())!=null?k:p),r(w,!0),F)return l()}).then(()=>{O==null||O(w,void 0),w=n(),s=!0,c.forEach(R=>R(w))}).catch(R=>{O==null||O(void 0,R)})};return i.persist={setOptions:y=>{o={...o,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>s,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},o.skipHydration||b(),w||p})((e,t)=>({ignoreWarnTokenMap:{},currentExplorer:Kc[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:Yc,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:Yc[0],customRpc:"",setCurrentRpc:r=>{e(()=>({currentRpc:r}))},setCustomRpc:r=>{e(()=>({customRpc:r}))},slippage:"0.5",setSlippage:r=>{e(()=>({slippage:r}))},isOpenSlippageDialog:!1,setIsOpenSlippageDialog:r=>{e(()=>({isOpenSlippageDialog:r}))},providers:Object.values(ma),setProviders:r=>{e(()=>({providers:r}))},poolApiMap:{},setPoolApiMap:(r,n)=>{const i=t().poolApiMap;i[r]=n,e(()=>({poolApiMap:{...i}}))},mevProtect:!0,setMevProtect:r=>{e(()=>({mevProtect:r}))},setIgnoreWarnToken:r=>{const n=t().ignoreWarnTokenMap;n[bi(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:o,mevProtect:s,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:o,mevProtect:s,ignoreWarnTokenMap:a}}}));function ls(){const{currentExplorer:e}=$r();return{getExplorerUrl:(r,n="account",i=e)=>{let o;return i.includes("suivision")?o=`${i}/${T5(n)}/${r}`:o=`${i}/${A5(n)}/${r}`,o}}}const A5=e=>{switch(e){case"account":return"address";case"token":return"object";case"tx":return"tx";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}},T5=e=>{switch(e){case"account":return"account";case"token":return"object";case"tx":return"txblock";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}};function I1(e){const{text:t,keywords:r,onKeywordClick:n,text_highlight_color:i="var(--cs-primary)",text_size:o="12px",text_color:s="var(--cs-btn-disabled-text)"}=e,a=new RegExp(`(${r.join("|")})`,"gi"),c=t.split(a);return x.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const d=r.includes(u);return x.jsx("span",{style:{lineHeight:"20px",fontSize:o,color:d?i:s,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var O1={exports:{}};/*!
45
+ */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,o){function s(u,l){if(!i[u]){if(!n[u]){var d=typeof eu=="function"&&eu;if(!l&&d)return d(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var b=i[u]={exports:{}};n[u][0].call(b.exports,function(x){var y=n[u][1][x];return s(y||x)},b,b.exports,r,n,i,o)}return i[u].exports}for(var a=typeof eu=="function"&&eu,c=0;c<o.length;c++)s(o[c]);return s}({1:[function(r,n,i){(function(o){var s=o.MutationObserver||o.WebKitMutationObserver,a;if(s){var c=0,u=new s(x),l=o.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel<"u"){var d=new o.MessageChannel;d.port1.onmessage=x,a=function(){d.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?a=function(){var T=o.document.createElement("script");T.onreadystatechange=function(){x(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},o.document.documentElement.appendChild(T)}:a=function(){setTimeout(x,0)};var p,b=[];function x(){p=!0;for(var T,O,N=b.length;N;){for(O=b,b=[],T=-1;++T<N;)O[T]();N=b.length}p=!1}n.exports=y;function y(T){b.push(T)===1&&!p&&a()}}).call(this,typeof _r<"u"?_r:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var o=r(1);function s(){}var a={},c=["REJECTED"],u=["FULFILLED"],l=["PENDING"];n.exports=d;function d(L){if(typeof L!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,L!==s&&y(this,L)}d.prototype.catch=function(L){return this.then(null,L)},d.prototype.then=function(L,W){if(typeof L!="function"&&this.state===u||typeof W!="function"&&this.state===c)return this;var z=new this.constructor(s);if(this.state!==l){var G=this.state===u?L:W;b(z,G,this.outcome)}else this.queue.push(new p(z,L,W));return z};function p(L,W,z){this.promise=L,typeof W=="function"&&(this.onFulfilled=W,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(L){a.resolve(this.promise,L)},p.prototype.otherCallFulfilled=function(L){b(this.promise,this.onFulfilled,L)},p.prototype.callRejected=function(L){a.reject(this.promise,L)},p.prototype.otherCallRejected=function(L){b(this.promise,this.onRejected,L)};function b(L,W,z){o(function(){var G;try{G=W(z)}catch(re){return a.reject(L,re)}G===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,G)})}a.resolve=function(L,W){var z=T(x,W);if(z.status==="error")return a.reject(L,z.value);var G=z.value;if(G)y(L,G);else{L.state=u,L.outcome=W;for(var re=-1,oe=L.queue.length;++re<oe;)L.queue[re].callFulfilled(W)}return L},a.reject=function(L,W){L.state=c,L.outcome=W;for(var z=-1,G=L.queue.length;++z<G;)L.queue[z].callRejected(W);return L};function x(L){var W=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof W=="function")return function(){W.apply(L,arguments)}}function y(L,W){var z=!1;function G(H){z||(z=!0,a.reject(L,H))}function re(H){z||(z=!0,a.resolve(L,H))}function oe(){W(re,G)}var ae=T(oe);ae.status==="error"&&G(ae.value)}function T(L,W){var z={};try{z.value=L(W),z.status="success"}catch(G){z.status="error",z.value=G}return z}d.resolve=O;function O(L){return L instanceof this?L:a.resolve(new this(s),L)}d.reject=N;function N(L){var W=new this(s);return a.reject(W,L)}d.all=k;function k(L){var W=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=L.length,G=!1;if(!z)return this.resolve([]);for(var re=new Array(z),oe=0,ae=-1,H=new this(s);++ae<z;)D(L[ae],ae);return H;function D(h,f){W.resolve(h).then(m,function(S){G||(G=!0,a.reject(H,S))});function m(S){re[f]=S,++oe===z&&!G&&(G=!0,a.resolve(H,re))}}}d.race=F;function F(L){var W=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=L.length,G=!1;if(!z)return this.resolve([]);for(var re=-1,oe=new this(s);++re<z;)ae(L[re]);return oe;function ae(H){W.resolve(H).then(function(D){G||(G=!0,a.resolve(oe,D))},function(D){G||(G=!0,a.reject(oe,D))})}}},{1:1}],3:[function(r,n,i){(function(o){typeof o.Promise!="function"&&(o.Promise=r(2))}).call(this,typeof _r<"u"?_r:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(B){return typeof B}:function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B};function s(B,K){if(!(B instanceof K))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var B=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),K=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!B||K)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(B,K){B=B||[],K=K||{};try{return new Blob(B,K)}catch(Z){if(Z.name!=="TypeError")throw Z;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,X=new U,te=0;te<B.length;te+=1)X.append(B[te]);return X.getBlob(K.type)}}typeof Promise>"u"&&r(3);var d=Promise;function p(B,K){K&&B.then(function(U){K(null,U)},function(U){K(U)})}function b(B,K,U){typeof K=="function"&&B.then(K),typeof U=="function"&&B.catch(U)}function x(B){return typeof B!="string"&&(console.warn(B+" used as a key, but it is not a string."),B=String(B)),B}function y(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",O=void 0,N={},k=Object.prototype.toString,F="readonly",L="readwrite";function W(B){for(var K=B.length,U=new ArrayBuffer(K),X=new Uint8Array(U),te=0;te<K;te++)X[te]=B.charCodeAt(te);return U}function z(B){return new d(function(K){var U=B.transaction(T,L),X=l([""]);U.objectStore(T).put(X,"key"),U.onabort=function(te){te.preventDefault(),te.stopPropagation(),K(!1)},U.oncomplete=function(){var te=navigator.userAgent.match(/Chrome\/(\d+)/),Z=navigator.userAgent.match(/Edge\//);K(Z||!te||parseInt(te[1],10)>=43)}}).catch(function(){return!1})}function G(B){return typeof O=="boolean"?d.resolve(O):z(B).then(function(K){return O=K,O})}function re(B){var K=N[B.name],U={};U.promise=new d(function(X,te){U.resolve=X,U.reject=te}),K.deferredOperations.push(U),K.dbReady?K.dbReady=K.dbReady.then(function(){return U.promise}):K.dbReady=U.promise}function oe(B){var K=N[B.name],U=K.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ae(B,K){var U=N[B.name],X=U.deferredOperations.pop();if(X)return X.reject(K),X.promise}function H(B,K){return new d(function(U,X){if(N[B.name]=N[B.name]||g(),B.db)if(K)re(B),B.db.close();else return U(B.db);var te=[B.name];K&&te.push(B.version);var Z=c.open.apply(c,te);K&&(Z.onupgradeneeded=function(he){var ye=Z.result;try{ye.createObjectStore(B.storeName),he.oldVersion<=1&&ye.createObjectStore(T)}catch(xe){if(xe.name==="ConstraintError")console.warn('The database "'+B.name+'" has been upgraded from version '+he.oldVersion+" to version "+he.newVersion+', but the storage "'+B.storeName+'" already exists.');else throw xe}}),Z.onerror=function(he){he.preventDefault(),X(Z.error)},Z.onsuccess=function(){var he=Z.result;he.onversionchange=function(ye){ye.target.close()},U(he),oe(B)}})}function D(B){return H(B,!1)}function h(B){return H(B,!0)}function f(B,K){if(!B.db)return!0;var U=!B.db.objectStoreNames.contains(B.storeName),X=B.version<B.db.version,te=B.version>B.db.version;if(X&&(B.version!==K&&console.warn('The database "'+B.name+`" can't be downgraded from version `+B.db.version+" to version "+B.version+"."),B.version=B.db.version),te||U){if(U){var Z=B.db.version+1;Z>B.version&&(B.version=Z)}return!0}return!1}function m(B){return new d(function(K,U){var X=new FileReader;X.onerror=U,X.onloadend=function(te){var Z=btoa(te.target.result||"");K({__local_forage_encoded_blob:!0,data:Z,type:B.type})},X.readAsBinaryString(B)})}function S(B){var K=W(atob(B.data));return l([K],{type:B.type})}function A(B){return B&&B.__local_forage_encoded_blob}function _(B){var K=this,U=K._initReady().then(function(){var X=N[K._dbInfo.name];if(X&&X.dbReady)return X.dbReady});return b(U,B,B),U}function I(B){re(B);for(var K=N[B.name],U=K.forages,X=0;X<U.length;X++){var te=U[X];te._dbInfo.db&&(te._dbInfo.db.close(),te._dbInfo.db=null)}return B.db=null,D(B).then(function(Z){return B.db=Z,f(B)?h(B):Z}).then(function(Z){B.db=K.db=Z;for(var he=0;he<U.length;he++)U[he]._dbInfo.db=Z}).catch(function(Z){throw ae(B,Z),Z})}function C(B,K,U,X){X===void 0&&(X=1);try{var te=B.db.transaction(B.storeName,K);U(null,te)}catch(Z){if(X>0&&(!B.db||Z.name==="InvalidStateError"||Z.name==="NotFoundError"))return d.resolve().then(function(){if(!B.db||Z.name==="NotFoundError"&&!B.db.objectStoreNames.contains(B.storeName)&&B.version<=B.db.version)return B.db&&(B.version=B.db.version+1),h(B)}).then(function(){return I(B).then(function(){C(B,K,U,X-1)})}).catch(U);U(Z)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(B){var K=this,U={db:null};if(B)for(var X in B)U[X]=B[X];var te=N[U.name];te||(te=g(),N[U.name]=te),te.forages.push(K),K._initReady||(K._initReady=K.ready,K.ready=_);var Z=[];function he(){return d.resolve()}for(var ye=0;ye<te.forages.length;ye++){var xe=te.forages[ye];xe!==K&&Z.push(xe._initReady().catch(he))}var Se=te.forages.slice(0);return d.all(Z).then(function(){return U.db=te.db,D(U)}).then(function(Ee){return U.db=Ee,f(U,K._defaultConfig.version)?h(U):Ee}).then(function(Ee){U.db=te.db=Ee,K._dbInfo=U;for(var Ue=0;Ue<Se.length;Ue++){var wt=Se[Ue];wt!==K&&(wt._dbInfo.db=U.db,wt._dbInfo.version=U.version)}})}function R(B,K){var U=this;B=x(B);var X=new d(function(te,Z){U.ready().then(function(){C(U._dbInfo,F,function(he,ye){if(he)return Z(he);try{var xe=ye.objectStore(U._dbInfo.storeName),Se=xe.get(B);Se.onsuccess=function(){var Ee=Se.result;Ee===void 0&&(Ee=null),A(Ee)&&(Ee=S(Ee)),te(Ee)},Se.onerror=function(){Z(Se.error)}}catch(Ee){Z(Ee)}})}).catch(Z)});return p(X,K),X}function J(B,K){var U=this,X=new d(function(te,Z){U.ready().then(function(){C(U._dbInfo,F,function(he,ye){if(he)return Z(he);try{var xe=ye.objectStore(U._dbInfo.storeName),Se=xe.openCursor(),Ee=1;Se.onsuccess=function(){var Ue=Se.result;if(Ue){var wt=Ue.value;A(wt)&&(wt=S(wt));var Vt=B(wt,Ue.key,Ee++);Vt!==void 0?te(Vt):Ue.continue()}else te()},Se.onerror=function(){Z(Se.error)}}catch(Ue){Z(Ue)}})}).catch(Z)});return p(X,K),X}function Q(B,K,U){var X=this;B=x(B);var te=new d(function(Z,he){var ye;X.ready().then(function(){return ye=X._dbInfo,k.call(K)==="[object Blob]"?G(ye.db).then(function(xe){return xe?K:m(K)}):K}).then(function(xe){C(X._dbInfo,L,function(Se,Ee){if(Se)return he(Se);try{var Ue=Ee.objectStore(X._dbInfo.storeName);xe===null&&(xe=void 0);var wt=Ue.put(xe,B);Ee.oncomplete=function(){xe===void 0&&(xe=null),Z(xe)},Ee.onabort=Ee.onerror=function(){var Vt=wt.error?wt.error:wt.transaction.error;he(Vt)}}catch(Vt){he(Vt)}})}).catch(he)});return p(te,U),te}function ue(B,K){var U=this;B=x(B);var X=new d(function(te,Z){U.ready().then(function(){C(U._dbInfo,L,function(he,ye){if(he)return Z(he);try{var xe=ye.objectStore(U._dbInfo.storeName),Se=xe.delete(B);ye.oncomplete=function(){te()},ye.onerror=function(){Z(Se.error)},ye.onabort=function(){var Ee=Se.error?Se.error:Se.transaction.error;Z(Ee)}}catch(Ee){Z(Ee)}})}).catch(Z)});return p(X,K),X}function _e(B){var K=this,U=new d(function(X,te){K.ready().then(function(){C(K._dbInfo,L,function(Z,he){if(Z)return te(Z);try{var ye=he.objectStore(K._dbInfo.storeName),xe=ye.clear();he.oncomplete=function(){X()},he.onabort=he.onerror=function(){var Se=xe.error?xe.error:xe.transaction.error;te(Se)}}catch(Se){te(Se)}})}).catch(te)});return p(U,B),U}function de(B){var K=this,U=new d(function(X,te){K.ready().then(function(){C(K._dbInfo,F,function(Z,he){if(Z)return te(Z);try{var ye=he.objectStore(K._dbInfo.storeName),xe=ye.count();xe.onsuccess=function(){X(xe.result)},xe.onerror=function(){te(xe.error)}}catch(Se){te(Se)}})}).catch(te)});return p(U,B),U}function be(B,K){var U=this,X=new d(function(te,Z){if(B<0){te(null);return}U.ready().then(function(){C(U._dbInfo,F,function(he,ye){if(he)return Z(he);try{var xe=ye.objectStore(U._dbInfo.storeName),Se=!1,Ee=xe.openKeyCursor();Ee.onsuccess=function(){var Ue=Ee.result;if(!Ue){te(null);return}B===0||Se?te(Ue.key):(Se=!0,Ue.advance(B))},Ee.onerror=function(){Z(Ee.error)}}catch(Ue){Z(Ue)}})}).catch(Z)});return p(X,K),X}function De(B){var K=this,U=new d(function(X,te){K.ready().then(function(){C(K._dbInfo,F,function(Z,he){if(Z)return te(Z);try{var ye=he.objectStore(K._dbInfo.storeName),xe=ye.openKeyCursor(),Se=[];xe.onsuccess=function(){var Ee=xe.result;if(!Ee){X(Se);return}Se.push(Ee.key),Ee.continue()},xe.onerror=function(){te(xe.error)}}catch(Ee){te(Ee)}})}).catch(te)});return p(U,B),U}function Ne(B,K){K=y.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var X=this,te;if(!B.name)te=d.reject("Invalid arguments");else{var Z=B.name===U.name&&X._dbInfo.db,he=Z?d.resolve(X._dbInfo.db):D(B).then(function(ye){var xe=N[B.name],Se=xe.forages;xe.db=ye;for(var Ee=0;Ee<Se.length;Ee++)Se[Ee]._dbInfo.db=ye;return ye});B.storeName?te=he.then(function(ye){if(ye.objectStoreNames.contains(B.storeName)){var xe=ye.version+1;re(B);var Se=N[B.name],Ee=Se.forages;ye.close();for(var Ue=0;Ue<Ee.length;Ue++){var wt=Ee[Ue];wt._dbInfo.db=null,wt._dbInfo.version=xe}var Vt=new d(function(Ht,mr){var hr=c.open(B.name,xe);hr.onerror=function(yn){var Wa=hr.result;Wa.close(),mr(yn)},hr.onupgradeneeded=function(){var yn=hr.result;yn.deleteObjectStore(B.storeName)},hr.onsuccess=function(){var yn=hr.result;yn.close(),Ht(yn)}});return Vt.then(function(Ht){Se.db=Ht;for(var mr=0;mr<Ee.length;mr++){var hr=Ee[mr];hr._dbInfo.db=Ht,oe(hr._dbInfo)}}).catch(function(Ht){throw(ae(B,Ht)||d.resolve()).catch(function(){}),Ht})}}):te=he.then(function(ye){re(B);var xe=N[B.name],Se=xe.forages;ye.close();for(var Ee=0;Ee<Se.length;Ee++){var Ue=Se[Ee];Ue._dbInfo.db=null}var wt=new d(function(Vt,Ht){var mr=c.deleteDatabase(B.name);mr.onerror=function(){var hr=mr.result;hr&&hr.close(),Ht(mr.error)},mr.onblocked=function(){console.warn('dropInstance blocked for database "'+B.name+'" until all open connections are closed')},mr.onsuccess=function(){var hr=mr.result;hr&&hr.close(),Vt(hr)}});return wt.then(function(Vt){xe.db=Vt;for(var Ht=0;Ht<Se.length;Ht++){var mr=Se[Ht];oe(mr._dbInfo)}}).catch(function(Vt){throw(ae(B,Vt)||d.resolve()).catch(function(){}),Vt})})}return p(te,K),te}var ft={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:J,getItem:R,setItem:Q,removeItem:ue,clear:_e,length:de,key:be,keys:De,dropInstance:Ne};function dt(){return typeof openDatabase=="function"}var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,pe="__lfsc__:",Ce=pe.length,Ve="arbf",je="blob",Ae="si08",Te="ui08",$e="uic8",ct="si16",ut="si32",ze="ur16",Dt="ui32",Et="fl32",Ze="fl64",Ot=Ce+Ve.length,Ft=Object.prototype.toString;function Qe(B){var K=B.length*.75,U=B.length,X,te=0,Z,he,ye,xe;B[B.length-1]==="="&&(K--,B[B.length-2]==="="&&K--);var Se=new ArrayBuffer(K),Ee=new Uint8Array(Se);for(X=0;X<U;X+=4)Z=ke.indexOf(B[X]),he=ke.indexOf(B[X+1]),ye=ke.indexOf(B[X+2]),xe=ke.indexOf(B[X+3]),Ee[te++]=Z<<2|he>>4,Ee[te++]=(he&15)<<4|ye>>2,Ee[te++]=(ye&3)<<6|xe&63;return Se}function _t(B){var K=new Uint8Array(B),U="",X;for(X=0;X<K.length;X+=3)U+=ke[K[X]>>2],U+=ke[(K[X]&3)<<4|K[X+1]>>4],U+=ke[(K[X+1]&15)<<2|K[X+2]>>6],U+=ke[K[X+2]&63];return K.length%3===2?U=U.substring(0,U.length-1)+"=":K.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Pt(B,K){var U="";if(B&&(U=Ft.call(B)),B&&(U==="[object ArrayBuffer]"||B.buffer&&Ft.call(B.buffer)==="[object ArrayBuffer]")){var X,te=pe;B instanceof ArrayBuffer?(X=B,te+=Ve):(X=B.buffer,U==="[object Int8Array]"?te+=Ae:U==="[object Uint8Array]"?te+=Te:U==="[object Uint8ClampedArray]"?te+=$e:U==="[object Int16Array]"?te+=ct:U==="[object Uint16Array]"?te+=ze:U==="[object Int32Array]"?te+=ut:U==="[object Uint32Array]"?te+=Dt:U==="[object Float32Array]"?te+=Et:U==="[object Float64Array]"?te+=Ze:K(new Error("Failed to get type for BinaryArray"))),K(te+_t(X))}else if(U==="[object Blob]"){var Z=new FileReader;Z.onload=function(){var he=mt+B.type+"~"+_t(this.result);K(pe+je+he)},Z.readAsArrayBuffer(B)}else try{K(JSON.stringify(B))}catch(he){console.error("Couldn't convert value into a JSON string: ",B),K(null,he)}}function rt(B){if(B.substring(0,Ce)!==pe)return JSON.parse(B);var K=B.substring(Ot),U=B.substring(Ce,Ot),X;if(U===je&&we.test(K)){var te=K.match(we);X=te[1],K=K.substring(te[0].length)}var Z=Qe(K);switch(U){case Ve:return Z;case je:return l([Z],{type:X});case Ae:return new Int8Array(Z);case Te:return new Uint8Array(Z);case $e:return new Uint8ClampedArray(Z);case ct:return new Int16Array(Z);case ze:return new Uint16Array(Z);case ut:return new Int32Array(Z);case Dt:return new Uint32Array(Z);case Et:return new Float32Array(Z);case Ze:return new Float64Array(Z);default:throw new Error("Unkown type: "+U)}}var Bt={serialize:Pt,deserialize:rt,stringToBuffer:Qe,bufferToString:_t};function Rt(B,K,U,X){B.executeSql("CREATE TABLE IF NOT EXISTS "+K.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,X)}function et(B){var K=this,U={db:null};if(B)for(var X in B)U[X]=typeof B[X]!="string"?B[X].toString():B[X];var te=new d(function(Z,he){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(ye){return he(ye)}U.db.transaction(function(ye){Rt(ye,U,function(){K._dbInfo=U,Z()},function(xe,Se){he(Se)})},he)});return U.serializer=Bt,te}function xt(B,K,U,X,te,Z){B.executeSql(U,X,te,function(he,ye){ye.code===ye.SYNTAX_ERR?he.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[K.storeName],function(xe,Se){Se.rows.length?Z(xe,ye):Rt(xe,K,function(){xe.executeSql(U,X,te,Z)},Z)},Z):Z(he,ye)},Z)}function At(B,K){var U=this;B=x(B);var X=new d(function(te,Z){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(ye){xt(ye,he,"SELECT * FROM "+he.storeName+" WHERE key = ? LIMIT 1",[B],function(xe,Se){var Ee=Se.rows.length?Se.rows.item(0).value:null;Ee&&(Ee=he.serializer.deserialize(Ee)),te(Ee)},function(xe,Se){Z(Se)})})}).catch(Z)});return p(X,K),X}function Ge(B,K){var U=this,X=new d(function(te,Z){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(ye){xt(ye,he,"SELECT * FROM "+he.storeName,[],function(xe,Se){for(var Ee=Se.rows,Ue=Ee.length,wt=0;wt<Ue;wt++){var Vt=Ee.item(wt),Ht=Vt.value;if(Ht&&(Ht=he.serializer.deserialize(Ht)),Ht=B(Ht,Vt.key,wt+1),Ht!==void 0){te(Ht);return}}te()},function(xe,Se){Z(Se)})})}).catch(Z)});return p(X,K),X}function gt(B,K,U,X){var te=this;B=x(B);var Z=new d(function(he,ye){te.ready().then(function(){K===void 0&&(K=null);var xe=K,Se=te._dbInfo;Se.serializer.serialize(K,function(Ee,Ue){Ue?ye(Ue):Se.db.transaction(function(wt){xt(wt,Se,"INSERT OR REPLACE INTO "+Se.storeName+" (key, value) VALUES (?, ?)",[B,Ee],function(){he(xe)},function(Vt,Ht){ye(Ht)})},function(wt){if(wt.code===wt.QUOTA_ERR){if(X>0){he(gt.apply(te,[B,xe,U,X-1]));return}ye(wt)}})})}).catch(ye)});return p(Z,U),Z}function Nt(B,K,U){return gt.apply(this,[B,K,U,1])}function nt(B,K){var U=this;B=x(B);var X=new d(function(te,Z){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(ye){xt(ye,he,"DELETE FROM "+he.storeName+" WHERE key = ?",[B],function(){te()},function(xe,Se){Z(Se)})})}).catch(Z)});return p(X,K),X}function St(B){var K=this,U=new d(function(X,te){K.ready().then(function(){var Z=K._dbInfo;Z.db.transaction(function(he){xt(he,Z,"DELETE FROM "+Z.storeName,[],function(){X()},function(ye,xe){te(xe)})})}).catch(te)});return p(U,B),U}function zt(B){var K=this,U=new d(function(X,te){K.ready().then(function(){var Z=K._dbInfo;Z.db.transaction(function(he){xt(he,Z,"SELECT COUNT(key) as c FROM "+Z.storeName,[],function(ye,xe){var Se=xe.rows.item(0).c;X(Se)},function(ye,xe){te(xe)})})}).catch(te)});return p(U,B),U}function j(B,K){var U=this,X=new d(function(te,Z){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(ye){xt(ye,he,"SELECT key FROM "+he.storeName+" WHERE id = ? LIMIT 1",[B+1],function(xe,Se){var Ee=Se.rows.length?Se.rows.item(0).key:null;te(Ee)},function(xe,Se){Z(Se)})})}).catch(Z)});return p(X,K),X}function E(B){var K=this,U=new d(function(X,te){K.ready().then(function(){var Z=K._dbInfo;Z.db.transaction(function(he){xt(he,Z,"SELECT key FROM "+Z.storeName,[],function(ye,xe){for(var Se=[],Ee=0;Ee<xe.rows.length;Ee++)Se.push(xe.rows.item(Ee).key);X(Se)},function(ye,xe){te(xe)})})}).catch(te)});return p(U,B),U}function M(B){return new d(function(K,U){B.transaction(function(X){X.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(te,Z){for(var he=[],ye=0;ye<Z.rows.length;ye++)he.push(Z.rows.item(ye).name);K({db:B,storeNames:he})},function(te,Z){U(Z)})},function(X){U(X)})})}function $(B,K){K=y.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var X=this,te;return B.name?te=new d(function(Z){var he;B.name===U.name?he=X._dbInfo.db:he=openDatabase(B.name,"","",0),B.storeName?Z({db:he,storeNames:[B.storeName]}):Z(M(he))}).then(function(Z){return new d(function(he,ye){Z.db.transaction(function(xe){function Se(Vt){return new d(function(Ht,mr){xe.executeSql("DROP TABLE IF EXISTS "+Vt,[],function(){Ht()},function(hr,yn){mr(yn)})})}for(var Ee=[],Ue=0,wt=Z.storeNames.length;Ue<wt;Ue++)Ee.push(Se(Z.storeNames[Ue]));d.all(Ee).then(function(){he()}).catch(function(Vt){ye(Vt)})},function(xe){ye(xe)})})}):te=d.reject("Invalid arguments"),p(te,K),te}var Y={_driver:"webSQLStorage",_initStorage:et,_support:dt(),iterate:Ge,getItem:At,setItem:Nt,removeItem:nt,clear:St,length:zt,key:j,keys:E,dropInstance:$};function ee(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function ie(B,K){var U=B.name+"/";return B.storeName!==K.storeName&&(U+=B.storeName+"/"),U}function Be(){var B="_localforage_support_test";try{return localStorage.setItem(B,!0),localStorage.removeItem(B),!1}catch{return!0}}function Je(){return!Be()||localStorage.length>0}function Re(B){var K=this,U={};if(B)for(var X in B)U[X]=B[X];return U.keyPrefix=ie(B,K._defaultConfig),Je()?(K._dbInfo=U,U.serializer=Bt,d.resolve()):d.reject()}function V(B){var K=this,U=K.ready().then(function(){for(var X=K._dbInfo.keyPrefix,te=localStorage.length-1;te>=0;te--){var Z=localStorage.key(te);Z.indexOf(X)===0&&localStorage.removeItem(Z)}});return p(U,B),U}function se(B,K){var U=this;B=x(B);var X=U.ready().then(function(){var te=U._dbInfo,Z=localStorage.getItem(te.keyPrefix+B);return Z&&(Z=te.serializer.deserialize(Z)),Z});return p(X,K),X}function fe(B,K){var U=this,X=U.ready().then(function(){for(var te=U._dbInfo,Z=te.keyPrefix,he=Z.length,ye=localStorage.length,xe=1,Se=0;Se<ye;Se++){var Ee=localStorage.key(Se);if(Ee.indexOf(Z)===0){var Ue=localStorage.getItem(Ee);if(Ue&&(Ue=te.serializer.deserialize(Ue)),Ue=B(Ue,Ee.substring(he),xe++),Ue!==void 0)return Ue}}});return p(X,K),X}function Oe(B,K){var U=this,X=U.ready().then(function(){var te=U._dbInfo,Z;try{Z=localStorage.key(B)}catch{Z=null}return Z&&(Z=Z.substring(te.keyPrefix.length)),Z});return p(X,K),X}function He(B){var K=this,U=K.ready().then(function(){for(var X=K._dbInfo,te=localStorage.length,Z=[],he=0;he<te;he++){var ye=localStorage.key(he);ye.indexOf(X.keyPrefix)===0&&Z.push(ye.substring(X.keyPrefix.length))}return Z});return p(U,B),U}function Pe(B){var K=this,U=K.keys().then(function(X){return X.length});return p(U,B),U}function Fe(B,K){var U=this;B=x(B);var X=U.ready().then(function(){var te=U._dbInfo;localStorage.removeItem(te.keyPrefix+B)});return p(X,K),X}function st(B,K,U){var X=this;B=x(B);var te=X.ready().then(function(){K===void 0&&(K=null);var Z=K;return new d(function(he,ye){var xe=X._dbInfo;xe.serializer.serialize(K,function(Se,Ee){if(Ee)ye(Ee);else try{localStorage.setItem(xe.keyPrefix+B,Se),he(Z)}catch(Ue){(Ue.name==="QuotaExceededError"||Ue.name==="NS_ERROR_DOM_QUOTA_REACHED")&&ye(Ue),ye(Ue)}})})});return p(te,U),te}function er(B,K){if(K=y.apply(this,arguments),B=typeof B!="function"&&B||{},!B.name){var U=this.config();B.name=B.name||U.name,B.storeName=B.storeName||U.storeName}var X=this,te;return B.name?te=new d(function(Z){B.storeName?Z(ie(B,X._defaultConfig)):Z(B.name+"/")}).then(function(Z){for(var he=localStorage.length-1;he>=0;he--){var ye=localStorage.key(he);ye.indexOf(Z)===0&&localStorage.removeItem(ye)}}):te=d.reject("Invalid arguments"),p(te,K),te}var Lt={_driver:"localStorageWrapper",_initStorage:Re,_support:ee(),iterate:fe,getItem:se,setItem:st,removeItem:Fe,clear:V,length:Pe,key:Oe,keys:He,dropInstance:er},Ut=function(K,U){return K===U||typeof K=="number"&&typeof U=="number"&&isNaN(K)&&isNaN(U)},lr=function(K,U){for(var X=K.length,te=0;te<X;){if(Ut(K[te],U))return!0;te++}return!1},Or=Array.isArray||function(B){return Object.prototype.toString.call(B)==="[object Array]"},dr={},tr={},Er={INDEXEDDB:ft,WEBSQL:Y,LOCALSTORAGE:Lt},Dn=[Er.INDEXEDDB._driver,Er.WEBSQL._driver,Er.LOCALSTORAGE._driver],Yr=["dropInstance"],Bn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Yr),Ni={description:"",driver:Dn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ji(B,K){B[K]=function(){var U=arguments;return B.ready().then(function(){return B[K].apply(B,U)})}}function Ln(){for(var B=1;B<arguments.length;B++){var K=arguments[B];if(K)for(var U in K)K.hasOwnProperty(U)&&(Or(K[U])?arguments[0][U]=K[U].slice():arguments[0][U]=K[U])}return arguments[0]}var ki=function(){function B(K){s(this,B);for(var U in Er)if(Er.hasOwnProperty(U)){var X=Er[U],te=X._driver;this[U]=te,dr[te]||this.defineDriver(X)}this._defaultConfig=Ln({},Ni),this._config=Ln({},this._defaultConfig,K),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return B.prototype.config=function(U){if((typeof U>"u"?"undefined":o(U))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var X in U){if(X==="storeName"&&(U[X]=U[X].replace(/\W/g,"_")),X==="version"&&typeof U[X]!="number")return new Error("Database version must be a number.");this._config[X]=U[X]}return"driver"in U&&U.driver?this.setDriver(this._config.driver):!0}else return typeof U=="string"?this._config[U]:this._config},B.prototype.defineDriver=function(U,X,te){var Z=new d(function(he,ye){try{var xe=U._driver,Se=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){ye(Se);return}for(var Ee=Bn.concat("_initStorage"),Ue=0,wt=Ee.length;Ue<wt;Ue++){var Vt=Ee[Ue],Ht=!lr(Yr,Vt);if((Ht||U[Vt])&&typeof U[Vt]!="function"){ye(Se);return}}var mr=function(){for(var Wa=function(VB){return function(){var zB=new Error("Method "+VB+" is not implemented by the current driver"),J2=d.reject(zB);return p(J2,arguments[arguments.length-1]),J2}},Xh=0,UB=Yr.length;Xh<UB;Xh++){var Jh=Yr[Xh];U[Jh]||(U[Jh]=Wa(Jh))}};mr();var hr=function(Wa){dr[xe]&&console.info("Redefining LocalForage driver: "+xe),dr[xe]=U,tr[xe]=Wa,he()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(hr,ye):hr(!!U._support):hr(!0)}catch(yn){ye(yn)}});return b(Z,X,te),Z},B.prototype.driver=function(){return this._driver||null},B.prototype.getDriver=function(U,X,te){var Z=dr[U]?d.resolve(dr[U]):d.reject(new Error("Driver not found."));return b(Z,X,te),Z},B.prototype.getSerializer=function(U){var X=d.resolve(Bt);return b(X,U),X},B.prototype.ready=function(U){var X=this,te=X._driverSet.then(function(){return X._ready===null&&(X._ready=X._initDriver()),X._ready});return b(te,U,U),te},B.prototype.setDriver=function(U,X,te){var Z=this;Or(U)||(U=[U]);var he=this._getSupportedDrivers(U);function ye(){Z._config.driver=Z.driver()}function xe(Ue){return Z._extend(Ue),ye(),Z._ready=Z._initStorage(Z._config),Z._ready}function Se(Ue){return function(){var wt=0;function Vt(){for(;wt<Ue.length;){var Ht=Ue[wt];return wt++,Z._dbInfo=null,Z._ready=null,Z.getDriver(Ht).then(xe).catch(Vt)}ye();var mr=new Error("No available storage method found.");return Z._driverSet=d.reject(mr),Z._driverSet}return Vt()}}var Ee=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=Ee.then(function(){var Ue=he[0];return Z._dbInfo=null,Z._ready=null,Z.getDriver(Ue).then(function(wt){Z._driver=wt._driver,ye(),Z._wrapLibraryMethodsWithReady(),Z._initDriver=Se(he)})}).catch(function(){ye();var Ue=new Error("No available storage method found.");return Z._driverSet=d.reject(Ue),Z._driverSet}),b(this._driverSet,X,te),this._driverSet},B.prototype.supports=function(U){return!!tr[U]},B.prototype._extend=function(U){Ln(this,U)},B.prototype._getSupportedDrivers=function(U){for(var X=[],te=0,Z=U.length;te<Z;te++){var he=U[te];this.supports(he)&&X.push(he)}return X},B.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,X=Bn.length;U<X;U++)ji(this,Bn[U])},B.prototype.createInstance=function(U){return new B(U)},B}(),Di=new ki;n.exports=Di},{3:3}]},{},[4])(4)})})(W1);var PA=W1.exports;const wa=Us(PA);wa.config({name:"CetusSite",storeName:"tokens"});class Ci{static async setItem(t,r){try{await wa.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await wa.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await wa.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await wa.clear()}catch(t){console.error("Failed to clear storage",t)}}}const tu=[{name:"SuiVision",link:"https://suivision.xyz",img:It("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:It("/images/logo_suiscan@2x.png"),isCustom:!1}],ru=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],RA=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],ps={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],NA="0x45f3c0814d7be4aa5fbd32d7e3c40f3c062a2b63eaf5ec4f8c1539b5987b11af",jA=It("/images/birdeye-logo.png"),kA=It("/images/img-logo@2x.png"),DA=It("/images/logo_CoinGecko@2x.png"),BA=It("/images/logo_pyth.png");var ba=(e=>(e.CETUS="CETUS",e.KRIYA="KRIYA",e.KRIYAV3="KRIYAV3",e.FLOWX="FLOWX",e.FLOWXV3="FLOWXV3",e.AFTERMATH="AFTERMATH",e.HAEDAL="HAEDAL",e.VOLO="VOLO",e.AFSUI="AFSUI",e.DEEPBOOKV3="DEEPBOOKV3",e.SCALLOP="SCALLOP",e.BLUEMOVE="BLUEMOVE",e.TURBOS="TURBOS",e.SPRINGSUI="SPRINGSUI",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e.ALPHAFI="ALPHAFI",e.STEAMM="STEAMM",e.OBRIC="OBRIC",e.METASTABLE="METASTABLE",e))(ba||{});const G1={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},LA={pyth:BA,coingecko:DA,birdeye:jA,Cetus:kA},ur={CETUS:It("/images/aggregator-source/cetus.png"),KRIYA:It("/images/aggregator-source/kriya.png"),FLOWX:It("/images/aggregator-source/flowx.png"),AFTERMATH:It("/images/aggregator-source/aftermath.png"),TURBOS:It("/images/aggregator-source/turbos.png"),HAEDAL:It("/images/aggregator-source/haedal.png"),VOLO:It("/images/aggregator-source/volo.png"),AFSUI:It("/images/aggregator-source/aftermath.png"),BLUEMOVE:It("/images/aggregator-source/bluemove.png"),KRIYAV3:It("/images/aggregator-source/kriya.png"),FLOWXV3:It("/images/aggregator-source/flowx.png"),DEEPBOOKV3:It("/images/aggregator-source/deepbook.png"),SCALLOP:It("/images/aggregator-source/scallop.png"),SPRINGSUI:It("/images/aggregator-source/suilend.png"),BLUEFIN:It("/images/aggregator-source/bluefin.png"),HAEDALPMM:It("/images/aggregator-source/haedal.png"),ALPHAFI:It("/images/aggregator-source/stSui.png"),STEAMM:It("/images/aggregator-source/steamm.png"),OBRIC:It("/images/aggregator-source/obric.png"),METASTABLE:It("/images/aggregator-source/metastable.png")},K1={CETUS:{name:"Cetus",id:"CETUS",logo:ur.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:ur.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:ur.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:ur.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:ur.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:ur.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:ur.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:ur.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:ur.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:ur.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:ur.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:ur.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:ur.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:ur.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:ur.SCALLOP,type:"other",sort:70},SPRINGSUI:{name:"SpringSui",id:"SPRINGSUI",logo:ur.SPRINGSUI,type:"other",sort:60},ALPHAFI:{name:"stSUI",id:"ALPHAFI",logo:ur.ALPHAFI,type:"other",sort:50},STEAMM:{name:"STEAMM",id:"STEAMM",logo:ur.STEAMM,sort:78,type:"dex"},METASTABLE:{name:"Metastable",id:"METASTABLE",logo:ur.METASTABLE,sort:77,type:"dex"},OBRIC:{name:"Obric",id:"OBRIC",logo:ur.OBRIC,sort:76,type:"dex"}},Y1=e=>{let t;const r=new Set,n=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(b=>b(t,p))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,i,a);return a},$A=e=>e?Y1(e):Y1,FA=e=>e;function UA(e,t=FA){const r=ne.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return ne.useDebugValue(r),r}const Z1=e=>{const t=$A(e),r=n=>UA(t,n);return Object.assign(r,t),r},Ai=e=>e?Z1(e):Z1;function VA(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var o;const s=c=>c===null?null:JSON.parse(c,t==null?void 0:t.reviver),a=(o=r.getItem(i))!=null?o:null;return a instanceof Promise?a.then(s):s(a)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const xd=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return xd(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return xd(n)(r)}}}},Fr=Ai(((e,t)=>(r,n,i)=>{let o={storage:VA(()=>localStorage),partialize:y=>y,version:0,merge:(y,T)=>({...T,...y}),...t},s=!1;const a=new Set,c=new Set;let u=o.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...y)},n,i);const l=()=>{const y=o.partialize({...n()});return u.setItem(o.name,{state:y,version:o.version})},d=i.setState;i.setState=(y,T)=>{d(y,T),l()};const p=e((...y)=>{r(...y),l()},n,i);i.getInitialState=()=>p;let b;const x=()=>{var y,T;if(!u)return;s=!1,a.forEach(N=>{var k;return N((k=n())!=null?k:p)});const O=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(y=n())!=null?y:p))||void 0;return xd(u.getItem.bind(u))(o.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==o.version){if(o.migrate){const k=o.migrate(N.state,N.version);return k instanceof Promise?k.then(F=>[!0,F]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var k;const[F,L]=N;if(b=o.merge(L,(k=n())!=null?k:p),r(b,!0),F)return l()}).then(()=>{O==null||O(b,void 0),b=n(),s=!0,c.forEach(N=>N(b))}).catch(N=>{O==null||O(void 0,N)})};return i.persist={setOptions:y=>{o={...o,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},o.skipHydration||x(),b||p})((e,t)=>({ignoreWarnTokenMap:{},currentExplorer:tu[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:ru,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:ru[0],customRpc:"",setCurrentRpc:r=>{e(()=>({currentRpc:r}))},setCustomRpc:r=>{e(()=>({customRpc:r}))},slippage:"0.5",setSlippage:r=>{e(()=>({slippage:r}))},isOpenSlippageDialog:!1,setIsOpenSlippageDialog:r=>{e(()=>({isOpenSlippageDialog:r}))},providers:Object.values(ba),setProviders:r=>{e(()=>({providers:r}))},poolApiMap:{},setPoolApiMap:(r,n)=>{const i=t().poolApiMap;i[r]=n,e(()=>({poolApiMap:{...i}}))},mevProtect:!0,setMevProtect:r=>{e(()=>({mevProtect:r}))},setIgnoreWarnToken:r=>{const n=t().ignoreWarnTokenMap;n[Ei(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:o,mevProtect:s,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:o,mevProtect:s,ignoreWarnTokenMap:a}}}));function ms(){const{currentExplorer:e}=Fr();return{getExplorerUrl:(r,n="account",i=e)=>{let o;return i.includes("suivision")?o=`${i}/${HA(n)}/${r}`:o=`${i}/${zA(n)}/${r}`,o}}}const zA=e=>{switch(e){case"account":return"address";case"token":return"object";case"tx":return"tx";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}},HA=e=>{switch(e){case"account":return"account";case"token":return"object";case"tx":return"txblock";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}};function X1(e){const{text:t,keywords:r,onKeywordClick:n,text_highlight_color:i="var(--cs-primary)",text_size:o="12px",text_color:s="var(--cs-btn-disabled-text)"}=e,a=new RegExp(`(${r.join("|")})`,"gi"),c=t.split(a);return w.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const d=r.includes(u);return w.jsx("span",{style:{lineHeight:"20px",fontSize:o,color:d?i:s,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var J1={exports:{}};/*!
46
46
  Copyright (c) 2018 Jed Watson.
47
47
  Licensed under the MIT License (MIT), see
48
48
  http://jedwatson.github.io/classnames
49
- */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,n(a)))}return o}function n(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return r.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(O1);var I5=O1.exports;const Xt=Bs(I5);function Xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function O5(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Zc(...e){return t=>e.forEach(r=>O5(r,t))}function rr(...e){return P.useCallback(Zc(...e),e)}function fs(e,t=[]){let r=[];function n(o,s){const a=P.createContext(s),c=r.length;r=[...r,s];const u=d=>{var O;const{scope:p,children:w,...b}=d,y=((O=p==null?void 0:p[e])==null?void 0:O[c])||a,T=P.useMemo(()=>b,Object.values(b));return x.jsx(y.Provider,{value:T,children:w})};u.displayName=o+"Provider";function l(d,p){var y;const w=((y=p==null?void 0:p[e])==null?void 0:y[c])||a,b=P.useContext(w);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[u,l]}const i=()=>{const o=r.map(s=>P.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,P5(i,...t)]}function P5(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((a,{useScope:c,scopeName:u})=>{const d=c(o)[`__scope${u}`];return{...a,...d}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var _i=P.forwardRef((e,t)=>{const{children:r,...n}=e,i=P.Children.toArray(r),o=i.find(R5);if(o){const s=o.props.children,a=i.map(c=>c===o?P.Children.count(s)>1?P.Children.only(null):P.isValidElement(s)?s.props.children:null:c);return x.jsx(dd,{...n,ref:t,children:P.isValidElement(s)?P.cloneElement(s,void 0,a):null})}return x.jsx(dd,{...n,ref:t,children:r})});_i.displayName="Slot";var dd=P.forwardRef((e,t)=>{const{children:r,...n}=e;if(P.isValidElement(r)){const i=j5(r);return P.cloneElement(r,{...N5(n,r.props),ref:t?Zc(t,i):i})}return P.Children.count(r)>1?P.Children.only(null):null});dd.displayName="SlotClone";var ds=({children:e})=>x.jsx(x.Fragment,{children:e});function R5(e){return P.isValidElement(e)&&e.type===ds}function N5(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...a)=>{o(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function j5(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var k5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Yt=k5.reduce((e,t)=>{const r=P.forwardRef((n,i)=>{const{asChild:o,...s}=n,a=o?_i:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(a,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function P1(e,t){e&&qh.flushSync(()=>e.dispatchEvent(t))}function br(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function D5(e,t=globalThis==null?void 0:globalThis.document){const r=br(e);P.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var B5="DismissableLayer",hd="dismissableLayer.update",L5="dismissableLayer.pointerDownOutside",$5="dismissableLayer.focusOutside",R1,N1=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pd=P.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...c}=e,u=P.useContext(N1),[l,d]=P.useState(null),p=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=P.useState({}),b=rr(t,H=>d(H)),y=Array.from(u.layers),[T]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),O=y.indexOf(T),R=l?y.indexOf(l):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,F=R>=O,L=V5(H=>{const K=H.target,re=[...u.branches].some(oe=>oe.contains(K));!F||re||(i==null||i(H),s==null||s(H),H.defaultPrevented||a==null||a())},p),q=z5(H=>{const K=H.target;[...u.branches].some(oe=>oe.contains(K))||(o==null||o(H),s==null||s(H),H.defaultPrevented||a==null||a())},p);return D5(H=>{R===u.layers.size-1&&(n==null||n(H),!H.defaultPrevented&&a&&(H.preventDefault(),a()))},p),P.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(R1=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),j1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=R1)}},[l,p,r,u]),P.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),j1())},[l,u]),P.useEffect(()=>{const H=()=>w({});return document.addEventListener(hd,H),()=>document.removeEventListener(hd,H)},[]),x.jsx(Yt.div,{...c,ref:b,style:{pointerEvents:k?F?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,q.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,q.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,L.onPointerDownCapture)})});pd.displayName=B5;var F5="DismissableLayerBranch",U5=P.forwardRef((e,t)=>{const r=P.useContext(N1),n=P.useRef(null),i=rr(t,n);return P.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),x.jsx(Yt.div,{...e,ref:i})});U5.displayName=F5;function V5(e,t=globalThis==null?void 0:globalThis.document){const r=br(e),n=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){k1(L5,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function z5(e,t=globalThis==null?void 0:globalThis.document){const r=br(e),n=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!n.current&&k1($5,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function j1(){const e=new CustomEvent(hd);document.dispatchEvent(e)}function k1(e,t,r,{discrete:n}){const i=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?P1(i,o):i.dispatchEvent(o)}var Gi=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},H5=P["useId".toString()]||(()=>{}),q5=0;function ga(e){const[t,r]=P.useState(H5());return Gi(()=>{e||r(n=>n??String(q5++))},[e]),e||(t?`radix-${t}`:"")}const W5=["top","right","bottom","left"],Ki=Math.min,en=Math.max,Xc=Math.round,Jc=Math.floor,Yn=e=>({x:e,y:e}),G5={left:"right",right:"left",bottom:"top",top:"bottom"},K5={start:"end",end:"start"};function md(e,t,r){return en(e,Ki(t,r))}function Ci(e,t){return typeof e=="function"?e(t):e}function Mi(e){return e.split("-")[0]}function hs(e){return e.split("-")[1]}function gd(e){return e==="x"?"y":"x"}function vd(e){return e==="y"?"height":"width"}function Yi(e){return["top","bottom"].includes(Mi(e))?"y":"x"}function yd(e){return gd(Yi(e))}function Y5(e,t,r){r===void 0&&(r=!1);const n=hs(e),i=yd(e),o=vd(i);let s=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Qc(s)),[s,Qc(s)]}function Z5(e){const t=Qc(e);return[wd(e),t,wd(t)]}function wd(e){return e.replace(/start|end/g,t=>K5[t])}function X5(e,t,r){const n=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?o:s;default:return[]}}function J5(e,t,r,n){const i=hs(e);let o=X5(Mi(e),r==="start",n);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(wd)))),o}function Qc(e){return e.replace(/left|right|bottom|top/g,t=>G5[t])}function Q5(e){return{top:0,right:0,bottom:0,left:0,...e}}function D1(e){return typeof e!="number"?Q5(e):{top:e,right:e,bottom:e,left:e}}function eu(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function B1(e,t,r){let{reference:n,floating:i}=e;const o=Yi(t),s=yd(t),a=vd(s),c=Mi(t),u=o==="y",l=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[a]/2-i[a]/2;let w;switch(c){case"top":w={x:l,y:n.y-i.height};break;case"bottom":w={x:l,y:n.y+n.height};break;case"right":w={x:n.x+n.width,y:d};break;case"left":w={x:n.x-i.width,y:d};break;default:w={x:n.x,y:n.y}}switch(hs(t)){case"start":w[s]-=p*(r&&u?-1:1);break;case"end":w[s]+=p*(r&&u?-1:1);break}return w}const eM=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:s}=r,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:d}=B1(u,n,c),p=n,w={},b=0;for(let y=0;y<a.length;y++){const{name:T,fn:O}=a[y],{x:R,y:k,data:F,reset:L}=await O({x:l,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:w,rects:u,platform:s,elements:{reference:e,floating:t}});l=R??l,d=k??d,w={...w,[T]:{...w[T],...F}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(u=L.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:d}=B1(u,p,c)),y=-1)}return{x:l,y:d,placement:p,strategy:i,middlewareData:w}};async function va(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:w=0}=Ci(t,e),b=D1(w),T=a[p?d==="floating"?"reference":"floating":d],O=eu(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(T)))==null||r?T:T.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),R=d==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),F=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},L=eu(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:k,strategy:c}):R);return{top:(O.top-L.top+b.top)/F.y,bottom:(L.bottom-O.bottom+b.bottom)/F.y,left:(O.left-L.left+b.left)/F.x,right:(L.right-O.right+b.right)/F.x}}const tM=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Ci(e,t)||{};if(u==null)return{};const d=D1(l),p={x:r,y:n},w=yd(i),b=vd(w),y=await s.getDimensions(u),T=w==="y",O=T?"top":"left",R=T?"bottom":"right",k=T?"clientHeight":"clientWidth",F=o.reference[b]+o.reference[w]-p[w]-o.floating[b],L=p[w]-o.reference[w],q=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let H=q?q[k]:0;(!H||!await(s.isElement==null?void 0:s.isElement(q)))&&(H=a.floating[k]||o.floating[b]);const K=F/2-L/2,re=H/2-y[b]/2-1,oe=Ki(d[O],re),ae=Ki(d[R],re),z=oe,D=H-y[b]-ae,h=H/2-y[b]/2+K,f=md(z,h,D),m=!c.arrow&&hs(i)!=null&&h!==f&&o.reference[b]/2-(h<z?oe:ae)-y[b]/2<0,S=m?h<z?h-z:h-D:0;return{[w]:p[w]+S,data:{[w]:f,centerOffset:h-f-S,...m&&{alignmentOffset:S}},reset:m}}}),rM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...T}=Ci(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const O=Mi(i),R=Yi(a),k=Mi(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=p||(k||!y?[Qc(a)]:Z5(a)),q=b!=="none";!p&&q&&L.push(...J5(a,y,b,F));const H=[a,...L],K=await va(t,T),re=[];let oe=((n=o.flip)==null?void 0:n.overflows)||[];if(l&&re.push(K[O]),d){const h=Y5(i,s,F);re.push(K[h[0]],K[h[1]])}if(oe=[...oe,{placement:i,overflows:re}],!re.every(h=>h<=0)){var ae,z;const h=(((ae=o.flip)==null?void 0:ae.index)||0)+1,f=H[h];if(f)return{data:{index:h,overflows:oe},reset:{placement:f}};let m=(z=oe.filter(S=>S.overflows[0]<=0).sort((S,M)=>S.overflows[1]-M.overflows[1])[0])==null?void 0:z.placement;if(!m)switch(w){case"bestFit":{var D;const S=(D=oe.filter(M=>{if(q){const _=Yi(M.placement);return _===R||_==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(_=>_>0).reduce((_,I)=>_+I,0)]).sort((M,_)=>M[1]-_[1])[0])==null?void 0:D[0];S&&(m=S);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function L1(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function $1(e){return W5.some(t=>e[t]>=0)}const nM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ci(e,t);switch(n){case"referenceHidden":{const o=await va(t,{...i,elementContext:"reference"}),s=L1(o,r.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:$1(s)}}}case"escaped":{const o=await va(t,{...i,altBoundary:!0}),s=L1(o,r.floating);return{data:{escapedOffsets:s,escaped:$1(s)}}}default:return{}}}}};async function iM(e,t){const{placement:r,platform:n,elements:i}=e,o=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=Mi(r),a=hs(r),c=Yi(r)==="y",u=["left","top"].includes(s)?-1:1,l=o&&c?-1:1,d=Ci(t,e);let{mainAxis:p,crossAxis:w,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof b=="number"&&(w=a==="end"?b*-1:b),c?{x:w*l,y:p*u}:{x:p*u,y:w*l}}const oM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await iM(t,e);return s===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},sM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:T=>{let{x:O,y:R}=T;return{x:O,y:R}}},...c}=Ci(e,t),u={x:r,y:n},l=await va(t,c),d=Yi(Mi(i)),p=gd(d);let w=u[p],b=u[d];if(o){const T=p==="y"?"top":"left",O=p==="y"?"bottom":"right",R=w+l[T],k=w-l[O];w=md(R,w,k)}if(s){const T=d==="y"?"top":"left",O=d==="y"?"bottom":"right",R=b+l[T],k=b-l[O];b=md(R,b,k)}const y=a.fn({...t,[p]:w,[d]:b});return{...y,data:{x:y.x-r,y:y.y-n,enabled:{[p]:o,[d]:s}}}}}},aM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ci(e,t),l={x:r,y:n},d=Yi(i),p=gd(d);let w=l[p],b=l[d];const y=Ci(a,t),T=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const k=p==="y"?"height":"width",F=o.reference[p]-o.floating[k]+T.mainAxis,L=o.reference[p]+o.reference[k]-T.mainAxis;w<F?w=F:w>L&&(w=L)}if(u){var O,R;const k=p==="y"?"width":"height",F=["top","left"].includes(Mi(i)),L=o.reference[d]-o.floating[k]+(F&&((O=s.offset)==null?void 0:O[d])||0)+(F?0:T.crossAxis),q=o.reference[d]+o.reference[k]+(F?0:((R=s.offset)==null?void 0:R[d])||0)-(F?T.crossAxis:0);b<L?b=L:b>q&&(b=q)}return{[p]:w,[d]:b}}}},cM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:c=()=>{},...u}=Ci(e,t),l=await va(t,u),d=Mi(i),p=hs(i),w=Yi(i)==="y",{width:b,height:y}=o.floating;let T,O;d==="top"||d==="bottom"?(T=d,O=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(O=d,T=p==="end"?"top":"bottom");const R=y-l.top-l.bottom,k=b-l.left-l.right,F=Ki(y-l[T],R),L=Ki(b-l[O],k),q=!t.middlewareData.shift;let H=F,K=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(K=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(H=R),q&&!p){const oe=en(l.left,0),ae=en(l.right,0),z=en(l.top,0),D=en(l.bottom,0);w?K=b-2*(oe!==0||ae!==0?oe+ae:en(l.left,l.right)):H=y-2*(z!==0||D!==0?z+D:en(l.top,l.bottom))}await c({...t,availableWidth:K,availableHeight:H});const re=await s.getDimensions(a.floating);return b!==re.width||y!==re.height?{reset:{rects:!0}}:{}}}};function tu(){return typeof window<"u"}function ps(e){return F1(e)?(e.nodeName||"").toLowerCase():"#document"}function tn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zn(e){var t;return(t=(F1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function F1(e){return tu()?e instanceof Node||e instanceof tn(e).Node:!1}function Tn(e){return tu()?e instanceof Element||e instanceof tn(e).Element:!1}function Xn(e){return tu()?e instanceof HTMLElement||e instanceof tn(e).HTMLElement:!1}function U1(e){return!tu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof tn(e).ShadowRoot}function ya(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=In(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function uM(e){return["table","td","th"].includes(ps(e))}function ru(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function bd(e){const t=xd(),r=Tn(e)?In(e):e;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function lM(e){let t=Zi(e);for(;Xn(t)&&!ms(t);){if(bd(t))return t;if(ru(t))return null;t=Zi(t)}return null}function xd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ms(e){return["html","body","#document"].includes(ps(e))}function In(e){return tn(e).getComputedStyle(e)}function nu(e){return Tn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zi(e){if(ps(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U1(e)&&e.host||Zn(e);return U1(t)?t.host:t}function V1(e){const t=Zi(e);return ms(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xn(t)&&ya(t)?t:V1(t)}function wa(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=V1(e),o=i===((n=e.ownerDocument)==null?void 0:n.body),s=tn(i);if(o){const a=Sd(s);return t.concat(s,s.visualViewport||[],ya(i)?i:[],a&&r?wa(a):[])}return t.concat(i,wa(i,[],r))}function Sd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z1(e){const t=In(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Xn(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=Xc(r)!==o||Xc(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function Ed(e){return Tn(e)?e:e.contextElement}function gs(e){const t=Ed(e);if(!Xn(t))return Yn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=z1(t);let s=(o?Xc(r.width):r.width)/n,a=(o?Xc(r.height):r.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const fM=Yn(0);function H1(e){const t=tn(e);return!xd()||!t.visualViewport?fM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dM(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==tn(e)?!1:t}function _o(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),o=Ed(e);let s=Yn(1);t&&(n?Tn(n)&&(s=gs(n)):s=gs(e));const a=dM(o,r,n)?H1(o):Yn(0);let c=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,l=i.width/s.x,d=i.height/s.y;if(o){const p=tn(o),w=n&&Tn(n)?tn(n):n;let b=p,y=Sd(b);for(;y&&n&&w!==b;){const T=gs(y),O=y.getBoundingClientRect(),R=In(y),k=O.left+(y.clientLeft+parseFloat(R.paddingLeft))*T.x,F=O.top+(y.clientTop+parseFloat(R.paddingTop))*T.y;c*=T.x,u*=T.y,l*=T.x,d*=T.y,c+=k,u+=F,b=tn(y),y=Sd(b)}}return eu({width:l,height:d,x:c,y:u})}function _d(e,t){const r=nu(e).scrollLeft;return t?t.left+r:_o(Zn(e)).left+r}function q1(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:_d(e,n)),o=n.top+t.scrollTop;return{x:i,y:o}}function hM(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o=i==="fixed",s=Zn(n),a=t?ru(t.floating):!1;if(n===s||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Yn(1);const l=Yn(0),d=Xn(n);if((d||!d&&!o)&&((ps(n)!=="body"||ya(s))&&(c=nu(n)),Xn(n))){const w=_o(n);u=gs(n),l.x=w.x+n.clientLeft,l.y=w.y+n.clientTop}const p=s&&!d&&!o?q1(s,c,!0):Yn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+p.x,y:r.y*u.y-c.scrollTop*u.y+l.y+p.y}}function pM(e){return Array.from(e.getClientRects())}function mM(e){const t=Zn(e),r=nu(e),n=e.ownerDocument.body,i=en(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=en(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+_d(e);const a=-r.scrollTop;return In(n).direction==="rtl"&&(s+=en(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}function gM(e,t){const r=tn(e),n=Zn(e),i=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const u=xd();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function vM(e,t){const r=_o(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=Xn(e)?gs(e):Yn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,u=n*o.y;return{width:s,height:a,x:c,y:u}}function W1(e,t,r){let n;if(t==="viewport")n=gM(e,r);else if(t==="document")n=mM(Zn(e));else if(Tn(t))n=vM(t,r);else{const i=H1(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return eu(n)}function G1(e,t){const r=Zi(e);return r===t||!Tn(r)||ms(r)?!1:In(r).position==="fixed"||G1(r,t)}function yM(e,t){const r=t.get(e);if(r)return r;let n=wa(e,[],!1).filter(a=>Tn(a)&&ps(a)!=="body"),i=null;const o=In(e).position==="fixed";let s=o?Zi(e):e;for(;Tn(s)&&!ms(s);){const a=In(s),c=bd(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||ya(s)&&!c&&G1(e,s))?n=n.filter(l=>l!==s):i=a,s=Zi(s)}return t.set(e,n),n}function wM(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const s=[...r==="clippingAncestors"?ru(t)?[]:yM(t,this._c):[].concat(r),n],a=s[0],c=s.reduce((u,l)=>{const d=W1(t,l,i);return u.top=en(d.top,u.top),u.right=Ki(d.right,u.right),u.bottom=Ki(d.bottom,u.bottom),u.left=en(d.left,u.left),u},W1(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function bM(e){const{width:t,height:r}=z1(e);return{width:t,height:r}}function xM(e,t,r){const n=Xn(t),i=Zn(t),o=r==="fixed",s=_o(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Yn(0);if(n||!n&&!o)if((ps(t)!=="body"||ya(i))&&(a=nu(t)),n){const p=_o(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=_d(i));const u=i&&!n&&!o?q1(i,a):Yn(0),l=s.left+a.scrollLeft-c.x-u.x,d=s.top+a.scrollTop-c.y-u.y;return{x:l,y:d,width:s.width,height:s.height}}function Cd(e){return In(e).position==="static"}function K1(e,t){if(!Xn(e)||In(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Zn(e)===r&&(r=r.ownerDocument.body),r}function Y1(e,t){const r=tn(e);if(ru(e))return r;if(!Xn(e)){let i=Zi(e);for(;i&&!ms(i);){if(Tn(i)&&!Cd(i))return i;i=Zi(i)}return r}let n=K1(e,t);for(;n&&uM(n)&&Cd(n);)n=K1(n,t);return n&&ms(n)&&Cd(n)&&!bd(n)?r:n||lM(e)||r}const SM=async function(e){const t=this.getOffsetParent||Y1,r=this.getDimensions,n=await r(e.floating);return{reference:xM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function EM(e){return In(e).direction==="rtl"}const _M={convertOffsetParentRelativeRectToViewportRelativeRect:hM,getDocumentElement:Zn,getClippingRect:wM,getOffsetParent:Y1,getElementRects:SM,getClientRects:pM,getDimensions:bM,getScale:gs,isElement:Tn,isRTL:EM};function CM(e,t){let r=null,n;const i=Zn(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:u,top:l,width:d,height:p}=e.getBoundingClientRect();if(a||t(),!d||!p)return;const w=Jc(l),b=Jc(i.clientWidth-(u+d)),y=Jc(i.clientHeight-(l+p)),T=Jc(u),R={rootMargin:-w+"px "+-b+"px "+-y+"px "+-T+"px",threshold:en(0,Ki(1,c))||1};let k=!0;function F(L){const q=L[0].intersectionRatio;if(q!==c){if(!k)return s();q?s(!1,q):n=setTimeout(()=>{s(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(F,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,R)}r.observe(e)}return s(!0),o}function MM(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Ed(e),l=i||o?[...u?wa(u):[],...wa(t)]:[];l.forEach(O=>{i&&O.addEventListener("scroll",r,{passive:!0}),o&&O.addEventListener("resize",r)});const d=u&&a?CM(u,r):null;let p=-1,w=null;s&&(w=new ResizeObserver(O=>{let[R]=O;R&&R.target===u&&w&&(w.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=w)==null||k.observe(t)})),r()}),u&&!c&&w.observe(u),w.observe(t));let b,y=c?_o(e):null;c&&T();function T(){const O=_o(e);y&&(O.x!==y.x||O.y!==y.y||O.width!==y.width||O.height!==y.height)&&r(),y=O,b=requestAnimationFrame(T)}return r(),()=>{var O;l.forEach(R=>{i&&R.removeEventListener("scroll",r),o&&R.removeEventListener("resize",r)}),d==null||d(),(O=w)==null||O.disconnect(),w=null,c&&cancelAnimationFrame(b)}}const AM=oM,TM=sM,IM=rM,OM=cM,PM=nM,Z1=tM,RM=aM,NM=(e,t,r)=>{const n=new Map,i={platform:_M,...r},o={...i.platform,_c:n};return eM(e,t,{...i,platform:o})};var iu=typeof document<"u"?te.useLayoutEffect:te.useEffect;function ou(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!ou(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){const o=i[n];if(!(o==="_owner"&&e.$$typeof)&&!ou(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function X1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function J1(e,t){const r=X1(e);return Math.round(t*r)/r}function Md(e){const t=P.useRef(e);return iu(()=>{t.current=e}),t}function jM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,d]=P.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,w]=P.useState(n);ou(p,n)||w(n);const[b,y]=P.useState(null),[T,O]=P.useState(null),R=P.useCallback(M=>{M!==q.current&&(q.current=M,y(M))},[]),k=P.useCallback(M=>{M!==H.current&&(H.current=M,O(M))},[]),F=o||b,L=s||T,q=P.useRef(null),H=P.useRef(null),K=P.useRef(l),re=c!=null,oe=Md(c),ae=Md(i),z=Md(u),D=P.useCallback(()=>{if(!q.current||!H.current)return;const M={placement:t,strategy:r,middleware:p};ae.current&&(M.platform=ae.current),NM(q.current,H.current,M).then(_=>{const I={..._,isPositioned:z.current!==!1};h.current&&!ou(K.current,I)&&(K.current=I,qh.flushSync(()=>{d(I)}))})},[p,t,r,ae,z]);iu(()=>{u===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[u]);const h=P.useRef(!1);iu(()=>(h.current=!0,()=>{h.current=!1}),[]),iu(()=>{if(F&&(q.current=F),L&&(H.current=L),F&&L){if(oe.current)return oe.current(F,L,D);D()}},[F,L,D,oe,re]);const f=P.useMemo(()=>({reference:q,floating:H,setReference:R,setFloating:k}),[R,k]),m=P.useMemo(()=>({reference:F,floating:L}),[F,L]),S=P.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const _=J1(m.floating,l.x),I=J1(m.floating,l.y);return a?{...M,transform:"translate("+_+"px, "+I+"px)",...X1(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:_,top:I}},[r,a,m.floating,l.x,l.y]);return P.useMemo(()=>({...l,update:D,refs:f,elements:m,floatingStyles:S}),[l,D,f,m,S])}const kM=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:i}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Z1({element:n.current,padding:i}).fn(r):{}:n?Z1({element:n,padding:i}).fn(r):{}}}},DM=(e,t)=>({...AM(e),options:[e,t]}),BM=(e,t)=>({...TM(e),options:[e,t]}),LM=(e,t)=>({...RM(e),options:[e,t]}),$M=(e,t)=>({...IM(e),options:[e,t]}),FM=(e,t)=>({...OM(e),options:[e,t]}),UM=(e,t)=>({...PM(e),options:[e,t]}),VM=(e,t)=>({...kM(e),options:[e,t]});var zM="Arrow",Q1=P.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...o}=e;return x.jsx(Yt.svg,{...o,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});Q1.displayName=zM;var HM=Q1;function qM(e,t=[]){let r=[];function n(o,s){const a=P.createContext(s),c=r.length;r=[...r,s];function u(d){const{scope:p,children:w,...b}=d,y=(p==null?void 0:p[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return x.jsx(y.Provider,{value:T,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,b=P.useContext(w);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,l]}const i=()=>{const o=r.map(s=>P.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,WM(i,...t)]}function WM(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((a,{useScope:c,scopeName:u})=>{const d=c(o)[`__scope${u}`];return{...a,...d}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function Ad(e){const[t,r]=P.useState(void 0);return Gi(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;r({width:s,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Td="Popper",[ev,su]=qM(Td),[GM,tv]=ev(Td),rv=e=>{const{__scopePopper:t,children:r}=e,[n,i]=P.useState(null);return x.jsx(GM,{scope:t,anchor:n,onAnchorChange:i,children:r})};rv.displayName=Td;var nv="PopperAnchor",iv=P.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,o=tv(nv,r),s=P.useRef(null),a=rr(t,s);return P.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:x.jsx(Yt.div,{...i,ref:a})});iv.displayName=nv;var Id="PopperContent",[KM,YM]=ev(Id),ov=P.forwardRef((e,t)=>{var le,me,xe,be,Ve,Le;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:w="optimized",onPlaced:b,...y}=e,T=tv(Id,r),[O,R]=P.useState(null),k=rr(t,ft=>R(ft)),[F,L]=P.useState(null),q=Ad(F),H=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,re=n+(o!=="center"?"-"+o:""),oe=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ae=Array.isArray(u)?u:[u],z=ae.length>0,D={padding:oe,boundary:ae.filter(XM),altBoundary:z},{refs:h,floatingStyles:f,placement:m,isPositioned:S,middlewareData:M}=jM({strategy:"fixed",placement:re,whileElementsMounted:(...ft)=>MM(...ft,{animationFrame:w==="always"}),elements:{reference:T.anchor},middleware:[DM({mainAxis:i+K,alignmentAxis:s}),c&&BM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?LM():void 0,...D}),c&&$M({...D}),FM({...D,apply:({elements:ft,rects:dt,availableWidth:je,availableHeight:mt})=>{const{width:we,height:he}=dt.reference,Ce=ft.floating.style;Ce.setProperty("--radix-popper-available-width",`${je}px`),Ce.setProperty("--radix-popper-available-height",`${mt}px`),Ce.setProperty("--radix-popper-anchor-width",`${we}px`),Ce.setProperty("--radix-popper-anchor-height",`${he}px`)}}),F&&VM({element:F,padding:a}),JM({arrowWidth:H,arrowHeight:K}),p&&UM({strategy:"referenceHidden",...D})]}),[_,I]=cv(m),C=br(b);Gi(()=>{S&&(C==null||C())},[S,C]);const g=(le=M.arrow)==null?void 0:le.x,v=(me=M.arrow)==null?void 0:me.y,N=((xe=M.arrow)==null?void 0:xe.centerOffset)!==0,[ee,ie]=P.useState();return Gi(()=>{O&&ie(window.getComputedStyle(O).zIndex)},[O]),x.jsx("div",{ref:h.setFloating,"data-radix-popper-content-wrapper":"",style:{...f,transform:S?f.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(be=M.transformOrigin)==null?void 0:be.x,(Ve=M.transformOrigin)==null?void 0:Ve.y].join(" "),...((Le=M.hide)==null?void 0:Le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:x.jsx(KM,{scope:r,placedSide:_,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:N,children:x.jsx(Yt.div,{"data-side":_,"data-align":I,...y,ref:k,style:{...y.style,animation:S?void 0:"none"}})})})});ov.displayName=Id;var sv="PopperArrow",ZM={top:"bottom",right:"left",bottom:"top",left:"right"},av=P.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,o=YM(sv,n),s=ZM[o.placedSide];return x.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:x.jsx(HM,{...i,ref:r,style:{...i.style,display:"block"}})})});av.displayName=sv;function XM(e){return e!==null}var JM=e=>({name:"transformOrigin",options:e,fn(t){var T,O,R;const{placement:r,rects:n,middlewareData:i}=t,s=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,l]=cv(r),d={start:"0%",center:"50%",end:"100%"}[l],p=(((O=i.arrow)==null?void 0:O.x)??0)+a/2,w=(((R=i.arrow)==null?void 0:R.y)??0)+c/2;let b="",y="";return u==="bottom"?(b=s?d:`${p}px`,y=`${-c}px`):u==="top"?(b=s?d:`${p}px`,y=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,y=s?d:`${w}px`):u==="left"&&(b=`${n.floating.width+c}px`,y=s?d:`${w}px`),{data:{x:b,y}}}});function cv(e){const[t,r="center"]=e.split("-");return[t,r]}var uv=rv,lv=iv,fv=ov,dv=av,QM="Portal",hv=P.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,o]=P.useState(!1);Gi(()=>o(!0),[]);const s=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?kn.createPortal(x.jsx(Yt.div,{...n,ref:t}),s):null});hv.displayName=QM;function eA(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var On=e=>{const{present:t,children:r}=e,n=tA(t),i=typeof r=="function"?r({present:n.isPresent}):P.Children.only(r),o=rr(n.ref,rA(i));return typeof r=="function"||n.isPresent?P.cloneElement(i,{ref:o}):null};On.displayName="Presence";function tA(e){const[t,r]=P.useState(),n=P.useRef({}),i=P.useRef(e),o=P.useRef("none"),s=e?"mounted":"unmounted",[a,c]=eA(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const u=au(n.current);o.current=a==="mounted"?u:"none"},[a]),Gi(()=>{const u=n.current,l=i.current;if(l!==e){const p=o.current,w=au(u);e?c("MOUNT"):w==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&p!==w?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Gi(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,d=w=>{const y=au(n.current).includes(w.animationName);if(w.target===t&&y&&(c("ANIMATION_END"),!i.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},p=w=>{w.target===t&&(o.current=au(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function au(e){return(e==null?void 0:e.animationName)||"none"}function rA(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function ba({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=nA({defaultProp:t,onChange:r}),o=e!==void 0,s=o?e:n,a=br(r),c=P.useCallback(u=>{if(o){const d=typeof u=="function"?u(e):u;d!==e&&a(d)}else i(u)},[o,e,i,a]);return[s,c]}function nA({defaultProp:e,onChange:t}){const r=P.useState(e),[n]=r,i=P.useRef(n),o=br(t);return P.useEffect(()=>{i.current!==n&&(o(n),i.current=n)},[n,i,o]),r}var iA="VisuallyHidden",pv=P.forwardRef((e,t)=>x.jsx(Yt.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));pv.displayName=iA;var oA=pv,[cu,nB]=fs("Tooltip",[su]),Od=su(),mv="TooltipProvider",sA=700,gv="tooltip.open",[aA,vv]=cu(mv),yv=e=>{const{__scopeTooltip:t,delayDuration:r=sA,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:o}=e,[s,a]=P.useState(!0),c=P.useRef(!1),u=P.useRef(0);return P.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),x.jsx(aA,{scope:t,isOpenDelayed:s,delayDuration:r,onOpen:P.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:P.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:P.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:o})};yv.displayName=mv;var wv="Tooltip",[iB,uu]=cu(wv),Pd="TooltipTrigger",cA=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=uu(Pd,r),o=vv(Pd,r),s=Od(r),a=P.useRef(null),c=rr(t,a,i.onTriggerChange),u=P.useRef(!1),l=P.useRef(!1),d=P.useCallback(()=>u.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),x.jsx(lv,{asChild:!0,...s,children:x.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:Xe(e.onPointerMove,p=>{p.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Xe(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Xe(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Xe(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:Xe(e.onBlur,i.onClose),onClick:Xe(e.onClick,i.onClose)})})});cA.displayName=Pd;var uA="TooltipPortal",[oB,lA]=cu(uA,{forceMount:void 0}),vs="TooltipContent",fA=P.forwardRef((e,t)=>{const r=lA(vs,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...o}=e,s=uu(vs,e.__scopeTooltip);return x.jsx(On,{present:n||s.open,children:s.disableHoverableContent?x.jsx(bv,{side:i,...o,ref:t}):x.jsx(dA,{side:i,...o,ref:t})})}),dA=P.forwardRef((e,t)=>{const r=uu(vs,e.__scopeTooltip),n=vv(vs,e.__scopeTooltip),i=P.useRef(null),o=rr(t,i),[s,a]=P.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:d}=n,p=P.useCallback(()=>{a(null),d(!1)},[d]),w=P.useCallback((b,y)=>{const T=b.currentTarget,O={x:b.clientX,y:b.clientY},R=gA(O,T.getBoundingClientRect()),k=vA(O,R),F=yA(y.getBoundingClientRect()),L=bA([...k,...F]);a(L),d(!0)},[d]);return P.useEffect(()=>()=>p(),[p]),P.useEffect(()=>{if(c&&l){const b=T=>w(T,l),y=T=>w(T,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",y)}}},[c,l,w,p]),P.useEffect(()=>{if(s){const b=y=>{const T=y.target,O={x:y.clientX,y:y.clientY},R=(c==null?void 0:c.contains(T))||(l==null?void 0:l.contains(T)),k=!wA(O,s);R?p():k&&(p(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,s,u,p]),x.jsx(bv,{...e,ref:o})}),[hA,pA]=cu(wv,{isInside:!1}),bv=P.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,c=uu(vs,r),u=Od(r),{onClose:l}=c;return P.useEffect(()=>(document.addEventListener(gv,l),()=>document.removeEventListener(gv,l)),[l]),P.useEffect(()=>{if(c.trigger){const d=p=>{const w=p.target;w!=null&&w.contains(c.trigger)&&l()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,l]),x.jsx(pd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:l,children:x.jsxs(fv,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[x.jsx(ds,{children:n}),x.jsx(hA,{scope:r,isInside:!0,children:x.jsx(oA,{id:c.contentId,role:"tooltip",children:i||n})})]})})});fA.displayName=vs;var xv="TooltipArrow",mA=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Od(r);return pA(xv,r).isInside?null:x.jsx(dv,{...i,...n,ref:t})});mA.displayName=xv;function gA(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,i,o)){case o:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function vA(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function yA(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function wA(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,c=t[o].y,u=t[s].x,l=t[s].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function bA(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),xA(t)}function xA(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const i=e[n];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const o=r[r.length-1],s=r[r.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var SA=yv,Sv=P.createContext(void 0),EA=e=>{const{dir:t,children:r}=e;return x.jsx(Sv.Provider,{value:t,children:r})};function Rd(e){const t=P.useContext(Sv);return e||t||"ltr"}const _A=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],CA=["sky","mint","lime","yellow","amber"],MA=["gold","bronze"],AA=[..._A,...CA,...MA],TA=["gray",...["mauve","slate","sage","olive","sand"]];function IA(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand"}}const OA=["inherit","light","dark"],PA=[...AA,"gray"],RA=[...TA,"auto"],Fr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:OA,default:"inherit"},accentColor:{type:"enum",values:PA,default:"indigo"},grayColor:{type:"enum",values:RA,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function Ev(e){return e==="gray"?"gray":IA(e)}const ys=()=>{},lu=P.createContext(void 0);function NA(){const e=P.useContext(lu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const fu=P.forwardRef((e,t)=>P.useContext(lu)===void 0?P.createElement(SA,null,P.createElement(EA,{dir:"ltr"},P.createElement(_v,{...e,ref:t}))):P.createElement(Nd,{...e,ref:t}));fu.displayName="Theme";const _v=P.forwardRef((e,t)=>{const{appearance:r=Fr.appearance.default,accentColor:n=Fr.accentColor.default,grayColor:i=Fr.grayColor.default,panelBackground:o=Fr.panelBackground.default,radius:s=Fr.radius.default,scaling:a=Fr.scaling.default,hasBackground:c=Fr.hasBackground.default,...u}=e,[l,d]=P.useState(r);P.useEffect(()=>d(r),[r]);const[p,w]=P.useState(n);P.useEffect(()=>w(n),[n]);const[b,y]=P.useState(i);P.useEffect(()=>y(i),[i]);const[T,O]=P.useState(o);P.useEffect(()=>O(o),[o]);const[R,k]=P.useState(s);P.useEffect(()=>k(s),[s]);const[F,L]=P.useState(a);P.useEffect(()=>L(a),[a]);const q=P.memo(({appearance:K})=>P.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${K}';c.add('${K}');}catch(e){}})();`}}),()=>!0);q.displayName="ExplicitRootAppearanceScript",P.useEffect(()=>jA(r),[r]);const H=b==="auto"?Ev(p):b;return P.createElement(P.Fragment,null,l!=="inherit"&&P.createElement(q,{appearance:l}),c&&P.createElement("style",{dangerouslySetInnerHTML:{__html:`
49
+ */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,n(a)))}return o}function n(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return r.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(J1);var qA=J1.exports;const Jt=Us(qA);function Xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Q1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nu(...e){return t=>{let r=!1;const n=e.map(i=>{const o=Q1(i,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let i=0;i<n.length;i++){const o=n[i];typeof o=="function"?o():Q1(e[i],null)}}}}function ir(...e){return P.useCallback(nu(...e),e)}function Mi(e,t=[]){let r=[];function n(o,s){const a=P.createContext(s),c=r.length;r=[...r,s];const u=d=>{var O;const{scope:p,children:b,...x}=d,y=((O=p==null?void 0:p[e])==null?void 0:O[c])||a,T=P.useMemo(()=>x,Object.values(x));return w.jsx(y.Provider,{value:T,children:b})};u.displayName=o+"Provider";function l(d,p){var y;const b=((y=p==null?void 0:p[e])==null?void 0:y[c])||a,x=P.useContext(b);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[u,l]}const i=()=>{const o=r.map(s=>P.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,WA(i,...t)]}function WA(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((a,{useScope:c,scopeName:u})=>{const d=c(o)[`__scope${u}`];return{...a,...d}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Ti=P.forwardRef((e,t)=>{const{children:r,...n}=e,i=P.Children.toArray(r),o=i.find(GA);if(o){const s=o.props.children,a=i.map(c=>c===o?P.Children.count(s)>1?P.Children.only(null):P.isValidElement(s)?s.props.children:null:c);return w.jsx(Sd,{...n,ref:t,children:P.isValidElement(s)?P.cloneElement(s,void 0,a):null})}return w.jsx(Sd,{...n,ref:t,children:r})});Ti.displayName="Slot";var Sd=P.forwardRef((e,t)=>{const{children:r,...n}=e;if(P.isValidElement(r)){const i=YA(r),o=KA(n,r.props);return r.type!==P.Fragment&&(o.ref=t?nu(t,i):i),P.cloneElement(r,o)}return P.Children.count(r)>1?P.Children.only(null):null});Sd.displayName="SlotClone";var gs=({children:e})=>w.jsx(w.Fragment,{children:e});function GA(e){return P.isValidElement(e)&&e.type===gs}function KA(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...a)=>{o(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function YA(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ZA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Zt=ZA.reduce((e,t)=>{const r=P.forwardRef((n,i)=>{const{asChild:o,...s}=n,a=o?Ti:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ev(e,t){e&&t0.flushSync(()=>e.dispatchEvent(t))}function br(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function XA(e,t=globalThis==null?void 0:globalThis.document){const r=br(e);P.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var JA="DismissableLayer",Ed="dismissableLayer.update",QA="dismissableLayer.pointerDownOutside",eM="dismissableLayer.focusOutside",tv,rv=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_d=P.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...c}=e,u=P.useContext(rv),[l,d]=P.useState(null),p=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=P.useState({}),x=ir(t,z=>d(z)),y=Array.from(u.layers),[T]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),O=y.indexOf(T),N=l?y.indexOf(l):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,F=N>=O,L=nM(z=>{const G=z.target,re=[...u.branches].some(oe=>oe.contains(G));!F||re||(i==null||i(z),s==null||s(z),z.defaultPrevented||a==null||a())},p),W=iM(z=>{const G=z.target;[...u.branches].some(oe=>oe.contains(G))||(o==null||o(z),s==null||s(z),z.defaultPrevented||a==null||a())},p);return XA(z=>{N===u.layers.size-1&&(n==null||n(z),!z.defaultPrevented&&a&&(z.preventDefault(),a()))},p),P.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(tv=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),nv(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=tv)}},[l,p,r,u]),P.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),nv())},[l,u]),P.useEffect(()=>{const z=()=>b({});return document.addEventListener(Ed,z),()=>document.removeEventListener(Ed,z)},[]),w.jsx(Zt.div,{...c,ref:x,style:{pointerEvents:k?F?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,W.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,L.onPointerDownCapture)})});_d.displayName=JA;var tM="DismissableLayerBranch",rM=P.forwardRef((e,t)=>{const r=P.useContext(rv),n=P.useRef(null),i=ir(t,n);return P.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),w.jsx(Zt.div,{...e,ref:i})});rM.displayName=tM;function nM(e,t=globalThis==null?void 0:globalThis.document){const r=br(e),n=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){iv(QA,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function iM(e,t=globalThis==null?void 0:globalThis.document){const r=br(e),n=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!n.current&&iv(eM,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function nv(){const e=new CustomEvent(Ed);document.dispatchEvent(e)}function iv(e,t,r,{discrete:n}){const i=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?ev(i,o):i.dispatchEvent(o)}var Ji=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},oM=P["useId".toString()]||(()=>{}),sM=0;function xa(e){const[t,r]=P.useState(oM());return Ji(()=>{e||r(n=>n??String(sM++))},[e]),e||(t?`radix-${t}`:"")}const aM=["top","right","bottom","left"],Qi=Math.min,tn=Math.max,iu=Math.round,ou=Math.floor,Jn=e=>({x:e,y:e}),cM={left:"right",right:"left",bottom:"top",top:"bottom"},uM={start:"end",end:"start"};function Cd(e,t,r){return tn(e,Qi(t,r))}function Ii(e,t){return typeof e=="function"?e(t):e}function Oi(e){return e.split("-")[0]}function vs(e){return e.split("-")[1]}function Ad(e){return e==="x"?"y":"x"}function Md(e){return e==="y"?"height":"width"}function eo(e){return["top","bottom"].includes(Oi(e))?"y":"x"}function Td(e){return Ad(eo(e))}function lM(e,t,r){r===void 0&&(r=!1);const n=vs(e),i=Td(e),o=Md(i);let s=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=su(s)),[s,su(s)]}function fM(e){const t=su(e);return[Id(e),t,Id(t)]}function Id(e){return e.replace(/start|end/g,t=>uM[t])}function dM(e,t,r){const n=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?o:s;default:return[]}}function hM(e,t,r,n){const i=vs(e);let o=dM(Oi(e),r==="start",n);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Id)))),o}function su(e){return e.replace(/left|right|bottom|top/g,t=>cM[t])}function pM(e){return{top:0,right:0,bottom:0,left:0,...e}}function ov(e){return typeof e!="number"?pM(e):{top:e,right:e,bottom:e,left:e}}function au(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function sv(e,t,r){let{reference:n,floating:i}=e;const o=eo(t),s=Td(t),a=Md(s),c=Oi(t),u=o==="y",l=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[a]/2-i[a]/2;let b;switch(c){case"top":b={x:l,y:n.y-i.height};break;case"bottom":b={x:l,y:n.y+n.height};break;case"right":b={x:n.x+n.width,y:d};break;case"left":b={x:n.x-i.width,y:d};break;default:b={x:n.x,y:n.y}}switch(vs(t)){case"start":b[s]-=p*(r&&u?-1:1);break;case"end":b[s]+=p*(r&&u?-1:1);break}return b}const mM=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:s}=r,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:d}=sv(u,n,c),p=n,b={},x=0;for(let y=0;y<a.length;y++){const{name:T,fn:O}=a[y],{x:N,y:k,data:F,reset:L}=await O({x:l,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:b,rects:u,platform:s,elements:{reference:e,floating:t}});l=N??l,d=k??d,b={...b,[T]:{...b[T],...F}},L&&x<=50&&(x++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(u=L.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:d}=sv(u,p,c)),y=-1)}return{x:l,y:d,placement:p,strategy:i,middlewareData:b}};async function Sa(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:b=0}=Ii(t,e),x=ov(b),T=a[p?d==="floating"?"reference":"floating":d],O=au(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(T)))==null||r?T:T.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),N=d==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),F=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},L=au(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:N,offsetParent:k,strategy:c}):N);return{top:(O.top-L.top+x.top)/F.y,bottom:(L.bottom-O.bottom+x.bottom)/F.y,left:(O.left-L.left+x.left)/F.x,right:(L.right-O.right+x.right)/F.x}}const gM=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Ii(e,t)||{};if(u==null)return{};const d=ov(l),p={x:r,y:n},b=Td(i),x=Md(b),y=await s.getDimensions(u),T=b==="y",O=T?"top":"left",N=T?"bottom":"right",k=T?"clientHeight":"clientWidth",F=o.reference[x]+o.reference[b]-p[b]-o.floating[x],L=p[b]-o.reference[b],W=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let z=W?W[k]:0;(!z||!await(s.isElement==null?void 0:s.isElement(W)))&&(z=a.floating[k]||o.floating[x]);const G=F/2-L/2,re=z/2-y[x]/2-1,oe=Qi(d[O],re),ae=Qi(d[N],re),H=oe,D=z-y[x]-ae,h=z/2-y[x]/2+G,f=Cd(H,h,D),m=!c.arrow&&vs(i)!=null&&h!==f&&o.reference[x]/2-(h<H?oe:ae)-y[x]/2<0,S=m?h<H?h-H:h-D:0;return{[b]:p[b]+S,data:{[b]:f,centerOffset:h-f-S,...m&&{alignmentOffset:S}},reset:m}}}),vM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...T}=Ii(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const O=Oi(i),N=eo(a),k=Oi(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=p||(k||!y?[su(a)]:fM(a)),W=x!=="none";!p&&W&&L.push(...hM(a,y,x,F));const z=[a,...L],G=await Sa(t,T),re=[];let oe=((n=o.flip)==null?void 0:n.overflows)||[];if(l&&re.push(G[O]),d){const h=lM(i,s,F);re.push(G[h[0]],G[h[1]])}if(oe=[...oe,{placement:i,overflows:re}],!re.every(h=>h<=0)){var ae,H;const h=(((ae=o.flip)==null?void 0:ae.index)||0)+1,f=z[h];if(f)return{data:{index:h,overflows:oe},reset:{placement:f}};let m=(H=oe.filter(S=>S.overflows[0]<=0).sort((S,A)=>S.overflows[1]-A.overflows[1])[0])==null?void 0:H.placement;if(!m)switch(b){case"bestFit":{var D;const S=(D=oe.filter(A=>{if(W){const _=eo(A.placement);return _===N||_==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(_=>_>0).reduce((_,I)=>_+I,0)]).sort((A,_)=>A[1]-_[1])[0])==null?void 0:D[0];S&&(m=S);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function av(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cv(e){return aM.some(t=>e[t]>=0)}const yM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ii(e,t);switch(n){case"referenceHidden":{const o=await Sa(t,{...i,elementContext:"reference"}),s=av(o,r.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:cv(s)}}}case"escaped":{const o=await Sa(t,{...i,altBoundary:!0}),s=av(o,r.floating);return{data:{escapedOffsets:s,escaped:cv(s)}}}default:return{}}}}};async function wM(e,t){const{placement:r,platform:n,elements:i}=e,o=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=Oi(r),a=vs(r),c=eo(r)==="y",u=["left","top"].includes(s)?-1:1,l=o&&c?-1:1,d=Ii(t,e);let{mainAxis:p,crossAxis:b,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof x=="number"&&(b=a==="end"?x*-1:x),c?{x:b*l,y:p*u}:{x:p*u,y:b*l}}const bM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await wM(t,e);return s===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},xM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:T=>{let{x:O,y:N}=T;return{x:O,y:N}}},...c}=Ii(e,t),u={x:r,y:n},l=await Sa(t,c),d=eo(Oi(i)),p=Ad(d);let b=u[p],x=u[d];if(o){const T=p==="y"?"top":"left",O=p==="y"?"bottom":"right",N=b+l[T],k=b-l[O];b=Cd(N,b,k)}if(s){const T=d==="y"?"top":"left",O=d==="y"?"bottom":"right",N=x+l[T],k=x-l[O];x=Cd(N,x,k)}const y=a.fn({...t,[p]:b,[d]:x});return{...y,data:{x:y.x-r,y:y.y-n,enabled:{[p]:o,[d]:s}}}}}},SM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ii(e,t),l={x:r,y:n},d=eo(i),p=Ad(d);let b=l[p],x=l[d];const y=Ii(a,t),T=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const k=p==="y"?"height":"width",F=o.reference[p]-o.floating[k]+T.mainAxis,L=o.reference[p]+o.reference[k]-T.mainAxis;b<F?b=F:b>L&&(b=L)}if(u){var O,N;const k=p==="y"?"width":"height",F=["top","left"].includes(Oi(i)),L=o.reference[d]-o.floating[k]+(F&&((O=s.offset)==null?void 0:O[d])||0)+(F?0:T.crossAxis),W=o.reference[d]+o.reference[k]+(F?0:((N=s.offset)==null?void 0:N[d])||0)-(F?T.crossAxis:0);x<L?x=L:x>W&&(x=W)}return{[p]:b,[d]:x}}}},EM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:c=()=>{},...u}=Ii(e,t),l=await Sa(t,u),d=Oi(i),p=vs(i),b=eo(i)==="y",{width:x,height:y}=o.floating;let T,O;d==="top"||d==="bottom"?(T=d,O=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(O=d,T=p==="end"?"top":"bottom");const N=y-l.top-l.bottom,k=x-l.left-l.right,F=Qi(y-l[T],N),L=Qi(x-l[O],k),W=!t.middlewareData.shift;let z=F,G=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(G=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(z=N),W&&!p){const oe=tn(l.left,0),ae=tn(l.right,0),H=tn(l.top,0),D=tn(l.bottom,0);b?G=x-2*(oe!==0||ae!==0?oe+ae:tn(l.left,l.right)):z=y-2*(H!==0||D!==0?H+D:tn(l.top,l.bottom))}await c({...t,availableWidth:G,availableHeight:z});const re=await s.getDimensions(a.floating);return x!==re.width||y!==re.height?{reset:{rects:!0}}:{}}}};function cu(){return typeof window<"u"}function ys(e){return uv(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qn(e){var t;return(t=(uv(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uv(e){return cu()?e instanceof Node||e instanceof rn(e).Node:!1}function Nn(e){return cu()?e instanceof Element||e instanceof rn(e).Element:!1}function ei(e){return cu()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function lv(e){return!cu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}function Ea(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=jn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function _M(e){return["table","td","th"].includes(ys(e))}function uu(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Od(e){const t=Pd(),r=Nn(e)?jn(e):e;return["transform","translate","scale","rotate","perspective"].some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function CM(e){let t=to(e);for(;ei(t)&&!ws(t);){if(Od(t))return t;if(uu(t))return null;t=to(t)}return null}function Pd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ws(e){return["html","body","#document"].includes(ys(e))}function jn(e){return rn(e).getComputedStyle(e)}function lu(e){return Nn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function to(e){if(ys(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lv(e)&&e.host||Qn(e);return lv(t)?t.host:t}function fv(e){const t=to(e);return ws(t)?e.ownerDocument?e.ownerDocument.body:e.body:ei(t)&&Ea(t)?t:fv(t)}function _a(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=fv(e),o=i===((n=e.ownerDocument)==null?void 0:n.body),s=rn(i);if(o){const a=Rd(s);return t.concat(s,s.visualViewport||[],Ea(i)?i:[],a&&r?_a(a):[])}return t.concat(i,_a(i,[],r))}function Rd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dv(e){const t=jn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ei(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=iu(r)!==o||iu(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function Nd(e){return Nn(e)?e:e.contextElement}function bs(e){const t=Nd(e);if(!ei(t))return Jn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=dv(t);let s=(o?iu(r.width):r.width)/n,a=(o?iu(r.height):r.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const AM=Jn(0);function hv(e){const t=rn(e);return!Pd()||!t.visualViewport?AM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function MM(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==rn(e)?!1:t}function jo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),o=Nd(e);let s=Jn(1);t&&(n?Nn(n)&&(s=bs(n)):s=bs(e));const a=MM(o,r,n)?hv(o):Jn(0);let c=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,l=i.width/s.x,d=i.height/s.y;if(o){const p=rn(o),b=n&&Nn(n)?rn(n):n;let x=p,y=Rd(x);for(;y&&n&&b!==x;){const T=bs(y),O=y.getBoundingClientRect(),N=jn(y),k=O.left+(y.clientLeft+parseFloat(N.paddingLeft))*T.x,F=O.top+(y.clientTop+parseFloat(N.paddingTop))*T.y;c*=T.x,u*=T.y,l*=T.x,d*=T.y,c+=k,u+=F,x=rn(y),y=Rd(x)}}return au({width:l,height:d,x:c,y:u})}function jd(e,t){const r=lu(e).scrollLeft;return t?t.left+r:jo(Qn(e)).left+r}function pv(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:jd(e,n)),o=n.top+t.scrollTop;return{x:i,y:o}}function TM(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o=i==="fixed",s=Qn(n),a=t?uu(t.floating):!1;if(n===s||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Jn(1);const l=Jn(0),d=ei(n);if((d||!d&&!o)&&((ys(n)!=="body"||Ea(s))&&(c=lu(n)),ei(n))){const b=jo(n);u=bs(n),l.x=b.x+n.clientLeft,l.y=b.y+n.clientTop}const p=s&&!d&&!o?pv(s,c,!0):Jn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+p.x,y:r.y*u.y-c.scrollTop*u.y+l.y+p.y}}function IM(e){return Array.from(e.getClientRects())}function OM(e){const t=Qn(e),r=lu(e),n=e.ownerDocument.body,i=tn(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=tn(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+jd(e);const a=-r.scrollTop;return jn(n).direction==="rtl"&&(s+=tn(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}function PM(e,t){const r=rn(e),n=Qn(e),i=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const u=Pd();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function RM(e,t){const r=jo(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=ei(e)?bs(e):Jn(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,u=n*o.y;return{width:s,height:a,x:c,y:u}}function mv(e,t,r){let n;if(t==="viewport")n=PM(e,r);else if(t==="document")n=OM(Qn(e));else if(Nn(t))n=RM(t,r);else{const i=hv(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return au(n)}function gv(e,t){const r=to(e);return r===t||!Nn(r)||ws(r)?!1:jn(r).position==="fixed"||gv(r,t)}function NM(e,t){const r=t.get(e);if(r)return r;let n=_a(e,[],!1).filter(a=>Nn(a)&&ys(a)!=="body"),i=null;const o=jn(e).position==="fixed";let s=o?to(e):e;for(;Nn(s)&&!ws(s);){const a=jn(s),c=Od(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Ea(s)&&!c&&gv(e,s))?n=n.filter(l=>l!==s):i=a,s=to(s)}return t.set(e,n),n}function jM(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const s=[...r==="clippingAncestors"?uu(t)?[]:NM(t,this._c):[].concat(r),n],a=s[0],c=s.reduce((u,l)=>{const d=mv(t,l,i);return u.top=tn(d.top,u.top),u.right=Qi(d.right,u.right),u.bottom=Qi(d.bottom,u.bottom),u.left=tn(d.left,u.left),u},mv(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function kM(e){const{width:t,height:r}=dv(e);return{width:t,height:r}}function DM(e,t,r){const n=ei(t),i=Qn(t),o=r==="fixed",s=jo(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Jn(0);if(n||!n&&!o)if((ys(t)!=="body"||Ea(i))&&(a=lu(t)),n){const p=jo(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=jd(i));const u=i&&!n&&!o?pv(i,a):Jn(0),l=s.left+a.scrollLeft-c.x-u.x,d=s.top+a.scrollTop-c.y-u.y;return{x:l,y:d,width:s.width,height:s.height}}function kd(e){return jn(e).position==="static"}function vv(e,t){if(!ei(e)||jn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Qn(e)===r&&(r=r.ownerDocument.body),r}function yv(e,t){const r=rn(e);if(uu(e))return r;if(!ei(e)){let i=to(e);for(;i&&!ws(i);){if(Nn(i)&&!kd(i))return i;i=to(i)}return r}let n=vv(e,t);for(;n&&_M(n)&&kd(n);)n=vv(n,t);return n&&ws(n)&&kd(n)&&!Od(n)?r:n||CM(e)||r}const BM=async function(e){const t=this.getOffsetParent||yv,r=this.getDimensions,n=await r(e.floating);return{reference:DM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function LM(e){return jn(e).direction==="rtl"}const $M={convertOffsetParentRelativeRectToViewportRelativeRect:TM,getDocumentElement:Qn,getClippingRect:jM,getOffsetParent:yv,getElementRects:BM,getClientRects:IM,getDimensions:kM,getScale:bs,isElement:Nn,isRTL:LM};function wv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function FM(e,t){let r=null,n;const i=Qn(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:l,top:d,width:p,height:b}=u;if(a||t(),!p||!b)return;const x=ou(d),y=ou(i.clientWidth-(l+p)),T=ou(i.clientHeight-(d+b)),O=ou(l),k={rootMargin:-x+"px "+-y+"px "+-T+"px "+-O+"px",threshold:tn(0,Qi(1,c))||1};let F=!0;function L(W){const z=W[0].intersectionRatio;if(z!==c){if(!F)return s();z?s(!1,z):n=setTimeout(()=>{s(!1,1e-7)},1e3)}z===1&&!wv(u,e.getBoundingClientRect())&&s(),F=!1}try{r=new IntersectionObserver(L,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(L,k)}r.observe(e)}return s(!0),o}function UM(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Nd(e),l=i||o?[...u?_a(u):[],..._a(t)]:[];l.forEach(O=>{i&&O.addEventListener("scroll",r,{passive:!0}),o&&O.addEventListener("resize",r)});const d=u&&a?FM(u,r):null;let p=-1,b=null;s&&(b=new ResizeObserver(O=>{let[N]=O;N&&N.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=b)==null||k.observe(t)})),r()}),u&&!c&&b.observe(u),b.observe(t));let x,y=c?jo(e):null;c&&T();function T(){const O=jo(e);y&&!wv(y,O)&&r(),y=O,x=requestAnimationFrame(T)}return r(),()=>{var O;l.forEach(N=>{i&&N.removeEventListener("scroll",r),o&&N.removeEventListener("resize",r)}),d==null||d(),(O=b)==null||O.disconnect(),b=null,c&&cancelAnimationFrame(x)}}const VM=bM,zM=xM,HM=vM,qM=EM,WM=yM,bv=gM,GM=SM,KM=(e,t,r)=>{const n=new Map,i={platform:$M,...r},o={...i.platform,_c:n};return mM(e,t,{...i,platform:o})};var fu=typeof document<"u"?ne.useLayoutEffect:ne.useEffect;function du(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!du(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){const o=i[n];if(!(o==="_owner"&&e.$$typeof)&&!du(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function xv(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sv(e,t){const r=xv(e);return Math.round(t*r)/r}function Dd(e){const t=P.useRef(e);return fu(()=>{t.current=e}),t}function YM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,d]=P.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,b]=P.useState(n);du(p,n)||b(n);const[x,y]=P.useState(null),[T,O]=P.useState(null),N=P.useCallback(A=>{A!==W.current&&(W.current=A,y(A))},[]),k=P.useCallback(A=>{A!==z.current&&(z.current=A,O(A))},[]),F=o||x,L=s||T,W=P.useRef(null),z=P.useRef(null),G=P.useRef(l),re=c!=null,oe=Dd(c),ae=Dd(i),H=Dd(u),D=P.useCallback(()=>{if(!W.current||!z.current)return;const A={placement:t,strategy:r,middleware:p};ae.current&&(A.platform=ae.current),KM(W.current,z.current,A).then(_=>{const I={..._,isPositioned:H.current!==!1};h.current&&!du(G.current,I)&&(G.current=I,t0.flushSync(()=>{d(I)}))})},[p,t,r,ae,H]);fu(()=>{u===!1&&G.current.isPositioned&&(G.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[u]);const h=P.useRef(!1);fu(()=>(h.current=!0,()=>{h.current=!1}),[]),fu(()=>{if(F&&(W.current=F),L&&(z.current=L),F&&L){if(oe.current)return oe.current(F,L,D);D()}},[F,L,D,oe,re]);const f=P.useMemo(()=>({reference:W,floating:z,setReference:N,setFloating:k}),[N,k]),m=P.useMemo(()=>({reference:F,floating:L}),[F,L]),S=P.useMemo(()=>{const A={position:r,left:0,top:0};if(!m.floating)return A;const _=Sv(m.floating,l.x),I=Sv(m.floating,l.y);return a?{...A,transform:"translate("+_+"px, "+I+"px)",...xv(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:_,top:I}},[r,a,m.floating,l.x,l.y]);return P.useMemo(()=>({...l,update:D,refs:f,elements:m,floatingStyles:S}),[l,D,f,m,S])}const ZM=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:i}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?bv({element:n.current,padding:i}).fn(r):{}:n?bv({element:n,padding:i}).fn(r):{}}}},XM=(e,t)=>({...VM(e),options:[e,t]}),JM=(e,t)=>({...zM(e),options:[e,t]}),QM=(e,t)=>({...GM(e),options:[e,t]}),eT=(e,t)=>({...HM(e),options:[e,t]}),tT=(e,t)=>({...qM(e),options:[e,t]}),rT=(e,t)=>({...WM(e),options:[e,t]}),nT=(e,t)=>({...ZM(e),options:[e,t]});var iT="Arrow",Ev=P.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...o}=e;return w.jsx(Zt.svg,{...o,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ev.displayName=iT;var oT=Ev;function Bd(e){const[t,r]=P.useState(void 0);return Ji(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;r({width:s,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Ld="Popper",[_v,hu]=Mi(Ld),[sT,Cv]=_v(Ld),Av=e=>{const{__scopePopper:t,children:r}=e,[n,i]=P.useState(null);return w.jsx(sT,{scope:t,anchor:n,onAnchorChange:i,children:r})};Av.displayName=Ld;var Mv="PopperAnchor",Tv=P.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,o=Cv(Mv,r),s=P.useRef(null),a=ir(t,s);return P.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:w.jsx(Zt.div,{...i,ref:a})});Tv.displayName=Mv;var $d="PopperContent",[aT,cT]=_v($d),Iv=P.forwardRef((e,t)=>{var ue,_e,de,be,De,Ne;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:b="optimized",onPlaced:x,...y}=e,T=Cv($d,r),[O,N]=P.useState(null),k=ir(t,ft=>N(ft)),[F,L]=P.useState(null),W=Bd(F),z=(W==null?void 0:W.width)??0,G=(W==null?void 0:W.height)??0,re=n+(o!=="center"?"-"+o:""),oe=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ae=Array.isArray(u)?u:[u],H=ae.length>0,D={padding:oe,boundary:ae.filter(lT),altBoundary:H},{refs:h,floatingStyles:f,placement:m,isPositioned:S,middlewareData:A}=YM({strategy:"fixed",placement:re,whileElementsMounted:(...ft)=>UM(...ft,{animationFrame:b==="always"}),elements:{reference:T.anchor},middleware:[XM({mainAxis:i+G,alignmentAxis:s}),c&&JM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?QM():void 0,...D}),c&&eT({...D}),tT({...D,apply:({elements:ft,rects:dt,availableWidth:ke,availableHeight:mt})=>{const{width:we,height:pe}=dt.reference,Ce=ft.floating.style;Ce.setProperty("--radix-popper-available-width",`${ke}px`),Ce.setProperty("--radix-popper-available-height",`${mt}px`),Ce.setProperty("--radix-popper-anchor-width",`${we}px`),Ce.setProperty("--radix-popper-anchor-height",`${pe}px`)}}),F&&nT({element:F,padding:a}),fT({arrowWidth:z,arrowHeight:G}),p&&rT({strategy:"referenceHidden",...D})]}),[_,I]=Rv(m),C=br(x);Ji(()=>{S&&(C==null||C())},[S,C]);const g=(ue=A.arrow)==null?void 0:ue.x,v=(_e=A.arrow)==null?void 0:_e.y,R=((de=A.arrow)==null?void 0:de.centerOffset)!==0,[J,Q]=P.useState();return Ji(()=>{O&&Q(window.getComputedStyle(O).zIndex)},[O]),w.jsx("div",{ref:h.setFloating,"data-radix-popper-content-wrapper":"",style:{...f,transform:S?f.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(be=A.transformOrigin)==null?void 0:be.x,(De=A.transformOrigin)==null?void 0:De.y].join(" "),...((Ne=A.hide)==null?void 0:Ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(aT,{scope:r,placedSide:_,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:R,children:w.jsx(Zt.div,{"data-side":_,"data-align":I,...y,ref:k,style:{...y.style,animation:S?void 0:"none"}})})})});Iv.displayName=$d;var Ov="PopperArrow",uT={top:"bottom",right:"left",bottom:"top",left:"right"},Pv=P.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,o=cT(Ov,n),s=uT[o.placedSide];return w.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:w.jsx(oT,{...i,ref:r,style:{...i.style,display:"block"}})})});Pv.displayName=Ov;function lT(e){return e!==null}var fT=e=>({name:"transformOrigin",options:e,fn(t){var T,O,N;const{placement:r,rects:n,middlewareData:i}=t,s=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,l]=Rv(r),d={start:"0%",center:"50%",end:"100%"}[l],p=(((O=i.arrow)==null?void 0:O.x)??0)+a/2,b=(((N=i.arrow)==null?void 0:N.y)??0)+c/2;let x="",y="";return u==="bottom"?(x=s?d:`${p}px`,y=`${-c}px`):u==="top"?(x=s?d:`${p}px`,y=`${n.floating.height+c}px`):u==="right"?(x=`${-c}px`,y=s?d:`${b}px`):u==="left"&&(x=`${n.floating.width+c}px`,y=s?d:`${b}px`),{data:{x,y}}}});function Rv(e){const[t,r="center"]=e.split("-");return[t,r]}var Nv=Av,jv=Tv,kv=Iv,Dv=Pv,dT="Portal",Bv=P.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,o]=P.useState(!1);Ji(()=>o(!0),[]);const s=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?$n.createPortal(w.jsx(Zt.div,{...n,ref:t}),s):null});Bv.displayName=dT;function hT(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var kn=e=>{const{present:t,children:r}=e,n=pT(t),i=typeof r=="function"?r({present:n.isPresent}):P.Children.only(r),o=ir(n.ref,mT(i));return typeof r=="function"||n.isPresent?P.cloneElement(i,{ref:o}):null};kn.displayName="Presence";function pT(e){const[t,r]=P.useState(),n=P.useRef({}),i=P.useRef(e),o=P.useRef("none"),s=e?"mounted":"unmounted",[a,c]=hT(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const u=pu(n.current);o.current=a==="mounted"?u:"none"},[a]),Ji(()=>{const u=n.current,l=i.current;if(l!==e){const p=o.current,b=pu(u);e?c("MOUNT"):b==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&p!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Ji(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,d=b=>{const y=pu(n.current).includes(b.animationName);if(b.target===t&&y&&(c("ANIMATION_END"),!i.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},p=b=>{b.target===t&&(o.current=pu(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function pu(e){return(e==null?void 0:e.animationName)||"none"}function mT(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ca({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=gT({defaultProp:t,onChange:r}),o=e!==void 0,s=o?e:n,a=br(r),c=P.useCallback(u=>{if(o){const d=typeof u=="function"?u(e):u;d!==e&&a(d)}else i(u)},[o,e,i,a]);return[s,c]}function gT({defaultProp:e,onChange:t}){const r=P.useState(e),[n]=r,i=P.useRef(n),o=br(t);return P.useEffect(()=>{i.current!==n&&(o(n),i.current=n)},[n,i,o]),r}var vT="VisuallyHidden",Lv=P.forwardRef((e,t)=>w.jsx(Zt.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Lv.displayName=vT;var yT=Lv,[mu,mL]=Mi("Tooltip",[hu]),Fd=hu(),$v="TooltipProvider",wT=700,Fv="tooltip.open",[bT,Uv]=mu($v),Vv=e=>{const{__scopeTooltip:t,delayDuration:r=wT,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:o}=e,[s,a]=P.useState(!0),c=P.useRef(!1),u=P.useRef(0);return P.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),w.jsx(bT,{scope:t,isOpenDelayed:s,delayDuration:r,onOpen:P.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:P.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:P.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:o})};Vv.displayName=$v;var zv="Tooltip",[gL,gu]=mu(zv),Ud="TooltipTrigger",xT=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=gu(Ud,r),o=Uv(Ud,r),s=Fd(r),a=P.useRef(null),c=ir(t,a,i.onTriggerChange),u=P.useRef(!1),l=P.useRef(!1),d=P.useCallback(()=>u.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),w.jsx(jv,{asChild:!0,...s,children:w.jsx(Zt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:Xe(e.onPointerMove,p=>{p.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Xe(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Xe(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Xe(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:Xe(e.onBlur,i.onClose),onClick:Xe(e.onClick,i.onClose)})})});xT.displayName=Ud;var ST="TooltipPortal",[vL,ET]=mu(ST,{forceMount:void 0}),xs="TooltipContent",_T=P.forwardRef((e,t)=>{const r=ET(xs,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...o}=e,s=gu(xs,e.__scopeTooltip);return w.jsx(kn,{present:n||s.open,children:s.disableHoverableContent?w.jsx(Hv,{side:i,...o,ref:t}):w.jsx(CT,{side:i,...o,ref:t})})}),CT=P.forwardRef((e,t)=>{const r=gu(xs,e.__scopeTooltip),n=Uv(xs,e.__scopeTooltip),i=P.useRef(null),o=ir(t,i),[s,a]=P.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:d}=n,p=P.useCallback(()=>{a(null),d(!1)},[d]),b=P.useCallback((x,y)=>{const T=x.currentTarget,O={x:x.clientX,y:x.clientY},N=IT(O,T.getBoundingClientRect()),k=OT(O,N),F=PT(y.getBoundingClientRect()),L=NT([...k,...F]);a(L),d(!0)},[d]);return P.useEffect(()=>()=>p(),[p]),P.useEffect(()=>{if(c&&l){const x=T=>b(T,l),y=T=>b(T,c);return c.addEventListener("pointerleave",x),l.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",x),l.removeEventListener("pointerleave",y)}}},[c,l,b,p]),P.useEffect(()=>{if(s){const x=y=>{const T=y.target,O={x:y.clientX,y:y.clientY},N=(c==null?void 0:c.contains(T))||(l==null?void 0:l.contains(T)),k=!RT(O,s);N?p():k&&(p(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,l,s,u,p]),w.jsx(Hv,{...e,ref:o})}),[AT,MT]=mu(zv,{isInside:!1}),Hv=P.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,c=gu(xs,r),u=Fd(r),{onClose:l}=c;return P.useEffect(()=>(document.addEventListener(Fv,l),()=>document.removeEventListener(Fv,l)),[l]),P.useEffect(()=>{if(c.trigger){const d=p=>{const b=p.target;b!=null&&b.contains(c.trigger)&&l()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,l]),w.jsx(_d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:l,children:w.jsxs(kv,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[w.jsx(gs,{children:n}),w.jsx(AT,{scope:r,isInside:!0,children:w.jsx(yT,{id:c.contentId,role:"tooltip",children:i||n})})]})})});_T.displayName=xs;var qv="TooltipArrow",TT=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Fd(r);return MT(qv,r).isInside?null:w.jsx(Dv,{...i,...n,ref:t})});TT.displayName=qv;function IT(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,i,o)){case o:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function OT(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function PT(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function RT(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,c=t[o].y,u=t[s].x,l=t[s].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function NT(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),jT(t)}function jT(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const i=e[n];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const o=r[r.length-1],s=r[r.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var kT=Vv,Wv=P.createContext(void 0),DT=e=>{const{dir:t,children:r}=e;return w.jsx(Wv.Provider,{value:t,children:r})};function Vd(e){const t=P.useContext(Wv);return e||t||"ltr"}const BT=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],LT=["sky","mint","lime","yellow","amber"],$T=["gold","bronze"],FT=[...BT,...LT,...$T],UT=["gray",...["mauve","slate","sage","olive","sand"]];function VT(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand"}}const zT=["inherit","light","dark"],HT=[...FT,"gray"],qT=[...UT,"auto"],Ur={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:zT,default:"inherit"},accentColor:{type:"enum",values:HT,default:"indigo"},grayColor:{type:"enum",values:qT,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function Gv(e){return e==="gray"?"gray":VT(e)}const Ss=()=>{},vu=P.createContext(void 0);function WT(){const e=P.useContext(vu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const yu=P.forwardRef((e,t)=>P.useContext(vu)===void 0?P.createElement(kT,null,P.createElement(DT,{dir:"ltr"},P.createElement(Kv,{...e,ref:t}))):P.createElement(zd,{...e,ref:t}));yu.displayName="Theme";const Kv=P.forwardRef((e,t)=>{const{appearance:r=Ur.appearance.default,accentColor:n=Ur.accentColor.default,grayColor:i=Ur.grayColor.default,panelBackground:o=Ur.panelBackground.default,radius:s=Ur.radius.default,scaling:a=Ur.scaling.default,hasBackground:c=Ur.hasBackground.default,...u}=e,[l,d]=P.useState(r);P.useEffect(()=>d(r),[r]);const[p,b]=P.useState(n);P.useEffect(()=>b(n),[n]);const[x,y]=P.useState(i);P.useEffect(()=>y(i),[i]);const[T,O]=P.useState(o);P.useEffect(()=>O(o),[o]);const[N,k]=P.useState(s);P.useEffect(()=>k(s),[s]);const[F,L]=P.useState(a);P.useEffect(()=>L(a),[a]);const W=P.memo(({appearance:G})=>P.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${G}';c.add('${G}');}catch(e){}})();`}}),()=>!0);W.displayName="ExplicitRootAppearanceScript",P.useEffect(()=>GT(r),[r]);const z=x==="auto"?Gv(p):x;return P.createElement(P.Fragment,null,l!=="inherit"&&P.createElement(W,{appearance:l}),c&&P.createElement("style",{dangerouslySetInnerHTML:{__html:`
50
50
  :root, .light, .light-theme { --color-page-background: white; }
51
- .dark, .dark-theme { --color-page-background: var(--${H}-1); }
51
+ .dark, .dark-theme { --color-page-background: var(--${z}-1); }
52
52
  body { background-color: var(--color-page-background); }
53
- `}}),P.createElement(Nd,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:p,grayColor:b,panelBackground:T,radius:R,scaling:F,onAppearanceChange:d,onAccentColorChange:w,onGrayColorChange:y,onPanelBackgroundChange:O,onRadiusChange:k,onScalingChange:L}))});_v.displayName="ThemeRoot";const Nd=P.forwardRef((e,t)=>{var r,n,i,o,s,a;const c=P.useContext(lu),{asChild:u,isRoot:l,hasBackground:d,appearance:p=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Fr.appearance.default,accentColor:w=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Fr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Fr.grayColor.default,panelBackground:y=(o=c==null?void 0:c.panelBackground)!==null&&o!==void 0?o:Fr.panelBackground.default,radius:T=(s=c==null?void 0:c.radius)!==null&&s!==void 0?s:Fr.radius.default,scaling:O=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Fr.scaling.default,onAppearanceChange:R=ys,onAccentColorChange:k=ys,onGrayColorChange:F=ys,onPanelBackgroundChange:L=ys,onRadiusChange:q=ys,onScalingChange:H=ys,...K}=e,re=u?_i:"div",oe=b==="auto"?Ev(w):b,ae=e.appearance!==void 0&&e.appearance!=="inherit",z=e.grayColor!==void 0,D=!l&&(d===!0||d!==!1&&(ae||z));return P.createElement(lu.Provider,{value:P.useMemo(()=>({appearance:p,accentColor:w,grayColor:b,resolvedGrayColor:oe,panelBackground:y,radius:T,scaling:O,onAppearanceChange:R,onAccentColorChange:k,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:q,onScalingChange:H}),[p,w,b,oe,y,T,O,R,k,F,L,q,H])},P.createElement(re,{"data-is-root-theme":l?"true":"false","data-accent-color":w,"data-gray-color":oe,"data-has-background":D?"true":"false","data-panel-background":y,"data-radius":T,"data-scaling":O,ref:t,...K,className:Xt("radix-themes",{light:!l&&p==="light",dark:!l&&p==="dark"},K.className)}))});Nd.displayName="ThemeImpl";function jA(e){if(e==="inherit")return;const t=document.documentElement;(t.classList.contains("light-theme")||t.classList.contains("dark-theme"))&&(t.classList.remove("light-theme","dark-theme"),t.style.colorScheme=e,t.classList.add(`${e}-theme`)),(t.classList.contains("light")||t.classList.contains("dark"))&&(t.classList.remove("light","dark"),t.style.colorScheme=e,t.classList.add(e))}const xa={type:"enum",values:Fr.accentColor.values,default:void 0},du={type:"boolean",default:void 0};function bt(e,t="",r){var n,i,o,s;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),d=t===""?"":"-",p=l?`-${t}`:t,w=l?u==null?void 0:u.substring(1):u;if(w===void 0)continue;const b=(i=r==null?void 0:r[w])!==null&&i!==void 0?i:w,y=c==="initial"?`${p}${d}${b}`:`${c}:${p}${d}${b}`;a.push(y)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,d=c?e.substring(1):e,p=(o=r==null?void 0:r[d])!==null&&o!==void 0?o:d;a.push(`${l}${u}${p}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(s=r==null?void 0:r[u])!==null&&s!==void 0?s:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const Co=["0","1","2","3","4","5","6","7","8","9"],kA={p:{type:"enum",values:Co,default:void 0,responsive:!0},px:{type:"enum",values:Co,default:void 0,responsive:!0},py:{type:"enum",values:Co,default:void 0,responsive:!0},pt:{type:"enum",values:Co,default:void 0,responsive:!0},pr:{type:"enum",values:Co,default:void 0,responsive:!0},pb:{type:"enum",values:Co,default:void 0,responsive:!0},pl:{type:"enum",values:Co,default:void 0,responsive:!0}};function DA(e){const{p:t=Cr.p.default,px:r=Cr.px.default,py:n=Cr.py.default,pt:i=Cr.pt.default,pr:o=Cr.pr.default,pb:s=Cr.pb.default,pl:a=Cr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:o,pb:s,pl:a,rest:c}}function BA(e){return[bt(e.p,"rt-r-p"),bt(e.px,"rt-r-px"),bt(e.py,"rt-r-py"),bt(e.pt,"rt-r-pt"),bt(e.pr,"rt-r-pr"),bt(e.pb,"rt-r-pb"),bt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const LA=["static","relative","absolute","fixed","sticky"],Sa=["auto","0","50%","100%"],Cv=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],Cr={...kA,position:{type:"enum",values:LA,default:void 0,responsive:!0},inset:{type:"enum",values:Sa,default:void 0,responsive:!0},top:{type:"enum",values:Sa,default:void 0,responsive:!0},right:{type:"enum",values:Sa,default:void 0,responsive:!0},bottom:{type:"enum",values:Sa,default:void 0,responsive:!0},left:{type:"enum",values:Sa,default:void 0,responsive:!0},width:{type:"enum",values:Cv,default:void 0,responsive:!0},height:{type:"enum",values:Cv,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function $A(e){const{rest:t,...r}=DA(e),{position:n=Cr.position.default,width:i=Cr.width.default,height:o=Cr.height.default,inset:s=Cr.inset.default,top:a=Cr.top.default,bottom:c=Cr.bottom.default,left:u=Cr.left.default,right:l=Cr.right.default,shrink:d=Cr.shrink.default,grow:p=Cr.grow.default,...w}=t;return{...r,position:n,width:i,height:o,inset:s,top:a,bottom:c,left:u,right:l,shrink:d,grow:p,rest:w}}function FA(e){return[BA(e),bt(e.position,"rt-r-position"),bt(e.shrink,"rt-r-fs"),bt(e.grow,"rt-r-fg"),bt(e.width,"rt-r-w"),bt(e.height,"rt-r-h"),bt(e.inset,"rt-r-inset"),bt(e.top,"rt-r-top"),bt(e.bottom,"rt-r-bottom"),bt(e.left,"rt-r-left"),bt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Mo=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Ao={m:{type:"enum",values:Mo,default:void 0,responsive:!0},mx:{type:"enum",values:Mo,default:void 0,responsive:!0},my:{type:"enum",values:Mo,default:void 0,responsive:!0},mt:{type:"enum",values:Mo,default:void 0,responsive:!0},mr:{type:"enum",values:Mo,default:void 0,responsive:!0},mb:{type:"enum",values:Mo,default:void 0,responsive:!0},ml:{type:"enum",values:Mo,default:void 0,responsive:!0}};function ws(e){const{m:t=Ao.m.default,mx:r=Ao.mx.default,my:n=Ao.my.default,mt:i=Ao.mt.default,mr:o=Ao.mr.default,mb:s=Ao.mb.default,ml:a=Ao.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:o,mb:s,ml:a,rest:c}}function bs(e){return[bt(e.m,"rt-r-m"),bt(e.mx,"rt-r-mx"),bt(e.my,"rt-r-my"),bt(e.mt,"rt-r-mt"),bt(e.mr,"rt-r-mr"),bt(e.mb,"rt-r-mb"),bt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const jd={type:"enum",values:Fr.radius.values,default:void 0},xs={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},Mv=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{rest:i,...o}=$A(r),{className:s,asChild:a,display:c=xs.display.default,direction:u=xs.direction.default,align:l=xs.align.default,justify:d=xs.justify.default,wrap:p=xs.wrap.default,gap:w=xs.gap.default,...b}=i,y=a?_i:"div";return P.createElement(y,{...b,ref:t,className:Xt("rt-Flex",s,bt(c,"rt-r-display"),bt(u,"rt-r-fd"),bt(l,"rt-r-ai"),bt(d,"rt-r-jc",{between:"space-between"}),bt(p,"rt-r-fw"),bt(w,"rt-r-gap"),FA(o),bs(n))})});Mv.displayName="Flex";function Av(e){const t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kd="Checkbox",[UA,wB]=fs(kd),[VA,zA]=UA(kd),Tv=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:l,...d}=e,[p,w]=P.useState(null),b=rr(t,F=>w(F)),y=P.useRef(!1),T=p?l||!!p.closest("form"):!0,[O=!1,R]=ba({prop:i,defaultProp:o,onChange:u}),k=P.useRef(O);return P.useEffect(()=>{const F=p==null?void 0:p.form;if(F){const L=()=>R(k.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[p,R]),x.jsxs(VA,{scope:r,state:O,disabled:a,children:[x.jsx(Yt.button,{type:"button",role:"checkbox","aria-checked":Xi(O)?"mixed":O,"aria-required":s,"data-state":Pv(O),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:b,onKeyDown:Xe(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:Xe(e.onClick,F=>{R(L=>Xi(L)?!0:!L),T&&(y.current=F.isPropagationStopped(),y.current||F.stopPropagation())})}),T&&x.jsx(HA,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:Xi(o)?!1:o})]})});Tv.displayName=kd;var Iv="CheckboxIndicator",Ov=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,o=zA(Iv,r);return x.jsx(On,{present:n||Xi(o.state)||o.state===!0,children:x.jsx(Yt.span,{"data-state":Pv(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ov.displayName=Iv;var HA=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...o}=e,s=P.useRef(null),a=Av(r),c=Ad(t);P.useEffect(()=>{const l=s.current,d=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==r&&w){const b=new Event("click",{bubbles:n});l.indeterminate=Xi(r),w.call(l,Xi(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=P.useRef(Xi(r)?!1:r);return x.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Xi(e){return e==="indeterminate"}function Pv(e){return Xi(e)?"indeterminate":e?"checked":"unchecked"}var qA=Tv,WA=Ov;const hu={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:xa,highContrast:du},pu=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));pu.displayName="ThickCheckIcon";const GA=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));GA.displayName="ChevronDownIcon";const Rv=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));Rv.displayName="ThickChevronRightIcon";const KA=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:e,fillRule:"evenodd",clipRule:"evenodd"})));KA.displayName="InfoCircledIcon";const mu=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{className:i,style:o,size:s=hu.size.default,variant:a=hu.variant.default,color:c=hu.color.default,highContrast:u=hu.highContrast.default,...l}=r;return P.createElement("span",{className:Xt("rt-CheckboxRoot",i,bt(s,"rt-r-size"),bs(n)),style:o},P.createElement(qA,{"data-accent-color":c,...l,ref:t,className:Xt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},P.createElement(WA,{className:"rt-CheckboxIndicator"},P.createElement(pu,{className:"rt-CheckboxIndicatorIcon"}))))});mu.displayName="Checkbox";function YA(e,t=[]){let r=[];function n(o,s){const a=P.createContext(s),c=r.length;r=[...r,s];function u(d){const{scope:p,children:w,...b}=d,y=(p==null?void 0:p[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return x.jsx(y.Provider,{value:T,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,b=P.useContext(w);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,l]}const i=()=>{const o=r.map(s=>P.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,ZA(i,...t)]}function ZA(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((a,{useScope:c,scopeName:u})=>{const d=c(o)[`__scope${u}`];return{...a,...d}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function Nv(e){const t=e+"CollectionProvider",[r,n]=YA(t),[i,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:b,children:y}=w,T=te.useRef(null),O=te.useRef(new Map).current;return x.jsx(i,{scope:b,itemMap:O,collectionRef:T,children:y})};s.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((w,b)=>{const{scope:y,children:T}=w,O=o(a,y),R=rr(b,O.collectionRef);return x.jsx(_i,{ref:R,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",d=te.forwardRef((w,b)=>{const{scope:y,children:T,...O}=w,R=te.useRef(null),k=rr(b,R),F=o(u,y);return te.useEffect(()=>(F.itemMap.set(R,{ref:R,...O}),()=>void F.itemMap.delete(R))),x.jsx(_i,{[l]:"",ref:k,children:T})});d.displayName=u;function p(w){const b=o(e+"CollectionConsumer",w);return te.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((F,L)=>O.indexOf(F.ref.current)-O.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:c,ItemSlot:d},p,n]}function XA(e,t=[]){let r=[];function n(o,s){const a=P.createContext(s),c=r.length;r=[...r,s];function u(d){const{scope:p,children:w,...b}=d,y=(p==null?void 0:p[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return x.jsx(y.Provider,{value:T,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,b=P.useContext(w);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,l]}const i=()=>{const o=r.map(s=>P.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,JA(i,...t)]}function JA(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((a,{useScope:c,scopeName:u})=>{const d=c(o)[`__scope${u}`];return{...a,...d}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Dd="rovingFocusGroup.onEntryFocus",QA={bubbles:!1,cancelable:!0},gu="RovingFocusGroup",[Bd,jv,eT]=Nv(gu),[tT,kv]=XA(gu,[eT]),[rT,nT]=tT(gu),Dv=P.forwardRef((e,t)=>x.jsx(Bd.Provider,{scope:e.__scopeRovingFocusGroup,children:x.jsx(Bd.Slot,{scope:e.__scopeRovingFocusGroup,children:x.jsx(iT,{...e,ref:t})})}));Dv.displayName=gu;var iT=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...d}=e,p=P.useRef(null),w=rr(t,p),b=Rd(o),[y=null,T]=ba({prop:s,defaultProp:a,onChange:c}),[O,R]=P.useState(!1),k=br(u),F=jv(r),L=P.useRef(!1),[q,H]=P.useState(0);return P.useEffect(()=>{const K=p.current;if(K)return K.addEventListener(Dd,k),()=>K.removeEventListener(Dd,k)},[k]),x.jsx(rT,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:y,onItemFocus:P.useCallback(K=>T(K),[T]),onItemShiftTab:P.useCallback(()=>R(!0),[]),onFocusableItemAdd:P.useCallback(()=>H(K=>K+1),[]),onFocusableItemRemove:P.useCallback(()=>H(K=>K-1),[]),children:x.jsx(Yt.div,{tabIndex:O||q===0?-1:0,"data-orientation":n,...d,ref:w,style:{outline:"none",...e.style},onMouseDown:Xe(e.onMouseDown,()=>{L.current=!0}),onFocus:Xe(e.onFocus,K=>{const re=!L.current;if(K.target===K.currentTarget&&re&&!O){const oe=new CustomEvent(Dd,QA);if(K.currentTarget.dispatchEvent(oe),!oe.defaultPrevented){const ae=F().filter(m=>m.focusable),z=ae.find(m=>m.active),D=ae.find(m=>m.id===y),f=[z,D,...ae].filter(Boolean).map(m=>m.ref.current);$v(f,l)}}L.current=!1}),onBlur:Xe(e.onBlur,()=>R(!1))})})}),Bv="RovingFocusGroupItem",Lv=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...s}=e,a=ga(),c=o||a,u=nT(Bv,r),l=u.currentTabStopId===c,d=jv(r),{onFocusableItemAdd:p,onFocusableItemRemove:w}=u;return P.useEffect(()=>{if(n)return p(),()=>w()},[n,p,w]),x.jsx(Bd.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:x.jsx(Yt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Xe(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:Xe(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Xe(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=aT(b,u.orientation,u.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let O=d().filter(R=>R.focusable).map(R=>R.ref.current);if(y==="last")O.reverse();else if(y==="prev"||y==="next"){y==="prev"&&O.reverse();const R=O.indexOf(b.currentTarget);O=u.loop?cT(O,R+1):O.slice(R+1)}setTimeout(()=>$v(O))}})})})});Lv.displayName=Bv;var oT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sT(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function aT(e,t,r){const n=sT(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return oT[n]}function $v(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function cT(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var uT=Dv,lT=Lv;function fT(e,[t,r]){return Math.min(r,Math.max(t,e))}var Ld=0;function dT(){P.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Fv()),document.body.insertAdjacentElement("beforeend",e[1]??Fv()),Ld++,()=>{Ld===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ld--}},[])}function Fv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $d="focusScope.autoFocusOnMount",Fd="focusScope.autoFocusOnUnmount",Uv={bubbles:!1,cancelable:!0},hT="FocusScope",Vv=P.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,c]=P.useState(null),u=br(i),l=br(o),d=P.useRef(null),p=rr(t,y=>c(y)),w=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(n){let y=function(k){if(w.paused||!a)return;const F=k.target;a.contains(F)?d.current=F:Ji(d.current,{select:!0})},T=function(k){if(w.paused||!a)return;const F=k.relatedTarget;F!==null&&(a.contains(F)||Ji(d.current,{select:!0}))},O=function(k){if(document.activeElement===document.body)for(const L of k)L.removedNodes.length>0&&Ji(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",T);const R=new MutationObserver(O);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",T),R.disconnect()}}},[n,a,w.paused]),P.useEffect(()=>{if(a){qv.add(w);const y=document.activeElement;if(!a.contains(y)){const O=new CustomEvent($d,Uv);a.addEventListener($d,u),a.dispatchEvent(O),O.defaultPrevented||(pT(wT(zv(a)),{select:!0}),document.activeElement===y&&Ji(a))}return()=>{a.removeEventListener($d,u),setTimeout(()=>{const O=new CustomEvent(Fd,Uv);a.addEventListener(Fd,l),a.dispatchEvent(O),O.defaultPrevented||Ji(y??document.body,{select:!0}),a.removeEventListener(Fd,l),qv.remove(w)},0)}}},[a,u,l,w]);const b=P.useCallback(y=>{if(!r&&!n||w.paused)return;const T=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,O=document.activeElement;if(T&&O){const R=y.currentTarget,[k,F]=mT(R);k&&F?!y.shiftKey&&O===F?(y.preventDefault(),r&&Ji(k,{select:!0})):y.shiftKey&&O===k&&(y.preventDefault(),r&&Ji(F,{select:!0})):O===R&&y.preventDefault()}},[r,n,w.paused]);return x.jsx(Yt.div,{tabIndex:-1,...s,ref:p,onKeyDown:b})});Vv.displayName=hT;function pT(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ji(n,{select:t}),document.activeElement!==r)return}function mT(e){const t=zv(e),r=Hv(t,e),n=Hv(t.reverse(),e);return[r,n]}function zv(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Hv(e,t){for(const r of e)if(!gT(r,{upTo:t}))return r}function gT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vT(e){return e instanceof HTMLInputElement&&"select"in e}function Ji(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&vT(e)&&t&&e.select()}}var qv=yT();function yT(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Wv(e,t),e.unshift(t)},remove(t){var r;e=Wv(e,t),(r=e[0])==null||r.resume()}}}function Wv(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function wT(e){return e.filter(t=>t.tagName!=="A")}var bT=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ss=new WeakMap,vu=new WeakMap,yu={},Ud=0,Gv=function(e){return e&&(e.host||Gv(e.parentNode))},xT=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Gv(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},ST=function(e,t,r,n){var i=xT(t,Array.isArray(e)?e:[e]);yu[r]||(yu[r]=new WeakMap);var o=yu[r],s=[],a=new Set,c=new Set(i),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};i.forEach(u);var l=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))l(p);else try{var w=p.getAttribute(n),b=w!==null&&w!=="false",y=(Ss.get(p)||0)+1,T=(o.get(p)||0)+1;Ss.set(p,y),o.set(p,T),s.push(p),y===1&&b&&vu.set(p,!0),T===1&&p.setAttribute(r,"true"),b||p.setAttribute(n,"true")}catch(O){console.error("aria-hidden: cannot operate on ",p,O)}})};return l(t),a.clear(),Ud++,function(){s.forEach(function(d){var p=Ss.get(d)-1,w=o.get(d)-1;Ss.set(d,p),o.set(d,w),p||(vu.has(d)||d.removeAttribute(n),vu.delete(d)),w||d.removeAttribute(r)}),Ud--,Ud||(Ss=new WeakMap,Ss=new WeakMap,vu=new WeakMap,yu={})}},ET=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||bT(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),ST(n,i,r,"aria-hidden")):function(){return null}},Jn=function(){return Jn=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Jn.apply(this,arguments)};function Kv(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function _T(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var wu="right-scroll-bar-position",bu="width-before-scroll-bar",CT="with-scroll-bars-hidden",MT="--removed-body-scroll-bar-size";function Vd(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function AT(e,t){var r=te.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var TT=typeof window<"u"?P.useLayoutEffect:P.useEffect,Yv=new WeakMap;function IT(e,t){var r=AT(t||null,function(n){return e.forEach(function(i){return Vd(i,n)})});return TT(function(){var n=Yv.get(r);if(n){var i=new Set(n),o=new Set(e),s=r.current;i.forEach(function(a){o.has(a)||Vd(a,null)}),o.forEach(function(a){i.has(a)||Vd(a,s)})}Yv.set(r,e)},[e]),r}function OT(e){return e}function PT(e,t){t===void 0&&(t=OT);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var s=t(o,n);return r.push(s),function(){r=r.filter(function(a){return a!==s})}},assignSyncMedium:function(o){for(n=!0;r.length;){var s=r;r=[],s.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var s=[];if(r.length){var a=r;r=[],a.forEach(o),s=r}var c=function(){var l=s;s=[],l.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(l){s.push(l),u()},filter:function(l){return s=s.filter(l),r}}}};return i}function RT(e){e===void 0&&(e={});var t=PT(null);return t.options=Jn({async:!0,ssr:!1},e),t}var Zv=function(e){var t=e.sideCar,r=Kv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return P.createElement(n,Jn({},r))};Zv.isSideCarExport=!0;function NT(e,t){return e.useMedium(t),Zv}var Xv=RT(),zd=function(){},xu=P.forwardRef(function(e,t){var r=P.useRef(null),n=P.useState({onScrollCapture:zd,onWheelCapture:zd,onTouchMoveCapture:zd}),i=n[0],o=n[1],s=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,d=e.shards,p=e.sideCar,w=e.noIsolation,b=e.inert,y=e.allowPinchZoom,T=e.as,O=T===void 0?"div":T,R=e.gapMode,k=Kv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=p,L=IT([r,t]),q=Jn(Jn({},k),i);return P.createElement(P.Fragment,null,l&&P.createElement(F,{sideCar:Xv,removeScrollBar:u,shards:d,noIsolation:w,inert:b,setCallbacks:o,allowPinchZoom:!!y,lockRef:r,gapMode:R}),s?P.cloneElement(P.Children.only(a),Jn(Jn({},q),{ref:L})):P.createElement(O,Jn({},q,{className:c,ref:L}),a))});xu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},xu.classNames={fullWidth:bu,zeroRight:wu};var Jv,jT=function(){if(Jv)return Jv;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jT();return t&&e.setAttribute("nonce",t),e}function DT(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BT(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var LT=function(){var e=0,t=null;return{add:function(r){e==0&&(t=kT())&&(DT(t,r),BT(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$T=function(){var e=LT();return function(t,r){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Qv=function(){var e=$T(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},FT={left:0,top:0,right:0,gap:0},Hd=function(e){return parseInt(e||"",10)||0},UT=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Hd(r),Hd(n),Hd(i)]},VT=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return FT;var t=UT(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},zT=Qv(),Es="data-scroll-locked",HT=function(e,t,r,n){var i=e.left,o=e.top,s=e.right,a=e.gap;return r===void 0&&(r="margin"),`
54
- .`.concat(CT,` {
53
+ `}}),P.createElement(zd,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:p,grayColor:x,panelBackground:T,radius:N,scaling:F,onAppearanceChange:d,onAccentColorChange:b,onGrayColorChange:y,onPanelBackgroundChange:O,onRadiusChange:k,onScalingChange:L}))});Kv.displayName="ThemeRoot";const zd=P.forwardRef((e,t)=>{var r,n,i,o,s,a;const c=P.useContext(vu),{asChild:u,isRoot:l,hasBackground:d,appearance:p=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Ur.appearance.default,accentColor:b=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Ur.accentColor.default,grayColor:x=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Ur.grayColor.default,panelBackground:y=(o=c==null?void 0:c.panelBackground)!==null&&o!==void 0?o:Ur.panelBackground.default,radius:T=(s=c==null?void 0:c.radius)!==null&&s!==void 0?s:Ur.radius.default,scaling:O=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Ur.scaling.default,onAppearanceChange:N=Ss,onAccentColorChange:k=Ss,onGrayColorChange:F=Ss,onPanelBackgroundChange:L=Ss,onRadiusChange:W=Ss,onScalingChange:z=Ss,...G}=e,re=u?Ti:"div",oe=x==="auto"?Gv(b):x,ae=e.appearance!==void 0&&e.appearance!=="inherit",H=e.grayColor!==void 0,D=!l&&(d===!0||d!==!1&&(ae||H));return P.createElement(vu.Provider,{value:P.useMemo(()=>({appearance:p,accentColor:b,grayColor:x,resolvedGrayColor:oe,panelBackground:y,radius:T,scaling:O,onAppearanceChange:N,onAccentColorChange:k,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:W,onScalingChange:z}),[p,b,x,oe,y,T,O,N,k,F,L,W,z])},P.createElement(re,{"data-is-root-theme":l?"true":"false","data-accent-color":b,"data-gray-color":oe,"data-has-background":D?"true":"false","data-panel-background":y,"data-radius":T,"data-scaling":O,ref:t,...G,className:Jt("radix-themes",{light:!l&&p==="light",dark:!l&&p==="dark"},G.className)}))});zd.displayName="ThemeImpl";function GT(e){if(e==="inherit")return;const t=document.documentElement;(t.classList.contains("light-theme")||t.classList.contains("dark-theme"))&&(t.classList.remove("light-theme","dark-theme"),t.style.colorScheme=e,t.classList.add(`${e}-theme`)),(t.classList.contains("light")||t.classList.contains("dark"))&&(t.classList.remove("light","dark"),t.style.colorScheme=e,t.classList.add(e))}const Aa={type:"enum",values:Ur.accentColor.values,default:void 0},wu={type:"boolean",default:void 0};function bt(e,t="",r){var n,i,o,s;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),d=t===""?"":"-",p=l?`-${t}`:t,b=l?u==null?void 0:u.substring(1):u;if(b===void 0)continue;const x=(i=r==null?void 0:r[b])!==null&&i!==void 0?i:b,y=c==="initial"?`${p}${d}${x}`:`${c}:${p}${d}${x}`;a.push(y)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,d=c?e.substring(1):e,p=(o=r==null?void 0:r[d])!==null&&o!==void 0?o:d;a.push(`${l}${u}${p}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(s=r==null?void 0:r[u])!==null&&s!==void 0?s:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const ko=["0","1","2","3","4","5","6","7","8","9"],KT={p:{type:"enum",values:ko,default:void 0,responsive:!0},px:{type:"enum",values:ko,default:void 0,responsive:!0},py:{type:"enum",values:ko,default:void 0,responsive:!0},pt:{type:"enum",values:ko,default:void 0,responsive:!0},pr:{type:"enum",values:ko,default:void 0,responsive:!0},pb:{type:"enum",values:ko,default:void 0,responsive:!0},pl:{type:"enum",values:ko,default:void 0,responsive:!0}};function YT(e){const{p:t=Tr.p.default,px:r=Tr.px.default,py:n=Tr.py.default,pt:i=Tr.pt.default,pr:o=Tr.pr.default,pb:s=Tr.pb.default,pl:a=Tr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:o,pb:s,pl:a,rest:c}}function ZT(e){return[bt(e.p,"rt-r-p"),bt(e.px,"rt-r-px"),bt(e.py,"rt-r-py"),bt(e.pt,"rt-r-pt"),bt(e.pr,"rt-r-pr"),bt(e.pb,"rt-r-pb"),bt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const XT=["static","relative","absolute","fixed","sticky"],Ma=["auto","0","50%","100%"],Yv=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],Tr={...KT,position:{type:"enum",values:XT,default:void 0,responsive:!0},inset:{type:"enum",values:Ma,default:void 0,responsive:!0},top:{type:"enum",values:Ma,default:void 0,responsive:!0},right:{type:"enum",values:Ma,default:void 0,responsive:!0},bottom:{type:"enum",values:Ma,default:void 0,responsive:!0},left:{type:"enum",values:Ma,default:void 0,responsive:!0},width:{type:"enum",values:Yv,default:void 0,responsive:!0},height:{type:"enum",values:Yv,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function JT(e){const{rest:t,...r}=YT(e),{position:n=Tr.position.default,width:i=Tr.width.default,height:o=Tr.height.default,inset:s=Tr.inset.default,top:a=Tr.top.default,bottom:c=Tr.bottom.default,left:u=Tr.left.default,right:l=Tr.right.default,shrink:d=Tr.shrink.default,grow:p=Tr.grow.default,...b}=t;return{...r,position:n,width:i,height:o,inset:s,top:a,bottom:c,left:u,right:l,shrink:d,grow:p,rest:b}}function QT(e){return[ZT(e),bt(e.position,"rt-r-position"),bt(e.shrink,"rt-r-fs"),bt(e.grow,"rt-r-fg"),bt(e.width,"rt-r-w"),bt(e.height,"rt-r-h"),bt(e.inset,"rt-r-inset"),bt(e.top,"rt-r-top"),bt(e.bottom,"rt-r-bottom"),bt(e.left,"rt-r-left"),bt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Do=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Bo={m:{type:"enum",values:Do,default:void 0,responsive:!0},mx:{type:"enum",values:Do,default:void 0,responsive:!0},my:{type:"enum",values:Do,default:void 0,responsive:!0},mt:{type:"enum",values:Do,default:void 0,responsive:!0},mr:{type:"enum",values:Do,default:void 0,responsive:!0},mb:{type:"enum",values:Do,default:void 0,responsive:!0},ml:{type:"enum",values:Do,default:void 0,responsive:!0}};function Es(e){const{m:t=Bo.m.default,mx:r=Bo.mx.default,my:n=Bo.my.default,mt:i=Bo.mt.default,mr:o=Bo.mr.default,mb:s=Bo.mb.default,ml:a=Bo.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:o,mb:s,ml:a,rest:c}}function _s(e){return[bt(e.m,"rt-r-m"),bt(e.mx,"rt-r-mx"),bt(e.my,"rt-r-my"),bt(e.mt,"rt-r-mt"),bt(e.mr,"rt-r-mr"),bt(e.mb,"rt-r-mb"),bt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Hd={type:"enum",values:Ur.radius.values,default:void 0},Cs={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},Zv=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{rest:i,...o}=JT(r),{className:s,asChild:a,display:c=Cs.display.default,direction:u=Cs.direction.default,align:l=Cs.align.default,justify:d=Cs.justify.default,wrap:p=Cs.wrap.default,gap:b=Cs.gap.default,...x}=i,y=a?Ti:"div";return P.createElement(y,{...x,ref:t,className:Jt("rt-Flex",s,bt(c,"rt-r-display"),bt(u,"rt-r-fd"),bt(l,"rt-r-ai"),bt(d,"rt-r-jc",{between:"space-between"}),bt(p,"rt-r-fw"),bt(b,"rt-r-gap"),QT(o),_s(n))})});Zv.displayName="Flex";function Xv(e){const t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var qd="Checkbox",[e7,PL]=Mi(qd),[t7,r7]=e7(qd),Jv=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:l,...d}=e,[p,b]=P.useState(null),x=ir(t,F=>b(F)),y=P.useRef(!1),T=p?l||!!p.closest("form"):!0,[O=!1,N]=Ca({prop:i,defaultProp:o,onChange:u}),k=P.useRef(O);return P.useEffect(()=>{const F=p==null?void 0:p.form;if(F){const L=()=>N(k.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[p,N]),w.jsxs(t7,{scope:r,state:O,disabled:a,children:[w.jsx(Zt.button,{type:"button",role:"checkbox","aria-checked":ro(O)?"mixed":O,"aria-required":s,"data-state":ty(O),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:x,onKeyDown:Xe(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:Xe(e.onClick,F=>{N(L=>ro(L)?!0:!L),T&&(y.current=F.isPropagationStopped(),y.current||F.stopPropagation())})}),T&&w.jsx(n7,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:ro(o)?!1:o})]})});Jv.displayName=qd;var Qv="CheckboxIndicator",ey=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,o=r7(Qv,r);return w.jsx(kn,{present:n||ro(o.state)||o.state===!0,children:w.jsx(Zt.span,{"data-state":ty(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});ey.displayName=Qv;var n7=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...o}=e,s=P.useRef(null),a=Xv(r),c=Bd(t);P.useEffect(()=>{const l=s.current,d=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==r&&b){const x=new Event("click",{bubbles:n});l.indeterminate=ro(r),b.call(l,ro(r)?!1:r),l.dispatchEvent(x)}},[a,r,n]);const u=P.useRef(ro(r)?!1:r);return w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ro(e){return e==="indeterminate"}function ty(e){return ro(e)?"indeterminate":e?"checked":"unchecked"}var i7=Jv,o7=ey;const bu={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:Aa,highContrast:wu},xu=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));xu.displayName="ThickCheckIcon";const s7=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));s7.displayName="ChevronDownIcon";const ry=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));ry.displayName="ThickChevronRightIcon";const a7=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:e,fillRule:"evenodd",clipRule:"evenodd"})));a7.displayName="InfoCircledIcon";const Su=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{className:i,style:o,size:s=bu.size.default,variant:a=bu.variant.default,color:c=bu.color.default,highContrast:u=bu.highContrast.default,...l}=r;return P.createElement("span",{className:Jt("rt-CheckboxRoot",i,bt(s,"rt-r-size"),_s(n)),style:o},P.createElement(i7,{"data-accent-color":c,...l,ref:t,className:Jt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},P.createElement(o7,{className:"rt-CheckboxIndicator"},P.createElement(xu,{className:"rt-CheckboxIndicatorIcon"}))))});Su.displayName="Checkbox";function ny(e){const t=e+"CollectionProvider",[r,n]=Mi(t),[i,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:x,children:y}=b,T=ne.useRef(null),O=ne.useRef(new Map).current;return w.jsx(i,{scope:x,itemMap:O,collectionRef:T,children:y})};s.displayName=t;const a=e+"CollectionSlot",c=ne.forwardRef((b,x)=>{const{scope:y,children:T}=b,O=o(a,y),N=ir(x,O.collectionRef);return w.jsx(Ti,{ref:N,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",d=ne.forwardRef((b,x)=>{const{scope:y,children:T,...O}=b,N=ne.useRef(null),k=ir(x,N),F=o(u,y);return ne.useEffect(()=>(F.itemMap.set(N,{ref:N,...O}),()=>void F.itemMap.delete(N))),w.jsx(Ti,{[l]:"",ref:k,children:T})});d.displayName=u;function p(b){const x=o(e+"CollectionConsumer",b);return ne.useCallback(()=>{const T=x.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${l}]`));return Array.from(x.itemMap.values()).sort((F,L)=>O.indexOf(F.ref.current)-O.indexOf(L.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:s,Slot:c,ItemSlot:d},p,n]}var Wd="rovingFocusGroup.onEntryFocus",c7={bubbles:!1,cancelable:!0},Eu="RovingFocusGroup",[Gd,iy,u7]=ny(Eu),[l7,oy]=Mi(Eu,[u7]),[f7,d7]=l7(Eu),sy=P.forwardRef((e,t)=>w.jsx(Gd.Provider,{scope:e.__scopeRovingFocusGroup,children:w.jsx(Gd.Slot,{scope:e.__scopeRovingFocusGroup,children:w.jsx(h7,{...e,ref:t})})}));sy.displayName=Eu;var h7=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...d}=e,p=P.useRef(null),b=ir(t,p),x=Vd(o),[y=null,T]=Ca({prop:s,defaultProp:a,onChange:c}),[O,N]=P.useState(!1),k=br(u),F=iy(r),L=P.useRef(!1),[W,z]=P.useState(0);return P.useEffect(()=>{const G=p.current;if(G)return G.addEventListener(Wd,k),()=>G.removeEventListener(Wd,k)},[k]),w.jsx(f7,{scope:r,orientation:n,dir:x,loop:i,currentTabStopId:y,onItemFocus:P.useCallback(G=>T(G),[T]),onItemShiftTab:P.useCallback(()=>N(!0),[]),onFocusableItemAdd:P.useCallback(()=>z(G=>G+1),[]),onFocusableItemRemove:P.useCallback(()=>z(G=>G-1),[]),children:w.jsx(Zt.div,{tabIndex:O||W===0?-1:0,"data-orientation":n,...d,ref:b,style:{outline:"none",...e.style},onMouseDown:Xe(e.onMouseDown,()=>{L.current=!0}),onFocus:Xe(e.onFocus,G=>{const re=!L.current;if(G.target===G.currentTarget&&re&&!O){const oe=new CustomEvent(Wd,c7);if(G.currentTarget.dispatchEvent(oe),!oe.defaultPrevented){const ae=F().filter(m=>m.focusable),H=ae.find(m=>m.active),D=ae.find(m=>m.id===y),f=[H,D,...ae].filter(Boolean).map(m=>m.ref.current);uy(f,l)}}L.current=!1}),onBlur:Xe(e.onBlur,()=>N(!1))})})}),ay="RovingFocusGroupItem",cy=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...s}=e,a=xa(),c=o||a,u=d7(ay,r),l=u.currentTabStopId===c,d=iy(r),{onFocusableItemAdd:p,onFocusableItemRemove:b}=u;return P.useEffect(()=>{if(n)return p(),()=>b()},[n,p,b]),w.jsx(Gd.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:w.jsx(Zt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Xe(e.onMouseDown,x=>{n?u.onItemFocus(c):x.preventDefault()}),onFocus:Xe(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Xe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=g7(x,u.orientation,u.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let O=d().filter(N=>N.focusable).map(N=>N.ref.current);if(y==="last")O.reverse();else if(y==="prev"||y==="next"){y==="prev"&&O.reverse();const N=O.indexOf(x.currentTarget);O=u.loop?v7(O,N+1):O.slice(N+1)}setTimeout(()=>uy(O))}})})})});cy.displayName=ay;var p7={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function m7(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function g7(e,t,r){const n=m7(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return p7[n]}function uy(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function v7(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var y7=sy,w7=cy;function b7(e,[t,r]){return Math.min(r,Math.max(t,e))}var Kd=0;function x7(){P.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ly()),document.body.insertAdjacentElement("beforeend",e[1]??ly()),Kd++,()=>{Kd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Kd--}},[])}function ly(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Yd="focusScope.autoFocusOnMount",Zd="focusScope.autoFocusOnUnmount",fy={bubbles:!1,cancelable:!0},S7="FocusScope",dy=P.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,c]=P.useState(null),u=br(i),l=br(o),d=P.useRef(null),p=ir(t,y=>c(y)),b=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(n){let y=function(k){if(b.paused||!a)return;const F=k.target;a.contains(F)?d.current=F:no(d.current,{select:!0})},T=function(k){if(b.paused||!a)return;const F=k.relatedTarget;F!==null&&(a.contains(F)||no(d.current,{select:!0}))},O=function(k){if(document.activeElement===document.body)for(const L of k)L.removedNodes.length>0&&no(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",T);const N=new MutationObserver(O);return a&&N.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",T),N.disconnect()}}},[n,a,b.paused]),P.useEffect(()=>{if(a){my.add(b);const y=document.activeElement;if(!a.contains(y)){const O=new CustomEvent(Yd,fy);a.addEventListener(Yd,u),a.dispatchEvent(O),O.defaultPrevented||(E7(T7(hy(a)),{select:!0}),document.activeElement===y&&no(a))}return()=>{a.removeEventListener(Yd,u),setTimeout(()=>{const O=new CustomEvent(Zd,fy);a.addEventListener(Zd,l),a.dispatchEvent(O),O.defaultPrevented||no(y??document.body,{select:!0}),a.removeEventListener(Zd,l),my.remove(b)},0)}}},[a,u,l,b]);const x=P.useCallback(y=>{if(!r&&!n||b.paused)return;const T=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,O=document.activeElement;if(T&&O){const N=y.currentTarget,[k,F]=_7(N);k&&F?!y.shiftKey&&O===F?(y.preventDefault(),r&&no(k,{select:!0})):y.shiftKey&&O===k&&(y.preventDefault(),r&&no(F,{select:!0})):O===N&&y.preventDefault()}},[r,n,b.paused]);return w.jsx(Zt.div,{tabIndex:-1,...s,ref:p,onKeyDown:x})});dy.displayName=S7;function E7(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(no(n,{select:t}),document.activeElement!==r)return}function _7(e){const t=hy(e),r=py(t,e),n=py(t.reverse(),e);return[r,n]}function hy(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function py(e,t){for(const r of e)if(!C7(r,{upTo:t}))return r}function C7(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function A7(e){return e instanceof HTMLInputElement&&"select"in e}function no(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&A7(e)&&t&&e.select()}}var my=M7();function M7(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=gy(e,t),e.unshift(t)},remove(t){var r;e=gy(e,t),(r=e[0])==null||r.resume()}}}function gy(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function T7(e){return e.filter(t=>t.tagName!=="A")}var I7=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},As=new WeakMap,_u=new WeakMap,Cu={},Xd=0,vy=function(e){return e&&(e.host||vy(e.parentNode))},O7=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=vy(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},P7=function(e,t,r,n){var i=O7(t,Array.isArray(e)?e:[e]);Cu[r]||(Cu[r]=new WeakMap);var o=Cu[r],s=[],a=new Set,c=new Set(i),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};i.forEach(u);var l=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))l(p);else try{var b=p.getAttribute(n),x=b!==null&&b!=="false",y=(As.get(p)||0)+1,T=(o.get(p)||0)+1;As.set(p,y),o.set(p,T),s.push(p),y===1&&x&&_u.set(p,!0),T===1&&p.setAttribute(r,"true"),x||p.setAttribute(n,"true")}catch(O){console.error("aria-hidden: cannot operate on ",p,O)}})};return l(t),a.clear(),Xd++,function(){s.forEach(function(d){var p=As.get(d)-1,b=o.get(d)-1;As.set(d,p),o.set(d,b),p||(_u.has(d)||d.removeAttribute(n),_u.delete(d)),b||d.removeAttribute(r)}),Xd--,Xd||(As=new WeakMap,As=new WeakMap,_u=new WeakMap,Cu={})}},R7=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||I7(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),P7(n,i,r,"aria-hidden")):function(){return null}},ti=function(){return ti=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},ti.apply(this,arguments)};function yy(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function N7(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Au="right-scroll-bar-position",Mu="width-before-scroll-bar",j7="with-scroll-bars-hidden",k7="--removed-body-scroll-bar-size";function Jd(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function D7(e,t){var r=ne.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var B7=typeof window<"u"?P.useLayoutEffect:P.useEffect,wy=new WeakMap;function L7(e,t){var r=D7(t||null,function(n){return e.forEach(function(i){return Jd(i,n)})});return B7(function(){var n=wy.get(r);if(n){var i=new Set(n),o=new Set(e),s=r.current;i.forEach(function(a){o.has(a)||Jd(a,null)}),o.forEach(function(a){i.has(a)||Jd(a,s)})}wy.set(r,e)},[e]),r}function $7(e){return e}function F7(e,t){t===void 0&&(t=$7);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var s=t(o,n);return r.push(s),function(){r=r.filter(function(a){return a!==s})}},assignSyncMedium:function(o){for(n=!0;r.length;){var s=r;r=[],s.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var s=[];if(r.length){var a=r;r=[],a.forEach(o),s=r}var c=function(){var l=s;s=[],l.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(l){s.push(l),u()},filter:function(l){return s=s.filter(l),r}}}};return i}function U7(e){e===void 0&&(e={});var t=F7(null);return t.options=ti({async:!0,ssr:!1},e),t}var by=function(e){var t=e.sideCar,r=yy(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return P.createElement(n,ti({},r))};by.isSideCarExport=!0;function V7(e,t){return e.useMedium(t),by}var xy=U7(),Qd=function(){},Tu=P.forwardRef(function(e,t){var r=P.useRef(null),n=P.useState({onScrollCapture:Qd,onWheelCapture:Qd,onTouchMoveCapture:Qd}),i=n[0],o=n[1],s=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,d=e.shards,p=e.sideCar,b=e.noIsolation,x=e.inert,y=e.allowPinchZoom,T=e.as,O=T===void 0?"div":T,N=e.gapMode,k=yy(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=p,L=L7([r,t]),W=ti(ti({},k),i);return P.createElement(P.Fragment,null,l&&P.createElement(F,{sideCar:xy,removeScrollBar:u,shards:d,noIsolation:b,inert:x,setCallbacks:o,allowPinchZoom:!!y,lockRef:r,gapMode:N}),s?P.cloneElement(P.Children.only(a),ti(ti({},W),{ref:L})):P.createElement(O,ti({},W,{className:c,ref:L}),a))});Tu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Tu.classNames={fullWidth:Mu,zeroRight:Au};var Sy,z7=function(){if(Sy)return Sy;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function H7(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=z7();return t&&e.setAttribute("nonce",t),e}function q7(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function W7(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var G7=function(){var e=0,t=null;return{add:function(r){e==0&&(t=H7())&&(q7(t,r),W7(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},K7=function(){var e=G7();return function(t,r){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ey=function(){var e=K7(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},Y7={left:0,top:0,right:0,gap:0},eh=function(e){return parseInt(e||"",10)||0},Z7=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[eh(r),eh(n),eh(i)]},X7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Y7;var t=Z7(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},J7=Ey(),Ms="data-scroll-locked",Q7=function(e,t,r,n){var i=e.left,o=e.top,s=e.right,a=e.gap;return r===void 0&&(r="margin"),`
54
+ .`.concat(j7,` {
55
55
  overflow: hidden `).concat(n,`;
56
56
  padding-right: `).concat(a,"px ").concat(n,`;
57
57
  }
58
- body[`).concat(Es,`] {
58
+ body[`).concat(Ms,`] {
59
59
  overflow: hidden `).concat(n,`;
60
60
  overscroll-behavior: contain;
61
61
  `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
@@ -68,38 +68,38 @@ body { background-color: var(--color-page-background); }
68
68
  `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
69
69
  }
70
70
 
71
- .`).concat(wu,` {
71
+ .`).concat(Au,` {
72
72
  right: `).concat(a,"px ").concat(n,`;
73
73
  }
74
74
 
75
- .`).concat(bu,` {
75
+ .`).concat(Mu,` {
76
76
  margin-right: `).concat(a,"px ").concat(n,`;
77
77
  }
78
78
 
79
- .`).concat(wu," .").concat(wu,` {
79
+ .`).concat(Au," .").concat(Au,` {
80
80
  right: 0 `).concat(n,`;
81
81
  }
82
82
 
83
- .`).concat(bu," .").concat(bu,` {
83
+ .`).concat(Mu," .").concat(Mu,` {
84
84
  margin-right: 0 `).concat(n,`;
85
85
  }
86
86
 
87
- body[`).concat(Es,`] {
88
- `).concat(MT,": ").concat(a,`px;
87
+ body[`).concat(Ms,`] {
88
+ `).concat(k7,": ").concat(a,`px;
89
89
  }
90
- `)},ey=function(){var e=parseInt(document.body.getAttribute(Es)||"0",10);return isFinite(e)?e:0},qT=function(){P.useEffect(function(){return document.body.setAttribute(Es,(ey()+1).toString()),function(){var e=ey()-1;e<=0?document.body.removeAttribute(Es):document.body.setAttribute(Es,e.toString())}},[])},WT=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;qT();var o=P.useMemo(function(){return VT(i)},[i]);return P.createElement(zT,{styles:HT(o,!t,i,r?"":"!important")})},qd=!1;if(typeof window<"u")try{var Su=Object.defineProperty({},"passive",{get:function(){return qd=!0,!0}});window.addEventListener("test",Su,Su),window.removeEventListener("test",Su,Su)}catch{qd=!1}var _s=qd?{passive:!1}:!1,GT=function(e){return e.tagName==="TEXTAREA"},ty=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!GT(e)&&r[t]==="visible")},KT=function(e){return ty(e,"overflowY")},YT=function(e){return ty(e,"overflowX")},ry=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=ny(e,n);if(i){var o=iy(e,n),s=o[1],a=o[2];if(s>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ZT=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},XT=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},ny=function(e,t){return e==="v"?KT(t):YT(t)},iy=function(e,t){return e==="v"?ZT(t):XT(t)},JT=function(e,t){return e==="h"&&t==="rtl"?-1:1},QT=function(e,t,r,n,i){var o=JT(e,window.getComputedStyle(t).direction),s=o*n,a=r.target,c=t.contains(a),u=!1,l=s>0,d=0,p=0;do{var w=iy(e,a),b=w[0],y=w[1],T=w[2],O=y-T-o*b;(b||O)&&ny(e,a)&&(d+=O,p+=b),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(l&&(i&&Math.abs(d)<1||!i&&s>d)||!l&&(i&&Math.abs(p)<1||!i&&-s>p))&&(u=!0),u},Eu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oy=function(e){return[e.deltaX,e.deltaY]},sy=function(e){return e&&"current"in e?e.current:e},e7=function(e,t){return e[0]===t[0]&&e[1]===t[1]},t7=function(e){return`
90
+ `)},_y=function(){var e=parseInt(document.body.getAttribute(Ms)||"0",10);return isFinite(e)?e:0},eI=function(){P.useEffect(function(){return document.body.setAttribute(Ms,(_y()+1).toString()),function(){var e=_y()-1;e<=0?document.body.removeAttribute(Ms):document.body.setAttribute(Ms,e.toString())}},[])},tI=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;eI();var o=P.useMemo(function(){return X7(i)},[i]);return P.createElement(J7,{styles:Q7(o,!t,i,r?"":"!important")})},th=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return th=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{th=!1}var Ts=th?{passive:!1}:!1,rI=function(e){return e.tagName==="TEXTAREA"},Cy=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!rI(e)&&r[t]==="visible")},nI=function(e){return Cy(e,"overflowY")},iI=function(e){return Cy(e,"overflowX")},Ay=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=My(e,n);if(i){var o=Ty(e,n),s=o[1],a=o[2];if(s>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},oI=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},sI=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},My=function(e,t){return e==="v"?nI(t):iI(t)},Ty=function(e,t){return e==="v"?oI(t):sI(t)},aI=function(e,t){return e==="h"&&t==="rtl"?-1:1},cI=function(e,t,r,n,i){var o=aI(e,window.getComputedStyle(t).direction),s=o*n,a=r.target,c=t.contains(a),u=!1,l=s>0,d=0,p=0;do{var b=Ty(e,a),x=b[0],y=b[1],T=b[2],O=y-T-o*x;(x||O)&&My(e,a)&&(d+=O,p+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(l&&(i&&Math.abs(d)<1||!i&&s>d)||!l&&(i&&Math.abs(p)<1||!i&&-s>p))&&(u=!0),u},Ou=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Iy=function(e){return[e.deltaX,e.deltaY]},Oy=function(e){return e&&"current"in e?e.current:e},uI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lI=function(e){return`
91
91
  .block-interactivity-`.concat(e,` {pointer-events: none;}
92
92
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
93
- `)},r7=0,Cs=[];function n7(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(r7++)[0],o=P.useState(Qv)[0],s=P.useRef(e);P.useEffect(function(){s.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=_T([e.lockRef.current],(e.shards||[]).map(sy),!0).filter(Boolean);return y.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(y,T){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var O=Eu(y),R=r.current,k="deltaX"in y?y.deltaX:R[0]-O[0],F="deltaY"in y?y.deltaY:R[1]-O[1],L,q=y.target,H=Math.abs(k)>Math.abs(F)?"h":"v";if("touches"in y&&H==="h"&&q.type==="range")return!1;var K=ry(H,q);if(!K)return!0;if(K?L=H:(L=H==="v"?"h":"v",K=ry(H,q)),!K)return!1;if(!n.current&&"changedTouches"in y&&(k||F)&&(n.current=L),!L)return!0;var re=n.current||L;return QT(re,T,y,re==="h"?k:F,!0)},[]),c=P.useCallback(function(y){var T=y;if(!(!Cs.length||Cs[Cs.length-1]!==o)){var O="deltaY"in T?oy(T):Eu(T),R=t.current.filter(function(L){return L.name===T.type&&(L.target===T.target||T.target===L.shadowParent)&&e7(L.delta,O)})[0];if(R&&R.should){T.cancelable&&T.preventDefault();return}if(!R){var k=(s.current.shards||[]).map(sy).filter(Boolean).filter(function(L){return L.contains(T.target)}),F=k.length>0?a(T,k[0]):!s.current.noIsolation;F&&T.cancelable&&T.preventDefault()}}},[]),u=P.useCallback(function(y,T,O,R){var k={name:y,delta:T,target:O,should:R,shadowParent:i7(O)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(F){return F!==k})},1)},[]),l=P.useCallback(function(y){r.current=Eu(y),n.current=void 0},[]),d=P.useCallback(function(y){u(y.type,oy(y),y.target,a(y,e.lockRef.current))},[]),p=P.useCallback(function(y){u(y.type,Eu(y),y.target,a(y,e.lockRef.current))},[]);P.useEffect(function(){return Cs.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,_s),document.addEventListener("touchmove",c,_s),document.addEventListener("touchstart",l,_s),function(){Cs=Cs.filter(function(y){return y!==o}),document.removeEventListener("wheel",c,_s),document.removeEventListener("touchmove",c,_s),document.removeEventListener("touchstart",l,_s)}},[]);var w=e.removeScrollBar,b=e.inert;return P.createElement(P.Fragment,null,b?P.createElement(o,{styles:t7(i)}):null,w?P.createElement(WT,{gapMode:e.gapMode}):null)}function i7(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const o7=NT(Xv,n7);var ay=P.forwardRef(function(e,t){return P.createElement(xu,Jn({},e,{ref:t,sideCar:o7}))});ay.classNames=xu.classNames;const s7=ay;function a7(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var Wd="ScrollArea",[cy,SB]=fs(Wd),[c7,un]=cy(Wd),uy=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:o=600,...s}=e,[a,c]=P.useState(null),[u,l]=P.useState(null),[d,p]=P.useState(null),[w,b]=P.useState(null),[y,T]=P.useState(null),[O,R]=P.useState(0),[k,F]=P.useState(0),[L,q]=P.useState(!1),[H,K]=P.useState(!1),re=rr(t,ae=>c(ae)),oe=Rd(i);return x.jsx(c7,{scope:r,type:n,dir:oe,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:l,content:d,onContentChange:p,scrollbarX:w,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:q,scrollbarY:y,onScrollbarYChange:T,scrollbarYEnabled:H,onScrollbarYEnabledChange:K,onCornerWidthChange:R,onCornerHeightChange:F,children:x.jsx(Yt.div,{dir:oe,...s,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":O+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});uy.displayName=Wd;var ly="ScrollAreaViewport",fy=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...o}=e,s=un(ly,r),a=P.useRef(null),c=rr(t,a,s.onViewportChange);return x.jsxs(x.Fragment,{children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),x.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:x.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});fy.displayName=ly;var Qn="ScrollAreaScrollbar",dy=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(Qn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?o(!0):s(!0),()=>{a?o(!1):s(!1)}),[a,o,s]),i.type==="hover"?x.jsx(u7,{...n,ref:t,forceMount:r}):i.type==="scroll"?x.jsx(l7,{...n,ref:t,forceMount:r}):i.type==="auto"?x.jsx(hy,{...n,ref:t,forceMount:r}):i.type==="always"?x.jsx(Gd,{...n,ref:t}):null});dy.displayName=Qn;var u7=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(Qn,e.__scopeScrollArea),[o,s]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},l=()=>{c=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),x.jsx(On,{present:r||o,children:x.jsx(hy,{"data-state":o?"visible":"hidden",...n,ref:t})})}),l7=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(Qn,e.__scopeScrollArea),o=e.orientation==="horizontal",s=Au(()=>c("SCROLL_END"),100),[a,c]=a7("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return P.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),P.useEffect(()=>{const u=i.viewport,l=o?"scrollLeft":"scrollTop";if(u){let d=u[l];const p=()=>{const w=u[l];d!==w&&(c("SCROLL"),s()),d=w};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[i.viewport,o,c,s]),x.jsx(On,{present:r||a!=="hidden",children:x.jsx(Gd,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Xe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Xe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),hy=P.forwardRef((e,t)=>{const r=un(Qn,e.__scopeScrollArea),{forceMount:n,...i}=e,[o,s]=P.useState(!1),a=e.orientation==="horizontal",c=Au(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;s(a?u:l)}},10);return Ms(r.viewport,c),Ms(r.content,c),x.jsx(On,{present:n||o,children:x.jsx(Gd,{"data-state":o?"visible":"hidden",...i,ref:t})})}),Gd=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=un(Qn,e.__scopeScrollArea),o=P.useRef(null),s=P.useRef(0),[a,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=yy(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>o.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function d(p,w){return g7(p,s.current,a,w)}return r==="horizontal"?x.jsx(f7,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollLeft,w=wy(p,a,i.dir);o.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}}):r==="vertical"?x.jsx(d7,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollTop,w=wy(p,a);o.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}}):null}),f7=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=un(Qn,e.__scopeScrollArea),[s,a]=P.useState(),c=P.useRef(null),u=rr(t,c,o.onScrollbarXChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),x.jsx(my,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Mu(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,d)=>{if(o.viewport){const p=o.viewport.scrollLeft+l.deltaX;e.onWheelScroll(p),xy(p,d)&&l.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Cu(s.paddingLeft),paddingEnd:Cu(s.paddingRight)}})}})}),d7=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=un(Qn,e.__scopeScrollArea),[s,a]=P.useState(),c=P.useRef(null),u=rr(t,c,o.onScrollbarYChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),x.jsx(my,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Mu(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,d)=>{if(o.viewport){const p=o.viewport.scrollTop+l.deltaY;e.onWheelScroll(p),xy(p,d)&&l.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Cu(s.paddingTop),paddingEnd:Cu(s.paddingBottom)}})}})}),[h7,py]=cy(Qn),my=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:d,...p}=e,w=un(Qn,r),[b,y]=P.useState(null),T=rr(t,re=>y(re)),O=P.useRef(null),R=P.useRef(""),k=w.viewport,F=n.content-n.viewport,L=br(l),q=br(c),H=Au(d,10);function K(re){if(O.current){const oe=re.clientX-O.current.left,ae=re.clientY-O.current.top;u({x:oe,y:ae})}}return P.useEffect(()=>{const re=oe=>{const ae=oe.target;(b==null?void 0:b.contains(ae))&&L(oe,F)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[k,b,F,L]),P.useEffect(q,[n,q]),Ms(b,H),Ms(w.content,H),x.jsx(h7,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:br(o),onThumbPointerUp:br(s),onThumbPositionChange:q,onThumbPointerDown:br(a),children:x.jsx(Yt.div,{...p,ref:T,style:{position:"absolute",...p.style},onPointerDown:Xe(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),O.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),K(re))}),onPointerMove:Xe(e.onPointerMove,K),onPointerUp:Xe(e.onPointerUp,re=>{const oe=re.target;oe.hasPointerCapture(re.pointerId)&&oe.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=R.current,w.viewport&&(w.viewport.style.scrollBehavior=""),O.current=null})})})}),_u="ScrollAreaThumb",gy=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=py(_u,e.__scopeScrollArea);return x.jsx(On,{present:r||i.hasThumb,children:x.jsx(p7,{ref:t,...n})})}),p7=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,o=un(_u,r),s=py(_u,r),{onThumbPositionChange:a}=s,c=rr(t,d=>s.onThumbChange(d)),u=P.useRef(),l=Au(()=>{u.current&&(u.current(),u.current=void 0)},100);return P.useEffect(()=>{const d=o.viewport;if(d){const p=()=>{if(l(),!u.current){const w=v7(d,a);u.current=w,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[o.viewport,l,a]),x.jsx(Yt.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Xe(e.onPointerDownCapture,d=>{const w=d.target.getBoundingClientRect(),b=d.clientX-w.left,y=d.clientY-w.top;s.onThumbPointerDown({x:b,y})}),onPointerUp:Xe(e.onPointerUp,s.onThumbPointerUp)})});gy.displayName=_u;var Kd="ScrollAreaCorner",vy=P.forwardRef((e,t)=>{const r=un(Kd,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?x.jsx(m7,{...e,ref:t}):null});vy.displayName=Kd;var m7=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=un(Kd,r),[o,s]=P.useState(0),[a,c]=P.useState(0),u=!!(o&&a);return Ms(i.scrollbarX,()=>{var d;const l=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Ms(i.scrollbarY,()=>{var d;const l=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(l),s(l)}),u?x.jsx(Yt.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Cu(e){return e?parseInt(e,10):0}function yy(e,t){const r=e/t;return isNaN(r)?0:r}function Mu(e){const t=yy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function g7(e,t,r,n="ltr"){const i=Mu(r),o=i/2,s=t||o,a=i-s,c=r.scrollbar.paddingStart+s,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,d=n==="ltr"?[0,l]:[l*-1,0];return by([c,u],d)(e)}function wy(e,t,r="ltr"){const n=Mu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,s]:[s*-1,0],u=fT(e,c);return by([0,s],[0,a])(u)}function by(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function xy(e,t){return e>0&&e<t}var v7=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},s=r.left!==o.left,a=r.top!==o.top;(s||a)&&t(),r=o,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function Au(e,t){const r=br(e),n=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(n.current),[]),P.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Ms(e,t){const r=br(t);Gi(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var y7=uy,w7=fy,Sy=dy,Ey=gy,b7=vy,Yd="Switch",[x7,EB]=fs(Yd),[S7,E7]=x7(Yd),_y=P.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:l,...d}=e,[p,w]=P.useState(null),b=rr(t,k=>w(k)),y=P.useRef(!1),T=p?l||!!p.closest("form"):!0,[O=!1,R]=ba({prop:i,defaultProp:o,onChange:u});return x.jsxs(S7,{scope:r,checked:O,disabled:a,children:[x.jsx(Yt.button,{type:"button",role:"switch","aria-checked":O,"aria-required":s,"data-state":Ay(O),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:b,onClick:Xe(e.onClick,k=>{R(F=>!F),T&&(y.current=k.isPropagationStopped(),y.current||k.stopPropagation())})}),T&&x.jsx(_7,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});_y.displayName=Yd;var Cy="SwitchThumb",My=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=E7(Cy,r);return x.jsx(Yt.span,{"data-state":Ay(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});My.displayName=Cy;var _7=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,o=P.useRef(null),s=Av(r),a=Ad(t);return P.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&d){const p=new Event("click",{bubbles:n});d.call(c,r),c.dispatchEvent(p)}},[s,r,n]),x.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ay(e){return e?"checked":"unchecked"}var C7=_y,M7=My;const Ea={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:xa,highContrast:du,radius:jd},Ty=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{className:i,style:o,size:s=Ea.size.default,variant:a=Ea.variant.default,color:c=Ea.color.default,highContrast:u=Ea.highContrast.default,radius:l=Ea.radius.default,...d}=r;return P.createElement("span",{"data-radius":l,className:Xt("rt-SwitchRoot",i,bt(s,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},bs(n)),style:o},P.createElement(C7,{"data-accent-color":c,...d,ref:t,className:Xt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(M7,{className:Xt("rt-SwitchThumb",{"rt-high-contrast":u})})))});Ty.displayName="Switch";var Zd=["Enter"," "],A7=["ArrowDown","PageUp","Home"],Iy=["ArrowUp","PageDown","End"],T7=[...A7,...Iy],I7={ltr:[...Zd,"ArrowRight"],rtl:[...Zd,"ArrowLeft"]},O7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_a="Menu",[Ca,P7,R7]=Nv(_a),[To,Oy]=fs(_a,[R7,su,kv]),Ma=su(),Py=kv(),[Ry,Qi]=To(_a),[N7,Aa]=To(_a),Ny=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:o,modal:s=!0}=e,a=Ma(t),[c,u]=P.useState(null),l=P.useRef(!1),d=br(o),p=Rd(i);return P.useEffect(()=>{const w=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),x.jsx(uv,{...a,children:x.jsx(Ry,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:x.jsx(N7,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:l,dir:p,modal:s,children:n})})})};Ny.displayName=_a;var j7="MenuAnchor",Xd=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ma(r);return x.jsx(lv,{...i,...n,ref:t})});Xd.displayName=j7;var Jd="MenuPortal",[k7,jy]=To(Jd,{forceMount:void 0}),ky=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=Qi(Jd,t);return x.jsx(k7,{scope:t,forceMount:r,children:x.jsx(On,{present:r||o.open,children:x.jsx(hv,{asChild:!0,container:i,children:n})})})};ky.displayName=Jd;var ln="MenuContent",[D7,Qd]=To(ln),Dy=P.forwardRef((e,t)=>{const r=jy(ln,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=Qi(ln,e.__scopeMenu),s=Aa(ln,e.__scopeMenu);return x.jsx(Ca.Provider,{scope:e.__scopeMenu,children:x.jsx(On,{present:n||o.open,children:x.jsx(Ca.Slot,{scope:e.__scopeMenu,children:s.modal?x.jsx(B7,{...i,ref:t}):x.jsx(L7,{...i,ref:t})})})})}),B7=P.forwardRef((e,t)=>{const r=Qi(ln,e.__scopeMenu),n=P.useRef(null),i=rr(t,n);return P.useEffect(()=>{const o=n.current;if(o)return ET(o)},[]),x.jsx(eh,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Xe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),L7=P.forwardRef((e,t)=>{const r=Qi(ln,e.__scopeMenu);return x.jsx(eh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),eh=P.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:p,onDismiss:w,disableOutsideScroll:b,...y}=e,T=Qi(ln,r),O=Aa(ln,r),R=Ma(r),k=Py(r),F=P7(r),[L,q]=P.useState(null),H=P.useRef(null),K=rr(t,H,T.onContentChange),re=P.useRef(0),oe=P.useRef(""),ae=P.useRef(0),z=P.useRef(null),D=P.useRef("right"),h=P.useRef(0),f=b?s7:P.Fragment,m=b?{as:_i,allowPinchZoom:!0}:void 0,S=_=>{var le,me;const I=oe.current+_,C=F().filter(xe=>!xe.disabled),g=document.activeElement,v=(le=C.find(xe=>xe.ref.current===g))==null?void 0:le.textValue,N=C.map(xe=>xe.textValue),ee=Z7(N,I,v),ie=(me=C.find(xe=>xe.textValue===ee))==null?void 0:me.ref.current;(function xe(be){oe.current=be,window.clearTimeout(re.current),be!==""&&(re.current=window.setTimeout(()=>xe(""),1e3))})(I),ie&&setTimeout(()=>ie.focus())};P.useEffect(()=>()=>window.clearTimeout(re.current),[]),dT();const M=P.useCallback(_=>{var C,g;return D.current===((C=z.current)==null?void 0:C.side)&&J7(_,(g=z.current)==null?void 0:g.area)},[]);return x.jsx(D7,{scope:r,searchRef:oe,onItemEnter:P.useCallback(_=>{M(_)&&_.preventDefault()},[M]),onItemLeave:P.useCallback(_=>{var I;M(_)||((I=H.current)==null||I.focus(),q(null))},[M]),onTriggerLeave:P.useCallback(_=>{M(_)&&_.preventDefault()},[M]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:P.useCallback(_=>{z.current=_},[]),children:x.jsx(f,{...m,children:x.jsx(Vv,{asChild:!0,trapped:i,onMountAutoFocus:Xe(o,_=>{var I;_.preventDefault(),(I=H.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:x.jsx(pd,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:p,onDismiss:w,children:x.jsx(uT,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:q,onEntryFocus:Xe(c,_=>{O.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:x.jsx(fv,{role:"menu","aria-orientation":"vertical","data-state":ew(T.open),"data-radix-menu-content":"",dir:O.dir,...R,...y,ref:K,style:{outline:"none",...y.style},onKeyDown:Xe(y.onKeyDown,_=>{const C=_.target.closest("[data-radix-menu-content]")===_.currentTarget,g=_.ctrlKey||_.altKey||_.metaKey,v=_.key.length===1;C&&(_.key==="Tab"&&_.preventDefault(),!g&&v&&S(_.key));const N=H.current;if(_.target!==N||!T7.includes(_.key))return;_.preventDefault();const ie=F().filter(le=>!le.disabled).map(le=>le.ref.current);Iy.includes(_.key)&&ie.reverse(),K7(ie)}),onBlur:Xe(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(re.current),oe.current="")}),onPointerMove:Xe(e.onPointerMove,Ia(_=>{const I=_.target,C=h.current!==_.clientX;if(_.currentTarget.contains(I)&&C){const g=_.clientX>h.current?"right":"left";D.current=g,h.current=_.clientX}}))})})})})})})});Dy.displayName=ln;var $7="MenuGroup",th=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return x.jsx(Yt.div,{role:"group",...n,ref:t})});th.displayName=$7;var F7="MenuLabel",By=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return x.jsx(Yt.div,{...n,ref:t})});By.displayName=F7;var Tu="MenuItem",Ly="menu.itemSelect",Iu=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=P.useRef(null),s=Aa(Tu,e.__scopeMenu),a=Qd(Tu,e.__scopeMenu),c=rr(t,o),u=P.useRef(!1),l=()=>{const d=o.current;if(!r&&d){const p=new CustomEvent(Ly,{bubbles:!0,cancelable:!0});d.addEventListener(Ly,w=>n==null?void 0:n(w),{once:!0}),P1(d,p),p.defaultPrevented?u.current=!1:s.onClose()}};return x.jsx($y,{...i,ref:c,disabled:r,onClick:Xe(e.onClick,l),onPointerDown:d=>{var p;(p=e.onPointerDown)==null||p.call(e,d),u.current=!0},onPointerUp:Xe(e.onPointerUp,d=>{var p;u.current||(p=d.currentTarget)==null||p.click()}),onKeyDown:Xe(e.onKeyDown,d=>{const p=a.searchRef.current!=="";r||p&&d.key===" "||Zd.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Iu.displayName=Tu;var $y=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,s=Qd(Tu,r),a=Py(r),c=P.useRef(null),u=rr(t,c),[l,d]=P.useState(!1),[p,w]=P.useState("");return P.useEffect(()=>{const b=c.current;b&&w((b.textContent??"").trim())},[o.children]),x.jsx(Ca.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:x.jsx(lT,{asChild:!0,...a,focusable:!n,children:x.jsx(Yt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:Xe(e.onPointerMove,Ia(b=>{n?s.onItemLeave(b):(s.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Xe(e.onPointerLeave,Ia(b=>s.onItemLeave(b))),onFocus:Xe(e.onFocus,()=>d(!0)),onBlur:Xe(e.onBlur,()=>d(!1))})})})}),U7="MenuCheckboxItem",Fy=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return x.jsx(qy,{scope:e.__scopeMenu,checked:r,children:x.jsx(Iu,{role:"menuitemcheckbox","aria-checked":Ou(r)?"mixed":r,...i,ref:t,"data-state":ih(r),onSelect:Xe(i.onSelect,()=>n==null?void 0:n(Ou(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Fy.displayName=U7;var Uy="MenuRadioGroup",[V7,z7]=To(Uy,{value:void 0,onValueChange:()=>{}}),Vy=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,o=br(n);return x.jsx(V7,{scope:e.__scopeMenu,value:r,onValueChange:o,children:x.jsx(th,{...i,ref:t})})});Vy.displayName=Uy;var zy="MenuRadioItem",Hy=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=z7(zy,e.__scopeMenu),o=r===i.value;return x.jsx(qy,{scope:e.__scopeMenu,checked:o,children:x.jsx(Iu,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":ih(o),onSelect:Xe(n.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,r)},{checkForDefaultPrevented:!1})})})});Hy.displayName=zy;var rh="MenuItemIndicator",[qy,H7]=To(rh,{checked:!1}),Wy=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,o=H7(rh,r);return x.jsx(On,{present:n||Ou(o.checked)||o.checked===!0,children:x.jsx(Yt.span,{...i,ref:t,"data-state":ih(o.checked)})})});Wy.displayName=rh;var q7="MenuSeparator",Gy=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return x.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Gy.displayName=q7;var W7="MenuArrow",Ky=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ma(r);return x.jsx(dv,{...i,...n,ref:t})});Ky.displayName=W7;var nh="MenuSub",[G7,Yy]=To(nh),Zy=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,o=Qi(nh,t),s=Ma(t),[a,c]=P.useState(null),[u,l]=P.useState(null),d=br(i);return P.useEffect(()=>(o.open===!1&&d(!1),()=>d(!1)),[o.open,d]),x.jsx(uv,{...s,children:x.jsx(Ry,{scope:t,open:n,onOpenChange:d,content:u,onContentChange:l,children:x.jsx(G7,{scope:t,contentId:ga(),triggerId:ga(),trigger:a,onTriggerChange:c,children:r})})})};Zy.displayName=nh;var Ta="MenuSubTrigger",Xy=P.forwardRef((e,t)=>{const r=Qi(Ta,e.__scopeMenu),n=Aa(Ta,e.__scopeMenu),i=Yy(Ta,e.__scopeMenu),o=Qd(Ta,e.__scopeMenu),s=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},l=P.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return P.useEffect(()=>l,[l]),P.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),c(null)}},[a,c]),x.jsx(Xd,{asChild:!0,...u,children:x.jsx($y,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":ew(r.open),...e,ref:Zc(t,i.onTriggerChange),onClick:d=>{var p;(p=e.onClick)==null||p.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Xe(e.onPointerMove,Ia(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:Xe(e.onPointerLeave,Ia(d=>{var w,b;l();const p=(w=r.content)==null?void 0:w.getBoundingClientRect();if(p){const y=(b=r.content)==null?void 0:b.dataset.side,T=y==="right",O=T?-5:5,R=p[T?"left":"right"],k=p[T?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+O,y:d.clientY},{x:R,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:R,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Xe(e.onKeyDown,d=>{var w;const p=o.searchRef.current!=="";e.disabled||p&&d.key===" "||I7[n.dir].includes(d.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),d.preventDefault())})})})});Xy.displayName=Ta;var Jy="MenuSubContent",Qy=P.forwardRef((e,t)=>{const r=jy(ln,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=Qi(ln,e.__scopeMenu),s=Aa(ln,e.__scopeMenu),a=Yy(Jy,e.__scopeMenu),c=P.useRef(null),u=rr(t,c);return x.jsx(Ca.Provider,{scope:e.__scopeMenu,children:x.jsx(On,{present:n||o.open,children:x.jsx(Ca.Slot,{scope:e.__scopeMenu,children:x.jsx(eh,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var d;s.isUsingKeyboardRef.current&&((d=c.current)==null||d.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:Xe(e.onFocusOutside,l=>{l.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Xe(e.onEscapeKeyDown,l=>{s.onClose(),l.preventDefault()}),onKeyDown:Xe(e.onKeyDown,l=>{var w;const d=l.currentTarget.contains(l.target),p=O7[s.dir].includes(l.key);d&&p&&(o.onOpenChange(!1),(w=a.trigger)==null||w.focus(),l.preventDefault())})})})})})});Qy.displayName=Jy;function ew(e){return e?"open":"closed"}function Ou(e){return e==="indeterminate"}function ih(e){return Ou(e)?"indeterminate":e?"checked":"unchecked"}function K7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function Y7(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function Z7(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let s=Y7(e,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==r));const c=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function X7(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,c=t[o].y,u=t[s].x,l=t[s].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function J7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return X7(r,t)}function Ia(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Q7=Ny,e9=Xd,t9=ky,r9=Dy,n9=th,i9=By,o9=Iu,s9=Fy,a9=Vy,c9=Hy,u9=Wy,l9=Gy,f9=Ky,d9=Zy,h9=Xy,p9=Qy,oh="DropdownMenu",[m9,MB]=fs(oh,[Oy]),kr=Oy(),[g9,tw]=m9(oh),rw=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,c=kr(t),u=P.useRef(null),[l=!1,d]=ba({prop:i,defaultProp:o,onChange:s});return x.jsx(g9,{scope:t,triggerId:ga(),triggerRef:u,contentId:ga(),open:l,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(p=>!p),[d]),modal:a,children:x.jsx(Q7,{...c,open:l,onOpenChange:d,dir:n,modal:a,children:r})})};rw.displayName=oh;var nw="DropdownMenuTrigger",iw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=tw(nw,r),s=kr(r);return x.jsx(e9,{asChild:!0,...s,children:x.jsx(Yt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:Zc(t,o.triggerRef),onPointerDown:Xe(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Xe(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iw.displayName=nw;var v9="DropdownMenuPortal",ow=e=>{const{__scopeDropdownMenu:t,...r}=e,n=kr(t);return x.jsx(t9,{...n,...r})};ow.displayName=v9;var sw="DropdownMenuContent",aw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=tw(sw,r),o=kr(r),s=P.useRef(!1);return x.jsx(r9,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...n,ref:t,onCloseAutoFocus:Xe(e.onCloseAutoFocus,a=>{var c;s.current||(c=i.triggerRef.current)==null||c.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Xe(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(s.current=!0)}),style:{...e.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)"}})});aw.displayName=sw;var y9="DropdownMenuGroup",cw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(n9,{...i,...n,ref:t})});cw.displayName=y9;var w9="DropdownMenuLabel",uw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(i9,{...i,...n,ref:t})});uw.displayName=w9;var b9="DropdownMenuItem",lw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(o9,{...i,...n,ref:t})});lw.displayName=b9;var x9="DropdownMenuCheckboxItem",fw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(s9,{...i,...n,ref:t})});fw.displayName=x9;var S9="DropdownMenuRadioGroup",dw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(a9,{...i,...n,ref:t})});dw.displayName=S9;var E9="DropdownMenuRadioItem",hw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(c9,{...i,...n,ref:t})});hw.displayName=E9;var _9="DropdownMenuItemIndicator",pw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(u9,{...i,...n,ref:t})});pw.displayName=_9;var C9="DropdownMenuSeparator",mw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(l9,{...i,...n,ref:t})});mw.displayName=C9;var M9="DropdownMenuArrow",A9=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(f9,{...i,...n,ref:t})});A9.displayName=M9;var T9=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:o}=e,s=kr(t),[a=!1,c]=ba({prop:n,defaultProp:o,onChange:i});return x.jsx(d9,{...s,open:a,onOpenChange:c,children:r})},I9="DropdownMenuSubTrigger",gw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(h9,{...i,...n,ref:t})});gw.displayName=I9;var O9="DropdownMenuSubContent",vw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return x.jsx(p9,{...i,...n,ref:t,style:{...e.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)"}})});vw.displayName=O9;var P9=rw,R9=iw,yw=ow,N9=aw,j9=cw,k9=uw,D9=lw,B9=fw,L9=dw,$9=hw,ww=pw,F9=mw,U9=T9,V9=gw,z9=vw;const sh={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:jd,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},ah=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{className:i,style:o,type:s,scrollHideDelay:a=s!=="scroll"?0:void 0,dir:c,size:u=sh.size.default,radius:l=sh.radius.default,scrollbars:d=sh.scrollbars.default,...p}=r;return P.createElement(y7,{type:s,scrollHideDelay:a,className:Xt("rt-ScrollAreaRoot",i,bs(n)),style:o},P.createElement(w7,{...p,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),d!=="vertical"?P.createElement(Sy,{"data-radius":l,orientation:"horizontal",className:Xt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(Ey,{className:"rt-ScrollAreaThumb"})):null,d!=="horizontal"?P.createElement(Sy,{"data-radius":l,orientation:"vertical",className:Xt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(Ey,{className:"rt-ScrollAreaThumb"})):null,d==="both"?P.createElement(b7,{className:"rt-ScrollAreaCorner"}):null)});ah.displayName="ScrollArea";const ch={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:xa,highContrast:du},bw={color:xa,shortcut:{type:"string",default:void 0}},xw=e=>P.createElement(P9,{...e});xw.displayName="DropdownMenuRoot";const Sw=P.forwardRef((e,t)=>P.createElement(R9,{...e,ref:t,asChild:!0}));Sw.displayName="DropdownMenuTrigger";const Ew=P.createContext({}),_w=P.forwardRef((e,t)=>{const r=NA(),{className:n,children:i,size:o=ch.size.default,variant:s=ch.variant.default,highContrast:a=ch.highContrast.default,color:c=bw.color.default,container:u,forceMount:l,...d}=e,p=c??r.accentColor;return P.createElement(yw,{container:u,forceMount:l},P.createElement(fu,{asChild:!0},P.createElement(N9,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...d,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,bt(o,"rt-r-size"),`rt-variant-${s}`,{"rt-high-contrast":a})},P.createElement(ah,{type:"auto"},P.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(Ew.Provider,{value:P.useMemo(()=>({size:o,variant:s,color:p,highContrast:a}),[o,s,p,a])},i))))))});_w.displayName="DropdownMenuContent";const Cw=P.forwardRef((e,t)=>P.createElement(k9,{...e,ref:t,className:Xt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));Cw.displayName="DropdownMenuLabel";const Mw=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=bw.color.default,shortcut:o,...s}=e;return P.createElement(D9,{"data-accent-color":i,...s,ref:t,className:Xt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(ds,null,n),o&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},o))});Mw.displayName="DropdownMenuItem";const Aw=P.forwardRef((e,t)=>P.createElement(j9,{...e,ref:t,className:Xt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Aw.displayName="DropdownMenuGroup";const Tw=P.forwardRef((e,t)=>P.createElement(L9,{...e,ref:t,className:Xt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Tw.displayName="DropdownMenuRadioGroup";const Iw=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement($9,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(ds,null,r),P.createElement(ww,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(pu,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Iw.displayName="DropdownMenuRadioItem";const Ow=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...o}=e;return P.createElement(B9,{...o,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(ds,null,r),P.createElement(ww,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(pu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Ow.displayName="DropdownMenuCheckboxItem";const Pw=e=>P.createElement(U9,{...e});Pw.displayName="DropdownMenuSub";const Rw=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(V9,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(ds,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement(Rv,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});Rw.displayName="DropdownMenuSubTrigger";const Nw=P.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:o,...s}=e,{size:a,variant:c,color:u,highContrast:l}=P.useContext(Ew);return P.createElement(yw,{container:i,forceMount:o},P.createElement(fu,{asChild:!0},P.createElement(z9,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...s,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,bt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},P.createElement(ah,{type:"auto"},P.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});Nw.displayName="DropdownMenuSubContent";const jw=P.forwardRef((e,t)=>P.createElement(F9,{...e,ref:t,className:Xt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));jw.displayName="DropdownMenuSeparator";const fn=Object.assign({},{Root:xw,Trigger:Sw,Content:_w,Label:Cw,Item:Mw,Group:Aw,RadioGroup:Tw,RadioItem:Iw,CheckboxItem:Ow,Sub:Pw,SubTrigger:Rw,SubContent:Nw,Separator:jw}),Oa={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:xa,highContrast:du,radius:jd},kw=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{className:i,asChild:o=!1,size:s=Oa.size.default,variant:a=Oa.variant.default,color:c=Oa.color.default,highContrast:u=Oa.highContrast.default,radius:l=Oa.radius.default,...d}=r,p=o?_i:"button";return P.createElement(p,{"data-disabled":d.disabled||void 0,"data-accent-color":c,"data-radius":l,...d,ref:t,className:Xt("rt-reset","rt-BaseButton",i,bt(s,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},bs(n))})});kw.displayName="BaseButton";const Dw=P.forwardRef((e,t)=>P.createElement(kw,{...e,ref:t,className:Xt("rt-Button",e.className)}));Dw.displayName="Button";const H9={loading:{type:"boolean",default:!0}},As=P.forwardRef((e,t)=>{const{rest:r,...n}=ws(e),{className:i,children:o,loading:s=H9.loading.default,...a}=r;if(!s)return P.createElement(P.Fragment,null,o);const c=P.isValidElement(o)?_i:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:Xt("rt-Skeleton",i,bs(n)),"data-inline-skeleton":P.isValidElement(o)?void 0:!0,tabIndex:-1,inert:"",...a},o)});As.displayName="Skeleton";const q9=Tt("/images/ghost_loading.png"),W9={primary:Tt("/images/primary_loading.png"),ghost:q9};function G9({size:e="24px",variant:t="primary",wrapStyle:r={}}){return x.jsx(Mv,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:x.jsx("img",{src:W9[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const K9="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAPKADAAQAAAABAAAAPAAAAACL3+lcAAAJW0lEQVRoBd1be1BU1xk/LstLdtlVUYKoKKA8fJBKJDVxovYxTadC0zY1/2jaKWM0GRsnTTOpEQNGqc34mGicNpqxGkirMYk4QFONqTG01WioFXzwFhRfUJTl/dple37XnmUf93Hu3Uuknpmdc/ec7/vO97vn9Z3vfHcUGaa0a+2PxlnN9hVWU+Aia5gxLsIaHGk1GUNCAgMCRocaRqHZ7p5BZ++Aw2HrtPe22PqabF32Olun46Stw/Du6s0Fd4ZDNaFhvQS/k/P95ChryKb4iaO/NX1yWHhgwD1gauUPOAadNY1d7bU3u0/csvVmrcr562W1MqTodQGcvzlj9cwppqw5ceYJFKMuMpnCFLuzvK6j+dK1zk3L1xbuYuVac7+Uy8tNf2legiU7cYrJolUBNXyV1zrbSqvas5evK9yhhs+dVhPgd9YvSUmJCzvyzeQxU92FfV3PX15ubSir63pq1cbiMrVtBqhlyM/9wfqli6MOxkaFjVHLqxf9pPGh1sSY0SuT46MGC07UlKiRq6qHC3c8Vbhk/kNLKJMqPjUKqaF1EuIsPn27OGPNkQxePi7F976ZYU6ICDn3+Oyx8byCv066f164W1vV0js389XCDqV2FYf07pz0xAWJlsq5MyxRSsLuV/2UyNCxoQGjVs9JjikoPlndIqeHbA+jZx+LC79BV2GznBDeuu4+B9l+qI4Un2oSWNIfe4j86plYEhqk+N65mqCreMepuvZouZ42yknCMNYLbL/dSX7xu/Pk3zVtribzjjWSC1faSd66b5Ago8FVrvUBut5p6z9H+adLyZB8tVigvpM6fr4Uo9ry7YeukE++vNez7ry37/aRvv5BsmD2WPdizc8Y3qmzJqUeOFp5QEyIKGBsPU8vjF6p12pMhxpZu6eCOOmyKpbKaS9/O3U8ibAEiVWrLpsx2TQjfmqk6JblAxhGBfbZYKM2O9hbO2D85VsXyM2WXu8q13+8iCr6Un6yaKIu+x06KjY6bFHMpIlHikuqPYaVz8SBBWUKMcouZi5NOR4+/Pymx7yVYsHc/ujkTalq1eXAACzejB6A83Mz1uhpLrZ2DJBtdFXmTVs/qCPg0SsBCzC5y/MA/EhC+Ab3Sn+ftxysJTYVAEAL0Homb0wuwHmb0l/U89Rzjg7Rj7+4pVp3DGvw6pWACdiYPBfgWdPMr7FCf3O7w0ly9lVxizGFGsn8WUPbEnjpOZibX4nQHZsAGJ4KHN6VGHnrYVBg1eVJgXR9/MPLc0hb59DcBe97Rxt52LlogA0YQSwAhltGL09FU2sfeftwPZci8I1sfWEmocOOVFz1tPt3FTQQyNIjARswQpYAGD4oPQRDRm5+DenudXCJy3p2BnkybQIprbL5GCVdPXZBFpcgDiKG0QDvIhxuHDyKJH8vv0uOnW1WpAPBqh9OJcu+O0mgPVthE+WBLMjUIwEjsBrgStXqXXRXpG9gkGzYz7dQ/fiJKPLST2Nd7GcrWl3P3g9vvFdFcPDwNwEjsBrgN/ZXGPh3F14ljc09iqIWPjyObMxMdNF10KF7ucFz/roq6cO1ph4qu8G9SPMzsBrgJNcs4X+MDbe7yZ6iBkUxKfHhZMeLs4gxYMhyLa1s85m/3oIA+CoF7m8CVgNuBPwVtGF/NRlQGHbTokaT3S+n+Bz2z1Qoz1HI5p0ucliAlQ5pY4gckVIdzrinLsorPWFMMNn76sNkjDnQR9xXtId5EvVbiZ6neXgZDbAacdfDCtTmnXT+bf5TrSwbrKh3X0kh0RG+7xXG1NzpFpISFy7IYOflkvI75LrIeoC2nkgZRyBTSwJWI7vY0iJg58f1pFnGOGBWFAwLsYQT97rlnt6Yo3QrOvC362LkQlto87VlnjyixCKFwCoYHiJ1ikXwYuR/Kq4YmJkVlZZoVZTFCM7Q7enXv78ku4ihTbStNRlxZWkxqfNuYFd8/Y+VZFDGwI8eH0rOXLYJP3a9RrdCspb2jlhrAPHC9guKix/azKaHi4PZqaq9I8BqxP2shahzGcKLUVbbLvuSMQf//JnnCJg5zSwK9gZ1/6zYUkawJvCk8/T4CB2WLp7IQ+6iAVYDLqNdJRwPdzv6NR/S05J8hzc8HJlvnpddC8TUgicFuqhJwGrAzbsapi0H6jyOcmp405I87996+h1k5bYyUn+rW40YgVbwjhxU5x0BVgPCDHhb+1e1jRwuUe/FgHzM43luCxicBGt2XlScGnK6waMCnXgTsNIh7TjJw3DPi1HNQypKkxRjJma3/XP93kryxXn/wzhy9lUT6MaTgNWAABLEVCgx5B27TqobtW8HjyYPDWfcL2kdKd56QifoppSAEVgNiJZBAIkcwz0vxhU5EsU6tmC9f/y6cLJSZFBB8PbhK6TZJu8dAUZgFQwPRMvIyccb5PViiMnB/H0kwUpgRW3K0z4txGSjDLrt+0TeB8YwCoCb2u3rES0jJfDTr/i8GFL8MC1hWChZUVL8POXHS/8jSQZsCH8CgQD4udeLLiE0SIrDX2ea1RxEnt9WrmhFSbXPUy43pIGNxXq5bGnqdciVEhxLz7L+pNP0+MhrRWltJz46TJIVMV6scsj1QEsqPlpmg6eeVbIcjrTntpbJ2s6M9n7kAdSDgiPo427OfKYHnUptSU+/7zLxPM7Cj6bE9NGz6fcYMctjIkPJQnoObe+2E1vXAOmlF9jSM55xDX8eYQ0SQG5emUTm0UVRLB092/KbghNVZ1idRw+j8PT+Z+r1vEFkDd2PHAFs83/+wTT3tl1zmBUiwq2zV8FBxYhHcA4MwOKtoseQRiVuzBHhNjvOsoh2v88I8BYwEv/T/dX54ec3sjOz/3LIWz8fwCBAOB8CQxImmxK8Gf4f/iM6b+krRc+L6Srbg//Yu7RmpEbfiYFBGaLyFmQeknR6+cxhd0EI56PLuvS1gDvxCHiGrtBZThXRIc0YCj+r6kc4X1iw4Wc0pCiYlY/EHGBLLralrcgqko2MkR3SDNiDFFzKBZgBfxDCh2WHNAPKcoTzIcINQV80NlLVy2Iy9Mqxz2LrkVqNpdpRBRhCsGUhws3ucDyJyHQpwcNZDgvqeGnrYrF9Vqldv3oJQV+IgxI7cCg1rKUeB4H78pGHt7KIg0Jo0HB+xnOxvuO3z2YV7fRuW+1/v3rYu7E9b6TPjAw3bnzgP9TyBo7/2j/FG6Cf4hmH7VO8/wJSjxTWAm8L8gAAAABJRU5ErkJggg==",uh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAQcklEQVR4Ac07C3BUVZb33vfp7nQSgiEhYYYgESEj40oZjERH/MxAnFEGQQYUZILRGix1y3V3q3bZqd2trZpZqram1rJ2tMZZiUGFAURQ4romiALjmlkFB2eGEVyMEAQSEiSQ9O+9fvfuOfe923Q66aQ7dDS3q/vcd9+553fPOffzXlMyxqX4hc1Vls9p4Iao5nm8Mp5HSoSfmsIUGjcJRfbMIoJa1CFRbhlh2k3CrJ3F6EG/rTWee3DlkbEUUQqQawYTX3ppVTxInoxN4rPjVxAfAf0kDwG/WEM4RKGUEiEEQYgF0ITxJY2ZPfSwHiJPnV+9etMQ3S6rKWcGmPTcq+XWxOhzVhlfGJ8oQGkoSlnFJcUAAlSk8EHoort1bPMaXGN5lzoao5O1muf9a3vW3nvGRbq8XyXaqKlMebG5IpTXtzF6JZ/PfYINSyjFADDUoCA0eiN+SVvXINIuKKF3qQzKLMr9x9n+YLig/vSPF3UMy3OEm6M2ALgqLd6y5fnwVXyNCJChFZcKU2GcoyGtlx6FuD7MYuQDjemHhNC7mLggR5HTCeWUxic7JD6HG6QGDDmbTxSzrCtEELRPKyOLEB74jDWdu+++hyFslJlGUHng7bTEB6INvPrGC6/O65tmt1iTeKGKWxfDGy7OhL+Tduq9ZLMZ9j19uuGekwMpZHY1pfG1qVZe7Il4EV8ZLSNlYGZgIK3qEXDrZje5GOgw67oevPd3mVG+hJW1AUpf3vpI+GrxjAOj7qmrIpZQhwr/CdbG+sz67tWLj11ic/m1kpden8ELrI2RabyWaIO9QkNv+D/9sbMPLPtVNtyyMsDkra809s8iawjjXj9lAhjxk+TTYLdY1bFm+cFsBMgWt6JpW3WomG6KVpCZhCg5XCqUMBE8Qpq6VvyoIVO6GRmg+oAwvji9sy00zalWKrsMBPF1sW69kzzU9eNlzZkyzQXelM2vLbImORtik3mJoqeCw39CO1gxZUntwbnUVvfSwRENgMp39OzoiJWJsgFZG5JO8BjdfWbpkrp0xL+K9sk7drZEruILYDZxZ0/PCj7IQRXFSytGMsLQ2TtJ8tOnX2+zy2kZo5CBgAdCZjNR8Alb/3Urj2J2wQAUHNHWs7gGczBmSfxlxC6jZadA9iRVhqwOa4CpW3c1RqeRalRcKg+E9X5m5x81lp1acc9Ph6T4NTSiLPlH2TI9BEMDJlDyxipI9dStzY3DiZQ2BK78TfMjfVXiWYHUvKKHme1v1+Z0PPCDP6u28QQrXn7zmmilcyieB6sJKFJwUAA85NHj99815OwwpAfM2PLmvHCleAbmeHR86VK6o4n8z/X7xqvyqDDKhjKirDIc0HOhhKc7z6BOiJNaBhkAV3jhUtEiTMZcV5ImEAXt+vr2Vd/fkUpgvF2jjCgrGEAagaED+xiTOmGiTCmDGiq3v7khdBVpkHjeOj3vBG39/J7v5yTbz9y2pyZO4/cIH68RGisV1PEJjerUZr3MEqepTd+JGUUvnlp647kUWbO6nL7rv1vC3+QLZRzgzAAl2E4b25f94CH3yv0dYICq37Rd2VfZ+5ljgNdjQeP10O4TC+4sddFH94tTae/J1v+0J4il9kRRgHbFkroXSuyLOBG+bnbcd8H4+6Mr7tjmYmf/O233W2djk0SJUpLGCJ/YUTD98PLvdChqA0IgHux/QRiUuRMJ/moi0E0HWEx1zBRevW33yp7w7guRaaTeLiIFFBwTJ2z5wRjFD0L4qqkWJKDWZDK972p7y1Vv7P4thmWm/JLxUHYIBJnHZS6HsI75IxuTcRKEv/Xq/vL+qdEvhA7B42H4z7Kjn935varkDtnUZ2/f+9cXKuxfEH1oBbw1S2K3m0obhUOcwBn6x2N3LfiL1PuZXF/91ttHwiV8lsJlccLzv/B/85N755/BtoQHCM1+juhgepnzYfS5JvIuslWqY7Zw1ta9t/dNc35BNfR0dy7BnS3W5Q4XR9yrJzzOa8PEJZOXB2EneO23tu/5WbYyIL4fdGACZgVcwCE/g8El6OqVhAGsK8hC5YoI8zq1tj8uv2NUGxt0WV4qXgd+lKEFgB5+UQAFk+uJ+x4u9pFf7IF1+MRK2d8oobOBqAPqInl44WaDroqGNMC1r7y3igeZLyEc7OeDjlmvkLKF1726/x/sQoz3S/GtaCPUYESCZ/S2CZ/7/nLSZ+bcwuPaT/292peEo0uC4wNMrmMbDwr/ddvfW56tLIjvt7QHkSfSQWM6Qeq79pV90rt1RIDT2ielc4KzYsz5e1nnR4tvGvV+PjaBPCGVl2kes72XaoA4A+MWHGf1Hy+/5SXk7RX0tH+dtWffWasIsrbKTIAv6ygUFJg6lwDIelb4eOktn1a17uu0ilm5O9OAQfPok0Brk/SAeFDMxpjDDI3QF9ZfRoajKTVv/2+xU0QnSWvLpQjGM9JF21OS36ntTFE+wSZw3vgXxFOeI3uAPAjx42gkkcwSnTKs+EJsM+YepIPQBp2xK6vefqDKKdB8ig06qBHW/yNDuoPQ7Ivxh3HIL9FT4sOkaml81qKb07qxYeu70BM176PqCGVd6P2DGGbYYEZ9T+O0rsKAg86oOxOG1QCjLnMk+r+vn4U+vL/mZIZ0B6E5wfxfFp7QH8w/pW0PnGPHjQizlQK+C/TYKxQegKQpIo/f7I4QIKD7w0gpKHMHZ6fSdB2xGXUy+2kIB0Z6GAdgOA260Fk1k5GPvAQxI9rREakNg/CHuutCcLvJ+0rM2uYDVZbD7xe287FsSPNj+cXPpHAw3ljQj2BGkRCMKLSY9m9pumbUjLo5QQ6nWi59WPNU67DyqyTczTJyrozTP2VELQuktkVz8fHWPw/XZe6uD/89VMwrKYehUVkQvQCFBeg/T08eWHbD74ejMdI9nWuHIQNUKzyui0omfLRERSlaH7aSHyqErwreuPPAP0ZK+V8BfxmK0k1lunIj1rA1J9hv/PBy5dFs9gHqqkKSmFqJDkskHzapAiIcUvWvAtb810cbw6V8NSjtPtrA0XcdUoYkCCzyusnj7y29ftjwyURWqZsAD1PIBjV1ouHy1ysQb36f2aUuxxLiarHmrY/ejxTzeaiwikulPPLW4owHv6SPv7/4+iFPc7KVD3ULEczBrsaCMU2nGuiPqwNsBuubNC43CbJhDH/mtfz+gFVMr8cHWirmVcJDqEdppKBPq9t393W/zZUYqFtykoVzCKpj4kOGsiiYK45p6Nz8xh/+KTTRcZXH0fDYq4QX6NU+KY36bty1uKovDYlRN8NaAAzudsddtq7B4yzHSwIogBXVy+H2qJfBmUhm5Yu/w5GQkqDRPYnAE/D8YdP/3HXt6kzoZIuDulEShwnV7QkPuCAK4hT0dz/SPQxtcraEs8G/tfmTRTzA8uQuD4yQgFDP+5K1jJXyKCMF3dwlPww18NMc5jDmUAsb5VeGA5+TjUJZ4zJxp4x7GAU5JXnQtDWrvG723VnTy6KDcPgceeokp0IIhjixdCPOuh2Bz+HBQvDljN6QBc2sUSHpTlErT+yssr8ZoYeGWyZnzWiIDtSgNW4SdG/qFu1msPBp12Dk8St3gxr99hB9c9hE8y+FnAo95K3hEnpMC+yEZrte5+qqC61d17h2kApxB3LG0eAmHfWWMxPpNc4+CPSTShcXfQ4zEmRjTrN+uSETfsk43NRmUbkQcqcBqfvC5s+r+kvif5ZPVyU2FfkX6bTWuhmj3hEmMx0v9YUtx6b2F/ATcpTdmUfk9xjXsNZF04+YMRZTbgnOAZMRe2K8CJ4rOVAn1E3paVoshrrLIzHDZocdgyd2SY5JVgLjv80Vc0Xn7uaeb0Ty+xJr+ksB4GIELO3h5rqK1xR+LiHqJDdZEHH4cp5hk8NIH3aHcAji6E956UhOTXaAlv3w3ZMz8F4uC2fRYNwniuM+Ir+2V0eIXzgLxUVYzgvqYvnhHQdQ3D0Wg2M/x3wKGUkDvFE3dZNhURkGOE3gCVGc8425lqQACMqZBgRBYSQvD8qFiStOrtkSC3RJuD8EAaw5YqgzMpIGwIrfYq3JAsX8tPaultOJsECcyy4+d/GT7sEIYdpls0glgDrYAVarpj+EvhhtVXgJA5j+wFo4O4fXrnBssBmSoc6llRRyLiCuAlUiSoW5oJ9KQ+qAp2rg2cgbpmFu8sBahZcwwI75JWf8UbbftZTrnpaPzry35dQihXz50Jd40qP4KIgCqofSl8/HpYCyW342UxkaBxZ13HFnSWLLnzAAdvH7J9aDD3DVAb0garINuRII0q2Me3c0UBzwNsw53ifXISBlT4w+GJhrHHVM1sddEiW1LNl9dkPY7zRgEwSBPCvIg/yw87uT65LQRl39kRBpAz2Xe4Ele7paIj6ReAaIAgcirHHngtKHkoUfZAA8qlq8r7vX1gS8BwyzBsQNPOEUeRG2fvv3Jo2bN8OSlUitL3u75+chP193aXULD4UdevH1W0uKcJmXjD8gBPAGIgRsrQ4e6cN7GuieYAU4R4yYfN2Kd3qWJncej3WUMWqKdTiVQyaTwQWvFnPUKVV5lH+QAbBx64Li3wUd/TGNum9byVgFN4jpbMuqt/uuQZzxWFA2lBFHEZWXD9YpE/mO+RjqNJTMQxoAEbfcfsWvIPabXC9w05QD/2CJmM6h8egJK945vzRsxA/BatJQSRZlRx223F6U9lR5UA5ItdLydy8ciGnePgGxMSdAbsxztPWbbyscFzlh5d6LPw8zZx2Kliw//IHl4LZbJ8xNbkutp/UAhVh0W2Gtj7NOdClpWeQB8RXWxLqVe/taFN7XBVEGlAWHRYYqyIfQz7XOovmFtSPJNcBi6ZB/IoTRv7+/LUrEwKUxuILBRXfAMR9q+q6/OV3/sWhfs+fioohGNsCj5xJFHyMfj/gDVDsYvCWv9tc0B6/LK+IIH9jb3xhjdA3HA3VZcEYBzwC+JiefGpyu2nhHcFTvFbn0Rv6tfydU7TC6KcbETJyyB/TA0OS06cXbgg0D2oe5GEhgGER1a827oUcijDwjX+fBcPCOtLz7wk9oW4Hhr3/2JprTZwuPvi9m9NmRjVFCwK09xV37SxEglnlAkMeabg+mTXhKh2SYtQGw88PvWfMijtNiC1KYbADwBLlwwreMDSE6dUI3BwK+p5+toaM6Xnv0AzE1EoE/TRGyEly9LHXE0d3R7eFU52JA0+qe/4455FSXrHBqfVQGQCIoTMN+6/kYERASQ68nJDNYWIEhQhoRR+H57580h3zo9xuHoE9XXpDITUk4RMpjlEymUXsOvAd0A4TYtx1CZ8UJHNenunmSBvBUk8PuoqlxvvnV/m0uSQbyxGFR0X8uvjFGyHzO4eB5mKJGDKEsKRGEM436N+lQZJTHg4fhHwL2Fxbr9U/Pph1D4WbaNmoPSGXwk/2inAvnOYuLhfAA2of3lcCeuoMzhooZhLIDYKo2t2XArw7vSxqEtsLjtLW/nk+l9wxAGMVFzgyQzPvRNrHKtvmTNiezwZV96dx4JAPBcgPCR8R0Sg6bJnvq2Vqa+wOaZMHHov74+6LKiZMGSGTVEPeV4P0lkMNNgBrMJHIAIG7gRRV4c0EQS6OkG1rbIbEd1HTS+Mub6JGxkEvR/H/1GixGG+ou8QAAAABJRU5ErkJggg==";function Wr({src:e,alt:t,className:r,style:n,showWarn:i,...o}){const[s,a]=te.useState(uh),c=u=>{a(uh)};return te.useEffect(()=>{a(e||uh)},[e]),x.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[x.jsx("img",{src:s,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...o}),i&&x.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:K9})]})}function Y9({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:o}=e,{getExplorerUrl:s}=ls(),a=te.useMemo(()=>{if(n&&r)return n(r)},[r]),c=te.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return x.jsxs("div",{className:"cs-toast",children:[x.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[x.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&x.jsx("div",{children:x.jsx(G9,{})}),x.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&x.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&x.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&x.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&x.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&x.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&x.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():x.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&x.jsx(I1,{text:"Confirmation is in progress. Check your transaction on here",keywords:["here"],text_highlight_color:"#72c1f7",onKeywordClick:()=>{window.open(s(i,"tx"),"_blank")}})]}),r==="rejected"&&x.jsxs(x.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():x.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&x.jsx("span",{children:"Something went wrong"})]}),r==="success"&&x.jsx(x.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():x.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&x.jsxs("div",{className:"view-transaction",children:[x.jsx("span",{children:"View Transaction"}),Kc.map(u=>x.jsx("a",{href:s(i,"tx",u.link),target:"_blank",children:x.jsx(Wr,{src:u.img})},u.link))]})]}),x.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(o),children:x.jsx("use",{xlinkHref:"#icon-close"})})]})}const Z9=Ei((e,t)=>({toasts:[],setToasts:r=>{e(n=>({toasts:[...n.toasts,r]})),setTimeout(()=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r.id)}))},3e3)},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}))}})),Ts=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=Z9(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},o=a=>{const c=Date.now();return a.id=c,r(a),c},s=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),kn.createPortal(x.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>x.jsx(Y9,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:o,ToastContainer:s,removeToast:n}},jB="";function X9(){const{mevProtect:e,setMevProtect:t}=$r();return x.jsxs(fn.Root,{children:[x.jsx(fn.Trigger,{children:x.jsx("div",{className:"cs-settings-btn",children:x.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:x.jsx("use",{xlinkHref:"#icon-mev"})})})}),x.jsx(fn.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:x.jsxs("div",{className:"mev-settings-box",children:[x.jsxs("div",{className:"mev-setting-title",children:[x.jsxs("div",{className:"name",children:[x.jsx("img",{src:Tt("/images/icon_mev@2x.png")}),x.jsx("span",{children:"MEV Protect"})]}),x.jsx(Ty,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),x.jsx("p",{className:"mev-tips",children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."})]})})]})}function J9({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return x.jsx("div",{className:"refresh-button",children:x.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:x.jsx("use",{xlinkHref:"#icon-refresh"})})})}const kB="",DB="";function lh(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,o=()=>{r&&r()};return x.jsx(Dw,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:o,children:t})}function Q9(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=$r();return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-verticalslider"})}),x.jsxs("span",{children:[r,"%"]})]}),t&&x.jsx(eI,{onClose:()=>e(!1)})]})}function eI({onClose:e}){const{slippage:t,setSlippage:r}=$r(),[n,i]=te.useState(t),o=u=>{i(u.display)},s=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=te.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),x.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:x.jsxs("div",{className:"slippage-settings",children:[x.jsxs("div",{className:"slippage-settings-header",children:[x.jsx("div",{className:"title",children:"Slippage Settings"}),x.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:x.jsx("use",{xlinkHref:"#icon-close"})})]}),x.jsxs("div",{className:"title",children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-verticalslider"})}),x.jsx("span",{children:"Slippage Tolerance"})]}),x.jsxs("div",{className:"form-box",children:[x.jsx("div",{className:"slippage-tab-list",children:g5.map(u=>x.jsxs("span",{className:u.display===n?"active":"",onClick:()=>o(u),children:[u.display," %"]}))}),x.jsxs("div",{className:"input-box",children:[x.jsx("span",{children:"Custom"}),x.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:s}),x.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&x.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&x.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&x.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),x.jsx(lh,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function tI({handleRefresh:e}){return x.jsx(x.Fragment,{children:x.jsxs("div",{className:"swap-header",children:[x.jsx("h3",{className:"swap-title",children:"Swap"}),x.jsxs("div",{className:"right",children:[x.jsx(Q9,{}),x.jsx(X9,{}),x.jsx(J9,{onClick:e})]})]})})}const BB="",LB="";function rI(){const[e,t]=te.useState(!1);return x.jsxs(fn.Root,{open:e,onOpenChange:t,children:[x.jsx(fn.Trigger,{children:x.jsx("div",{className:"cs-settings-btn",children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-settings"})})})}),x.jsx(fn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:x.jsxs("div",{className:"cs-settings-box",children:[x.jsx("h3",{children:"Settings"}),x.jsx(nI,{}),x.jsx(oI,{onClose:()=>{t(!1)}})]})})]})}function nI(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=$r(),i=o=>{t(o)};return x.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[x.jsxs("h3",{className:"card-title",children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-plorer"})}),x.jsx("span",{children:"Preferred Explorer"})]}),x.jsx("div",{className:"explorer-checkbox-group",children:Kc.map(o=>x.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(o.link),children:[x.jsx(mu,{color:"indigo",checked:o.link===e,variant:"soft",className:"cs-checkbox"}),x.jsx("img",{src:o.img}),x.jsx("span",{children:o.name})]}))})]})}const iI=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function oI({onClose:e}){const{addTxToast:t}=Ts(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:o,rpcList:s}=$r(),[a,c]=te.useState(i),[u,l]=te.useState(r),d=y=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${y}`})})},p=y=>{l(y),y.isCustom||(n(y),d(y.link),e())},w=y=>{c(y.target.value)},b=()=>{if(a){const y={name:"Custom RPC URL",link:a,isCustom:!0};o(a),n(y),d(a),e()}};return x.jsxs("div",{className:"settings-card rpc-settings-card",children:[x.jsxs("h3",{className:"card-title",children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-settings"})}),x.jsx("span",{children:"RPC Node"})]}),x.jsxs("div",{className:"rpc-checkbox-group",children:[s.map(y=>x.jsxs("div",{className:"rpc-item",onClick:()=>p(y),children:[x.jsx(mu,{color:"indigo",checked:u.name===y.name,variant:"soft",className:"cs-checkbox"}),x.jsx("span",{children:y.name})]})),u.isCustom&&x.jsxs("div",{className:"custom-rpc-input-box",children:[x.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:w,value:a}),x.jsx(lh,{btnIsDisabled:iI(a),text:"Save",onClick:b})]})]})]})}const $B="",Pn=Ei((e,t)=>({accounts:[],currentAccount:void 0,isOpenWalletModal:!1,saveCurrentAccount:r=>{e({currentAccount:r})},saveAccounts:r=>{e({accounts:r})},onWalletModal:r=>{e({isOpenWalletModal:r})},isOpenAccountList:!1,setIsOpenAccountList:r=>{e(()=>({isOpenAccountList:r}))},tokenBalanceObj:{},setTokenBalanceObj:r=>{e(()=>({tokenBalanceObj:r}))}}));var sI=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},aI=sI,Bw={"text/plain":"Text","text/html":"Url",default:"Text"},cI="Copy to clipboard: #{key}, Enter";function uI(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function lI(e,t){var r,n,i,o,s,a,c=!1;t||(t={}),r=t.debug||!1;try{i=aI(),o=document.createRange(),s=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Bw[t.format]||Bw.default;window.clipboardData.setData(d,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),o.selectNodeContents(a),s.addRange(o);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(d){r&&console.error("unable to copy using clipboardData: ",d),r&&console.error("falling back to prompt"),n=uI("message"in t?t.message:cI),window.prompt(n,e)}}finally{s&&(typeof s.removeRange=="function"?s.removeRange(o):s.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var fI=lI;const Lw=Bs(fI);function dI({currentAccount:e}){const{mutate:t}=Ur.useSwitchAccount(),r=Ur.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Pn(),o=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const s=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{},[s]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return x.jsxs("div",{className:"cs-account-switch",children:[x.jsxs("div",{className:"account",onClick:o,children:[x.jsx("span",{children:Eo(e)}),(s==null?void 0:s.length)>0&&x.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-unfold"})})]}),x.jsx("div",{className:`account-list ${n?"open":"close"}`,children:s.map(c=>x.jsxs("div",{className:"account-item",children:[x.jsxs("div",{className:"left",children:[x.jsx("div",{className:"label",children:c==null?void 0:c.label}),x.jsx("div",{className:"address",children:Eo(c==null?void 0:c.address)})]}),x.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const hI=te.forwardRef(({connect:e})=>{const t=Ur.useCurrentAccount();return x.jsx("div",{children:t?x.jsx(pI,{}):x.jsx(lh,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function pI(){const{mutate:e}=Ur.useDisconnectWallet(),t=Ur.useCurrentAccount(),{currentWallet:r}=Ur.useCurrentWallet(),{addCommonToast:n}=Ts(),{getExplorerUrl:i}=ls(),o=()=>{t&&(Lw(t.address||"",{debug:!1,message:"message"}),n("Copied"))},s=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),x.jsxs(fn.Root,{children:[x.jsx(fn.Trigger,{children:x.jsxs("div",{className:"cs-connected-button",children:[x.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),x.jsx("span",{children:Eo(t==null?void 0:t.address)})]})}),x.jsx(fn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:x.jsxs("div",{className:"account-op-box",children:[x.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),x.jsx(dI,{currentAccount:t==null?void 0:t.address}),x.jsxs("div",{className:"account-op-item",onClick:o,style:{marginTop:"12px"},children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-copy"})}),x.jsx("span",{children:"Copy address"})]}),x.jsxs("div",{className:"account-op-item",onClick:s,children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-link"})}),x.jsx("span",{children:"Open explorer"})]}),x.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-disconnect"})}),x.jsx("span",{children:"Disconnect"})]})]})})]})}function mI(){Ur.useCurrentAccount(),Ur.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Pn();return Ur.useWallets(),x.jsx(x.Fragment,{children:x.jsx(Ur.ConnectModal,{trigger:x.jsx(hI,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function gI({independentWallet:e,customWallet:t}){return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"widget-header",children:[x.jsx("img",{src:Tt("/images/logo@2x.png"),className:"cetus-logo"}),x.jsxs("div",{className:"right",children:[e&&x.jsx(mI,{}),x.jsx(rI,{})]})]}),x.jsx("div",{style:{marginTop:"20px"}})]})}const FB="",$w=()=>{const e=te.useRef(null);te.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return x.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:x.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>x.jsx("div",{style:t(i),children:x.jsx("div",{style:r})},i))})})};function vI({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,o=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return x.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&x.jsx(yI,{info:o,status:r}),(r==="success"||r==="rejected")&&x.jsx(wI,{info:o,status:r,tx:i,onClose:e})]})}function yI({info:e,status:t}){return x.jsxs("div",{className:"progress-dialog",children:[x.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),x.jsx("div",{className:"loading-box",children:x.jsx($w,{})}),x.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),x.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function wI({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=ls();return x.jsxs("div",{className:"finally-status-dialog",children:[x.jsxs("div",{className:"center-content",children:[x.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[x.jsx("div",{className:"status-icon-box",children:x.jsx("div",{className:"status-icon",children:x.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?x.jsx("use",{xlinkHref:"#icon-sel"}):x.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?x.jsx("span",{children:"Swap Success"}):x.jsx("span",{children:"Swap failed"})]}),x.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&x.jsxs("div",{className:"view-transaction",children:[x.jsx("span",{children:"View Transaction"}),Kc.map(o=>x.jsx("a",{href:i(r,"tx",o.link),target:"_blank",children:x.jsx("img",{src:o.img})},o.link))]})]}),x.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Pu(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await h5(`${i||us.api}${t}`,n):await p5(`${i||us.api}${t}`,n)}catch(o){throw o}}}}function bI(){const{fetchByApi:e}=Pu(),{setProviders:t}=$r();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function xI({interval:e,callback:t}){const r=te.useRef(),n=te.useRef(null);te.useEffect(()=>{r.current=t},[t]);const i=te.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),o=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>o()),[]),{startTimer:i,stopTimer:o}}const Io=Ei((e,t)=>({suiClient:new Wo({url:us.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new Yg({signer:us.simulationAccount,client:new Wo({url:us.fullRpcUrl}),env:td.Mainnet}),setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),Is=Ei((e,t)=>({tokenMapIsInit:!1,requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),o=Rr(r.coin_type).full_address;if(!n.has(o)){const s=new Map(n);s.set(o,r);const a=i.filter(c=>c!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...a]})),Si.setItem(ld,s)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||Si.setItem(ld,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Si.setItem(x1,r)}}));Si.getItem(ld).then(e=>{e!==null&&Is.getState().setTokenMap(e,!0)}),Si.getItem(x1).then(e=>{e!==null&&Is.getState().setTrustedTokenList(e,!0)});function SI(e,t){return{id:e.id||void 0,logo_url:e.iconUrl||void 0,coin_type:t,decimals:e.decimals,description:e.description,name:e.name,symbol:e.symbol}}function eo(){const{suiClient:e}=Io(),{fetchByApi:t}=Pu(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:o,addRequestTokenList:s,setTrustedTokenList:a}=Is(),c=async()=>{var b;const d=await t("/v2/sui/coins_info","GET"),p=[],w=(b=d==null?void 0:d.list)==null?void 0:b.reduce((y,T)=>(y.set(T.coin_type,T),T.is_trusted&&p.push({...T,coin_type:Rr(T.coin_type).full_address}),y),new Map);w&&(w.set("0x2::sui::SUI",{...w.get("0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"),coin_type:"0x2::sui::SUI"}),r(w),a(p))},u=async d=>{try{const p=l(d);if(p)return p;if(o.includes(d))return;s(d);const w=await e.getCoinMetadata({coinType:d});if(w){Qg(d)&&(w.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=SI(w,d);return i(b),b}}catch{}},l=te.useCallback(d=>{if(d)return n.get(Rr(d).full_address)||n.get(d)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Ru(e){const{suiClient:t}=Io(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Pn(),{fetchTokenInfo:o}=eo(),[s,a]=te.useState([]),{tokenMap:c}=Is(),u=async(w=(r==null?void 0:r.address)||"",b)=>{try{if(!w){l();return}let y=[];b?y=[await t.getBalance({owner:w,coinType:b})]:y=[...await t.getAllBalances({owner:w})],a(y)}catch{a([])}},l=()=>{n({})};te.useEffect(()=>{(s==null?void 0:s.length)>0&&(c!=null&&c.size)&&d(s)},[s,c]);const d=async w=>{const b={};for(let y=0;y<(w==null?void 0:w.length);y++)try{const T=w[y],O=await o(T.coinType),R=a5(T.totalBalance,O==null?void 0:O.decimals),k=jr(R,4);b[Rr(T.coinType).full_address]={...T,displayBalance:k,totalBalanceFormat:R}}catch{continue}n(b)},p=te.useMemo(()=>{if(e&&r)return i[e]||i[Rr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:p}}const dn=Ei((e,t)=>({isOpenTokensDialog:!1,defaultFromCoinType:void 0,defaultToCoinCoinType:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoinType:r,defaultToCoinCoinType:n}))},setFromCoin:r=>{e(()=>({fromCoin:r}))},setToCoin:r=>{e(()=>({toCoin:r}))},setFromAmount:r=>{e(()=>({fromAmount:r}))},setToAmount:r=>{e(()=>({toAmount:r}))},setRouterData:r=>{e(()=>({routerData:r}))},setFindRouterLoading:r=>{e(()=>({findRouterLoading:r}))},setByAmountIn:r=>{e(()=>({byAmountIn:r}))},setIsOpenSecondary:r=>{e(()=>({isOpenSecondary:r}))},setIsOpenTokensDialog:r=>{e(()=>({isOpenTokensDialog:r}))}})),EI={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},Fw={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},Uw=EI;function _I(e,t){const{fetchTokenInfo:r}=eo(),{setFromCoin:n,setToCoin:i,setDefaultCoin:o}=dn(),{setSlippage:s,setRpcList:a,setCurrentRpc:c}=$r(),{tokenMapIsInit:u}=Is(),l=te.useRef({}),d=async(w,b)=>{const y=w?await r(w):Fw,T=b?await r(b):Uw;n(y),i(T),o(y==null?void 0:y.coin_type,T==null?void 0:T.coin_type)},p=(w,b)=>{const y=[Yc[0]];let T=Yc[0];w.forEach(O=>{const R={name:O,link:O,isCustom:!1};y.push(R),O===b&&(T=R)}),a([...y,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(T)};return te.useEffect(()=>{if(u&&!ud(e,l.current)){const{defaultFromToken:w,defaultToToken:b,defaultSlippage:y,customRpcList:T,defaultRpc:O}=e;d(w,b),y&&s(y),(T==null?void 0:T.length)>0&&p(T,O),l.current=e}},[e,u]),{handleSetDefaultPair:d}}function CI(){const{currentRpc:e}=$r(),{setSuiClient:t,setAggregatorSDK:r}=Io(),{currentAccount:n}=Pn();te.useEffect(()=>{if(e){const i=new Wo({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new Yg({endpoint:us.aggregatorUrl,signer:(n==null?void 0:n.address)||"",client:new Wo({url:e.link}),env:td.Mainnet});r(i)}},[e.link,n==null?void 0:n.address])}const Vw=Ei((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Rr(i).full_address]}),e({coinPriceObj:{...n}})}}));function Nu(){const{fetchByApi:e}=Pu(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Vw(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>bi(l,!1))})).prices;if(u){const l={};u.forEach(d=>{l[Rr(d.base_symbol).full_address]=d}),r(l)}return u}catch{return n(a),null}},o=te.useCallback(a=>{if(!a)return;const c=t[Rr(a).full_address];if(c)return c},[t]),s=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const d=o(a);if(d)return De(c).mul(d.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:o,getTokenAmountValue:s}}const fh=Ei((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Mr=[];for(let e=0;e<256;++e)Mr.push((e+256).toString(16).slice(1));function MI(e,t=0){return(Mr[e[t+0]]+Mr[e[t+1]]+Mr[e[t+2]]+Mr[e[t+3]]+"-"+Mr[e[t+4]]+Mr[e[t+5]]+"-"+Mr[e[t+6]]+Mr[e[t+7]]+"-"+Mr[e[t+8]]+Mr[e[t+9]]+"-"+Mr[e[t+10]]+Mr[e[t+11]]+Mr[e[t+12]]+Mr[e[t+13]]+Mr[e[t+14]]+Mr[e[t+15]]).toLowerCase()}let dh;const AI=new Uint8Array(16);function TI(){if(!dh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");dh=crypto.getRandomValues.bind(crypto)}return dh(AI)}const zw={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Hw(e,t,r){if(zw.randomUUID&&!t&&!e)return zw.randomUUID();e=e||{};const n=e.random||(e.rng||TI)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return MI(n)}var Oo=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Oo||{});const II=new Wo({url:a0("mainnet")}),OI=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],PI=["deny_list","DenyList","DenyCap","create_regulated_currency"],RI={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},NI=async e=>{let t=!1;if(OI.includes(e))return t;const r=e.split("::"),n=r[0]&&Nt(r[0]),i=r[1],o=await II.getObject({id:n,options:RI}),s="disassembled"in o.data.content?o.data.content.disassembled[i]:null;return s&&typeof s=="string"&&new RegExp(PI.join("|"),"i").test(s)&&(t=!0),t},jI=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>bi(i,!1)))==null?void 0:n.join(",")};function kI(){const{fetchByApi:e}=Pu(),t=async n=>{try{const i={...n},o=jI(n==null?void 0:n.coin_type);o&&(i.coin_type=o);const s=await e("/v2/sui/stats_pools","GET",i);if(s!=null&&s.lp_list)return{list:(s==null?void 0:s.lp_list)||[],total:s==null?void 0:s.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,o,s,a;try{const c=Tt("/data/pools.json"),u=await fetch(c).then(l=>l.json());if((i=u==null?void 0:u.data)!=null&&i.lp_list){const l=(o=u==null?void 0:u.data)==null?void 0:o.lp_list;let d=l;if(n!=null&&n.coin_type){const w=(a=(s=n==null?void 0:n.coin_type)==null?void 0:s.split(","))==null?void 0:a.map(b=>Cn(b).source_address);d=l==null?void 0:l.filter(b=>{var O,R;const y=Cn((O=b==null?void 0:b.coin_a)==null?void 0:O.address).source_address,T=Cn((R=b==null?void 0:b.coin_b)==null?void 0:R.address).source_address;return(w==null?void 0:w.length)>1&&w.includes(y)&&w.includes(T)?!0:!!((w==null?void 0:w.length)===1&&(w.includes(y)||w.includes(T)))})}n!=null&&n.is_vaults&&(d=l==null?void 0:l.filter(w=>w==null?void 0:w.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(d=l==null?void 0:l.filter(w=>w==null?void 0:w.has_farming));const p=d;return{list:p,total:(p==null?void 0:p.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function DI(e=!0){const{poolApiMap:t,setPoolApiMap:r}=$r(),{getPoolList:n,getLocalJsonPoolList:i}=kI();return{getPoolListByCoinType:async(s,a)=>{if(s&&a){const c=[s,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const d={coin_type:`${s},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let p=e?await i(d):void 0;(p===void 0||p.list.length===0)&&(p=await n(d));const w=p.list;if(w.length>0)return t[u]=w,r(u,w),w}return[]}}}function BI(e){const{routerData:t}=dn();return{priceAcceptRouterData:te.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!De(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!De(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function qw(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:o}=t;return n?De(o).mul(De(1).sub(De(e).div(100))).toString():De(i).mul(De(1).add(De(e).div(100))).toString()}},[e,t])}}function LI(e){const{getTokenInfo:t,fetchTokenInfo:r}=eo();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],o=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),s=[],a=[];let c=De(0);if(e.routerData.routes.forEach((l,d)=>{const p={},w=e.byAmountIn?l.amountIn.toString():l.amountOut.toString();d===e.routerData.routes.length-1?p.percentage=De(1).sub(c).toFixed(2):p.percentage=De(w).div(o).toFixed(2),c=De(c).add(p.percentage);const b=[];l.path.forEach(y=>{i.includes(y.provider)||i.push(y.provider);const T=Rr(y.from).full_address,O=Rr(y.target).full_address,R=t(T),k=t(O);R||a.includes(T)&&a.push(T),k||a.includes(O)&&a.push(O);const F=y.provider===ma.SCALLOP||y.provider===ma.FLOWX||y.provider===ma.FLOWXV3;b.push({from_type:T,to_type:O,pool_address:F?"":y.id,fee_rate:y.feeRate,provider:y.provider})}),p.paths=b,s.push(p)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:s}}},[e])}}function $I(){const{fromCoin:e,toCoin:t}=dn(),{getPoolListByCoinType:r}=DI();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(s=>s.address):[]}}function Ww(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?De(r).div(t).toString():De(t).div(r).toString():"0",[t,r,e])}function Gw(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await NI(i.coin_type)}catch{}return!1};return te.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function FI(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=dn(),{getTokenInfo:i}=eo(),{ignoreWarnTokenMap:o}=$r(),s=i(e),a=i(t),c=te.useMemo(()=>!Wc(r,Fw.coin_type)||!Wc(n,Uw.coin_type),[r,n]),u=te.useCallback(d=>d&&!o[bi(d.coin_type)]&&(Wc(r,d.coin_type)||Wc(n,d.coin_type))?!d.is_trusted:!1,[r,n,o]),l=te.useMemo(()=>{const d=[];return c&&(s&&u(s)&&d.push({...s}),a&&u(a)&&d.push({...a})),d},[s==null?void 0:s.coin_type,a==null?void 0:a.coin_type,c,o]);return{isCustomMode:c,customWarnTokenList:l}}function UI(){const{aggregatorSDK:e}=Io(),{getSwapPoolAddress:t}=$I(),r=o=>o&&o.error?o.error.code===Oo.InsufficientLiquidity||Oo.HoneyPot||Oo.NumberTooLarge:!1,n=async o=>{const{fromToken:s,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:d}=o;try{const p={from:s.coin_type,target:a.coin_type,amount:new Cp(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},w=await e.findRouters(p);if(w&&r(w))return i(!1,l,d,s,a,w);if(!w||w.routes.length===0)throw Error("not find router");return i(!1,l,d,s,a,w)}catch{const w=await t(),b={from:s.coin_type,target:a.coin_type,amount:new Cp(c),byAmountIn:l,pools:w};try{const y=await e.swapInPools(b);return!y||!y.routeData?i(!0,l,d,s,a):i(!0,l,d,s,a,y.routeData)}catch{return{uuid:d,byAmountIn:l,isDegrade:!0}}}},i=(o,s,a,c,u,l)=>{var d;if(l){const p=l.error!==void 0,w=cd(l.amountIn.toString(),c.decimals).toString(),b=cd(l.amountOut.toString(),u.decimals).toString();return{routerData:p?void 0:l,fromAmountUi:p?s?w:"":w,toAmountUi:p&&s?"":b,uuid:a,byAmountIn:s,isDegrade:o,errorCode:(d=l.error)==null?void 0:d.code}}else return{uuid:a,byAmountIn:s,isDegrade:o}};return{findBestRouters:n}}function Os(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function VI(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function zI(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function HI(e){return!!String(e).includes("Could not find the referenced transaction")}function qI(e){return VI(e)?"User rejected the request":zI(e)?"Exceeded price slippage":HI(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var hh={};Object.defineProperty(hh,"__esModule",{value:!0});var WI=hh.executeAuction=Kw,GI=lm,KI="https://rpc.getshio.com",YI=500,ZI=300;function Kw(e,t,r){r===void 0&&(r=YI);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,o){setTimeout(i,r),GI.default.post(KI,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(s){console.log("Shio executeAuction response:",s.data),setTimeout(i,ZI)}).catch(o)})}hh.default={executeAuction:Kw};function XI(){const{suiClient:e}=Io(),{currentAccount:t}=Pn(),{mutateAsync:r}=Ur.useSignTransaction(),{mutate:n}=Ur.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await o(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),o=async(c,u,l=!1)=>{var p,w;if(l){const b=await e.devInspectTransactionBlock({transactionBlock:qo.from(Tr(c)),sender:t.address});if(!b||((p=b.effects)==null?void 0:p.status.status)==="failure")throw Error((w=b.effects)==null?void 0:w.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var d,p;let l;if(typeof c=="string"?l=qo.from(c):l=c,u){const w=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!w||((d=w.effects)==null?void 0:d.status.status)==="failure")throw Error((p=w.effects)==null?void 0:p.status.error)}return l.setGasBudget(1e8),new Promise((w,b)=>{n({transaction:l,chain:i},{onSuccess:y=>{w(y)},onError:y=>{console.error("signAndExecuteTransactionBlock transaction failed",y),b(y)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=qo.from(c)),typeof c=="string"&&(c=qo.from(Tr(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:d=>{u(d)},onError:d=>{console.error("signTransactionBlock failed",d),l(d)},onSettled:(d,p,w,b)=>{console.error("signTransactionBlock onSettled",{data:d,error:p,variables:w})}})})),executeTransactionBlock:o}}function JI(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=XI(),{currentAccount:n}=Pn(),{suiClient:i}=Io(),{setTransactionData:o}=fh(),{addTxToast:s,removeToast:a}=Ts(),c=5,u=2e3;async function l(w,b=1){try{let y;try{y=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{y=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0}})}if(y)return y;throw new Error("Empty response")}catch(y){if(console.error(`Attempt ${b} failed:`,y),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await w1(u),l(w,b+1)}}const d=async(w,b,y={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:T=!1,useMev:O,txAction:R="signTransactionBlock"}=y;let k;b.status="confirmation",o(b);try{let q;if(R==="signTransactionBlock"){const K=await e(w),{bytes:re,signature:oe}=K;if(O)try{const ae=await WI(re,oe,500)}catch{}q=await t(re,oe,T)}else q=await r(w,T);b.status="submitted",o({...b}),b.tx=q.digest,k=s(b),await w1(u);const H=await l(q.digest,0);if(!H||((F=H.effects)==null?void 0:F.status.status)==="failure")p(b,(L=H.effects)==null?void 0:L.status.error);else{const K=d5(H,n==null?void 0:n.address,!1);if(b.buildShowInfo){const re=b.buildShowInfo("success",K);b.buildShowInfo=oe=>re}a(k),b.status="success",o({...b})}return H}catch(q){p(b,q)}},p=(w,b)=>{const y=qI(b);if(w.buildShowInfo){const T=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(T.toastDescriptionContent=y,T.modalDescriptionText=y,T),w.status="rejected",o({...w})}else w.buildShowInfo=T=>{const O={};return O.toastDescriptionContent=y,O.modalDescriptionText=y,O},w.status="rejected",o({...w})};return{signAndExecuteTransaction:d}}function ph(e,t=1e3){const r=te.useRef(),n=te.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return te.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function QI(){const{aggregatorSDK:e}=Io(),{findBestRouters:t}=UI(),{getTokenAmountValue:r,fetchTokenPrices:n}=Nu(),{providers:i,slippage:o,mevProtect:s}=$r(),{signAndExecuteTransaction:a}=JI(),{setTransactionData:c}=fh(),{addTxToast:u}=Ts(),{fromCoin:l,toCoin:d,setFromCoin:p,setToCoin:w,setToAmount:b,fromAmount:y,toAmount:T,setFromAmount:O,setFindRouterLoading:R,setRouterData:k,setByAmountIn:F,byAmountIn:L}=dn(),[q,H]=te.useState(""),K=Os(q),re=Os(L),oe=Os(y),ae=Os(T),z=Os(l),D=Os(d),{balanceInfo:h,getOwnerCoinBalances:f}=Ru(l==null?void 0:l.coin_type),{balanceInfo:m}=Ru(d==null?void 0:d.coin_type),S=r(l==null?void 0:l.coin_type,y),M=r(d==null?void 0:d.coin_type,T),I=ph(async(be,Ve,Le)=>{if(z.current&&D.current&&+be){(+oe.current||+ae.current)&&R(!0);const ft=u5(be,Ve?z.current.decimals:D.current.decimals),dt=await t({fromToken:z.current,toToken:D.current,amount:ft.toString(),providersKeys:i,by_amount_in:Ve,uuid:Le});R(!1),K.current===Le&&(Ve?+oe.current?(b(dt.toAmountUi||""),k(dt)):b(""):+ae.current?(O(dt.fromAmountUi||"ß"),k(dt)):O(""))}else v(!Ve)},500),C=(be,Ve,Le=!1)=>{if(F(Ve),Ve?(O(be),Le&&b("")):(b(be),Le&&O("")),+be){const ft=Hw();H(ft),I(be,Ve,ft)}else R(!1),k(void 0),v(!Ve)},g=(be,Ve=!0)=>{v(),Ve?((be==null?void 0:be.coin_type)===(d==null?void 0:d.coin_type)&&w(l),p(be)):((be==null?void 0:be.coin_type)===(l==null?void 0:l.coin_type)&&p(d),w(be))},v=be=>{be===void 0?(O(""),b("")):be?O(""):b(""),R(!1),k(void 0)},N=()=>{const be=re.current?oe.current:ae.current;if(+be){const Ve=Hw();H(Ve),I(be,re.current,Ve)}},ee=async(be,Ve)=>{const{routerData:Le,byAmountIn:ft,fromAmountUi:dt,toAmountUi:je}=be,mt=new qo,we={routers:Le,slippage:Number(o)/100,txb:mt,partner:Ve||v5};try{await e.fastRouterSwap(we);const he={status:"confirmation",buildShowInfo:(Ue,Ne)=>{const Me=`Swap ${jr(dt,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${jr(je,d==null?void 0:d.decimals)} ${d==null?void 0:d.symbol}`,Te={modalDescriptionText:Me,toastTitleText:Me};if(Ue==="success"){let Be=dt,ut=je;Ne&&(Be=b1(Ne,l)||dt,ut=b1(Ne,d)||je);const lt=`Swapped ${jr(Be,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${jr(ut,d==null?void 0:d.decimals)} ${d==null?void 0:d.symbol}`;Te.toastTitleText=lt,Te.modalDescriptionText=lt}return Te},id:0};c(he),await a(mt,he,{useMev:s})?(v(),f()):N()}catch(he){String(he).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Ce,Ue){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{ie(),v()},[l==null?void 0:l.coin_type,d==null?void 0:d.coin_type]);const ie=()=>{const be=[];l&&be.push(l.coin_type),d&&be.push(d.coin_type),be.length>0&&n(be)},{isScamsCoin:le}=Gw(l),{isScamsCoin:me}=Gw(d),xe=te.useMemo(()=>{if(!(!le&&!me)){if(le&&me)return`${l==null?void 0:l.symbol} and ${d==null?void 0:d.symbol} are`;if(le)return`${l==null?void 0:l.symbol} token is `;if(me)return`${d==null?void 0:d.symbol} token is `}},[le,me]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:h,toBalanceInfo:m,fromAmountValue:S,toAmountValue:M,doSwapAction:ee,reCalculateRouteData:N,refreshMarketPrice:ie,scamsText:xe}}function eO(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:o}=dn(),{currentAccount:s}=Pn(),a=te.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(s!=null&&s.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(o&&o.errorCode){if(o.errorCode===Oo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(o.errorCode===Oo.NoRouter||o.errorCode===Oo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&De(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${cn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[s==null?void 0:s.address,n,i,e,o==null?void 0:o.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function Yw({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const o=50-parseFloat(t),s=2*Math.PI*o,a=s*i,c=s-a;return x.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[x.jsx("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:n,strokeWidth:t}),x.jsx("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),x.jsx("style",{children:`
93
+ `)},fI=0,Is=[];function dI(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(fI++)[0],o=P.useState(Ey)[0],s=P.useRef(e);P.useEffect(function(){s.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=N7([e.lockRef.current],(e.shards||[]).map(Oy),!0).filter(Boolean);return y.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(y,T){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var O=Ou(y),N=r.current,k="deltaX"in y?y.deltaX:N[0]-O[0],F="deltaY"in y?y.deltaY:N[1]-O[1],L,W=y.target,z=Math.abs(k)>Math.abs(F)?"h":"v";if("touches"in y&&z==="h"&&W.type==="range")return!1;var G=Ay(z,W);if(!G)return!0;if(G?L=z:(L=z==="v"?"h":"v",G=Ay(z,W)),!G)return!1;if(!n.current&&"changedTouches"in y&&(k||F)&&(n.current=L),!L)return!0;var re=n.current||L;return cI(re,T,y,re==="h"?k:F,!0)},[]),c=P.useCallback(function(y){var T=y;if(!(!Is.length||Is[Is.length-1]!==o)){var O="deltaY"in T?Iy(T):Ou(T),N=t.current.filter(function(L){return L.name===T.type&&(L.target===T.target||T.target===L.shadowParent)&&uI(L.delta,O)})[0];if(N&&N.should){T.cancelable&&T.preventDefault();return}if(!N){var k=(s.current.shards||[]).map(Oy).filter(Boolean).filter(function(L){return L.contains(T.target)}),F=k.length>0?a(T,k[0]):!s.current.noIsolation;F&&T.cancelable&&T.preventDefault()}}},[]),u=P.useCallback(function(y,T,O,N){var k={name:y,delta:T,target:O,should:N,shadowParent:hI(O)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(F){return F!==k})},1)},[]),l=P.useCallback(function(y){r.current=Ou(y),n.current=void 0},[]),d=P.useCallback(function(y){u(y.type,Iy(y),y.target,a(y,e.lockRef.current))},[]),p=P.useCallback(function(y){u(y.type,Ou(y),y.target,a(y,e.lockRef.current))},[]);P.useEffect(function(){return Is.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Ts),document.addEventListener("touchmove",c,Ts),document.addEventListener("touchstart",l,Ts),function(){Is=Is.filter(function(y){return y!==o}),document.removeEventListener("wheel",c,Ts),document.removeEventListener("touchmove",c,Ts),document.removeEventListener("touchstart",l,Ts)}},[]);var b=e.removeScrollBar,x=e.inert;return P.createElement(P.Fragment,null,x?P.createElement(o,{styles:lI(i)}):null,b?P.createElement(tI,{gapMode:e.gapMode}):null)}function hI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const pI=V7(xy,dI);var Py=P.forwardRef(function(e,t){return P.createElement(Tu,ti({},e,{ref:t,sideCar:pI}))});Py.classNames=Tu.classNames;const mI=Py;function gI(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var rh="ScrollArea",[Ry,jL]=Mi(rh),[vI,pn]=Ry(rh),Ny=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:o=600,...s}=e,[a,c]=P.useState(null),[u,l]=P.useState(null),[d,p]=P.useState(null),[b,x]=P.useState(null),[y,T]=P.useState(null),[O,N]=P.useState(0),[k,F]=P.useState(0),[L,W]=P.useState(!1),[z,G]=P.useState(!1),re=ir(t,ae=>c(ae)),oe=Vd(i);return w.jsx(vI,{scope:r,type:n,dir:oe,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:l,content:d,onContentChange:p,scrollbarX:b,onScrollbarXChange:x,scrollbarXEnabled:L,onScrollbarXEnabledChange:W,scrollbarY:y,onScrollbarYChange:T,scrollbarYEnabled:z,onScrollbarYEnabledChange:G,onCornerWidthChange:N,onCornerHeightChange:F,children:w.jsx(Zt.div,{dir:oe,...s,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":O+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Ny.displayName=rh;var jy="ScrollAreaViewport",ky=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...o}=e,s=pn(jy,r),a=P.useRef(null),c=ir(t,a,s.onViewportChange);return w.jsxs(w.Fragment,{children:[w.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),w.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:w.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});ky.displayName=jy;var ri="ScrollAreaScrollbar",Dy=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=pn(ri,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?o(!0):s(!0),()=>{a?o(!1):s(!1)}),[a,o,s]),i.type==="hover"?w.jsx(yI,{...n,ref:t,forceMount:r}):i.type==="scroll"?w.jsx(wI,{...n,ref:t,forceMount:r}):i.type==="auto"?w.jsx(By,{...n,ref:t,forceMount:r}):i.type==="always"?w.jsx(nh,{...n,ref:t}):null});Dy.displayName=ri;var yI=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=pn(ri,e.__scopeScrollArea),[o,s]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},l=()=>{c=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),w.jsx(kn,{present:r||o,children:w.jsx(By,{"data-state":o?"visible":"hidden",...n,ref:t})})}),wI=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=pn(ri,e.__scopeScrollArea),o=e.orientation==="horizontal",s=ju(()=>c("SCROLL_END"),100),[a,c]=gI("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return P.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),P.useEffect(()=>{const u=i.viewport,l=o?"scrollLeft":"scrollTop";if(u){let d=u[l];const p=()=>{const b=u[l];d!==b&&(c("SCROLL"),s()),d=b};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[i.viewport,o,c,s]),w.jsx(kn,{present:r||a!=="hidden",children:w.jsx(nh,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Xe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Xe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),By=P.forwardRef((e,t)=>{const r=pn(ri,e.__scopeScrollArea),{forceMount:n,...i}=e,[o,s]=P.useState(!1),a=e.orientation==="horizontal",c=ju(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;s(a?u:l)}},10);return Os(r.viewport,c),Os(r.content,c),w.jsx(kn,{present:n||o,children:w.jsx(nh,{"data-state":o?"visible":"hidden",...i,ref:t})})}),nh=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=pn(ri,e.__scopeScrollArea),o=P.useRef(null),s=P.useRef(0),[a,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Vy(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>o.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function d(p,b){return CI(p,s.current,a,b)}return r==="horizontal"?w.jsx(bI,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollLeft,b=zy(p,a,i.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}}):r==="vertical"?w.jsx(xI,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollTop,b=zy(p,a);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}}):null}),bI=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=pn(ri,e.__scopeScrollArea),[s,a]=P.useState(),c=P.useRef(null),u=ir(t,c,o.onScrollbarXChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx($y,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Nu(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,d)=>{if(o.viewport){const p=o.viewport.scrollLeft+l.deltaX;e.onWheelScroll(p),qy(p,d)&&l.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Ru(s.paddingLeft),paddingEnd:Ru(s.paddingRight)}})}})}),xI=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=pn(ri,e.__scopeScrollArea),[s,a]=P.useState(),c=P.useRef(null),u=ir(t,c,o.onScrollbarYChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx($y,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Nu(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,d)=>{if(o.viewport){const p=o.viewport.scrollTop+l.deltaY;e.onWheelScroll(p),qy(p,d)&&l.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Ru(s.paddingTop),paddingEnd:Ru(s.paddingBottom)}})}})}),[SI,Ly]=Ry(ri),$y=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:d,...p}=e,b=pn(ri,r),[x,y]=P.useState(null),T=ir(t,re=>y(re)),O=P.useRef(null),N=P.useRef(""),k=b.viewport,F=n.content-n.viewport,L=br(l),W=br(c),z=ju(d,10);function G(re){if(O.current){const oe=re.clientX-O.current.left,ae=re.clientY-O.current.top;u({x:oe,y:ae})}}return P.useEffect(()=>{const re=oe=>{const ae=oe.target;(x==null?void 0:x.contains(ae))&&L(oe,F)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[k,x,F,L]),P.useEffect(W,[n,W]),Os(x,z),Os(b.content,z),w.jsx(SI,{scope:r,scrollbar:x,hasThumb:i,onThumbChange:br(o),onThumbPointerUp:br(s),onThumbPositionChange:W,onThumbPointerDown:br(a),children:w.jsx(Zt.div,{...p,ref:T,style:{position:"absolute",...p.style},onPointerDown:Xe(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),O.current=x.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),G(re))}),onPointerMove:Xe(e.onPointerMove,G),onPointerUp:Xe(e.onPointerUp,re=>{const oe=re.target;oe.hasPointerCapture(re.pointerId)&&oe.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=N.current,b.viewport&&(b.viewport.style.scrollBehavior=""),O.current=null})})})}),Pu="ScrollAreaThumb",Fy=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Ly(Pu,e.__scopeScrollArea);return w.jsx(kn,{present:r||i.hasThumb,children:w.jsx(EI,{ref:t,...n})})}),EI=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,o=pn(Pu,r),s=Ly(Pu,r),{onThumbPositionChange:a}=s,c=ir(t,d=>s.onThumbChange(d)),u=P.useRef(void 0),l=ju(()=>{u.current&&(u.current(),u.current=void 0)},100);return P.useEffect(()=>{const d=o.viewport;if(d){const p=()=>{if(l(),!u.current){const b=AI(d,a);u.current=b,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[o.viewport,l,a]),w.jsx(Zt.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Xe(e.onPointerDownCapture,d=>{const b=d.target.getBoundingClientRect(),x=d.clientX-b.left,y=d.clientY-b.top;s.onThumbPointerDown({x,y})}),onPointerUp:Xe(e.onPointerUp,s.onThumbPointerUp)})});Fy.displayName=Pu;var ih="ScrollAreaCorner",Uy=P.forwardRef((e,t)=>{const r=pn(ih,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?w.jsx(_I,{...e,ref:t}):null});Uy.displayName=ih;var _I=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=pn(ih,r),[o,s]=P.useState(0),[a,c]=P.useState(0),u=!!(o&&a);return Os(i.scrollbarX,()=>{var d;const l=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Os(i.scrollbarY,()=>{var d;const l=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(l),s(l)}),u?w.jsx(Zt.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Ru(e){return e?parseInt(e,10):0}function Vy(e,t){const r=e/t;return isNaN(r)?0:r}function Nu(e){const t=Vy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function CI(e,t,r,n="ltr"){const i=Nu(r),o=i/2,s=t||o,a=i-s,c=r.scrollbar.paddingStart+s,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,d=n==="ltr"?[0,l]:[l*-1,0];return Hy([c,u],d)(e)}function zy(e,t,r="ltr"){const n=Nu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,s]:[s*-1,0],u=b7(e,c);return Hy([0,s],[0,a])(u)}function Hy(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function qy(e,t){return e>0&&e<t}var AI=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},s=r.left!==o.left,a=r.top!==o.top;(s||a)&&t(),r=o,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function ju(e,t){const r=br(e),n=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(n.current),[]),P.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Os(e,t){const r=br(t);Ji(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var MI=Ny,TI=ky,Wy=Dy,Gy=Fy,II=Uy,oh="Switch",[OI,kL]=Mi(oh),[PI,RI]=OI(oh),Ky=P.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:l,...d}=e,[p,b]=P.useState(null),x=ir(t,k=>b(k)),y=P.useRef(!1),T=p?l||!!p.closest("form"):!0,[O=!1,N]=Ca({prop:i,defaultProp:o,onChange:u});return w.jsxs(PI,{scope:r,checked:O,disabled:a,children:[w.jsx(Zt.button,{type:"button",role:"switch","aria-checked":O,"aria-required":s,"data-state":Xy(O),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:x,onClick:Xe(e.onClick,k=>{N(F=>!F),T&&(y.current=k.isPropagationStopped(),y.current||k.stopPropagation())})}),T&&w.jsx(NI,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});Ky.displayName=oh;var Yy="SwitchThumb",Zy=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=RI(Yy,r);return w.jsx(Zt.span,{"data-state":Xy(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});Zy.displayName=Yy;var NI=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,o=P.useRef(null),s=Xv(r),a=Bd(t);return P.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&d){const p=new Event("click",{bubbles:n});d.call(c,r),c.dispatchEvent(p)}},[s,r,n]),w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Xy(e){return e?"checked":"unchecked"}var jI=Ky,kI=Zy;const Ta={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:Aa,highContrast:wu,radius:Hd},Jy=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{className:i,style:o,size:s=Ta.size.default,variant:a=Ta.variant.default,color:c=Ta.color.default,highContrast:u=Ta.highContrast.default,radius:l=Ta.radius.default,...d}=r;return P.createElement("span",{"data-radius":l,className:Jt("rt-SwitchRoot",i,bt(s,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},_s(n)),style:o},P.createElement(jI,{"data-accent-color":c,...d,ref:t,className:Jt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(kI,{className:Jt("rt-SwitchThumb",{"rt-high-contrast":u})})))});Jy.displayName="Switch";var sh=["Enter"," "],DI=["ArrowDown","PageUp","Home"],Qy=["ArrowUp","PageDown","End"],BI=[...DI,...Qy],LI={ltr:[...sh,"ArrowRight"],rtl:[...sh,"ArrowLeft"]},$I={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ia="Menu",[Oa,FI,UI]=ny(Ia),[Lo,ew]=Mi(Ia,[UI,hu,oy]),Pa=hu(),tw=oy(),[rw,io]=Lo(Ia),[VI,Ra]=Lo(Ia),nw=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:o,modal:s=!0}=e,a=Pa(t),[c,u]=P.useState(null),l=P.useRef(!1),d=br(o),p=Vd(i);return P.useEffect(()=>{const b=()=>{l.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>l.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),w.jsx(Nv,{...a,children:w.jsx(rw,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:w.jsx(VI,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:l,dir:p,modal:s,children:n})})})};nw.displayName=Ia;var zI="MenuAnchor",ah=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Pa(r);return w.jsx(jv,{...i,...n,ref:t})});ah.displayName=zI;var ch="MenuPortal",[HI,iw]=Lo(ch,{forceMount:void 0}),ow=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=io(ch,t);return w.jsx(HI,{scope:t,forceMount:r,children:w.jsx(kn,{present:r||o.open,children:w.jsx(Bv,{asChild:!0,container:i,children:n})})})};ow.displayName=ch;var mn="MenuContent",[qI,uh]=Lo(mn),sw=P.forwardRef((e,t)=>{const r=iw(mn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=io(mn,e.__scopeMenu),s=Ra(mn,e.__scopeMenu);return w.jsx(Oa.Provider,{scope:e.__scopeMenu,children:w.jsx(kn,{present:n||o.open,children:w.jsx(Oa.Slot,{scope:e.__scopeMenu,children:s.modal?w.jsx(WI,{...i,ref:t}):w.jsx(GI,{...i,ref:t})})})})}),WI=P.forwardRef((e,t)=>{const r=io(mn,e.__scopeMenu),n=P.useRef(null),i=ir(t,n);return P.useEffect(()=>{const o=n.current;if(o)return R7(o)},[]),w.jsx(lh,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Xe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),GI=P.forwardRef((e,t)=>{const r=io(mn,e.__scopeMenu);return w.jsx(lh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),lh=P.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:p,onDismiss:b,disableOutsideScroll:x,...y}=e,T=io(mn,r),O=Ra(mn,r),N=Pa(r),k=tw(r),F=FI(r),[L,W]=P.useState(null),z=P.useRef(null),G=ir(t,z,T.onContentChange),re=P.useRef(0),oe=P.useRef(""),ae=P.useRef(0),H=P.useRef(null),D=P.useRef("right"),h=P.useRef(0),f=x?mI:P.Fragment,m=x?{as:Ti,allowPinchZoom:!0}:void 0,S=_=>{var ue,_e;const I=oe.current+_,C=F().filter(de=>!de.disabled),g=document.activeElement,v=(ue=C.find(de=>de.ref.current===g))==null?void 0:ue.textValue,R=C.map(de=>de.textValue),J=o9(R,I,v),Q=(_e=C.find(de=>de.textValue===J))==null?void 0:_e.ref.current;(function de(be){oe.current=be,window.clearTimeout(re.current),be!==""&&(re.current=window.setTimeout(()=>de(""),1e3))})(I),Q&&setTimeout(()=>Q.focus())};P.useEffect(()=>()=>window.clearTimeout(re.current),[]),x7();const A=P.useCallback(_=>{var C,g;return D.current===((C=H.current)==null?void 0:C.side)&&a9(_,(g=H.current)==null?void 0:g.area)},[]);return w.jsx(qI,{scope:r,searchRef:oe,onItemEnter:P.useCallback(_=>{A(_)&&_.preventDefault()},[A]),onItemLeave:P.useCallback(_=>{var I;A(_)||((I=z.current)==null||I.focus(),W(null))},[A]),onTriggerLeave:P.useCallback(_=>{A(_)&&_.preventDefault()},[A]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:P.useCallback(_=>{H.current=_},[]),children:w.jsx(f,{...m,children:w.jsx(dy,{asChild:!0,trapped:i,onMountAutoFocus:Xe(o,_=>{var I;_.preventDefault(),(I=z.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:w.jsx(_d,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:p,onDismiss:b,children:w.jsx(y7,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:W,onEntryFocus:Xe(c,_=>{O.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(kv,{role:"menu","aria-orientation":"vertical","data-state":_w(T.open),"data-radix-menu-content":"",dir:O.dir,...N,...y,ref:G,style:{outline:"none",...y.style},onKeyDown:Xe(y.onKeyDown,_=>{const C=_.target.closest("[data-radix-menu-content]")===_.currentTarget,g=_.ctrlKey||_.altKey||_.metaKey,v=_.key.length===1;C&&(_.key==="Tab"&&_.preventDefault(),!g&&v&&S(_.key));const R=z.current;if(_.target!==R||!BI.includes(_.key))return;_.preventDefault();const Q=F().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);Qy.includes(_.key)&&Q.reverse(),n9(Q)}),onBlur:Xe(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(re.current),oe.current="")}),onPointerMove:Xe(e.onPointerMove,ja(_=>{const I=_.target,C=h.current!==_.clientX;if(_.currentTarget.contains(I)&&C){const g=_.clientX>h.current?"right":"left";D.current=g,h.current=_.clientX}}))})})})})})})});sw.displayName=mn;var KI="MenuGroup",fh=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Zt.div,{role:"group",...n,ref:t})});fh.displayName=KI;var YI="MenuLabel",aw=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Zt.div,{...n,ref:t})});aw.displayName=YI;var ku="MenuItem",cw="menu.itemSelect",Du=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=P.useRef(null),s=Ra(ku,e.__scopeMenu),a=uh(ku,e.__scopeMenu),c=ir(t,o),u=P.useRef(!1),l=()=>{const d=o.current;if(!r&&d){const p=new CustomEvent(cw,{bubbles:!0,cancelable:!0});d.addEventListener(cw,b=>n==null?void 0:n(b),{once:!0}),ev(d,p),p.defaultPrevented?u.current=!1:s.onClose()}};return w.jsx(uw,{...i,ref:c,disabled:r,onClick:Xe(e.onClick,l),onPointerDown:d=>{var p;(p=e.onPointerDown)==null||p.call(e,d),u.current=!0},onPointerUp:Xe(e.onPointerUp,d=>{var p;u.current||(p=d.currentTarget)==null||p.click()}),onKeyDown:Xe(e.onKeyDown,d=>{const p=a.searchRef.current!=="";r||p&&d.key===" "||sh.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Du.displayName=ku;var uw=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,s=uh(ku,r),a=tw(r),c=P.useRef(null),u=ir(t,c),[l,d]=P.useState(!1),[p,b]=P.useState("");return P.useEffect(()=>{const x=c.current;x&&b((x.textContent??"").trim())},[o.children]),w.jsx(Oa.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:w.jsx(w7,{asChild:!0,...a,focusable:!n,children:w.jsx(Zt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:Xe(e.onPointerMove,ja(x=>{n?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Xe(e.onPointerLeave,ja(x=>s.onItemLeave(x))),onFocus:Xe(e.onFocus,()=>d(!0)),onBlur:Xe(e.onBlur,()=>d(!1))})})})}),ZI="MenuCheckboxItem",lw=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return w.jsx(mw,{scope:e.__scopeMenu,checked:r,children:w.jsx(Du,{role:"menuitemcheckbox","aria-checked":Bu(r)?"mixed":r,...i,ref:t,"data-state":ph(r),onSelect:Xe(i.onSelect,()=>n==null?void 0:n(Bu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});lw.displayName=ZI;var fw="MenuRadioGroup",[XI,JI]=Lo(fw,{value:void 0,onValueChange:()=>{}}),dw=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,o=br(n);return w.jsx(XI,{scope:e.__scopeMenu,value:r,onValueChange:o,children:w.jsx(fh,{...i,ref:t})})});dw.displayName=fw;var hw="MenuRadioItem",pw=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=JI(hw,e.__scopeMenu),o=r===i.value;return w.jsx(mw,{scope:e.__scopeMenu,checked:o,children:w.jsx(Du,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":ph(o),onSelect:Xe(n.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,r)},{checkForDefaultPrevented:!1})})})});pw.displayName=hw;var dh="MenuItemIndicator",[mw,QI]=Lo(dh,{checked:!1}),gw=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,o=QI(dh,r);return w.jsx(kn,{present:n||Bu(o.checked)||o.checked===!0,children:w.jsx(Zt.span,{...i,ref:t,"data-state":ph(o.checked)})})});gw.displayName=dh;var e9="MenuSeparator",vw=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});vw.displayName=e9;var t9="MenuArrow",yw=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Pa(r);return w.jsx(Dv,{...i,...n,ref:t})});yw.displayName=t9;var hh="MenuSub",[r9,ww]=Lo(hh),bw=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,o=io(hh,t),s=Pa(t),[a,c]=P.useState(null),[u,l]=P.useState(null),d=br(i);return P.useEffect(()=>(o.open===!1&&d(!1),()=>d(!1)),[o.open,d]),w.jsx(Nv,{...s,children:w.jsx(rw,{scope:t,open:n,onOpenChange:d,content:u,onContentChange:l,children:w.jsx(r9,{scope:t,contentId:xa(),triggerId:xa(),trigger:a,onTriggerChange:c,children:r})})})};bw.displayName=hh;var Na="MenuSubTrigger",xw=P.forwardRef((e,t)=>{const r=io(Na,e.__scopeMenu),n=Ra(Na,e.__scopeMenu),i=ww(Na,e.__scopeMenu),o=uh(Na,e.__scopeMenu),s=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},l=P.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return P.useEffect(()=>l,[l]),P.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),c(null)}},[a,c]),w.jsx(ah,{asChild:!0,...u,children:w.jsx(uw,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":_w(r.open),...e,ref:nu(t,i.onTriggerChange),onClick:d=>{var p;(p=e.onClick)==null||p.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Xe(e.onPointerMove,ja(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:Xe(e.onPointerLeave,ja(d=>{var b,x;l();const p=(b=r.content)==null?void 0:b.getBoundingClientRect();if(p){const y=(x=r.content)==null?void 0:x.dataset.side,T=y==="right",O=T?-5:5,N=p[T?"left":"right"],k=p[T?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+O,y:d.clientY},{x:N,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:N,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Xe(e.onKeyDown,d=>{var b;const p=o.searchRef.current!=="";e.disabled||p&&d.key===" "||LI[n.dir].includes(d.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),d.preventDefault())})})})});xw.displayName=Na;var Sw="MenuSubContent",Ew=P.forwardRef((e,t)=>{const r=iw(mn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=io(mn,e.__scopeMenu),s=Ra(mn,e.__scopeMenu),a=ww(Sw,e.__scopeMenu),c=P.useRef(null),u=ir(t,c);return w.jsx(Oa.Provider,{scope:e.__scopeMenu,children:w.jsx(kn,{present:n||o.open,children:w.jsx(Oa.Slot,{scope:e.__scopeMenu,children:w.jsx(lh,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var d;s.isUsingKeyboardRef.current&&((d=c.current)==null||d.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:Xe(e.onFocusOutside,l=>{l.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Xe(e.onEscapeKeyDown,l=>{s.onClose(),l.preventDefault()}),onKeyDown:Xe(e.onKeyDown,l=>{var b;const d=l.currentTarget.contains(l.target),p=$I[s.dir].includes(l.key);d&&p&&(o.onOpenChange(!1),(b=a.trigger)==null||b.focus(),l.preventDefault())})})})})})});Ew.displayName=Sw;function _w(e){return e?"open":"closed"}function Bu(e){return e==="indeterminate"}function ph(e){return Bu(e)?"indeterminate":e?"checked":"unchecked"}function n9(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function i9(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function o9(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let s=i9(e,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==r));const c=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function s9(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,c=t[o].y,u=t[s].x,l=t[s].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function a9(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return s9(r,t)}function ja(e){return t=>t.pointerType==="mouse"?e(t):void 0}var c9=nw,u9=ah,l9=ow,f9=sw,d9=fh,h9=aw,p9=Du,m9=lw,g9=dw,v9=pw,y9=gw,w9=vw,b9=yw,x9=bw,S9=xw,E9=Ew,mh="DropdownMenu",[_9,LL]=Mi(mh,[ew]),Br=ew(),[C9,Cw]=_9(mh),Aw=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,c=Br(t),u=P.useRef(null),[l=!1,d]=Ca({prop:i,defaultProp:o,onChange:s});return w.jsx(C9,{scope:t,triggerId:xa(),triggerRef:u,contentId:xa(),open:l,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(p=>!p),[d]),modal:a,children:w.jsx(c9,{...c,open:l,onOpenChange:d,dir:n,modal:a,children:r})})};Aw.displayName=mh;var Mw="DropdownMenuTrigger",Tw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=Cw(Mw,r),s=Br(r);return w.jsx(u9,{asChild:!0,...s,children:w.jsx(Zt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:nu(t,o.triggerRef),onPointerDown:Xe(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Xe(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});Tw.displayName=Mw;var A9="DropdownMenuPortal",Iw=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Br(t);return w.jsx(l9,{...n,...r})};Iw.displayName=A9;var Ow="DropdownMenuContent",Pw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Cw(Ow,r),o=Br(r),s=P.useRef(!1);return w.jsx(f9,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...n,ref:t,onCloseAutoFocus:Xe(e.onCloseAutoFocus,a=>{var c;s.current||(c=i.triggerRef.current)==null||c.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Xe(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(s.current=!0)}),style:{...e.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)"}})});Pw.displayName=Ow;var M9="DropdownMenuGroup",Rw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(d9,{...i,...n,ref:t})});Rw.displayName=M9;var T9="DropdownMenuLabel",Nw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(h9,{...i,...n,ref:t})});Nw.displayName=T9;var I9="DropdownMenuItem",jw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(p9,{...i,...n,ref:t})});jw.displayName=I9;var O9="DropdownMenuCheckboxItem",kw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(m9,{...i,...n,ref:t})});kw.displayName=O9;var P9="DropdownMenuRadioGroup",Dw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(g9,{...i,...n,ref:t})});Dw.displayName=P9;var R9="DropdownMenuRadioItem",Bw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(v9,{...i,...n,ref:t})});Bw.displayName=R9;var N9="DropdownMenuItemIndicator",Lw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(y9,{...i,...n,ref:t})});Lw.displayName=N9;var j9="DropdownMenuSeparator",$w=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(w9,{...i,...n,ref:t})});$w.displayName=j9;var k9="DropdownMenuArrow",D9=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(b9,{...i,...n,ref:t})});D9.displayName=k9;var B9=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:o}=e,s=Br(t),[a=!1,c]=Ca({prop:n,defaultProp:o,onChange:i});return w.jsx(x9,{...s,open:a,onOpenChange:c,children:r})},L9="DropdownMenuSubTrigger",Fw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(S9,{...i,...n,ref:t})});Fw.displayName=L9;var $9="DropdownMenuSubContent",Uw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Br(r);return w.jsx(E9,{...i,...n,ref:t,style:{...e.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)"}})});Uw.displayName=$9;var F9=Aw,U9=Tw,Vw=Iw,V9=Pw,z9=Rw,H9=Nw,q9=jw,W9=kw,G9=Dw,K9=Bw,zw=Lw,Y9=$w,Z9=B9,X9=Fw,J9=Uw;const gh={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Hd,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},vh=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{className:i,style:o,type:s,scrollHideDelay:a=s!=="scroll"?0:void 0,dir:c,size:u=gh.size.default,radius:l=gh.radius.default,scrollbars:d=gh.scrollbars.default,...p}=r;return P.createElement(MI,{type:s,scrollHideDelay:a,className:Jt("rt-ScrollAreaRoot",i,_s(n)),style:o},P.createElement(TI,{...p,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),d!=="vertical"?P.createElement(Wy,{"data-radius":l,orientation:"horizontal",className:Jt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(Gy,{className:"rt-ScrollAreaThumb"})):null,d!=="horizontal"?P.createElement(Wy,{"data-radius":l,orientation:"vertical",className:Jt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(Gy,{className:"rt-ScrollAreaThumb"})):null,d==="both"?P.createElement(II,{className:"rt-ScrollAreaCorner"}):null)});vh.displayName="ScrollArea";const yh={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:Aa,highContrast:wu},Hw={color:Aa,shortcut:{type:"string",default:void 0}},qw=e=>P.createElement(F9,{...e});qw.displayName="DropdownMenuRoot";const Ww=P.forwardRef((e,t)=>P.createElement(U9,{...e,ref:t,asChild:!0}));Ww.displayName="DropdownMenuTrigger";const Gw=P.createContext({}),Kw=P.forwardRef((e,t)=>{const r=WT(),{className:n,children:i,size:o=yh.size.default,variant:s=yh.variant.default,highContrast:a=yh.highContrast.default,color:c=Hw.color.default,container:u,forceMount:l,...d}=e,p=c??r.accentColor;return P.createElement(Vw,{container:u,forceMount:l},P.createElement(yu,{asChild:!0},P.createElement(V9,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...d,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,bt(o,"rt-r-size"),`rt-variant-${s}`,{"rt-high-contrast":a})},P.createElement(vh,{type:"auto"},P.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(Gw.Provider,{value:P.useMemo(()=>({size:o,variant:s,color:p,highContrast:a}),[o,s,p,a])},i))))))});Kw.displayName="DropdownMenuContent";const Yw=P.forwardRef((e,t)=>P.createElement(H9,{...e,ref:t,className:Jt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));Yw.displayName="DropdownMenuLabel";const Zw=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=Hw.color.default,shortcut:o,...s}=e;return P.createElement(q9,{"data-accent-color":i,...s,ref:t,className:Jt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(gs,null,n),o&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},o))});Zw.displayName="DropdownMenuItem";const Xw=P.forwardRef((e,t)=>P.createElement(z9,{...e,ref:t,className:Jt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Xw.displayName="DropdownMenuGroup";const Jw=P.forwardRef((e,t)=>P.createElement(G9,{...e,ref:t,className:Jt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Jw.displayName="DropdownMenuRadioGroup";const Qw=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement(K9,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(gs,null,r),P.createElement(zw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(xu,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Qw.displayName="DropdownMenuRadioItem";const eb=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...o}=e;return P.createElement(W9,{...o,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(gs,null,r),P.createElement(zw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(xu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});eb.displayName="DropdownMenuCheckboxItem";const tb=e=>P.createElement(Z9,{...e});tb.displayName="DropdownMenuSub";const rb=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(X9,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(gs,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement(ry,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});rb.displayName="DropdownMenuSubTrigger";const nb=P.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:o,...s}=e,{size:a,variant:c,color:u,highContrast:l}=P.useContext(Gw);return P.createElement(Vw,{container:i,forceMount:o},P.createElement(yu,{asChild:!0},P.createElement(J9,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...s,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,bt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},P.createElement(vh,{type:"auto"},P.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});nb.displayName="DropdownMenuSubContent";const ib=P.forwardRef((e,t)=>P.createElement(Y9,{...e,ref:t,className:Jt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));ib.displayName="DropdownMenuSeparator";const gn=Object.assign({},{Root:qw,Trigger:Ww,Content:Kw,Label:Yw,Item:Zw,Group:Xw,RadioGroup:Jw,RadioItem:Qw,CheckboxItem:eb,Sub:tb,SubTrigger:rb,SubContent:nb,Separator:ib}),ka={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:Aa,highContrast:wu,radius:Hd},ob=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{className:i,asChild:o=!1,size:s=ka.size.default,variant:a=ka.variant.default,color:c=ka.color.default,highContrast:u=ka.highContrast.default,radius:l=ka.radius.default,...d}=r,p=o?Ti:"button";return P.createElement(p,{"data-disabled":d.disabled||void 0,"data-accent-color":c,"data-radius":l,...d,ref:t,className:Jt("rt-reset","rt-BaseButton",i,bt(s,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},_s(n))})});ob.displayName="BaseButton";const sb=P.forwardRef((e,t)=>P.createElement(ob,{...e,ref:t,className:Jt("rt-Button",e.className)}));sb.displayName="Button";const Q9={loading:{type:"boolean",default:!0}},Ps=P.forwardRef((e,t)=>{const{rest:r,...n}=Es(e),{className:i,children:o,loading:s=Q9.loading.default,...a}=r;if(!s)return P.createElement(P.Fragment,null,o);const c=P.isValidElement(o)?Ti:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:Jt("rt-Skeleton",i,_s(n)),"data-inline-skeleton":P.isValidElement(o)?void 0:!0,tabIndex:-1,inert:"",...a},o)});Ps.displayName="Skeleton";const eO=It("/images/ghost_loading.png"),tO={primary:It("/images/primary_loading.png"),ghost:eO};function rO({size:e="24px",variant:t="primary",wrapStyle:r={}}){return w.jsx(Zv,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:w.jsx("img",{src:tO[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const nO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAPKADAAQAAAABAAAAPAAAAACL3+lcAAAJW0lEQVRoBd1be1BU1xk/LstLdtlVUYKoKKA8fJBKJDVxovYxTadC0zY1/2jaKWM0GRsnTTOpEQNGqc34mGicNpqxGkirMYk4QFONqTG01WioFXzwFhRfUJTl/dple37XnmUf93Hu3Uuknpmdc/ec7/vO97vn9Z3vfHcUGaa0a+2PxlnN9hVWU+Aia5gxLsIaHGk1GUNCAgMCRocaRqHZ7p5BZ++Aw2HrtPe22PqabF32Olun46Stw/Du6s0Fd4ZDNaFhvQS/k/P95ChryKb4iaO/NX1yWHhgwD1gauUPOAadNY1d7bU3u0/csvVmrcr562W1MqTodQGcvzlj9cwppqw5ceYJFKMuMpnCFLuzvK6j+dK1zk3L1xbuYuVac7+Uy8tNf2legiU7cYrJolUBNXyV1zrbSqvas5evK9yhhs+dVhPgd9YvSUmJCzvyzeQxU92FfV3PX15ubSir63pq1cbiMrVtBqhlyM/9wfqli6MOxkaFjVHLqxf9pPGh1sSY0SuT46MGC07UlKiRq6qHC3c8Vbhk/kNLKJMqPjUKqaF1EuIsPn27OGPNkQxePi7F976ZYU6ICDn3+Oyx8byCv066f164W1vV0js389XCDqV2FYf07pz0xAWJlsq5MyxRSsLuV/2UyNCxoQGjVs9JjikoPlndIqeHbA+jZx+LC79BV2GznBDeuu4+B9l+qI4Un2oSWNIfe4j86plYEhqk+N65mqCreMepuvZouZ42yknCMNYLbL/dSX7xu/Pk3zVtribzjjWSC1faSd66b5Ago8FVrvUBut5p6z9H+adLyZB8tVigvpM6fr4Uo9ry7YeukE++vNez7ry37/aRvv5BsmD2WPdizc8Y3qmzJqUeOFp5QEyIKGBsPU8vjF6p12pMhxpZu6eCOOmyKpbKaS9/O3U8ibAEiVWrLpsx2TQjfmqk6JblAxhGBfbZYKM2O9hbO2D85VsXyM2WXu8q13+8iCr6Un6yaKIu+x06KjY6bFHMpIlHikuqPYaVz8SBBWUKMcouZi5NOR4+/Pymx7yVYsHc/ujkTalq1eXAACzejB6A83Mz1uhpLrZ2DJBtdFXmTVs/qCPg0SsBCzC5y/MA/EhC+Ab3Sn+ftxysJTYVAEAL0Homb0wuwHmb0l/U89Rzjg7Rj7+4pVp3DGvw6pWACdiYPBfgWdPMr7FCf3O7w0ly9lVxizGFGsn8WUPbEnjpOZibX4nQHZsAGJ4KHN6VGHnrYVBg1eVJgXR9/MPLc0hb59DcBe97Rxt52LlogA0YQSwAhltGL09FU2sfeftwPZci8I1sfWEmocOOVFz1tPt3FTQQyNIjARswQpYAGD4oPQRDRm5+DenudXCJy3p2BnkybQIprbL5GCVdPXZBFpcgDiKG0QDvIhxuHDyKJH8vv0uOnW1WpAPBqh9OJcu+O0mgPVthE+WBLMjUIwEjsBrgStXqXXRXpG9gkGzYz7dQ/fiJKPLST2Nd7GcrWl3P3g9vvFdFcPDwNwEjsBrgN/ZXGPh3F14ljc09iqIWPjyObMxMdNF10KF7ucFz/roq6cO1ph4qu8G9SPMzsBrgJNcs4X+MDbe7yZ6iBkUxKfHhZMeLs4gxYMhyLa1s85m/3oIA+CoF7m8CVgNuBPwVtGF/NRlQGHbTokaT3S+n+Bz2z1Qoz1HI5p0ucliAlQ5pY4gckVIdzrinLsorPWFMMNn76sNkjDnQR9xXtId5EvVbiZ6neXgZDbAacdfDCtTmnXT+bf5TrSwbrKh3X0kh0RG+7xXG1NzpFpISFy7IYOflkvI75LrIeoC2nkgZRyBTSwJWI7vY0iJg58f1pFnGOGBWFAwLsYQT97rlnt6Yo3QrOvC362LkQlto87VlnjyixCKFwCoYHiJ1ikXwYuR/Kq4YmJkVlZZoVZTFCM7Q7enXv78ku4ihTbStNRlxZWkxqfNuYFd8/Y+VZFDGwI8eH0rOXLYJP3a9RrdCspb2jlhrAPHC9guKix/azKaHi4PZqaq9I8BqxP2shahzGcKLUVbbLvuSMQf//JnnCJg5zSwK9gZ1/6zYUkawJvCk8/T4CB2WLp7IQ+6iAVYDLqNdJRwPdzv6NR/S05J8hzc8HJlvnpddC8TUgicFuqhJwGrAzbsapi0H6jyOcmp405I87996+h1k5bYyUn+rW40YgVbwjhxU5x0BVgPCDHhb+1e1jRwuUe/FgHzM43luCxicBGt2XlScGnK6waMCnXgTsNIh7TjJw3DPi1HNQypKkxRjJma3/XP93kryxXn/wzhy9lUT6MaTgNWAABLEVCgx5B27TqobtW8HjyYPDWfcL2kdKd56QifoppSAEVgNiJZBAIkcwz0vxhU5EsU6tmC9f/y6cLJSZFBB8PbhK6TZJu8dAUZgFQwPRMvIyccb5PViiMnB/H0kwUpgRW3K0z4txGSjDLrt+0TeB8YwCoCb2u3rES0jJfDTr/i8GFL8MC1hWChZUVL8POXHS/8jSQZsCH8CgQD4udeLLiE0SIrDX2ea1RxEnt9WrmhFSbXPUy43pIGNxXq5bGnqdciVEhxLz7L+pNP0+MhrRWltJz46TJIVMV6scsj1QEsqPlpmg6eeVbIcjrTntpbJ2s6M9n7kAdSDgiPo427OfKYHnUptSU+/7zLxPM7Cj6bE9NGz6fcYMctjIkPJQnoObe+2E1vXAOmlF9jSM55xDX8eYQ0SQG5emUTm0UVRLB092/KbghNVZ1idRw+j8PT+Z+r1vEFkDd2PHAFs83/+wTT3tl1zmBUiwq2zV8FBxYhHcA4MwOKtoseQRiVuzBHhNjvOsoh2v88I8BYwEv/T/dX54ec3sjOz/3LIWz8fwCBAOB8CQxImmxK8Gf4f/iM6b+krRc+L6Srbg//Yu7RmpEbfiYFBGaLyFmQeknR6+cxhd0EI56PLuvS1gDvxCHiGrtBZThXRIc0YCj+r6kc4X1iw4Wc0pCiYlY/EHGBLLralrcgqko2MkR3SDNiDFFzKBZgBfxDCh2WHNAPKcoTzIcINQV80NlLVy2Iy9Mqxz2LrkVqNpdpRBRhCsGUhws3ucDyJyHQpwcNZDgvqeGnrYrF9Vqldv3oJQV+IgxI7cCg1rKUeB4H78pGHt7KIg0Jo0HB+xnOxvuO3z2YV7fRuW+1/v3rYu7E9b6TPjAw3bnzgP9TyBo7/2j/FG6Cf4hmH7VO8/wJSjxTWAm8L8gAAAABJRU5ErkJggg==",wh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAQcklEQVR4Ac07C3BUVZb33vfp7nQSgiEhYYYgESEj40oZjERH/MxAnFEGQQYUZILRGix1y3V3q3bZqd2trZpZqram1rJ2tMZZiUGFAURQ4romiALjmlkFB2eGEVyMEAQSEiSQ9O+9fvfuOfe923Q66aQ7dDS3q/vcd9+553fPOffzXlMyxqX4hc1Vls9p4Iao5nm8Mp5HSoSfmsIUGjcJRfbMIoJa1CFRbhlh2k3CrJ3F6EG/rTWee3DlkbEUUQqQawYTX3ppVTxInoxN4rPjVxAfAf0kDwG/WEM4RKGUEiEEQYgF0ITxJY2ZPfSwHiJPnV+9etMQ3S6rKWcGmPTcq+XWxOhzVhlfGJ8oQGkoSlnFJcUAAlSk8EHoort1bPMaXGN5lzoao5O1muf9a3vW3nvGRbq8XyXaqKlMebG5IpTXtzF6JZ/PfYINSyjFADDUoCA0eiN+SVvXINIuKKF3qQzKLMr9x9n+YLig/vSPF3UMy3OEm6M2ALgqLd6y5fnwVXyNCJChFZcKU2GcoyGtlx6FuD7MYuQDjemHhNC7mLggR5HTCeWUxic7JD6HG6QGDDmbTxSzrCtEELRPKyOLEB74jDWdu+++hyFslJlGUHng7bTEB6INvPrGC6/O65tmt1iTeKGKWxfDGy7OhL+Tduq9ZLMZ9j19uuGekwMpZHY1pfG1qVZe7Il4EV8ZLSNlYGZgIK3qEXDrZje5GOgw67oevPd3mVG+hJW1AUpf3vpI+GrxjAOj7qmrIpZQhwr/CdbG+sz67tWLj11ic/m1kpden8ELrI2RabyWaIO9QkNv+D/9sbMPLPtVNtyyMsDkra809s8iawjjXj9lAhjxk+TTYLdY1bFm+cFsBMgWt6JpW3WomG6KVpCZhCg5XCqUMBE8Qpq6VvyoIVO6GRmg+oAwvji9sy00zalWKrsMBPF1sW69kzzU9eNlzZkyzQXelM2vLbImORtik3mJoqeCw39CO1gxZUntwbnUVvfSwRENgMp39OzoiJWJsgFZG5JO8BjdfWbpkrp0xL+K9sk7drZEruILYDZxZ0/PCj7IQRXFSytGMsLQ2TtJ8tOnX2+zy2kZo5CBgAdCZjNR8Alb/3Urj2J2wQAUHNHWs7gGczBmSfxlxC6jZadA9iRVhqwOa4CpW3c1RqeRalRcKg+E9X5m5x81lp1acc9Ph6T4NTSiLPlH2TI9BEMDJlDyxipI9dStzY3DiZQ2BK78TfMjfVXiWYHUvKKHme1v1+Z0PPCDP6u28QQrXn7zmmilcyieB6sJKFJwUAA85NHj99815OwwpAfM2PLmvHCleAbmeHR86VK6o4n8z/X7xqvyqDDKhjKirDIc0HOhhKc7z6BOiJNaBhkAV3jhUtEiTMZcV5ImEAXt+vr2Vd/fkUpgvF2jjCgrGEAagaED+xiTOmGiTCmDGiq3v7khdBVpkHjeOj3vBG39/J7v5yTbz9y2pyZO4/cIH68RGisV1PEJjerUZr3MEqepTd+JGUUvnlp647kUWbO6nL7rv1vC3+QLZRzgzAAl2E4b25f94CH3yv0dYICq37Rd2VfZ+5ljgNdjQeP10O4TC+4sddFH94tTae/J1v+0J4il9kRRgHbFkroXSuyLOBG+bnbcd8H4+6Mr7tjmYmf/O233W2djk0SJUpLGCJ/YUTD98PLvdChqA0IgHux/QRiUuRMJ/moi0E0HWEx1zBRevW33yp7w7guRaaTeLiIFFBwTJ2z5wRjFD0L4qqkWJKDWZDK972p7y1Vv7P4thmWm/JLxUHYIBJnHZS6HsI75IxuTcRKEv/Xq/vL+qdEvhA7B42H4z7Kjn935varkDtnUZ2/f+9cXKuxfEH1oBbw1S2K3m0obhUOcwBn6x2N3LfiL1PuZXF/91ttHwiV8lsJlccLzv/B/85N755/BtoQHCM1+juhgepnzYfS5JvIuslWqY7Zw1ta9t/dNc35BNfR0dy7BnS3W5Q4XR9yrJzzOa8PEJZOXB2EneO23tu/5WbYyIL4fdGACZgVcwCE/g8El6OqVhAGsK8hC5YoI8zq1tj8uv2NUGxt0WV4qXgd+lKEFgB5+UQAFk+uJ+x4u9pFf7IF1+MRK2d8oobOBqAPqInl44WaDroqGNMC1r7y3igeZLyEc7OeDjlmvkLKF1726/x/sQoz3S/GtaCPUYESCZ/S2CZ/7/nLSZ+bcwuPaT/292peEo0uC4wNMrmMbDwr/ddvfW56tLIjvt7QHkSfSQWM6Qeq79pV90rt1RIDT2ielc4KzYsz5e1nnR4tvGvV+PjaBPCGVl2kes72XaoA4A+MWHGf1Hy+/5SXk7RX0tH+dtWffWasIsrbKTIAv6ygUFJg6lwDIelb4eOktn1a17uu0ilm5O9OAQfPok0Brk/SAeFDMxpjDDI3QF9ZfRoajKTVv/2+xU0QnSWvLpQjGM9JF21OS36ntTFE+wSZw3vgXxFOeI3uAPAjx42gkkcwSnTKs+EJsM+YepIPQBp2xK6vefqDKKdB8ig06qBHW/yNDuoPQ7Ivxh3HIL9FT4sOkaml81qKb07qxYeu70BM176PqCGVd6P2DGGbYYEZ9T+O0rsKAg86oOxOG1QCjLnMk+r+vn4U+vL/mZIZ0B6E5wfxfFp7QH8w/pW0PnGPHjQizlQK+C/TYKxQegKQpIo/f7I4QIKD7w0gpKHMHZ6fSdB2xGXUy+2kIB0Z6GAdgOA260Fk1k5GPvAQxI9rREakNg/CHuutCcLvJ+0rM2uYDVZbD7xe287FsSPNj+cXPpHAw3ljQj2BGkRCMKLSY9m9pumbUjLo5QQ6nWi59WPNU67DyqyTczTJyrozTP2VELQuktkVz8fHWPw/XZe6uD/89VMwrKYehUVkQvQCFBeg/T08eWHbD74ejMdI9nWuHIQNUKzyui0omfLRERSlaH7aSHyqErwreuPPAP0ZK+V8BfxmK0k1lunIj1rA1J9hv/PBy5dFs9gHqqkKSmFqJDkskHzapAiIcUvWvAtb810cbw6V8NSjtPtrA0XcdUoYkCCzyusnj7y29ftjwyURWqZsAD1PIBjV1ouHy1ysQb36f2aUuxxLiarHmrY/ejxTzeaiwikulPPLW4owHv6SPv7/4+iFPc7KVD3ULEczBrsaCMU2nGuiPqwNsBuubNC43CbJhDH/mtfz+gFVMr8cHWirmVcJDqEdppKBPq9t393W/zZUYqFtykoVzCKpj4kOGsiiYK45p6Nz8xh/+KTTRcZXH0fDYq4QX6NU+KY36bty1uKovDYlRN8NaAAzudsddtq7B4yzHSwIogBXVy+H2qJfBmUhm5Yu/w5GQkqDRPYnAE/D8YdP/3HXt6kzoZIuDulEShwnV7QkPuCAK4hT0dz/SPQxtcraEs8G/tfmTRTzA8uQuD4yQgFDP+5K1jJXyKCMF3dwlPww18NMc5jDmUAsb5VeGA5+TjUJZ4zJxp4x7GAU5JXnQtDWrvG723VnTy6KDcPgceeokp0IIhjixdCPOuh2Bz+HBQvDljN6QBc2sUSHpTlErT+yssr8ZoYeGWyZnzWiIDtSgNW4SdG/qFu1msPBp12Dk8St3gxr99hB9c9hE8y+FnAo95K3hEnpMC+yEZrte5+qqC61d17h2kApxB3LG0eAmHfWWMxPpNc4+CPSTShcXfQ4zEmRjTrN+uSETfsk43NRmUbkQcqcBqfvC5s+r+kvif5ZPVyU2FfkX6bTWuhmj3hEmMx0v9YUtx6b2F/ATcpTdmUfk9xjXsNZF04+YMRZTbgnOAZMRe2K8CJ4rOVAn1E3paVoshrrLIzHDZocdgyd2SY5JVgLjv80Vc0Xn7uaeb0Ty+xJr+ksB4GIELO3h5rqK1xR+LiHqJDdZEHH4cp5hk8NIH3aHcAji6E956UhOTXaAlv3w3ZMz8F4uC2fRYNwniuM+Ir+2V0eIXzgLxUVYzgvqYvnhHQdQ3D0Wg2M/x3wKGUkDvFE3dZNhURkGOE3gCVGc8425lqQACMqZBgRBYSQvD8qFiStOrtkSC3RJuD8EAaw5YqgzMpIGwIrfYq3JAsX8tPaultOJsECcyy4+d/GT7sEIYdpls0glgDrYAVarpj+EvhhtVXgJA5j+wFo4O4fXrnBssBmSoc6llRRyLiCuAlUiSoW5oJ9KQ+qAp2rg2cgbpmFu8sBahZcwwI75JWf8UbbftZTrnpaPzry35dQihXz50Jd40qP4KIgCqofSl8/HpYCyW342UxkaBxZ13HFnSWLLnzAAdvH7J9aDD3DVAb0garINuRII0q2Me3c0UBzwNsw53ifXISBlT4w+GJhrHHVM1sddEiW1LNl9dkPY7zRgEwSBPCvIg/yw87uT65LQRl39kRBpAz2Xe4Ele7paIj6ReAaIAgcirHHngtKHkoUfZAA8qlq8r7vX1gS8BwyzBsQNPOEUeRG2fvv3Jo2bN8OSlUitL3u75+chP193aXULD4UdevH1W0uKcJmXjD8gBPAGIgRsrQ4e6cN7GuieYAU4R4yYfN2Kd3qWJncej3WUMWqKdTiVQyaTwQWvFnPUKVV5lH+QAbBx64Li3wUd/TGNum9byVgFN4jpbMuqt/uuQZzxWFA2lBFHEZWXD9YpE/mO+RjqNJTMQxoAEbfcfsWvIPabXC9w05QD/2CJmM6h8egJK945vzRsxA/BatJQSRZlRx223F6U9lR5UA5ItdLydy8ciGnePgGxMSdAbsxztPWbbyscFzlh5d6LPw8zZx2Kliw//IHl4LZbJ8xNbkutp/UAhVh0W2Gtj7NOdClpWeQB8RXWxLqVe/taFN7XBVEGlAWHRYYqyIfQz7XOovmFtSPJNcBi6ZB/IoTRv7+/LUrEwKUxuILBRXfAMR9q+q6/OV3/sWhfs+fioohGNsCj5xJFHyMfj/gDVDsYvCWv9tc0B6/LK+IIH9jb3xhjdA3HA3VZcEYBzwC+JiefGpyu2nhHcFTvFbn0Rv6tfydU7TC6KcbETJyyB/TA0OS06cXbgg0D2oe5GEhgGER1a827oUcijDwjX+fBcPCOtLz7wk9oW4Hhr3/2JprTZwuPvi9m9NmRjVFCwK09xV37SxEglnlAkMeabg+mTXhKh2SYtQGw88PvWfMijtNiC1KYbADwBLlwwreMDSE6dUI3BwK+p5+toaM6Xnv0AzE1EoE/TRGyEly9LHXE0d3R7eFU52JA0+qe/4455FSXrHBqfVQGQCIoTMN+6/kYERASQ68nJDNYWIEhQhoRR+H57580h3zo9xuHoE9XXpDITUk4RMpjlEymUXsOvAd0A4TYtx1CZ8UJHNenunmSBvBUk8PuoqlxvvnV/m0uSQbyxGFR0X8uvjFGyHzO4eB5mKJGDKEsKRGEM436N+lQZJTHg4fhHwL2Fxbr9U/Pph1D4WbaNmoPSGXwk/2inAvnOYuLhfAA2of3lcCeuoMzhooZhLIDYKo2t2XArw7vSxqEtsLjtLW/nk+l9wxAGMVFzgyQzPvRNrHKtvmTNiezwZV96dx4JAPBcgPCR8R0Sg6bJnvq2Vqa+wOaZMHHov74+6LKiZMGSGTVEPeV4P0lkMNNgBrMJHIAIG7gRRV4c0EQS6OkG1rbIbEd1HTS+Mub6JGxkEvR/H/1GixGG+ou8QAAAABJRU5ErkJggg==";function Gr({src:e,alt:t,className:r,style:n,showWarn:i,...o}){const[s,a]=ne.useState(wh),c=u=>{a(wh)};return ne.useEffect(()=>{a(e||wh)},[e]),w.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[w.jsx("img",{src:s,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...o}),i&&w.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:nO})]})}function iO({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:o}=e,{getExplorerUrl:s}=ms(),a=ne.useMemo(()=>{if(n&&r)return n(r)},[r]),c=ne.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return w.jsxs("div",{className:"cs-toast",children:[w.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[w.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&w.jsx("div",{children:w.jsx(rO,{})}),w.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&w.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&w.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&w.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&w.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&w.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&w.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&w.jsx(X1,{text:"Confirmation is in progress. Check your transaction on here",keywords:["here"],text_highlight_color:"#72c1f7",onKeywordClick:()=>{window.open(s(i,"tx"),"_blank")}})]}),r==="rejected"&&w.jsxs(w.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&w.jsx("span",{children:"Something went wrong"})]}),r==="success"&&w.jsx(w.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),tu.map(u=>w.jsx("a",{href:s(i,"tx",u.link),target:"_blank",children:w.jsx(Gr,{src:u.img})},u.link))]})]}),w.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(o),children:w.jsx("use",{xlinkHref:"#icon-close"})})]})}const oO=Ai((e,t)=>({toasts:[],setToasts:r=>{e(n=>({toasts:[...n.toasts,r]})),setTimeout(()=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r.id)}))},3e3)},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}))}})),Rs=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=oO(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},o=a=>{const c=Date.now();return a.id=c,r(a),c},s=ne.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),$n.createPortal(w.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>w.jsx(iO,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:o,ToastContainer:s,removeToast:n}},WL="";function sO(){const{mevProtect:e,setMevProtect:t}=Fr();return w.jsxs(gn.Root,{children:[w.jsx(gn.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:w.jsx("use",{xlinkHref:"#icon-mev"})})})}),w.jsx(gn.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:w.jsxs("div",{className:"mev-settings-box",children:[w.jsxs("div",{className:"mev-setting-title",children:[w.jsxs("div",{className:"name",children:[w.jsx("img",{src:It("/images/icon_mev@2x.png")}),w.jsx("span",{children:"MEV Protect"})]}),w.jsx(Jy,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),w.jsx("p",{className:"mev-tips",children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."})]})})]})}function aO({onClick:e}){const[t,r]=ne.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return w.jsx("div",{className:"refresh-button",children:w.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:w.jsx("use",{xlinkHref:"#icon-refresh"})})})}const GL="",KL="";function bh(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,o=()=>{r&&r()};return w.jsx(sb,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:o,children:t})}function cO(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Fr();return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsxs("span",{children:[r,"%"]})]}),t&&w.jsx(uO,{onClose:()=>e(!1)})]})}function uO({onClose:e}){const{slippage:t,setSlippage:r}=Fr(),[n,i]=ne.useState(t),o=u=>{i(u.display)},s=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=ne.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),w.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:w.jsxs("div",{className:"slippage-settings",children:[w.jsxs("div",{className:"slippage-settings-header",children:[w.jsx("div",{className:"title",children:"Slippage Settings"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsx("span",{children:"Slippage Tolerance"})]}),w.jsxs("div",{className:"form-box",children:[w.jsx("div",{className:"slippage-tab-list",children:RA.map(u=>w.jsxs("span",{className:u.display===n?"active":"",onClick:()=>o(u),children:[u.display," %"]}))}),w.jsxs("div",{className:"input-box",children:[w.jsx("span",{children:"Custom"}),w.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:s}),w.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&w.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&w.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&w.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),w.jsx(bh,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function lO({handleRefresh:e}){return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"swap-header",children:[w.jsx("h3",{className:"swap-title",children:"Swap"}),w.jsxs("div",{className:"right",children:[w.jsx(cO,{}),w.jsx(sO,{}),w.jsx(aO,{onClick:e})]})]})})}const YL="",ZL="";function fO(){const[e,t]=ne.useState(!1);return w.jsxs(gn.Root,{open:e,onOpenChange:t,children:[w.jsx(gn.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})})})}),w.jsx(gn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:w.jsxs("div",{className:"cs-settings-box",children:[w.jsx("h3",{children:"Settings"}),w.jsx(dO,{}),w.jsx(pO,{onClose:()=>{t(!1)}})]})})]})}function dO(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Fr(),i=o=>{t(o)};return w.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-plorer"})}),w.jsx("span",{children:"Preferred Explorer"})]}),w.jsx("div",{className:"explorer-checkbox-group",children:tu.map(o=>w.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(o.link),children:[w.jsx(Su,{color:"indigo",checked:o.link===e,variant:"soft",className:"cs-checkbox"}),w.jsx("img",{src:o.img}),w.jsx("span",{children:o.name})]}))})]})}const hO=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function pO({onClose:e}){const{addTxToast:t}=Rs(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:o,rpcList:s}=Fr(),[a,c]=ne.useState(i),[u,l]=ne.useState(r),d=y=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${y}`})})},p=y=>{l(y),y.isCustom||(n(y),d(y.link),e())},b=y=>{c(y.target.value)},x=()=>{if(a){const y={name:"Custom RPC URL",link:a,isCustom:!0};o(a),n(y),d(a),e()}};return w.jsxs("div",{className:"settings-card rpc-settings-card",children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})}),w.jsx("span",{children:"RPC Node"})]}),w.jsxs("div",{className:"rpc-checkbox-group",children:[s.map(y=>w.jsxs("div",{className:"rpc-item",onClick:()=>p(y),children:[w.jsx(Su,{color:"indigo",checked:u.name===y.name,variant:"soft",className:"cs-checkbox"}),w.jsx("span",{children:y.name})]})),u.isCustom&&w.jsxs("div",{className:"custom-rpc-input-box",children:[w.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:b,value:a}),w.jsx(bh,{btnIsDisabled:hO(a),text:"Save",onClick:x})]})]})]})}const XL="",nn=Ai((e,t)=>({accounts:[],currentAccount:void 0,isOpenWalletModal:!1,saveCurrentAccount:r=>{e({currentAccount:r})},saveAccounts:r=>{e({accounts:r})},onWalletModal:r=>{e({isOpenWalletModal:r})},isOpenAccountList:!1,setIsOpenAccountList:r=>{e(()=>({isOpenAccountList:r}))},tokenBalanceObj:{},setTokenBalanceObj:r=>{e(()=>({tokenBalanceObj:r}))}}));var mO=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},gO=mO,ab={"text/plain":"Text","text/html":"Url",default:"Text"},vO="Copy to clipboard: #{key}, Enter";function yO(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function wO(e,t){var r,n,i,o,s,a,c=!1;t||(t={}),r=t.debug||!1;try{i=gO(),o=document.createRange(),s=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=ab[t.format]||ab.default;window.clipboardData.setData(d,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),o.selectNodeContents(a),s.addRange(o);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(d){r&&console.error("unable to copy using clipboardData: ",d),r&&console.error("falling back to prompt"),n=yO("message"in t?t.message:vO),window.prompt(n,e)}}finally{s&&(typeof s.removeRange=="function"?s.removeRange(o):s.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var bO=wO;const cb=Us(bO);function xO({currentAccount:e}){const{mutate:t}=Vr.useSwitchAccount(),r=Vr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=nn(),o=()=>{i(!n)};ne.useEffect(()=>()=>{i(!1)},[]);const s=ne.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);ne.useEffect(()=>{},[s]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return w.jsxs("div",{className:"cs-account-switch",children:[w.jsxs("div",{className:"account",onClick:o,children:[w.jsx("span",{children:No(e)}),(s==null?void 0:s.length)>0&&w.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})})]}),w.jsx("div",{className:`account-list ${n?"open":"close"}`,children:s.map(c=>w.jsxs("div",{className:"account-item",children:[w.jsxs("div",{className:"left",children:[w.jsx("div",{className:"label",children:c==null?void 0:c.label}),w.jsx("div",{className:"address",children:No(c==null?void 0:c.address)})]}),w.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const SO=ne.forwardRef(({connect:e})=>{const t=Vr.useCurrentAccount();return w.jsx("div",{children:t?w.jsx(EO,{}):w.jsx(bh,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function EO(){const{mutate:e}=Vr.useDisconnectWallet(),t=Vr.useCurrentAccount(),{currentWallet:r}=Vr.useCurrentWallet(),{addCommonToast:n}=Rs(),{getExplorerUrl:i}=ms(),o=()=>{t&&(cb(t.address||"",{debug:!1,message:"message"}),n("Copied"))},s=()=>{t&&window.open(i(t.address,"account"),"_blank")};return ne.useEffect(()=>{},[r]),w.jsxs(gn.Root,{children:[w.jsx(gn.Trigger,{children:w.jsxs("div",{className:"cs-connected-button",children:[w.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),w.jsx("span",{children:No(t==null?void 0:t.address)})]})}),w.jsx(gn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:w.jsxs("div",{className:"account-op-box",children:[w.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),w.jsx(xO,{currentAccount:t==null?void 0:t.address}),w.jsxs("div",{className:"account-op-item",onClick:o,style:{marginTop:"12px"},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-copy"})}),w.jsx("span",{children:"Copy address"})]}),w.jsxs("div",{className:"account-op-item",onClick:s,children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-link"})}),w.jsx("span",{children:"Open explorer"})]}),w.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-disconnect"})}),w.jsx("span",{children:"Disconnect"})]})]})})]})}function _O(){Vr.useCurrentAccount(),Vr.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=nn();return Vr.useWallets(),w.jsx(w.Fragment,{children:w.jsx(Vr.ConnectModal,{trigger:w.jsx(SO,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function CO({independentWallet:e,customWallet:t}){return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"widget-header",children:[w.jsx("img",{src:It("/images/logo@2x.png"),className:"cetus-logo"}),w.jsxs("div",{className:"right",children:[e&&w.jsx(_O,{}),w.jsx(fO,{})]})]}),w.jsx("div",{style:{marginTop:"20px"}})]})}const JL="",ub=()=>{const e=ne.useRef(null);ne.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return w.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:w.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>w.jsx("div",{style:t(i),children:w.jsx("div",{style:r})},i))})})};function AO({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,o=ne.useMemo(()=>{if(n&&r)return n(r)},[r]);return w.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&w.jsx(MO,{info:o,status:r}),(r==="success"||r==="rejected")&&w.jsx(TO,{info:o,status:r,tx:i,onClose:e})]})}function MO({info:e,status:t}){return w.jsxs("div",{className:"progress-dialog",children:[w.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),w.jsx("div",{className:"loading-box",children:w.jsx(ub,{})}),w.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),w.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function TO({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=ms();return w.jsxs("div",{className:"finally-status-dialog",children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[w.jsx("div",{className:"status-icon-box",children:w.jsx("div",{className:"status-icon",children:w.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?w.jsx("use",{xlinkHref:"#icon-sel"}):w.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?w.jsx("span",{children:"Swap Success"}):w.jsx("span",{children:"Swap failed"})]}),w.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),tu.map(o=>w.jsx("a",{href:i(r,"tx",o.link),target:"_blank",children:w.jsx("img",{src:o.img})},o.link))]})]}),w.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Lu(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await IA(`${i||ps.api}${t}`,n):await OA(`${i||ps.api}${t}`,n)}catch(o){throw o}}}}function IO(){const{fetchByApi:e}=Lu(),{setProviders:t}=Fr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function OO({interval:e,callback:t}){const r=ne.useRef(),n=ne.useRef(null);ne.useEffect(()=>{r.current=t},[t]);const i=ne.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),o=ne.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return ne.useEffect(()=>(i(),()=>o()),[]),{startTimer:i,stopTimer:o}}const lb=Ai((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[jr(i).full_address]}),e({coinPriceObj:{...n}})}}));function $o(){const{fetchByApi:e}=Lu(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=lb(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>Ei(l,!1))})).prices;if(u){const l={};u.forEach(d=>{l[jr(d.base_symbol).full_address]=d}),r(l)}return u}catch{return n(a),null}},o=ne.useCallback(a=>{if(!a)return;const c=t[jr(a).full_address];if(c)return c},[t]),s=ne.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const d=o(a);if(d)return Le(c).mul(d.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:o,getTokenAmountValue:s}}function PO(){const{tokenBalanceObj:e}=nn(),{fetchTokenPrices:t}=$o();ne.useEffect(()=>{if(V1(e)){const r=Object.keys(e);t(r)}},[V1(e)])}const Fo=Ai((e,t)=>({suiClient:new ts({url:ps.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new g1({signer:ps.simulationAccount,client:new ts({url:ps.fullRpcUrl}),env:dd.Mainnet}),setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),Ns=Ai((e,t)=>({tokenMapIsInit:!1,requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),o=jr(r.coin_type).full_address;if(!n.has(o)){const s=new Map(n);s.set(o,r);const a=i.filter(c=>c!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...a]})),Ci.setItem(bd,s)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||Ci.setItem(bd,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Ci.setItem(z1,r)}}));Ci.getItem(bd).then(e=>{e!==null&&Ns.getState().setTokenMap(e,!0)}),Ci.getItem(z1).then(e=>{e!==null&&Ns.getState().setTrustedTokenList(e,!0)});function RO(e,t){return{id:e.id||void 0,logo_url:e.iconUrl||void 0,coin_type:t,decimals:e.decimals,description:e.description,name:e.name,symbol:e.symbol}}function oo(){const{suiClient:e}=Fo(),{fetchByApi:t}=Lu(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:o,addRequestTokenList:s,setTrustedTokenList:a}=Ns(),c=async()=>{var x;const d=await t("/v2/sui/coins_info","GET"),p=[],b=(x=d==null?void 0:d.list)==null?void 0:x.reduce((y,T)=>(y.set(T.coin_type,T),T.is_trusted&&p.push({...T,coin_type:jr(T.coin_type).full_address}),y),new Map);b&&(b.set("0x2::sui::SUI",{...b.get("0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"),coin_type:"0x2::sui::SUI"}),r(b),a(p))},u=async d=>{try{const p=l(d);if(p)return p;if(o.includes(d))return;s(d);const b=await e.getCoinMetadata({coinType:d});if(b){b1(d)&&(b.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const x=RO(b,d);return i(x),x}}catch{}},l=ne.useCallback(d=>{if(d)return n.get(jr(d).full_address)||n.get(d)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function $u(e){const{suiClient:t}=Fo(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=nn(),{fetchTokenInfo:o}=oo(),[s,a]=ne.useState([]),{tokenMap:c}=Ns(),u=async(b=(r==null?void 0:r.address)||"",x)=>{try{if(!b){l();return}let y=[];x?y=[await t.getBalance({owner:b,coinType:x})]:y=[...await t.getAllBalances({owner:b})],a(y)}catch{a([])}},l=()=>{n({})};ne.useEffect(()=>{(s==null?void 0:s.length)>0&&(c!=null&&c.size)&&d(s)},[s,c]);const d=async b=>{const x={};for(let y=0;y<(b==null?void 0:b.length);y++)try{const T=b[y],O=await o(T.coinType),N=EA(T.totalBalance,O==null?void 0:O.decimals),k=Dr(N,4);x[jr(T.coinType).full_address]={...T,displayBalance:k,totalBalanceFormat:N}}catch{continue}n(x)},p=ne.useMemo(()=>{if(e&&r)return i[e]||i[jr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:p}}const vn=Ai((e,t)=>({isOpenTokensDialog:!1,defaultFromCoinType:void 0,defaultToCoinCoinType:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoinType:r,defaultToCoinCoinType:n}))},setFromCoin:r=>{e(()=>({fromCoin:r}))},setToCoin:r=>{e(()=>({toCoin:r}))},setFromAmount:r=>{e(()=>({fromAmount:r}))},setToAmount:r=>{e(()=>({toAmount:r}))},setRouterData:r=>{e(()=>({routerData:r}))},setFindRouterLoading:r=>{e(()=>({findRouterLoading:r}))},setByAmountIn:r=>{e(()=>({byAmountIn:r}))},setIsOpenSecondary:r=>{e(()=>({isOpenSecondary:r}))},setIsOpenTokensDialog:r=>{e(()=>({isOpenTokensDialog:r}))}})),NO={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},fb={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},db=NO;function jO(e,t){const{fetchTokenInfo:r}=oo(),{setFromCoin:n,setToCoin:i,setDefaultCoin:o}=vn(),{setSlippage:s,setRpcList:a,setCurrentRpc:c}=Fr(),{tokenMapIsInit:u}=Ns(),l=ne.useRef({}),d=async(b,x)=>{const y=b?await r(b):fb,T=x?await r(x):db;n(y),i(T),o(y==null?void 0:y.coin_type,T==null?void 0:T.coin_type)},p=(b,x)=>{const y=[ru[0]];let T=ru[0];b.forEach(O=>{const N={name:O,link:O,isCustom:!1};y.push(N),O===x&&(T=N)}),a([...y,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(T)};return ne.useEffect(()=>{if(u&&!wd(e,l.current)){const{defaultFromToken:b,defaultToToken:x,defaultSlippage:y,customRpcList:T,defaultRpc:O}=e;d(b,x),y&&s(y),(T==null?void 0:T.length)>0&&p(T,O),l.current=e}},[e,u]),{handleSetDefaultPair:d}}function kO(){const{currentRpc:e}=Fr(),{setSuiClient:t,setAggregatorSDK:r}=Fo(),{currentAccount:n}=nn();ne.useEffect(()=>{if(e){const i=new ts({url:e.link});t(i)}},[e]),ne.useEffect(()=>{if(e){const i=new g1({endpoint:ps.aggregatorUrl,signer:(n==null?void 0:n.address)||"",client:new ts({url:e.link}),env:dd.Mainnet});r(i)}},[e.link,n==null?void 0:n.address])}const xh=Ai((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Ir=[];for(let e=0;e<256;++e)Ir.push((e+256).toString(16).slice(1));function DO(e,t=0){return(Ir[e[t+0]]+Ir[e[t+1]]+Ir[e[t+2]]+Ir[e[t+3]]+"-"+Ir[e[t+4]]+Ir[e[t+5]]+"-"+Ir[e[t+6]]+Ir[e[t+7]]+"-"+Ir[e[t+8]]+Ir[e[t+9]]+"-"+Ir[e[t+10]]+Ir[e[t+11]]+Ir[e[t+12]]+Ir[e[t+13]]+Ir[e[t+14]]+Ir[e[t+15]]).toLowerCase()}let Sh;const BO=new Uint8Array(16);function LO(){if(!Sh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Sh=crypto.getRandomValues.bind(crypto)}return Sh(BO)}const hb={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pb(e,t,r){var i;if(hb.randomUUID&&!t&&!e)return hb.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??LO();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return DO(n)}var Uo=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Uo||{});const $O=new ts({url:v0("mainnet")}),FO=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],UO=["deny_list","DenyList","DenyCap","create_regulated_currency"],VO={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},zO=async e=>{let t=!1;if(FO.includes(e))return t;const r=e.split("::"),n=r[0]&&jt(r[0]),i=r[1],o=await $O.getObject({id:n,options:VO}),s="disassembled"in o.data.content?o.data.content.disassembled[i]:null;return s&&typeof s=="string"&&new RegExp(UO.join("|"),"i").test(s)&&(t=!0),t},HO=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Ei(i,!1)))==null?void 0:n.join(",")};function qO(){const{fetchByApi:e}=Lu(),t=async n=>{try{const i={...n},o=HO(n==null?void 0:n.coin_type);o&&(i.coin_type=o);const s=await e("/v2/sui/stats_pools","GET",i);if(s!=null&&s.lp_list)return{list:(s==null?void 0:s.lp_list)||[],total:s==null?void 0:s.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,o,s,a;try{const c=It("/data/pools.json"),u=await fetch(c).then(l=>l.json());if((i=u==null?void 0:u.data)!=null&&i.lp_list){const l=(o=u==null?void 0:u.data)==null?void 0:o.lp_list;let d=l;if(n!=null&&n.coin_type){const b=(a=(s=n==null?void 0:n.coin_type)==null?void 0:s.split(","))==null?void 0:a.map(x=>Pn(x).source_address);d=l==null?void 0:l.filter(x=>{var O,N;const y=Pn((O=x==null?void 0:x.coin_a)==null?void 0:O.address).source_address,T=Pn((N=x==null?void 0:x.coin_b)==null?void 0:N.address).source_address;return(b==null?void 0:b.length)>1&&b.includes(y)&&b.includes(T)?!0:!!((b==null?void 0:b.length)===1&&(b.includes(y)||b.includes(T)))})}n!=null&&n.is_vaults&&(d=l==null?void 0:l.filter(b=>b==null?void 0:b.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(d=l==null?void 0:l.filter(b=>b==null?void 0:b.has_farming));const p=d;return{list:p,total:(p==null?void 0:p.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function WO(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Fr(),{getPoolList:n,getLocalJsonPoolList:i}=qO();return{getPoolListByCoinType:async(s,a)=>{if(s&&a){const c=[s,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const d={coin_type:`${s},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let p=e?await i(d):void 0;(p===void 0||p.list.length===0)&&(p=await n(d));const b=p.list;if(b.length>0)return t[u]=b,r(u,b),b}return[]}}}function GO(e){const{routerData:t}=vn();return{priceAcceptRouterData:ne.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Le(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Le(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function mb(e,t){return{amountLimit:ne.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:o}=t;return n?Le(o).mul(Le(1).sub(Le(e).div(100))).toString():Le(i).mul(Le(1).add(Le(e).div(100))).toString()}},[e,t])}}function KO(e){const{getTokenInfo:t,fetchTokenInfo:r}=oo();return{formatSwapRouter:ne.useMemo(()=>{if(e&&e.routerData){const i=[],o=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),s=[],a=[];let c=Le(0);if(e.routerData.routes.forEach((l,d)=>{const p={},b=e.byAmountIn?l.amountIn.toString():l.amountOut.toString();d===e.routerData.routes.length-1?p.percentage=Le(1).sub(c).toFixed(2):p.percentage=Le(b).div(o).toFixed(2),c=Le(c).add(p.percentage);const x=[];l.path.forEach(y=>{i.includes(y.provider)||i.push(y.provider);const T=jr(y.from).full_address,O=jr(y.target).full_address,N=t(T),k=t(O);N||a.includes(T)&&a.push(T),k||a.includes(O)&&a.push(O);const F=y.provider===ba.SCALLOP||y.provider===ba.FLOWX||y.provider===ba.FLOWXV3;x.push({from_type:T,to_type:O,pool_address:F?"":y.id,fee_rate:y.feeRate,provider:y.provider})}),p.paths=x,s.push(p)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:s}}},[e])}}function YO(){const{fromCoin:e,toCoin:t}=vn(),{getPoolListByCoinType:r}=WO();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(s=>s.address):[]}}function gb(e,t,r){return ne.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function vb(e){const[t,r]=ne.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await zO(i.coin_type)}catch{}return!1};return ne.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function ZO(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=vn(),{getTokenInfo:i}=oo(),{ignoreWarnTokenMap:o}=Fr(),s=i(e),a=i(t),c=ne.useMemo(()=>!Qc(r,fb.coin_type)||!Qc(n,db.coin_type),[r,n]),u=ne.useCallback(d=>d&&!o[Ei(d.coin_type)]&&(Qc(r,d.coin_type)||Qc(n,d.coin_type))?!d.is_trusted:!1,[r,n,o]),l=ne.useMemo(()=>{const d=[];return c&&(s&&u(s)&&d.push({...s}),a&&u(a)&&d.push({...a})),d},[s==null?void 0:s.coin_type,a==null?void 0:a.coin_type,c,o]);return{isCustomMode:c,customWarnTokenList:l}}function XO(){const{aggregatorSDK:e}=Fo(),{getSwapPoolAddress:t}=YO(),r=o=>o&&o.error?o.error.code===Uo.InsufficientLiquidity||Uo.HoneyPot||Uo.NumberTooLarge:!1,n=async o=>{const{fromToken:s,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:d}=o;try{const p={from:s.coin_type,target:a.coin_type,amount:new Vp(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},b=await e.findRouters(p);if(b&&r(b))return i(!1,l,d,s,a,b);if(!b||b.routes.length===0)throw Error("not find router");return i(!1,l,d,s,a,b)}catch{const b=await t(),x={from:s.coin_type,target:a.coin_type,amount:new Vp(c),byAmountIn:l,pools:b};try{const y=await e.swapInPools(x);return!y||!y.routeData?i(!0,l,d,s,a):i(!0,l,d,s,a,y.routeData)}catch{return{uuid:d,byAmountIn:l,isDegrade:!0}}}},i=(o,s,a,c,u,l)=>{var d;if(l){const p=l.error!==void 0,b=yd(l.amountIn.toString(),c.decimals).toString(),x=yd(l.amountOut.toString(),u.decimals).toString();return{routerData:p?void 0:l,fromAmountUi:p?s?b:"":b,toAmountUi:p&&s?"":x,uuid:a,byAmountIn:s,isDegrade:o,errorCode:(d=l.error)==null?void 0:d.code}}else return{uuid:a,byAmountIn:s,isDegrade:o}};return{findBestRouters:n}}function js(e){const t=ne.useRef(e);return ne.useEffect(()=>{t.current=e},[e]),t}function JO(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function QO(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function eP(e){return!!String(e).includes("Could not find the referenced transaction")}function tP(e){return JO(e)?"User rejected the request":QO(e)?"Exceeded price slippage":eP(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var Eh={},rP=_r&&_r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Eh,"__esModule",{value:!0});var nP=Eh.executeAuction=yb;const iP=rP(Cm),oP="https://rpc.getshio.com",sP=500,aP=300;function yb(e,t,r=sP){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,o)=>{setTimeout(i,r),iP.default.post(oP,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(s=>{console.log("Shio executeAuction response:",s.data),setTimeout(i,aP)}).catch(o)})}Eh.default={executeAuction:yb};function cP(){const{suiClient:e}=Fo(),{currentAccount:t}=nn(),{mutateAsync:r}=Vr.useSignTransaction(),{mutate:n}=Vr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await o(c,u)}),i=ne.useMemo(()=>t==null?void 0:t.chains[0],[t]),o=async(c,u,l=!1)=>{var p,b;if(l){const x=await e.devInspectTransactionBlock({transactionBlock:Eo.from(xr(c)),sender:t.address});if(!x||((p=x.effects)==null?void 0:p.status.status)==="failure")throw Error((b=x.effects)==null?void 0:b.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var d,p;let l;if(typeof c=="string"?l=Eo.from(c):l=c,u){const b=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!b||((d=b.effects)==null?void 0:d.status.status)==="failure")throw Error((p=b.effects)==null?void 0:p.status.error)}return l.setGasBudget(1e8),new Promise((b,x)=>{n({transaction:l,chain:i},{onSuccess:y=>{b(y)},onError:y=>{console.error("signAndExecuteTransactionBlock transaction failed",y),x(y)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Eo.from(c)),typeof c=="string"&&(c=Eo.from(xr(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:d=>{u(d)},onError:d=>{console.error("signTransactionBlock failed",d),l(d)},onSettled:(d,p,b,x)=>{console.error("signTransactionBlock onSettled",{data:d,error:p,variables:b})}})})),executeTransactionBlock:o}}function uP(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=cP(),{currentAccount:n}=nn(),{suiClient:i}=Fo(),{setTransactionData:o}=xh(),{addTxToast:s,removeToast:a}=Rs(),c=5,u=2e3;async function l(b,x=1){try{let y;try{y=await i.getTransactionBlock({digest:b,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{y=await i.getTransactionBlock({digest:b,options:{showEvents:!0,showEffects:!0}})}if(y)return y;throw new Error("Empty response")}catch(y){if(console.error(`Attempt ${x} failed:`,y),x>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await F1(u),l(b,x+1)}}const d=async(b,x,y={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:T=!1,useMev:O,txAction:N="signTransactionBlock"}=y;let k;x.status="confirmation",o(x);try{let W;if(N==="signTransactionBlock"){const G=await e(b),{bytes:re,signature:oe}=G;if(O)try{const ae=await nP(re,oe,500)}catch{}W=await t(re,oe,T)}else W=await r(b,T);x.status="submitted",o({...x}),x.tx=W.digest,k=s(x),await F1(u);const z=await l(W.digest,0);if(!z||((F=z.effects)==null?void 0:F.status.status)==="failure")p(x,(L=z.effects)==null?void 0:L.status.error);else{const G=TA(z,n==null?void 0:n.address,!1);if(x.buildShowInfo){const re=x.buildShowInfo("success",G);x.buildShowInfo=oe=>re}a(k),x.status="success",o({...x})}return z}catch(W){p(x,W)}},p=(b,x)=>{const y=tP(x);if(b.buildShowInfo){const T=b.buildShowInfo("confirmation");b.buildShowInfo=O=>(T.toastDescriptionContent=y,T.modalDescriptionText=y,T),b.status="rejected",o({...b})}else b.buildShowInfo=T=>{const O={};return O.toastDescriptionContent=y,O.modalDescriptionText=y,O},b.status="rejected",o({...b})};return{signAndExecuteTransaction:d}}function _h(e,t=1e3){const r=ne.useRef(),n=ne.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return ne.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function lP(){const{aggregatorSDK:e}=Fo(),{findBestRouters:t}=XO(),{getTokenAmountValue:r,fetchTokenPrices:n}=$o(),{providers:i,slippage:o,mevProtect:s}=Fr(),{signAndExecuteTransaction:a}=uP(),{setTransactionData:c}=xh(),{addTxToast:u}=Rs(),{fromCoin:l,toCoin:d,setFromCoin:p,setToCoin:b,setToAmount:x,fromAmount:y,toAmount:T,setFromAmount:O,setFindRouterLoading:N,setRouterData:k,setByAmountIn:F,byAmountIn:L}=vn(),[W,z]=ne.useState(""),G=js(W),re=js(L),oe=js(y),ae=js(T),H=js(l),D=js(d),{balanceInfo:h,getOwnerCoinBalances:f}=$u(l==null?void 0:l.coin_type),{balanceInfo:m}=$u(d==null?void 0:d.coin_type),S=r(l==null?void 0:l.coin_type,y),A=r(d==null?void 0:d.coin_type,T),I=_h(async(be,De,Ne)=>{if(H.current&&D.current&&+be){(+oe.current||+ae.current)&&N(!0);const ft=CA(be,De?H.current.decimals:D.current.decimals),dt=await t({fromToken:H.current,toToken:D.current,amount:ft.toString(),providersKeys:i,by_amount_in:De,uuid:Ne});N(!1),G.current===Ne&&(De?+oe.current?(x(dt.toAmountUi||""),k(dt)):x(""):+ae.current?(O(dt.fromAmountUi||"ß"),k(dt)):O(""))}else v(!De)},500),C=(be,De,Ne=!1)=>{if(F(De),De?(O(be),Ne&&x("")):(x(be),Ne&&O("")),+be){const ft=pb();z(ft),I(be,De,ft)}else N(!1),k(void 0),v(!De)},g=(be,De=!0)=>{v(),De?((be==null?void 0:be.coin_type)===(d==null?void 0:d.coin_type)&&b(l),p(be)):((be==null?void 0:be.coin_type)===(l==null?void 0:l.coin_type)&&p(d),b(be))},v=be=>{be===void 0?(O(""),x("")):be?O(""):x(""),N(!1),k(void 0)},R=()=>{const be=re.current?oe.current:ae.current;if(+be){const De=pb();z(De),I(be,re.current,De)}},J=async(be,De)=>{const{routerData:Ne,byAmountIn:ft,fromAmountUi:dt,toAmountUi:ke}=be,mt=new Eo,we={routers:Ne,slippage:Number(o)/100,txb:mt,partner:De||NA};try{await e.fastRouterSwap(we);const pe={status:"confirmation",buildShowInfo:(Ve,je)=>{const Ae=`Swap ${Dr(dt,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Dr(ke,d==null?void 0:d.decimals)} ${d==null?void 0:d.symbol}`,Te={modalDescriptionText:Ae,toastTitleText:Ae};if(Ve==="success"){let $e=dt,ct=ke;je&&($e=U1(je,l)||dt,ct=U1(je,d)||ke);const ut=`Swapped ${Dr($e,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Dr(ct,d==null?void 0:d.decimals)} ${d==null?void 0:d.symbol}`;Te.toastTitleText=ut,Te.modalDescriptionText=ut}return Te},id:0};c(pe),await a(mt,pe,{useMev:s})?(v(),f()):R()}catch(pe){String(pe).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Ce,Ve){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};ne.useEffect(()=>{Q(),v()},[l==null?void 0:l.coin_type,d==null?void 0:d.coin_type]);const Q=()=>{const be=[];l&&be.push(l.coin_type),d&&be.push(d.coin_type),be.length>0&&n(be)},{isScamsCoin:ue}=vb(l),{isScamsCoin:_e}=vb(d),de=ne.useMemo(()=>{if(!(!ue&&!_e)){if(ue&&_e)return`${l==null?void 0:l.symbol} and ${d==null?void 0:d.symbol} are`;if(ue)return`${l==null?void 0:l.symbol} token is `;if(_e)return`${d==null?void 0:d.symbol} token is `}},[ue,_e]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:h,toBalanceInfo:m,fromAmountValue:S,toAmountValue:A,doSwapAction:J,reCalculateRouteData:R,refreshMarketPrice:Q,scamsText:de}}function fP(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:o}=vn(),{currentAccount:s}=nn(),a=ne.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(s!=null&&s.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(o&&o.errorCode){if(o.errorCode===Uo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(o.errorCode===Uo.NoRouter||o.errorCode===Uo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${hn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[s==null?void 0:s.address,n,i,e,o==null?void 0:o.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function wb({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const o=50-parseFloat(t),s=2*Math.PI*o,a=s*i,c=s-a;return w.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[w.jsx("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:n,strokeWidth:t}),w.jsx("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),w.jsx("style",{children:`
94
94
  @keyframes dash {
95
95
  0% {
96
- stroke-dashoffset: 0; /* 从起点开始 */
96
+ stroke-dashoffset: 0;
97
97
  }
98
98
  100% {
99
- stroke-dashoffset: -${s}; /* 一圈 */
99
+ stroke-dashoffset: -${s};
100
100
  }
101
101
  }
102
- `})]})}function mh({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[o,s]=te.useState(!0),a=Ww(o,r,n);return x.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{s(!o)},children:[x.jsx(Wr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url}),x.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",cn(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?x.jsx(As,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):jr(a,t==null?void 0:t.decimals)," ",cn(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),x.jsx(Wr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url}),x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-swap"})})]})}function ju(){const[e,t]=te.useState(window.innerWidth),r=ph(()=>{t(window.innerWidth)},300);te.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=te.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function Zw(e,t,r,n){const{getTokenPrice:i}=Nu(),o=i(e==null?void 0:e.coin_type),s=i(t==null?void 0:t.coin_type),a=Ww(!0,r,n),c=te.useMemo(()=>{if(s&&o)return De(o.price).div(s.price).toString()},[o==null?void 0:o.price,s==null?void 0:s.price]),u=te.useMemo(()=>{if(c&&+a)return De(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const b=[];return o&&b.push(o.market),s&&!b.includes(s.market)&&b.push(s.market),b},[o==null?void 0:o.market,s==null?void 0:s.market]),d=te.useMemo(()=>u&&De(u).lt(0)?De(u).abs().gt(5):!1,[u]),p=te.useMemo(()=>u&&De(u).lt(0)?De(u).abs().gt(10):!1,[u]),w=te.useMemo(()=>{let b,y="yellow";if(u)if(De(u).gt(0))y="green",De(u).lt(.1)?b="< 0.1% cheaper than":b=`${jr(u,2,!0,Lr.ROUND_UP)}% cheaper than`;else if(De(u).eq(0))b="0%",y="green";else{const T=De(u).abs();T.lte(5)?(y="green",b=`Within ${jr(T.toString(),2,!0,Lr.ROUND_UP)}%`):T.lte(10)?(y="yellow",b=`${jr(T.toString(),2,!0,Lr.ROUND_UP)}% more than`):T.lte(100)?(y="red",b=`${jr(T.toString(),2,!0,Lr.ROUND_UP)}% more than`):(y="red",b="> 100% more than")}return{priceImpactText:b,textColor:y}},[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:d,showPriceImpactWarn:p,priceImpactTextInfo:w}}function ku({content:e,children:t,position:r="top",delay:n=0}){const[i,o]=te.useState(!1),[s,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),o(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{s||(o(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},d=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},p=te.useRef(null),[w,b]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var y;if(i&&p.current){const T=(y=p.current)==null?void 0:y.getBoundingClientRect();let O,R;r==="top"?(O=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.top-2*T.height-8}px`):r==="bottom"?(O=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.bottom}px`):r==="left"?(O=`${window.scrollX+T.left-8}px`,R=`${window.scrollY+T.top+T.height/2}px`):r==="right"?(O=`${window.scrollX+T.right+8}px`,R=`${window.scrollY+T.top+T.height/2}px`):(O=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.top+T.height/2}px`),b({left:O,top:R})}},[i]),x.jsxs("div",{ref:p,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&kn.createPortal(x.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:i?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...d(),...w},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),o(!1)},children:e}),document.body)]})}function Xw({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=ju();return i&&n?x.jsxs(fn.Root,{children:[x.jsx(fn.Trigger,{children:x.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),x.jsx(fn.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):x.jsx(ku,{content:e,position:r,children:t})}function Jw({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=dn();ju();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l}=Zw(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return x.jsxs(x.Fragment,{children:[!r&&De(a).lte(-30)&&x.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),x.jsxs("div",{className:"price-impact-block",children:[x.jsxs("div",{className:"left",children:[x.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),x.jsx(Xw,{autoSwitchTooltip:!0,position:"top",content:x.jsx(tO,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:x.jsx("use",{xlinkHref:"#icon-tips"})})})]}),x.jsxs("div",{children:[e&&x.jsx(As,{style:{width:"80px",height:"20px"}}),!e&&x.jsxs("div",{className:"right",children:[x.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),x.jsx("div",{className:"platforms",children:c.map(d=>x.jsx(ku,{content:x.jsx("span",{style:{fontSize:"12px"},children:C1[d]}),position:"top",delay:300,children:x.jsx(Wr,{src:S5[d]})},d))})]})]})]})]})}function tO({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:o}=ju();return x.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[x.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),x.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[x.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?x.jsx(mh,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):x.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),x.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[x.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),x.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(s=>C1[s]+" ").join("")})]})]})}function Qw({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:o,byAmountIn:s}=dn();return x.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[x.jsx("div",{className:"left",children:s?"Minimum Received":"Maximum Sold"}),n?x.jsx(As,{style:{height:"18px",width:"80px"}}):x.jsxs("div",{className:"right",children:[jr(r,s?o==null?void 0:o.decimals:i==null?void 0:i.decimals,!1,Lr.ROUND_DOWN)," ",cn(s?(o==null?void 0:o.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function rO({scamsText:e}){return x.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[x.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[x.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-alert"})}),x.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),x.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:x.jsx(I1,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function nO({onClick:e}){return x.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-back"})}),x.jsx("span",{children:"Back"})]})}function gh({title:e,backClick:t}){return x.jsxs("div",{className:"cs-have-back-header",children:[x.jsx(nO,{onClick:t}),x.jsx("span",{className:"title",children:e})]})}const Du=globalThis||void 0||self;var iO=typeof Du=="object"&&Du&&Du.Object===Object&&Du;const eb=iO;var oO=typeof self=="object"&&self&&self.Object===Object&&self,sO=eb||oO||Function("return this")();const ei=sO;var aO=ei.Symbol;const ti=aO;var tb=Object.prototype,cO=tb.hasOwnProperty,uO=tb.toString,Pa=ti?ti.toStringTag:void 0;function lO(e){var t=cO.call(e,Pa),r=e[Pa];try{e[Pa]=void 0;var n=!0}catch{}var i=uO.call(e);return n&&(t?e[Pa]=r:delete e[Pa]),i}var fO=Object.prototype,dO=fO.toString;function hO(e){return dO.call(e)}var pO="[object Null]",mO="[object Undefined]",rb=ti?ti.toStringTag:void 0;function Ps(e){return e==null?e===void 0?mO:pO:rb&&rb in Object(e)?lO(e):hO(e)}function to(e){return e!=null&&typeof e=="object"}var gO="[object Symbol]";function Ra(e){return typeof e=="symbol"||to(e)&&Ps(e)==gO}function Bu(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var vO=Array.isArray;const Gr=vO;var yO=1/0,nb=ti?ti.prototype:void 0,ib=nb?nb.toString:void 0;function ob(e){if(typeof e=="string")return e;if(Gr(e))return Bu(e,ob)+"";if(Ra(e))return ib?ib.call(e):"";var t=e+"";return t=="0"&&1/e==-yO?"-0":t}function Rs(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function sb(e){return e}var wO="[object AsyncFunction]",bO="[object Function]",xO="[object GeneratorFunction]",SO="[object Proxy]";function ab(e){if(!Rs(e))return!1;var t=Ps(e);return t==bO||t==xO||t==wO||t==SO}var EO=ei["__core-js_shared__"];const vh=EO;var cb=function(){var e=/[^.]+$/.exec(vh&&vh.keys&&vh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function _O(e){return!!cb&&cb in e}var CO=Function.prototype,MO=CO.toString;function Po(e){if(e!=null){try{return MO.call(e)}catch{}try{return e+""}catch{}}return""}var AO=/[\\^$.*+?()[\]{}|]/g,TO=/^\[object .+?Constructor\]$/,IO=Function.prototype,OO=Object.prototype,PO=IO.toString,RO=OO.hasOwnProperty,NO=RegExp("^"+PO.call(RO).replace(AO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jO(e){if(!Rs(e)||_O(e))return!1;var t=ab(e)?NO:TO;return t.test(Po(e))}function kO(e,t){return e==null?void 0:e[t]}function Ro(e,t){var r=kO(e,t);return jO(r)?r:void 0}var DO=Ro(ei,"WeakMap");const yh=DO;var ub=Object.create,BO=function(){function e(){}return function(t){if(!Rs(t))return{};if(ub)return ub(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const LO=BO;function $O(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var FO=function(){try{var e=Ro(Object,"defineProperty");return e({},"",{}),e}catch{}}();const lb=FO;function UO(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var VO=9007199254740991,zO=/^(?:0|[1-9]\d*)$/;function fb(e,t){var r=typeof e;return t=t??VO,!!t&&(r=="number"||r!="symbol"&&zO.test(e))&&e>-1&&e%1==0&&e<t}function db(e,t,r){t=="__proto__"&&lb?lb(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function wh(e,t){return e===t||e!==e&&t!==t}var HO=Object.prototype,qO=HO.hasOwnProperty;function hb(e,t,r){var n=e[t];(!(qO.call(e,t)&&wh(n,r))||r===void 0&&!(t in e))&&db(e,t,r)}function Lu(e,t,r,n){var i=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var a=t[o],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?db(r,a,c):hb(r,a,c)}return r}var WO=9007199254740991;function bh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=WO}function $u(e){return e!=null&&bh(e.length)&&!ab(e)}var GO=Object.prototype;function xh(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||GO;return e===r}function KO(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var YO="[object Arguments]";function pb(e){return to(e)&&Ps(e)==YO}var mb=Object.prototype,ZO=mb.hasOwnProperty,XO=mb.propertyIsEnumerable,JO=pb(function(){return arguments}())?pb:function(e){return to(e)&&ZO.call(e,"callee")&&!XO.call(e,"callee")};const gb=JO;function QO(){return!1}var vb=typeof qt=="object"&&qt&&!qt.nodeType&&qt,yb=vb&&typeof module=="object"&&module&&!module.nodeType&&module,eP=yb&&yb.exports===vb,wb=eP?ei.Buffer:void 0,tP=wb?wb.isBuffer:void 0,rP=tP||QO;const Fu=rP;var nP="[object Arguments]",iP="[object Array]",oP="[object Boolean]",sP="[object Date]",aP="[object Error]",cP="[object Function]",uP="[object Map]",lP="[object Number]",fP="[object Object]",dP="[object RegExp]",hP="[object Set]",pP="[object String]",mP="[object WeakMap]",gP="[object ArrayBuffer]",vP="[object DataView]",yP="[object Float32Array]",wP="[object Float64Array]",bP="[object Int8Array]",xP="[object Int16Array]",SP="[object Int32Array]",EP="[object Uint8Array]",_P="[object Uint8ClampedArray]",CP="[object Uint16Array]",MP="[object Uint32Array]",Jt={};Jt[yP]=Jt[wP]=Jt[bP]=Jt[xP]=Jt[SP]=Jt[EP]=Jt[_P]=Jt[CP]=Jt[MP]=!0,Jt[nP]=Jt[iP]=Jt[gP]=Jt[oP]=Jt[vP]=Jt[sP]=Jt[aP]=Jt[cP]=Jt[uP]=Jt[lP]=Jt[fP]=Jt[dP]=Jt[hP]=Jt[pP]=Jt[mP]=!1;function AP(e){return to(e)&&bh(e.length)&&!!Jt[Ps(e)]}function Uu(e){return function(t){return e(t)}}var bb=typeof qt=="object"&&qt&&!qt.nodeType&&qt,Na=bb&&typeof module=="object"&&module&&!module.nodeType&&module,TP=Na&&Na.exports===bb,Sh=TP&&eb.process,IP=function(){try{var e=Na&&Na.require&&Na.require("util").types;return e||Sh&&Sh.binding&&Sh.binding("util")}catch{}}();const Ns=IP;var xb=Ns&&Ns.isTypedArray,OP=xb?Uu(xb):AP;const Sb=OP;var PP=Object.prototype,RP=PP.hasOwnProperty;function Eb(e,t){var r=Gr(e),n=!r&&gb(e),i=!r&&!n&&Fu(e),o=!r&&!n&&!i&&Sb(e),s=r||n||i||o,a=s?KO(e.length,String):[],c=a.length;for(var u in e)(t||RP.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||fb(u,c)))&&a.push(u);return a}function _b(e,t){return function(r){return e(t(r))}}var NP=_b(Object.keys,Object);const jP=NP;var kP=Object.prototype,DP=kP.hasOwnProperty;function BP(e){if(!xh(e))return jP(e);var t=[];for(var r in Object(e))DP.call(e,r)&&r!="constructor"&&t.push(r);return t}function ja(e){return $u(e)?Eb(e):BP(e)}function LP(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var $P=Object.prototype,FP=$P.hasOwnProperty;function UP(e){if(!Rs(e))return LP(e);var t=xh(e),r=[];for(var n in e)n=="constructor"&&(t||!FP.call(e,n))||r.push(n);return r}function Eh(e){return $u(e)?Eb(e,!0):UP(e)}var VP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zP=/^\w*$/;function _h(e,t){if(Gr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ra(e)?!0:zP.test(e)||!VP.test(e)||t!=null&&e in Object(t)}var HP=Ro(Object,"create");const ka=HP;function qP(){this.__data__=ka?ka(null):{},this.size=0}function WP(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var GP="__lodash_hash_undefined__",KP=Object.prototype,YP=KP.hasOwnProperty;function ZP(e){var t=this.__data__;if(ka){var r=t[e];return r===GP?void 0:r}return YP.call(t,e)?t[e]:void 0}var XP=Object.prototype,JP=XP.hasOwnProperty;function QP(e){var t=this.__data__;return ka?t[e]!==void 0:JP.call(t,e)}var eR="__lodash_hash_undefined__";function tR(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ka&&t===void 0?eR:t,this}function No(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}No.prototype.clear=qP,No.prototype.delete=WP,No.prototype.get=ZP,No.prototype.has=QP,No.prototype.set=tR;function rR(){this.__data__=[],this.size=0}function Vu(e,t){for(var r=e.length;r--;)if(wh(e[r][0],t))return r;return-1}var nR=Array.prototype,iR=nR.splice;function oR(e){var t=this.__data__,r=Vu(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():iR.call(t,r,1),--this.size,!0}function sR(e){var t=this.__data__,r=Vu(t,e);return r<0?void 0:t[r][1]}function aR(e){return Vu(this.__data__,e)>-1}function cR(e,t){var r=this.__data__,n=Vu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ai(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ai.prototype.clear=rR,Ai.prototype.delete=oR,Ai.prototype.get=sR,Ai.prototype.has=aR,Ai.prototype.set=cR;var uR=Ro(ei,"Map");const Da=uR;function lR(){this.size=0,this.__data__={hash:new No,map:new(Da||Ai),string:new No}}function fR(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function zu(e,t){var r=e.__data__;return fR(t)?r[typeof t=="string"?"string":"hash"]:r.map}function dR(e){var t=zu(this,e).delete(e);return this.size-=t?1:0,t}function hR(e){return zu(this,e).get(e)}function pR(e){return zu(this,e).has(e)}function mR(e,t){var r=zu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ti(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ti.prototype.clear=lR,Ti.prototype.delete=dR,Ti.prototype.get=hR,Ti.prototype.has=pR,Ti.prototype.set=mR;var gR="Expected a function";function Ch(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(gR);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Ch.Cache||Ti),r}Ch.Cache=Ti;var vR=500;function yR(e){var t=Ch(e,function(n){return r.size===vR&&r.clear(),n}),r=t.cache;return t}var wR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bR=/\\(\\)?/g,xR=yR(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wR,function(r,n,i,o){t.push(i?o.replace(bR,"$1"):n||r)}),t});const SR=xR;function ER(e){return e==null?"":ob(e)}function Cb(e,t){return Gr(e)?e:_h(e,t)?[e]:SR(ER(e))}var _R=1/0;function Hu(e){if(typeof e=="string"||Ra(e))return e;var t=e+"";return t=="0"&&1/e==-_R?"-0":t}function Mh(e,t){t=Cb(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Hu(t[r++])];return r&&r==n?e:void 0}function CR(e,t,r){var n=e==null?void 0:Mh(e,t);return n===void 0?r:n}function Mb(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var MR=_b(Object.getPrototypeOf,Object);const Ab=MR;function AR(){this.__data__=new Ai,this.size=0}function TR(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function IR(e){return this.__data__.get(e)}function OR(e){return this.__data__.has(e)}var PR=200;function RR(e,t){var r=this.__data__;if(r instanceof Ai){var n=r.__data__;if(!Da||n.length<PR-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ti(n)}return r.set(e,t),this.size=r.size,this}function ri(e){var t=this.__data__=new Ai(e);this.size=t.size}ri.prototype.clear=AR,ri.prototype.delete=TR,ri.prototype.get=IR,ri.prototype.has=OR,ri.prototype.set=RR;function NR(e,t){return e&&Lu(t,ja(t),e)}function jR(e,t){return e&&Lu(t,Eh(t),e)}var Tb=typeof qt=="object"&&qt&&!qt.nodeType&&qt,Ib=Tb&&typeof module=="object"&&module&&!module.nodeType&&module,kR=Ib&&Ib.exports===Tb,Ob=kR?ei.Buffer:void 0,Pb=Ob?Ob.allocUnsafe:void 0;function DR(e,t){if(t)return e.slice();var r=e.length,n=Pb?Pb(r):new e.constructor(r);return e.copy(n),n}function Rb(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Nb(){return[]}var BR=Object.prototype,LR=BR.propertyIsEnumerable,jb=Object.getOwnPropertySymbols,$R=jb?function(e){return e==null?[]:(e=Object(e),Rb(jb(e),function(t){return LR.call(e,t)}))}:Nb;const Ah=$R;function FR(e,t){return Lu(e,Ah(e),t)}var UR=Object.getOwnPropertySymbols,VR=UR?function(e){for(var t=[];e;)Mb(t,Ah(e)),e=Ab(e);return t}:Nb;const kb=VR;function zR(e,t){return Lu(e,kb(e),t)}function Db(e,t,r){var n=t(e);return Gr(e)?n:Mb(n,r(e))}function Th(e){return Db(e,ja,Ah)}function HR(e){return Db(e,Eh,kb)}var qR=Ro(ei,"DataView");const Ih=qR;var WR=Ro(ei,"Promise");const Oh=WR;var GR=Ro(ei,"Set");const Ph=GR;var Bb="[object Map]",KR="[object Object]",Lb="[object Promise]",$b="[object Set]",Fb="[object WeakMap]",Ub="[object DataView]",YR=Po(Ih),ZR=Po(Da),XR=Po(Oh),JR=Po(Ph),QR=Po(yh),jo=Ps;(Ih&&jo(new Ih(new ArrayBuffer(1)))!=Ub||Da&&jo(new Da)!=Bb||Oh&&jo(Oh.resolve())!=Lb||Ph&&jo(new Ph)!=$b||yh&&jo(new yh)!=Fb)&&(jo=function(e){var t=Ps(e),r=t==KR?e.constructor:void 0,n=r?Po(r):"";if(n)switch(n){case YR:return Ub;case ZR:return Bb;case XR:return Lb;case JR:return $b;case QR:return Fb}return t});const Ba=jo;var eN=Object.prototype,tN=eN.hasOwnProperty;function rN(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&tN.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var nN=ei.Uint8Array;const qu=nN;function Rh(e){var t=new e.constructor(e.byteLength);return new qu(t).set(new qu(e)),t}function iN(e,t){var r=t?Rh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var oN=/\w*$/;function sN(e){var t=new e.constructor(e.source,oN.exec(e));return t.lastIndex=e.lastIndex,t}var Vb=ti?ti.prototype:void 0,zb=Vb?Vb.valueOf:void 0;function aN(e){return zb?Object(zb.call(e)):{}}function cN(e,t){var r=t?Rh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var uN="[object Boolean]",lN="[object Date]",fN="[object Map]",dN="[object Number]",hN="[object RegExp]",pN="[object Set]",mN="[object String]",gN="[object Symbol]",vN="[object ArrayBuffer]",yN="[object DataView]",wN="[object Float32Array]",bN="[object Float64Array]",xN="[object Int8Array]",SN="[object Int16Array]",EN="[object Int32Array]",_N="[object Uint8Array]",CN="[object Uint8ClampedArray]",MN="[object Uint16Array]",AN="[object Uint32Array]";function TN(e,t,r){var n=e.constructor;switch(t){case vN:return Rh(e);case uN:case lN:return new n(+e);case yN:return iN(e,r);case wN:case bN:case xN:case SN:case EN:case _N:case CN:case MN:case AN:return cN(e,r);case fN:return new n;case dN:case mN:return new n(e);case hN:return sN(e);case pN:return new n;case gN:return aN(e)}}function IN(e){return typeof e.constructor=="function"&&!xh(e)?LO(Ab(e)):{}}var ON="[object Map]";function PN(e){return to(e)&&Ba(e)==ON}var Hb=Ns&&Ns.isMap,RN=Hb?Uu(Hb):PN;const NN=RN;var jN="[object Set]";function kN(e){return to(e)&&Ba(e)==jN}var qb=Ns&&Ns.isSet,DN=qb?Uu(qb):kN;const BN=DN;var LN=1,$N=2,FN=4,Wb="[object Arguments]",UN="[object Array]",VN="[object Boolean]",zN="[object Date]",HN="[object Error]",Gb="[object Function]",qN="[object GeneratorFunction]",WN="[object Map]",GN="[object Number]",Kb="[object Object]",KN="[object RegExp]",YN="[object Set]",ZN="[object String]",XN="[object Symbol]",JN="[object WeakMap]",QN="[object ArrayBuffer]",ej="[object DataView]",tj="[object Float32Array]",rj="[object Float64Array]",nj="[object Int8Array]",ij="[object Int16Array]",oj="[object Int32Array]",sj="[object Uint8Array]",aj="[object Uint8ClampedArray]",cj="[object Uint16Array]",uj="[object Uint32Array]",Zt={};Zt[Wb]=Zt[UN]=Zt[QN]=Zt[ej]=Zt[VN]=Zt[zN]=Zt[tj]=Zt[rj]=Zt[nj]=Zt[ij]=Zt[oj]=Zt[WN]=Zt[GN]=Zt[Kb]=Zt[KN]=Zt[YN]=Zt[ZN]=Zt[XN]=Zt[sj]=Zt[aj]=Zt[cj]=Zt[uj]=!0,Zt[HN]=Zt[Gb]=Zt[JN]=!1;function Wu(e,t,r,n,i,o){var s,a=t&LN,c=t&$N,u=t&FN;if(r&&(s=i?r(e,n,i,o):r(e)),s!==void 0)return s;if(!Rs(e))return e;var l=Gr(e);if(l){if(s=rN(e),!a)return $O(e,s)}else{var d=Ba(e),p=d==Gb||d==qN;if(Fu(e))return DR(e,a);if(d==Kb||d==Wb||p&&!i){if(s=c||p?{}:IN(e),!a)return c?zR(e,jR(s,e)):FR(e,NR(s,e))}else{if(!Zt[d])return i?e:{};s=TN(e,d,a)}}o||(o=new ri);var w=o.get(e);if(w)return w;o.set(e,s),BN(e)?e.forEach(function(T){s.add(Wu(T,t,r,T,e,o))}):NN(e)&&e.forEach(function(T,O){s.set(O,Wu(T,t,r,O,e,o))});var b=u?c?HR:Th:c?Eh:ja,y=l?void 0:b(e);return UO(y||e,function(T,O){y&&(O=T,T=e[O]),hb(s,O,Wu(T,t,r,O,e,o))}),s}var lj=1,fj=4;function dj(e){return Wu(e,lj|fj)}var hj="__lodash_hash_undefined__";function pj(e){return this.__data__.set(e,hj),this}function mj(e){return this.__data__.has(e)}function Gu(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ti;++t<r;)this.add(e[t])}Gu.prototype.add=Gu.prototype.push=pj,Gu.prototype.has=mj;function gj(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function vj(e,t){return e.has(t)}var yj=1,wj=2;function Yb(e,t,r,n,i,o){var s=r&yj,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var d=-1,p=!0,w=r&wj?new Gu:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var b=e[d],y=t[d];if(n)var T=s?n(y,b,d,t,e,o):n(b,y,d,e,t,o);if(T!==void 0){if(T)continue;p=!1;break}if(w){if(!gj(t,function(O,R){if(!vj(w,R)&&(b===O||i(b,O,r,n,o)))return w.push(R)})){p=!1;break}}else if(!(b===y||i(b,y,r,n,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function bj(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function xj(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Sj=1,Ej=2,_j="[object Boolean]",Cj="[object Date]",Mj="[object Error]",Aj="[object Map]",Tj="[object Number]",Ij="[object RegExp]",Oj="[object Set]",Pj="[object String]",Rj="[object Symbol]",Nj="[object ArrayBuffer]",jj="[object DataView]",Zb=ti?ti.prototype:void 0,Nh=Zb?Zb.valueOf:void 0;function kj(e,t,r,n,i,o,s){switch(r){case jj:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Nj:return!(e.byteLength!=t.byteLength||!o(new qu(e),new qu(t)));case _j:case Cj:case Tj:return wh(+e,+t);case Mj:return e.name==t.name&&e.message==t.message;case Ij:case Pj:return e==t+"";case Aj:var a=bj;case Oj:var c=n&Sj;if(a||(a=xj),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=Ej,s.set(e,t);var l=Yb(a(e),a(t),n,i,o,s);return s.delete(e),l;case Rj:if(Nh)return Nh.call(e)==Nh.call(t)}return!1}var Dj=1,Bj=Object.prototype,Lj=Bj.hasOwnProperty;function $j(e,t,r,n,i,o){var s=r&Dj,a=Th(e),c=a.length,u=Th(t),l=u.length;if(c!=l&&!s)return!1;for(var d=c;d--;){var p=a[d];if(!(s?p in t:Lj.call(t,p)))return!1}var w=o.get(e),b=o.get(t);if(w&&b)return w==t&&b==e;var y=!0;o.set(e,t),o.set(t,e);for(var T=s;++d<c;){p=a[d];var O=e[p],R=t[p];if(n)var k=s?n(R,O,p,t,e,o):n(O,R,p,e,t,o);if(!(k===void 0?O===R||i(O,R,r,n,o):k)){y=!1;break}T||(T=p=="constructor")}if(y&&!T){var F=e.constructor,L=t.constructor;F!=L&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof L=="function"&&L instanceof L)&&(y=!1)}return o.delete(e),o.delete(t),y}var Fj=1,Xb="[object Arguments]",Jb="[object Array]",Ku="[object Object]",Uj=Object.prototype,Qb=Uj.hasOwnProperty;function Vj(e,t,r,n,i,o){var s=Gr(e),a=Gr(t),c=s?Jb:Ba(e),u=a?Jb:Ba(t);c=c==Xb?Ku:c,u=u==Xb?Ku:u;var l=c==Ku,d=u==Ku,p=c==u;if(p&&Fu(e)){if(!Fu(t))return!1;s=!0,l=!1}if(p&&!l)return o||(o=new ri),s||Sb(e)?Yb(e,t,r,n,i,o):kj(e,t,c,r,n,i,o);if(!(r&Fj)){var w=l&&Qb.call(e,"__wrapped__"),b=d&&Qb.call(t,"__wrapped__");if(w||b){var y=w?e.value():e,T=b?t.value():t;return o||(o=new ri),i(y,T,r,n,o)}}return p?(o||(o=new ri),$j(e,t,r,n,i,o)):!1}function Yu(e,t,r,n,i){return e===t?!0:e==null||t==null||!to(e)&&!to(t)?e!==e&&t!==t:Vj(e,t,r,n,Yu,i)}var zj=1,Hj=2;function qj(e,t,r,n){var i=r.length,o=i,s=!n;if(e==null)return!o;for(e=Object(e);i--;){var a=r[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=r[i];var c=a[0],u=e[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in e))return!1}else{var d=new ri;if(n)var p=n(u,l,c,e,t,d);if(!(p===void 0?Yu(l,u,zj|Hj,n,d):p))return!1}}return!0}function e2(e){return e===e&&!Rs(e)}function Wj(e){for(var t=ja(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,e2(i)]}return t}function t2(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function Gj(e){var t=Wj(e);return t.length==1&&t[0][2]?t2(t[0][0],t[0][1]):function(r){return r===e||qj(r,e,t)}}function Kj(e,t){return e!=null&&t in Object(e)}function Yj(e,t,r){t=Cb(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=Hu(t[n]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&bh(i)&&fb(s,i)&&(Gr(e)||gb(e)))}function Zj(e,t){return e!=null&&Yj(e,t,Kj)}var Xj=1,Jj=2;function Qj(e,t){return _h(e)&&e2(t)?t2(Hu(e),t):function(r){var n=CR(r,e);return n===void 0&&n===t?Zj(r,e):Yu(t,n,Xj|Jj)}}function ek(e){return function(t){return t==null?void 0:t[e]}}function tk(e){return function(t){return Mh(t,e)}}function rk(e){return _h(e)?ek(Hu(e)):tk(e)}function r2(e){return typeof e=="function"?e:e==null?sb:typeof e=="object"?Gr(e)?Qj(e[0],e[1]):Gj(e):rk(e)}function nk(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(r(o[c],c,o)===!1)break}return t}}var ik=nk();const ok=ik;function sk(e,t){return e&&ok(e,t,ja)}function ak(e,t){return function(r,n){if(r==null)return r;if(!$u(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var ck=ak(sk);const n2=ck;function uk(e,t){var r=[];return n2(e,function(n,i,o){t(n,i,o)&&r.push(n)}),r}function lk(e,t){var r=Gr(e)?Rb:uk;return r(e,r2(t))}function fk(e,t){var r=-1,n=$u(e)?Array(e.length):[];return n2(e,function(i,o,s){n[++r]=t(i,o,s)}),n}function dk(e,t){return Yu(e,t)}function hk(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function pk(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,o=Ra(e),s=t!==void 0,a=t===null,c=t===t,u=Ra(t);if(!a&&!u&&!o&&e>t||o&&s&&c&&!a&&!u||n&&s&&c||!r&&c||!i)return 1;if(!n&&!o&&!u&&e<t||u&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!c)return-1}return 0}function mk(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=pk(i[n],o[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function gk(e,t,r){t.length?t=Bu(t,function(o){return Gr(o)?function(s){return Mh(s,o.length===1?o[0]:o)}:o}):t=[sb];var n=-1;t=Bu(t,Uu(r2));var i=fk(e,function(o,s,a){var c=Bu(t,function(u){return u(o)});return{criteria:c,index:++n,value:o}});return hk(i,function(o,s){return mk(o,s,r)})}function vk(e,t,r,n){return e==null?[]:(Gr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Gr(r)||(r=r==null?[]:[r]),gk(e,t,r))}function yk({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=dn(),o=te.useRef(!1),{slippage:s}=$r(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:d}=a,{amountLimit:p}=qw(s,a),{showPriceImpactTips:w,showPriceImpactWarn:b}=Zw(n,i,u,l),{priceAcceptRouterData:y}=BI(a),[T,O]=te.useState(!1),[R,k]=te.useState(!1);te.useMemo(()=>d?i:n,[d]);const F=te.useMemo(()=>y!==void 0,[y]),L=()=>{if(y){if(o.current)return;o.current=!0;const H=dj(y);c(H),setTimeout(()=>{o.current=!1},300)}},q=te.useMemo(()=>T?!1:!!b,[T,b]);return x.jsxs("div",{className:"secondary-dialog",children:[x.jsx(gh,{title:"Review your order",backClick:e}),x.jsxs("div",{className:"secondary-content",children:[x.jsxs("div",{className:"trade-info",children:[x.jsxs("div",{className:"amount-info",children:[x.jsx("span",{className:"amount",children:cs(u||"")}),x.jsx("img",{src:n==null?void 0:n.logo_url}),x.jsx("span",{className:"symbol",children:cn((n==null?void 0:n.symbol)||"")})]}),x.jsx("div",{className:"dividing-line",children:x.jsx("div",{className:"swap-icon",children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-trade"})})})}),x.jsxs("div",{className:"amount-info",children:[x.jsx("span",{className:"amount",children:cs(l||"")}),x.jsx("img",{src:i==null?void 0:i.logo_url}),x.jsx("span",{className:"symbol",children:cn((i==null?void 0:i.symbol)||"")})]})]}),x.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[x.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:x.jsx(mh,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),w&&x.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),x.jsxs("div",{className:"swap-info-between",children:[x.jsx("div",{className:"left",children:"Slippage Tolerance"}),x.jsxs("div",{className:"right",children:[s,"%"]})]}),x.jsx(Qw,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),x.jsx(Jw,{isLoading:!1,routerData:a,noTips:!0}),b&&x.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[x.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),x.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[x.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:T?"#72c1f7":"#7F98A7"},onClick:()=>{O(!0)},children:"Yes, please continue."}),x.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"#7F98A7",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!F&&x.jsx("button",{disabled:q||R,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{R||(k(!0),t(a))},children:R?x.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:x.jsx(Yw,{})}):"Confirm Swap"}),F&&x.jsxs("div",{className:"price-update",children:[x.jsxs("div",{className:"left",children:[x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-alert"})}),x.jsx("span",{children:"Price update"})]}),x.jsx("div",{className:"right",children:x.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function Zu(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:o}=Ts(),s=a=>{n||(qc(a),Lw(t,{debug:!1,message:"message"}),o("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),x.jsx(x.Fragment,{children:r==="btn"?x.jsxs("div",{className:"copy-btn",onClick:s,children:[x.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),x.jsx("span",{children:"Copy"})]}):x.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:s,children:x.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function wk({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=dn(),{getTokenInfo:a}=eo(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(d=>({...d,fromToken:a(d.from_type),toToken:a(d.to_type)}))}))},[t]);return x.jsxs("div",{className:"route-dialog",children:[x.jsx(gh,{title:"Route",backClick:e}),x.jsxs("div",{className:"route-dialog-content",children:[x.jsx("div",{className:"simple-router-box",children:x.jsx(o2,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),x.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[x.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[x.jsx(Wr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),x.jsx("span",{className:"amount",children:jr(o,n==null?void 0:n.decimals)}),x.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),x.jsx("div",{className:"route-box-h5 center",children:x.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>x.jsxs("div",{className:"route-item-box-h5",children:[x.jsxs("div",{className:"percent",children:[De(u.percentage).mul(100).toString(),"%"]}),x.jsx("div",{className:u.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:u.paths.map(d=>x.jsx("div",{className:"route-path-item",children:x.jsx(Xw,{autoSwitchTooltip:!0,position:"bottom",content:x.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[x.jsx(xk,{poolAddress:d.pool_address}),x.jsx(i2,{token:d.fromToken}),x.jsx(i2,{token:d.toToken})]}),children:x.jsx(bk,{path:d})})},d.to_type))})]},l))})}),x.jsxs("div",{className:"center",style:{gap:"4px"},children:[x.jsx(Wr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),x.jsx("span",{className:"amount",children:jr(s,i==null?void 0:i.decimals)}),x.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function bk({path:e}){var t,r,n;return x.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[x.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[x.jsx(Wr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),x.jsx(Wr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),x.jsxs("span",{className:"provider",children:[(n=M1[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&x.jsxs("div",{className:"fee-tier",children:[" ",De(e.fee_rate).mul(100).toString(),"%"]})]})}function i2({token:e}){const{getExplorerUrl:t}=ls();return x.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[x.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[x.jsx(Wr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),x.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:cn((e==null?void 0:e.symbol)||"")})]}),x.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[x.jsx("a",{onClick:qc,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Eo(e==null?void 0:e.coin_type)}),x.jsx(Zu,{text:(e==null?void 0:e.coin_type)||""})]})]})}function xk({poolAddress:e}){const{getExplorerUrl:t}=ls();return x.jsxs(x.Fragment,{children:[e&&x.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[x.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),x.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[x.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:qc,href:t(e,"poolAddress"),target:"_blank",children:Eo(e)}),x.jsx(Zu,{text:e})]})]}),e&&x.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function o2({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var d;const[n,i]=te.useState(!1),{isApp:o}=ju(),{fetchTokenInfo:s}=eo(),a=te.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]),[c,u]=te.useState(""),l=async()=>{var y,T;const p=[],w=((T=(y=r==null?void 0:r.routers)==null?void 0:y[0])==null?void 0:T.paths)||[];for(let O=0;O<w.length;O++){const R=w[O],k=await s(R==null?void 0:R.to_type);if(O===0){const F=await s(R==null?void 0:R.from_type);p.push(`${F==null?void 0:F.symbol} > ${k==null?void 0:k.symbol}`)}else p.push(k==null?void 0:k.symbol)}const b=p.join(" > ");u(b)};return te.useEffect(()=>{a&&l()},[a]),x.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[x.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?x.jsx(As,{style:{width:"80px",height:"18px"}}):x.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[x.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?c:r==null?void 0:r.router_summery}),x.jsxs("div",{className:"providers",children:[(d=r==null?void 0:r.providers)==null?void 0:d.map((p,w)=>{var b;return o?x.jsx(Wr,{src:cr[p],style:{width:"16px",height:"16px"}}):x.jsx(ku,{content:x.jsx("div",{children:((b=M1[p])==null?void 0:b.name)||p}),position:"top",delay:300,children:x.jsx(Wr,{src:cr[p],style:{width:"16px",height:"16px"}})},p)}),e&&x.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:x.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&x.jsx(wk,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const WB="",La=Ei((e,t)=>({currentTypeTab:"Default",setCurrentTypeTab:r=>{e(()=>({currentTypeTab:r}))},currentPlatformTab:"All",setCurrentPlatformTab:r=>{e(()=>({currentPlatformTab:r}))},platformList:["All","Wormhole"],setPlatformList:r=>{e(()=>({platformList:r}))},isOpenImportDialog:!1,setIsOpenImportDialog:r=>{e(()=>({isOpenImportDialog:r}))},collectTokenMap:new Map,setCollectTokenMap:(r,n=!1)=>{e(()=>({collectTokenMap:r})),n||Si.setItem(S1,r)},showTokenList:[],setShowTokenList:r=>{e(()=>({showTokenList:[...r]}))},combineTokenList:[],setComBineTokenList:r=>{e(()=>({combineTokenList:r}))},currentImportTokenData:void 0,setCurrentImportTokenData:r=>{e(()=>({currentImportTokenData:r}))},importTokenList:[],importTokenIsLoading:!1,setImportToken:(r,n)=>{const{importTokenList:i,setImportTokenList:o}=t();let s=i;if(n)s=[r,...s];else{const a=Bg(r.coin_type);s=i.filter(c=>Bg(c.coin_type)!==a)}return o(s),Si.setItem(E1,s),s},setImportTokenList:r=>{e(()=>({importTokenList:r}))},setImportTokenIsLoading:r=>{e(()=>({importTokenIsLoading:r}))},searchInput:"",setSearchInput:r=>{e(()=>({searchInput:r}))},showTokenListIsLoading:!1,setShowTokenListIsLoading:r=>{e(()=>({showTokenListIsLoading:r}))}}));Si.getItem(S1).then(e=>{e!==null&&La.getState().setCollectTokenMap(e,!0)}),Si.getItem(E1).then(e=>{e&&La.getState().setImportTokenList(e)});function s2(){const{setCollectTokenMap:e,collectTokenMap:t}=La(),r=i=>{const o=new Map(t);o.get(i.coin_type)?o.delete(i.coin_type):o.set(i.coin_type,i),e(o)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function Sk(e){const{trustedTokenList:t}=Is(),{tokenBalanceObj:r,currentAccount:n}=Pn(),{coinPriceObj:i}=Vw(),{getTokenAmountValue:o}=Nu(),{fetchTokenInfo:s}=eo(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:d,setComBineTokenList:p,setImportToken:w,setCurrentImportTokenData:b,setImportTokenIsLoading:y,currentImportTokenData:T,searchInput:O,setSearchInput:R,importTokenIsLoading:k,showTokenListIsLoading:F,setCurrentTypeTab:L}=La(),[q,H]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&H(!0)},[t]);const[K,re]=te.useState(!1);te.useEffect(()=>{v1(i)||re(!0)},[i]);const oe=te.useRef({}),[ae,z]=te.useState(!1);te.useEffect(()=>{(!v1(r)||!ud(oe.current,r))&&(oe.current=r,z(!0))},[r]);const D=(v,N)=>{const ee=N&&N.toLocaleLowerCase().trim(),ie=v.map(me=>{let xe=0,be=0;me.symbol.toLowerCase()===ee||me.name.toLowerCase()===ee||me.coin_type.toLowerCase()===ee?(xe=1e3,be=2):me.symbol.toLowerCase().indexOf(ee)>-1?(xe=100,be=0):me.name.toLowerCase().indexOf(ee)>-1?(xe=10,be=0):me.coin_type.toLowerCase().indexOf(ee)>-1?(xe=1,be=0):me.coin_type.toLowerCase()=="0x2::sui::sui"&&(be=1);let Ve=Array.isArray(me==null?void 0:me.coin_priority)?Number(me.coin_priority[0])||0:Number(me==null?void 0:me.coin_priority)||0;return e===me.coin_type&&!N&&(be=12,xe=1e3,Ve=1e4),{...me,mark:xe,sort:be,coin_priority_sort:Ve,rateNumber:Number((me==null?void 0:me.rate)||"0"),balanceNumber:Number((me==null?void 0:me.balance)||"0")}});return vk(ie,[me=>!N&&e===me.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},h=(v,N=!1)=>{const ee=N?v.trim():v.toLowerCase().trim(),ie=["symbol","name","coin_type"];return lk(ee.length===0?l:[...l,...d],me=>ie.some(xe=>{const be=me[xe];if(typeof be=="string"){const Ve=N?be:be.toLowerCase();return xe==="coin_type"?Ve.includes(ee)||bi(Ve,!0).includes(bi(ee,!0)):Ve.includes(ee)}return!1}))},f=v=>{v||b(void 0);const N=h(v);if((N==null?void 0:N.length)===0){m(v);return}else{const ee=D(N,v);u(ee)}},m=async v=>{var N;y(!0);try{if(y1(v)){const ee=v.trim(),ie=Rr(ee).full_address,le=await s(ie);if(!le){u([]);return}const me=((N=r==null?void 0:r[ee])==null?void 0:N.totalBalanceFormat)||"0",xe=De(me).gt("0")?o(ee,me):"0",be={...le,balance:me,rate:xe};u([be]),b(be)}else{u([]);return}}catch{b(void 0),u([]);return}finally{y(!1)}},S=v=>{if(v==="Default")I("All");else{const N=D(d,O);u(N)}},M=()=>{if(T){const v=w(T,!0),N=D(v,O);u(N),b(void 0),R("")}},_=v=>{const N=w(v,!1),ee=D(N,O);u(ee)},I=v=>{const N=v==="All"?[...l]:l.filter(ie=>v=="Native"?!ie.labels||ie.labels.length==0||ie.labels=="Native":ie.labels&&ie.labels.length>0&&ie.labels[0].toLowerCase()==v.toLowerCase()),ee=D(N,O);u(ee)};te.useEffect(()=>{if(!q||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const v=[];for(const N of t){const ee=r==null?void 0:r[N==null?void 0:N.coin_type],ie=(ee==null?void 0:ee.totalBalanceFormat)||"0",le=(ee==null?void 0:ee.displayBalance)||"0",me=De(ie).gt("0")?o(N==null?void 0:N.coin_type,ie):"0";v.push({...N,balance:le,rate:jr(me,4,!0)})}p(v)}},[q,K,ae,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!dk(C.current,l)){C.current=l;const v=D(l);e&&d.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),S("Imported")):u(v)}},[l,e]);const g=te.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!k)return!0;return!1},[O,c,T,k,F]);return{showTokenList:c,handleSearch:f,handleChangePlatform:I,currentImportTokenData:T,handleChangeType:S,handleImportClick:M,handleDeleteImportClick:_,isNoData:g}}function Ek({tokenList:e,onHandleTokenAction:t}){return x.jsx("div",{className:"token-collect-list",children:e.map(r=>x.jsx(_k,{token:r,onHandleTokenAction:t},r.coin_type))})}function _k({token:e,onHandleTokenAction:t}){return x.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[x.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),x.jsx("span",{children:e.symbol}),x.jsx("i",{children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:x.jsx("use",{xlinkHref:"#icon-close"})})})]})}const Ck=Tt("/images/img_no_data@2x.png");function Mk(e){const{img:t=Ck,text:r,width:n="100%",height:i="auto",padding:o="20px",subItem:s}=e;return x.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:o,boxSizing:"border-box",textAlign:"center"},children:[t&&x.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&x.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),s&&s]})}function Ak({tabList:e,currentTab:t,changeTab:r}){return x.jsx("div",{className:"platform-tabs",children:e.map(n=>x.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var a2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Tk(e,t){return!!(e===t||a2(e)&&a2(t))}function Ik(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Tk(e[r],t[r]))return!1;return!0}function Ok(e,t){t===void 0&&(t=Ik);var r=null;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var s=e.apply(this,i);return r={lastResult:s,lastArgs:i,lastThis:this},s}return n.clear=function(){r=null},n}function jh(){return jh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jh.apply(null,arguments)}function c2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kh(e,t){return kh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},kh(e,t)}function Pk(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,kh(e,t)}var u2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Rk(e,t){return!!(e===t||u2(e)&&u2(t))}function Nk(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Rk(e[r],t[r]))return!1;return!0}function Dh(e,t){t===void 0&&(t=Nk);var r,n=[],i,o=!1;function s(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return o&&r===this&&t(a,n)||(i=e.apply(this,a),o=!0,r=this,n=a),i}return s}function l2(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var jk=typeof performance=="object"&&typeof performance.now=="function",f2=jk?function(){return performance.now()}:function(){return Date.now()};function d2(e){cancelAnimationFrame(e.id)}function kk(e,t){var r=f2();function n(){f2()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Bh=-1;function h2(e){if(e===void 0&&(e=!1),Bh===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Bh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Bh}var js=null;function p2(e){if(e===void 0&&(e=!1),js===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?js="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?js="negative":js="positive-ascending"),document.body.removeChild(t),js}return js}pn.env.NODE_ENV;var Dk=150,Bk=function(t,r){return t},Xu=null,Ju=null;pn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Xu=new WeakSet,Ju=new WeakSet);function Lk(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,o=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(d){Pk(p,d);function p(b){var y;return y=d.call(this,b)||this,y._instanceProps=c(y.props,c2(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:c2(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Dh(function(T,O,R,k){return y.props.onItemsRendered({overscanStartIndex:T,overscanStopIndex:O,visibleStartIndex:R,visibleStopIndex:k})}),y._callOnScroll=void 0,y._callOnScroll=Dh(function(T,O,R){return y.props.onScroll({scrollDirection:T,scrollOffset:O,scrollUpdateWasRequested:R})}),y._getItemStyle=void 0,y._getItemStyle=function(T){var O=y.props,R=O.direction,k=O.itemSize,F=O.layout,L=y._getItemStyleCache(u&&k,u&&F,u&&R),q;if(L.hasOwnProperty(T))q=L[T];else{var H=r(y.props,T,y._instanceProps),K=i(y.props,T,y._instanceProps),re=R==="horizontal"||F==="horizontal",oe=R==="rtl",ae=re?H:0;L[T]=q={position:"absolute",left:oe?void 0:ae,right:oe?ae:void 0,top:re?0:H,height:re?"100%":K,width:re?K:"100%"}}return q},y._getItemStyleCache=void 0,y._getItemStyleCache=Dh(function(T,O,R){return{}}),y._onScrollHorizontal=function(T){var O=T.currentTarget,R=O.clientWidth,k=O.scrollLeft,F=O.scrollWidth;y.setState(function(L){if(L.scrollOffset===k)return null;var q=y.props.direction,H=k;if(q==="rtl")switch(p2()){case"negative":H=-k;break;case"positive-descending":H=F-R-k;break}return H=Math.max(0,Math.min(H,F-R)),{isScrolling:!0,scrollDirection:L.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(T){var O=T.currentTarget,R=O.clientHeight,k=O.scrollHeight,F=O.scrollTop;y.setState(function(L){if(L.scrollOffset===F)return null;var q=Math.max(0,Math.min(F,k-R));return{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(T){var O=y.props.outerRef;y._outerRef=T,typeof O=="function"?O(T):O!=null&&typeof O=="object"&&O.hasOwnProperty("current")&&(O.current=T)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&d2(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=kk(y._resetIsScrolling,Dk)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,T){return $k(y,T),l(y),null};var w=p.prototype;return w.scrollTo=function(y){y=Math.max(0,y),this.setState(function(T){return T.scrollOffset===y?null:{scrollDirection:T.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},w.scrollToItem=function(y,T){T===void 0&&(T="auto");var O=this.props,R=O.itemCount,k=O.layout,F=this.state.scrollOffset;y=Math.max(0,Math.min(y,R-1));var L=0;if(this._outerRef){var q=this._outerRef;k==="vertical"?L=q.scrollWidth>q.clientWidth?h2():0:L=q.scrollHeight>q.clientHeight?h2():0}this.scrollTo(o(this.props,y,T,F,this._instanceProps,L))},w.componentDidMount=function(){var y=this.props,T=y.direction,O=y.initialScrollOffset,R=y.layout;if(typeof O=="number"&&this._outerRef!=null){var k=this._outerRef;T==="horizontal"||R==="horizontal"?k.scrollLeft=O:k.scrollTop=O}this._callPropsCallbacks()},w.componentDidUpdate=function(){var y=this.props,T=y.direction,O=y.layout,R=this.state,k=R.scrollOffset,F=R.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(T==="horizontal"||O==="horizontal")if(T==="rtl")switch(p2()){case"negative":L.scrollLeft=-k;break;case"positive-ascending":L.scrollLeft=k;break;default:var q=L.clientWidth,H=L.scrollWidth;L.scrollLeft=H-q-k;break}else L.scrollLeft=k;else L.scrollTop=k}this._callPropsCallbacks()},w.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&d2(this._resetIsScrollingTimeoutId)},w.render=function(){var y=this.props,T=y.children,O=y.className,R=y.direction,k=y.height,F=y.innerRef,L=y.innerElementType,q=y.innerTagName,H=y.itemCount,K=y.itemData,re=y.itemKey,oe=re===void 0?Bk:re,ae=y.layout,z=y.outerElementType,D=y.outerTagName,h=y.style,f=y.useIsScrolling,m=y.width,S=this.state.isScrolling,M=R==="horizontal"||ae==="horizontal",_=M?this._onScrollHorizontal:this._onScrollVertical,I=this._getRangeToRender(),C=I[0],g=I[1],v=[];if(H>0)for(var N=C;N<=g;N++)v.push(te.createElement(T,{data:K,key:oe(N,K),index:N,isScrolling:f?S:void 0,style:this._getItemStyle(N)}));var ee=n(this.props,this._instanceProps);return te.createElement(z||D||"div",{className:O,onScroll:_,ref:this._outerRefSetter,style:jh({position:"relative",height:k,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},h)},te.createElement(L||q||"div",{children:v,ref:F,style:{height:M?"100%":ee,pointerEvents:S?"none":void 0,width:M?ee:"100%"}}))},w._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var y=this.props.itemCount;if(y>0){var T=this._getRangeToRender(),O=T[0],R=T[1],k=T[2],F=T[3];this._callOnItemsRendered(O,R,k,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,q=L.scrollDirection,H=L.scrollOffset,K=L.scrollUpdateWasRequested;this._callOnScroll(q,H,K)}},w._getRangeToRender=function(){var y=this.props,T=y.itemCount,O=y.overscanCount,R=this.state,k=R.isScrolling,F=R.scrollDirection,L=R.scrollOffset;if(T===0)return[0,0,0,0];var q=s(this.props,L,this._instanceProps),H=a(this.props,q,L,this._instanceProps),K=!k||F==="backward"?Math.max(1,O):1,re=!k||F==="forward"?Math.max(1,O):1;return[Math.max(0,q-K),Math.max(0,Math.min(T-1,H+re)),q,H]},p}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var $k=function(t,r){var n=t.children,i=t.direction,o=t.height,s=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(pn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Ju&&!Ju.has(l)&&(Ju.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var d=i==="horizontal"||s==="horizontal";switch(i){case"horizontal":case"vertical":Xu&&!Xu.has(l)&&(Xu.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(s){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+s+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(d&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!d&&typeof o!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(o===null?"null":typeof o)+'" was specified.'))}},Fk=Lk({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,o,s){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,d=t.layout,p=t.width,w=a==="horizontal"||d==="horizontal",b=w?p:c,y=Math.max(0,u*l-b),T=Math.min(y,r*l),O=Math.max(0,r*l-b+l+s);switch(n==="smart"&&(i>=O-b&&i<=T+b?n="auto":n="center"),n){case"start":return T;case"end":return O;case"center":{var R=Math.round(O+(T-O)/2);return R<Math.ceil(b/2)?0:R>y+Math.floor(b/2)?y:R}case"auto":default:return i>=O&&i<=T?i:i<O?O:T}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,o=t.height,s=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",d=r*a,p=l?u:o,w=Math.ceil((p+n-d)/a);return Math.max(0,Math.min(s-1,r+w-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(pn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function m2(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var Uk=["style"],Vk=["style"];function zk(e,t){var r=e.style,n=l2(e,Uk),i=t.style,o=l2(t,Vk);return!m2(r,i)&&!m2(n,o)}const Hk=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:o,showDelete:s}=e,a=n[t];return x.jsx("div",{style:r,children:x.jsx(Gk,{data:a,onHandleTokenAction:i,showCollect:o,showDelete:s})})},zk),qk=Ok((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function Wk({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=te.useRef(null);te.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const o=qk(e,t,r,n);return x.jsx("div",{className:"token-list",children:x.jsx(Fk,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:o,itemSize:72,width:"100%",children:Hk})})}function Gk({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=s2(),{getExplorerUrl:o}=ls();return x.jsxs("div",{className:"token-list-item",onClick:s=>{t&&(s.stopPropagation(),n(e,"select_token"))},children:[x.jsx(Wr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),x.jsxs("div",{className:"token-info",children:[x.jsx("h4",{className:"token-symbol",children:x.jsx("span",{children:cn(e.symbol)})}),x.jsx("p",{className:"token-name",children:cn(e==null?void 0:e.name,20)}),x.jsxs("div",{className:"copy",children:[x.jsx("a",{onClick:qc,href:o(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Eo(e==null?void 0:e.coin_type)}),x.jsx(Zu,{text:e==null?void 0:e.coin_type})]})]}),x.jsxs("div",{className:"token-balance",children:[x.jsxs("div",{className:"balance",children:[x.jsx("h4",{children:e==null?void 0:e.balance}),x.jsx("p",{children:e!=null&&e.rate?m1(e==null?void 0:e.rate,2):""})]}),r&&x.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"delete_import")},children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&x.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"collect_token")},children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function Kk({currentType:e,changeTab:t}){const r=["Default","Imported"];return x.jsx("div",{className:"type-tabs",children:r.map(n=>x.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function Yk({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:o,handleChangePlatform:s,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=Sk(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:d,setCurrentTypeTab:p,currentPlatformTab:w,setCurrentPlatformTab:b,platformList:y,isOpenImportDialog:T,setIsOpenImportDialog:O,setSearchInput:R,searchInput:k,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:q}=La();te.useEffect(()=>()=>{R(""),b("All"),p("Default"),q(void 0)},[]);const{handleCollectToken:H,collectTokenMap:K}=s2(),re=m=>{p(m),a(m)},oe=m=>{b(m),s(m)},ae=()=>{c(),O(!1)},z=m=>{let S=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();R(S),S?D(S):(D(""),re("Default"))},D=ph(m=>{y1(m)?o(bi(m,!0)):o(m)},300),h=(m,S)=>{if(S==="delete_import"){u(m);return}if(S==="collect_token"||S==="un_collect"){H(m);return}S==="select_token"&&(t(m),e())},f=te.useMemo(()=>Array.from(K.values()),[K]);return x.jsxs("div",{className:"token-select-modal",children:[x.jsx(gh,{backClick:e,title:"Select Token"}),x.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[x.jsxs("div",{className:"center-content",children:[x.jsxs("div",{className:"search-input",style:{position:"relative"},children:[x.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:k,onChange:m=>z(m.target.value),style:{paddingRight:"40px"}}),k.length>0&&x.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{z("")},children:x.jsx("use",{xlinkHref:"#icon-close"})})]}),f.length>0&&x.jsx(Ek,{tokenList:f,onHandleTokenAction:h}),k.length===0&&x.jsx(Kk,{currentType:d,changeTab:re}),k.length===0&&d==="Default"&&x.jsx(Ak,{tabList:y,currentTab:w,changeTab:oe})]}),i&&x.jsx(Zk,{showTooltip:k.length>0,text:k.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&x.jsx($w,{}),L&&x.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&x.jsxs("div",{style:{position:"relative"},children:[x.jsx(Wk,{showTokenList:n,showCollect:!L,showDelete:!L&&d==="Imported",onHandleTokenAction:h}),L&&x.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:x.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ae(),h(L,"select_token")},children:"Import"})})]})]})]})}function Zk({showTooltip:e,text:t}){return x.jsx("div",{style:{height:"360px"},children:x.jsx(Mk,{text:t,subItem:e?x.jsx("div",{children:x.jsx(ku,{position:"bottom",content:x.jsx("div",{children:"The unique id of coin"}),children:x.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",x.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:x.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function Xk({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1),{setIgnoreWarnToken:o}=$r();return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"dialog-mask",onClick:e}),x.jsxs("div",{className:"import-dialog",children:[x.jsxs("div",{className:"cs-dialog-header",children:[x.jsx("div",{className:"title",children:"Tips"}),x.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:x.jsx("use",{xlinkHref:"#icon-close"})})]}),x.jsxs("div",{className:"import-content",children:[x.jsx("div",{className:"tip-text-box",children:x.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(s=>x.jsxs("div",{className:"import-token-info",children:[x.jsx(Wr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),x.jsxs("div",{className:"info",children:[x.jsx("div",{className:"name",children:x.jsxs("span",{children:[" ",s.symbol," "]})}),x.jsxs("div",{className:"address",children:[x.jsx("span",{children:Eo(s.coin_type)}),x.jsx(Zu,{text:s.coin_type})]})]})]},s.coin_type)),x.jsxs("div",{className:"risk-checkbox",children:[x.jsx(mu,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),x.jsx("span",{children:"I acknowledge the risk"})]}),x.jsxs("div",{className:"button-block",children:[x.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),x.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(s=>{o(s.coin_type)})},children:"Confirm"})]})]})]})]})}const GB="";function g2(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var $a;(function(e){e.event="event",e.props="prop"})($a||($a={}));function ro(){}function Jk(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(o,s){return o===t[s]})||(t=n,r=e.apply(void 0,n)),r}}function Fa(e){return!!(e||"").match(/\d/)}function ks(e){return e==null}function Qk(e){return typeof e=="number"&&isNaN(e)}function v2(e){return ks(e)||Qk(e)||typeof e=="number"&&!isFinite(e)}function y2(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function eD(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function tD(e,t,r){var n=eD(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function rD(e){var t=te.useRef(e);t.current=e;var r=te.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Lh(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),o=i[0],s=i[1]||"";return{beforeDecimal:o,afterDecimal:s,hasNegation:r,addNegation:n}}function nD(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function w2(e,t,r){for(var n="",i=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||i;return n}function b2(e,t){return Array(t+1).join(e)}function x2(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],o=n[1];if(o=Number(o),!o)return r+i;i=i.replace(".","");var s=1+o,a=i.length;return s<0?i="0."+b2("0",Math.abs(s))+i:s>=a?i=i+b2("0",s-a):i=(i.substring(0,s)||"0")+"."+i.substring(s),r+i}function S2(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Lh(e),o=i.beforeDecimal,s=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(s||"0")),u=s.length<=t?"0."+s:c.toFixed(t),l=u.split("."),d=o;o&&Number(l[0])&&(d=o.split("").reverse().reduce(function(y,T,O){return y.length>O?(Number(y[0])+Number(T)).toString()+y.substring(1,y.length):T+y},l[0]));var p=w2(l[1]||"",t,r),w=a?"-":"",b=n?".":"";return""+w+d+b+p}function ko(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var E2=Jk(function(e,t){for(var r=0,n=0,i=e.length,o=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[o-1-n]&&o-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:o-n}}}),iD=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function oD(e,t,r){return Math.min(Math.max(e,t),r)}function $h(e){return Math.max(e.selectionStart,e.selectionEnd)}function sD(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function aD(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function cD(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function uD(e,t,r,n,i,o,s){s===void 0&&(s=cD);var a=i.findIndex(function(F){return F}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,d={},p=new Array(u),w=0;w<u;w++){p[w]=-1;for(var b=0,y=l;b<y;b++){var T=s({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:w,formattedValueIndex:b});if(T&&d[b]!==!0){p[w]=b,d[b]=!0;break}}}for(var O=n;O<u&&(p[O]===-1||!o(r[O]));)O++;var R=O===u||p[O]===-1?l:p[O];for(O=n-1;O>0&&p[O]===-1;)O--;var k=O===-1||p[O]===-1?0:p[O]+1;return k>R?R:n-k<R-n?k:R}function _2(e,t,r,n){var i=e.length;if(t=oD(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function lD(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Fa(e[r])||Fa(e[r-1]));return t}function C2(e,t,r,n,i,o){o===void 0&&(o=ro);var s=rD(function(b,y){var T,O;return v2(b)?(O="",T=""):typeof b=="number"||y?(O=typeof b=="number"?x2(b):b,T=n(O)):(O=i(b,void 0),T=n(O)),{formattedValue:T,numAsString:O}}),a=te.useState(function(){return s(ks(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,y){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),o(b,y)},d=e,p=r;ks(e)&&(d=c.numAsString,p=!0);var w=s(d,p);return te.useMemo(function(){u(w)},[w.formattedValue]),[c,l]}function fD(e){return e.replace(/[^0-9]/g,"")}function dD(e){return e}function hD(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,o=e.getInputRef,s=e.format;s===void 0&&(s=dD);var a=e.removeFormatting;a===void 0&&(a=fD);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,d=e.isAllowed,p=e.onChange;p===void 0&&(p=ro);var w=e.onKeyDown;w===void 0&&(w=ro);var b=e.onMouseUp;b===void 0&&(b=ro);var y=e.onFocus;y===void 0&&(y=ro);var T=e.onBlur;T===void 0&&(T=ro);var O=e.value,R=e.getCaretBoundary;R===void 0&&(R=lD);var k=e.isValidInputCharacter;k===void 0&&(k=Fa);var F=e.isCharacterSame,L=g2(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),q=C2(O,c,!!u,s,a,l),H=q[0],K=H.formattedValue,re=H.numAsString,oe=q[1],ae=te.useRef(),z=te.useRef({formattedValue:K,numAsString:re}),D=function(we,he){z.current={formattedValue:we.formattedValue,numAsString:we.value},oe(we,he)},h=te.useState(!1),f=h[0],m=h[1],S=te.useRef(null),M=te.useRef({setCaretTimeout:null,focusTimeout:null});te.useEffect(function(){return m(!0),function(){clearTimeout(M.current.setCaretTimeout),clearTimeout(M.current.focusTimeout)}},[]);var _=s,I=function(we,he){var Ce=parseFloat(he);return{formattedValue:we,value:he,floatValue:isNaN(Ce)?void 0:Ce}},C=function(we,he,Ce){we.selectionStart===0&&we.selectionEnd===we.value.length||(ko(we,he),M.current.setCaretTimeout=setTimeout(function(){we.value===Ce&&we.selectionStart!==he&&ko(we,he)},0))},g=function(we,he,Ce){return _2(we,he,R(we),Ce)},v=function(we,he,Ce){var Ue=R(he),Ne=uD(he,K,we,Ce,Ue,k,F);return Ne=_2(he,Ne,Ue),Ne},N=function(we){var he=we.formattedValue;he===void 0&&(he="");var Ce=we.input,Ue=we.source,Ne=we.event,Me=we.numAsString,Te;if(Ce){var Be=we.inputValue||Ce.value,ut=$h(Ce);Ce.value=he,Te=v(Be,he,ut),Te!==void 0&&C(Ce,Te,he)}he!==K&&D(I(he,Me),{event:Ne,source:Ue})};te.useEffect(function(){var we=z.current,he=we.formattedValue,Ce=we.numAsString;(K!==he||re!==Ce)&&D(I(K,re),{event:void 0,source:$a.props})},[K,re]);var ee=S.current?$h(S.current):void 0,ie=typeof window<"u"?te.useLayoutEffect:te.useEffect;ie(function(){var we=S.current;if(K!==z.current.formattedValue&&we){var he=v(z.current.formattedValue,K,ee);we.value=K,C(we,he,K)}},[K]);var le=function(we,he,Ce){var Ue=he.target,Ne=ae.current?iD(ae.current,Ue.selectionEnd):E2(K,we),Me=Object.assign(Object.assign({},Ne),{lastValue:K}),Te=a(we,Me),Be=_(Te);if(Te=a(Be,void 0),d&&!d(I(Be,Te))){var ut=he.target,lt=$h(ut),ze=v(we,K,lt);return ut.value=K,C(ut,ze,K),!1}return N({formattedValue:Be,numAsString:Te,inputValue:we,event:he,source:Ce,input:he.target}),!0},me=function(we,he){he===void 0&&(he=0);var Ce=we.selectionStart,Ue=we.selectionEnd;ae.current={selectionStart:Ce,selectionEnd:Ue+he}},xe=function(we){var he=we.target,Ce=he.value,Ue=le(Ce,we,$a.event);Ue&&p(we),ae.current=void 0},be=function(we){var he=we.target,Ce=we.key,Ue=he.selectionStart,Ne=he.selectionEnd,Me=he.value;Me===void 0&&(Me="");var Te;Ce==="ArrowLeft"||Ce==="Backspace"?Te=Math.max(Ue-1,0):Ce==="ArrowRight"?Te=Math.min(Ue+1,Me.length):Ce==="Delete"&&(Te=Ue);var Be=0;Ce==="Delete"&&Ue===Ne&&(Be=1);var ut=Ce==="ArrowLeft"||Ce==="ArrowRight";if(Te===void 0||Ue!==Ne&&!ut){w(we),me(he,Be);return}var lt=Te;if(ut){var ze=Ce==="ArrowLeft"?"left":"right";lt=g(Me,Te,ze),lt!==Te&&we.preventDefault()}else Ce==="Delete"&&!k(Me[Te])?lt=g(Me,Te,"right"):Ce==="Backspace"&&!k(Me[Te])&&(lt=g(Me,Te,"left"));lt!==Te&&C(he,lt,Me),w(we),me(he,Be)},Ve=function(we){var he=we.target,Ce=function(){var Ue=he.selectionStart,Ne=he.selectionEnd,Me=he.value;if(Me===void 0&&(Me=""),Ue===Ne){var Te=g(Me,Ue);Te!==Ue&&C(he,Te,Me)}};Ce(),requestAnimationFrame(function(){Ce()}),b(we),me(he)},Le=function(we){we.persist&&we.persist();var he=we.target,Ce=we.currentTarget;S.current=he,M.current.focusTimeout=setTimeout(function(){var Ue=he.selectionStart,Ne=he.selectionEnd,Me=he.value;Me===void 0&&(Me="");var Te=g(Me,Ue);Te!==Ue&&!(Ue===0&&Ne===Me.length)&&C(he,Te,Me),y(Object.assign(Object.assign({},we),{currentTarget:Ce}))},0)},ft=function(we){S.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),T(we)},dt=f&&sD()?"numeric":void 0,je=Object.assign({inputMode:dt},L,{type:t,value:K,onChange:xe,onKeyDown:be,onMouseUp:Ve,onFocus:Le,onBlur:ft});if(r==="text")return i?te.createElement(te.Fragment,null,i(K,L)||null):te.createElement("span",Object.assign({},L,{ref:o}),K);if(n){var mt=n;return te.createElement(mt,Object.assign({},je,{ref:o}))}return te.createElement("input",Object.assign({},je,{ref:o}))}function M2(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var o=t.suffix;o===void 0&&(o="");var s=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=Qu(t),u=c.thousandSeparator,l=c.decimalSeparator,d=r!==0&&e.indexOf(".")!==-1||r&&n,p=Lh(e,s),w=p.beforeDecimal,b=p.afterDecimal,y=p.addNegation;return r!==void 0&&(b=w2(b,r,!!n)),u&&(w=tD(w,u,a)),i&&(w=i+w),o&&(b=b+o),y&&(w="-"+w),e=w+(d&&l||"")+b,e}function Qu(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function pD(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),i&&!o&&t&&(e="-"+e),e}function mD(e,t){return new RegExp("(^-)|[0-9]|"+y2(e),t?"g":void 0)}function gD(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function vD(e,t,r){var n;t===void 0&&(t=aD(e));var i=r.allowNegative,o=r.prefix;o===void 0&&(o="");var s=r.suffix;s===void 0&&(s="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,d=u.end,p=Qu(r),w=p.allowedDecimalSeparators,b=p.decimalSeparator,y=e[d]===b;if(Fa(e)&&(e===o||e===s)&&t.lastValue==="")return e;if(d-l===1&&w.indexOf(e[l])!==-1){var T=a===0?"":b;e=e.substring(0,l)+T+e.substring(l+1,e.length)}var O=function(S,M,_){var I=!1,C=!1;o.startsWith("-")?I=!1:S.startsWith("--")?(I=!1,C=!0):s.startsWith("-")&&S.length===s.length?I=!1:S[0]==="-"&&(I=!0);var g=I?1:0;return C&&(g=2),g&&(S=S.substring(g),M-=g,_-=g),{value:S,start:M,end:_,hasNegation:I}},R=O(e,l,d),k=R.hasNegation;n=R,e=n.value,l=n.start,d=n.end;var F=O(t.lastValue,c.start,c.end),L=F.start,q=F.end,H=F.value,K=e.substring(l,d);e.length&&H.length&&(L>H.length-s.length||q<o.length)&&!(K&&s.startsWith(K))&&(e=H);var re=0;e.startsWith(o)?re+=o.length:l<o.length&&(re=l),e=e.substring(re),d-=re;var oe=e.length,ae=e.length-s.length;e.endsWith(s)?oe=ae:(d>ae||d>e.length-s.length)&&(oe=d),e=e.substring(0,oe),e=pD(k?"-"+e:e,i),e=(e.match(mD(b,!0))||[]).join("");var z=e.indexOf(b);e=e.replace(new RegExp(y2(b),"g"),function(S,M){return M===z?".":""});var D=Lh(e,i),h=D.beforeDecimal,f=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&h===""&&y&&!parseFloat(f)&&(e=m?"-":""),e}function yD(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),o=e[0]==="-";i.fill(!1,0,r.length+(o?1:0));var s=e.length;return i.fill(!1,s-n.length+1,s+1),i}function wD(e){var t=Qu(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var o=e.allowNegative;if(o===void 0&&(o=!0),r===n)throw new Error(`
102
+ `})]})}function Ch({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[o,s]=ne.useState(!0),a=gb(o,r,n);return w.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{s(!o)},children:[w.jsx(Gr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url}),w.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",hn(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?w.jsx(Ps,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):Dr(a,t==null?void 0:t.decimals)," ",hn(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),w.jsx(Gr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Fu(){const[e,t]=ne.useState(window.innerWidth),r=_h(()=>{t(window.innerWidth)},300);ne.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=ne.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function bb(e,t,r,n){const{getTokenPrice:i}=$o(),o=i(e==null?void 0:e.coin_type),s=i(t==null?void 0:t.coin_type),a=gb(!0,r,n),c=ne.useMemo(()=>{if(s&&o)return Le(o.price).div(s.price).toString()},[o==null?void 0:o.price,s==null?void 0:s.price]),u=ne.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=ne.useMemo(()=>{const y=[];return o&&y.push(o.market),s&&!y.includes(s.market)&&y.push(s.market),y},[o==null?void 0:o.market,s==null?void 0:s.market]),d=ne.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),p=ne.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]),b=ne.useMemo(()=>{let y,T="yellow";if(u)if(Le(u).gt(0))T="green",Le(u).lt(.1)?y="< 0.1% cheaper than":y=`${Dr(u,2,!0,$r.ROUND_UP)}% cheaper than`;else if(Le(u).eq(0))y="0%",T="green";else{const O=Le(u).abs();O.lte(5)?(T="green",y=`Within ${Dr(O.toString(),2,!0,$r.ROUND_UP)}%`):O.lte(10)?(T="yellow",y=`${Dr(O.toString(),2,!0,$r.ROUND_UP)}% more than`):O.lte(100)?(T="red",y=`${Dr(O.toString(),2,!0,$r.ROUND_UP)}% more than`):(T="red",y="> 100% more than")}return{priceImpactText:y,textColor:T}},[u]),x=ne.useMemo(()=>(o==null?void 0:o.market)==="Cetus"||(s==null?void 0:s.market)==="Cetus",[o,s]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:d,showPriceImpactWarn:p,priceImpactTextInfo:b,hideShowPriceImpact:x}}function Uu({content:e,children:t,position:r="top",delay:n=0}){const[i,o]=ne.useState(!1),[s,a]=ne.useState(!1),c=ne.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),o(!0)};ne.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{s||(o(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},d=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},p=ne.useRef(null),[b,x]=ne.useState({left:void 0,top:void 0});return ne.useEffect(()=>{var y;if(i&&p.current){const T=(y=p.current)==null?void 0:y.getBoundingClientRect();let O,N;r==="top"?(O=`${window.scrollX+T.left+T.width/2}px`,N=`${window.scrollY+T.top-2*T.height-8}px`):r==="bottom"?(O=`${window.scrollX+T.left+T.width/2}px`,N=`${window.scrollY+T.bottom}px`):r==="left"?(O=`${window.scrollX+T.left-8}px`,N=`${window.scrollY+T.top+T.height/2}px`):r==="right"?(O=`${window.scrollX+T.right+8}px`,N=`${window.scrollY+T.top+T.height/2}px`):(O=`${window.scrollX+T.left+T.width/2}px`,N=`${window.scrollY+T.top+T.height/2}px`),x({left:O,top:N})}},[i]),w.jsxs("div",{ref:p,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&$n.createPortal(w.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:i?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...d(),...b},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),o(!1)},children:e}),document.body)]})}function xb({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Fu();return i&&n?w.jsxs(gn.Root,{children:[w.jsx(gn.Trigger,{children:w.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),w.jsx(gn.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):w.jsx(Uu,{content:e,position:r,children:t})}function Sb({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=vn();Fu();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l,hideShowPriceImpact:d}=bb(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return w.jsx(w.Fragment,{children:d?w.jsx(w.Fragment,{}):w.jsxs(w.Fragment,{children:[!r&&Le(a).lte(-30)&&w.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),w.jsxs("div",{className:"price-impact-block",children:[w.jsxs("div",{className:"left",children:[w.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),w.jsx(xb,{autoSwitchTooltip:!0,position:"top",content:w.jsx(dP,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{children:[e&&w.jsx(Ps,{style:{width:"80px",height:"20px"}}),!e&&w.jsxs("div",{className:"right",children:[w.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),w.jsx("div",{className:"platforms",children:c.map(p=>w.jsx(Uu,{content:w.jsx("span",{style:{fontSize:"12px"},children:G1[p]}),position:"top",delay:300,children:w.jsx(Gr,{src:LA[p]})},p))})]})]})]})]})})}function dP({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:o}=Fu();return w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[w.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),w.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[w.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?w.jsx(Ch,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):w.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[w.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),w.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(s=>G1[s]+" ").join("")})]})]})}function Eb({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:o,byAmountIn:s}=vn();return w.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[w.jsx("div",{className:"left",children:s?"Minimum Received":"Maximum Sold"}),n?w.jsx(Ps,{style:{height:"18px",width:"80px"}}):w.jsxs("div",{className:"right",children:[Dr(r,s?o==null?void 0:o.decimals:i==null?void 0:i.decimals,!1,$r.ROUND_DOWN)," ",hn(s?(o==null?void 0:o.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function hP({scamsText:e}){return w.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[w.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),w.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:w.jsx(X1,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function pP({onClick:e}){return w.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-back"})}),w.jsx("span",{children:"Back"})]})}function Ah({title:e,backClick:t}){return w.jsxs("div",{className:"cs-have-back-header",children:[w.jsx(pP,{onClick:t}),w.jsx("span",{className:"title",children:e})]})}const Vu=globalThis||void 0||self;var mP=typeof Vu=="object"&&Vu&&Vu.Object===Object&&Vu;const _b=mP;var gP=typeof self=="object"&&self&&self.Object===Object&&self,vP=_b||gP||Function("return this")();const ni=vP;var yP=ni.Symbol;const ii=yP;var Cb=Object.prototype,wP=Cb.hasOwnProperty,bP=Cb.toString,Da=ii?ii.toStringTag:void 0;function xP(e){var t=wP.call(e,Da),r=e[Da];try{e[Da]=void 0;var n=!0}catch{}var i=bP.call(e);return n&&(t?e[Da]=r:delete e[Da]),i}var SP=Object.prototype,EP=SP.toString;function _P(e){return EP.call(e)}var CP="[object Null]",AP="[object Undefined]",Ab=ii?ii.toStringTag:void 0;function ks(e){return e==null?e===void 0?AP:CP:Ab&&Ab in Object(e)?xP(e):_P(e)}function so(e){return e!=null&&typeof e=="object"}var MP="[object Symbol]";function Ba(e){return typeof e=="symbol"||so(e)&&ks(e)==MP}function zu(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var TP=Array.isArray;const Kr=TP;var IP=1/0,Mb=ii?ii.prototype:void 0,Tb=Mb?Mb.toString:void 0;function Ib(e){if(typeof e=="string")return e;if(Kr(e))return zu(e,Ib)+"";if(Ba(e))return Tb?Tb.call(e):"";var t=e+"";return t=="0"&&1/e==-IP?"-0":t}function Ds(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ob(e){return e}var OP="[object AsyncFunction]",PP="[object Function]",RP="[object GeneratorFunction]",NP="[object Proxy]";function Pb(e){if(!Ds(e))return!1;var t=ks(e);return t==PP||t==RP||t==OP||t==NP}var jP=ni["__core-js_shared__"];const Mh=jP;var Rb=function(){var e=/[^.]+$/.exec(Mh&&Mh.keys&&Mh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kP(e){return!!Rb&&Rb in e}var DP=Function.prototype,BP=DP.toString;function Vo(e){if(e!=null){try{return BP.call(e)}catch{}try{return e+""}catch{}}return""}var LP=/[\\^$.*+?()[\]{}|]/g,$P=/^\[object .+?Constructor\]$/,FP=Function.prototype,UP=Object.prototype,VP=FP.toString,zP=UP.hasOwnProperty,HP=RegExp("^"+VP.call(zP).replace(LP,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qP(e){if(!Ds(e)||kP(e))return!1;var t=Pb(e)?HP:$P;return t.test(Vo(e))}function WP(e,t){return e==null?void 0:e[t]}function zo(e,t){var r=WP(e,t);return qP(r)?r:void 0}var GP=zo(ni,"WeakMap");const Th=GP;var Nb=Object.create,KP=function(){function e(){}return function(t){if(!Ds(t))return{};if(Nb)return Nb(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const YP=KP;function ZP(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var XP=function(){try{var e=zo(Object,"defineProperty");return e({},"",{}),e}catch{}}();const jb=XP;function JP(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var QP=9007199254740991,eR=/^(?:0|[1-9]\d*)$/;function kb(e,t){var r=typeof e;return t=t??QP,!!t&&(r=="number"||r!="symbol"&&eR.test(e))&&e>-1&&e%1==0&&e<t}function Db(e,t,r){t=="__proto__"&&jb?jb(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Ih(e,t){return e===t||e!==e&&t!==t}var tR=Object.prototype,rR=tR.hasOwnProperty;function Bb(e,t,r){var n=e[t];(!(rR.call(e,t)&&Ih(n,r))||r===void 0&&!(t in e))&&Db(e,t,r)}function Hu(e,t,r,n){var i=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var a=t[o],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?Db(r,a,c):Bb(r,a,c)}return r}var nR=9007199254740991;function Oh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=nR}function qu(e){return e!=null&&Oh(e.length)&&!Pb(e)}var iR=Object.prototype;function Ph(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||iR;return e===r}function oR(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var sR="[object Arguments]";function Lb(e){return so(e)&&ks(e)==sR}var $b=Object.prototype,aR=$b.hasOwnProperty,cR=$b.propertyIsEnumerable,uR=Lb(function(){return arguments}())?Lb:function(e){return so(e)&&aR.call(e,"callee")&&!cR.call(e,"callee")};const Fb=uR;function lR(){return!1}var Ub=typeof qt=="object"&&qt&&!qt.nodeType&&qt,Vb=Ub&&typeof module=="object"&&module&&!module.nodeType&&module,fR=Vb&&Vb.exports===Ub,zb=fR?ni.Buffer:void 0,dR=zb?zb.isBuffer:void 0,hR=dR||lR;const Wu=hR;var pR="[object Arguments]",mR="[object Array]",gR="[object Boolean]",vR="[object Date]",yR="[object Error]",wR="[object Function]",bR="[object Map]",xR="[object Number]",SR="[object Object]",ER="[object RegExp]",_R="[object Set]",CR="[object String]",AR="[object WeakMap]",MR="[object ArrayBuffer]",TR="[object DataView]",IR="[object Float32Array]",OR="[object Float64Array]",PR="[object Int8Array]",RR="[object Int16Array]",NR="[object Int32Array]",jR="[object Uint8Array]",kR="[object Uint8ClampedArray]",DR="[object Uint16Array]",BR="[object Uint32Array]",Qt={};Qt[IR]=Qt[OR]=Qt[PR]=Qt[RR]=Qt[NR]=Qt[jR]=Qt[kR]=Qt[DR]=Qt[BR]=!0,Qt[pR]=Qt[mR]=Qt[MR]=Qt[gR]=Qt[TR]=Qt[vR]=Qt[yR]=Qt[wR]=Qt[bR]=Qt[xR]=Qt[SR]=Qt[ER]=Qt[_R]=Qt[CR]=Qt[AR]=!1;function LR(e){return so(e)&&Oh(e.length)&&!!Qt[ks(e)]}function Gu(e){return function(t){return e(t)}}var Hb=typeof qt=="object"&&qt&&!qt.nodeType&&qt,La=Hb&&typeof module=="object"&&module&&!module.nodeType&&module,$R=La&&La.exports===Hb,Rh=$R&&_b.process,FR=function(){try{var e=La&&La.require&&La.require("util").types;return e||Rh&&Rh.binding&&Rh.binding("util")}catch{}}();const Bs=FR;var qb=Bs&&Bs.isTypedArray,UR=qb?Gu(qb):LR;const Wb=UR;var VR=Object.prototype,zR=VR.hasOwnProperty;function Gb(e,t){var r=Kr(e),n=!r&&Fb(e),i=!r&&!n&&Wu(e),o=!r&&!n&&!i&&Wb(e),s=r||n||i||o,a=s?oR(e.length,String):[],c=a.length;for(var u in e)(t||zR.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||kb(u,c)))&&a.push(u);return a}function Kb(e,t){return function(r){return e(t(r))}}var HR=Kb(Object.keys,Object);const qR=HR;var WR=Object.prototype,GR=WR.hasOwnProperty;function KR(e){if(!Ph(e))return qR(e);var t=[];for(var r in Object(e))GR.call(e,r)&&r!="constructor"&&t.push(r);return t}function $a(e){return qu(e)?Gb(e):KR(e)}function YR(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var ZR=Object.prototype,XR=ZR.hasOwnProperty;function JR(e){if(!Ds(e))return YR(e);var t=Ph(e),r=[];for(var n in e)n=="constructor"&&(t||!XR.call(e,n))||r.push(n);return r}function Nh(e){return qu(e)?Gb(e,!0):JR(e)}var QR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eN=/^\w*$/;function jh(e,t){if(Kr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ba(e)?!0:eN.test(e)||!QR.test(e)||t!=null&&e in Object(t)}var tN=zo(Object,"create");const Fa=tN;function rN(){this.__data__=Fa?Fa(null):{},this.size=0}function nN(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var iN="__lodash_hash_undefined__",oN=Object.prototype,sN=oN.hasOwnProperty;function aN(e){var t=this.__data__;if(Fa){var r=t[e];return r===iN?void 0:r}return sN.call(t,e)?t[e]:void 0}var cN=Object.prototype,uN=cN.hasOwnProperty;function lN(e){var t=this.__data__;return Fa?t[e]!==void 0:uN.call(t,e)}var fN="__lodash_hash_undefined__";function dN(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Fa&&t===void 0?fN:t,this}function Ho(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ho.prototype.clear=rN,Ho.prototype.delete=nN,Ho.prototype.get=aN,Ho.prototype.has=lN,Ho.prototype.set=dN;function hN(){this.__data__=[],this.size=0}function Ku(e,t){for(var r=e.length;r--;)if(Ih(e[r][0],t))return r;return-1}var pN=Array.prototype,mN=pN.splice;function gN(e){var t=this.__data__,r=Ku(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():mN.call(t,r,1),--this.size,!0}function vN(e){var t=this.__data__,r=Ku(t,e);return r<0?void 0:t[r][1]}function yN(e){return Ku(this.__data__,e)>-1}function wN(e,t){var r=this.__data__,n=Ku(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Pi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Pi.prototype.clear=hN,Pi.prototype.delete=gN,Pi.prototype.get=vN,Pi.prototype.has=yN,Pi.prototype.set=wN;var bN=zo(ni,"Map");const Ua=bN;function xN(){this.size=0,this.__data__={hash:new Ho,map:new(Ua||Pi),string:new Ho}}function SN(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yu(e,t){var r=e.__data__;return SN(t)?r[typeof t=="string"?"string":"hash"]:r.map}function EN(e){var t=Yu(this,e).delete(e);return this.size-=t?1:0,t}function _N(e){return Yu(this,e).get(e)}function CN(e){return Yu(this,e).has(e)}function AN(e,t){var r=Yu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ri(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ri.prototype.clear=xN,Ri.prototype.delete=EN,Ri.prototype.get=_N,Ri.prototype.has=CN,Ri.prototype.set=AN;var MN="Expected a function";function kh(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(MN);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(kh.Cache||Ri),r}kh.Cache=Ri;var TN=500;function IN(e){var t=kh(e,function(n){return r.size===TN&&r.clear(),n}),r=t.cache;return t}var ON=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PN=/\\(\\)?/g,RN=IN(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ON,function(r,n,i,o){t.push(i?o.replace(PN,"$1"):n||r)}),t});const NN=RN;function jN(e){return e==null?"":Ib(e)}function Yb(e,t){return Kr(e)?e:jh(e,t)?[e]:NN(jN(e))}var kN=1/0;function Zu(e){if(typeof e=="string"||Ba(e))return e;var t=e+"";return t=="0"&&1/e==-kN?"-0":t}function Dh(e,t){t=Yb(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Zu(t[r++])];return r&&r==n?e:void 0}function DN(e,t,r){var n=e==null?void 0:Dh(e,t);return n===void 0?r:n}function Zb(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var BN=Kb(Object.getPrototypeOf,Object);const Xb=BN;function LN(){this.__data__=new Pi,this.size=0}function $N(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function FN(e){return this.__data__.get(e)}function UN(e){return this.__data__.has(e)}var VN=200;function zN(e,t){var r=this.__data__;if(r instanceof Pi){var n=r.__data__;if(!Ua||n.length<VN-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ri(n)}return r.set(e,t),this.size=r.size,this}function oi(e){var t=this.__data__=new Pi(e);this.size=t.size}oi.prototype.clear=LN,oi.prototype.delete=$N,oi.prototype.get=FN,oi.prototype.has=UN,oi.prototype.set=zN;function HN(e,t){return e&&Hu(t,$a(t),e)}function qN(e,t){return e&&Hu(t,Nh(t),e)}var Jb=typeof qt=="object"&&qt&&!qt.nodeType&&qt,Qb=Jb&&typeof module=="object"&&module&&!module.nodeType&&module,WN=Qb&&Qb.exports===Jb,e2=WN?ni.Buffer:void 0,t2=e2?e2.allocUnsafe:void 0;function GN(e,t){if(t)return e.slice();var r=e.length,n=t2?t2(r):new e.constructor(r);return e.copy(n),n}function r2(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function n2(){return[]}var KN=Object.prototype,YN=KN.propertyIsEnumerable,i2=Object.getOwnPropertySymbols,ZN=i2?function(e){return e==null?[]:(e=Object(e),r2(i2(e),function(t){return YN.call(e,t)}))}:n2;const Bh=ZN;function XN(e,t){return Hu(e,Bh(e),t)}var JN=Object.getOwnPropertySymbols,QN=JN?function(e){for(var t=[];e;)Zb(t,Bh(e)),e=Xb(e);return t}:n2;const o2=QN;function ej(e,t){return Hu(e,o2(e),t)}function s2(e,t,r){var n=t(e);return Kr(e)?n:Zb(n,r(e))}function Lh(e){return s2(e,$a,Bh)}function tj(e){return s2(e,Nh,o2)}var rj=zo(ni,"DataView");const $h=rj;var nj=zo(ni,"Promise");const Fh=nj;var ij=zo(ni,"Set");const Uh=ij;var a2="[object Map]",oj="[object Object]",c2="[object Promise]",u2="[object Set]",l2="[object WeakMap]",f2="[object DataView]",sj=Vo($h),aj=Vo(Ua),cj=Vo(Fh),uj=Vo(Uh),lj=Vo(Th),qo=ks;($h&&qo(new $h(new ArrayBuffer(1)))!=f2||Ua&&qo(new Ua)!=a2||Fh&&qo(Fh.resolve())!=c2||Uh&&qo(new Uh)!=u2||Th&&qo(new Th)!=l2)&&(qo=function(e){var t=ks(e),r=t==oj?e.constructor:void 0,n=r?Vo(r):"";if(n)switch(n){case sj:return f2;case aj:return a2;case cj:return c2;case uj:return u2;case lj:return l2}return t});const Va=qo;var fj=Object.prototype,dj=fj.hasOwnProperty;function hj(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&dj.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var pj=ni.Uint8Array;const Xu=pj;function Vh(e){var t=new e.constructor(e.byteLength);return new Xu(t).set(new Xu(e)),t}function mj(e,t){var r=t?Vh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var gj=/\w*$/;function vj(e){var t=new e.constructor(e.source,gj.exec(e));return t.lastIndex=e.lastIndex,t}var d2=ii?ii.prototype:void 0,h2=d2?d2.valueOf:void 0;function yj(e){return h2?Object(h2.call(e)):{}}function wj(e,t){var r=t?Vh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var bj="[object Boolean]",xj="[object Date]",Sj="[object Map]",Ej="[object Number]",_j="[object RegExp]",Cj="[object Set]",Aj="[object String]",Mj="[object Symbol]",Tj="[object ArrayBuffer]",Ij="[object DataView]",Oj="[object Float32Array]",Pj="[object Float64Array]",Rj="[object Int8Array]",Nj="[object Int16Array]",jj="[object Int32Array]",kj="[object Uint8Array]",Dj="[object Uint8ClampedArray]",Bj="[object Uint16Array]",Lj="[object Uint32Array]";function $j(e,t,r){var n=e.constructor;switch(t){case Tj:return Vh(e);case bj:case xj:return new n(+e);case Ij:return mj(e,r);case Oj:case Pj:case Rj:case Nj:case jj:case kj:case Dj:case Bj:case Lj:return wj(e,r);case Sj:return new n;case Ej:case Aj:return new n(e);case _j:return vj(e);case Cj:return new n;case Mj:return yj(e)}}function Fj(e){return typeof e.constructor=="function"&&!Ph(e)?YP(Xb(e)):{}}var Uj="[object Map]";function Vj(e){return so(e)&&Va(e)==Uj}var p2=Bs&&Bs.isMap,zj=p2?Gu(p2):Vj;const Hj=zj;var qj="[object Set]";function Wj(e){return so(e)&&Va(e)==qj}var m2=Bs&&Bs.isSet,Gj=m2?Gu(m2):Wj;const Kj=Gj;var Yj=1,Zj=2,Xj=4,g2="[object Arguments]",Jj="[object Array]",Qj="[object Boolean]",ek="[object Date]",tk="[object Error]",v2="[object Function]",rk="[object GeneratorFunction]",nk="[object Map]",ik="[object Number]",y2="[object Object]",ok="[object RegExp]",sk="[object Set]",ak="[object String]",ck="[object Symbol]",uk="[object WeakMap]",lk="[object ArrayBuffer]",fk="[object DataView]",dk="[object Float32Array]",hk="[object Float64Array]",pk="[object Int8Array]",mk="[object Int16Array]",gk="[object Int32Array]",vk="[object Uint8Array]",yk="[object Uint8ClampedArray]",wk="[object Uint16Array]",bk="[object Uint32Array]",Xt={};Xt[g2]=Xt[Jj]=Xt[lk]=Xt[fk]=Xt[Qj]=Xt[ek]=Xt[dk]=Xt[hk]=Xt[pk]=Xt[mk]=Xt[gk]=Xt[nk]=Xt[ik]=Xt[y2]=Xt[ok]=Xt[sk]=Xt[ak]=Xt[ck]=Xt[vk]=Xt[yk]=Xt[wk]=Xt[bk]=!0,Xt[tk]=Xt[v2]=Xt[uk]=!1;function Ju(e,t,r,n,i,o){var s,a=t&Yj,c=t&Zj,u=t&Xj;if(r&&(s=i?r(e,n,i,o):r(e)),s!==void 0)return s;if(!Ds(e))return e;var l=Kr(e);if(l){if(s=hj(e),!a)return ZP(e,s)}else{var d=Va(e),p=d==v2||d==rk;if(Wu(e))return GN(e,a);if(d==y2||d==g2||p&&!i){if(s=c||p?{}:Fj(e),!a)return c?ej(e,qN(s,e)):XN(e,HN(s,e))}else{if(!Xt[d])return i?e:{};s=$j(e,d,a)}}o||(o=new oi);var b=o.get(e);if(b)return b;o.set(e,s),Kj(e)?e.forEach(function(T){s.add(Ju(T,t,r,T,e,o))}):Hj(e)&&e.forEach(function(T,O){s.set(O,Ju(T,t,r,O,e,o))});var x=u?c?tj:Lh:c?Nh:$a,y=l?void 0:x(e);return JP(y||e,function(T,O){y&&(O=T,T=e[O]),Bb(s,O,Ju(T,t,r,O,e,o))}),s}var xk=1,Sk=4;function Ek(e){return Ju(e,xk|Sk)}var _k="__lodash_hash_undefined__";function Ck(e){return this.__data__.set(e,_k),this}function Ak(e){return this.__data__.has(e)}function Qu(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ri;++t<r;)this.add(e[t])}Qu.prototype.add=Qu.prototype.push=Ck,Qu.prototype.has=Ak;function Mk(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function Tk(e,t){return e.has(t)}var Ik=1,Ok=2;function w2(e,t,r,n,i,o){var s=r&Ik,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var d=-1,p=!0,b=r&Ok?new Qu:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var x=e[d],y=t[d];if(n)var T=s?n(y,x,d,t,e,o):n(x,y,d,e,t,o);if(T!==void 0){if(T)continue;p=!1;break}if(b){if(!Mk(t,function(O,N){if(!Tk(b,N)&&(x===O||i(x,O,r,n,o)))return b.push(N)})){p=!1;break}}else if(!(x===y||i(x,y,r,n,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function Pk(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function Rk(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Nk=1,jk=2,kk="[object Boolean]",Dk="[object Date]",Bk="[object Error]",Lk="[object Map]",$k="[object Number]",Fk="[object RegExp]",Uk="[object Set]",Vk="[object String]",zk="[object Symbol]",Hk="[object ArrayBuffer]",qk="[object DataView]",b2=ii?ii.prototype:void 0,zh=b2?b2.valueOf:void 0;function Wk(e,t,r,n,i,o,s){switch(r){case qk:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Hk:return!(e.byteLength!=t.byteLength||!o(new Xu(e),new Xu(t)));case kk:case Dk:case $k:return Ih(+e,+t);case Bk:return e.name==t.name&&e.message==t.message;case Fk:case Vk:return e==t+"";case Lk:var a=Pk;case Uk:var c=n&Nk;if(a||(a=Rk),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=jk,s.set(e,t);var l=w2(a(e),a(t),n,i,o,s);return s.delete(e),l;case zk:if(zh)return zh.call(e)==zh.call(t)}return!1}var Gk=1,Kk=Object.prototype,Yk=Kk.hasOwnProperty;function Zk(e,t,r,n,i,o){var s=r&Gk,a=Lh(e),c=a.length,u=Lh(t),l=u.length;if(c!=l&&!s)return!1;for(var d=c;d--;){var p=a[d];if(!(s?p in t:Yk.call(t,p)))return!1}var b=o.get(e),x=o.get(t);if(b&&x)return b==t&&x==e;var y=!0;o.set(e,t),o.set(t,e);for(var T=s;++d<c;){p=a[d];var O=e[p],N=t[p];if(n)var k=s?n(N,O,p,t,e,o):n(O,N,p,e,t,o);if(!(k===void 0?O===N||i(O,N,r,n,o):k)){y=!1;break}T||(T=p=="constructor")}if(y&&!T){var F=e.constructor,L=t.constructor;F!=L&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof L=="function"&&L instanceof L)&&(y=!1)}return o.delete(e),o.delete(t),y}var Xk=1,x2="[object Arguments]",S2="[object Array]",el="[object Object]",Jk=Object.prototype,E2=Jk.hasOwnProperty;function Qk(e,t,r,n,i,o){var s=Kr(e),a=Kr(t),c=s?S2:Va(e),u=a?S2:Va(t);c=c==x2?el:c,u=u==x2?el:u;var l=c==el,d=u==el,p=c==u;if(p&&Wu(e)){if(!Wu(t))return!1;s=!0,l=!1}if(p&&!l)return o||(o=new oi),s||Wb(e)?w2(e,t,r,n,i,o):Wk(e,t,c,r,n,i,o);if(!(r&Xk)){var b=l&&E2.call(e,"__wrapped__"),x=d&&E2.call(t,"__wrapped__");if(b||x){var y=b?e.value():e,T=x?t.value():t;return o||(o=new oi),i(y,T,r,n,o)}}return p?(o||(o=new oi),Zk(e,t,r,n,i,o)):!1}function tl(e,t,r,n,i){return e===t?!0:e==null||t==null||!so(e)&&!so(t)?e!==e&&t!==t:Qk(e,t,r,n,tl,i)}var eD=1,tD=2;function rD(e,t,r,n){var i=r.length,o=i,s=!n;if(e==null)return!o;for(e=Object(e);i--;){var a=r[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=r[i];var c=a[0],u=e[c],l=a[1];if(s&&a[2]){if(u===void 0&&!(c in e))return!1}else{var d=new oi;if(n)var p=n(u,l,c,e,t,d);if(!(p===void 0?tl(l,u,eD|tD,n,d):p))return!1}}return!0}function _2(e){return e===e&&!Ds(e)}function nD(e){for(var t=$a(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,_2(i)]}return t}function C2(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function iD(e){var t=nD(e);return t.length==1&&t[0][2]?C2(t[0][0],t[0][1]):function(r){return r===e||rD(r,e,t)}}function oD(e,t){return e!=null&&t in Object(e)}function sD(e,t,r){t=Yb(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=Zu(t[n]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Oh(i)&&kb(s,i)&&(Kr(e)||Fb(e)))}function aD(e,t){return e!=null&&sD(e,t,oD)}var cD=1,uD=2;function lD(e,t){return jh(e)&&_2(t)?C2(Zu(e),t):function(r){var n=DN(r,e);return n===void 0&&n===t?aD(r,e):tl(t,n,cD|uD)}}function fD(e){return function(t){return t==null?void 0:t[e]}}function dD(e){return function(t){return Dh(t,e)}}function hD(e){return jh(e)?fD(Zu(e)):dD(e)}function A2(e){return typeof e=="function"?e:e==null?Ob:typeof e=="object"?Kr(e)?lD(e[0],e[1]):iD(e):hD(e)}function pD(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(r(o[c],c,o)===!1)break}return t}}var mD=pD();const gD=mD;function vD(e,t){return e&&gD(e,t,$a)}function yD(e,t){return function(r,n){if(r==null)return r;if(!qu(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var wD=yD(vD);const M2=wD;function bD(e,t){var r=[];return M2(e,function(n,i,o){t(n,i,o)&&r.push(n)}),r}function xD(e,t){var r=Kr(e)?r2:bD;return r(e,A2(t))}function SD(e,t){var r=-1,n=qu(e)?Array(e.length):[];return M2(e,function(i,o,s){n[++r]=t(i,o,s)}),n}function ED(e,t){return tl(e,t)}function _D(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function CD(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,o=Ba(e),s=t!==void 0,a=t===null,c=t===t,u=Ba(t);if(!a&&!u&&!o&&e>t||o&&s&&c&&!a&&!u||n&&s&&c||!r&&c||!i)return 1;if(!n&&!o&&!u&&e<t||u&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!c)return-1}return 0}function AD(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=CD(i[n],o[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function MD(e,t,r){t.length?t=zu(t,function(o){return Kr(o)?function(s){return Dh(s,o.length===1?o[0]:o)}:o}):t=[Ob];var n=-1;t=zu(t,Gu(A2));var i=SD(e,function(o,s,a){var c=zu(t,function(u){return u(o)});return{criteria:c,index:++n,value:o}});return _D(i,function(o,s){return AD(o,s,r)})}function TD(e,t,r,n){return e==null?[]:(Kr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Kr(r)||(r=r==null?[]:[r]),MD(e,t,r))}function ID({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=vn(),o=ne.useRef(!1),{slippage:s}=Fr(),[a,c]=ne.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:d}=a,{amountLimit:p}=mb(s,a),{showPriceImpactTips:b,showPriceImpactWarn:x}=bb(n,i,u,l),{priceAcceptRouterData:y}=GO(a),[T,O]=ne.useState(!1),[N,k]=ne.useState(!1);ne.useMemo(()=>d?i:n,[d]);const F=ne.useMemo(()=>y!==void 0,[y]),L=()=>{if(y){if(o.current)return;o.current=!0;const z=Ek(y);c(z),setTimeout(()=>{o.current=!1},300)}},W=ne.useMemo(()=>T?!1:!!x,[T,x]);return w.jsxs("div",{className:"secondary-dialog",children:[w.jsx(Ah,{title:"Review your order",backClick:e}),w.jsxs("div",{className:"secondary-content",children:[w.jsxs("div",{className:"trade-info",children:[w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:hs(u||"")}),w.jsx("img",{src:n==null?void 0:n.logo_url}),w.jsx("span",{className:"symbol",children:hn((n==null?void 0:n.symbol)||"")})]}),w.jsx("div",{className:"dividing-line",children:w.jsx("div",{className:"swap-icon",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-trade"})})})}),w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:hs(l||"")}),w.jsx("img",{src:i==null?void 0:i.logo_url}),w.jsx("span",{className:"symbol",children:hn((i==null?void 0:i.symbol)||"")})]})]}),w.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[w.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:w.jsx(Ch,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),b&&w.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),w.jsxs("div",{className:"swap-info-between",children:[w.jsx("div",{className:"left",children:"Slippage Tolerance"}),w.jsxs("div",{className:"right",children:[s,"%"]})]}),w.jsx(Eb,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),w.jsx(Sb,{isLoading:!1,routerData:a,noTips:!0}),x&&w.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[w.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),w.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[w.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:T?"#72c1f7":"#7F98A7"},onClick:()=>{O(!0)},children:"Yes, please continue."}),w.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"#7F98A7",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!F&&w.jsx("button",{disabled:W||N,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{N||(k(!0),t(a))},children:N?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(wb,{})}):"Confirm Swap"}),F&&w.jsxs("div",{className:"price-update",children:[w.jsxs("div",{className:"left",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{children:"Price update"})]}),w.jsx("div",{className:"right",children:w.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function rl(e){const{text:t,type:r}=e,[n,i]=ne.useState(!1),{addCommonToast:o}=Rs(),s=a=>{n||(Jc(a),cb(t,{debug:!1,message:"message"}),o("Copied"),i(!n))};return ne.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),w.jsx(w.Fragment,{children:r==="btn"?w.jsxs("div",{className:"copy-btn",onClick:s,children:[w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),w.jsx("span",{children:"Copy"})]}):w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:s,children:w.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function OD({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=vn(),{getTokenInfo:a}=oo(),c=ne.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(d=>({...d,fromToken:a(d.from_type),toToken:a(d.to_type)}))}))},[t]);return w.jsxs("div",{className:"route-dialog",children:[w.jsx(Ah,{title:"Route",backClick:e}),w.jsxs("div",{className:"route-dialog-content",children:[w.jsx("div",{className:"simple-router-box",children:w.jsx(I2,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),w.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[w.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[w.jsx(Gr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",children:Dr(o,n==null?void 0:n.decimals)}),w.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),w.jsx("div",{className:"route-box-h5 center",children:w.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>w.jsxs("div",{className:"route-item-box-h5",children:[w.jsxs("div",{className:"percent",children:[Le(u.percentage).mul(100).toString(),"%"]}),w.jsx("div",{className:u.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:u.paths.map(d=>w.jsx("div",{className:"route-path-item",children:w.jsx(xb,{autoSwitchTooltip:!0,position:"bottom",content:w.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[w.jsx(RD,{poolAddress:d.pool_address}),w.jsx(T2,{token:d.fromToken}),w.jsx(T2,{token:d.toToken})]}),children:w.jsx(PD,{path:d})})},d.to_type))})]},l))})}),w.jsxs("div",{className:"center",style:{gap:"4px"},children:[w.jsx(Gr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",children:Dr(s,i==null?void 0:i.decimals)}),w.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function PD({path:e}){var t,r,n;return w.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[w.jsx(Gr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),w.jsx(Gr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),w.jsxs("span",{className:"provider",children:[(n=K1[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&w.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function T2({token:e}){const{getExplorerUrl:t}=ms();return w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[w.jsx(Gr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),w.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:hn((e==null?void 0:e.symbol)||"")})]}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{onClick:Jc,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:No(e==null?void 0:e.coin_type)}),w.jsx(rl,{text:(e==null?void 0:e.coin_type)||""})]})]})}function RD({poolAddress:e}){const{getExplorerUrl:t}=ms();return w.jsxs(w.Fragment,{children:[e&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[w.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:Jc,href:t(e,"poolAddress"),target:"_blank",children:No(e)}),w.jsx(rl,{text:e})]})]}),e&&w.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function I2({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var d;const[n,i]=ne.useState(!1),{isApp:o}=Fu(),{fetchTokenInfo:s}=oo(),a=ne.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]),[c,u]=ne.useState(""),l=async()=>{var y,T;const p=[],b=((T=(y=r==null?void 0:r.routers)==null?void 0:y[0])==null?void 0:T.paths)||[];for(let O=0;O<b.length;O++){const N=b[O],k=await s(N==null?void 0:N.to_type);if(O===0){const F=await s(N==null?void 0:N.from_type);p.push(`${F==null?void 0:F.symbol} > ${k==null?void 0:k.symbol}`)}else p.push(k==null?void 0:k.symbol)}const x=p.join(" > ");u(x)};return ne.useEffect(()=>{a&&l()},[a]),w.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[w.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?w.jsx(Ps,{style:{width:"80px",height:"18px"}}):w.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[w.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?c:r==null?void 0:r.router_summery}),w.jsxs("div",{className:"providers",children:[(d=r==null?void 0:r.providers)==null?void 0:d.map((p,b)=>{var x;return o?w.jsx(Gr,{src:ur[p],style:{width:"16px",height:"16px"}}):w.jsx(Uu,{content:w.jsx("div",{children:((x=K1[p])==null?void 0:x.name)||p}),position:"top",delay:300,children:w.jsx(Gr,{src:ur[p],style:{width:"16px",height:"16px"}})},p)}),e&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:w.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&w.jsx(OD,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const i$="",za=Ai((e,t)=>({currentTypeTab:"Default",setCurrentTypeTab:r=>{e(()=>({currentTypeTab:r}))},currentPlatformTab:"All",setCurrentPlatformTab:r=>{e(()=>({currentPlatformTab:r}))},platformList:["All","Wormhole"],setPlatformList:r=>{e(()=>({platformList:r}))},isOpenImportDialog:!1,setIsOpenImportDialog:r=>{e(()=>({isOpenImportDialog:r}))},collectTokenMap:new Map,setCollectTokenMap:(r,n=!1)=>{e(()=>({collectTokenMap:r})),n||Ci.setItem(H1,r)},showTokenList:[],setShowTokenList:r=>{e(()=>({showTokenList:[...r]}))},combineTokenList:[],setComBineTokenList:r=>{e(()=>({combineTokenList:r}))},currentImportTokenData:void 0,setCurrentImportTokenData:r=>{e(()=>({currentImportTokenData:r}))},importTokenList:[],importTokenIsLoading:!1,setImportToken:(r,n)=>{const{importTokenList:i,setImportTokenList:o}=t();let s=i;if(n)s=[r,...s];else{const a=i1(r.coin_type);s=i.filter(c=>i1(c.coin_type)!==a)}return o(s),Ci.setItem(q1,s),s},setImportTokenList:r=>{e(()=>({importTokenList:r}))},setImportTokenIsLoading:r=>{e(()=>({importTokenIsLoading:r}))},searchInput:"",setSearchInput:r=>{e(()=>({searchInput:r}))},showTokenListIsLoading:!1,setShowTokenListIsLoading:r=>{e(()=>({showTokenListIsLoading:r}))}}));Ci.getItem(H1).then(e=>{e!==null&&za.getState().setCollectTokenMap(e,!0)}),Ci.getItem(q1).then(e=>{e&&za.getState().setImportTokenList(e)});function O2(){const{setCollectTokenMap:e,collectTokenMap:t}=za(),r=i=>{const o=new Map(t);o.get(i.coin_type)?o.delete(i.coin_type):o.set(i.coin_type,i),e(o)},n=ne.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function ND(e){const{trustedTokenList:t}=Ns(),{tokenBalanceObj:r,currentAccount:n}=nn(),{coinPriceObj:i}=lb(),{getTokenAmountValue:o}=$o(),{fetchTokenInfo:s}=oo(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:d,setComBineTokenList:p,setImportToken:b,setCurrentImportTokenData:x,setImportTokenIsLoading:y,currentImportTokenData:T,searchInput:O,setSearchInput:N,importTokenIsLoading:k,showTokenListIsLoading:F,setCurrentTypeTab:L}=za(),[W,z]=ne.useState(!1);ne.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&z(!0)},[t]);const[G,re]=ne.useState(!1);ne.useEffect(()=>{L1(i)||re(!0)},[i]);const oe=ne.useRef({}),[ae,H]=ne.useState(!1);ne.useEffect(()=>{(!L1(r)||!wd(oe.current,r))&&(oe.current=r,H(!0))},[r]);const D=ne.useMemo(()=>(d==null?void 0:d.length)>1?d==null?void 0:d.map(R=>{var ue;const J=(ue=r==null?void 0:r[R==null?void 0:R.coin_type])==null?void 0:ue.totalBalanceFormat,Q=Le(J).gt("0")?o(R==null?void 0:R.coin_type,J):"0";return{...R,balance:J,rate:Q}}):d,[d,r,i]),h=(R,J)=>{const Q=J&&J.toLocaleLowerCase().trim(),ue=R.map(de=>{let be=0,De=0;de.symbol.toLowerCase()===Q||de.name.toLowerCase()===Q||de.coin_type.toLowerCase()===Q?(be=1e3,De=2):de.symbol.toLowerCase().indexOf(Q)>-1?(be=100,De=0):de.name.toLowerCase().indexOf(Q)>-1?(be=10,De=0):de.coin_type.toLowerCase().indexOf(Q)>-1?(be=1,De=0):de.coin_type.toLowerCase()=="0x2::sui::sui"&&(De=1);let Ne=Array.isArray(de==null?void 0:de.coin_priority)?Number(de.coin_priority[0])||0:Number(de==null?void 0:de.coin_priority)||0;return e===de.coin_type&&!J&&(De=12,be=1e3,Ne=1e4),{...de,mark:be,sort:De,coin_priority_sort:Ne,rateNumber:Number((de==null?void 0:de.rate)||"0"),balanceNumber:Number((de==null?void 0:de.balance)||"0")}});return TD(ue,[de=>!J&&e===de.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},f=(R,J=!1)=>{const Q=J?R.trim():R.toLowerCase().trim(),ue=["symbol","name","coin_type"];return xD(Q.length===0?l:[...l,...D],de=>ue.some(be=>{const De=de[be];if(typeof De=="string"){const Ne=J?De:De.toLowerCase();return be==="coin_type"?Ne.includes(Q)||Ei(Ne,!0).includes(Ei(Q,!0)):Ne.includes(Q)}return!1}))},m=R=>{R||x(void 0);const J=f(R);if((J==null?void 0:J.length)===0){S(R);return}else{const Q=h(J,R);u(Q)}},S=async R=>{var J;y(!0);try{if($1(R)){const Q=R.trim(),ue=jr(Q).full_address,_e=await s(ue);if(!_e){u([]);return}const de=((J=r==null?void 0:r[Q])==null?void 0:J.totalBalanceFormat)||"0",be=Le(de).gt("0")?o(Q,de):"0",De={..._e,balance:de,rate:be};u([De]),x(De)}else{u([]);return}}catch{x(void 0),u([]);return}finally{y(!1)}},A=R=>{if(R==="Default")C("All");else{const J=h(D,O);u(J)}},_=()=>{if(T){const R=b(T,!0),J=h(R,O);u(J),x(void 0),N("")}},I=R=>{const J=b(R,!1),Q=h(J,O);u(Q)},C=R=>{const J=R==="All"?[...l]:l.filter(ue=>R=="Native"?!ue.labels||ue.labels.length==0||ue.labels=="Native":ue.labels&&ue.labels.length>0&&ue.labels[0].toLowerCase()==R.toLowerCase()),Q=h(J,O);u(Q)};ne.useEffect(()=>{if(!W||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const R=[];for(const J of t){const Q=r==null?void 0:r[J==null?void 0:J.coin_type],ue=(Q==null?void 0:Q.totalBalanceFormat)||"0",_e=(Q==null?void 0:Q.displayBalance)||"0",de=Le(ue).gt("0")?o(J==null?void 0:J.coin_type,ue):"0";R.push({...J,balance:_e,rate:Dr(de,4,!0)})}p(R)}},[W,G,ae,n==null?void 0:n.address,i]);const g=ne.useRef([]);ne.useEffect(()=>{if((l==null?void 0:l.length)>0&&!ED(g.current,l)){g.current=l;const R=h(l);e&&(D.find(Q=>Q.coin_type===e)!==void 0||a!=="Default")?(L("Imported"),A("Imported")):u(R)}},[l,e]);const v=ne.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!k)return!0;return!1},[O,c,T,k,F]);return{showTokenList:c,handleSearch:m,handleChangePlatform:C,currentImportTokenData:T,handleChangeType:A,handleImportClick:_,handleDeleteImportClick:I,isNoData:v}}function jD({tokenList:e,onHandleTokenAction:t}){return w.jsx("div",{className:"token-collect-list",children:e.map(r=>w.jsx(kD,{token:r,onHandleTokenAction:t},r.coin_type))})}function kD({token:e,onHandleTokenAction:t}){return w.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[w.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),w.jsx("span",{children:e.symbol}),w.jsx("i",{children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:w.jsx("use",{xlinkHref:"#icon-close"})})})]})}const DD=It("/images/img_no_data@2x.png");function BD(e){const{img:t=DD,text:r,width:n="100%",height:i="auto",padding:o="20px",subItem:s}=e;return w.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:o,boxSizing:"border-box",textAlign:"center"},children:[t&&w.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&w.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),s&&s]})}function LD({tabList:e,currentTab:t,changeTab:r}){return w.jsx("div",{className:"platform-tabs",children:e.map(n=>w.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var P2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function $D(e,t){return!!(e===t||P2(e)&&P2(t))}function FD(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!$D(e[r],t[r]))return!1;return!0}function UD(e,t){t===void 0&&(t=FD);var r=null;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var s=e.apply(this,i);return r={lastResult:s,lastArgs:i,lastThis:this},s}return n.clear=function(){r=null},n}function Hh(){return Hh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hh.apply(null,arguments)}function R2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qh(e,t){return qh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},qh(e,t)}function VD(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,qh(e,t)}var N2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function zD(e,t){return!!(e===t||N2(e)&&N2(t))}function HD(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!zD(e[r],t[r]))return!1;return!0}function Wh(e,t){t===void 0&&(t=HD);var r,n=[],i,o=!1;function s(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return o&&r===this&&t(a,n)||(i=e.apply(this,a),o=!0,r=this,n=a),i}return s}function j2(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var qD=typeof performance=="object"&&typeof performance.now=="function",k2=qD?function(){return performance.now()}:function(){return Date.now()};function D2(e){cancelAnimationFrame(e.id)}function WD(e,t){var r=k2();function n(){k2()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Gh=-1;function B2(e){if(e===void 0&&(e=!1),Gh===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Gh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Gh}var Ls=null;function L2(e){if(e===void 0&&(e=!1),Ls===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?Ls="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Ls="negative":Ls="positive-ascending"),document.body.removeChild(t),Ls}return Ls}wn.env.NODE_ENV;var GD=150,KD=function(t,r){return t},nl=null,il=null;wn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(nl=new WeakSet,il=new WeakSet);function YD(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,o=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(d){VD(p,d);function p(x){var y;return y=d.call(this,x)||this,y._instanceProps=c(y.props,R2(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:R2(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Wh(function(T,O,N,k){return y.props.onItemsRendered({overscanStartIndex:T,overscanStopIndex:O,visibleStartIndex:N,visibleStopIndex:k})}),y._callOnScroll=void 0,y._callOnScroll=Wh(function(T,O,N){return y.props.onScroll({scrollDirection:T,scrollOffset:O,scrollUpdateWasRequested:N})}),y._getItemStyle=void 0,y._getItemStyle=function(T){var O=y.props,N=O.direction,k=O.itemSize,F=O.layout,L=y._getItemStyleCache(u&&k,u&&F,u&&N),W;if(L.hasOwnProperty(T))W=L[T];else{var z=r(y.props,T,y._instanceProps),G=i(y.props,T,y._instanceProps),re=N==="horizontal"||F==="horizontal",oe=N==="rtl",ae=re?z:0;L[T]=W={position:"absolute",left:oe?void 0:ae,right:oe?ae:void 0,top:re?0:z,height:re?"100%":G,width:re?G:"100%"}}return W},y._getItemStyleCache=void 0,y._getItemStyleCache=Wh(function(T,O,N){return{}}),y._onScrollHorizontal=function(T){var O=T.currentTarget,N=O.clientWidth,k=O.scrollLeft,F=O.scrollWidth;y.setState(function(L){if(L.scrollOffset===k)return null;var W=y.props.direction,z=k;if(W==="rtl")switch(L2()){case"negative":z=-k;break;case"positive-descending":z=F-N-k;break}return z=Math.max(0,Math.min(z,F-N)),{isScrolling:!0,scrollDirection:L.scrollOffset<z?"forward":"backward",scrollOffset:z,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(T){var O=T.currentTarget,N=O.clientHeight,k=O.scrollHeight,F=O.scrollTop;y.setState(function(L){if(L.scrollOffset===F)return null;var W=Math.max(0,Math.min(F,k-N));return{isScrolling:!0,scrollDirection:L.scrollOffset<W?"forward":"backward",scrollOffset:W,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(T){var O=y.props.outerRef;y._outerRef=T,typeof O=="function"?O(T):O!=null&&typeof O=="object"&&O.hasOwnProperty("current")&&(O.current=T)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&D2(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=WD(y._resetIsScrolling,GD)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,T){return ZD(y,T),l(y),null};var b=p.prototype;return b.scrollTo=function(y){y=Math.max(0,y),this.setState(function(T){return T.scrollOffset===y?null:{scrollDirection:T.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},b.scrollToItem=function(y,T){T===void 0&&(T="auto");var O=this.props,N=O.itemCount,k=O.layout,F=this.state.scrollOffset;y=Math.max(0,Math.min(y,N-1));var L=0;if(this._outerRef){var W=this._outerRef;k==="vertical"?L=W.scrollWidth>W.clientWidth?B2():0:L=W.scrollHeight>W.clientHeight?B2():0}this.scrollTo(o(this.props,y,T,F,this._instanceProps,L))},b.componentDidMount=function(){var y=this.props,T=y.direction,O=y.initialScrollOffset,N=y.layout;if(typeof O=="number"&&this._outerRef!=null){var k=this._outerRef;T==="horizontal"||N==="horizontal"?k.scrollLeft=O:k.scrollTop=O}this._callPropsCallbacks()},b.componentDidUpdate=function(){var y=this.props,T=y.direction,O=y.layout,N=this.state,k=N.scrollOffset,F=N.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(T==="horizontal"||O==="horizontal")if(T==="rtl")switch(L2()){case"negative":L.scrollLeft=-k;break;case"positive-ascending":L.scrollLeft=k;break;default:var W=L.clientWidth,z=L.scrollWidth;L.scrollLeft=z-W-k;break}else L.scrollLeft=k;else L.scrollTop=k}this._callPropsCallbacks()},b.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&D2(this._resetIsScrollingTimeoutId)},b.render=function(){var y=this.props,T=y.children,O=y.className,N=y.direction,k=y.height,F=y.innerRef,L=y.innerElementType,W=y.innerTagName,z=y.itemCount,G=y.itemData,re=y.itemKey,oe=re===void 0?KD:re,ae=y.layout,H=y.outerElementType,D=y.outerTagName,h=y.style,f=y.useIsScrolling,m=y.width,S=this.state.isScrolling,A=N==="horizontal"||ae==="horizontal",_=A?this._onScrollHorizontal:this._onScrollVertical,I=this._getRangeToRender(),C=I[0],g=I[1],v=[];if(z>0)for(var R=C;R<=g;R++)v.push(ne.createElement(T,{data:G,key:oe(R,G),index:R,isScrolling:f?S:void 0,style:this._getItemStyle(R)}));var J=n(this.props,this._instanceProps);return ne.createElement(H||D||"div",{className:O,onScroll:_,ref:this._outerRefSetter,style:Hh({position:"relative",height:k,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:N},h)},ne.createElement(L||W||"div",{children:v,ref:F,style:{height:A?"100%":J,pointerEvents:S?"none":void 0,width:A?J:"100%"}}))},b._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var y=this.props.itemCount;if(y>0){var T=this._getRangeToRender(),O=T[0],N=T[1],k=T[2],F=T[3];this._callOnItemsRendered(O,N,k,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,W=L.scrollDirection,z=L.scrollOffset,G=L.scrollUpdateWasRequested;this._callOnScroll(W,z,G)}},b._getRangeToRender=function(){var y=this.props,T=y.itemCount,O=y.overscanCount,N=this.state,k=N.isScrolling,F=N.scrollDirection,L=N.scrollOffset;if(T===0)return[0,0,0,0];var W=s(this.props,L,this._instanceProps),z=a(this.props,W,L,this._instanceProps),G=!k||F==="backward"?Math.max(1,O):1,re=!k||F==="forward"?Math.max(1,O):1;return[Math.max(0,W-G),Math.max(0,Math.min(T-1,z+re)),W,z]},p}(ne.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ZD=function(t,r){var n=t.children,i=t.direction,o=t.height,s=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(wn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&il&&!il.has(l)&&(il.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var d=i==="horizontal"||s==="horizontal";switch(i){case"horizontal":case"vertical":nl&&!nl.has(l)&&(nl.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(s){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+s+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(d&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!d&&typeof o!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(o===null?"null":typeof o)+'" was specified.'))}},XD=YD({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,o,s){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,d=t.layout,p=t.width,b=a==="horizontal"||d==="horizontal",x=b?p:c,y=Math.max(0,u*l-x),T=Math.min(y,r*l),O=Math.max(0,r*l-x+l+s);switch(n==="smart"&&(i>=O-x&&i<=T+x?n="auto":n="center"),n){case"start":return T;case"end":return O;case"center":{var N=Math.round(O+(T-O)/2);return N<Math.ceil(x/2)?0:N>y+Math.floor(x/2)?y:N}case"auto":default:return i>=O&&i<=T?i:i<O?O:T}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,o=t.height,s=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",d=r*a,p=l?u:o,b=Math.ceil((p+n-d)/a);return Math.max(0,Math.min(s-1,r+b-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(wn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function $2(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var JD=["style"],QD=["style"];function eB(e,t){var r=e.style,n=j2(e,JD),i=t.style,o=j2(t,QD);return!$2(r,i)&&!$2(n,o)}const tB=ne.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:o,showDelete:s}=e,a=n[t];return w.jsx("div",{style:r,children:w.jsx(iB,{data:a,onHandleTokenAction:i,showCollect:o,showDelete:s})})},eB),rB=UD((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function nB({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=ne.useRef(null);nn(),$o(),ne.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const o=rB(e,t,r,n);return w.jsx("div",{className:"token-list",children:w.jsx(XD,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:o,itemSize:72,width:"100%",children:tB})})}function iB({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=O2(),{getExplorerUrl:o}=ms();return $o(),w.jsxs("div",{className:"token-list-item",onClick:s=>{t&&(s.stopPropagation(),n(e,"select_token"))},children:[w.jsx(Gr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),w.jsxs("div",{className:"token-info",children:[w.jsx("h4",{className:"token-symbol",children:w.jsx("span",{children:hn(e.symbol)})}),w.jsx("p",{className:"token-name",children:hn(e==null?void 0:e.name,20)}),w.jsxs("div",{className:"copy",children:[w.jsx("a",{onClick:Jc,href:o(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:No(e==null?void 0:e.coin_type)}),w.jsx(rl,{text:e==null?void 0:e.coin_type})]})]}),w.jsxs("div",{className:"token-balance",children:[w.jsxs("div",{className:"balance",children:[w.jsx("h4",{children:e==null?void 0:e.balance}),w.jsx("p",{children:e!=null&&e.rate?D1(e==null?void 0:e.rate,2):""})]}),r&&w.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"delete_import")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&w.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"collect_token")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function oB({currentType:e,changeTab:t}){const r=["Default","Imported"];return w.jsx("div",{className:"type-tabs",children:r.map(n=>w.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function sB({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:o,handleChangePlatform:s,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=ND(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:d,setCurrentTypeTab:p,currentPlatformTab:b,setCurrentPlatformTab:x,platformList:y,isOpenImportDialog:T,setIsOpenImportDialog:O,setSearchInput:N,searchInput:k,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:W}=za();ne.useEffect(()=>()=>{N(""),x("All"),p("Default"),W(void 0)},[]);const{handleCollectToken:z,collectTokenMap:G}=O2(),re=m=>{p(m),a(m)},oe=m=>{x(m),s(m)},ae=()=>{c(),O(!1)},H=m=>{let S=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();N(S),S?D(S):(D(""),re("Default"))},D=_h(m=>{$1(m)?o(Ei(m,!0)):o(m)},300),h=(m,S)=>{if(S==="delete_import"){u(m);return}if(S==="collect_token"||S==="un_collect"){z(m);return}S==="select_token"&&(t(m),e())},f=ne.useMemo(()=>Array.from(G.values()),[G]);return w.jsxs("div",{className:"token-select-modal",children:[w.jsx(Ah,{backClick:e,title:"Select Token"}),w.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:"search-input",style:{position:"relative"},children:[w.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:k,onChange:m=>H(m.target.value),style:{paddingRight:"40px"}}),k.length>0&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{H("")},children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),f.length>0&&w.jsx(jD,{tokenList:f,onHandleTokenAction:h}),k.length===0&&w.jsx(oB,{currentType:d,changeTab:re}),k.length===0&&d==="Default"&&w.jsx(LD,{tabList:y,currentTab:b,changeTab:oe})]}),i&&w.jsx(aB,{showTooltip:k.length>0,text:k.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&w.jsx(ub,{}),L&&w.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&w.jsxs("div",{style:{position:"relative"},children:[w.jsx(nB,{showTokenList:n,showCollect:!L,showDelete:!L&&d==="Imported",onHandleTokenAction:h}),L&&w.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:w.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ae(),h(L,"select_token")},children:"Import"})})]})]})]})}function aB({showTooltip:e,text:t}){return w.jsx("div",{style:{height:"360px"},children:w.jsx(BD,{text:t,subItem:e?w.jsx("div",{children:w.jsx(Uu,{position:"bottom",content:w.jsx("div",{children:"The unique id of coin"}),children:w.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function cB({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=ne.useState(!1),{setIgnoreWarnToken:o}=Fr();return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",onClick:e}),w.jsxs("div",{className:"import-dialog",children:[w.jsxs("div",{className:"cs-dialog-header",children:[w.jsx("div",{className:"title",children:"Tips"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"import-content",children:[w.jsx("div",{className:"tip-text-box",children:w.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(s=>w.jsxs("div",{className:"import-token-info",children:[w.jsx(Gr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),w.jsxs("div",{className:"info",children:[w.jsx("div",{className:"name",children:w.jsxs("span",{children:[" ",s.symbol," "]})}),w.jsxs("div",{className:"address",children:[w.jsx("span",{children:No(s.coin_type)}),w.jsx(rl,{text:s.coin_type})]})]})]},s.coin_type)),w.jsxs("div",{className:"risk-checkbox",children:[w.jsx(Su,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),w.jsx("span",{children:"I acknowledge the risk"})]}),w.jsxs("div",{className:"button-block",children:[w.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),w.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(s=>{o(s.coin_type)})},children:"Confirm"})]})]})]})]})}const o$="";function F2(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var Ha;(function(e){e.event="event",e.props="prop"})(Ha||(Ha={}));function ao(){}function uB(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(o,s){return o===t[s]})||(t=n,r=e.apply(void 0,n)),r}}function qa(e){return!!(e||"").match(/\d/)}function $s(e){return e==null}function lB(e){return typeof e=="number"&&isNaN(e)}function U2(e){return $s(e)||lB(e)||typeof e=="number"&&!isFinite(e)}function V2(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function fB(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function dB(e,t,r){var n=fB(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function hB(e){var t=ne.useRef(e);t.current=e;var r=ne.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Kh(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),o=i[0],s=i[1]||"";return{beforeDecimal:o,afterDecimal:s,hasNegation:r,addNegation:n}}function pB(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function z2(e,t,r){for(var n="",i=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||i;return n}function H2(e,t){return Array(t+1).join(e)}function q2(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],o=n[1];if(o=Number(o),!o)return r+i;i=i.replace(".","");var s=1+o,a=i.length;return s<0?i="0."+H2("0",Math.abs(s))+i:s>=a?i=i+H2("0",s-a):i=(i.substring(0,s)||"0")+"."+i.substring(s),r+i}function W2(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Kh(e),o=i.beforeDecimal,s=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(s||"0")),u=s.length<=t?"0."+s:c.toFixed(t),l=u.split("."),d=o;o&&Number(l[0])&&(d=o.split("").reverse().reduce(function(y,T,O){return y.length>O?(Number(y[0])+Number(T)).toString()+y.substring(1,y.length):T+y},l[0]));var p=z2(l[1]||"",t,r),b=a?"-":"",x=n?".":"";return""+b+d+x+p}function Wo(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var G2=uB(function(e,t){for(var r=0,n=0,i=e.length,o=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[o-1-n]&&o-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:o-n}}}),mB=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function gB(e,t,r){return Math.min(Math.max(e,t),r)}function Yh(e){return Math.max(e.selectionStart,e.selectionEnd)}function vB(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function yB(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function wB(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function bB(e,t,r,n,i,o,s){s===void 0&&(s=wB);var a=i.findIndex(function(F){return F}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,d={},p=new Array(u),b=0;b<u;b++){p[b]=-1;for(var x=0,y=l;x<y;x++){var T=s({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:b,formattedValueIndex:x});if(T&&d[x]!==!0){p[b]=x,d[x]=!0;break}}}for(var O=n;O<u&&(p[O]===-1||!o(r[O]));)O++;var N=O===u||p[O]===-1?l:p[O];for(O=n-1;O>0&&p[O]===-1;)O--;var k=O===-1||p[O]===-1?0:p[O]+1;return k>N?N:n-k<N-n?k:N}function K2(e,t,r,n){var i=e.length;if(t=gB(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function xB(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(qa(e[r])||qa(e[r-1]));return t}function Y2(e,t,r,n,i,o){o===void 0&&(o=ao);var s=hB(function(x,y){var T,O;return U2(x)?(O="",T=""):typeof x=="number"||y?(O=typeof x=="number"?q2(x):x,T=n(O)):(O=i(x,void 0),T=n(O)),{formattedValue:T,numAsString:O}}),a=ne.useState(function(){return s($s(e)?t:e,r)}),c=a[0],u=a[1],l=function(x,y){x.formattedValue!==c.formattedValue&&u({formattedValue:x.formattedValue,numAsString:x.value}),o(x,y)},d=e,p=r;$s(e)&&(d=c.numAsString,p=!0);var b=s(d,p);return ne.useMemo(function(){u(b)},[b.formattedValue]),[c,l]}function SB(e){return e.replace(/[^0-9]/g,"")}function EB(e){return e}function _B(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,o=e.getInputRef,s=e.format;s===void 0&&(s=EB);var a=e.removeFormatting;a===void 0&&(a=SB);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,d=e.isAllowed,p=e.onChange;p===void 0&&(p=ao);var b=e.onKeyDown;b===void 0&&(b=ao);var x=e.onMouseUp;x===void 0&&(x=ao);var y=e.onFocus;y===void 0&&(y=ao);var T=e.onBlur;T===void 0&&(T=ao);var O=e.value,N=e.getCaretBoundary;N===void 0&&(N=xB);var k=e.isValidInputCharacter;k===void 0&&(k=qa);var F=e.isCharacterSame,L=F2(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),W=Y2(O,c,!!u,s,a,l),z=W[0],G=z.formattedValue,re=z.numAsString,oe=W[1],ae=ne.useRef(),H=ne.useRef({formattedValue:G,numAsString:re}),D=function(we,pe){H.current={formattedValue:we.formattedValue,numAsString:we.value},oe(we,pe)},h=ne.useState(!1),f=h[0],m=h[1],S=ne.useRef(null),A=ne.useRef({setCaretTimeout:null,focusTimeout:null});ne.useEffect(function(){return m(!0),function(){clearTimeout(A.current.setCaretTimeout),clearTimeout(A.current.focusTimeout)}},[]);var _=s,I=function(we,pe){var Ce=parseFloat(pe);return{formattedValue:we,value:pe,floatValue:isNaN(Ce)?void 0:Ce}},C=function(we,pe,Ce){we.selectionStart===0&&we.selectionEnd===we.value.length||(Wo(we,pe),A.current.setCaretTimeout=setTimeout(function(){we.value===Ce&&we.selectionStart!==pe&&Wo(we,pe)},0))},g=function(we,pe,Ce){return K2(we,pe,N(we),Ce)},v=function(we,pe,Ce){var Ve=N(pe),je=bB(pe,G,we,Ce,Ve,k,F);return je=K2(pe,je,Ve),je},R=function(we){var pe=we.formattedValue;pe===void 0&&(pe="");var Ce=we.input,Ve=we.source,je=we.event,Ae=we.numAsString,Te;if(Ce){var $e=we.inputValue||Ce.value,ct=Yh(Ce);Ce.value=pe,Te=v($e,pe,ct),Te!==void 0&&C(Ce,Te,pe)}pe!==G&&D(I(pe,Ae),{event:je,source:Ve})};ne.useEffect(function(){var we=H.current,pe=we.formattedValue,Ce=we.numAsString;(G!==pe||re!==Ce)&&D(I(G,re),{event:void 0,source:Ha.props})},[G,re]);var J=S.current?Yh(S.current):void 0,Q=typeof window<"u"?ne.useLayoutEffect:ne.useEffect;Q(function(){var we=S.current;if(G!==H.current.formattedValue&&we){var pe=v(H.current.formattedValue,G,J);we.value=G,C(we,pe,G)}},[G]);var ue=function(we,pe,Ce){var Ve=pe.target,je=ae.current?mB(ae.current,Ve.selectionEnd):G2(G,we),Ae=Object.assign(Object.assign({},je),{lastValue:G}),Te=a(we,Ae),$e=_(Te);if(Te=a($e,void 0),d&&!d(I($e,Te))){var ct=pe.target,ut=Yh(ct),ze=v(we,G,ut);return ct.value=G,C(ct,ze,G),!1}return R({formattedValue:$e,numAsString:Te,inputValue:we,event:pe,source:Ce,input:pe.target}),!0},_e=function(we,pe){pe===void 0&&(pe=0);var Ce=we.selectionStart,Ve=we.selectionEnd;ae.current={selectionStart:Ce,selectionEnd:Ve+pe}},de=function(we){var pe=we.target,Ce=pe.value,Ve=ue(Ce,we,Ha.event);Ve&&p(we),ae.current=void 0},be=function(we){var pe=we.target,Ce=we.key,Ve=pe.selectionStart,je=pe.selectionEnd,Ae=pe.value;Ae===void 0&&(Ae="");var Te;Ce==="ArrowLeft"||Ce==="Backspace"?Te=Math.max(Ve-1,0):Ce==="ArrowRight"?Te=Math.min(Ve+1,Ae.length):Ce==="Delete"&&(Te=Ve);var $e=0;Ce==="Delete"&&Ve===je&&($e=1);var ct=Ce==="ArrowLeft"||Ce==="ArrowRight";if(Te===void 0||Ve!==je&&!ct){b(we),_e(pe,$e);return}var ut=Te;if(ct){var ze=Ce==="ArrowLeft"?"left":"right";ut=g(Ae,Te,ze),ut!==Te&&we.preventDefault()}else Ce==="Delete"&&!k(Ae[Te])?ut=g(Ae,Te,"right"):Ce==="Backspace"&&!k(Ae[Te])&&(ut=g(Ae,Te,"left"));ut!==Te&&C(pe,ut,Ae),b(we),_e(pe,$e)},De=function(we){var pe=we.target,Ce=function(){var Ve=pe.selectionStart,je=pe.selectionEnd,Ae=pe.value;if(Ae===void 0&&(Ae=""),Ve===je){var Te=g(Ae,Ve);Te!==Ve&&C(pe,Te,Ae)}};Ce(),requestAnimationFrame(function(){Ce()}),x(we),_e(pe)},Ne=function(we){we.persist&&we.persist();var pe=we.target,Ce=we.currentTarget;S.current=pe,A.current.focusTimeout=setTimeout(function(){var Ve=pe.selectionStart,je=pe.selectionEnd,Ae=pe.value;Ae===void 0&&(Ae="");var Te=g(Ae,Ve);Te!==Ve&&!(Ve===0&&je===Ae.length)&&C(pe,Te,Ae),y(Object.assign(Object.assign({},we),{currentTarget:Ce}))},0)},ft=function(we){S.current=null,clearTimeout(A.current.focusTimeout),clearTimeout(A.current.setCaretTimeout),T(we)},dt=f&&vB()?"numeric":void 0,ke=Object.assign({inputMode:dt},L,{type:t,value:G,onChange:de,onKeyDown:be,onMouseUp:De,onFocus:Ne,onBlur:ft});if(r==="text")return i?ne.createElement(ne.Fragment,null,i(G,L)||null):ne.createElement("span",Object.assign({},L,{ref:o}),G);if(n){var mt=n;return ne.createElement(mt,Object.assign({},ke,{ref:o}))}return ne.createElement("input",Object.assign({},ke,{ref:o}))}function Z2(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var o=t.suffix;o===void 0&&(o="");var s=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=ol(t),u=c.thousandSeparator,l=c.decimalSeparator,d=r!==0&&e.indexOf(".")!==-1||r&&n,p=Kh(e,s),b=p.beforeDecimal,x=p.afterDecimal,y=p.addNegation;return r!==void 0&&(x=z2(x,r,!!n)),u&&(b=dB(b,u,a)),i&&(b=i+b),o&&(x=x+o),y&&(b="-"+b),e=b+(d&&l||"")+x,e}function ol(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function CB(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),i&&!o&&t&&(e="-"+e),e}function AB(e,t){return new RegExp("(^-)|[0-9]|"+V2(e),t?"g":void 0)}function MB(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function TB(e,t,r){var n;t===void 0&&(t=yB(e));var i=r.allowNegative,o=r.prefix;o===void 0&&(o="");var s=r.suffix;s===void 0&&(s="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,d=u.end,p=ol(r),b=p.allowedDecimalSeparators,x=p.decimalSeparator,y=e[d]===x;if(qa(e)&&(e===o||e===s)&&t.lastValue==="")return e;if(d-l===1&&b.indexOf(e[l])!==-1){var T=a===0?"":x;e=e.substring(0,l)+T+e.substring(l+1,e.length)}var O=function(S,A,_){var I=!1,C=!1;o.startsWith("-")?I=!1:S.startsWith("--")?(I=!1,C=!0):s.startsWith("-")&&S.length===s.length?I=!1:S[0]==="-"&&(I=!0);var g=I?1:0;return C&&(g=2),g&&(S=S.substring(g),A-=g,_-=g),{value:S,start:A,end:_,hasNegation:I}},N=O(e,l,d),k=N.hasNegation;n=N,e=n.value,l=n.start,d=n.end;var F=O(t.lastValue,c.start,c.end),L=F.start,W=F.end,z=F.value,G=e.substring(l,d);e.length&&z.length&&(L>z.length-s.length||W<o.length)&&!(G&&s.startsWith(G))&&(e=z);var re=0;e.startsWith(o)?re+=o.length:l<o.length&&(re=l),e=e.substring(re),d-=re;var oe=e.length,ae=e.length-s.length;e.endsWith(s)?oe=ae:(d>ae||d>e.length-s.length)&&(oe=d),e=e.substring(0,oe),e=CB(k?"-"+e:e,i),e=(e.match(AB(x,!0))||[]).join("");var H=e.indexOf(x);e=e.replace(new RegExp(V2(x),"g"),function(S,A){return A===H?".":""});var D=Kh(e,i),h=D.beforeDecimal,f=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&h===""&&y&&!parseFloat(f)&&(e=m?"-":""),e}function IB(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),o=e[0]==="-";i.fill(!1,0,r.length+(o?1:0));var s=e.length;return i.fill(!1,s-n.length+1,s+1),i}function OB(e){var t=ol(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var o=e.allowNegative;if(o===void 0&&(o=!0),r===n)throw new Error(`
103
103
  Decimal separator can't be same as thousand separator.
104
104
  thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
105
105
  decimalSeparator: `+n+` (default value for decimalSeparator is .)
@@ -107,4 +107,4 @@ body { background-color: var(--color-page-background); }
107
107
  Prefix can't start with '-' when allowNegative is true.
108
108
  prefix: `+i+`
109
109
  allowNegative: `+o+`
110
- `),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}function bD(e){e=wD(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ro);var o=e.onBlur;o===void 0&&(o=ro);var s=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var l=e.defaultValue,d=e.value,p=e.valueIsNumericString,w=e.onValueChange,b=g2(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),y=Qu(e),T=y.decimalSeparator,O=y.allowedDecimalSeparators,R=function(m){return M2(m,e)},k=function(m,S){return vD(m,S,e)},F=ks(d)?l:d,L=p??gD(F,u,t);ks(d)?ks(l)||(L=L||typeof l=="number"):L=L||typeof d=="number";var q=function(m){return v2(m)?m:(typeof m=="number"&&(m=x2(m)),L&&typeof a=="number"?S2(m,a,!!c):m)},H=C2(q(d),q(l),!!L,R,k,w),K=H[0],re=K.numAsString,oe=K.formattedValue,ae=H[1],z=function(m){var S=m.target,M=m.key,_=S.selectionStart,I=S.selectionEnd,C=S.value;if(C===void 0&&(C=""),(M==="Backspace"||M==="Delete")&&I<u.length){m.preventDefault();return}if(_!==I){i(m);return}M==="Backspace"&&C[0]==="-"&&_===u.length+1&&r&&ko(S,1),a&&c&&(M==="Backspace"&&C[_-1]===T?(ko(S,_-1),m.preventDefault()):M==="Delete"&&C[_]===T&&m.preventDefault()),O!=null&&O.includes(M)&&C[_]===T&&ko(S,_+1);var g=s===!0?",":s;M==="Backspace"&&C[_-1]===g&&ko(S,_-1),M==="Delete"&&C[_]===g&&ko(S,_+1),i(m)},D=function(m){var S=re;if(S.match(/\d/g)||(S=""),n||(S=nD(S)),c&&a&&(S=S2(S,a,c)),S!==re){var M=M2(S,e);ae({formattedValue:M,value:S,floatValue:parseFloat(S)},{event:m,source:$a.event})}o(m)},h=function(m){return m===T?!0:Fa(m)},f=function(m){var S=m.currentValue,M=m.lastValue,_=m.formattedValue,I=m.currentValueIndex,C=m.formattedValueIndex,g=S[I],v=_[C],N=E2(M,S),ee=N.to,ie=function(le){return k(le).indexOf(".")+u.length};return d===0&&c&&a&&S[ee.start]===T&&ie(S)<I&&ie(_)>C?!1:I>=ee.start&&I<ee.end&&O&&O.includes(g)&&v===T?!0:g===v};return Object.assign(Object.assign({},b),{value:oe,valueIsNumericString:!1,isValidInputCharacter:h,isCharacterSame:f,onValueChange:ae,format:R,removeFormatting:k,getCaretBoundary:function(m){return yD(m,e)},onKeyDown:z,onBlur:D})}function xD(e){var t=bD(e);return te.createElement(hD,Object.assign({},t))}function SD(e){const{className:t,value:r,decimals:n,placeholder:i,style:o,onChange:s,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...d}=e,p=w=>{var T;const b=((T=w==null?void 0:w.target)==null?void 0:T.value)||"";let y=b;if(b.startsWith("0")&&b!=="0"&&!b.startsWith("0.")&&(y=b.replace(/^0+/,"")),y){if(y.startsWith(".")){s(y.slice(1,y.length));return}let O=String(y).replace(/,/g,"");if(O.startsWith("-")){s("");return}l&&(O=O.replace(l,"")),a!==void 0&&De(O).gt(a)?O=a.toString():c!==void 0&&De(O).lt(c)&&(O=c.toString()),s(String(O))}else s("")};return x.jsx(xD,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:w=>!w.value.startsWith("-"),onChange:p,...d,style:{...o,cursor:u?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function ED(e){const{token:t,handleTokenSelectClick:r}=e;return x.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[x.jsx("div",{className:"token-img-box",children:x.jsx(Wr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),x.jsx("div",{className:"name",children:x.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),x.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function A2({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:o,token:s,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:d}){const[p,w]=te.useState(!1),{currentAccount:b}=Pn(),y=()=>{const O=De((n==null?void 0:n.totalBalanceFormat)||"0").div(2),R=jr(O.toString(),s==null?void 0:s.decimals,!0).toString();t&&De(R).eq(t)||i(R)},T=()=>{const O=De((n==null?void 0:n.totalBalanceFormat)||0),R=Rr((s==null?void 0:s.coin_type)||"").full_address===Ja,k=.05;let F=O;R&&De(O).gt(k)&&(F=F.sub(k)),!(t&&De(F).eq(t))&&De(F).gte(0)&&i(F.toString())};return x.jsxs("div",{className:p?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:d},children:[x.jsxs("div",{className:"title",children:[" ",e," "]}),x.jsxs("div",{className:"token-input",children:[a?x.jsxs("div",{style:{flex:1},children:[" ",x.jsx(As,{style:{width:"200px",height:"28px",flex:1}})," "]}):x.jsx(SD,{inputAllowed:l,value:t,decimals:(s==null?void 0:s.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>w(!0),onBlur:()=>w(!1)}),x.jsx(ED,{token:s,handleTokenSelectClick:o})]}),x.jsxs("div",{className:"info-box",children:[!a&&r&&De(r).gt(0)?x.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:m1(r,2)}):x.jsx("div",{}),b&&s&&x.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[x.jsxs("div",{className:"token-balance",children:[x.jsx("svg",{className:"icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-wallet"})}),x.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),x.jsxs("div",{className:"btn-box",children:[u&&x.jsx("button",{className:"cs-outline-btn",onClick:y,children:"HALF"}),c&&x.jsx("button",{className:"cs-outline-btn",onClick:T,children:"MAX"})]})]})]})]})}function _D({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Pn(),{getOwnerCoinBalances:o}=Ru(),{fromCoin:s,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:d,routerData:p,isOpenSecondary:w,setIsOpenSecondary:b,isOpenTokensDialog:y,setIsOpenTokensDialog:T}=dn(),{handleAmountChange:O,handleSelectToken:R,fromBalanceInfo:k,toBalanceInfo:F,fromAmountValue:L,toAmountValue:q,doSwapAction:H,reCalculateRouteData:K,refreshMarketPrice:re,scamsText:oe}=QI(),{slippage:ae}=$r(),{isCustomMode:z,customWarnTokenList:D}=FI(s==null?void 0:s.coin_type,a==null?void 0:a.coin_type),{amountLimit:h}=qw(ae,p),{formatSwapRouter:f}=LI(p),[m,S]=te.useState(!1),{btnText:M,btnDisabled:_}=eO(k==null?void 0:k.totalBalanceFormat),[I,C]=te.useState(!1),[g,v]=te.useState(!1);te.useEffect(()=>{w?e>=5&&N():e>=20&&N()},[e]);const N=()=>{K(),n&&o(),re()},ee=()=>({...p}),ie=async()=>{a&&R(a,!0)};return x.jsxs("div",{className:"swap-trade-box",children:[x.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[x.jsx(A2,{loading:!d&&l,balance:k,amountValue:L,handleTokenSelectClick:()=>{C(!0),T(!0)},onInputChange:le=>{O(le,!0)},amount:c,token:s}),x.jsx("div",{onClick:ie,className:"swap-icon",onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{cursor:"pointer"},children:x.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:x.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),x.jsx(A2,{marginTop:"-20px",loading:d&&l,balance:F,showHalf:!1,showMax:!1,amountValue:q,handleTokenSelectClick:()=>{C(!1),T(!0)},onInputChange:le=>{O(le,!1)},inputAllowed:!1,amount:u,token:a})]}),oe&&x.jsx(rO,{scamsText:oe}),x.jsxs("div",{className:"swap-bottom-block",style:{border:_?"0px solid #2a3238":"1px solid #2a3238"},children:[x.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:_||l,onClick:()=>{n?z&&D.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?x.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:x.jsx(Yw,{})}):M}),c&&u&&De(c).gt(0)&&De(u).gt(0)&&x.jsxs("div",{className:"content",children:[x.jsxs("div",{className:"price-related-info",children:[p&&!(p!=null&&p.errorCode)&&x.jsx(mh,{baseToken:s,quoteToken:a,baseAmount:p.fromAmountUi||"",quoteAmount:p.toAmountUi||"",loading:l}),x.jsx(Jw,{isLoading:l,routerData:p})]}),x.jsx(Qw,{isLoading:l,amountLimit:h}),x.jsx(o2,{hasSubMenu:!0,formatSwapRouter:f,isLoading:l})]})]}),w&&x.jsx(yk,{data:ee(),toBack:()=>b(!1),onSubmitClick:async le=>{try{await H(le,r==null?void 0:r.partner)}finally{b(!1)}}}),y&&x.jsx(Yk,{currToken:I?s:a,backClick:()=>T(!1),onSelectToken:le=>{R(le,I),T(!1)}}),g&&D.length>0&&x.jsx(Xk,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),b(!0)}})]})}function CD({initProps:e={},customWallet:t}){CI();const{ToastContainer:r}=Ts(),{fetchRouterConfig:n}=bI(),{getTokens:i}=eo(),{fetchTokenPrices:o}=Nu(),{transactionData:s,setTransactionData:a}=fh(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:d,fromAmount:p}=dn(),[w,b]=te.useState(0),y=te.useRef(w);_I(e),te.useEffect(()=>{i(),o([]),n()},[]),te.useEffect(()=>{y.current=0},[u==null?void 0:u.coin_type,d==null?void 0:d.coin_type,p,l]),xI({interval:1e3,callback:()=>{y.current=y.current+1,c?y.current>=5&&T():y.current>=20&&T()}});const T=()=>{y.current=20,b(20),setTimeout(()=>{y.current=0,b(0)},20)};return x.jsx(x.Fragment,{children:x.jsxs("div",{className:"cs-swap-container",id:"cs-swap-widget",children:[x.jsx(gI,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),x.jsx(tI,{handleRefresh:T}),x.jsx(_D,{refreshCount:w,customWallet:t,initProps:e}),s&&x.jsx(vI,{transactionData:s,onClose:()=>{a(void 0)}}),x.jsx(r,{})]})})}function Fh({initProps:e={},customWallet:t}){var s;const{getOwnerCoinBalances:r}=Ru(),n=Ur.useCurrentAccount(),{saveCurrentAccount:i}=Pn(),{mutate:o}=Ur.useConnectWallet();return te.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),te.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&o({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(s=t==null?void 0:t.currentAccount)==null?void 0:s.address,n==null?void 0:n.address]),x.jsx(CD,{initProps:e,customWallet:t})}function MD({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return x.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&x.jsx("div",{className:"swap-modal-box",children:x.jsx(Fh,{initProps:e,customWallet:t})}),x.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function AD({size:e,direction:t,initProps:r,customWallet:n}){const[i,o]=te.useState(!1),s=()=>{o(!i)};return x.jsxs("div",{className:"widget-btn-box",children:[x.jsx("div",{className:`img-btn ${e} ${t}`,onClick:s,children:i?x.jsx("svg",{className:"icon","aria-hidden":"true",children:x.jsx("use",{xlinkHref:"#icon-unfold"})}):x.jsx("img",{src:Tt("/images/img-logo@2x.png")})}),i&&x.jsx("div",{className:`widget-modal ${t} ${e}`,children:x.jsx(Fh,{initProps:r,customWallet:n})})]})}function TD({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return x.jsxs(fu,{appearance:"dark",children:[r==="Integrated"&&x.jsx(Fh,{initProps:e,customWallet:t}),r==="Widget"&&x.jsx(AD,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&x.jsx(MD,{initProps:e,customWallet:t})]})}const ID=TD;qt.CetusSwap=ID,Object.defineProperty(qt,Symbol.toStringTag,{value:"Module"})});
110
+ `),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}function PB(e){e=OB(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ao);var o=e.onBlur;o===void 0&&(o=ao);var s=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var l=e.defaultValue,d=e.value,p=e.valueIsNumericString,b=e.onValueChange,x=F2(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),y=ol(e),T=y.decimalSeparator,O=y.allowedDecimalSeparators,N=function(m){return Z2(m,e)},k=function(m,S){return TB(m,S,e)},F=$s(d)?l:d,L=p??MB(F,u,t);$s(d)?$s(l)||(L=L||typeof l=="number"):L=L||typeof d=="number";var W=function(m){return U2(m)?m:(typeof m=="number"&&(m=q2(m)),L&&typeof a=="number"?W2(m,a,!!c):m)},z=Y2(W(d),W(l),!!L,N,k,b),G=z[0],re=G.numAsString,oe=G.formattedValue,ae=z[1],H=function(m){var S=m.target,A=m.key,_=S.selectionStart,I=S.selectionEnd,C=S.value;if(C===void 0&&(C=""),(A==="Backspace"||A==="Delete")&&I<u.length){m.preventDefault();return}if(_!==I){i(m);return}A==="Backspace"&&C[0]==="-"&&_===u.length+1&&r&&Wo(S,1),a&&c&&(A==="Backspace"&&C[_-1]===T?(Wo(S,_-1),m.preventDefault()):A==="Delete"&&C[_]===T&&m.preventDefault()),O!=null&&O.includes(A)&&C[_]===T&&Wo(S,_+1);var g=s===!0?",":s;A==="Backspace"&&C[_-1]===g&&Wo(S,_-1),A==="Delete"&&C[_]===g&&Wo(S,_+1),i(m)},D=function(m){var S=re;if(S.match(/\d/g)||(S=""),n||(S=pB(S)),c&&a&&(S=W2(S,a,c)),S!==re){var A=Z2(S,e);ae({formattedValue:A,value:S,floatValue:parseFloat(S)},{event:m,source:Ha.event})}o(m)},h=function(m){return m===T?!0:qa(m)},f=function(m){var S=m.currentValue,A=m.lastValue,_=m.formattedValue,I=m.currentValueIndex,C=m.formattedValueIndex,g=S[I],v=_[C],R=G2(A,S),J=R.to,Q=function(ue){return k(ue).indexOf(".")+u.length};return d===0&&c&&a&&S[J.start]===T&&Q(S)<I&&Q(_)>C?!1:I>=J.start&&I<J.end&&O&&O.includes(g)&&v===T?!0:g===v};return Object.assign(Object.assign({},x),{value:oe,valueIsNumericString:!1,isValidInputCharacter:h,isCharacterSame:f,onValueChange:ae,format:N,removeFormatting:k,getCaretBoundary:function(m){return IB(m,e)},onKeyDown:H,onBlur:D})}function RB(e){var t=PB(e);return ne.createElement(_B,Object.assign({},t))}function NB(e){const{className:t,value:r,decimals:n,placeholder:i,style:o,onChange:s,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...d}=e,p=b=>{var T;const x=((T=b==null?void 0:b.target)==null?void 0:T.value)||"";let y=x;if(x.startsWith("0")&&x!=="0"&&!x.startsWith("0.")&&(y=x.replace(/^0+/,"")),y){if(y.startsWith(".")){s(y.slice(1,y.length));return}let O=String(y).replace(/,/g,"");if(O.startsWith("-")){s("");return}l&&(O=O.replace(l,"")),a!==void 0&&Le(O).gt(a)?O=a.toString():c!==void 0&&Le(O).lt(c)&&(O=c.toString()),s(String(O))}else s("")};return w.jsx(RB,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:b=>!b.value.startsWith("-"),onChange:p,...d,style:{...o,cursor:u?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function jB(e){const{token:t,handleTokenSelectClick:r}=e;return w.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[w.jsx("div",{className:"token-img-box",children:w.jsx(Gr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),w.jsx("div",{className:"name",children:w.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function X2({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:o,token:s,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:d}){const[p,b]=ne.useState(!1),{currentAccount:x}=nn(),y=()=>{const O=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),N=Dr(O.toString(),s==null?void 0:s.decimals,!0).toString();t&&Le(N).eq(t)||i(N)},T=()=>{const O=Le((n==null?void 0:n.totalBalanceFormat)||0),N=jr((s==null?void 0:s.coin_type)||"").full_address===ac,k=.05;let F=O;N&&Le(O).gt(k)&&(F=F.sub(k)),!(t&&Le(F).eq(t))&&Le(F).gte(0)&&i(F.toString())};return w.jsxs("div",{className:p?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:d},children:[w.jsxs("div",{className:"title",children:[" ",e," "]}),w.jsxs("div",{className:"token-input",children:[a?w.jsxs("div",{style:{flex:1},children:[" ",w.jsx(Ps,{style:{width:"200px",height:"28px",flex:1}})," "]}):w.jsx(NB,{inputAllowed:l,value:t,decimals:(s==null?void 0:s.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>b(!0),onBlur:()=>b(!1)}),w.jsx(jB,{token:s,handleTokenSelectClick:o})]}),w.jsxs("div",{className:"info-box",children:[!a&&r&&Le(r).gt(0)?w.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:D1(r,2)}):w.jsx("div",{}),x&&s&&w.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[w.jsxs("div",{className:"token-balance",children:[w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-wallet"})}),w.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),w.jsxs("div",{className:"btn-box",children:[u&&w.jsx("button",{className:"cs-outline-btn",onClick:y,children:"HALF"}),c&&w.jsx("button",{className:"cs-outline-btn",onClick:T,children:"MAX"})]})]})]})]})}function kB({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=nn(),{getOwnerCoinBalances:o}=$u(),{fromCoin:s,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:d,routerData:p,isOpenSecondary:b,setIsOpenSecondary:x,isOpenTokensDialog:y,setIsOpenTokensDialog:T}=vn(),{handleAmountChange:O,handleSelectToken:N,fromBalanceInfo:k,toBalanceInfo:F,fromAmountValue:L,toAmountValue:W,doSwapAction:z,reCalculateRouteData:G,refreshMarketPrice:re,scamsText:oe}=lP(),{slippage:ae}=Fr(),{isCustomMode:H,customWarnTokenList:D}=ZO(s==null?void 0:s.coin_type,a==null?void 0:a.coin_type),{amountLimit:h}=mb(ae,p),{formatSwapRouter:f}=KO(p),[m,S]=ne.useState(!1),{btnText:A,btnDisabled:_}=fP(k==null?void 0:k.totalBalanceFormat),[I,C]=ne.useState(!1),[g,v]=ne.useState(!1);ne.useEffect(()=>{b?e>=5&&R():e>=20&&R()},[e]);const R=()=>{G(),n&&o(),re()},J=()=>({...p}),Q=async()=>{a&&N(a,!0)};return w.jsxs("div",{className:"swap-trade-box",children:[w.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[w.jsx(X2,{loading:!d&&l,balance:k,amountValue:L,handleTokenSelectClick:()=>{C(!0),T(!0)},onInputChange:ue=>{O(ue,!0)},amount:c,token:s}),w.jsx("div",{onClick:Q,className:"swap-icon",onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{cursor:"pointer"},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:w.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),w.jsx(X2,{marginTop:"-20px",loading:d&&l,balance:F,showHalf:!1,showMax:!1,amountValue:W,handleTokenSelectClick:()=>{C(!1),T(!0)},onInputChange:ue=>{O(ue,!1)},inputAllowed:!1,amount:u,token:a})]}),oe&&w.jsx(hP,{scamsText:oe}),w.jsxs("div",{className:"swap-bottom-block",style:{border:_?"0px solid #2a3238":"1px solid #2a3238"},children:[w.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:_||l,onClick:()=>{n?H&&D.length>0?v(!0):x(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(wb,{})}):A}),c&&u&&Le(c).gt(0)&&Le(u).gt(0)&&w.jsxs("div",{className:"content",children:[w.jsxs("div",{className:"price-related-info",children:[p&&!(p!=null&&p.errorCode)&&w.jsx(Ch,{baseToken:s,quoteToken:a,baseAmount:p.fromAmountUi||"",quoteAmount:p.toAmountUi||"",loading:l}),w.jsx(Sb,{isLoading:l,routerData:p})]}),w.jsx(Eb,{isLoading:l,amountLimit:h}),w.jsx(I2,{hasSubMenu:!0,formatSwapRouter:f,isLoading:l})]})]}),b&&w.jsx(ID,{data:J(),toBack:()=>x(!1),onSubmitClick:async ue=>{try{await z(ue,r==null?void 0:r.partner)}finally{x(!1)}}}),y&&w.jsx(sB,{currToken:I?s:a,backClick:()=>T(!1),onSelectToken:ue=>{N(ue,I),T(!1)}}),g&&D.length>0&&w.jsx(cB,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),x(!0)}})]})}function DB({initProps:e={},customWallet:t}){kO();const{ToastContainer:r}=Rs(),{fetchRouterConfig:n}=IO(),{getTokens:i}=oo();$o();const{transactionData:o,setTransactionData:s}=xh(),{isOpenSecondary:a,fromCoin:c,toAmount:u,toCoin:l,fromAmount:d}=vn(),[p,b]=ne.useState(0),x=ne.useRef(p);jO(e),ne.useEffect(()=>{i(),n()},[]),ne.useEffect(()=>{x.current=0},[c==null?void 0:c.coin_type,l==null?void 0:l.coin_type,d,u]),OO({interval:1e3,callback:()=>{x.current=x.current+1,a?x.current>=5&&y():x.current>=20&&y()}});const y=()=>{x.current=20,b(20),setTimeout(()=>{x.current=0,b(0)},20)};return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"cs-swap-container",id:"cs-swap-widget",children:[w.jsx(CO,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),w.jsx(lO,{handleRefresh:y}),w.jsx(kB,{refreshCount:p,customWallet:t,initProps:e}),o&&w.jsx(AO,{transactionData:o,onClose:()=>{s(void 0)}}),w.jsx(r,{})]})})}function Zh({initProps:e={},customWallet:t}){var s;PO();const{getOwnerCoinBalances:r}=$u(),n=Vr.useCurrentAccount(),{saveCurrentAccount:i}=nn(),{mutate:o}=Vr.useConnectWallet();return ne.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),ne.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&o({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(s=t==null?void 0:t.currentAccount)==null?void 0:s.address,n==null?void 0:n.address]),w.jsx(DB,{initProps:e,customWallet:t})}function BB({initProps:e,customWallet:t}){const[r,n]=ne.useState(!0);return w.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&w.jsx("div",{className:"swap-modal-box",children:w.jsx(Zh,{initProps:e,customWallet:t})}),w.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function LB({size:e,direction:t,initProps:r,customWallet:n}){const[i,o]=ne.useState(!1),s=()=>{o(!i)};return w.jsxs("div",{className:"widget-btn-box",children:[w.jsx("div",{className:`img-btn ${e} ${t}`,onClick:s,children:i?w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})}):w.jsx("img",{src:It("/images/img-logo@2x.png")})}),i&&w.jsx("div",{className:`widget-modal ${t} ${e}`,children:w.jsx(Zh,{initProps:r,customWallet:n})})]})}function $B({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return w.jsxs(yu,{appearance:"dark",children:[r==="Integrated"&&w.jsx(Zh,{initProps:e,customWallet:t}),r==="Widget"&&w.jsx(LB,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&w.jsx(BB,{initProps:e,customWallet:t})]})}const FB=$B;qt.CetusSwap=FB,Object.defineProperty(qt,Symbol.toStringTag,{value:"Module"})});