@cetusprotocol/terminal 0.1.5 → 0.1.6

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(zt,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):(zt=typeof globalThis<"u"?globalThis:zt||self,te(zt.CetusSwap={},zt.React,zt.ReactDOM,zt.dappKit))})(this,function(zt,te,Ln,Ur){"use strict";var AX=Object.defineProperty;var MX=(zt,te,Ln)=>te in zt?AX(zt,te,{enumerable:!0,configurable:!0,writable:!0,value:Ln}):zt[te]=Ln;var vt=(zt,te,Ln)=>(MX(zt,typeof te!="symbol"?te+"":te,Ln),Ln);function rm(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 I=rm(te),nm=rm(Ln);function z3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var im={exports:{}},sr=im.exports={},Fn,Un;function df(){throw new Error("setTimeout has not been defined")}function hf(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Fn=setTimeout:Fn=df}catch{Fn=df}try{typeof clearTimeout=="function"?Un=clearTimeout:Un=hf}catch{Un=hf}})();function sm(e){if(Fn===setTimeout)return setTimeout(e,0);if((Fn===df||!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 q3(e){if(Un===clearTimeout)return clearTimeout(e);if((Un===hf||!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 hi=[],oo=!1,Es,Rc=-1;function W3(){!oo||!Es||(oo=!1,Es.length?hi=Es.concat(hi):Rc=-1,hi.length&&om())}function om(){if(!oo){var e=sm(W3);oo=!0;for(var t=hi.length;t;){for(Es=hi,hi=[];++Rc<t;)Es&&Es[Rc].run();Rc=-1,t=hi.length}Es=null,oo=!1,q3(e)}}sr.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];hi.push(new am(e,t)),hi.length===1&&!oo&&sm(om)};function am(e,t){this.fun=e,this.array=t}am.prototype.run=function(){this.fun.apply(null,this.array)},sr.title="browser",sr.browser=!0,sr.env={},sr.argv=[],sr.version="",sr.versions={};function pi(){}sr.on=pi,sr.addListener=pi,sr.once=pi,sr.off=pi,sr.removeListener=pi,sr.removeAllListeners=pi,sr.emit=pi,sr.prependListener=pi,sr.prependOnceListener=pi,sr.listeners=function(e){return[]},sr.binding=function(e){throw new Error("process.binding is not supported")},sr.cwd=function(){return"/"},sr.chdir=function(e){throw new Error("process.chdir is not supported")},sr.umask=function(){return 0};var G3=im.exports;const gn=z3(G3);var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ga(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dc(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 pf={exports:{}},va={};/**
1
+ (function(Ht,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):(Ht=typeof globalThis<"u"?globalThis:Ht||self,te(Ht.CetusSwap={},Ht.React,Ht.ReactDOM,Ht.dappKit))})(this,function(Ht,te,kn,Ur){"use strict";var CD=Object.defineProperty;var MD=(Ht,te,kn)=>te in Ht?CD(Ht,te,{enumerable:!0,configurable:!0,writable:!0,value:kn}):Ht[te]=kn;var gt=(Ht,te,kn)=>(MD(Ht,typeof te!="symbol"?te+"":te,kn),kn);function Fh(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=Fh(te),Uh=Fh(kn);function T2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vh={exports:{}},ur=Vh.exports={},Dn,Bn;function tl(){throw new Error("setTimeout has not been defined")}function rl(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Dn=setTimeout:Dn=tl}catch{Dn=tl}try{typeof clearTimeout=="function"?Bn=clearTimeout:Bn=rl}catch{Bn=rl}})();function zh(e){if(Dn===setTimeout)return setTimeout(e,0);if((Dn===tl||!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 A2(e){if(Bn===clearTimeout)return clearTimeout(e);if((Bn===rl||!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 ri=[],Do=!1,no,Va=-1;function I2(){!Do||!no||(Do=!1,no.length?ri=no.concat(ri):Va=-1,ri.length&&qh())}function qh(){if(!Do){var e=zh(I2);Do=!0;for(var t=ri.length;t;){for(no=ri,ri=[];++Va<t;)no&&no[Va].run();Va=-1,t=ri.length}no=null,Do=!1,A2(e)}}ur.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];ri.push(new Hh(e,t)),ri.length===1&&!Do&&zh(qh)};function Hh(e,t){this.fun=e,this.array=t}Hh.prototype.run=function(){this.fun.apply(null,this.array)},ur.title="browser",ur.browser=!0,ur.env={},ur.argv=[],ur.version="",ur.versions={};function ni(){}ur.on=ni,ur.addListener=ni,ur.once=ni,ur.off=ni,ur.removeListener=ni,ur.removeAllListeners=ni,ur.emit=ni,ur.prependListener=ni,ur.prependOnceListener=ni,ur.listeners=function(e){return[]},ur.binding=function(e){throw new Error("process.binding is not supported")},ur.cwd=function(){return"/"},ur.chdir=function(e){throw new Error("process.chdir is not supported")},ur.umask=function(){return 0};var O2=Vh.exports;const hn=T2(O2);var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ks(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wh(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 nl={exports:{}},Ds={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,109 +6,105 @@
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 cm;function H3(){if(cm)return va;cm=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,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,u){var l,f={},h=null,y=null;u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(y=c.ref);for(l in c)n.call(c,l)&&!s.hasOwnProperty(l)&&(f[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)f[l]===void 0&&(f[l]=c[l]);return{$$typeof:t,type:a,key:h,ref:y,props:f,_owner:i.current}}return va.Fragment=r,va.jsx=o,va.jsxs=o,va}var ya={},um;function K3(){return um||(um=1,gn.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"),s=Symbol.for("react.profiler"),o=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"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),b=Symbol.iterator,w="@@iterator";function T(V){if(V===null||typeof V!="object")return null;var oe=b&&V[b]||V[w];return typeof oe=="function"?oe:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(V){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)pe[ke-1]=arguments[ke];R("error",V,pe)}}function R(V,oe,pe){{var ke=P.ReactDebugCurrentFrame,Ke=ke.getStackAddendum();Ke!==""&&(oe+="%s",pe=pe.concat([Ke]));var Ne=pe.map(function(Ve){return String(Ve)});Ne.unshift("Warning: "+oe),Function.prototype.apply.call(console[V],console,Ne)}}var F=!1,L=!1,G=!1,q=!1,X=!1,ie;ie=Symbol.for("react.module.reference");function ae(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===s||X||V===i||V===u||V===l||q||V===y||F||L||G||typeof V=="object"&&V!==null&&(V.$$typeof===h||V.$$typeof===f||V.$$typeof===o||V.$$typeof===a||V.$$typeof===c||V.$$typeof===ie||V.getModuleId!==void 0))}function ce(V,oe,pe){var ke=V.displayName;if(ke)return ke;var Ke=oe.displayName||oe.name||"";return Ke!==""?pe+"("+Ke+")":pe}function z(V){return V.displayName||"Context"}function D(V){if(V==null)return null;if(typeof V.tag=="number"&&k("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 s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof V=="object")switch(V.$$typeof){case a:var oe=V;return z(oe)+".Consumer";case o:var pe=V;return z(pe._context)+".Provider";case c:return ce(V,V.render,"ForwardRef");case f:var ke=V.displayName||null;return ke!==null?ke:D(V.type)||"Memo";case h:{var Ke=V,Ne=Ke._payload,Ve=Ke._init;try{return D(Ve(Ne))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,A,E,O,C,g;function v(){}v.__reactDisabledLog=!0;function j(){{if(d===0){m=console.log,x=console.info,A=console.warn,E=console.error,O=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})}d++}}function ee(){{if(d--,d===0){var V={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},V,{value:m}),info:p({},V,{value:x}),warn:p({},V,{value:A}),error:p({},V,{value:E}),group:p({},V,{value:O}),groupCollapsed:p({},V,{value:C}),groupEnd:p({},V,{value:g})})}d<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=P.ReactCurrentDispatcher,he;function ye(V,oe,pe){{if(he===void 0)try{throw Error()}catch(Ke){var ke=Ke.stack.trim().match(/\n( *(at )?)/);he=ke&&ke[1]||""}return`
10
- `+he+V}}var Ee=!1,Se;{var Ge=typeof WeakMap=="function"?WeakMap:Map;Se=new Ge}function Ue(V,oe){if(!V||Ee)return"";{var pe=Se.get(V);if(pe!==void 0)return pe}var ke;Ee=!0;var Ke=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ne;Ne=se.current,se.current=null,j();try{if(oe){var Ve=function(){throw Error()};if(Object.defineProperty(Ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ve,[])}catch(Yt){ke=Yt}Reflect.construct(V,[],Ve)}else{try{Ve.call()}catch(Yt){ke=Yt}V.call(Ve.prototype)}}else{try{throw Error()}catch(Yt){ke=Yt}V()}}catch(Yt){if(Yt&&ke&&typeof Yt.stack=="string"){for(var ut=Yt.stack.split(`
11
- `),Jt=ke.stack.split(`
12
- `),Nt=ut.length-1,Lt=Jt.length-1;Nt>=1&&Lt>=0&&ut[Nt]!==Jt[Lt];)Lt--;for(;Nt>=1&&Lt>=0;Nt--,Lt--)if(ut[Nt]!==Jt[Lt]){if(Nt!==1||Lt!==1)do if(Nt--,Lt--,Lt<0||ut[Nt]!==Jt[Lt]){var ir=`
13
- `+ut[Nt].replace(" at new "," at ");return V.displayName&&ir.includes("<anonymous>")&&(ir=ir.replace("<anonymous>",V.displayName)),typeof V=="function"&&Se.set(V,ir),ir}while(Nt>=1&&Lt>=0);break}}}finally{Ee=!1,se.current=Ne,ee(),Error.prepareStackTrace=Ke}var Er=V?V.displayName||V.name:"",or=Er?ye(Er):"";return typeof V=="function"&&Se.set(V,or),or}function dt(V,oe,pe){return Ue(V,!1)}function ht(V){var oe=V.prototype;return!!(oe&&oe.isReactComponent)}function $e(V,oe,pe){if(V==null)return"";if(typeof V=="function")return Ue(V,ht(V));if(typeof V=="string")return ye(V);switch(V){case u:return ye("Suspense");case l:return ye("SuspenseList")}if(typeof V=="object")switch(V.$$typeof){case c:return dt(V.render);case f:return $e(V.type,oe,pe);case h:{var ke=V,Ke=ke._payload,Ne=ke._init;try{return $e(Ne(Ke),oe,pe)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,xe={},ge=P.ReactDebugCurrentFrame;function Te(V){if(V){var oe=V._owner,pe=$e(V.type,V._source,oe?oe.type:null);ge.setExtraStackFrame(pe)}else ge.setExtraStackFrame(null)}function We(V,oe,pe,ke,Ke){{var Ne=Function.call.bind(mt);for(var Ve in V)if(Ne(V,Ve)){var ut=void 0;try{if(typeof V[Ve]!="function"){var Jt=Error((ke||"React class")+": "+pe+" type `"+Ve+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof V[Ve]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Jt.name="Invariant Violation",Jt}ut=V[Ve](oe,Ve,ke,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Nt){ut=Nt}ut&&!(ut instanceof Error)&&(Te(Ke),k("%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).",ke||"React class",pe,Ve,typeof ut),Te(null)),ut instanceof Error&&!(ut.message in xe)&&(xe[ut.message]=!0,Te(Ke),k("Failed %s type: %s",pe,ut.message),Te(null))}}}var De=Array.isArray;function Oe(V){return De(V)}function Ie(V){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&V[Symbol.toStringTag]||V.constructor.name||"Object";return pe}}function Fe(V){try{return lt(V),!1}catch{return!0}}function lt(V){return""+V}function ft(V){if(Fe(V))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ie(V)),lt(V)}var He=P.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},St,et,Tt;Tt={};function Bt(V){if(mt.call(V,"ref")){var oe=Object.getOwnPropertyDescriptor(V,"ref").get;if(oe&&oe.isReactWarning)return!1}return V.ref!==void 0}function nt(V){if(mt.call(V,"key")){var oe=Object.getOwnPropertyDescriptor(V,"key").get;if(oe&&oe.isReactWarning)return!1}return V.key!==void 0}function Et(V,oe){if(typeof V.ref=="string"&&He.current&&oe&&He.current.stateNode!==oe){var pe=D(He.current.type);Tt[pe]||(k('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(He.current.type),V.ref),Tt[pe]=!0)}}function Ot(V,oe){{var pe=function(){St||(St=!0,k("%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)",oe))};pe.isReactWarning=!0,Object.defineProperty(V,"key",{get:pe,configurable:!0})}}function st(V,oe){{var pe=function(){et||(et=!0,k("%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)",oe))};pe.isReactWarning=!0,Object.defineProperty(V,"ref",{get:pe,configurable:!0})}}var kt=function(V,oe,pe,ke,Ke,Ne,Ve){var ut={$$typeof:t,type:V,key:oe,ref:pe,props:Ve,_owner:Ne};return ut._store={},Object.defineProperty(ut._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ut,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(ut,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ke}),Object.freeze&&(Object.freeze(ut.props),Object.freeze(ut)),ut};function It(V,oe,pe,ke,Ke){{var Ne,Ve={},ut=null,Jt=null;pe!==void 0&&(ft(pe),ut=""+pe),nt(oe)&&(ft(oe.key),ut=""+oe.key),Bt(oe)&&(Jt=oe.ref,Et(oe,Ke));for(Ne in oe)mt.call(oe,Ne)&&!jt.hasOwnProperty(Ne)&&(Ve[Ne]=oe[Ne]);if(V&&V.defaultProps){var Nt=V.defaultProps;for(Ne in Nt)Ve[Ne]===void 0&&(Ve[Ne]=Nt[Ne])}if(ut||Jt){var Lt=typeof V=="function"?V.displayName||V.name||"Unknown":V;ut&&Ot(Ve,Lt),Jt&&st(Ve,Lt)}return kt(V,ut,Jt,Ke,ke,He.current,Ve)}}var it=P.ReactCurrentOwner,_t=P.ReactDebugCurrentFrame;function At(V){if(V){var oe=V._owner,pe=$e(V.type,V._source,oe?oe.type:null);_t.setExtraStackFrame(pe)}else _t.setExtraStackFrame(null)}var Ye;Ye=!1;function gt(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function Pt(){{if(it.current){var V=D(it.current.type);if(V)return`
9
+ */var Gh;function P2(){if(Gh)return Ds;Gh=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 Ds.Fragment=r,Ds.jsx=s,Ds.jsxs=s,Ds}var Bs={},Kh;function R2(){return Kh||(Kh=1,hn.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"),x=Symbol.iterator,y="@@iterator";function A(V){if(V===null||typeof V!="object")return null;var oe=x&&V[x]||V[y];return typeof oe=="function"?oe:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(V){{for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),Oe=1;Oe<oe;Oe++)fe[Oe-1]=arguments[Oe];k("error",V,fe)}}function k(V,oe,fe){{var Oe=O.ReactDebugCurrentFrame,qe=Oe.getStackAddendum();qe!==""&&(oe+="%s",fe=fe.concat([qe]));var Pe=fe.map(function($e){return String($e)});Pe.unshift("Warning: "+oe),Function.prototype.apply.call(console[V],console,Pe)}}var F=!1,$=!1,H=!1,q=!1,Y=!1,ne;ne=Symbol.for("react.module.reference");function se(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===o||Y||V===i||V===u||V===l||q||V===w||F||$||H||typeof V=="object"&&V!==null&&(V.$$typeof===p||V.$$typeof===d||V.$$typeof===s||V.$$typeof===a||V.$$typeof===c||V.$$typeof===ne||V.getModuleId!==void 0))}function ae(V,oe,fe){var Oe=V.displayName;if(Oe)return Oe;var qe=oe.displayName||oe.name||"";return qe!==""?fe+"("+qe+")":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 oe=V;return z(oe)+".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 qe=V,Pe=qe._payload,$e=qe._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,oe,fe){{if(le===void 0)try{throw Error()}catch(qe){var Oe=qe.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,oe){if(!V||xe)return"";{var fe=be.get(V);if(fe!==void 0)return fe}var Oe;xe=!0;var qe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Pe;Pe=ie.current,ie.current=null,N();try{if(oe){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
+ `),kt=at.length-1,Ut=Qt.length-1;kt>=1&&Ut>=0&&at[kt]!==Qt[Ut];)Ut--;for(;kt>=1&&Ut>=0;kt--,Ut--)if(at[kt]!==Qt[Ut]){if(kt!==1||Ut!==1)do if(kt--,Ut--,Ut<0||at[kt]!==Qt[Ut]){var cr=`
13
+ `+at[kt].replace(" at new "," at ");return V.displayName&&cr.includes("<anonymous>")&&(cr=cr.replace("<anonymous>",V.displayName)),typeof V=="function"&&be.set(V,cr),cr}while(kt>=1&&Ut>=0);break}}}finally{xe=!1,ie.current=Pe,ee(),Error.prepareStackTrace=qe}var Tr=V?V.displayName||V.name:"",lr=Tr?me(Tr):"";return typeof V=="function"&&be.set(V,lr),lr}function ft(V,oe,fe){return Le(V,!1)}function dt(V){var oe=V.prototype;return!!(oe&&oe.isReactComponent)}function je(V,oe,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,oe,fe);case p:{var Oe=V,qe=Oe._payload,Pe=Oe._init;try{return je(Pe(qe),oe,fe)}catch{}}}return""}var pt=Object.prototype.hasOwnProperty,we={},he=O.ReactDebugCurrentFrame;function Ce(V){if(V){var oe=V._owner,fe=je(V.type,V._source,oe?oe.type:null);he.setExtraStackFrame(fe)}else he.setExtraStackFrame(null)}function Ue(V,oe,fe,Oe,qe){{var Pe=Function.call.bind(pt);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](oe,$e,Oe,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(kt){at=kt}at&&!(at instanceof Error)&&(Ce(qe),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(qe),R("Failed %s type: %s",fe,at.message),Ce(null))}}}var Ne=Array.isArray;function Me(V){return Ne(V)}function Ae(V){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,fe=oe&&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.",Ae(V)),ut(V)}var ze=O.ReactCurrentOwner,Nt={key:!0,ref:!0,__self:!0,__source:!0},Et,Ze,At;At={};function Ft(V){if(pt.call(V,"ref")){var oe=Object.getOwnPropertyDescriptor(V,"ref").get;if(oe&&oe.isReactWarning)return!1}return V.ref!==void 0}function Qe(V){if(pt.call(V,"key")){var oe=Object.getOwnPropertyDescriptor(V,"key").get;if(oe&&oe.isReactWarning)return!1}return V.key!==void 0}function _t(V,oe){if(typeof V.ref=="string"&&ze.current&&oe&&ze.current.stateNode!==oe){var fe=D(ze.current.type);At[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),At[fe]=!0)}}function It(V,oe){{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)",oe))};fe.isReactWarning=!0,Object.defineProperty(V,"key",{get:fe,configurable:!0})}}function rt(V,oe){{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)",oe))};fe.isReactWarning=!0,Object.defineProperty(V,"ref",{get:fe,configurable:!0})}}var jt=function(V,oe,fe,Oe,qe,Pe,$e){var at={$$typeof:t,type:V,key:oe,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:qe}),Object.freeze&&(Object.freeze(at.props),Object.freeze(at)),at};function Ot(V,oe,fe,Oe,qe){{var Pe,$e={},at=null,Qt=null;fe!==void 0&&(lt(fe),at=""+fe),Qe(oe)&&(lt(oe.key),at=""+oe.key),Ft(oe)&&(Qt=oe.ref,_t(oe,qe));for(Pe in oe)pt.call(oe,Pe)&&!Nt.hasOwnProperty(Pe)&&($e[Pe]=oe[Pe]);if(V&&V.defaultProps){var kt=V.defaultProps;for(Pe in kt)$e[Pe]===void 0&&($e[Pe]=kt[Pe])}if(at||Qt){var Ut=typeof V=="function"?V.displayName||V.name||"Unknown":V;at&&It($e,Ut),Qt&&rt($e,Ut)}return jt(V,at,Qt,qe,Oe,ze.current,$e)}}var et=O.ReactCurrentOwner,xt=O.ReactDebugCurrentFrame;function Mt(V){if(V){var oe=V._owner,fe=je(V.type,V._source,oe?oe.type:null);xt.setExtraStackFrame(fe)}else xt.setExtraStackFrame(null)}var Ge;Ge=!1;function mt(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function Pt(){{if(et.current){var V=D(et.current.type);if(V)return`
14
14
 
15
- Check the render method of \``+V+"`."}return""}}function ot(V){{if(V!==void 0){var oe=V.fileName.replace(/^.*[\\\/]/,""),pe=V.lineNumber;return`
15
+ Check the render method of \``+V+"`."}return""}}function nt(V){{if(V!==void 0){var oe=V.fileName.replace(/^.*[\\\/]/,""),fe=V.lineNumber;return`
16
16
 
17
- Check your code at `+oe+":"+pe+"."}return""}}var xt={};function Ut(V){{var oe=Pt();if(!oe){var pe=typeof V=="string"?V:V.displayName||V.name;pe&&(oe=`
17
+ Check your code at `+oe+":"+fe+"."}return""}}var St={};function zt(V){{var oe=Pt();if(!oe){var fe=typeof V=="string"?V:V.displayName||V.name;fe&&(oe=`
18
18
 
19
- Check the top-level render call using <`+pe+">.")}return oe}}function N(V,oe){{if(!V._store||V._store.validated||V.key!=null)return;V._store.validated=!0;var pe=Ut(oe);if(xt[pe])return;xt[pe]=!0;var ke="";V&&V._owner&&V._owner!==it.current&&(ke=" It was passed a child from "+D(V._owner.type)+"."),At(V),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,ke),At(null)}}function S(V,oe){{if(typeof V!="object")return;if(Oe(V))for(var pe=0;pe<V.length;pe++){var ke=V[pe];gt(ke)&&N(ke,oe)}else if(gt(V))V._store&&(V._store.validated=!0);else if(V){var Ke=T(V);if(typeof Ke=="function"&&Ke!==V.entries)for(var Ne=Ke.call(V),Ve;!(Ve=Ne.next()).done;)gt(Ve.value)&&N(Ve.value,oe)}}}function M(V){{var oe=V.type;if(oe==null||typeof oe=="string")return;var pe;if(typeof oe=="function")pe=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===f))pe=oe.propTypes;else return;if(pe){var ke=D(oe);We(pe,V.props,"prop",ke,V)}else if(oe.PropTypes!==void 0&&!Ye){Ye=!0;var Ke=D(oe);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ke||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function B(V){{for(var oe=Object.keys(V.props),pe=0;pe<oe.length;pe++){var ke=oe[pe];if(ke!=="children"&&ke!=="key"){At(V),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),At(null);break}}V.ref!==null&&(At(V),k("Invalid attribute `ref` supplied to `React.Fragment`."),At(null))}}var K={};function Z(V,oe,pe,ke,Ke,Ne){{var Ve=ae(V);if(!Ve){var ut="";(V===void 0||typeof V=="object"&&V!==null&&Object.keys(V).length===0)&&(ut+=" 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 Jt=ot(Ke);Jt?ut+=Jt:ut+=Pt();var Nt;V===null?Nt="null":Oe(V)?Nt="array":V!==void 0&&V.$$typeof===t?(Nt="<"+(D(V.type)||"Unknown")+" />",ut=" Did you accidentally export a JSX literal instead of a component?"):Nt=typeof V,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Nt,ut)}var Lt=It(V,oe,pe,Ke,Ne);if(Lt==null)return Lt;if(Ve){var ir=oe.children;if(ir!==void 0)if(ke)if(Oe(ir)){for(var Er=0;Er<ir.length;Er++)S(ir[Er],V);Object.freeze&&Object.freeze(ir)}else k("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 S(ir,V)}if(mt.call(oe,"key")){var or=D(V),Yt=Object.keys(oe).filter(function(Kr){return Kr!=="key"}),br=Yt.length>0?"{key: someKey, "+Yt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[or+br]){var Dn=Yt.length>0?"{"+Yt.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
19
+ Check the top-level render call using <`+fe+">.")}return oe}}function j(V,oe){{if(!V._store||V._store.validated||V.key!=null)return;V._store.validated=!0;var fe=zt(oe);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,oe){{if(typeof V!="object")return;if(Me(V))for(var fe=0;fe<V.length;fe++){var Oe=V[fe];mt(Oe)&&j(Oe,oe)}else if(mt(V))V._store&&(V._store.validated=!0);else if(V){var qe=A(V);if(typeof qe=="function"&&qe!==V.entries)for(var Pe=qe.call(V),$e;!($e=Pe.next()).done;)mt($e.value)&&j($e.value,oe)}}}function T(V){{var oe=V.type;if(oe==null||typeof oe=="string")return;var fe;if(typeof oe=="function")fe=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===d))fe=oe.propTypes;else return;if(fe){var Oe=D(oe);Ue(fe,V.props,"prop",Oe,V)}else if(oe.PropTypes!==void 0&&!Ge){Ge=!0;var qe=D(oe);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",qe||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function L(V){{for(var oe=Object.keys(V.props),fe=0;fe<oe.length;fe++){var Oe=oe[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 K={};function J(V,oe,fe,Oe,qe,Pe){{var $e=se(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(qe);Qt?at+=Qt:at+=Pt();var kt;V===null?kt="null":Me(V)?kt="array":V!==void 0&&V.$$typeof===t?(kt="<"+(D(V.type)||"Unknown")+" />",at=" Did you accidentally export a JSX literal instead of a component?"):kt=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",kt,at)}var Ut=Ot(V,oe,fe,qe,Pe);if(Ut==null)return Ut;if($e){var cr=oe.children;if(cr!==void 0)if(Oe)if(Me(cr)){for(var Tr=0;Tr<cr.length;Tr++)E(cr[Tr],V);Object.freeze&&Object.freeze(cr)}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(cr,V)}if(pt.call(oe,"key")){var lr=D(V),er=Object.keys(oe).filter(function(Gr){return Gr!=="key"}),xr=er.length>0?"{key: someKey, "+er.join(": ..., ")+": ...}":"{key: someKey}";if(!K[lr+xr]){var Rn=er.length>0?"{"+er.join(": ..., ")+": ...}":"{}";R(`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} />`,br,or,Dn,or),K[or+br]=!0}}return V===n?B(Lt):M(Lt),Lt}}function re(V,oe,pe){return Z(V,oe,pe,!0)}function Be(V,oe,pe){return Z(V,oe,pe,!1)}var rt=Be,Re=re;ya.Fragment=n,ya.jsx=rt,ya.jsxs=Re}()),ya}gn.env.NODE_ENV==="production"?pf.exports=H3():pf.exports=K3();var _=pf.exports;const TX="",OX="",IX="";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,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};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 f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},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&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const PX="",jX="",kX="",NX="";function Vn(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.')}const X3="1.18.0",J3="1.40.0",Y3={"-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 mf extends Error{}class gf extends mf{constructor(t,r){super(t),this.code=r,this.type=Y3[r]??"ServerError"}}class lm extends mf{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var fm=e=>{throw TypeError(e)},vf=(e,t,r)=>t.has(e)||fm("Cannot "+r),tr=(e,t,r)=>(vf(e,t,"read from private field"),r?r.call(e):t.get(e)),Cs=(e,t,r)=>t.has(e)?fm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ao=(e,t,r,n)=>(vf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),dm=(e,t,r)=>(vf(e,t,"access private method"),r),Z3=(e,t,r,n)=>({set _(i){ao(e,t,i,r)},get _(){return tr(e,t,n)}}),As,ba,mi,Ms,wa,co,$c,hm,pm;function Q3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const eE={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class tE{constructor(t,r={}){if(Cs(this,$c),Cs(this,As,0),Cs(this,ba,0),Cs(this,mi,null),Cs(this,Ms,null),Cs(this,wa,new Set),Cs(this,co,new Map),this.endpoint=t,this.options={...eE,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=Q3(this.endpoint))}async makeRequest(t,r){const n=await dm(this,$c,hm).call(this);return new Promise((i,s)=>{ao(this,As,tr(this,As)+1),tr(this,co).set(tr(this,As),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,co).delete(tr(this,As)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,As),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new gf(i.message,i.code);return s})}async subscribe(t){const r=new rE(t);return tr(this,wa).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}As=new WeakMap,ba=new WeakMap,mi=new WeakMap,Ms=new WeakMap,wa=new WeakMap,co=new WeakMap,$c=new WeakSet,hm=function(){return tr(this,Ms)?tr(this,Ms):(ao(this,Ms,new Promise(e=>{var t;(t=tr(this,mi))==null||t.close(),ao(this,mi,new this.options.WebSocketConstructor(this.endpoint)),tr(this,mi).addEventListener("open",()=>{ao(this,ba,0),e(tr(this,mi))}),tr(this,mi).addEventListener("close",()=>{Z3(this,ba)._++,tr(this,ba)<=this.options.maxReconnects&&setTimeout(()=>{dm(this,$c,pm).call(this)},this.options.reconnectTimeout)}),tr(this,mi).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&&tr(this,co).has(n.id)){const{resolve:i,timeout:s}=tr(this,co).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;tr(this,wa).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),tr(this,Ms))},pm=async function(){var e;return(e=tr(this,mi))==null||e.close(),ao(this,Ms,null),Promise.allSettled([...tr(this,wa)].map(t=>t.subscribe(this)))};class rE{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 mm=e=>{throw TypeError(e)},yf=(e,t,r)=>t.has(e)||mm("Cannot "+r),tn=(e,t,r)=>(yf(e,t,"read from private field"),r?r.call(e):t.get(e)),Bc=(e,t,r)=>t.has(e)?mm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bf=(e,t,r,n)=>(yf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),nE=(e,t,r)=>(yf(e,t,"access private method"),r),_a,vn,xa,wf,gm;class vm{constructor(t){Bc(this,wf),Bc(this,_a,0),Bc(this,vn),Bc(this,xa),bf(this,vn,t)}fetch(t,r){const n=tn(this,vn).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,s;bf(this,_a,tn(this,_a)+1);const r=await this.fetch(((i=tn(this,vn).rpc)==null?void 0:i.url)??tn(this,vn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":X3,"Client-Target-Api-Version":J3,"Client-Request-Method":t.method,...(s=tn(this,vn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:tn(this,_a),method:t.method,params:t.params})});if(!r.ok)throw new lm(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new gf(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await nE(this,wf,gm).call(this).subscribe(t);return async()=>!!await r()}}_a=new WeakMap,vn=new WeakMap,xa=new WeakMap,wf=new WeakSet,gm=function(){var e;if(!tn(this,xa)){const t=tn(this,vn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");bf(this,xa,new tE(((e=tn(this,vn).websocket)==null?void 0:e.url)??tn(this,vn).url,{WebSocketConstructor:t,...tn(this,vn).websocket}))}return tn(this,xa)};function ym(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 iE(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),f=l.charCodeAt(0);if(t[f]!==255)throw new TypeError(l+" is ambiguous");t[f]=u}const r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let l=0,f=0,h=0;const y=u.length;for(;h!==y&&u[h]===0;)h++,l++;const b=(y-h)*s+1>>>0,w=new Uint8Array(b);for(;h!==y;){let k=u[h],R=0;for(let F=b-1;(k!==0||R<f)&&F!==-1;F--,R++)k+=256*w[F]>>>0,w[F]=k%r>>>0,k=k/r>>>0;if(k!==0)throw new Error("Non-zero carry");f=R,h++}let T=b-f;for(;T!==b&&w[T]===0;)T++;let P=n.repeat(l);for(;T<b;++T)P+=e.charAt(w[T]);return P}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,f=0,h=0;for(;u[l]===n;)f++,l++;const y=(u.length-l)*i+1>>>0,b=new Uint8Array(y);for(;u[l];){let k=t[u.charCodeAt(l)];if(k===255)return;let R=0;for(let F=y-1;(k!==0||R<h)&&F!==-1;F--,R++)k+=r*b[F]>>>0,b[F]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");h=R,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const T=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)T[P++]=b[w++];return T}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var sE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const bm=iE(sE),uo=e=>bm.encode(e),gi=e=>bm.decode(e),oE=uo,aE=gi;function yn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const _f=8192;function Xr(e){if(e.length<_f)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=_f){const n=e.slice(r,r+_f);t+=String.fromCharCode(...n)}return btoa(t)}const wm=Xr,_m=yn;function lo(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(s=>parseInt(s,16)))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function vi(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const xm=vi,Sm=lo;function xf(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 cE(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 Em{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}=cE(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 Cm(e,t){switch(t){case"base58":return uo(e);case"base64":return Xr(e);case"hex":return vi(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function uE(e,t){switch(t){case"base58":return gi(e);case"base64":return yn(e);case"hex":return lo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Sf(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class Am{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 Ef(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Ef(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Ef(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return xf(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 Cm(this.toBytes(),t)}}function Ef(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 Mm=e=>{throw TypeError(e)},Tm=(e,t,r)=>t.has(e)||Mm("Cannot "+r),bn=(e,t,r)=>(Tm(e,t,"read from private field"),r?r.call(e):t.get(e)),Lc=(e,t,r)=>t.has(e)?Mm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Fc=(e,t,r,n)=>(Tm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),fo,Sa,Uc,Gi;const lE=class U3{constructor(t){Lc(this,fo),Lc(this,Sa),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fc(this,fo,t.write),Fc(this,Sa,t.serialize??((r,n)=>{const i=new Am({initialSize:this.serializedSize(r)??void 0,...n});return bn(this,fo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),bn(this,fo).call(this,t,r)}serialize(t,r){return this.validate(t),new Im(this,bn(this,Sa).call(this,t,r))}parse(t){const r=new Em(t);return this.read(r)}fromHex(t){return this.parse(lo(t))}fromBase58(t){return this.parse(gi(t))}fromBase64(t){return this.parse(yn(t))}transform({name:t,input:r,output:n,validate:i}){return new U3({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>bn(this,fo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>bn(this,Sa).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};fo=new WeakMap,Sa=new WeakMap;let zn=lE;const Om=Symbol.for("@mysten/serialized-bcs");function fE(e){return!!e&&typeof e=="object"&&e[Om]===!0}class Im{constructor(t,r){Lc(this,Uc),Lc(this,Gi),Fc(this,Uc,t),Fc(this,Gi,r)}get[Om](){return!0}toBytes(){return bn(this,Gi)}toHex(){return vi(bn(this,Gi))}toBase64(){return Xr(bn(this,Gi))}toBase58(){return uo(bn(this,Gi))}parse(){return bn(this,Uc).parse(bn(this,Gi))}}Uc=new WeakMap,Gi=new WeakMap;function Vc({size:e,...t}){return new zn({...t,serializedSize:()=>e})}function Cf({readMethod:e,writeMethod:t,...r}){return Vc({...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 Af({readMethod:e,writeMethod:t,...r}){return Vc({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;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}`);(s=r.validate)==null||s.call(r,i)}})}function dE({serialize:e,...t}){const r=new zn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function hE({toBytes:e,fromBytes:t,...r}){return new zn({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=xf(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},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 pE(e){let t=null;function r(){return t||(t=e()),t}return new zn({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 Cf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Cf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Cf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Af({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Af({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Af({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Vc({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 dE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(xf(t)),...e})},bytes(e,t){return Vc({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{const i=new Uint8Array(r);for(let s=0;s<e;s++)n.write8(i[s]??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 hE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new zn({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,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 zn({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=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 zn({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}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 zn({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.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 zn({name:e,read:i=>{const s=i.readULEB(),o=n[s];if(!o)throw new TypeError(`Unknown value ${s} for enum ${e}`);const[a,c]=o;return{[a]:(c==null?void 0:c.read(i))??!0,$kind:a}},write:(i,s)=>{const[o,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===o){s.writeULEB(c),l==null||l.write(a,s);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 s=Object.keys(i).filter(c=>i[c]!==void 0&&Object.hasOwn(t,c));if(s.length!==1)throw new TypeError(`Expected object with one key, but found ${s.length} for type ${e}}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},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,s]of r)n.set(i,s);return n}})},lazy(e){return pE(e)}},mE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:Em,BcsType:zn,BcsWriter:Am,SerializedBcs:Im,bcs:W,decodeStr:uE,encodeStr:Cm,fromB58:aE,fromB64:_m,fromBase58:gi,fromBase64:yn,fromHEX:Sm,fromHex:lo,isSerializedBcs:fE,splitGenericParameters:Sf,toB58:oE,toB64:wm,toBase58:uo,toBase64:Xr,toHEX:xm,toHex:vi},Symbol.toStringTag,{value:"Module"})),gE=32;function Mf(e){try{return gi(e).length===gE}catch{return!1}}const zc=32;function yi(e){return yE(e)&&bE(e)===zc}function Ea(e){return yi(e)}function vE(e){return e.includes("::")?Tf(e):e}function Tf(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?Sf(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>vE(o.trim())):[];return{address:Vr(t),module:r,name:i,typeParams:s}}function Pm(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Tf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Pm(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Vr(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(zc*2,"0")}`}function bi(e,t=!1){return Vr(e,t)}function yE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function bE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const wE=/^vector<(.+)>$/,_E=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let jm=class ma{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:ma.parseFromStr(n[1],r)};const i=t.match(_E);if(i)return{struct:{address:r?Vr(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:ma.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Sf(t).map(n=>ma.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<${ma.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(ma.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function xE(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function SE(e){return W.enum("Option",{None:null,Some:e})}const er=W.bytes(zc).transform({validate:e=>{const t=typeof e=="string"?e:vi(e);if(!t||!yi(Vr(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?lo(Vr(e)):e,output:e=>Vr(vi(e))}),wn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>gi(e),output:e=>uo(new Uint8Array(e)),validate:e=>{if(gi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),rn=W.struct("SuiObjectRef",{objectId:er,version:W.u64(),digest:wn}),km=W.struct("SharedObjectRef",{objectId:er,initialSharedVersion:W.u64(),mutable:W.bool()}),Nm=W.enum("ObjectArg",{ImmOrOwnedObject:rn,SharedObject:km,Receiving:rn}),Rm=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?yn(e):e,output:e=>Xr(new Uint8Array(e))})}),Object:Nm}),Of=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>Of),struct:W.lazy(()=>Um),u16:null,u32:null,u256:null}),If=Of.transform({input:e=>typeof e=="string"?jm.parseFromStr(e,!0):e,output:e=>jm.tagToString(e)}),qn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),Dm=W.struct("ProgrammableMoveCall",{package:er,module:W.string(),function:W.string(),typeArguments:W.vector(If),arguments:W.vector(qn)}),$m=W.enum("Command",{MoveCall:Dm,TransferObjects:W.struct("TransferObjects",{objects:W.vector(qn),address:qn}),SplitCoins:W.struct("SplitCoins",{coin:qn,amounts:W.vector(qn)}),MergeCoins:W.struct("MergeCoins",{destination:qn,sources:W.vector(qn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?yn(e):e,output:e=>Xr(new Uint8Array(e))})),dependencies:W.vector(er)}),MakeMoveVec:W.struct("MakeMoveVec",{type:SE(If).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(qn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?yn(e):e,output:e=>Xr(new Uint8Array(e))})),dependencies:W.vector(er),package:er,ticket:qn})}),Bm=W.struct("ProgrammableTransaction",{inputs:W.vector(Rm),commands:W.vector($m)}),Lm=W.enum("TransactionKind",{ProgrammableTransaction:Bm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Fm=W.enum("TransactionExpiration",{None:null,Epoch:xE()}),Um=W.struct("StructTag",{address:er,module:W.string(),name:W.string(),typeParams:W.vector(Of)}),Vm=W.struct("GasData",{payment:W.vector(rn),owner:er,price:W.u64(),budget:W.u64()}),zm=W.struct("TransactionDataV1",{kind:Lm,sender:er,gasData:Vm,expiration:Fm}),qm=W.enum("TransactionData",{V1:zm}),Wm=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Gm=W.enum("IntentVersion",{V0:null}),Hm=W.enum("AppId",{Sui:null}),Km=W.struct("Intent",{scope:Wm,version:Gm,appId:Hm});function Xm(e){return W.struct(`IntentMessage<${e.name}>`,{intent:Km,value:e})}const Jm=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())}),Ym=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())}),Zm=W.struct("MultiSigPkMap",{pubKey:Ym,weight:W.u8()}),Qm=W.struct("MultiSigPublicKey",{pk_map:W.vector(Zm),threshold:W.u16()}),EE=W.struct("MultiSig",{sigs:W.vector(Jm),bitmap:W.u16(),multisig_pk:Qm}),CE=W.vector(W.u8()).transform({input:e=>typeof e=="string"?yn(e):e,output:e=>Xr(new Uint8Array(e))}),eg=W.struct("SenderSignedTransaction",{intentMessage:Xm(qm),txSignatures:W.vector(CE)}),AE=W.vector(eg,{name:"SenderSignedData"}),ME=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),TE=W.enum("PackageUpgradeError",{UnableToFetchPackage:W.struct("UnableToFetchPackage",{packageId:er}),NotAPackage:W.struct("NotAPackage",{objectId:er}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:er,ticketId:er})}),OE=W.struct("ModuleId",{address:er,name:W.string()}),tg=W.struct("MoveLocation",{module:OE,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),IE=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}),PE=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),jE=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:er}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(tg),MoveAbort:W.tuple([tg,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:IE}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:PE}),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:TE}),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(er)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:er,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),rg=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:jE,command:W.option(W.u64())})}),ng=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),ho=W.enum("Owner",{AddressOwner:er,ObjectOwner:er,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),kE=W.struct("TransactionEffectsV1",{status:rg,executedEpoch:W.u64(),gasUsed:ng,modifiedAtVersions:W.vector(W.tuple([er,W.u64()])),sharedObjects:W.vector(rn),transactionDigest:wn,created:W.vector(W.tuple([rn,ho])),mutated:W.vector(W.tuple([rn,ho])),unwrapped:W.vector(W.tuple([rn,ho])),deleted:W.vector(rn),unwrappedThenDeleted:W.vector(rn),wrapped:W.vector(rn),gasObject:W.tuple([rn,ho]),eventsDigest:W.option(wn),dependencies:W.vector(wn)}),Pf=W.tuple([W.u64(),wn]),NE=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([Pf,ho])}),RE=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([wn,ho]),PackageWrite:Pf}),DE=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),$E=W.struct("EffectsObjectChange",{inputState:NE,outputState:RE,idOperation:DE}),BE=W.enum("UnchangedSharedKind",{ReadOnlyRoot:Pf,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),LE=W.struct("TransactionEffectsV2",{status:rg,executedEpoch:W.u64(),gasUsed:ng,transactionDigest:wn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(wn),dependencies:W.vector(wn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([er,$E])),unchangedSharedObjects:W.vector(W.tuple([er,BE])),auxDataDigest:W.option(wn)}),FE=W.enum("TransactionEffects",{V1:kE,V2:LE}),jf={...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:er,AppId:Hm,Argument:qn,CallArg:Rm,CompressedSignature:Jm,GasData:Vm,Intent:Km,IntentMessage:Xm,IntentScope:Wm,IntentVersion:Gm,MultiSig:EE,MultiSigPkMap:Zm,MultiSigPublicKey:Qm,ObjectArg:Nm,ObjectDigest:wn,ProgrammableMoveCall:Dm,ProgrammableTransaction:Bm,PublicKey:Ym,SenderSignedData:AE,SenderSignedTransaction:eg,SharedObjectRef:km,StructTag:Um,SuiObjectRef:rn,Command:$m,TransactionData:qm,TransactionDataV1:zm,TransactionExpiration:Fm,TransactionKind:Lm,TypeTag:If,TransactionEffects:FE,PasskeyAuthenticator:ME},ig="…";function UE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${ig}${e.slice(-4)}`}function VE(e){return`${e.slice(0,10)}${ig}`}const sg=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,og=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,zE=235;function ag(e){return e.length>zE?!1:e.includes("@")?sg.test(e):og.test(e)}function cg(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!sg.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!og.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 qE=9,WE=BigInt(1e9),GE="0x1",ug="0x2",HE="0x3",KE=bi("0x6"),XE="sui_system",kf=`${ug}::sui::SUI`,JE=bi("0x5"),YE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,ZE=/^\d+$/,QE=64,lg="/",fg=e=>{const t=e.split(lg);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!ZE.test(i)||!ag(r)?!1:YE.test(n)&&n.length<QE},eC=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(lg)&&!fg(r))return!1;return!0};function Nf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function tC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function dg(e,...t){if(!tC(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 hg(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 rC(e,t){dg(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 qc=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ts=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),pg=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,wi=Ts?e=>e:e=>pg(e);function po(e){for(let t=0;t<e.length;t++)e[t]=pg(e[t])}function nC(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ca(e){return typeof e=="string"&&(e=nC(e)),dg(e),e}let iC=class{clone(){return this._cloneInto()}};function sC(e){const t=(n,i)=>e(i).update(Ca(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const oC=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 aC extends iC{constructor(t,r,n={},i,s,o){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,Nf(t),Nf(r),Nf(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!==s)throw new Error("salt must be undefined or "+s);if(n.personalization!==void 0&&n.personalization.length!==o)throw new Error("personalization must be undefined or "+o);this.buffer=new Uint8Array(t),this.buffer32=qc(this.buffer)}update(t){hg(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Ca(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(Ts||po(i),this.compress(i,0,!1),Ts||po(i),this.pos=0);const u=Math.min(r-this.pos,s-c),l=o+c;if(u===r&&!(l%4)&&c+u<s){const f=new Uint32Array(a,l,Math.floor((s-c)/4));Ts||po(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);Ts||po(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){hg(this),rC(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),Ts||po(n),this.compress(n,0,!0),Ts||po(n);const i=qc(t);this.get().forEach((s,o)=>i[o]=wi(s))}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:s,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=s,t.outputLen=o,t.buffer.set(r),t.pos=a,t}}const Wc=BigInt(2**32-1),Rf=BigInt(32);function mg(e,t=!1){return t?{h:Number(e&Wc),l:Number(e>>Rf&Wc)}:{h:Number(e>>Rf&Wc)|0,l:Number(e&Wc)|0}}function cC(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=mg(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const uC=(e,t)=>BigInt(e>>>0)<<Rf|BigInt(t>>>0),lC=(e,t,r)=>e>>>r,fC=(e,t,r)=>e<<32-r|t>>>r,dC=(e,t,r)=>e>>>r|t<<32-r,hC=(e,t,r)=>e<<32-r|t>>>r,pC=(e,t,r)=>e<<64-r|t>>>r-32,mC=(e,t,r)=>e>>>r-32|t<<64-r,gC=(e,t)=>t,vC=(e,t)=>e,yC=(e,t,r)=>e<<r|t>>>32-r,bC=(e,t,r)=>t<<r|e>>>32-r,wC=(e,t,r)=>t<<r-32|e>>>64-r,_C=(e,t,r)=>e<<r-32|t>>>64-r;function xC(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const Rr={fromBig:mg,split:cC,toBig:uC,shrSH:lC,shrSL:fC,rotrSH:dC,rotrSL:hC,rotrBH:pC,rotrBL:mC,rotr32H:gC,rotr32L:vC,rotlSH:yC,rotlSL:bC,rotlBH:wC,rotlBL:_C,add:xC,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,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},fr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function Hi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],T=Rr.add3L(c,l,o);u=Rr.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Rr.rotr32H(w,b),Dl:Rr.rotr32L(w,b)},{h:y,l:h}=Rr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Rr.rotrSH(f,l,24),Bl:Rr.rotrSL(f,l,24)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}function Ki(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],T=Rr.add3L(c,l,o);u=Rr.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Rr.rotrSH(w,b,16),Dl:Rr.rotrSL(w,b,16)},{h:y,l:h}=Rr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Rr.rotrBH(f,l,63),Bl:Rr.rotrBL(f,l,63)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}class gg extends aC{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=fr[0]|0,this.v0h=fr[1]|0,this.v1l=fr[2]|0,this.v1h=fr[3]|0,this.v2l=fr[4]|0,this.v2h=fr[5]|0,this.v3l=fr[6]|0,this.v3h=fr[7]|0,this.v4l=fr[8]|0,this.v4h=fr[9]|0,this.v5l=fr[10]|0,this.v5h=fr[11]|0,this.v6l=fr[12]|0,this.v6h=fr[13]|0,this.v7l=fr[14]|0,this.v7h=fr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=qc(Ca(t.salt));this.v4l^=wi(n[0]),this.v4h^=wi(n[1]),this.v5l^=wi(n[2]),this.v5h^=wi(n[3])}if(t.personalization){const n=qc(Ca(t.personalization));this.v6l^=wi(n[0]),this.v6h^=wi(n[1]),this.v7l^=wi(n[2]),this.v7h^=wi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Ca(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:T}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=f|0,this.v5h=h|0,this.v6l=y|0,this.v6h=b|0,this.v7l=w|0,this.v7h=T|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(fr,16);let{h:i,l:s}=Rr.fromBig(BigInt(this.length));Pe[24]=fr[8]^s,Pe[25]=fr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=oC;for(let c=0;c<12;c++)Hi(0,4,8,12,t,r+2*a[o++]),Ki(0,4,8,12,t,r+2*a[o++]),Hi(1,5,9,13,t,r+2*a[o++]),Ki(1,5,9,13,t,r+2*a[o++]),Hi(2,6,10,14,t,r+2*a[o++]),Ki(2,6,10,14,t,r+2*a[o++]),Hi(3,7,11,15,t,r+2*a[o++]),Ki(3,7,11,15,t,r+2*a[o++]),Hi(0,5,10,15,t,r+2*a[o++]),Ki(0,5,10,15,t,r+2*a[o++]),Hi(1,6,11,12,t,r+2*a[o++]),Ki(1,6,11,12,t,r+2*a[o++]),Hi(2,7,8,13,t,r+2*a[o++]),Ki(2,7,8,13,t,r+2*a[o++]),Hi(3,4,9,14,t,r+2*a[o++]),Ki(3,4,9,14,t,r+2*a[o++]);this.v0l^=Pe[0]^Pe[16],this.v0h^=Pe[1]^Pe[17],this.v1l^=Pe[2]^Pe[18],this.v1h^=Pe[3]^Pe[19],this.v2l^=Pe[4]^Pe[20],this.v2h^=Pe[5]^Pe[21],this.v3l^=Pe[6]^Pe[22],this.v3h^=Pe[7]^Pe[23],this.v4l^=Pe[8]^Pe[24],this.v4h^=Pe[9]^Pe[25],this.v5l^=Pe[10]^Pe[26],this.v5h^=Pe[11]^Pe[27],this.v6l^=Pe[12]^Pe[28],this.v6h^=Pe[13]^Pe[29],this.v7l^=Pe[14]^Pe[30],this.v7h^=Pe[15]^Pe[31],Pe.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 vg=sC(e=>new gg(e)),SC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:gg,blake2b:vg},Symbol.toStringTag,{value:"Module"}));function EC(e,t,r){const n=jf.Address.serialize(e).toBytes(),i=jf.TypeTag.serialize(t).toBytes(),s=jf.u64().serialize(r.length).toBytes(),o=vg.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${vi(o.digest().slice(0,32))}`}const CC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:WE,MOVE_STDLIB_ADDRESS:GE,SUI_ADDRESS_LENGTH:zc,SUI_CLOCK_OBJECT_ID:KE,SUI_DECIMALS:qE,SUI_FRAMEWORK_ADDRESS:ug,SUI_SYSTEM_ADDRESS:HE,SUI_SYSTEM_MODULE_NAME:XE,SUI_SYSTEM_STATE_OBJECT_ID:JE,SUI_TYPE_ARG:kf,deriveDynamicFieldID:EC,formatAddress:UE,formatDigest:VE,fromB64:_m,fromBase58:gi,fromBase64:yn,fromHEX:Sm,fromHex:lo,isValidNamedPackage:fg,isValidNamedType:eC,isValidSuiAddress:yi,isValidSuiNSName:ag,isValidSuiObjectId:Ea,isValidTransactionDigest:Mf,normalizeStructTag:Pm,normalizeSuiAddress:Vr,normalizeSuiNSName:cg,normalizeSuiObjectId:bi,parseStructTag:Tf,toB64:wm,toBase58:uo,toBase64:Xr,toHEX:xm,toHex:vi},Symbol.toStringTag,{value:"Module"}));var Df=Object.defineProperty,AC=Object.getOwnPropertyDescriptor,MC=Object.getOwnPropertyNames,TC=Object.prototype.hasOwnProperty,OC=(e,t)=>{for(var r in t)Df(e,r,{get:t[r],enumerable:!0})},IC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MC(t))!TC.call(e,i)&&i!==r&&Df(e,i,{get:()=>t[i],enumerable:!(n=AC(t,i))||n.enumerable});return e},PC=e=>IC(Df({},"__esModule",{value:!0}),e),yg={};OC(yg,{BIC_REGEX:()=>wg,CUID2_REGEX:()=>_g,DECIMAL_REGEX:()=>xg,EMAIL_REGEX:()=>Sg,EMOJI_REGEX:()=>Eg,HEXADECIMAL_REGEX:()=>Cg,HEX_COLOR_REGEX:()=>Ag,IMEI_REGEX:()=>Mg,IPV4_REGEX:()=>Tg,IPV6_REGEX:()=>Og,IP_REGEX:()=>Ig,ISO_DATE_REGEX:()=>Pg,ISO_DATE_TIME_REGEX:()=>jg,ISO_TIMESTAMP_REGEX:()=>Rg,ISO_TIME_REGEX:()=>kg,ISO_TIME_SECOND_REGEX:()=>Ng,ISO_WEEK_REGEX:()=>Dg,MAC48_REGEX:()=>$g,MAC64_REGEX:()=>Bg,MAC_REGEX:()=>Lg,OCTAL_REGEX:()=>Fg,ULID_REGEX:()=>Ug,UUID_REGEX:()=>Vg,ValiError:()=>Gc,_addIssue:()=>le,_isLuhnAlgo:()=>$f,_isValidObjectKey:()=>Os,_stringify:()=>Dr,any:()=>x1,array:()=>S1,arrayAsync:()=>E1,awaitAsync:()=>bg,bic:()=>Hg,bigint:()=>C1,blob:()=>A1,boolean:()=>M1,brand:()=>Kg,bytes:()=>Xg,check:()=>Jg,checkAsync:()=>Yg,checkItems:()=>Zg,config:()=>XC,creditCard:()=>Qg,cuid2:()=>ev,custom:()=>T1,customAsync:()=>O1,date:()=>I1,decimal:()=>tv,deleteGlobalConfig:()=>kC,deleteGlobalMessage:()=>RC,deleteSchemaMessage:()=>$C,deleteSpecificMessage:()=>LC,email:()=>rv,emoji:()=>nv,empty:()=>iv,endsWith:()=>sv,entriesFromList:()=>UC,enum:()=>Vf,enum_:()=>Vf,everyItem:()=>ov,excludes:()=>av,fallback:()=>JC,fallbackAsync:()=>YC,file:()=>P1,filterItems:()=>cv,findItem:()=>uv,finite:()=>lv,flatten:()=>ZC,forward:()=>QC,forwardAsync:()=>eA,function:()=>zf,function_:()=>zf,getDefault:()=>Si,getDefaults:()=>Bf,getDefaultsAsync:()=>Lf,getDotPath:()=>Gg,getFallback:()=>Ma,getFallbacks:()=>Ff,getFallbacksAsync:()=>Uf,getGlobalConfig:()=>Aa,getGlobalMessage:()=>zg,getSchemaMessage:()=>qg,getSpecificMessage:()=>Wg,hash:()=>fv,hexColor:()=>hv,hexadecimal:()=>dv,imei:()=>pv,includes:()=>mv,instance:()=>j1,integer:()=>gv,intersect:()=>k1,intersectAsync:()=>N1,ip:()=>vv,ipv4:()=>yv,ipv6:()=>bv,is:()=>tA,isOfKind:()=>VC,isOfType:()=>zC,isValiError:()=>qC,isoDate:()=>wv,isoDateTime:()=>_v,isoTime:()=>xv,isoTimeSecond:()=>Sv,isoTimestamp:()=>Ev,isoWeek:()=>Cv,keyof:()=>rA,lazy:()=>R1,lazyAsync:()=>D1,length:()=>Av,literal:()=>$1,looseObject:()=>B1,looseObjectAsync:()=>L1,looseTuple:()=>F1,looseTupleAsync:()=>U1,mac:()=>Mv,mac48:()=>Tv,mac64:()=>Ov,map:()=>V1,mapAsync:()=>z1,mapItems:()=>Iv,maxBytes:()=>Pv,maxLength:()=>jv,maxSize:()=>kv,maxValue:()=>Nv,mimeType:()=>Rv,minBytes:()=>Dv,minLength:()=>$v,minSize:()=>Bv,minValue:()=>Lv,multipleOf:()=>Fv,nan:()=>q1,never:()=>W1,nonEmpty:()=>Uv,nonNullable:()=>G1,nonNullableAsync:()=>H1,nonNullish:()=>K1,nonNullishAsync:()=>X1,nonOptional:()=>qf,nonOptionalAsync:()=>Wf,normalize:()=>Vv,notBytes:()=>zv,notLength:()=>qv,notSize:()=>Wv,notValue:()=>Gv,null:()=>Gf,null_:()=>Gf,nullable:()=>J1,nullableAsync:()=>Y1,nullish:()=>Z1,nullishAsync:()=>Q1,number:()=>ey,object:()=>ty,objectAsync:()=>ry,objectWithRest:()=>ny,objectWithRestAsync:()=>iy,octal:()=>Hv,omit:()=>nA,optional:()=>Hf,optionalAsync:()=>Kf,parse:()=>Cy,parseAsync:()=>Ay,parser:()=>iA,parserAsync:()=>sA,partial:()=>oA,partialAsync:()=>aA,partialCheck:()=>Xv,partialCheckAsync:()=>Jv,pick:()=>cA,picklist:()=>Xf,pipe:()=>uA,pipeAsync:()=>lA,promise:()=>sy,rawCheck:()=>Yv,rawCheckAsync:()=>Zv,rawTransform:()=>Qv,rawTransformAsync:()=>e1,readonly:()=>t1,record:()=>oy,recordAsync:()=>ay,reduceItems:()=>r1,regex:()=>n1,required:()=>fA,requiredAsync:()=>dA,safeInteger:()=>i1,safeParse:()=>My,safeParseAsync:()=>Ty,safeParser:()=>hA,safeParserAsync:()=>pA,set:()=>cy,setAsync:()=>uy,setGlobalConfig:()=>jC,setGlobalMessage:()=>NC,setSchemaMessage:()=>DC,setSpecificMessage:()=>BC,size:()=>s1,someItem:()=>o1,sortItems:()=>a1,startsWith:()=>c1,strictObject:()=>ly,strictObjectAsync:()=>fy,strictTuple:()=>dy,strictTupleAsync:()=>hy,string:()=>py,symbol:()=>my,toLowerCase:()=>u1,toMaxValue:()=>l1,toMinValue:()=>f1,toUpperCase:()=>d1,transform:()=>h1,transformAsync:()=>p1,trim:()=>m1,trimEnd:()=>g1,trimStart:()=>v1,tuple:()=>gy,tupleAsync:()=>vy,tupleWithRest:()=>yy,tupleWithRestAsync:()=>by,ulid:()=>y1,undefined:()=>Jf,undefined_:()=>Jf,union:()=>wy,unionAsync:()=>_y,unknown:()=>xy,unwrap:()=>mA,url:()=>b1,uuid:()=>w1,value:()=>_1,variant:()=>Sy,variantAsync:()=>Ey,void:()=>Zf,void_:()=>Zf});var Xi=PC(yg);function bg(){return{kind:"transformation",type:"await",reference:bg,async:!0,async _run(e){return e.value=await e.value,e}}}var wg=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,_g=/^[a-z][\da-z]*$/u,xg=/^\d+$/u,Sg=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,Eg=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,Cg=/^(?:0h|0x)?[\da-f]+$/iu,Ag=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,Mg=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,Tg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,Og=/^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Ig=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Pg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,jg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3]):[0-5]\d$/u,kg=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Ng=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,Rg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z|[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u,Dg=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,$g=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,Bg=/^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,Lg=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$|^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,Fg=/^(?:0o)?[0-7]+$/iu,Ug=/^[\da-hjkmnp-tv-z]{26}$/iu,Vg=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,nn;function jC(e){nn={...nn,...e}}function Aa(e){return{lang:(e==null?void 0:e.lang)??(nn==null?void 0:nn.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(nn==null?void 0:nn.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(nn==null?void 0:nn.abortPipeEarly)}}function kC(){nn=void 0}var _i;function NC(e,t){_i||(_i=new Map),_i.set(t,e)}function zg(e){return _i==null?void 0:_i.get(e)}function RC(e){_i==null||_i.delete(e)}var xi;function DC(e,t){xi||(xi=new Map),xi.set(t,e)}function qg(e){return xi==null?void 0:xi.get(e)}function $C(e){xi==null||xi.delete(e)}var _n;function BC(e,t,r){_n||(_n=new Map),_n.get(e)||_n.set(e,new Map),_n.get(e).set(r,t)}function Wg(e,t){var r;return(r=_n==null?void 0:_n.get(e))==null?void 0:r.get(t)}function LC(e,t){var r;(r=_n==null?void 0:_n.get(e))==null||r.delete(t)}function Dr(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 le(e,t,r,n,i){const s=i&&"input"in i?i.input:r.value,o=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??Dr(s),c={kind:e.kind,type:e.type,input:s,expected:o,received:a,message:`Invalid ${t}: ${o?`Expected ${o} 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??Wg(e.reference,c.lang)??(u?qg(c.lang):null)??n.message??zg(c.lang);l&&(c.message=typeof l=="function"?l(c):l),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}var FC=/\D/gu;function $f(e){const t=e.replace(FC,"");let r=t.length,n=1,i=0;for(;r;){const s=+t[--r];n^=1,i+=n?[0,2,4,6,8,1,3,5,7,9][s]:s}return i%10===0}function Os(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function UC(e,t){const r={};for(const n of e)r[n]=t;return r}function Gg(e){if(e.path){let t="";for(const r of e.path)if(typeof r.key=="string"||typeof r.key=="number")t?t+=`.${r.key}`:t+=r.key;else return null;return t}return null}function VC(e,t){return t.kind===e}function zC(e,t){return t.type===e}function qC(e){return e instanceof Gc}var Gc=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Hg(e){return{kind:"validation",type:"bic",reference:Hg,async:!1,expects:null,requirement:wg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Kg(e){return{kind:"transformation",type:"brand",reference:Kg,async:!1,name:e,_run(t){return t}}}function Xg(e,t){return{kind:"validation",type:"bytes",reference:Xg,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i!==this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Jg(e,t){return{kind:"validation",type:"check",reference:Jg,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&le(this,"input",r,n),r}}}function Yg(e,t){return{kind:"validation",type:"check",reference:Yg,async:!0,expects:null,requirement:e,message:t,async _run(r,n){return r.typed&&!await this.requirement(r.value)&&le(this,"input",r,n),r}}}function Zg(e,t){return{kind:"validation",type:"check_items",reference:Zg,async:!1,expects:null,requirement:e,message:t,_run(r,n){if(r.typed)for(let i=0;i<r.value.length;i++){const s=r.value[i];this.requirement(s,i,r.value)||le(this,"item",r,n,{input:s,path:[{type:"array",origin:"value",input:r.value,key:i,value:s}]})}return r}}}var WC=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,GC=/[- ]/gu,HC=[/^3[47]\d{13}$/u,/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,/^6(?:011|5\d{2})\d{12,15}$/u,/^(?:2131|1800|35\d{3})\d{11}$/u,/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,/^(?:6[27]\d{14,17}|81\d{14,17})$/u,/^4\d{12}(?:\d{3,6})?$/u];function Qg(e){return{kind:"validation",type:"credit_card",reference:Qg,async:!1,expects:null,requirement(t){let r;return WC.test(t)&&(r=t.replace(GC,""))&&HC.some(n=>n.test(r))&&$f(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function ev(e){return{kind:"validation",type:"cuid2",reference:ev,async:!1,expects:null,requirement:_g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function tv(e){return{kind:"validation",type:"decimal",reference:tv,async:!1,expects:null,requirement:xg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function rv(e){return{kind:"validation",type:"email",reference:rv,expects:null,async:!1,requirement:Sg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function nv(e){return{kind:"validation",type:"emoji",reference:nv,async:!1,expects:null,requirement:Eg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function iv(e){return{kind:"validation",type:"empty",reference:iv,async:!1,expects:"0",message:e,_run(t,r){return t.typed&&t.value.length>0&&le(this,"length",t,r,{received:`${t.value.length}`}),t}}}function sv(e,t){return{kind:"validation",type:"ends_with",reference:sv,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.endsWith(this.requirement)&&le(this,"end",r,n,{received:`"${r.value.slice(-this.requirement.length)}"`}),r}}}function ov(e,t){return{kind:"validation",type:"every_item",reference:ov,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.every(this.requirement)&&le(this,"item",r,n),r}}}function av(e,t){const r=Dr(e);return{kind:"validation",type:"excludes",reference:av,async:!1,expects:`!${r}`,requirement:e,message:t,_run(n,i){return n.typed&&n.value.includes(this.requirement)&&le(this,"content",n,i,{received:r}),n}}}function cv(e){return{kind:"transformation",type:"filter_items",reference:cv,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function uv(e){return{kind:"transformation",type:"find_item",reference:uv,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function lv(e){return{kind:"validation",type:"finite",reference:lv,async:!1,expects:null,requirement:Number.isFinite,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"finite",t,r),t}}}var KC={md4:32,md5:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8,adler32:8};function fv(e,t){return{kind:"validation",type:"hash",reference:fv,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${KC[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function dv(e){return{kind:"validation",type:"hexadecimal",reference:dv,async:!1,expects:null,requirement:Cg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function hv(e){return{kind:"validation",type:"hex_color",reference:hv,async:!1,expects:null,requirement:Ag,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function pv(e){return{kind:"validation",type:"imei",reference:pv,async:!1,expects:null,requirement(t){return Mg.test(t)&&$f(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function mv(e,t){const r=Dr(e);return{kind:"validation",type:"includes",reference:mv,async:!1,expects:r,requirement:e,message:t,_run(n,i){return n.typed&&!n.value.includes(this.requirement)&&le(this,"content",n,i,{received:`!${r}`}),n}}}function gv(e){return{kind:"validation",type:"integer",reference:gv,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"integer",t,r),t}}}function vv(e){return{kind:"validation",type:"ip",reference:vv,async:!1,expects:null,requirement:Ig,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function yv(e){return{kind:"validation",type:"ipv4",reference:yv,async:!1,expects:null,requirement:Tg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function bv(e){return{kind:"validation",type:"ipv6",reference:bv,async:!1,expects:null,requirement:Og,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function wv(e){return{kind:"validation",type:"iso_date",reference:wv,async:!1,expects:null,requirement:Pg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function _v(e){return{kind:"validation",type:"iso_date_time",reference:_v,async:!1,expects:null,requirement:jg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function xv(e){return{kind:"validation",type:"iso_time",reference:xv,async:!1,expects:null,requirement:kg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function Sv(e){return{kind:"validation",type:"iso_time_second",reference:Sv,async:!1,expects:null,requirement:Ng,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function Ev(e){return{kind:"validation",type:"iso_timestamp",reference:Ev,async:!1,expects:null,requirement:Rg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function Cv(e){return{kind:"validation",type:"iso_week",reference:Cv,async:!1,expects:null,requirement:Dg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function Av(e,t){return{kind:"validation",type:"length",reference:Av,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length!==this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Mv(e){return{kind:"validation",type:"mac",reference:Mv,async:!1,expects:null,requirement:Lg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function Tv(e){return{kind:"validation",type:"mac48",reference:Tv,async:!1,expects:null,requirement:$g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function Ov(e){return{kind:"validation",type:"mac64",reference:Ov,async:!1,expects:null,requirement:Bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function Iv(e){return{kind:"transformation",type:"map_items",reference:Iv,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Pv(e,t){return{kind:"validation",type:"max_bytes",reference:Pv,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i>this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function jv(e,t){return{kind:"validation",type:"max_length",reference:jv,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length>this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function kv(e,t){return{kind:"validation",type:"max_size",reference:kv,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size>this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Nv(e,t){return{kind:"validation",type:"max_value",reference:Nv,async:!1,expects:`<=${e instanceof Date?e.toJSON():Dr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value>this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Dr(r.value)}),r}}}function Rv(e,t){return{kind:"validation",type:"mime_type",reference:Rv,async:!1,expects:e.map(r=>`"${r}"`).join(" | ")||"never",requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.includes(r.value.type)&&le(this,"MIME type",r,n,{received:`"${r.value.type}"`}),r}}}function Dv(e,t){return{kind:"validation",type:"min_bytes",reference:Dv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i<this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function $v(e,t){return{kind:"validation",type:"min_length",reference:$v,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length<this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Bv(e,t){return{kind:"validation",type:"min_size",reference:Bv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size<this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Lv(e,t){return{kind:"validation",type:"min_value",reference:Lv,async:!1,expects:`>=${e instanceof Date?e.toJSON():Dr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value<this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Dr(r.value)}),r}}}function Fv(e,t){return{kind:"validation",type:"multiple_of",reference:Fv,async:!1,expects:`%${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value%this.requirement!==0&&le(this,"multiple",r,n),r}}}function Uv(e){return{kind:"validation",type:"non_empty",reference:Uv,async:!1,expects:"!0",message:e,_run(t,r){return t.typed&&t.value.length===0&&le(this,"length",t,r,{received:"0"}),t}}}function Vv(e){return{kind:"transformation",type:"normalize",reference:Vv,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function zv(e,t){return{kind:"validation",type:"not_bytes",reference:zv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i===this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function qv(e,t){return{kind:"validation",type:"not_length",reference:qv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length===this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Wv(e,t){return{kind:"validation",type:"not_size",reference:Wv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size===this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Gv(e,t){return{kind:"validation",type:"not_value",reference:Gv,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Dr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&this.requirement<=r.value&&this.requirement>=r.value&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Dr(r.value)}),r}}}function Hv(e){return{kind:"validation",type:"octal",reference:Hv,async:!1,expects:null,requirement:Fg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Kv(e,t){var r;if(e.issues)for(const n of t)for(const i of e.issues){let s=!1;const o=Math.min(n.length,((r=i.path)==null?void 0:r.length)??0);for(let a=0;a<o;a++)if(n[a]!==i.path[a].key){s=!0;break}if(!s)return!1}return!0}function Xv(e,t,r){return{kind:"validation",type:"partial_check",reference:Xv,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Kv(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Jv(e,t,r){return{kind:"validation",type:"partial_check",reference:Jv,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Kv(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Yv(e){return{kind:"validation",type:"raw_check",reference:Yv,async:!1,expects:null,_run(t,r){return e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Zv(e){return{kind:"validation",type:"raw_check",reference:Zv,async:!0,expects:null,async _run(t,r){return await e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Qv(e){return{kind:"transformation",type:"raw_transform",reference:Qv,async:!1,_run(t,r){const n=e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function e1(e){return{kind:"transformation",type:"raw_transform",reference:e1,async:!0,async _run(t,r){const n=await e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function t1(){return{kind:"transformation",type:"readonly",reference:t1,async:!1,_run(e){return e}}}function r1(e,t){return{kind:"transformation",type:"reduce_items",reference:r1,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function n1(e,t){return{kind:"validation",type:"regex",reference:n1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"format",r,n),r}}}function i1(e){return{kind:"validation",type:"safe_integer",reference:i1,async:!1,expects:null,requirement:Number.isSafeInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"safe integer",t,r),t}}}function s1(e,t){return{kind:"validation",type:"size",reference:s1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function o1(e,t){return{kind:"validation",type:"some_item",reference:o1,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.some(this.requirement)&&le(this,"item",r,n),r}}}function a1(e){return{kind:"transformation",type:"sort_items",reference:a1,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function c1(e,t){return{kind:"validation",type:"starts_with",reference:c1,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.startsWith(this.requirement)&&le(this,"start",r,n,{received:`"${r.value.slice(0,this.requirement.length)}"`}),r}}}function u1(){return{kind:"transformation",type:"to_lower_case",reference:u1,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function l1(e){return{kind:"transformation",type:"to_max_value",reference:l1,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function f1(e){return{kind:"transformation",type:"to_min_value",reference:f1,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function d1(){return{kind:"transformation",type:"to_upper_case",reference:d1,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function h1(e){return{kind:"transformation",type:"transform",reference:h1,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function p1(e){return{kind:"transformation",type:"transform",reference:p1,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function m1(){return{kind:"transformation",type:"trim",reference:m1,async:!1,_run(e){return e.value=e.value.trim(),e}}}function g1(){return{kind:"transformation",type:"trim_end",reference:g1,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function v1(){return{kind:"transformation",type:"trim_start",reference:v1,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function y1(e){return{kind:"validation",type:"ulid",reference:y1,async:!1,expects:null,requirement:Ug,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function b1(e){return{kind:"validation",type:"url",reference:b1,async:!1,expects:null,requirement(t){try{return new URL(t),!0}catch{return!1}},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"URL",t,r),t}}}function w1(e){return{kind:"validation",type:"uuid",reference:w1,async:!1,expects:null,requirement:Vg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function _1(e,t){return{kind:"validation",type:"value",reference:_1,async:!1,expects:e instanceof Date?e.toJSON():Dr(e),requirement:e,message:t,_run(r,n){return r.typed&&!(this.requirement<=r.value&&this.requirement>=r.value)&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Dr(r.value)}),r}}}function XC(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function Ma(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function JC(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:Ma(this,r,n)}:r}}}function YC(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await Ma(this,r,n)}:r}}}function ZC(e){const t={};for(const r of e)if(r.path){const n=Gg(r);n?(t.nested||(t.nested={}),t.nested[n]?t.nested[n].push(r.message):t.nested[n]=[r.message]):t.other?t.other.push(r.message):t.other=[r.message]}else t.root?t.root.push(r.message):t.root=[r.message];return t}function QC(e,t){return{...e,_run(r,n){const i=r.issues&&[...r.issues];if(e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function eA(e,t){return{...e,async:!0,async _run(r,n){const i=r.issues&&[...r.issues];if(await e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function Si(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Bf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Bf(e.entries[r]);return t}return"items"in e?e.items.map(Bf):Si(e)}async function Lf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Lf(r)]))):"items"in e?Promise.all(e.items.map(Lf)):Si(e)}function Ff(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Ff(e.entries[r]);return t}return"items"in e?e.items.map(Ff):Ma(e)}async function Uf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Uf(r)]))):"items"in e?Promise.all(e.items.map(Uf)):Ma(e)}function tA(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function x1(){return{kind:"schema",type:"any",reference:x1,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function S1(e,t){return{kind:"schema",type:"array",reference:S1,expects:"Array",async:!1,item:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<i.length;o++){const a=i[o],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.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 le(this,"type",r,n);return r}}}function E1(e,t){return{kind:"schema",type:"array",reference:E1,expects:"Array",async:!0,item:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(i.map(a=>this.item._run({typed:!1,value:a},n)));for(let a=0;a<o.length;a++){const c=o[a];if(c.issues){const u={type:"array",origin:"value",input:i,key:a,value:i[a]};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.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 le(this,"type",r,n);return r}}}function C1(e){return{kind:"schema",type:"bigint",reference:C1,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function A1(e){return{kind:"schema",type:"blob",reference:A1,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function M1(e){return{kind:"schema",type:"boolean",reference:M1,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function T1(e,t){return{kind:"schema",type:"custom",reference:T1,expects:"unknown",async:!1,check:e,message:t,_run(r,n){return this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function O1(e,t){return{kind:"schema",type:"custom",reference:O1,expects:"unknown",async:!0,check:e,message:t,async _run(r,n){return await this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function I1(e){return{kind:"schema",type:"date",reference:I1,expects:"Date",async:!1,message:e,_run(t,r){return t.value instanceof Date?isNaN(t.value)?le(this,"type",t,r,{received:'"Invalid Date"'}):t.typed=!0:le(this,"type",t,r),t}}}function Vf(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Vf,expects:r.map(Dr).join(" | ")||"never",async:!1,enum:e,options:r,message:t,_run(n,i){return this.options.includes(n.value)?n.typed=!0:le(this,"type",n,i),n}}}function P1(e){return{kind:"schema",type:"file",reference:P1,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function zf(e){return{kind:"schema",type:"function",reference:zf,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function j1(e,t){return{kind:"schema",type:"instance",reference:j1,expects:e.name,async:!1,class:e,message:t,_run(r,n){return r.value instanceof this.class?r.typed=!0:le(this,"type",r,n),r}}}function Hc(e,t){if(typeof e==typeof t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{value:e};if(e&&t&&e.constructor===Object&&t.constructor===Object){for(const r in t)if(r in e){const n=Hc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}else e[r]=t[r];return{value:e}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let r=0;r<e.length;r++){const n=Hc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function k1(e,t){return{kind:"schema",type:"intersect",reference:k1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!1,options:e,message:t,_run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;for(const o of this.options){const a=o._run({typed:!1,value:i},n);if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let o=1;o<s.length;o++){const a=Hc(r.value,s[o]);if(a.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=a.value}}}else le(this,"type",r,n);return r}}}function N1(e,t){return{kind:"schema",type:"intersect",reference:N1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!0,options:e,message:t,async _run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;const o=await Promise.all(this.options.map(a=>a._run({typed:!1,value:i},n)));for(const a of o){if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let a=1;a<s.length;a++){const c=Hc(r.value,s[a]);if(c.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=c.value}}}else le(this,"type",r,n);return r}}}function R1(e){return{kind:"schema",type:"lazy",reference:R1,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function D1(e){return{kind:"schema",type:"lazy",reference:D1,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function $1(e,t){return{kind:"schema",type:"literal",reference:$1,expects:Dr(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:le(this,"type",r,n),r}}}function B1(e,t){return{kind:"schema",type:"loose_object",reference:B1,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly)for(const o in i)Os(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function L1(e,t){return{kind:"schema",type:"loose_object",reference:L1,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly)for(const a in i)Os(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function F1(e,t){return{kind:"schema",type:"loose_tuple",reference:F1,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.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)}if(!r.issues||!n.abortEarly)for(let o=this.items.length;o<i.length;o++)r.value.push(i[o])}else le(this,"type",r,n);return r}}}function U1(e,t){return{kind:"schema",type:"loose_tuple",reference:U1,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!r.issues||!n.abortEarly)for(let a=this.items.length;a<i.length;a++)r.value.push(i[a])}else le(this,"type",r,n);return r}}}function V1(e,t,r){return{kind:"schema",type:"map",reference:V1,expects:"Map",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;for(const[c,u]of s){const l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"map",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path?y.path.unshift(h):y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"map",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),n.value.set(l.value,f.value)}}else le(this,"type",n,i);return n}}}function z1(e,t,r){return{kind:"schema",type:"map",reference:z1,expects:"Map",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;const c=await Promise.all([...s].map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"map",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"map",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),n.value.set(f.value,h.value)}}else le(this,"type",n,i);return n}}}function q1(e){return{kind:"schema",type:"nan",reference:q1,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function W1(e){return{kind:"schema",type:"never",reference:W1,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function G1(e,t){return{kind:"schema",type:"non_nullable",reference:G1,expects:"!null",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function H1(e,t){return{kind:"schema",type:"non_nullable",reference:H1,expects:"!null",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function K1(e,t){return{kind:"schema",type:"non_nullish",reference:K1,expects:"!null & !undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function X1(e,t){return{kind:"schema",type:"non_nullish",reference:X1,expects:"!null & !undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function qf(e,t){return{kind:"schema",type:"non_optional",reference:qf,expects:"!undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Wf(e,t){return{kind:"schema",type:"non_optional",reference:Wf,expects:"!undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Gf(e){return{kind:"schema",type:"null",reference:Gf,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function J1(e,...t){const r={kind:"schema",type:"nullable",reference:J1,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=Si(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 Y1(e,...t){const r={kind:"schema",type:"nullable",reference:Y1,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await Si(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 Z1(e,...t){const r={kind:"schema",type:"nullish",reference:Z1,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=Si(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 Q1(e,...t){const r={kind:"schema",type:"nullish",reference:Q1,expects:`${e.expects} | null | undefined`,async:!0,wrapped:e,async _run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=await Si(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 ey(e){return{kind:"schema",type:"number",reference:ey,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function ty(e,t){return{kind:"schema",type:"object",reference:ty,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}}else le(this,"type",r,n);return r}}}function ry(e,t){return{kind:"schema",type:"object",reference:ry,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}}else le(this,"type",r,n);return r}}}function ny(e,t,r){return{kind:"schema",type:"object_with_rest",reference:ny,expects:"Object",async:!1,entries:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in this.entries){const u=s[c],l=this.entries[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),(l.value!==void 0||c in s)&&(n.value[c]=l.value)}if(!n.issues||!i.abortEarly){for(const c in s)if(Os(s,c)&&!(c in this.entries)){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[c]=l.value}}}else le(this,"type",n,i);return n}}}function iy(e,t,r){return{kind:"schema",type:"object_with_rest",reference:iy,expects:"Object",async:!0,entries:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const[c,u]=await Promise.all([Promise.all(Object.entries(this.entries).map(async([l,f])=>{const h=s[l];return[l,h,await f._run({typed:!1,value:h},i)]})),Promise.all(Object.entries(s).filter(([l])=>Os(s,l)&&!(l in this.entries)).map(async([l,f])=>[l,f,await this.rest._run({typed:!1,value:f},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),(h.value!==void 0||l in s)&&(n.value[l]=h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value[l]=h.value}}else le(this,"type",n,i);return n}}}function Hf(e,...t){const r={kind:"schema",type:"optional",reference:Hf,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=Si(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 Kf(e,...t){const r={kind:"schema",type:"optional",reference:Kf,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await Si(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 Xf(e,t){return{kind:"schema",type:"picklist",reference:Xf,expects:e.map(Dr).join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){return this.options.includes(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function sy(e){return{kind:"schema",type:"promise",reference:sy,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function oy(e,t,r){return{kind:"schema",type:"record",reference:oy,expects:"Object",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in s)if(Os(s,c)){const u=s[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"object",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"object",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=f.value)}}else le(this,"type",n,i);return n}}}function ay(e,t,r){return{kind:"schema",type:"record",reference:ay,expects:"Object",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const c=await Promise.all(Object.entries(s).filter(([u])=>Os(s,u)).map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"object",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"object",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),f.typed&&(n.value[f.value]=h.value)}}else le(this,"type",n,i);return n}}}function cy(e,t){return{kind:"schema",type:"set",reference:cy,expects:"Set",async:!1,value:e,message:t,_run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;for(const o of i){const a=this.value._run({typed:!1,value:o},n);if(a.issues){const c={type:"set",origin:"value",input:i,key:null,value:o};for(const u of a.issues)u.path?u.path.unshift(c):u.path=[c],(s=r.issues)==null||s.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.add(a.value)}}else le(this,"type",r,n);return r}}}function uy(e,t){return{kind:"schema",type:"set",reference:uy,expects:"Set",async:!0,value:e,message:t,async _run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;const o=await Promise.all([...i].map(async a=>[a,await this.value._run({typed:!1,value:a},n)]));for(const[a,c]of o){if(c.issues){const u={type:"set",origin:"value",input:i,key:null,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.add(c.value)}}else le(this,"type",r,n);return r}}}function ly(e,t){return{kind:"schema",type:"strict_object",reference:ly,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly){for(const o in i)if(!(o in this.entries)){const a=i[o];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"object",origin:"value",input:i,key:o,value:a}]});break}}}else le(this,"type",r,n);return r}}}function fy(e,t){return{kind:"schema",type:"strict_object",reference:fy,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly){for(const a in i)if(!(a in this.entries)){const c=i[a];le(this,"type",r,n,{input:c,expected:"never",path:[{type:"object",origin:"value",input:i,key:a,value:c}]});break}}}else le(this,"type",r,n);return r}}}function dy(e,t){return{kind:"schema",type:"strict_tuple",reference:dy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.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)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const o=i[e.length];le(this,"type",r,n,{input:o,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:o}]})}}else le(this,"type",r,n);return r}}}function hy(e,t){return{kind:"schema",type:"strict_tuple",reference:hy,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const a=i[e.length];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:a}]})}}else le(this,"type",r,n);return r}}}function py(e){return{kind:"schema",type:"string",reference:py,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function my(e){return{kind:"schema",type:"symbol",reference:my,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function gy(e,t){return{kind:"schema",type:"tuple",reference:gy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.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 le(this,"type",r,n);return r}}}function vy(e,t){return{kind:"schema",type:"tuple",reference:vy,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else le(this,"type",r,n);return r}}}function yy(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:yy,expects:"Array",async:!1,items:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let c=0;c<this.items.length;c++){const u=s[c],l=this.items[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}if(!n.issues||!i.abortEarly)for(let c=this.items.length;c<s.length;c++){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else le(this,"type",n,i);return n}}}function by(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:by,expects:"Array",async:!0,items:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];const[c,u]=await Promise.all([Promise.all(this.items.map(async(l,f)=>{const h=s[f];return[f,h,await l._run({typed:!1,value:h},i)]})),Promise.all(s.slice(this.items.length).map(async(l,f)=>[f+this.items.length,l,await this.rest._run({typed:!1,value:l},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}}else le(this,"type",n,i);return n}}}function Jf(e){return{kind:"schema",type:"undefined",reference:Jf,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Kc(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function wy(e,t){return{kind:"schema",type:"union",reference:wy,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,s,o;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Kc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Kc(o)})}return r}}}function _y(e,t){return{kind:"schema",type:"union",reference:_y,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!0,options:e,message:t,async _run(r,n){let i,s,o;for(const a of this.options){const c=await a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Kc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Kc(o)})}return r}}}function xy(){return{kind:"schema",type:"unknown",reference:xy,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Yf(e,t,r=new Set){for(const n of t)n.type==="variant"?Yf(e,n.options,r):r.add(n.entries[e].expects);return r}function Sy(e,t,r){let n;return{kind:"schema",type:"variant",reference:Sy,expects:"Object",async:!1,key:e,options:t,message:r,_run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!u.entries[this.key]._run({typed:!1,value:a},s).issues){const l=u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Yf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function Ey(e,t,r){let n;return{kind:"schema",type:"variant",reference:Ey,expects:"Object",async:!0,key:e,options:t,message:r,async _run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!(await u.entries[this.key]._run({typed:!1,value:a},s)).issues){const l=await u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Yf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function Zf(e){return{kind:"schema",type:"void",reference:Zf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function rA(e,t){return Xf(Object.keys(e.entries),t)}function nA(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function Cy(e,t,r){const n=e._run({typed:!1,value:t},Aa(r));if(n.issues)throw new Gc(n.issues);return n.value}async function Ay(e,t,r){const n=await e._run({typed:!1,value:t},Aa(r));if(n.issues)throw new Gc(n.issues);return n.value}function iA(e,t){const r=n=>Cy(e,n,t);return r.schema=e,r.config=t,r}function sA(e,t){const r=n=>Ay(e,n,t);return r.schema=e,r.config=t,r}function oA(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Hf(e.entries[n]):e.entries[n];return{...e,entries:r}}function aA(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Kf(e.entries[n]):e.entries[n];return{...e,entries:r}}function cA(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function uA(...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 lA(...e){return{...e[0],pipe:e,async:!0,async _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=await e[n]._run(t,r))}return t}}}function fA(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?qf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function dA(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?Wf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function My(e,t,r){const n=e._run({typed:!1,value:t},Aa(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function Ty(e,t,r){const n=await e._run({typed:!1,value:t},Aa(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function hA(e,t){const r=n=>My(e,n,t);return r.schema=e,r.config=t,r}function pA(e,t){const r=n=>Ty(e,n,t);return r.schema=e,r.config=t,r}function mA(e){return e.wrapped}const gA=Symbol.for("@mysten/transaction");function vA(e){return!!e&&typeof e=="object"&&e[gA]===!0}const Oy=Symbol.for("@mysten/SuiClient");function yA(e){return typeof e=="object"&&e!==null&&e[Oy]===!0}class Ta{get[Oy](){return!0}constructor(t){this.transport=t.transport??new vm({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!yi(Vr(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||!yi(Vr(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||!yi(Vr(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||!yi(Vr(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||!yi(Vr(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||!Ea(bi(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||!Ea(bi(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(!Mf(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(!Mf(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 s=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof t=="string"?t:Xr(t),Array.isArray(r)?r:[r],n]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:s.digest})}catch{}return s}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:s,bytes:o}=await r.signTransaction(i);return this.executeTransactionBlock({transactionBlock:o,signature:s,...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||!yi(Vr(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||!Ea(bi(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(vA(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Xr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Xr(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:Xr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Ea(bi(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=gi(t.digest);return vi(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:s}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[r.address,r.cursor,r.limit]});return{hasNextPage:i,nextCursor:n,data:s.map(o=>cg(o,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 s=AbortSignal.timeout(r),o=new Promise((a,c)=>{s.addEventListener("abort",()=>c(s.reason))});for(o.catch(()=>{});!s.aborted;){t==null||t.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),o])}}throw s.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}const bA=Dc(Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:gf,SuiClient:Ta,SuiHTTPStatusError:lm,SuiHTTPTransport:vm,SuiHTTPTransportError:mf,getFullnodeUrl:ym,isSuiClient:yA},Symbol.toStringTag,{value:"Module"}))),Iy=Dc(CC),Cr=Dc(mE);var Qf=Object.defineProperty,wA=Object.getOwnPropertyDescriptor,_A=Object.getOwnPropertyNames,xA=Object.prototype.hasOwnProperty,SA=(e,t)=>{for(var r in t)Qf(e,r,{get:t[r],enumerable:!0})},EA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _A(t))!xA.call(e,i)&&i!==r&&Qf(e,i,{get:()=>t[i],enumerable:!(n=wA(t,i))||n.enumerable});return e},CA=e=>EA(Qf({},"__esModule",{value:!0}),e),Py={};SA(Py,{SUI_ADDRESS_LENGTH:()=>ed,isValidSuiAddress:()=>ky,isValidSuiObjectId:()=>TA,isValidTransactionDigest:()=>MA,normalizeStructTag:()=>Ny,normalizeSuiAddress:()=>rd,normalizeSuiObjectId:()=>IA,parseStructTag:()=>td});var Jr=CA(Py),jy=Cr;const AA=32;function MA(e){try{return(0,jy.fromBase58)(e).length===AA}catch{return!1}}const ed=32;function ky(e){return PA(e)&&jA(e)===ed}function TA(e){return ky(e)}function OA(e){return e.includes("::")?td(e):e}function td(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?(0,jy.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>OA(o.trim())):[];return{address:rd(t),module:r,name:i,typeParams:s}}function Ny(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?td(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Ny(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function rd(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(ed*2,"0")}`}function IA(e,t=!1){return rd(e,t)}function PA(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function jA(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var nd=Object.defineProperty,kA=Object.getOwnPropertyDescriptor,NA=Object.getOwnPropertyNames,RA=Object.prototype.hasOwnProperty,DA=(e,t)=>{for(var r in t)nd(e,r,{get:t[r],enumerable:!0})},$A=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NA(t))!RA.call(e,i)&&i!==r&&nd(e,i,{get:()=>t[i],enumerable:!(n=kA(t,i))||n.enumerable});return e},BA=e=>$A(nd({},"__esModule",{value:!0}),e),Ry={};DA(Ry,{TypeTagSerializer:()=>Is});var Dy=BA(Ry),LA=Cr,FA=Jr;const UA=/^vector<(.+)>$/,VA=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Is{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(UA);if(n)return{vector:Is.parseFromStr(n[1],r)};const i=t.match(VA);if(i)return{struct:{address:r?(0,FA.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Is.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,LA.splitGenericParameters)(t).map(n=>Is.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<${Is.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Is.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var id=Object.defineProperty,zA=Object.getOwnPropertyDescriptor,qA=Object.getOwnPropertyNames,WA=Object.prototype.hasOwnProperty,GA=(e,t)=>{for(var r in t)id(e,r,{get:t[r],enumerable:!0})},HA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qA(t))!WA.call(e,i)&&i!==r&&id(e,i,{get:()=>t[i],enumerable:!(n=zA(t,i))||n.enumerable});return e},KA=e=>HA(id({},"__esModule",{value:!0}),e),$y={};GA($y,{Address:()=>Wn,AppId:()=>tb,Argument:()=>Gn,CallArg:()=>zy,Command:()=>Wy,CompressedSignature:()=>ib,GasData:()=>Jy,Intent:()=>rb,IntentMessage:()=>nb,IntentScope:()=>Qy,IntentVersion:()=>eb,MultiSig:()=>YA,MultiSigPkMap:()=>ob,MultiSigPublicKey:()=>ab,ObjectArg:()=>Vy,ObjectDigest:()=>Fy,PasskeyAuthenticator:()=>QA,ProgrammableMoveCall:()=>qy,ProgrammableTransaction:()=>Gy,PublicKey:()=>sb,SenderSignedData:()=>ZA,SenderSignedTransaction:()=>ub,SharedObjectRef:()=>Uy,StructTag:()=>Xy,SuiObjectRef:()=>Xc,TransactionData:()=>Zy,TransactionDataV1:()=>Yy,TransactionExpiration:()=>Ky,TransactionKind:()=>Hy,TypeTag:()=>od,base64String:()=>cb});var By=KA($y),de=Cr,Oa=Jr,Ly=Dy;function XA(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function JA(e){return de.bcs.enum("Option",{None:null,Some:e})}const Wn=de.bcs.bytes(Oa.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,Oa.isValidSuiAddress)((0,Oa.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,Oa.normalizeSuiAddress)(e)):e,output:e=>(0,Oa.normalizeSuiAddress)((0,de.toHex)(e))}),Fy=de.bcs.vector(de.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,de.fromBase58)(e),output:e=>(0,de.toBase58)(new Uint8Array(e)),validate:e=>{if((0,de.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Xc=de.bcs.struct("SuiObjectRef",{objectId:Wn,version:de.bcs.u64(),digest:Fy}),Uy=de.bcs.struct("SharedObjectRef",{objectId:Wn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),Vy=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Xc,SharedObject:Uy,Receiving:Xc}),zy=de.bcs.enum("CallArg",{Pure:de.bcs.struct("Pure",{bytes:de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})}),Object:Vy}),sd=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>sd),struct:de.bcs.lazy(()=>Xy),u16:null,u32:null,u256:null}),od=sd.transform({input:e=>typeof e=="string"?Ly.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>Ly.TypeTagSerializer.tagToString(e)}),Gn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),qy=de.bcs.struct("ProgrammableMoveCall",{package:Wn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(od),arguments:de.bcs.vector(Gn)}),Wy=de.bcs.enum("Command",{MoveCall:qy,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Gn),address:Gn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Gn,amounts:de.bcs.vector(Gn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Gn,sources:de.bcs.vector(Gn)}),Publish:de.bcs.struct("Publish",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(Wn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:JA(od).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Gn)}),Upgrade:de.bcs.struct("Upgrade",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(Wn),package:Wn,ticket:Gn})}),Gy=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(zy),commands:de.bcs.vector(Wy)}),Hy=de.bcs.enum("TransactionKind",{ProgrammableTransaction:Gy,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Ky=de.bcs.enum("TransactionExpiration",{None:null,Epoch:XA()}),Xy=de.bcs.struct("StructTag",{address:Wn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(sd)}),Jy=de.bcs.struct("GasData",{payment:de.bcs.vector(Xc),owner:Wn,price:de.bcs.u64(),budget:de.bcs.u64()}),Yy=de.bcs.struct("TransactionDataV1",{kind:Hy,sender:Wn,gasData:Jy,expiration:Ky}),Zy=de.bcs.enum("TransactionData",{V1:Yy}),Qy=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),eb=de.bcs.enum("IntentVersion",{V0:null}),tb=de.bcs.enum("AppId",{Sui:null}),rb=de.bcs.struct("Intent",{scope:Qy,version:eb,appId:tb});function nb(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:rb,value:e})}const ib=de.bcs.enum("CompressedSignature",{ED25519:de.bcs.fixedArray(64,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(64,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(64,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),sb=de.bcs.enum("PublicKey",{ED25519:de.bcs.fixedArray(32,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(33,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(33,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),ob=de.bcs.struct("MultiSigPkMap",{pubKey:sb,weight:de.bcs.u8()}),ab=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(ob),threshold:de.bcs.u16()}),YA=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(ib),bitmap:de.bcs.u16(),multisig_pk:ab}),cb=de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))}),ub=de.bcs.struct("SenderSignedTransaction",{intentMessage:nb(Zy),txSignatures:de.bcs.vector(cb)}),ZA=de.bcs.vector(ub,{name:"SenderSignedData"}),QA=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var ad=Object.defineProperty,eM=Object.getOwnPropertyDescriptor,tM=Object.getOwnPropertyNames,rM=Object.prototype.hasOwnProperty,nM=(e,t)=>{for(var r in t)ad(e,r,{get:t[r],enumerable:!0})},iM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tM(t))!rM.call(e,i)&&i!==r&&ad(e,i,{get:()=>t[i],enumerable:!(n=eM(t,i))||n.enumerable});return e},sM=e=>iM(ad({},"__esModule",{value:!0}),e),lb={};nM(lb,{TransactionEffects:()=>bM});var oM=sM(lb),ve=Cr,Rt=By;const aM=ve.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ve.bcs.struct("UnableToFetchPackage",{packageId:Rt.Address}),NotAPackage:ve.bcs.struct("NotAPackage",{objectId:Rt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ve.bcs.struct("DigestDoesNotMatch",{digest:ve.bcs.vector(ve.bcs.u8())}),UnknownUpgradePolicy:ve.bcs.struct("UnknownUpgradePolicy",{policy:ve.bcs.u8()}),PackageIDDoesNotMatch:ve.bcs.struct("PackageIDDoesNotMatch",{packageId:Rt.Address,ticketId:Rt.Address})}),cM=ve.bcs.struct("ModuleId",{address:Rt.Address,name:ve.bcs.string()}),fb=ve.bcs.struct("MoveLocation",{module:cM,function:ve.bcs.u16(),instruction:ve.bcs.u16(),functionName:ve.bcs.option(ve.bcs.string())}),uM=ve.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ve.bcs.struct("IndexOutOfBounds",{idx:ve.bcs.u16()}),SecondaryIndexOutOfBounds:ve.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidResultArity:ve.bcs.struct("InvalidResultArity",{resultIdx:ve.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),lM=ve.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),fM=ve.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ve.bcs.struct("MoveObjectTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),MovePackageTooBig:ve.bcs.struct("MovePackageTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),CircularObjectOwnership:ve.bcs.struct("CircularObjectOwnership",{object:Rt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ve.bcs.option(fb),MoveAbort:ve.bcs.tuple([fb,ve.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ve.bcs.struct("CommandArgumentError",{argIdx:ve.bcs.u16(),kind:uM}),TypeArgumentError:ve.bcs.struct("TypeArgumentError",{argumentIdx:ve.bcs.u16(),kind:lM}),UnusedValueWithoutDrop:ve.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidPublicFunctionReturnType:ve.bcs.struct("InvalidPublicFunctionReturnType",{idx:ve.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ve.bcs.struct("EffectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ve.bcs.struct("PackageUpgradeError",{upgradeError:aM}),WrittenObjectsTooLarge:ve.bcs.struct("WrittenObjectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ve.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ve.bcs.vector(Rt.Address)}),AddressDeniedForCoin:ve.bcs.struct("AddressDeniedForCoin",{address:Rt.Address,coinType:ve.bcs.string()}),CoinTypeGlobalPause:ve.bcs.struct("CoinTypeGlobalPause",{coinType:ve.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),db=ve.bcs.enum("ExecutionStatus",{Success:null,Failed:ve.bcs.struct("ExecutionFailed",{error:fM,command:ve.bcs.option(ve.bcs.u64())})}),hb=ve.bcs.struct("GasCostSummary",{computationCost:ve.bcs.u64(),storageCost:ve.bcs.u64(),storageRebate:ve.bcs.u64(),nonRefundableStorageFee:ve.bcs.u64()}),mo=ve.bcs.enum("Owner",{AddressOwner:Rt.Address,ObjectOwner:Rt.Address,Shared:ve.bcs.struct("Shared",{initialSharedVersion:ve.bcs.u64()}),Immutable:null}),dM=ve.bcs.struct("TransactionEffectsV1",{status:db,executedEpoch:ve.bcs.u64(),gasUsed:hb,modifiedAtVersions:ve.bcs.vector(ve.bcs.tuple([Rt.Address,ve.bcs.u64()])),sharedObjects:ve.bcs.vector(Rt.SuiObjectRef),transactionDigest:Rt.ObjectDigest,created:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,mo])),mutated:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,mo])),unwrapped:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,mo])),deleted:ve.bcs.vector(Rt.SuiObjectRef),unwrappedThenDeleted:ve.bcs.vector(Rt.SuiObjectRef),wrapped:ve.bcs.vector(Rt.SuiObjectRef),gasObject:ve.bcs.tuple([Rt.SuiObjectRef,mo]),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest)}),cd=ve.bcs.tuple([ve.bcs.u64(),Rt.ObjectDigest]),hM=ve.bcs.enum("ObjectIn",{NotExist:null,Exist:ve.bcs.tuple([cd,mo])}),pM=ve.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ve.bcs.tuple([Rt.ObjectDigest,mo]),PackageWrite:cd}),mM=ve.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),gM=ve.bcs.struct("EffectsObjectChange",{inputState:hM,outputState:pM,idOperation:mM}),vM=ve.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:cd,MutateDeleted:ve.bcs.u64(),ReadDeleted:ve.bcs.u64(),Cancelled:ve.bcs.u64(),PerEpochConfig:null}),yM=ve.bcs.struct("TransactionEffectsV2",{status:db,executedEpoch:ve.bcs.u64(),gasUsed:hb,transactionDigest:Rt.ObjectDigest,gasObjectIndex:ve.bcs.option(ve.bcs.u32()),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest),lamportVersion:ve.bcs.u64(),changedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,gM])),unchangedSharedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,vM])),auxDataDigest:ve.bcs.option(Rt.ObjectDigest)}),bM=ve.bcs.enum("TransactionEffects",{V1:dM,V2:yM});var ud=Object.defineProperty,wM=Object.getOwnPropertyDescriptor,_M=Object.getOwnPropertyNames,xM=Object.prototype.hasOwnProperty,SM=(e,t)=>{for(var r in t)ud(e,r,{get:t[r],enumerable:!0})},EM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _M(t))!xM.call(e,i)&&i!==r&&ud(e,i,{get:()=>t[i],enumerable:!(n=wM(t,i))||n.enumerable});return e},CM=e=>EM(ud({},"__esModule",{value:!0}),e),pb={};SM(pb,{BcsType:()=>TM.BcsType,TypeTagSerializer:()=>MM.TypeTagSerializer,bcs:()=>OM});var Hn=CM(pb),Kn=Cr,Dt=By,AM=oM,MM=Dy,TM=Cr;const OM={...Kn.bcs,U8:Kn.bcs.u8(),U16:Kn.bcs.u16(),U32:Kn.bcs.u32(),U64:Kn.bcs.u64(),U128:Kn.bcs.u128(),U256:Kn.bcs.u256(),ULEB128:Kn.bcs.uleb128(),Bool:Kn.bcs.bool(),String:Kn.bcs.string(),Address:Dt.Address,AppId:Dt.AppId,Argument:Dt.Argument,CallArg:Dt.CallArg,CompressedSignature:Dt.CompressedSignature,GasData:Dt.GasData,Intent:Dt.Intent,IntentMessage:Dt.IntentMessage,IntentScope:Dt.IntentScope,IntentVersion:Dt.IntentVersion,MultiSig:Dt.MultiSig,MultiSigPkMap:Dt.MultiSigPkMap,MultiSigPublicKey:Dt.MultiSigPublicKey,ObjectArg:Dt.ObjectArg,ObjectDigest:Dt.ObjectDigest,ProgrammableMoveCall:Dt.ProgrammableMoveCall,ProgrammableTransaction:Dt.ProgrammableTransaction,PublicKey:Dt.PublicKey,SenderSignedData:Dt.SenderSignedData,SenderSignedTransaction:Dt.SenderSignedTransaction,SharedObjectRef:Dt.SharedObjectRef,StructTag:Dt.StructTag,SuiObjectRef:Dt.SuiObjectRef,Command:Dt.Command,TransactionData:Dt.TransactionData,TransactionDataV1:Dt.TransactionDataV1,TransactionExpiration:Dt.TransactionExpiration,TransactionKind:Dt.TransactionKind,TypeTag:Dt.TypeTag,TransactionEffects:AM.TransactionEffects,PasskeyAuthenticator:Dt.PasskeyAuthenticator};var ld=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,PM=Object.getOwnPropertyNames,jM=Object.prototype.hasOwnProperty,kM=(e,t)=>{for(var r in t)ld(e,r,{get:t[r],enumerable:!0})},NM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PM(t))!jM.call(e,i)&&i!==r&&ld(e,i,{get:()=>t[i],enumerable:!(n=IM(t,i))||n.enumerable});return e},RM=e=>NM(ld({},"__esModule",{value:!0}),e),mb={};kM(mb,{formatAddress:()=>$M,formatDigest:()=>BM});var DM=RM(mb);const gb="…";function $M(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${gb}${e.slice(-4)}`}function BM(e){return`${e.slice(0,10)}${gb}`}var fd=Object.defineProperty,LM=Object.getOwnPropertyDescriptor,FM=Object.getOwnPropertyNames,UM=Object.prototype.hasOwnProperty,VM=(e,t)=>{for(var r in t)fd(e,r,{get:t[r],enumerable:!0})},zM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FM(t))!UM.call(e,i)&&i!==r&&fd(e,i,{get:()=>t[i],enumerable:!(n=LM(t,i))||n.enumerable});return e},qM=e=>zM(fd({},"__esModule",{value:!0}),e),vb={};VM(vb,{isValidSuiNSName:()=>GM,normalizeSuiNSName:()=>HM});var yb=qM(vb);const bb=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,wb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,WM=235;function GM(e){return e.length>WM?!1:e.includes("@")?bb.test(e):wb.test(e)}function HM(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!bb.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!wb.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 dd=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,XM=Object.getOwnPropertyNames,JM=Object.prototype.hasOwnProperty,YM=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0})},ZM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XM(t))!JM.call(e,i)&&i!==r&&dd(e,i,{get:()=>t[i],enumerable:!(n=KM(t,i))||n.enumerable});return e},QM=e=>ZM(dd({},"__esModule",{value:!0}),e),_b={};YM(_b,{MIST_PER_SUI:()=>rT,MOVE_STDLIB_ADDRESS:()=>nT,SUI_CLOCK_OBJECT_ID:()=>sT,SUI_DECIMALS:()=>tT,SUI_FRAMEWORK_ADDRESS:()=>Sb,SUI_SYSTEM_ADDRESS:()=>iT,SUI_SYSTEM_MODULE_NAME:()=>oT,SUI_SYSTEM_STATE_OBJECT_ID:()=>cT,SUI_TYPE_ARG:()=>aT});var eT=QM(_b),xb=Jr;const tT=9,rT=BigInt(1e9),nT="0x1",Sb="0x2",iT="0x3",sT=(0,xb.normalizeSuiObjectId)("0x6"),oT="sui_system",aT=`${Sb}::sui::SUI`,cT=(0,xb.normalizeSuiObjectId)("0x5");var hd=Object.defineProperty,uT=Object.getOwnPropertyDescriptor,lT=Object.getOwnPropertyNames,fT=Object.prototype.hasOwnProperty,dT=(e,t)=>{for(var r in t)hd(e,r,{get:t[r],enumerable:!0})},hT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lT(t))!fT.call(e,i)&&i!==r&&hd(e,i,{get:()=>t[i],enumerable:!(n=uT(t,i))||n.enumerable});return e},pT=e=>hT(hd({},"__esModule",{value:!0}),e),Eb={};dT(Eb,{isValidNamedPackage:()=>Mb,isValidNamedType:()=>bT});var Cb=pT(Eb),mT=yb;const gT=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,vT=/^\d+$/,yT=64,Ab="/",Mb=e=>{const t=e.split(Ab);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!vT.test(i)||!(0,mT.isValidSuiNSName)(r)?!1:gT.test(n)&&n.length<yT},bT=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Ab)&&!Mb(r))return!1;return!0},Tb=Dc(SC);var pd=Object.defineProperty,wT=Object.getOwnPropertyDescriptor,_T=Object.getOwnPropertyNames,xT=Object.prototype.hasOwnProperty,ST=(e,t)=>{for(var r in t)pd(e,r,{get:t[r],enumerable:!0})},ET=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _T(t))!xT.call(e,i)&&i!==r&&pd(e,i,{get:()=>t[i],enumerable:!(n=wT(t,i))||n.enumerable});return e},CT=e=>ET(pd({},"__esModule",{value:!0}),e),Ob={};ST(Ob,{deriveDynamicFieldID:()=>OT});var AT=CT(Ob),MT=Cr,TT=Tb,md=Hn;function OT(e,t,r){const n=md.bcs.Address.serialize(e).toBytes(),i=md.bcs.TypeTag.serialize(t).toBytes(),s=md.bcs.u64().serialize(r.length).toBytes(),o=TT.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,MT.toHex)(o.digest().slice(0,32))}`}var gd=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,PT=Object.getOwnPropertyNames,jT=Object.prototype.hasOwnProperty,kT=(e,t)=>{for(var r in t)gd(e,r,{get:t[r],enumerable:!0})},NT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PT(t))!jT.call(e,i)&&i!==r&&gd(e,i,{get:()=>t[i],enumerable:!(n=IT(t,i))||n.enumerable});return e},RT=e=>NT(gd({},"__esModule",{value:!0}),e),Ib={};kT(Ib,{MIST_PER_SUI:()=>Ei.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>Ei.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Ji.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>Ei.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>Ei.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>Ei.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>Ei.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>Ei.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>Ei.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>Ei.SUI_TYPE_ARG,deriveDynamicFieldID:()=>DT.deriveDynamicFieldID,formatAddress:()=>jb.formatAddress,formatDigest:()=>jb.formatDigest,fromB64:()=>Xn.fromB64,fromBase58:()=>Xn.fromBase58,fromBase64:()=>Xn.fromBase64,fromHEX:()=>Xn.fromHEX,fromHex:()=>Xn.fromHex,isValidNamedPackage:()=>Nb.isValidNamedPackage,isValidNamedType:()=>Nb.isValidNamedType,isValidSuiAddress:()=>Ji.isValidSuiAddress,isValidSuiNSName:()=>kb.isValidSuiNSName,isValidSuiObjectId:()=>Ji.isValidSuiObjectId,isValidTransactionDigest:()=>Ji.isValidTransactionDigest,normalizeStructTag:()=>Ji.normalizeStructTag,normalizeSuiAddress:()=>Ji.normalizeSuiAddress,normalizeSuiNSName:()=>kb.normalizeSuiNSName,normalizeSuiObjectId:()=>Ji.normalizeSuiObjectId,parseStructTag:()=>Ji.parseStructTag,toB64:()=>Xn.toB64,toBase58:()=>Xn.toBase58,toBase64:()=>Xn.toBase64,toHEX:()=>Xn.toHEX,toHex:()=>Xn.toHex});var Pb=RT(Ib),jb=DM,Ji=Jr,Xn=Cr,kb=yb,Ei=eT,Nb=Cb,DT=AT,vd=Object.defineProperty,$T=Object.getOwnPropertyDescriptor,BT=Object.getOwnPropertyNames,LT=Object.prototype.hasOwnProperty,FT=(e,t)=>{for(var r in t)vd(e,r,{get:t[r],enumerable:!0})},UT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of BT(t))!LT.call(e,i)&&i!==r&&vd(e,i,{get:()=>t[i],enumerable:!(n=$T(t,i))||n.enumerable});return e},VT=e=>UT(vd({},"__esModule",{value:!0}),e),Rb={};FT(Rb,{getPureBcsSchema:()=>yd,isTxContext:()=>YT,normalizedTypeToMoveTypeSignature:()=>ZT,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>Bb});var Db=VT(Rb),Zt=Hn,$b=Pb,Ia=Jr;const zT="object",qT="ID",WT="ascii",GT="String",HT="string",KT="String",XT="option",JT="Option";function YT(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Ia.normalizeSuiAddress)(t.package)===(0,Ia.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function yd(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Zt.bcs.vector(Zt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=yd(e.vector);return t?Zt.bcs.vector(t):null}if("datatype"in e){const t=(0,Ia.normalizeSuiAddress)(e.datatype.package);if(t===(0,Ia.normalizeSuiAddress)($b.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===WT&&e.datatype.type===GT||e.datatype.module===HT&&e.datatype.type===KT)return Zt.bcs.String;if(e.datatype.module===XT&&e.datatype.type===JT){const r=yd(e.datatype.typeParameters[0]);return r?Zt.bcs.vector(r):null}}if(t===(0,Ia.normalizeSuiAddress)($b.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===zT&&e.datatype.type===qT)return Zt.bcs.Address}return null}function ZT(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Pa(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Pa(e.MutableReference)}:{ref:null,body:Pa(e)}}function Pa(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:Pa(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(Pa)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function Bb(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Zt.bcs.vector(Bb(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var bd=Object.defineProperty,QT=Object.getOwnPropertyDescriptor,e5=Object.getOwnPropertyNames,t5=Object.prototype.hasOwnProperty,r5=(e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},n5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of e5(t))!t5.call(e,i)&&i!==r&&bd(e,i,{get:()=>t[i],enumerable:!(n=QT(t,i))||n.enumerable});return e},i5=e=>n5(bd({},"__esModule",{value:!0}),e),Lb={};r5(Lb,{Inputs:()=>a5});var Jc=i5(Lb),s5=Cr,wd=Jr;function o5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,s5.toBase64)(e):e.toBase64()}}}const a5={Pure:o5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,wd.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,wd.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,wd.normalizeSuiAddress)(e)}}}}};var _d=Object.defineProperty,c5=Object.getOwnPropertyDescriptor,u5=Object.getOwnPropertyNames,l5=Object.prototype.hasOwnProperty,f5=(e,t)=>{for(var r in t)_d(e,r,{get:t[r],enumerable:!0})},d5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u5(t))!l5.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=c5(t,i))||n.enumerable});return e},h5=e=>d5(_d({},"__esModule",{value:!0}),e),Fb={};f5(Fb,{$Intent:()=>qb,Argument:()=>sn,BCSBytes:()=>ka,Command:()=>Wb,GasData:()=>Vb,JsonU64:()=>Yi,NormalizedCallArg:()=>v5,ObjectArg:()=>xd,ObjectID:()=>Ps,ObjectRef:()=>Yc,OpenMoveTypeSignature:()=>zb,OpenMoveTypeSignatureBody:()=>Zc,StructTag:()=>p5,SuiAddress:()=>ja,TransactionData:()=>y5,TransactionExpiration:()=>Gb,safeEnum:()=>vo});var go=h5(Fb),ue=Xi,Ub=Jr;function vo(e){const t=Object.entries(e).map(([r,n])=>(0,ue.object)({[r]:n}));return(0,ue.pipe)((0,ue.union)(t),(0,ue.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const ja=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,Ub.normalizeSuiAddress)(e)),(0,ue.check)(Ub.isValidSuiAddress)),Ps=ja,ka=(0,ue.string)(),Yi=(0,ue.pipe)((0,ue.union)([(0,ue.string)(),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())]),(0,ue.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Yc=(0,ue.object)({objectId:ja,version:Yi,digest:(0,ue.string)()}),sn=(0,ue.pipe)((0,ue.union)([(0,ue.object)({GasCoin:(0,ue.literal)(!0)}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("pure"))}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("object"))}),(0,ue.object)({Result:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())}),(0,ue.object)({NestedResult:(0,ue.tuple)([(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())])})]),(0,ue.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),Vb=(0,ue.object)({budget:(0,ue.nullable)(Yi),price:(0,ue.nullable)(Yi),owner:(0,ue.nullable)(ja),payment:(0,ue.nullable)((0,ue.array)(Yc))}),p5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Zc=(0,ue.union)([(0,ue.literal)("address"),(0,ue.literal)("bool"),(0,ue.literal)("u8"),(0,ue.literal)("u16"),(0,ue.literal)("u32"),(0,ue.literal)("u64"),(0,ue.literal)("u128"),(0,ue.literal)("u256"),(0,ue.object)({vector:(0,ue.lazy)(()=>Zc)}),(0,ue.object)({datatype:(0,ue.object)({package:(0,ue.string)(),module:(0,ue.string)(),type:(0,ue.string)(),typeParameters:(0,ue.array)((0,ue.lazy)(()=>Zc))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),zb=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Zc}),m5=(0,ue.object)({package:Ps,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(sn),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)(zb)))}),qb=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([sn,(0,ue.array)(sn)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),Wb=vo({MoveCall:m5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(sn),address:sn}),SplitCoins:(0,ue.object)({coin:sn,amounts:(0,ue.array)(sn)}),MergeCoins:(0,ue.object)({destination:sn,sources:(0,ue.array)(sn)}),Publish:(0,ue.object)({modules:(0,ue.array)(ka),dependencies:(0,ue.array)(Ps)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(sn)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(ka),dependencies:(0,ue.array)(Ps),package:Ps,ticket:sn}),$Intent:qb}),xd=vo({ImmOrOwnedObject:Yc,SharedObject:(0,ue.object)({objectId:Ps,initialSharedVersion:Yi,mutable:(0,ue.boolean)()}),Receiving:Yc}),g5=vo({Object:xd,Pure:(0,ue.object)({bytes:ka}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:Ps,version:(0,ue.optional)((0,ue.nullable)(Yi)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(Yi))})}),v5=vo({Object:xd,Pure:(0,ue.object)({bytes:ka})}),Gb=vo({None:(0,ue.literal)(!0),Epoch:Yi}),y5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(ja),expiration:(0,ue.nullish)(Gb),gasData:Vb,inputs:(0,ue.array)(g5),commands:(0,ue.array)(Wb)});var Sd=Object.defineProperty,b5=Object.getOwnPropertyDescriptor,w5=Object.getOwnPropertyNames,_5=Object.prototype.hasOwnProperty,x5=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},S5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of w5(t))!_5.call(e,i)&&i!==r&&Sd(e,i,{get:()=>t[i],enumerable:!(n=b5(t,i))||n.enumerable});return e},E5=e=>S5(Sd({},"__esModule",{value:!0}),e),Hb={};x5(Hb,{Commands:()=>C5,UpgradePolicy:()=>Jb});var Ed=E5(Hb),Kb=Cr,Jn=Xi,Xb=Jr,Yn=go,Jb=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(Jb||{});const C5={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=>(0,Jn.parse)(Yn.Argument,r)),address:(0,Jn.parse)(Yn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Jn.parse)(Yn.Argument,e),amounts:t.map(r=>(0,Jn.parse)(Yn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Jn.parse)(Yn.Argument,e),sources:t.map(r=>(0,Jn.parse)(Yn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,Kb.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,Xb.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,Kb.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,Xb.normalizeSuiObjectId)(i)),package:r,ticket:(0,Jn.parse)(Yn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Jn.parse)(Yn.Argument,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(s=>(0,Jn.parse)(Yn.Argument,s)):(0,Jn.parse)(Yn.Argument,i)])),data:r}}}};var Cd=Object.defineProperty,A5=Object.getOwnPropertyDescriptor,M5=Object.getOwnPropertyNames,T5=Object.prototype.hasOwnProperty,O5=(e,t)=>{for(var r in t)Cd(e,r,{get:t[r],enumerable:!0})},I5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of M5(t))!T5.call(e,i)&&i!==r&&Cd(e,i,{get:()=>t[i],enumerable:!(n=A5(t,i))||n.enumerable});return e},P5=e=>I5(Cd({},"__esModule",{value:!0}),e),Yb={};O5(Yb,{NormalizedCallArg:()=>Ad,ObjectRef:()=>Qc,SerializedTransactionDataV1:()=>W5,StructTag:()=>rw,TransactionArgument:()=>Zn,TypeTag:()=>eu,serializeV1TransactionData:()=>G5,transactionDataFromV1:()=>H5});var Zb=P5(Yb),yo=Cr,ne=Xi,Qb=Hn,Na=go;const Qc=(0,ne.object)({digest:(0,ne.string)(),objectId:(0,ne.string)(),version:(0,ne.union)([(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),(0,ne.string)(),(0,ne.bigint)()])}),j5=(0,Na.safeEnum)({ImmOrOwned:Qc,Shared:(0,ne.object)({objectId:Na.ObjectID,initialSharedVersion:Na.JsonU64,mutable:(0,ne.boolean)()}),Receiving:Qc}),Ad=(0,Na.safeEnum)({Object:j5,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),ew=(0,ne.union)([(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.optional)((0,ne.literal)("object"))}),(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.literal)("pure")})]),k5=(0,ne.union)([(0,ne.object)({Epoch:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),tw=(0,ne.pipe)((0,ne.union)([(0,ne.number)(),(0,ne.string)(),(0,ne.bigint)()]),(0,ne.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),eu=(0,ne.union)([(0,ne.object)({bool:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u8:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u64:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u128:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({address:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({signer:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({vector:(0,ne.lazy)(()=>eu)}),(0,ne.object)({struct:(0,ne.lazy)(()=>rw)}),(0,ne.object)({u16:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u32:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u256:(0,ne.nullable)((0,ne.literal)(!0))})]),rw=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(eu)}),N5=(0,ne.object)({budget:(0,ne.optional)(tw),price:(0,ne.optional)(tw),payment:(0,ne.optional)((0,ne.array)(Qc)),owner:(0,ne.optional)((0,ne.string)())}),R5=[ew,(0,ne.object)({kind:(0,ne.literal)("GasCoin")}),(0,ne.object)({kind:(0,ne.literal)("Result"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({kind:(0,ne.literal)("NestedResult"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),resultIndex:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())})],Zn=(0,ne.union)([...R5]),D5=(0,ne.object)({kind:(0,ne.literal)("MoveCall"),target:(0,ne.pipe)((0,ne.string)(),(0,ne.check)(e=>e.split("::").length===3)),typeArguments:(0,ne.array)((0,ne.string)()),arguments:(0,ne.array)(Zn)}),$5=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Zn),address:Zn}),B5=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Zn,amounts:(0,ne.array)(Zn)}),L5=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Zn,sources:(0,ne.array)(Zn)}),F5=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:eu}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Zn)}),U5=(0,ne.object)({kind:(0,ne.literal)("Publish"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)())}),V5=(0,ne.object)({kind:(0,ne.literal)("Upgrade"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)()),packageId:(0,ne.string)(),ticket:Zn}),z5=[D5,$5,B5,L5,U5,V5,F5],q5=(0,ne.union)([...z5]),W5=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(k5),gasConfig:N5,inputs:(0,ne.array)(ew),transactions:(0,ne.array)(q5)});function G5(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((0,yo.fromBase64)(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:Qb.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>Ci(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:Ci(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>Ci(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=>Ci(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,yo.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:Ci(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>Ci(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>Ci(i,t)),address:Ci(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,yo.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:Ci(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function Ci(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 H5(e){var t,r,n;return(0,ne.parse)(Na.TransactionData,{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((0,ne.is)(Ad,i.value)){const s=(0,ne.parse)(Ad,i.value);if(s.Object){if(s.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:s.Object.ImmOrOwned.objectId,version:String(s.Object.ImmOrOwned.version),digest:s.Object.ImmOrOwned.digest}}};if(s.Object.Shared)return{Object:{SharedObject:{mutable:s.Object.Shared.mutable??null,initialSharedVersion:s.Object.Shared.initialSharedVersion,objectId:s.Object.Shared.objectId}}};if(s.Object.Receiving)return{Object:{Receiving:{digest:s.Object.Receiving.digest,version:String(s.Object.Receiving.version),objectId:s.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:(0,yo.toBase64)(new Uint8Array(s.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?Qb.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>Ai(s))}};case"MergeCoins":return{MergeCoins:{destination:Ai(i.destination),sources:i.sources.map(s=>Ai(s))}};case"MoveCall":{const[s,o,a]=i.target.split("::");return{MoveCall:{package:s,module:o,function:a,typeArguments:i.typeArguments,arguments:i.arguments.map(c=>Ai(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,yo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:Ai(i.coin),amounts:i.amounts.map(s=>Ai(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>Ai(s)),address:Ai(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,yo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:Ai(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function Ai(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}}}var Md=Object.defineProperty,K5=Object.getOwnPropertyDescriptor,X5=Object.getOwnPropertyNames,J5=Object.prototype.hasOwnProperty,Y5=(e,t)=>{for(var r in t)Md(e,r,{get:t[r],enumerable:!0})},Z5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X5(t))!J5.call(e,i)&&i!==r&&Md(e,i,{get:()=>t[i],enumerable:!(n=K5(t,i))||n.enumerable});return e},Q5=e=>Z5(Md({},"__esModule",{value:!0}),e),nw={};Y5(nw,{SerializedTransactionDataV2:()=>cO});var eO=Q5(nw),je=Xi,cr=go;function Ra(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const xn=Ra({GasCoin:(0,je.literal)(!0),Input:(0,je.pipe)((0,je.number)(),(0,je.integer)()),Result:(0,je.pipe)((0,je.number)(),(0,je.integer)()),NestedResult:(0,je.tuple)([(0,je.pipe)((0,je.number)(),(0,je.integer)()),(0,je.pipe)((0,je.number)(),(0,je.integer)())])}),tO=(0,je.object)({budget:(0,je.nullable)(cr.JsonU64),price:(0,je.nullable)(cr.JsonU64),owner:(0,je.nullable)(cr.SuiAddress),payment:(0,je.nullable)((0,je.array)(cr.ObjectRef))}),rO=(0,je.object)({package:cr.ObjectID,module:(0,je.string)(),function:(0,je.string)(),typeArguments:(0,je.array)((0,je.string)()),arguments:(0,je.array)(xn)}),nO=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([xn,(0,je.array)(xn)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),iO=Ra({MoveCall:rO,TransferObjects:(0,je.object)({objects:(0,je.array)(xn),address:xn}),SplitCoins:(0,je.object)({coin:xn,amounts:(0,je.array)(xn)}),MergeCoins:(0,je.object)({destination:xn,sources:(0,je.array)(xn)}),Publish:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID)}),MakeMoveVec:(0,je.object)({type:(0,je.nullable)((0,je.string)()),elements:(0,je.array)(xn)}),Upgrade:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID),package:cr.ObjectID,ticket:xn}),$Intent:nO}),sO=Ra({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,je.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,je.boolean)()}),Receiving:cr.ObjectRef}),oO=Ra({Object:sO,Pure:(0,je.object)({bytes:cr.BCSBytes}),UnresolvedPure:(0,je.object)({value:(0,je.unknown)()}),UnresolvedObject:(0,je.object)({objectId:cr.ObjectID,version:(0,je.optional)((0,je.nullable)(cr.JsonU64)),digest:(0,je.optional)((0,je.nullable)((0,je.string)())),initialSharedVersion:(0,je.optional)((0,je.nullable)(cr.JsonU64))})}),aO=Ra({None:(0,je.literal)(!0),Epoch:cr.JsonU64}),cO=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(cr.SuiAddress),expiration:(0,je.nullish)(aO),gasData:tO,inputs:(0,je.array)(oO),commands:(0,je.array)(iO)});var Td=Object.defineProperty,uO=Object.getOwnPropertyDescriptor,lO=Object.getOwnPropertyNames,fO=Object.prototype.hasOwnProperty,dO=(e,t)=>{for(var r in t)Td(e,r,{get:t[r],enumerable:!0})},hO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lO(t))!fO.call(e,i)&&i!==r&&Td(e,i,{get:()=>t[i],enumerable:!(n=uO(t,i))||n.enumerable});return e},pO=e=>hO(Td({},"__esModule",{value:!0}),e),iw={};dO(iw,{getClient:()=>bo,resolveTransactionData:()=>wO});var sw=pO(iw),mO=Xi,ow=Hn,Od=Pb,gO=go,Da=Jc,Id=Db;const vO=50,yO=1000n,bO=5e10;async function wO(e,t,r){return await CO(e,t),await EO(e,t),t.onlyTransactionKind||(await _O(e,t),await xO(e,t),await SO(e,t)),await AO(e),await r()}async function _O(e,t){e.gasConfig.price||(e.gasConfig.price=String(await bo(t).getReferenceGasPrice()))}async function xO(e,t){if(e.gasConfig.budget)return;const r=await bo(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(bO),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=yO*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+n,s=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(s>i?s:i)}async function SO(e,t){if(!e.gasConfig.payment){const n=(await bo(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Od.SUI_TYPE_ARG})).data.filter(i=>!e.inputs.find(o=>{var a;return(a=o.Object)!=null&&a.ImmOrOwnedObject?i.coinObjectId===o.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=>(0,mO.parse)(gO.ObjectRef,i))}}async function EO(e,t){const r=e.inputs.filter(l=>{var f;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(f=l.UnresolvedObject)!=null&&f.initialSharedVersion)}),n=[...new Set(r.map(l=>(0,Od.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?IO(n,vO):[],s=(await Promise.all(i.map(l=>bo(t).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),o=new Map(n.map((l,f)=>[l,s[f]])),a=Array.from(o).filter(([l,f])=>f.error).map(([l,f])=>JSON.stringify(f.error));if(a.length)throw new Error(`The following input objects are invalid: ${a.join(", ")}`);const c=s.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const f=l.data.owner,h=f&&typeof f=="object"&&"Shared"in f?f.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:h}}),u=new Map(n.map((l,f)=>[l,c[f]]));for(const[l,f]of e.inputs.entries()){if(!f.UnresolvedObject)continue;let h;const y=(0,Od.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Da.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:MO(e,l)}):TO(e,l)&&(h=Da.Inputs.ReceivingRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})),e.inputs[e.inputs.indexOf(f)]=h??Da.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})}}async function CO(e,t){const{inputs:r,commands:n}=e,i=[],s=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}`;s.add(l),i.push(a.MoveCall)}}switch(a.$kind){case"SplitCoins":a.SplitCoins.amounts.forEach(c=>{aw(c,ow.bcs.U64,e)});break;case"TransferObjects":aw(a.TransferObjects.address,ow.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=bo(t);await Promise.all([...s].map(async c=>{const[u,l,f]=c.split("::"),h=await a.getNormalizedMoveFunction({package:u,module:l,function:f});o.set(c,h.parameters.map(y=>(0,Id.normalizedTypeToMoveTypeSignature)(y)))}))}i.length&&await Promise.all(i.map(async a=>{const c=o.get(`${a.package}::${a.module}::${a.function}`);if(!c)return;const l=c.length>0&&(0,Id.isTxContext)(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((f,h)=>{var k,R;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((k=b.UnresolvedPure)==null?void 0:k.value)??((R=b.UnresolvedObject)==null?void 0:R.objectId),T=(0,Id.getPureBcsSchema)(f.body);if(T){y.type="pure",r[r.indexOf(b)]=Da.Inputs.Pure(T.serialize(w));return}if(typeof w!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(w,null,2)}`);y.type="object";const P=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:w}}:b;r[y.Input]=P})}})}function AO(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 aw(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Da.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function MO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=i.MoveCall._argumentTypes[s].ref!=="&"||r}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(r=!0)}),r}function TO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=OO(i.MoveCall._argumentTypes[s])||r}}),r}function OO(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 bo(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 IO(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var Pd=Object.defineProperty,PO=Object.getOwnPropertyDescriptor,jO=Object.getOwnPropertyNames,kO=Object.prototype.hasOwnProperty,NO=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},RO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jO(t))!kO.call(e,i)&&i!==r&&Pd(e,i,{get:()=>t[i],enumerable:!(n=PO(t,i))||n.enumerable});return e},DO=e=>RO(Pd({},"__esModule",{value:!0}),e),cw={};NO(cw,{createObjectMethods:()=>$O});var uw=DO(cw);function $O(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}var jd=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,LO=Object.getOwnPropertyNames,FO=Object.prototype.hasOwnProperty,UO=(e,t)=>{for(var r in t)jd(e,r,{get:t[r],enumerable:!0})},VO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LO(t))!FO.call(e,i)&&i!==r&&jd(e,i,{get:()=>t[i],enumerable:!(n=BO(t,i))||n.enumerable});return e},zO=e=>VO(jd({},"__esModule",{value:!0}),e),lw={};UO(lw,{createPure:()=>WO});var fw=zO(lw),qO=Cr,rr=Hn;function WO(e){function t(r,n){if(typeof r=="string")return e($a(r).serialize(n));if(r instanceof Uint8Array||(0,qO.isSerializedBcs)(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(rr.bcs.U8.serialize(r)),t.u16=r=>e(rr.bcs.U16.serialize(r)),t.u32=r=>e(rr.bcs.U32.serialize(r)),t.u64=r=>e(rr.bcs.U64.serialize(r)),t.u128=r=>e(rr.bcs.U128.serialize(r)),t.u256=r=>e(rr.bcs.U256.serialize(r)),t.bool=r=>e(rr.bcs.Bool.serialize(r)),t.string=r=>e(rr.bcs.String.serialize(r)),t.address=r=>e(rr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(rr.bcs.vector($a(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option($a(r)).serialize(n)),t}function $a(e){switch(e){case"u8":return rr.bcs.u8();case"u16":return rr.bcs.u16();case"u32":return rr.bcs.u32();case"u64":return rr.bcs.u64();case"u128":return rr.bcs.u128();case"u256":return rr.bcs.u256();case"bool":return rr.bcs.bool();case"string":return rr.bcs.string();case"id":case"address":return rr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?rr.bcs.vector($a(n)):rr.bcs.option($a(n))}throw new Error(`Invalid Pure type name: ${e}`)}var kd=Object.defineProperty,GO=Object.getOwnPropertyDescriptor,HO=Object.getOwnPropertyNames,KO=Object.prototype.hasOwnProperty,XO=(e,t)=>{for(var r in t)kd(e,r,{get:t[r],enumerable:!0})},JO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HO(t))!KO.call(e,i)&&i!==r&&kd(e,i,{get:()=>t[i],enumerable:!(n=GO(t,i))||n.enumerable});return e},YO=e=>JO(kd({},"__esModule",{value:!0}),e),dw={};XO(dw,{hashTypedData:()=>eI});var ZO=YO(dw),QO=Tb;function eI(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),(0,QO.blake2b)(n,{dkLen:32})}var Nd=Object.defineProperty,tI=Object.getOwnPropertyDescriptor,rI=Object.getOwnPropertyNames,nI=Object.prototype.hasOwnProperty,iI=(e,t)=>{for(var r in t)Nd(e,r,{get:t[r],enumerable:!0})},sI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rI(t))!nI.call(e,i)&&i!==r&&Nd(e,i,{get:()=>t[i],enumerable:!(n=tI(t,i))||n.enumerable});return e},oI=e=>sI(Nd({},"__esModule",{value:!0}),e),hw={};iI(hw,{TransactionDataBuilder:()=>js});var Rd=oI(hw),aI=Cr,Dd=Xi,tu=Hn,cI=Jr,$d=go,uI=Zb,lI=ZO;function pw(e){return(0,cI.normalizeSuiAddress)(e).replace("0x","")}class js{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=tu.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return js.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=tu.bcs.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 js.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 js((0,Dd.parse)($d.TransactionData,t)):new js((0,Dd.parse)($d.TransactionData,(0,uI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,lI.hashTypedData)("TransactionData",t);return(0,aI.toBase58)(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,s=this.commands,o={ProgrammableTransaction:{inputs:i,commands:s}};if(n)return tu.bcs.TransactionKind.serialize(o,{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:pw(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:pw(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return tu.bcs.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,s]of Object.entries(n))r.$Intent.inputs[i]=Array.isArray(s)?s.map(o=>t(o,r)):t(s,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 js.getDigestFromBytes(t)}snapshot(){return(0,Dd.parse)($d.TransactionData,this)}}var Bd=Object.defineProperty,fI=Object.getOwnPropertyDescriptor,dI=Object.getOwnPropertyNames,hI=Object.prototype.hasOwnProperty,pI=(e,t)=>{for(var r in t)Bd(e,r,{get:t[r],enumerable:!0})},mI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dI(t))!hI.call(e,i)&&i!==r&&Bd(e,i,{get:()=>t[i],enumerable:!(n=fI(t,i))||n.enumerable});return e},gI=e=>mI(Bd({},"__esModule",{value:!0}),e),mw={};pI(mw,{extractMutableReference:()=>gw,extractReference:()=>vw,extractStructTag:()=>yI,getIdFromCallArg:()=>bI});var vI=gI(mw),Ba=Jr;function gw(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function vw(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function yI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=vw(e),r=gw(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function bI(e){if(typeof e=="string")return(0,Ba.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,Ba.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,Ba.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,Ba.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,Ba.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var Ld=Object.defineProperty,wI=Object.getOwnPropertyDescriptor,_I=Object.getOwnPropertyNames,xI=Object.prototype.hasOwnProperty,yw=e=>{throw TypeError(e)},SI=(e,t)=>{for(var r in t)Ld(e,r,{get:t[r],enumerable:!0})},EI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _I(t))!xI.call(e,i)&&i!==r&&Ld(e,i,{get:()=>t[i],enumerable:!(n=wI(t,i))||n.enumerable});return e},CI=e=>EI(Ld({},"__esModule",{value:!0}),e),Fd=(e,t,r)=>t.has(e)||yw("Cannot "+r),Ct=(e,t,r)=>(Fd(e,t,"read from private field"),r?r.call(e):t.get(e)),La=(e,t,r)=>t.has(e)?yw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ks=(e,t,r,n)=>(Fd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Mi=(e,t,r)=>(Fd(e,t,"access private method"),r),bw={};SI(bw,{Transaction:()=>jI,isTransaction:()=>Ew});var ru=CI(bw),nu=Cr,Zi=Xi,AI=Jr,Ns=Ed,Rs=go,ww=Zb,MI=eO,iu=Jc,TI=sw,OI=uw,II=fw,Fa=Rd,_w=vI,Ua,Va,Ds,Mt,Sn,su,Ud,Vd,zd;function xw(e,t=1/0){const r={$kind:"Result",Result:e},n=[],i=s=>n[s]??(n[s]={$kind:"NestedResult",NestedResult:[e,s]});return new Proxy(r,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(s,o){if(o in s)return Reflect.get(s,o);if(o===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield i(c),c++};if(typeof o=="symbol")return;const a=parseInt(o,10);if(!(Number.isNaN(a)||a<0))return i(a)}})}const Sw=Symbol.for("@mysten/transaction");function Ew(e){return!!e&&typeof e=="object"&&e[Sw]===!0}const Cw={buildPlugins:new Map,serializationPlugins:new Map},qd=Symbol.for("@mysten/transaction/registry");function za(){try{const e=globalThis;return e[qd]||(e[qd]=Cw),e[qd]}catch{return Cw}}const PI=class tm{constructor(){La(this,Sn),La(this,Ua),La(this,Va),La(this,Ds,new Map),La(this,Mt),this.object=(0,OI.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Zi.is)(Rs.Argument,r))return r;const n=(0,_w.getIdFromCallArg)(r),i=Ct(this,Mt).inputs.find(a=>n===(0,_w.getIdFromCallArg)(a));return(s=i==null?void 0:i.Object)!=null&&s.SharedObject&&typeof r=="object"&&((o=r.Object)!=null&&o.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,Mt).inputs.indexOf(i),type:"object"}:Ct(this,Mt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,AI.normalizeSuiAddress)(r)}}:r)});const t=za();ks(this,Mt,new Fa.TransactionDataBuilder),ks(this,Va,[...t.buildPlugins.values()]),ks(this,Ua,[...t.serializationPlugins.values()])}static fromKind(t){const r=new tm;return ks(r,Mt,Fa.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,nu.fromBase64)(t):t)),r}static from(t){const r=new tm;return Ew(t)?ks(r,Mt,new Fa.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?ks(r,Mt,Fa.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,nu.fromBase64)(t):t)):ks(r,Mt,Fa.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){za().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){za().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){za().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){za().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,Ua).push(t)}addBuildPlugin(t){Ct(this,Va).push(t)}addIntentResolver(t,r){if(Ct(this,Ds).has(t)&&Ct(this,Ds).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,Ds).set(t,r)}setSender(t){Ct(this,Mt).sender=t}setSenderIfNotSet(t){Ct(this,Mt).sender||(Ct(this,Mt).sender=t)}setExpiration(t){Ct(this,Mt).expiration=t?(0,Zi.parse)(Rs.TransactionExpiration,t):null}setGasPrice(t){Ct(this,Mt).gasConfig.price=String(t)}setGasBudget(t){Ct(this,Mt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,Mt).gasData.budget==null&&(Ct(this,Mt).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,Mt).gasConfig.owner=t}setGasPayment(t){Ct(this,Mt).gasConfig.payment=t.map(r=>(0,Zi.parse)(Rs.ObjectRef,r))}get blockData(){return(0,ww.serializeV1TransactionData)(Ct(this,Mt).snapshot())}getData(){return Ct(this,Mt).snapshot()}get[Sw](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,II.createPure)(t=>(0,nu.isSerializedBcs)(t)?Ct(this,Mt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Mt).addInput("pure",(0,Zi.is)(Rs.NormalizedCallArg,t)?(0,Zi.parse)(Rs.NormalizedCallArg,t):t instanceof Uint8Array?iu.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(iu.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(iu.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(iu.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Mt).commands.push(t);return xw(r-1)}splitCoins(t,r){const n=Ns.Commands.SplitCoins(typeof t=="string"?this.object(t):Mi(this,Sn,Ud).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):Mi(this,Sn,su).call(this,s))),i=Ct(this,Mt).commands.push(n);return xw(i-1,r.length)}mergeCoins(t,r){return this.add(Ns.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(Ns.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(Ns.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(Ns.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>Mi(this,Sn,su).call(this,n))}))}transferObjects(t,r){return this.add(Ns.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):Mi(this,Sn,su).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(Ns.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,ww.serializeV1TransactionData)(Ct(this,Mt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Zi.parse)(MI.SerializedTransactionDataV2,Ct(this,Mt).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 Mi(this,Sn,Vd).call(this,t),Ct(this,Mt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await Mi(this,Sn,Vd).call(this,t),Ct(this,Mt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Ct(this,Mt).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Ct(this,Ua)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Ct(this,Ds).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Ct(this,Ds).get(s))}await Mi(this,Sn,zd).call(this,n,t)}};Ua=new WeakMap,Va=new WeakMap,Ds=new WeakMap,Mt=new WeakMap,Sn=new WeakSet,su=function(e){return(0,nu.isSerializedBcs)(e)?this.pure(e):Mi(this,Sn,Ud).call(this,e)},Ud=function(e){return typeof e=="function"?(0,Zi.parse)(Rs.Argument,e(this)):(0,Zi.parse)(Rs.Argument,e)},Vd=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Mt).sender)throw new Error("Missing transaction sender");await Mi(this,Sn,zd).call(this,[...Ct(this,Va),TI.resolveTransactionData],e)},zd=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const s=r(n+1);let o=!1,a=!1;if(await i(Ct(this,Mt),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)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 jI=PI;var Wd=Object.defineProperty,kI=Object.getOwnPropertyDescriptor,NI=Object.getOwnPropertyNames,RI=Object.prototype.hasOwnProperty,Aw=e=>{throw TypeError(e)},DI=(e,t)=>{for(var r in t)Wd(e,r,{get:t[r],enumerable:!0})},$I=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NI(t))!RI.call(e,i)&&i!==r&&Wd(e,i,{get:()=>t[i],enumerable:!(n=kI(t,i))||n.enumerable});return e},BI=e=>$I(Wd({},"__esModule",{value:!0}),e),Mw=(e,t,r)=>t.has(e)||Aw("Cannot "+r),dr=(e,t,r)=>(Mw(e,t,"read from private field"),r?r.call(e):t.get(e)),Gd=(e,t,r)=>t.has(e)?Aw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Tw=(e,t,r,n)=>(Mw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ow={};DI(Ow,{AsyncCache:()=>Pw,InMemoryCache:()=>jw,ObjectCache:()=>LI});var Iw=BI(Ow),Hd=Jr,$s,Ar,ou;class Pw{async getObject(t){const[r,n]=await Promise.all([this.get("OwnedObject",t),this.get("SharedOrImmutableObject",t)]);return r??n??null}async getObjects(t){return Promise.all([...t.map(r=>this.getObject(r))])}async addObject(t){return t.owner?await this.set("OwnedObject",t.objectId,t):await this.set("SharedOrImmutableObject",t.objectId,t),t}async addObjects(t){await Promise.all(t.map(async r=>this.addObject(r)))}async deleteObject(t){await Promise.all([this.delete("OwnedObject",t),this.delete("SharedOrImmutableObject",t)])}async deleteObjects(t){await Promise.all(t.map(r=>this.deleteObject(r)))}async getMoveFunctionDefinition(t){const r=`${(0,Hd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,Hd.normalizeSuiAddress)(t.package),n=`${r}::${t.module}::${t.function}`,i={...t,package:r};return await this.set("MoveFunction",n,i),i}async deleteMoveFunctionDefinition(t){const r=`${(0,Hd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;await this.delete("MoveFunction",r)}async getCustom(t){return this.get("Custom",t)}async setCustom(t,r){return this.set("Custom",t,r)}async deleteCustom(t){return this.delete("Custom",t)}}class jw extends Pw{constructor(){super(...arguments),Gd(this,$s,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,$s)[t].get(r)??null}async set(t,r,n){dr(this,$s)[t].set(r,n)}async delete(t,r){dr(this,$s)[t].delete(r)}async clear(t){if(t)dr(this,$s)[t].clear();else for(const r of Object.values(dr(this,$s)))r.clear()}}$s=new WeakMap;class LI{constructor({cache:t=new jw,onEffects:r}){Gd(this,Ar),Gd(this,ou),Tw(this,Ar,t),Tw(this,ou,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Ar).getObjects(i)).filter(a=>a!==null),o=new Map(s.map(a=>[a.objectId,a]));for(const a of t.inputs){if(!a.UnresolvedObject)continue;const c=o.get(a.UnresolvedObject.objectId);c&&(c.initialSharedVersion&&!a.UnresolvedObject.initialSharedVersion?a.UnresolvedObject.initialSharedVersion=c.initialSharedVersion:(c.version&&!a.UnresolvedObject.version&&(a.UnresolvedObject.version=c.version),c.digest&&!a.UnresolvedObject.digest&&(a.UnresolvedObject.digest=c.digest)))}await Promise.all(t.commands.map(async a=>{if(a.MoveCall){const c=await this.getMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function});c&&(a.MoveCall._argumentTypes=c.parameters)}})),await n(),await Promise.all(t.commands.map(async a=>{var c;(c=a.MoveCall)!=null&&c._argumentTypes&&await dr(this,Ar).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Ar).clear()}async getMoveFunctionDefinition(t){return dr(this,Ar).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Ar).getObjects(t)}async deleteObjects(t){return dr(this,Ar).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Ar).clear("OwnedObject")}async clearCustom(){await dr(this,Ar).clear("Custom")}async getCustom(t){return dr(this,Ar).getCustom(t)}async setCustom(t,r){return dr(this,Ar).setCustom(t,r)}async deleteCustom(t){return dr(this,Ar).deleteCustom(t)}async applyEffects(t){var r;if(!t.V2)throw new Error(`Unsupported transaction effects version ${t.$kind}`);const{lamportVersion:n,changedObjects:i}=t.V2,s=[],o=[];i.forEach(([a,c])=>{var u;if(c.outputState.NotExist)s.push(a);else if(c.outputState.ObjectWrite){const[l,f]=c.outputState.ObjectWrite;o.push({objectId:a,digest:l,version:n,owner:f.AddressOwner??f.ObjectOwner??null,initialSharedVersion:((u=f.Shared)==null?void 0:u.initialSharedVersion)??null})}}),await Promise.all([dr(this,Ar).addObjects(o),dr(this,Ar).deleteObjects(s),(r=dr(this,ou))==null?void 0:r.call(this,t)])}}Ar=new WeakMap,ou=new WeakMap;var Kd=Object.defineProperty,FI=Object.getOwnPropertyDescriptor,UI=Object.getOwnPropertyNames,VI=Object.prototype.hasOwnProperty,kw=e=>{throw TypeError(e)},zI=(e,t)=>{for(var r in t)Kd(e,r,{get:t[r],enumerable:!0})},qI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of UI(t))!VI.call(e,i)&&i!==r&&Kd(e,i,{get:()=>t[i],enumerable:!(n=FI(t,i))||n.enumerable});return e},WI=e=>qI(Kd({},"__esModule",{value:!0}),e),Nw=(e,t,r)=>t.has(e)||kw("Cannot "+r),qa=(e,t,r)=>(Nw(e,t,"read from private field"),r?r.call(e):t.get(e)),Rw=(e,t,r)=>t.has(e)?kw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Xd=(e,t,r,n)=>(Nw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Dw={};zI(Dw,{CachingTransactionExecutor:()=>XI});var $w=WI(Dw),GI=Hn,HI=Iw,KI=ru,wo,_o;class XI{constructor({client:t,...r}){Rw(this,wo),Rw(this,_o,null),Xd(this,wo,t),this.cache=new HI.ObjectCache(r)}async reset(){await Promise.all([this.cache.clearOwnedObjects(),this.cache.clearCustom(),this.waitForLastTransaction()])}async buildTransaction({transaction:t,...r}){return t.addBuildPlugin(this.cache.asPlugin()),t.build({client:qa(this,wo),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,KI.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await qa(this,wo).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=GI.bcs.TransactionEffects.parse(Uint8Array.from(s.rawEffects));await this.applyEffects(o)}return s}async signAndExecuteTransaction({options:t,transaction:r,...n}){r.setSenderIfNotSet(n.signer.toSuiAddress());const i=await this.buildTransaction({transaction:r}),{signature:s}=await n.signer.signTransaction(i);return await this.executeTransaction({transaction:i,signature:s,options:t})}async applyEffects(t){var r;Xd(this,_o,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){qa(this,_o)&&(await qa(this,wo).waitForTransaction({digest:qa(this,_o)}),Xd(this,_o,null))}}wo=new WeakMap,_o=new WeakMap;var Jd=Object.defineProperty,JI=Object.getOwnPropertyDescriptor,YI=Object.getOwnPropertyNames,ZI=Object.prototype.hasOwnProperty,Bw=e=>{throw TypeError(e)},QI=(e,t)=>{for(var r in t)Jd(e,r,{get:t[r],enumerable:!0})},eP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YI(t))!ZI.call(e,i)&&i!==r&&Jd(e,i,{get:()=>t[i],enumerable:!(n=JI(t,i))||n.enumerable});return e},tP=e=>eP(Jd({},"__esModule",{value:!0}),e),rP=(e,t,r)=>t.has(e)||Bw("Cannot "+r),En=(e,t,r)=>(rP(e,t,"read from private field"),r?r.call(e):t.get(e)),Lw=(e,t,r)=>t.has(e)?Bw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Fw={};QI(Fw,{ParallelQueue:()=>iP,SerialQueue:()=>nP});var Uw=tP(Fw),Qi,Bs;class nP{constructor(){Lw(this,Qi,[])}async runTask(t){return new Promise((r,n)=>{En(this,Qi).push(()=>{t().finally(()=>{En(this,Qi).shift(),En(this,Qi).length>0&&En(this,Qi)[0]()}).then(r,n)}),En(this,Qi).length===1&&En(this,Qi)[0]()})}}Qi=new WeakMap;class iP{constructor(t){Lw(this,Bs,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{En(this,Bs).length>0?En(this,Bs).shift()():this.activeTasks--}).then(r,n)):En(this,Bs).push(()=>{t().finally(()=>{En(this,Bs).length>0?En(this,Bs).shift()():this.activeTasks--}).then(r,n)})})}}Bs=new WeakMap;var Yd=Object.defineProperty,sP=Object.getOwnPropertyDescriptor,oP=Object.getOwnPropertyNames,aP=Object.prototype.hasOwnProperty,Vw=e=>{throw TypeError(e)},cP=(e,t)=>{for(var r in t)Yd(e,r,{get:t[r],enumerable:!0})},uP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oP(t))!aP.call(e,i)&&i!==r&&Yd(e,i,{get:()=>t[i],enumerable:!(n=sP(t,i))||n.enumerable});return e},lP=e=>uP(Yd({},"__esModule",{value:!0}),e),zw=(e,t,r)=>t.has(e)||Vw("Cannot "+r),Mr=(e,t,r)=>(zw(e,t,"read from private field"),r?r.call(e):t.get(e)),xo=(e,t,r)=>t.has(e)?Vw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Zd=(e,t,r,n)=>(zw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),qw={};cP(qw,{SerialTransactionExecutor:()=>pP,getGasCoinFromEffects:()=>Hw});var Ww=lP(qw),fP=Cr,Gw=ru,dP=$w,hP=Uw,au,Wa,Cn,cu,Qd,uu;class pP{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){xo(this,au,new hP.SerialQueue),xo(this,Wa),xo(this,Cn),xo(this,cu),xo(this,Qd,async i=>{if(!i.V2)return;const s=Hw(i).ref;s?Mr(this,Cn).cache.setCustom("gasCoin",s):Mr(this,Cn).cache.deleteCustom("gasCoin")}),xo(this,uu,async i=>{const s=await Mr(this,Cn).cache.getCustom("gasCoin"),o=Gw.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Mr(this,cu)),o.setSenderIfNotSet(Mr(this,Wa).toSuiAddress()),Mr(this,Cn).buildTransaction({transaction:o})}),Zd(this,Wa,t),Zd(this,cu,r),Zd(this,Cn,new dP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Mr(this,Qd).call(this,i)}))}async applyEffects(t){return Mr(this,Cn).applyEffects(t)}async buildTransaction(t){return Mr(this,au).runTask(()=>Mr(this,uu).call(this,t))}resetCache(){return Mr(this,Cn).reset()}waitForLastTransaction(){return Mr(this,Cn).waitForLastTransaction()}executeTransaction(t,r){return Mr(this,au).runTask(async()=>{const n=(0,Gw.isTransaction)(t)?await Mr(this,uu).call(this,t):t,{signature:i}=await Mr(this,Wa).signTransaction(n),s=await Mr(this,Cn).executeTransaction({signature:i,transaction:n,options:r}).catch(async a=>{throw await this.resetCache(),a}),o=Uint8Array.from(s.rawEffects);return{digest:s.digest,effects:(0,fP.toBase64)(o),data:s}})}}au=new WeakMap,Wa=new WeakMap,Cn=new WeakMap,cu=new WeakMap,Qd=new WeakMap,uu=new WeakMap;function Hw(e){if(!e.V2)throw new Error("Unexpected effects version");const t=e.V2.changedObjects[e.V2.gasObjectIndex];if(!t)throw new Error("Gas object not found in effects");const[r,{outputState:n}]=t;if(!n.ObjectWrite)throw new Error("Unexpected gas object state");const[i,s]=n.ObjectWrite;return{ref:{objectId:r,digest:i,version:e.V2.lamportVersion},owner:s.AddressOwner||s.ObjectOwner}}var eh=Object.defineProperty,mP=Object.getOwnPropertyDescriptor,gP=Object.getOwnPropertyNames,vP=Object.prototype.hasOwnProperty,Kw=e=>{throw TypeError(e)},yP=(e,t)=>{for(var r in t)eh(e,r,{get:t[r],enumerable:!0})},bP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gP(t))!vP.call(e,i)&&i!==r&&eh(e,i,{get:()=>t[i],enumerable:!(n=mP(t,i))||n.enumerable});return e},wP=e=>bP(eh({},"__esModule",{value:!0}),e),th=(e,t,r)=>t.has(e)||Kw("Cannot "+r),qe=(e,t,r)=>(th(e,t,"read from private field"),r?r.call(e):t.get(e)),hr=(e,t,r)=>t.has(e)?Kw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),nr=(e,t,r,n)=>(th(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),on=(e,t,r)=>(th(e,t,"access private method"),r),Xw=(e,t,r,n)=>({set _(i){nr(e,t,i,r)},get _(){return qe(e,t,n)}}),Jw={};yP(Jw,{ParallelTransactionExecutor:()=>AP});var _P=wP(Jw),xP=Cr,Yw=Hn,SP=ru,EP=Rd,CP=$w,Zw=Uw,Qw=Ww,es,Qn,lu,Ga,Ha,Ka,fu,So,$r,ts,Ls,Fs,rh,du,Xa,Eo,Co,Ti,zr,e2,t2,Ja,nh,r2,ih,n2;const Ya={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class AP{constructor(t){hr(this,zr),hr(this,es),hr(this,Qn),hr(this,lu),hr(this,Ga),hr(this,Ha),hr(this,Ka),hr(this,fu),hr(this,So),hr(this,$r),hr(this,ts,[]),hr(this,Ls),hr(this,Fs,new Map),hr(this,rh,new Zw.SerialQueue),hr(this,du),hr(this,Xa,null),hr(this,Eo,null),hr(this,Co,0),hr(this,Ti,null),nr(this,es,t.signer),nr(this,Qn,t.client),nr(this,lu,t.coinBatchSize??Ya.coinBatchSize),nr(this,Ga,t.initialCoinBalance??Ya.initialCoinBalance),nr(this,Ha,t.minimumCoinBalance??Ya.minimumCoinBalance),nr(this,fu,t.defaultGasBudget??qe(this,Ha)),nr(this,Ka,t.epochBoundaryWindow??Ya.epochBoundaryWindow),nr(this,So,t.maxPoolSize??Ya.maxPoolSize),nr(this,Ls,new CP.CachingTransactionExecutor({client:t.client,cache:t.cache})),nr(this,du,new Zw.ParallelQueue(qe(this,So))),nr(this,$r,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return nr(this,Ti,null),on(this,zr,Ja).call(this,()=>qe(this,Ls).reset())}async waitForLastTransaction(){await on(this,zr,Ja).call(this,()=>on(this,zr,nh).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=MP(),o=await on(this,zr,e2).call(this,t),a=()=>{qe(this,du).runTask(()=>on(this,zr,t2).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,Fs).get(u)?(c.add(u),qe(this,Fs).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,Fs).set(u,[])}),c.size===0&&a(),n}}es=new WeakMap,Qn=new WeakMap,lu=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,Ka=new WeakMap,fu=new WeakMap,So=new WeakMap,$r=new WeakMap,ts=new WeakMap,Ls=new WeakMap,Fs=new WeakMap,rh=new WeakMap,du=new WeakMap,Xa=new WeakMap,Eo=new WeakMap,Co=new WeakMap,Ti=new WeakMap,zr=new WeakSet,e2=async function(e){const t=new Set;let r=!1;return e.addSerializationPlugin(async(n,i,s)=>{await s(),!r&&(r=!0,n.inputs.forEach(o=>{var a,c,u,l,f;(c=(a=o.Object)==null?void 0:a.ImmOrOwnedObject)!=null&&c.objectId?t.add(o.Object.ImmOrOwnedObject.objectId):(l=(u=o.Object)==null?void 0:u.Receiving)!=null&&l.objectId?t.add(o.Object.Receiving.objectId):(f=o.UnresolvedObject)!=null&&f.objectId&&!o.UnresolvedObject.initialSharedVersion&&t.add(o.UnresolvedObject.objectId)}))}),await e.prepareForSerialization({client:qe(this,Qn)}),t},t2=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,es).toSuiAddress()),await qe(this,rh).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await on(this,zr,ih).call(this)),e.setGasBudgetIfNotSet(qe(this,fu)),await on(this,zr,Ja).call(this),n=await on(this,zr,r2).call(this),Xw(this,Co)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,Ls).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,Qn)}),{signature:o}=await qe(this,es).signTransaction(s),a=await qe(this,Ls).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=Yw.bcs.TransactionEffects.parse(c),l=(0,Qw.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,es).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new EP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,Ha)?qe(this,ts).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,$r)||nr(this,$r,new Map),qe(this,$r).set(l.ref.objectId,l.ref))}return nr(this,Xa,a.digest),{digest:a.digest,effects:(0,xP.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,$r)||nr(this,$r,new Map),qe(this,$r).set(n.id,null)),await on(this,zr,Ja).call(this,async()=>{await Promise.all([qe(this,Ls).cache.deleteObjects([...t]),on(this,zr,nh).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,Fs).get(s);o&&o.length>0?o.shift()():o&&qe(this,Fs).delete(s)}),Xw(this,Co)._--}},Ja=async function(e){qe(this,Eo)&&await qe(this,Eo),nr(this,Eo,(e==null?void 0:e().then(()=>{nr(this,Eo,null)},()=>{}))??null)},nh=async function(){const e=qe(this,Xa);e&&(nr(this,Xa,null),await qe(this,Qn).waitForTransaction({digest:e}))},r2=async function(){if(qe(this,ts).length===0&&qe(this,Co)<=qe(this,So)&&await on(this,zr,n2).call(this),qe(this,ts).length===0)throw new Error("No coins available");return qe(this,ts).shift()},ih=async function(){if((qe(this,Ti)?qe(this,Ti).expiration-qe(this,Ka)-Date.now():0)>0)return qe(this,Ti).price;if(qe(this,Ti)){const r=Math.max(qe(this,Ti).expiration+qe(this,Ka)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,Qn).getLatestSuiSystemState();return nr(this,Ti,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),on(this,zr,ih).call(this)},n2=async function(){var u;const e=Math.min(qe(this,lu),qe(this,So)-(qe(this,ts).length+qe(this,Co))+1);if(e===0)return;const t=new SP.Transaction,r=qe(this,es).toSuiAddress();if(t.setSender(r),qe(this,$r)){const l=[],f=[];for(const[h,y]of qe(this,$r))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,Qn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),nr(this,$r,new Map)}const n=new Array(e).fill(qe(this,Ga)),i=t.splitCoins(t.gas,n),s=[];for(let l=0;l<n.length;l++)s.push(i[l]);t.transferObjects(s,r),await this.waitForLastTransaction();const o=await qe(this,Qn).signAndExecuteTransaction({transaction:t,signer:qe(this,es),options:{showRawEffects:!0}}),a=Yw.bcs.TransactionEffects.parse(Uint8Array.from(o.rawEffects));(u=a.V2)==null||u.changedObjects.forEach(([l,{outputState:f}],h)=>{var y;h===((y=a.V2)==null?void 0:y.gasObjectIndex)||!f.ObjectWrite||qe(this,ts).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,Ga))})}),qe(this,$r)||nr(this,$r,new Map);const c=(0,Qw.getGasCoinFromEffects)(a).ref;qe(this,$r).set(c.objectId,c),await qe(this,Qn).waitForTransaction({digest:o.digest})};function MP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var sh=Object.defineProperty,TP=Object.getOwnPropertyDescriptor,OP=Object.getOwnPropertyNames,IP=Object.prototype.hasOwnProperty,PP=(e,t)=>{for(var r in t)sh(e,r,{get:t[r],enumerable:!0})},jP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OP(t))!IP.call(e,i)&&i!==r&&sh(e,i,{get:()=>t[i],enumerable:!(n=TP(t,i))||n.enumerable});return e},kP=e=>jP(sh({},"__esModule",{value:!0}),e),i2={};PP(i2,{coinWithBalance:()=>$P});var NP=kP(i2),hu=Xi,RP=Hn,s2=Jr,pu=Ed,o2=Jc,DP=sw;const mu="CoinWithBalance",a2=(0,s2.normalizeStructTag)("0x2::sui::SUI");function $P({type:e=a2,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(mu,LP);const i=e==="gas"?e:(0,s2.normalizeStructTag)(e);return n.add(pu.Commands.Intent({name:mu,inputs:{},data:{type:i===a2&&r?"gas":i,balance:BigInt(t)}}))}}const BP=(0,hu.object)({type:(0,hu.string)(),balance:(0,hu.bigint)()});async function LP(e,t,r){var u,l;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===mu){const{type:h,balance:y}=(0,hu.parse)(BP,f.$Intent.data);h!=="gas"&&y>0n&&n.add(h),i.set(h,(i.get(h)??0n)+y)}const s=new Set;for(const f of e.inputs)(u=f.Object)!=null&&u.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(l=f.UnresolvedObject)!=null&&l.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=(0,DP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await FP({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,h]of e.commands.entries()){if(h.$kind!=="$Intent"||h.$Intent.name!==mu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,pu.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[T,...P]=o.get(y).map(k=>e.addInput("object",o2.Inputs.ObjectRef({objectId:k.coinObjectId,digest:k.digest,version:k.version})));P.length>0&&w.push(pu.Commands.MergeCoins(T,P)),c.set(y,T)}w.push(pu.Commands.SplitCoins(c.get(y),[e.addInput("pure",o2.Inputs.Pure(RP.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(T=>T.$kind==="Result"&&T.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:T)}return r()}async function FP({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:u,hasNextPage:l,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),h=u.sort((y,b)=>Number(BigInt(b.balance)-BigInt(y.balance)));for(const y of h){if(i.has(y.coinObjectId))continue;const b=BigInt(y.balance);if(o.push(y),s-=b,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}var oh=Object.defineProperty,UP=Object.getOwnPropertyDescriptor,VP=Object.getOwnPropertyNames,zP=Object.prototype.hasOwnProperty,qP=(e,t)=>{for(var r in t)oh(e,r,{get:t[r],enumerable:!0})},WP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of VP(t))!zP.call(e,i)&&i!==r&&oh(e,i,{get:()=>t[i],enumerable:!(n=UP(t,i))||n.enumerable});return e},GP=e=>WP(oh({},"__esModule",{value:!0}),e),c2={};qP(c2,{Arguments:()=>JP});var HP=GP(c2),KP=uw,XP=fw;const JP={pure:(0,XP.createPure)(e=>t=>t.pure(e)),object:(0,KP.createObjectMethods)(e=>t=>t.object(e)),sharedObjectRef:(...e)=>t=>t.sharedObjectRef(...e),objectRef:(...e)=>t=>t.objectRef(...e),receivingRef:(...e)=>t=>t.receivingRef(...e)};var ah=Object.defineProperty,YP=Object.getOwnPropertyDescriptor,ZP=Object.getOwnPropertyNames,QP=Object.prototype.hasOwnProperty,e7=(e,t)=>{for(var r in t)ah(e,r,{get:t[r],enumerable:!0})},t7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZP(t))!QP.call(e,i)&&i!==r&&ah(e,i,{get:()=>t[i],enumerable:!(n=YP(t,i))||n.enumerable});return e},r7=e=>t7(ah({},"__esModule",{value:!0}),e),u2={};e7(u2,{findTransactionBlockNames:()=>i7,listToRequests:()=>o7,replaceNames:()=>s7});var n7=r7(u2),l2=Cb;const Ao="/",i7=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){f2([i.MakeMoveVec.type]).forEach(a=>{r.add(a)});continue}if(!("MoveCall"in i))continue;const s=i.MoveCall;if(!s)continue;const o=s.package.split("::")[0];if(o.includes(Ao)){if(!(0,l2.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}f2(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function f2(e){const t=new Set;for(const r of e)if(r.includes(Ao)){if(!(0,l2.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const s7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(Ao))continue;if(!t.types[n.MakeMoveVec.type])throw new Error(`No resolution found for type: ${n.MakeMoveVec.type}`);n.MakeMoveVec.type=t.types[n.MakeMoveVec.type]}const i=n.MoveCall;if(!i)continue;const s=i.package.split("::"),o=s[0];if(o.includes(Ao)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(Ao)&&(s[0]=t.packages[o],i.package=s.join("::"));const a=i.typeArguments;if(a){for(let c=0;c<a.length;c++)if(a[c].includes(Ao)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},o7=(e,t)=>{const r=[],n=d2(e.packages),i=d2(e.types);for(const[s,o]of n.entries())r.push({id:s,type:"package",name:o});for(const[s,o]of i.entries())r.push({id:s+n.length,type:"moveType",name:o});return a7(r,t)},d2=e=>[...new Set(e)],a7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var ch=Object.defineProperty,c7=Object.getOwnPropertyDescriptor,u7=Object.getOwnPropertyNames,l7=Object.prototype.hasOwnProperty,f7=(e,t)=>{for(var r in t)ch(e,r,{get:t[r],enumerable:!0})},d7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u7(t))!l7.call(e,i)&&i!==r&&ch(e,i,{get:()=>t[i],enumerable:!(n=c7(t,i))||n.enumerable});return e},h7=e=>d7(ch({},"__esModule",{value:!0}),e),h2={};f7(h2,{namedPackagesPlugin:()=>m7});var p7=h7(h2),uh=n7;const m7=({suiGraphQLClient:e,pageSize:t=10,overrides:r={packages:{},types:{}}})=>{const n={packages:{...r.packages},types:{...r.types}};return async(s,o,a)=>{const c=(0,uh.findTransactionBlockNames)(s),u=(0,uh.listToRequests)({packages:c.packages.filter(l=>!n.packages[l]),types:c.types.filter(l=>!n.types[l])},t);(await Promise.all(u.map(l=>i(e,l)))).forEach(l=>{Object.assign(n.types,l.types),Object.assign(n.packages,l.packages)}),(0,uh.replaceNames)(s,n),await a()};async function i(s,o){const a={packages:{},types:{}};if(o.length===0)return a;const c=`{
25
- ${o.map(l=>{const f=l.type==="package"?"packageByName":"typeByName",h=l.type==="package"?"address":"repr";return`${p2(l.id)}: ${f}(name:"${l.name}") {
26
- ${h}
27
- }`})}
28
- }`,u=await s.query({query:c,variables:void 0});if(u.errors)throw new Error(JSON.stringify({query:c,errors:u.errors}));for(const l of o){const f=p2(l.id);if(!u.data||!u.data[f])throw new Error(`No result found for: ${l.name}`);const h=u.data[f];l.type==="package"&&(a.packages[l.name]=h.address),l.type==="moveType"&&(a.types[l.name]=h.repr)}return a}},p2=e=>`key_${e}`;var lh=Object.defineProperty,g7=Object.getOwnPropertyDescriptor,v7=Object.getOwnPropertyNames,y7=Object.prototype.hasOwnProperty,b7=(e,t)=>{for(var r in t)lh(e,r,{get:t[r],enumerable:!0})},w7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of v7(t))!y7.call(e,i)&&i!==r&&lh(e,i,{get:()=>t[i],enumerable:!(n=g7(t,i))||n.enumerable});return e},_7=e=>w7(lh({},"__esModule",{value:!0}),e),m2={};b7(m2,{Arguments:()=>M7.Arguments,AsyncCache:()=>b2.AsyncCache,Commands:()=>v2.Commands,Inputs:()=>x7.Inputs,ObjectCache:()=>b2.ObjectCache,ParallelTransactionExecutor:()=>C7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>E7.SerialTransactionExecutor,Transaction:()=>y2.Transaction,TransactionDataBuilder:()=>S7.TransactionDataBuilder,UpgradePolicy:()=>v2.UpgradePolicy,coinWithBalance:()=>A7.coinWithBalance,getPureBcsSchema:()=>g2.getPureBcsSchema,isTransaction:()=>y2.isTransaction,namedPackagesPlugin:()=>T7.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>g2.normalizedTypeToMoveTypeSignature});var Mo=_7(m2),g2=Db,x7=Jc,v2=Ed,y2=ru,S7=Rd,b2=Iw,E7=Ww,C7=_P,A7=NP,M7=HP,T7=p7,w2={},gu={},fh={},vu={},dh={},yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.Convert=void 0;class O7{static toPriceFeed(t){return hh(t,Ii("PriceFeed"))}static priceFeedToJson(t){return ph(t,Ii("PriceFeed"))}static toPrice(t){return hh(t,Ii("Price"))}static priceToJson(t){return ph(t,Ii("Price"))}static toPriceFeedMetadata(t){return hh(t,Ii("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return ph(t,Ii("PriceFeedMetadata"))}}yu.Convert=O7;function Oi(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 I7(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 P7(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 To(e,t,r,n=""){function i(l,f){return typeof l==typeof f?f:Oi(l,f,n)}function s(l,f){const h=l.length;for(let y=0;y<h;y++){const b=l[y];try{return To(f,b,r)}catch{}}return Oi(l,f)}function o(l,f){return l.indexOf(f)!==-1?f:Oi(l,f)}function a(l,f){return Array.isArray(f)?f.map(h=>To(h,l,r)):Oi("array",f)}function c(l){if(l===null)return null;const f=new Date(l);return isNaN(f.valueOf())?Oi("Date",l):f}function u(l,f,h){if(h===null||typeof h!="object"||Array.isArray(h))return Oi("object",h);const y={};return Object.getOwnPropertyNames(l).forEach(b=>{const w=l[b],T=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[w.key]=To(T,w.typ,r,w.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=To(h[b],f,r,b))}),y}if(t==="any")return e;if(t===null)return e===null?e:Oi(t,e);if(t===!1)return Oi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=j7[t.ref];return Array.isArray(t)?o(t,e):typeof t=="object"?t.hasOwnProperty("unionMembers")?s(t.unionMembers,e):t.hasOwnProperty("arrayItems")?a(t.arrayItems,e):t.hasOwnProperty("props")?u(r(t),t.additional,e):Oi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function hh(e,t){return To(e,t,I7)}function ph(e,t){return To(e,t,P7)}function Us(...e){return{unionMembers:e}}function mh(e,t){return{props:e,additional:t}}function Ii(e){return{ref:e}}const j7={PriceFeed:mh([{json:"ema_price",js:"ema_price",typ:Ii("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:Us(void 0,Ii("PriceFeedMetadata"))},{json:"price",js:"price",typ:Ii("Price")},{json:"vaa",js:"vaa",typ:Us(void 0,"")}],"any"),Price:mh([{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:mh([{json:"attestation_time",js:"attestation_time",typ:Us(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:Us(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:Us(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:Us(void 0,0)},{json:"slot",js:"slot",typ:Us(void 0,0)}],"any")};var gh={},_2;function bu(){return _2||(_2=1,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=l,r.toByteArray=h,r.fromByteArray=w;for(var n=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function u(k){var R=k.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=k.indexOf("=");F===-1&&(F=R);var L=F===R?0:4-F%4;return[F,L]}function l(k){var R=u(k),F=R[0],L=R[1];return(F+L)*3/4-L}function f(k,R,F){return(R+F)*3/4-F}function h(k){var R,F=u(k),L=F[0],G=F[1],q=new s(f(k,L,G)),X=0,ie=G>0?L-4:L,ae;for(ae=0;ae<ie;ae+=4)R=i[k.charCodeAt(ae)]<<18|i[k.charCodeAt(ae+1)]<<12|i[k.charCodeAt(ae+2)]<<6|i[k.charCodeAt(ae+3)],q[X++]=R>>16&255,q[X++]=R>>8&255,q[X++]=R&255;return G===2&&(R=i[k.charCodeAt(ae)]<<2|i[k.charCodeAt(ae+1)]>>4,q[X++]=R&255),G===1&&(R=i[k.charCodeAt(ae)]<<10|i[k.charCodeAt(ae+1)]<<4|i[k.charCodeAt(ae+2)]>>2,q[X++]=R>>8&255,q[X++]=R&255),q}function y(k){return n[k>>18&63]+n[k>>12&63]+n[k>>6&63]+n[k&63]}function b(k,R,F){for(var L,G=[],q=R;q<F;q+=3)L=(k[q]<<16&16711680)+(k[q+1]<<8&65280)+(k[q+2]&255),G.push(y(L));return G.join("")}function w(k){for(var R,F=k.length,L=F%3,G=[],q=16383,X=0,ie=F-L;X<ie;X+=q)G.push(b(k,X,X+q>ie?ie:X+q));return L===1?(R=k[F-1],G.push(n[R>>2]+n[R<<4&63]+"==")):L===2&&(R=(k[F-2]<<8)+k[F-1],G.push(n[R>>10]+n[R>>4&63]+n[R<<2&63]+"=")),G.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(k,R,F,L,G){var q,X,ie=G*8-L-1,ae=(1<<ie)-1,ce=ae>>1,z=-7,D=F?G-1:0,p=F?-1:1,d=k[R+D];for(D+=p,q=d&(1<<-z)-1,d>>=-z,z+=ie;z>0;q=q*256+k[R+D],D+=p,z-=8);for(X=q&(1<<-z)-1,q>>=-z,z+=L;z>0;X=X*256+k[R+D],D+=p,z-=8);if(q===0)q=1-ce;else{if(q===ae)return X?NaN:(d?-1:1)*(1/0);X=X+Math.pow(2,L),q=q-ce}return(d?-1:1)*X*Math.pow(2,q-L)},T.write=function(k,R,F,L,G,q){var X,ie,ae,ce=q*8-G-1,z=(1<<ce)-1,D=z>>1,p=G===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=R<0||R===0&&1/R<0?1:0;for(R=Math.abs(R),isNaN(R)||R===1/0?(ie=isNaN(R)?1:0,X=z):(X=Math.floor(Math.log(R)/Math.LN2),R*(ae=Math.pow(2,-X))<1&&(X--,ae*=2),X+D>=1?R+=p/ae:R+=p*Math.pow(2,1-D),R*ae>=2&&(X++,ae/=2),X+D>=z?(ie=0,X=z):X+D>=1?(ie=(R*ae-1)*Math.pow(2,G),X=X+D):(ie=R*Math.pow(2,D-1)*Math.pow(2,G),X=0));G>=8;k[F+d]=ie&255,d+=m,ie/=256,G-=8);for(X=X<<G|ie,ce+=G;ce>0;k[F+d]=X&255,d+=m,X/=256,ce-=8);k[F+d-m]|=x*128};/*!
24
+ <%s key={someKey} {...props} />`,xr,lr,Rn,lr),K[lr+xr]=!0}}return V===n?L(Ut):T(Ut),Ut}}function re(V,oe,fe){return J(V,oe,fe,!0)}function ke(V,oe,fe){return J(V,oe,fe,!1)}var Je=ke,Re=re;Bs.Fragment=n,Bs.jsx=Je,Bs.jsxs=Re}()),Bs}hn.env.NODE_ENV==="production"?nl.exports=P2():nl.exports=R2();var b=nl.exports;const TD="",AD="",ID="";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 OD="",PD="",RD="",ND="",N2="1.18.0",j2="1.40.0",k2={"-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 Yh extends Error{}class Zh extends Yh{constructor(t,r){super(t),this.code=r,this.type=k2[r]??"ServerError"}}class D2 extends Yh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var Xh=e=>{throw TypeError(e)},il=(e,t,r)=>t.has(e)||Xh("Cannot "+r),or=(e,t,r)=>(il(e,t,"read from private field"),r?r.call(e):t.get(e)),io=(e,t,r)=>t.has(e)?Xh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Bo=(e,t,r,n)=>(il(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Jh=(e,t,r)=>(il(e,t,"access private method"),r),B2=(e,t,r,n)=>({set _(i){Bo(e,t,i,r)},get _(){return or(e,t,n)}}),oo,Ls,ii,so,$s,Lo,za,Qh,e0;function L2(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const $2={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class F2{constructor(t,r={}){if(io(this,za),io(this,oo,0),io(this,Ls,0),io(this,ii,null),io(this,so,null),io(this,$s,new Set),io(this,Lo,new Map),this.endpoint=t,this.options={...$2,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=L2(this.endpoint))}async makeRequest(t,r){const n=await Jh(this,za,Qh).call(this);return new Promise((i,o)=>{Bo(this,oo,or(this,oo)+1),or(this,Lo).set(or(this,oo),{resolve:i,reject:o,timeout:setTimeout(()=>{or(this,Lo).delete(or(this,oo)),o(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:or(this,oo),method:t,params:r}))}).then(({error:i,result:o})=>{if(i)throw new Zh(i.message,i.code);return o})}async subscribe(t){const r=new U2(t);return or(this,$s).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}oo=new WeakMap,Ls=new WeakMap,ii=new WeakMap,so=new WeakMap,$s=new WeakMap,Lo=new WeakMap,za=new WeakSet,Qh=function(){return or(this,so)?or(this,so):(Bo(this,so,new Promise(e=>{var t;(t=or(this,ii))==null||t.close(),Bo(this,ii,new this.options.WebSocketConstructor(this.endpoint)),or(this,ii).addEventListener("open",()=>{Bo(this,Ls,0),e(or(this,ii))}),or(this,ii).addEventListener("close",()=>{B2(this,Ls)._++,or(this,Ls)<=this.options.maxReconnects&&setTimeout(()=>{Jh(this,za,e0).call(this)},this.options.reconnectTimeout)}),or(this,ii).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,$s).forEach(o=>{o.subscriptionId===i.subscription&&i.subscription===o.subscriptionId&&o.onMessage(i.result)})}})})),or(this,so))},e0=async function(){var e;return(e=or(this,ii))==null||e.close(),Bo(this,so,null),Promise.allSettled([...or(this,$s)].map(t=>t.subscribe(this)))};class U2{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 t0=e=>{throw TypeError(e)},ol=(e,t,r)=>t.has(e)||t0("Cannot "+r),tn=(e,t,r)=>(ol(e,t,"read from private field"),r?r.call(e):t.get(e)),qa=(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),sl=(e,t,r,n)=>(ol(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),V2=(e,t,r)=>(ol(e,t,"access private method"),r),Fs,pn,Us,al,r0;class z2{constructor(t){qa(this,al),qa(this,Fs,0),qa(this,pn),qa(this,Us),sl(this,pn,t)}fetch(t,r){const n=tn(this,pn).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;sl(this,Fs,tn(this,Fs)+1);const r=await this.fetch(((i=tn(this,pn).rpc)==null?void 0:i.url)??tn(this,pn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":N2,"Client-Target-Api-Version":j2,"Client-Request-Method":t.method,...(o=tn(this,pn).rpc)==null?void 0:o.headers},body:JSON.stringify({jsonrpc:"2.0",id:tn(this,Fs),method:t.method,params:t.params})});if(!r.ok)throw new D2(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Zh(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await V2(this,al,r0).call(this).subscribe(t);return async()=>!!await r()}}Fs=new WeakMap,pn=new WeakMap,Us=new WeakMap,al=new WeakSet,r0=function(){var e;if(!tn(this,Us)){const t=tn(this,pn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");sl(this,Us,new F2(((e=tn(this,pn).websocket)==null?void 0:e.url)??tn(this,pn).url,{WebSocketConstructor:t,...tn(this,pn).websocket}))}return tn(this,Us)};function n0(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 q2(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 x=(w-p)*o+1>>>0,y=new Uint8Array(x);for(;p!==w;){let R=u[p],k=0;for(let F=x-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 A=x-d;for(;A!==x&&y[A]===0;)A++;let O=n.repeat(l);for(;A<x;++A)O+=e.charAt(y[A]);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,x=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*x[F]>>>0,x[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&&x[y]===0;)y++;const A=new Uint8Array(d+(w-y));let O=d;for(;y!==w;)A[O++]=x[y++];return A}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 H2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const i0=q2(H2),ao=e=>i0.encode(e),oi=e=>i0.decode(e),W2=ao,G2=oi;function Ar(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const cl=8192;function pr(e){if(e.length<cl)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=cl){const n=e.slice(r,r+cl);t+=String.fromCharCode(...n)}return btoa(t)}const o0=pr,s0=Ar;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 si(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const a0=si,c0=$o;function ul(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 K2(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 u0{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}=K2(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 l0(e,t){switch(t){case"base58":return ao(e);case"base64":return pr(e);case"hex":return si(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Y2(e,t){switch(t){case"base58":return oi(e);case"base64":return Ar(e);case"hex":return $o(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ll(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 f0{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 fl(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return fl(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return fl(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return ul(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 l0(this.toBytes(),t)}}function fl(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 d0=e=>{throw TypeError(e)},h0=(e,t,r)=>t.has(e)||d0("Cannot "+r),mn=(e,t,r)=>(h0(e,t,"read from private field"),r?r.call(e):t.get(e)),Ha=(e,t,r)=>t.has(e)?d0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Wa=(e,t,r,n)=>(h0(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Fo,Vs,Ga,Pi;const Z2=class _2{constructor(t){Ha(this,Fo),Ha(this,Vs),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Wa(this,Fo,t.write),Wa(this,Vs,t.serialize??((r,n)=>{const i=new f0({initialSize:this.serializedSize(r)??void 0,...n});return mn(this,Fo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),mn(this,Fo).call(this,t,r)}serialize(t,r){return this.validate(t),new m0(this,mn(this,Vs).call(this,t,r))}parse(t){const r=new u0(t);return this.read(r)}fromHex(t){return this.parse($o(t))}fromBase58(t){return this.parse(oi(t))}fromBase64(t){return this.parse(Ar(t))}transform({name:t,input:r,output:n,validate:i}){return new _2({name:t??this.name,read:o=>n(this.read(o)),write:(o,s)=>mn(this,Fo).call(this,r(o),s),serializedSize:o=>this.serializedSize(r(o)),serialize:(o,s)=>mn(this,Vs).call(this,r(o),s),validate:o=>{i==null||i(o),this.validate(r(o))}})}};Fo=new WeakMap,Vs=new WeakMap;let Ln=Z2;const p0=Symbol.for("@mysten/serialized-bcs");function Ka(e){return!!e&&typeof e=="object"&&e[p0]===!0}class m0{constructor(t,r){Ha(this,Ga),Ha(this,Pi),Wa(this,Ga,t),Wa(this,Pi,r)}get[p0](){return!0}toBytes(){return mn(this,Pi)}toHex(){return si(mn(this,Pi))}toBase64(){return pr(mn(this,Pi))}toBase58(){return ao(mn(this,Pi))}parse(){return mn(this,Ga).parse(mn(this,Pi))}}Ga=new WeakMap,Pi=new WeakMap;function Ya({size:e,...t}){return new Ln({...t,serializedSize:()=>e})}function dl({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 hl({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 X2({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 J2({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=ul(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 Q2(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 dl({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return dl({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return dl({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return hl({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return hl({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return hl({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 X2({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(ul(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 J2({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 Q2(e)}},e6=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:u0,BcsType:Ln,BcsWriter:f0,SerializedBcs:m0,bcs:W,decodeStr:Y2,encodeStr:l0,fromB58:G2,fromB64:s0,fromBase58:oi,fromBase64:Ar,fromHEX:c0,fromHex:$o,isSerializedBcs:Ka,splitGenericParameters:ll,toB58:W2,toB64:o0,toBase58:ao,toBase64:pr,toHEX:a0,toHex:si},Symbol.toStringTag,{value:"Module"})),t6=32;function pl(e){try{return oi(e).length===t6}catch{return!1}}const Za=32;function $n(e){return n6(e)&&i6(e)===Za}function zs(e){return $n(e)}function r6(e){return e.includes("::")?ml(e):e}function ml(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("<")?ll(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(s=>r6(s.trim())):[];return{address:Rt(t),module:r,name:i,typeParams:o}}function g0(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?ml(e):e,o=(i==null?void 0:i.length)>0?`<${i.map(s=>typeof s=="string"?s:g0(s)).join(",")}>`:"";return`${t}::${r}::${n}${o}`}function Rt(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Za*2,"0")}`}function Kr(e,t=!1){return Rt(e,t)}function n6(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function i6(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const o6=/^vector<(.+)>$/,s6=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Xa=class js{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(o6);if(n)return{vector:js.parseFromStr(n[1],r)};const i=t.match(s6);if(i)return{struct:{address:r?Rt(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:js.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return ll(t).map(n=>js.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<${js.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(js.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function a6(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function c6(e){return W.enum("Option",{None:null,Some:e})}const nr=W.bytes(Za).transform({validate:e=>{const t=typeof e=="string"?e:si(e);if(!t||!$n(Rt(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?$o(Rt(e)):e,output:e=>Rt(si(e))}),gn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>oi(e),output:e=>ao(new Uint8Array(e)),validate:e=>{if(oi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),rn=W.struct("SuiObjectRef",{objectId:nr,version:W.u64(),digest:gn}),v0=W.struct("SharedObjectRef",{objectId:nr,initialSharedVersion:W.u64(),mutable:W.bool()}),y0=W.enum("ObjectArg",{ImmOrOwnedObject:rn,SharedObject:v0,Receiving:rn}),w0=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?Ar(e):e,output:e=>pr(new Uint8Array(e))})}),Object:y0}),gl=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>gl),struct:W.lazy(()=>C0),u16:null,u32:null,u256:null}),vl=gl.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()])}),b0=W.struct("ProgrammableMoveCall",{package:nr,module:W.string(),function:W.string(),typeArguments:W.vector(vl),arguments:W.vector(Fn)}),x0=W.enum("Command",{MoveCall:b0,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"?Ar(e):e,output:e=>pr(new Uint8Array(e))})),dependencies:W.vector(nr)}),MakeMoveVec:W.struct("MakeMoveVec",{type:c6(vl).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"?Ar(e):e,output:e=>pr(new Uint8Array(e))})),dependencies:W.vector(nr),package:nr,ticket:Fn})}),S0=W.struct("ProgrammableTransaction",{inputs:W.vector(w0),commands:W.vector(x0)}),E0=W.enum("TransactionKind",{ProgrammableTransaction:S0,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),_0=W.enum("TransactionExpiration",{None:null,Epoch:a6()}),C0=W.struct("StructTag",{address:nr,module:W.string(),name:W.string(),typeParams:W.vector(gl)}),M0=W.struct("GasData",{payment:W.vector(rn),owner:nr,price:W.u64(),budget:W.u64()}),T0=W.struct("TransactionDataV1",{kind:E0,sender:nr,gasData:M0,expiration:_0}),A0=W.enum("TransactionData",{V1:T0}),I0=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),O0=W.enum("IntentVersion",{V0:null}),P0=W.enum("AppId",{Sui:null}),R0=W.struct("Intent",{scope:I0,version:O0,appId:P0});function N0(e){return W.struct(`IntentMessage<${e.name}>`,{intent:R0,value:e})}const j0=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())}),k0=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())}),D0=W.struct("MultiSigPkMap",{pubKey:k0,weight:W.u8()}),B0=W.struct("MultiSigPublicKey",{pk_map:W.vector(D0),threshold:W.u16()}),u6=W.struct("MultiSig",{sigs:W.vector(j0),bitmap:W.u16(),multisig_pk:B0}),l6=W.vector(W.u8()).transform({input:e=>typeof e=="string"?Ar(e):e,output:e=>pr(new Uint8Array(e))}),L0=W.struct("SenderSignedTransaction",{intentMessage:N0(A0),txSignatures:W.vector(l6)}),f6=W.vector(L0,{name:"SenderSignedData"}),d6=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),h6=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})}),p6=W.struct("ModuleId",{address:nr,name:W.string()}),$0=W.struct("MoveLocation",{module:p6,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),m6=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}),g6=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),v6=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($0),MoveAbort:W.tuple([$0,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:m6}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:g6}),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:h6}),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}),F0=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:v6,command:W.option(W.u64())})}),U0=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}),y6=W.struct("TransactionEffectsV1",{status:F0,executedEpoch:W.u64(),gasUsed:U0,modifiedAtVersions:W.vector(W.tuple([nr,W.u64()])),sharedObjects:W.vector(rn),transactionDigest:gn,created:W.vector(W.tuple([rn,Uo])),mutated:W.vector(W.tuple([rn,Uo])),unwrapped:W.vector(W.tuple([rn,Uo])),deleted:W.vector(rn),unwrappedThenDeleted:W.vector(rn),wrapped:W.vector(rn),gasObject:W.tuple([rn,Uo]),eventsDigest:W.option(gn),dependencies:W.vector(gn)}),yl=W.tuple([W.u64(),gn]),w6=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([yl,Uo])}),b6=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([gn,Uo]),PackageWrite:yl}),x6=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),S6=W.struct("EffectsObjectChange",{inputState:w6,outputState:b6,idOperation:x6}),E6=W.enum("UnchangedSharedKind",{ReadOnlyRoot:yl,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),_6=W.struct("TransactionEffectsV2",{status:F0,executedEpoch:W.u64(),gasUsed:U0,transactionDigest:gn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(gn),dependencies:W.vector(gn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([nr,S6])),unchangedSharedObjects:W.vector(W.tuple([nr,E6])),auxDataDigest:W.option(gn)}),C6=W.enum("TransactionEffects",{V1:y6,V2:_6}),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:P0,Argument:Fn,CallArg:w0,CompressedSignature:j0,GasData:M0,Intent:R0,IntentMessage:N0,IntentScope:I0,IntentVersion:O0,MultiSig:u6,MultiSigPkMap:D0,MultiSigPublicKey:B0,ObjectArg:y0,ObjectDigest:gn,ProgrammableMoveCall:b0,ProgrammableTransaction:S0,PublicKey:k0,SenderSignedData:f6,SenderSignedTransaction:L0,SharedObjectRef:v0,StructTag:C0,SuiObjectRef:rn,Command:x0,TransactionData:A0,TransactionDataV1:T0,TransactionExpiration:_0,TransactionKind:E0,TypeTag:vl,TransactionEffects:C6,PasskeyAuthenticator:d6},V0="…";function M6(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${V0}${e.slice(-4)}`}function T6(e){return`${e.slice(0,10)}${V0}`}const z0=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,q0=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,A6=235;function H0(e){return e.length>A6?!1:e.includes("@")?z0.test(e):q0.test(e)}function W0(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!z0.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,o]=r.split("@");n=[...i?i.split("."):[],o]}else{if(!q0.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 I6=9,O6=BigInt(1e9),G0="0x1",qs="0x2",P6="0x3",K0=Kr("0x6"),R6="sui_system",Ja=`${qs}::sui::SUI`,N6=Kr("0x5"),j6=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,k6=/^\d+$/,D6=64,Y0="/",Z0=e=>{const t=e.split(Y0);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!k6.test(i)||!H0(r)?!1:j6.test(n)&&n.length<D6},B6=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Y0)&&!Z0(r))return!1;return!0};function wl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function L6(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function X0(e,...t){if(!L6(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 J0(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 $6(e,t){X0(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)),co=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),Q0=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,ai=co?e=>e:e=>Q0(e);function Vo(e){for(let t=0;t<e.length;t++)e[t]=Q0(e[t])}function F6(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Hs(e){return typeof e=="string"&&(e=F6(e)),X0(e),e}let U6=class{clone(){return this._cloneInto()}};function V6(e){const t=(n,i)=>e(i).update(Hs(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const z6=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 q6 extends U6{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,wl(t),wl(r),wl(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){J0(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Hs(t);const o=t.length,s=t.byteOffset,a=t.buffer;for(let c=0;c<o;){this.pos===r&&(co||Vo(i),this.compress(i,0,!1),co||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));co||Vo(d);for(let p=0;c+r<o;p+=i.length,c+=r)this.length+=r,this.compress(d,p,!1);co||Vo(d);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){J0(this),$6(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),co||Vo(n),this.compress(n,0,!0),co||Vo(n);const i=Qa(t);this.get().forEach((o,s)=>i[s]=ai(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),bl=BigInt(32);function ep(e,t=!1){return t?{h:Number(e&ec),l:Number(e>>bl&ec)}:{h:Number(e>>bl&ec)|0,l:Number(e&ec)|0}}function H6(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}=ep(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}const W6=(e,t)=>BigInt(e>>>0)<<bl|BigInt(t>>>0),G6=(e,t,r)=>e>>>r,K6=(e,t,r)=>e<<32-r|t>>>r,Y6=(e,t,r)=>e>>>r|t<<32-r,Z6=(e,t,r)=>e<<32-r|t>>>r,X6=(e,t,r)=>e<<64-r|t>>>r-32,J6=(e,t,r)=>e>>>r-32|t<<64-r,Q6=(e,t)=>t,e4=(e,t)=>e,t4=(e,t,r)=>e<<r|t>>>32-r,r4=(e,t,r)=>t<<r|e>>>32-r,n4=(e,t,r)=>t<<r-32|e>>>64-r,i4=(e,t,r)=>e<<r-32|t>>>64-r;function o4(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:ep,split:H6,toBig:W6,shrSH:G6,shrSL:K6,rotrSH:Y6,rotrSL:Z6,rotrBH:X6,rotrBL:J6,rotr32H:Q6,rotr32L:e4,rotlSH:t4,rotlSL:r4,rotlBH:n4,rotlBL:i4,add:o4,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)},mr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ie=new Uint32Array(32);function Ri(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],x=Ie[2*n],y=Ie[2*n+1],A=Br.add3L(c,l,s);u=Br.add3H(A,u,d,a),c=A|0,{Dh:y,Dl:x}={Dh:y^u,Dl:x^c},{Dh:y,Dl:x}={Dh:Br.rotr32H(y,x),Dl:Br.rotr32L(y,x)},{h:w,l:p}=Br.add(w,p,y,x),{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]=x,Ie[2*n+1]=y}function Ni(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],x=Ie[2*n],y=Ie[2*n+1],A=Br.add3L(c,l,s);u=Br.add3H(A,u,d,a),c=A|0,{Dh:y,Dl:x}={Dh:y^u,Dl:x^c},{Dh:y,Dl:x}={Dh:Br.rotrSH(y,x,16),Dl:Br.rotrSL(y,x,16)},{h:w,l:p}=Br.add(w,p,y,x),{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]=x,Ie[2*n+1]=y}class s4 extends q6{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=mr[0]|0,this.v0h=mr[1]|0,this.v1l=mr[2]|0,this.v1h=mr[3]|0,this.v2l=mr[4]|0,this.v2h=mr[5]|0,this.v3l=mr[6]|0,this.v3h=mr[7]|0,this.v4l=mr[8]|0,this.v4h=mr[9]|0,this.v5l=mr[10]|0,this.v5h=mr[11]|0,this.v6l=mr[12]|0,this.v6h=mr[13]|0,this.v7l=mr[14]|0,this.v7h=mr[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(Hs(t.salt));this.v4l^=ai(n[0]),this.v4h^=ai(n[1]),this.v5l^=ai(n[2]),this.v5h^=ai(n[3])}if(t.personalization){const n=Qa(Hs(t.personalization));this.v6l^=ai(n[0]),this.v6h^=ai(n[1]),this.v7l^=ai(n[2]),this.v7h^=ai(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Hs(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:x,v7l:y,v7h:A}=this;return[t,r,n,i,o,s,a,c,u,l,d,p,w,x,y,A]}set(t,r,n,i,o,s,a,c,u,l,d,p,w,x,y,A){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=x|0,this.v7l=y|0,this.v7h=A|0}compress(t,r,n){this.get().forEach((c,u)=>Ie[u]=c),Ie.set(mr,16);let{h:i,l:o}=Br.fromBig(BigInt(this.length));Ie[24]=mr[8]^o,Ie[25]=mr[9]^i,n&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]);let s=0;const a=z6;for(let c=0;c<12;c++)Ri(0,4,8,12,t,r+2*a[s++]),Ni(0,4,8,12,t,r+2*a[s++]),Ri(1,5,9,13,t,r+2*a[s++]),Ni(1,5,9,13,t,r+2*a[s++]),Ri(2,6,10,14,t,r+2*a[s++]),Ni(2,6,10,14,t,r+2*a[s++]),Ri(3,7,11,15,t,r+2*a[s++]),Ni(3,7,11,15,t,r+2*a[s++]),Ri(0,5,10,15,t,r+2*a[s++]),Ni(0,5,10,15,t,r+2*a[s++]),Ri(1,6,11,12,t,r+2*a[s++]),Ni(1,6,11,12,t,r+2*a[s++]),Ri(2,7,8,13,t,r+2*a[s++]),Ni(2,7,8,13,t,r+2*a[s++]),Ri(3,4,9,14,t,r+2*a[s++]),Ni(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=V6(e=>new s4(e));function a4(e,t,r){const n=it.Address.serialize(e).toBytes(),i=it.TypeTag.serialize(t).toBytes(),o=it.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${si(s.digest().slice(0,32))}`}const c4=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:O6,MOVE_STDLIB_ADDRESS:G0,SUI_ADDRESS_LENGTH:Za,SUI_CLOCK_OBJECT_ID:K0,SUI_DECIMALS:I6,SUI_FRAMEWORK_ADDRESS:qs,SUI_SYSTEM_ADDRESS:P6,SUI_SYSTEM_MODULE_NAME:R6,SUI_SYSTEM_STATE_OBJECT_ID:N6,SUI_TYPE_ARG:Ja,deriveDynamicFieldID:a4,formatAddress:M6,formatDigest:T6,fromB64:s0,fromBase58:oi,fromBase64:Ar,fromHEX:c0,fromHex:$o,isValidNamedPackage:Z0,isValidNamedType:B6,isValidSuiAddress:$n,isValidSuiNSName:H0,isValidSuiObjectId:zs,isValidTransactionDigest:pl,normalizeStructTag:g0,normalizeSuiAddress:Rt,normalizeSuiNSName:W0,normalizeSuiObjectId:Kr,parseStructTag:ml,toB64:o0,toBase58:ao,toBase64:pr,toHEX:a0,toHex:si},Symbol.toStringTag,{value:"Module"})),u4="object",l4="ID",f4="ascii",d4="String",h4="string",p4="String",m4="option",g4="Option";function v4(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&Rt(t.package)===Rt("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function xl(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=xl(e.vector);return t?it.vector(t):null}if("datatype"in e){const t=Rt(e.datatype.package);if(t===Rt(G0)){if(e.datatype.module===f4&&e.datatype.type===d4||e.datatype.module===h4&&e.datatype.type===p4)return it.String;if(e.datatype.module===m4&&e.datatype.type===g4){const r=xl(e.datatype.typeParameters[0]);return r?it.vector(r):null}}if(t===Rt(qs)&&e.datatype.module===u4&&e.datatype.type===l4)return it.Address}return null}function y4(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Ws(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Ws(e.MutableReference)}:{ref:null,body:Ws(e)}}function Ws(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:Ws(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(Ws)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function w4(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?pr(e):e.toBase64()}}}const ci={Pure:w4,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:Rt(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:Rt(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:Rt(e)}}}}};var ui;function b4(e){return{lang:(e==null?void 0:e.lang)??(ui==null?void 0:ui.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(ui==null?void 0:ui.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(ui==null?void 0:ui.abortPipeEarly)}}var Sl;function x4(e){return Sl==null?void 0:Sl.get(e)}var El;function S4(e){return El==null?void 0:El.get(e)}var _l;function E4(e,t){var r;return(r=_l==null?void 0:_l.get(e))==null?void 0:r.get(t)}function rp(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 Yr(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)??rp(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??E4(e.reference,c.lang)??(u?S4(c.lang):null)??n.message??x4(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 _4(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}var C4=class extends Error{constructor(t){super(t[0].message);gt(this,"issues");this.name="ValiError",this.issues=t}};function Gs(e,t){return{kind:"validation",type:"check",reference:Gs,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&Yr(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)&&Yr(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 Cl(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Ml(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 Yr(this,"type",r,n);return r}}}function Tl(e){return{kind:"schema",type:"bigint",reference:Tl,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:Yr(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:Yr(this,"type",t,r),t}}}function Ks(e){return{kind:"schema",type:"lazy",reference:Ks,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:rp(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:Yr(this,"type",r,n),r}}}function Dt(e,...t){const r={kind:"schema",type:"nullable",reference:Dt,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=Cl(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=Cl(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:Yr(this,"type",t,r),t}}}function Te(e,t){return{kind:"schema",type:"object",reference:Te,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 Yr(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=Cl(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 Ys(e,t,r){return{kind:"schema",type:"record",reference:Ys,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(_4(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 Yr(this,"type",n,i);return n}}}function vt(e){return{kind:"schema",type:"string",reference:vt,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:Yr(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 Yr(this,"type",r,n);return r}}}function np(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];Yr(this,"type",r,n,{issues:np(o)}),r.typed=!0}else{if((s==null?void 0:s.length)===1)return s[0];Yr(this,"type",r,n,{issues:np(s)})}return r}}}function uo(){return{kind:"schema",type:"unknown",reference:uo,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function ar(e,t,r){const n=e._run({typed:!1,value:t},b4(r));if(n.issues)throw new C4(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 lo(e){const t=Object.entries(e).map(([r,n])=>Te({[r]:n}));return Wt(Sr(t),tc(r=>({...r,$kind:Object.keys(r)[0]})))}const qo=Wt(vt(),tc(e=>Rt(e)),Gs($n)),Zr=qo,fo=vt(),Vr=Wt(Sr([vt(),Wt(ir(),sr())]),Gs(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),ji=Te({objectId:qo,version:Vr,digest:vt()}),tr=Wt(Sr([Te({GasCoin:ct(!0)}),Te({Input:Wt(ir(),sr()),type:Ir(ct("pure"))}),Te({Input:Wt(ir(),sr()),type:Ir(ct("object"))}),Te({Result:Wt(ir(),sr())}),Te({NestedResult:Al([Wt(ir(),sr()),Wt(ir(),sr())])})]),tc(e=>({...e,$kind:Object.keys(e)[0]}))),M4=Te({budget:Dt(Vr),price:Dt(Vr),owner:Dt(qo),payment:Dt(tt(ji))}),Il=Sr([ct("address"),ct("bool"),ct("u8"),ct("u16"),ct("u32"),ct("u64"),ct("u128"),ct("u256"),Te({vector:Ks(()=>Il)}),Te({datatype:Te({package:vt(),module:vt(),type:vt(),typeParameters:tt(Ks(()=>Il))})}),Te({typeParameter:Wt(ir(),sr())})]),T4=Te({ref:Dt(Sr([ct("&"),ct("&mut")])),body:Il}),A4=Te({package:Zr,module:vt(),function:vt(),typeArguments:tt(vt()),arguments:tt(tr),_argumentTypes:Ir(Dt(tt(T4)))}),I4=Te({name:vt(),inputs:Ys(vt(),Sr([tr,tt(tr)])),data:Ys(vt(),uo())}),O4=lo({MoveCall:A4,TransferObjects:Te({objects:tt(tr),address:tr}),SplitCoins:Te({coin:tr,amounts:tt(tr)}),MergeCoins:Te({destination:tr,sources:tt(tr)}),Publish:Te({modules:tt(fo),dependencies:tt(Zr)}),MakeMoveVec:Te({type:Dt(vt()),elements:tt(tr)}),Upgrade:Te({modules:tt(fo),dependencies:tt(Zr),package:Zr,ticket:tr}),$Intent:I4}),ip=lo({ImmOrOwnedObject:ji,SharedObject:Te({objectId:Zr,initialSharedVersion:Vr,mutable:rc()}),Receiving:ji}),P4=lo({Object:ip,Pure:Te({bytes:fo}),UnresolvedPure:Te({value:uo()}),UnresolvedObject:Te({objectId:Zr,version:Ir(Dt(Vr)),digest:Ir(Dt(vt())),initialSharedVersion:Ir(Dt(Vr))})}),op=lo({Object:ip,Pure:Te({bytes:fo})}),sp=lo({None:ct(!0),Epoch:Vr}),nc=Te({version:ct(2),sender:zo(qo),expiration:zo(sp),gasData:M4,inputs:tt(P4),commands:tt(O4)}),ho={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:pr(new Uint8Array(r))),dependencies:t.map(r=>Kr(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:pr(new Uint8Array(i))),dependencies:t.map(i=>Kr(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}}}},Ol=Te({digest:vt(),objectId:vt(),version:Sr([Wt(ir(),sr()),vt(),Tl()])}),R4=lo({ImmOrOwned:Ol,Shared:Te({objectId:Zr,initialSharedVersion:Vr,mutable:rc()}),Receiving:Ol}),ap=lo({Object:R4,Pure:tt(Wt(ir(),sr()))}),cp=Sr([Te({kind:ct("Input"),index:Wt(ir(),sr()),value:uo(),type:Ir(ct("object"))}),Te({kind:ct("Input"),index:Wt(ir(),sr()),value:uo(),type:ct("pure")})]),N4=Sr([Te({Epoch:Wt(ir(),sr())}),Te({None:Dt(ct(!0))})]),up=Wt(Sr([ir(),vt(),Tl()]),Gs(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),Pl=Sr([Te({bool:Dt(ct(!0))}),Te({u8:Dt(ct(!0))}),Te({u64:Dt(ct(!0))}),Te({u128:Dt(ct(!0))}),Te({address:Dt(ct(!0))}),Te({signer:Dt(ct(!0))}),Te({vector:Ks(()=>Pl)}),Te({struct:Ks(()=>j4)}),Te({u16:Dt(ct(!0))}),Te({u32:Dt(ct(!0))}),Te({u256:Dt(ct(!0))})]),j4=Te({address:vt(),module:vt(),name:vt(),typeParams:tt(Pl)}),k4=Te({budget:Ir(up),price:Ir(up),payment:Ir(tt(Ol)),owner:Ir(vt())}),D4=[cp,Te({kind:ct("GasCoin")}),Te({kind:ct("Result"),index:Wt(ir(),sr())}),Te({kind:ct("NestedResult"),index:Wt(ir(),sr()),resultIndex:Wt(ir(),sr())})],li=Sr([...D4]),B4=Te({kind:ct("MoveCall"),target:Wt(vt(),Gs(e=>e.split("::").length===3)),typeArguments:tt(vt()),arguments:tt(li)}),L4=Te({kind:ct("TransferObjects"),objects:tt(li),address:li}),$4=Te({kind:ct("SplitCoins"),coin:li,amounts:tt(li)}),F4=Te({kind:ct("MergeCoins"),destination:li,sources:tt(li)}),U4=Te({kind:ct("MakeMoveVec"),type:Sr([Te({Some:Pl}),Te({None:Dt(ct(!0))})]),objects:tt(li)}),V4=Te({kind:ct("Publish"),modules:tt(tt(Wt(ir(),sr()))),dependencies:tt(vt())}),z4=Te({kind:ct("Upgrade"),modules:tt(tt(Wt(ir(),sr()))),dependencies:tt(vt()),packageId:vt(),ticket:li}),q4=Sr([...[B4,L4,$4,F4,V4,z4,U4]]);Te({version:ct(1),sender:Ir(vt()),expiration:zo(N4),gasConfig:k4,inputs:tt(cp),transactions:tt(q4)});function lp(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(Ar(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=>fi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:fi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>fi(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=>fi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from(Ar(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:fi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>fi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>fi(i,t)),address:fi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from(Ar(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:fi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function fi(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 H4(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(Ml(ap,i.value)){const o=ar(ap,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:pr(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=>di(o))}};case"MergeCoins":return{MergeCoins:{destination:di(i.destination),sources:i.sources.map(o=>di(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=>di(c))}}}case"Publish":return{Publish:{modules:i.modules.map(o=>pr(Uint8Array.from(o))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:di(i.coin),amounts:i.amounts.map(o=>di(o))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(o=>di(o)),address:di(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(o=>pr(Uint8Array.from(o))),dependencies:i.dependencies,package:i.packageId,ticket:di(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function di(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 Zs(e){return Sr(Object.entries(e).map(([t,r])=>Te({[t]:r})))}const vn=Zs({GasCoin:ct(!0),Input:Wt(ir(),sr()),Result:Wt(ir(),sr()),NestedResult:Al([Wt(ir(),sr()),Wt(ir(),sr())])}),W4=Te({budget:Dt(Vr),price:Dt(Vr),owner:Dt(qo),payment:Dt(tt(ji))}),G4=Te({package:Zr,module:vt(),function:vt(),typeArguments:tt(vt()),arguments:tt(vn)}),K4=Te({name:vt(),inputs:Ys(vt(),Sr([vn,tt(vn)])),data:Ys(vt(),uo())}),Y4=Zs({MoveCall:G4,TransferObjects:Te({objects:tt(vn),address:vn}),SplitCoins:Te({coin:vn,amounts:tt(vn)}),MergeCoins:Te({destination:vn,sources:tt(vn)}),Publish:Te({modules:tt(fo),dependencies:tt(Zr)}),MakeMoveVec:Te({type:Dt(vt()),elements:tt(vn)}),Upgrade:Te({modules:tt(fo),dependencies:tt(Zr),package:Zr,ticket:vn}),$Intent:K4}),Z4=Zs({ImmOrOwnedObject:ji,SharedObject:Te({objectId:Zr,initialSharedVersion:Vr,mutable:rc()}),Receiving:ji}),X4=Zs({Object:Z4,Pure:Te({bytes:fo}),UnresolvedPure:Te({value:uo()}),UnresolvedObject:Te({objectId:Zr,version:Ir(Dt(Vr)),digest:Ir(Dt(vt())),initialSharedVersion:Ir(Dt(Vr))})}),J4=Zs({None:ct(!0),Epoch:Vr}),Q4=Te({version:ct(2),sender:zo(qo),expiration:zo(J4),gasData:W4,inputs:tt(X4),commands:tt(Y4)}),e8=50,t8=1000n,r8=5e10;async function n8(e,t,r){return await c8(e,t),await a8(e,t),t.onlyTransactionKind||(await i8(e,t),await o8(e,t),await s8(e,t)),await u8(e),await r()}async function i8(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Xs(t).getReferenceGasPrice()))}async function o8(e,t){if(e.gasConfig.budget)return;const r=await Xs(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(r8),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=t8*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 s8(e,t){if(!e.gasConfig.payment){const n=(await Xs(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(ji,i))}}async function a8(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=>Kr(l.UnresolvedObject.objectId)))],i=n.length?h8(n,e8):[],o=(await Promise.all(i.map(l=>Xs(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=Rt(d.UnresolvedObject.objectId),x=u.get(w);d.UnresolvedObject.initialSharedVersion??(x==null?void 0:x.initialSharedVersion)?p=ci.SharedObjectRef({objectId:w,initialSharedVersion:d.UnresolvedObject.initialSharedVersion||(x==null?void 0:x.initialSharedVersion),mutable:l8(e,l)}):f8(e,l)&&(p=ci.ReceivingRef({objectId:w,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??ci.ObjectRef({objectId:w,digest:d.UnresolvedObject.digest??(x==null?void 0:x.digest),version:d.UnresolvedObject.version??(x==null?void 0:x.version)})}}async function c8(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=>{fp(c,it.U64,e)});break;case"TransferObjects":fp(a.TransferObjects.address,it.Address,e);break}});const s=new Map;if(o.size>0){const a=Xs(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=>y4(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&&v4(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 x=r[w.Input];if(!x.UnresolvedPure&&!x.UnresolvedObject)return;const y=((R=x.UnresolvedPure)==null?void 0:R.value)??((k=x.UnresolvedObject)==null?void 0:k.objectId),A=xl(d.body);if(A){w.type="pure",r[r.indexOf(x)]=ci.Pure(A.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=x.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:y}}:x;r[w.Input]=O})}})}function u8(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 fp(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=ci.Pure(t.serialize(n.UnresolvedPure.value)))}function l8(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 f8(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=d8(i.MoveCall._argumentTypes[o])||r}}),r}function d8(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 Xs(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 h8(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}function p8(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 m8(e){function t(r,n){if(typeof r=="string")return e(Js(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(Js(r)).serialize(n)),t.option=(r,n)=>e(it.option(Js(r)).serialize(n)),t}function Js(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(Js(n)):it.option(Js(n))}throw new Error(`Invalid Pure type name: ${e}`)}function g8(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 dp(e){return Rt(e).replace("0x","")}class yn{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 yn.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 yn.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 yn(ar(nc,t)):new yn(ar(nc,H4(t)))}static getDigestFromBytes(t){const r=g8("TransactionData",t);return ao(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:dp(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:dp(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 yn.getDigestFromBytes(t)}snapshot(){return ar(nc,this)}}function hp(e){if(typeof e=="string")return Rt(e);if(e.Object)return e.Object.ImmOrOwnedObject?Rt(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?Rt(e.Object.Receiving.objectId):Rt(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return Rt(e.UnresolvedObject.objectId)}var pp=e=>{throw TypeError(e)},Rl=(e,t,r)=>t.has(e)||pp("Cannot "+r),Ct=(e,t,r)=>(Rl(e,t,"read from private field"),r?r.call(e):t.get(e)),Qs=(e,t,r)=>t.has(e)?pp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),po=(e,t,r,n)=>(Rl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),hi=(e,t,r)=>(Rl(e,t,"access private method"),r),ea,ta,mo,Tt,wn,ic,Nl,jl,kl;function mp(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 gp=Symbol.for("@mysten/transaction");function vp(e){return!!e&&typeof e=="object"&&e[gp]===!0}const yp={buildPlugins:new Map,serializationPlugins:new Map},Dl=Symbol.for("@mysten/transaction/registry");function ra(){try{const e=globalThis;return e[Dl]||(e[Dl]=yp),e[Dl]}catch{return yp}}const v8=class $h{constructor(){Qs(this,wn),Qs(this,ea),Qs(this,ta),Qs(this,mo,new Map),Qs(this,Tt),this.object=p8(r=>{var o,s;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&Ml(tr,r))return r;const n=hp(r),i=Ct(this,Tt).inputs.find(a=>n===hp(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:Rt(r)}}:r)});const t=ra();po(this,Tt,new yn),po(this,ta,[...t.buildPlugins.values()]),po(this,ea,[...t.serializationPlugins.values()])}static fromKind(t){const r=new $h;return po(r,Tt,yn.fromKindBytes(typeof t=="string"?Ar(t):t)),r}static from(t){const r=new $h;return vp(t)?po(r,Tt,new yn(t.getData())):typeof t!="string"||!t.startsWith("{")?po(r,Tt,yn.fromBytes(typeof t=="string"?Ar(t):t)):po(r,Tt,yn.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){ra().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){ra().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){ra().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){ra().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,ea).push(t)}addBuildPlugin(t){Ct(this,ta).push(t)}addIntentResolver(t,r){if(Ct(this,mo).has(t)&&Ct(this,mo).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,mo).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?ar(sp,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=>ar(ji,r))}get blockData(){return lp(Ct(this,Tt).snapshot())}getData(){return Ct(this,Tt).snapshot()}get[gp](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:m8(t=>Ka(t)?Ct(this,Tt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Tt).addInput("pure",Ml(op,t)?ar(op,t):t instanceof Uint8Array?ci.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(ci.ObjectRef(...t))}receivingRef(...t){return this.object(ci.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(ci.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Tt).commands.push(t);return mp(r-1)}splitCoins(t,r){const n=ho.SplitCoins(typeof t=="string"?this.object(t):hi(this,wn,Nl).call(this,t),r.map(o=>typeof o=="number"||typeof o=="bigint"||typeof o=="string"?this.pure.u64(o):hi(this,wn,ic).call(this,o))),i=Ct(this,Tt).commands.push(n);return mp(i-1,r.length)}mergeCoins(t,r){return this.add(ho.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(ho.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(ho.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(ho.MoveCall({...r,arguments:t==null?void 0:t.map(n=>hi(this,wn,ic).call(this,n))}))}transferObjects(t,r){return this.add(ho.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):hi(this,wn,ic).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(ho.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify(lp(Ct(this,Tt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify(ar(Q4,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 hi(this,wn,jl).call(this,t),Ct(this,Tt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await hi(this,wn,jl).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,ea)];for(const o of r)if(!((i=t.supportedIntents)!=null&&i.includes(o))){if(!Ct(this,mo).has(o))throw new Error(`Missing intent resolver for ${o}`);n.push(Ct(this,mo).get(o))}await hi(this,wn,kl).call(this,n,t)}};ea=new WeakMap,ta=new WeakMap,mo=new WeakMap,Tt=new WeakMap,wn=new WeakSet,ic=function(e){return Ka(e)?this.pure(e):hi(this,wn,Nl).call(this,e)},Nl=function(e){return typeof e=="function"?ar(tr,e(this)):ar(tr,e)},jl=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Tt).sender)throw new Error("Missing transaction sender");await hi(this,wn,kl).call(this,[...Ct(this,ta),n8],e)},kl=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 Ho=v8;const y8=Symbol.for("@mysten/SuiClient");class na{get[y8](){return!0}constructor(t){this.transport=t.transport??new z2({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!$n(Rt(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(Rt(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(Rt(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(Rt(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(Rt(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||!zs(Kr(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||!zs(Kr(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(!pl(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(!pl(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:pr(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(Rt(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||!zs(Kr(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(vp(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=pr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=pr(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:pr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!zs(Kr(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=oi(t.digest);return si(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=>W0(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 ia={},oc={},Bl={},sc={},Ll={},ac={};Object.defineProperty(ac,"__esModule",{value:!0}),ac.Convert=void 0;class w8{static toPriceFeed(t){return $l(t,mi("PriceFeed"))}static priceFeedToJson(t){return Fl(t,mi("PriceFeed"))}static toPrice(t){return $l(t,mi("Price"))}static priceToJson(t){return Fl(t,mi("Price"))}static toPriceFeedMetadata(t){return $l(t,mi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return Fl(t,mi("PriceFeedMetadata"))}}ac.Convert=w8;function pi(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 b8(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 x8(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 Wo(e,t,r,n=""){function i(l,d){return typeof l==typeof d?d:pi(l,d,n)}function o(l,d){const p=l.length;for(let w=0;w<p;w++){const x=l[w];try{return Wo(d,x,r)}catch{}}return pi(l,d)}function s(l,d){return l.indexOf(d)!==-1?d:pi(l,d)}function a(l,d){return Array.isArray(d)?d.map(p=>Wo(p,l,r)):pi("array",d)}function c(l){if(l===null)return null;const d=new Date(l);return isNaN(d.valueOf())?pi("Date",l):d}function u(l,d,p){if(p===null||typeof p!="object"||Array.isArray(p))return pi("object",p);const w={};return Object.getOwnPropertyNames(l).forEach(x=>{const y=l[x],A=Object.prototype.hasOwnProperty.call(p,x)?p[x]:void 0;w[y.key]=Wo(A,y.typ,r,y.key)}),Object.getOwnPropertyNames(p).forEach(x=>{Object.prototype.hasOwnProperty.call(l,x)||(w[x]=Wo(p[x],d,r,x))}),w}if(t==="any")return e;if(t===null)return e===null?e:pi(t,e);if(t===!1)return pi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=S8[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):pi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function $l(e,t){return Wo(e,t,b8)}function Fl(e,t){return Wo(e,t,x8)}function go(...e){return{unionMembers:e}}function Ul(e,t){return{props:e,additional:t}}function mi(e){return{ref:e}}const S8={PriceFeed:Ul([{json:"ema_price",js:"ema_price",typ:mi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:go(void 0,mi("PriceFeedMetadata"))},{json:"price",js:"price",typ:mi("Price")},{json:"vaa",js:"vaa",typ:go(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:go(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:go(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:go(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:go(void 0,0)},{json:"slot",js:"slot",typ:go(void 0,0)}],"any")};var Vl={},wp;function cc(){return wp||(wp=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 $=F===k?0:4-F%4;return[F,$]}function l(R){var k=u(R),F=k[0],$=k[1];return(F+$)*3/4-$}function d(R,k,F){return(k+F)*3/4-F}function p(R){var k,F=u(R),$=F[0],H=F[1],q=new o(d(R,$,H)),Y=0,ne=H>0?$-4:$,se;for(se=0;se<ne;se+=4)k=i[R.charCodeAt(se)]<<18|i[R.charCodeAt(se+1)]<<12|i[R.charCodeAt(se+2)]<<6|i[R.charCodeAt(se+3)],q[Y++]=k>>16&255,q[Y++]=k>>8&255,q[Y++]=k&255;return H===2&&(k=i[R.charCodeAt(se)]<<2|i[R.charCodeAt(se+1)]>>4,q[Y++]=k&255),H===1&&(k=i[R.charCodeAt(se)]<<10|i[R.charCodeAt(se+1)]<<4|i[R.charCodeAt(se+2)]>>2,q[Y++]=k>>8&255,q[Y++]=k&255),q}function w(R){return n[R>>18&63]+n[R>>12&63]+n[R>>6&63]+n[R&63]}function x(R,k,F){for(var $,H=[],q=k;q<F;q+=3)$=(R[q]<<16&16711680)+(R[q+1]<<8&65280)+(R[q+2]&255),H.push(w($));return H.join("")}function y(R){for(var k,F=R.length,$=F%3,H=[],q=16383,Y=0,ne=F-$;Y<ne;Y+=q)H.push(x(R,Y,Y+q>ne?ne:Y+q));return $===1?(k=R[F-1],H.push(n[k>>2]+n[k<<4&63]+"==")):$===2&&(k=(R[F-2]<<8)+R[F-1],H.push(n[k>>10]+n[k>>4&63]+n[k<<2&63]+"=")),H.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(R,k,F,$,H){var q,Y,ne=H*8-$-1,se=(1<<ne)-1,ae=se>>1,z=-7,D=F?H-1:0,h=F?-1:1,f=R[k+D];for(D+=h,q=f&(1<<-z)-1,f>>=-z,z+=ne;z>0;q=q*256+R[k+D],D+=h,z-=8);for(Y=q&(1<<-z)-1,q>>=-z,z+=$;z>0;Y=Y*256+R[k+D],D+=h,z-=8);if(q===0)q=1-ae;else{if(q===se)return Y?NaN:(f?-1:1)*(1/0);Y=Y+Math.pow(2,$),q=q-ae}return(f?-1:1)*Y*Math.pow(2,q-$)},A.write=function(R,k,F,$,H,q){var Y,ne,se,ae=q*8-H-1,z=(1<<ae)-1,D=z>>1,h=H===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=$?0:q-1,m=$?1:-1,S=k<0||k===0&&1/k<0?1:0;for(k=Math.abs(k),isNaN(k)||k===1/0?(ne=isNaN(k)?1:0,Y=z):(Y=Math.floor(Math.log(k)/Math.LN2),k*(se=Math.pow(2,-Y))<1&&(Y--,se*=2),Y+D>=1?k+=h/se:k+=h*Math.pow(2,1-D),k*se>=2&&(Y++,se/=2),Y+D>=z?(ne=0,Y=z):Y+D>=1?(ne=(k*se-1)*Math.pow(2,H),Y=Y+D):(ne=k*Math.pow(2,D-1)*Math.pow(2,H),Y=0));H>=8;R[F+f]=ne&255,f+=m,ne/=256,H-=8);for(Y=Y<<H|ne,ae+=H;ae>0;R[F+f]=Y&255,f+=m,Y/=256,ae-=8);R[F+f-m]|=S*128};/*!
29
25
  * The buffer module from node.js, for the browser.
30
26
  *
31
27
  * @author Feross Aboukhadijeh <https://feross.org>
32
28
  * @license MIT
33
- */(function(k){const R=r,F=T,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;k.Buffer=z,k.SlowBuffer=v,k.INSPECT_MAX_BYTES=50;const G=2147483647;k.kMaxLength=G;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:ie}=globalThis;z.TYPED_ARRAY_SUPPORT=ae(),!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 ae(){try{const N=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(N,S),N.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 ce(N){if(N>G)throw new RangeError('The value "'+N+'" is invalid for option "size"');const S=new q(N);return Object.setPrototypeOf(S,z.prototype),S}function z(N,S,M){if(typeof N=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(N)}return D(N,S,M)}z.poolSize=8192;function D(N,S,M){if(typeof N=="string")return x(N,S);if(X.isView(N))return E(N);if(N==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N);if(gt(N,X)||N&&gt(N.buffer,X)||typeof ie<"u"&&(gt(N,ie)||N&&gt(N.buffer,ie)))return O(N,S,M);if(typeof N=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=N.valueOf&&N.valueOf();if(B!=null&&B!==N)return z.from(B,S,M);const K=C(N);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof N[Symbol.toPrimitive]=="function")return z.from(N[Symbol.toPrimitive]("string"),S,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N)}z.from=function(N,S,M){return D(N,S,M)},Object.setPrototypeOf(z.prototype,q.prototype),Object.setPrototypeOf(z,q);function p(N){if(typeof N!="number")throw new TypeError('"size" argument must be of type number');if(N<0)throw new RangeError('The value "'+N+'" is invalid for option "size"')}function d(N,S,M){return p(N),N<=0?ce(N):S!==void 0?typeof M=="string"?ce(N).fill(S,M):ce(N).fill(S):ce(N)}z.alloc=function(N,S,M){return d(N,S,M)};function m(N){return p(N),ce(N<0?0:g(N)|0)}z.allocUnsafe=function(N){return m(N)},z.allocUnsafeSlow=function(N){return m(N)};function x(N,S){if((typeof S!="string"||S==="")&&(S="utf8"),!z.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const M=j(N,S)|0;let B=ce(M);const K=B.write(N,S);return K!==M&&(B=B.slice(0,K)),B}function A(N){const S=N.length<0?0:g(N.length)|0,M=ce(S);for(let B=0;B<S;B+=1)M[B]=N[B]&255;return M}function E(N){if(gt(N,q)){const S=new q(N);return O(S.buffer,S.byteOffset,S.byteLength)}return A(N)}function O(N,S,M){if(S<0||N.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(N.byteLength<S+(M||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&M===void 0?B=new q(N):M===void 0?B=new q(N,S):B=new q(N,S,M),Object.setPrototypeOf(B,z.prototype),B}function C(N){if(z.isBuffer(N)){const S=g(N.length)|0,M=ce(S);return M.length===0||N.copy(M,0,0,S),M}if(N.length!==void 0)return typeof N.length!="number"||Pt(N.length)?ce(0):A(N);if(N.type==="Buffer"&&Array.isArray(N.data))return A(N.data)}function g(N){if(N>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return N|0}function v(N){return+N!=N&&(N=0),z.alloc(+N)}z.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==z.prototype},z.compare=function(S,M){if(gt(S,q)&&(S=z.from(S,S.offset,S.byteLength)),gt(M,q)&&(M=z.from(M,M.offset,M.byteLength)),!z.isBuffer(S)||!z.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===M)return 0;let B=S.length,K=M.length;for(let Z=0,re=Math.min(B,K);Z<re;++Z)if(S[Z]!==M[Z]){B=S[Z],K=M[Z];break}return B<K?-1:K<B?1:0},z.isEncoding=function(S){switch(String(S).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(S,M){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return z.alloc(0);let B;if(M===void 0)for(M=0,B=0;B<S.length;++B)M+=S[B].length;const K=z.allocUnsafe(M);let Z=0;for(B=0;B<S.length;++B){let re=S[B];if(gt(re,q))Z+re.length>K.length?(z.isBuffer(re)||(re=z.from(re)),re.copy(K,Z)):q.prototype.set.call(K,re,Z);else if(z.isBuffer(re))re.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=re.length}return K};function j(N,S){if(z.isBuffer(N))return N.length;if(X.isView(N)||gt(N,X))return N.byteLength;if(typeof N!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof N);const M=N.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&M===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return It(N).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return At(N).length;default:if(K)return B?-1:It(N).length;S=(""+S).toLowerCase(),K=!0}}z.byteLength=j;function ee(N,S,M){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((M===void 0||M>this.length)&&(M=this.length),M<=0)||(M>>>=0,S>>>=0,M<=S))return"";for(N||(N="utf8");;)switch(N){case"hex":return We(this,S,M);case"utf8":case"utf-8":return $e(this,S,M);case"ascii":return ge(this,S,M);case"latin1":case"binary":return Te(this,S,M);case"base64":return ht(this,S,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,M);default:if(B)throw new TypeError("Unknown encoding: "+N);N=(N+"").toLowerCase(),B=!0}}z.prototype._isBuffer=!0;function se(N,S,M){const B=N[S];N[S]=N[M],N[M]=B}z.prototype.swap16=function(){const S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let M=0;M<S;M+=2)se(this,M,M+1);return this},z.prototype.swap32=function(){const S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let M=0;M<S;M+=4)se(this,M,M+3),se(this,M+1,M+2);return this},z.prototype.swap64=function(){const S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let M=0;M<S;M+=8)se(this,M,M+7),se(this,M+1,M+6),se(this,M+2,M+5),se(this,M+3,M+4);return this},z.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},z.prototype.toLocaleString=z.prototype.toString,z.prototype.equals=function(S){if(!z.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:z.compare(this,S)===0},z.prototype.inspect=function(){let S="";const M=k.INSPECT_MAX_BYTES;return S=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(S+=" ... "),"<Buffer "+S+">"},L&&(z.prototype[L]=z.prototype.inspect),z.prototype.compare=function(S,M,B,K,Z){if(gt(S,q)&&(S=z.from(S,S.offset,S.byteLength)),!z.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(M===void 0&&(M=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),M<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&M>=B)return 0;if(K>=Z)return-1;if(M>=B)return 1;if(M>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let re=Z-K,Be=B-M;const rt=Math.min(re,Be),Re=this.slice(K,Z),V=S.slice(M,B);for(let oe=0;oe<rt;++oe)if(Re[oe]!==V[oe]){re=Re[oe],Be=V[oe];break}return re<Be?-1:Be<re?1:0};function he(N,S,M,B,K){if(N.length===0)return-1;if(typeof M=="string"?(B=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,Pt(M)&&(M=K?0:N.length-1),M<0&&(M=N.length+M),M>=N.length){if(K)return-1;M=N.length-1}else if(M<0)if(K)M=0;else return-1;if(typeof S=="string"&&(S=z.from(S,B)),z.isBuffer(S))return S.length===0?-1:ye(N,S,M,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(N,S,M):q.prototype.lastIndexOf.call(N,S,M):ye(N,[S],M,B,K);throw new TypeError("val must be string, number or Buffer")}function ye(N,S,M,B,K){let Z=1,re=N.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(N.length<2||S.length<2)return-1;Z=2,re/=2,Be/=2,M/=2}function rt(V,oe){return Z===1?V[oe]:V.readUInt16BE(oe*Z)}let Re;if(K){let V=-1;for(Re=M;Re<re;Re++)if(rt(N,Re)===rt(S,V===-1?0:Re-V)){if(V===-1&&(V=Re),Re-V+1===Be)return V*Z}else V!==-1&&(Re-=Re-V),V=-1}else for(M+Be>re&&(M=re-Be),Re=M;Re>=0;Re--){let V=!0;for(let oe=0;oe<Be;oe++)if(rt(N,Re+oe)!==rt(S,oe)){V=!1;break}if(V)return Re}return-1}z.prototype.includes=function(S,M,B){return this.indexOf(S,M,B)!==-1},z.prototype.indexOf=function(S,M,B){return he(this,S,M,B,!0)},z.prototype.lastIndexOf=function(S,M,B){return he(this,S,M,B,!1)};function Ee(N,S,M,B){M=Number(M)||0;const K=N.length-M;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let re;for(re=0;re<B;++re){const Be=parseInt(S.substr(re*2,2),16);if(Pt(Be))return re;N[M+re]=Be}return re}function Se(N,S,M,B){return Ye(It(S,N.length-M),N,M,B)}function Ge(N,S,M,B){return Ye(it(S),N,M,B)}function Ue(N,S,M,B){return Ye(At(S),N,M,B)}function dt(N,S,M,B){return Ye(_t(S,N.length-M),N,M,B)}z.prototype.write=function(S,M,B,K){if(M===void 0)K="utf8",B=this.length,M=0;else if(B===void 0&&typeof M=="string")K=M,B=this.length,M=0;else if(isFinite(M))M=M>>>0,isFinite(B)?(B=B>>>0,K===void 0&&(K="utf8")):(K=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Z=this.length-M;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let re=!1;for(;;)switch(K){case"hex":return Ee(this,S,M,B);case"utf8":case"utf-8":return Se(this,S,M,B);case"ascii":case"latin1":case"binary":return Ge(this,S,M,B);case"base64":return Ue(this,S,M,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,S,M,B);default:if(re)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),re=!0}},z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(N,S,M){return S===0&&M===N.length?R.fromByteArray(N):R.fromByteArray(N.slice(S,M))}function $e(N,S,M){M=Math.min(N.length,M);const B=[];let K=S;for(;K<M;){const Z=N[K];let re=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=M){let rt,Re,V,oe;switch(Be){case 1:Z<128&&(re=Z);break;case 2:rt=N[K+1],(rt&192)===128&&(oe=(Z&31)<<6|rt&63,oe>127&&(re=oe));break;case 3:rt=N[K+1],Re=N[K+2],(rt&192)===128&&(Re&192)===128&&(oe=(Z&15)<<12|(rt&63)<<6|Re&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:rt=N[K+1],Re=N[K+2],V=N[K+3],(rt&192)===128&&(Re&192)===128&&(V&192)===128&&(oe=(Z&15)<<18|(rt&63)<<12|(Re&63)<<6|V&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,Be=1):re>65535&&(re-=65536,B.push(re>>>10&1023|55296),re=56320|re&1023),B.push(re),K+=Be}return xe(B)}const mt=4096;function xe(N){const S=N.length;if(S<=mt)return String.fromCharCode.apply(String,N);let M="",B=0;for(;B<S;)M+=String.fromCharCode.apply(String,N.slice(B,B+=mt));return M}function ge(N,S,M){let B="";M=Math.min(N.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(N[K]&127);return B}function Te(N,S,M){let B="";M=Math.min(N.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(N[K]);return B}function We(N,S,M){const B=N.length;(!S||S<0)&&(S=0),(!M||M<0||M>B)&&(M=B);let K="";for(let Z=S;Z<M;++Z)K+=ot[N[Z]];return K}function De(N,S,M){const B=N.slice(S,M);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}z.prototype.slice=function(S,M){const B=this.length;S=~~S,M=M===void 0?B:~~M,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),M<0?(M+=B,M<0&&(M=0)):M>B&&(M=B),M<S&&(M=S);const K=this.subarray(S,M);return Object.setPrototypeOf(K,z.prototype),K};function Oe(N,S,M){if(N%1!==0||N<0)throw new RangeError("offset is not uint");if(N+S>M)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S],Z=1,re=0;for(;++re<M&&(Z*=256);)K+=this[S+re]*Z;return K},z.prototype.readUintBE=z.prototype.readUIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S+--M],Z=1;for(;M>0&&(Z*=256);)K+=this[S+--M]*Z;return K},z.prototype.readUint8=z.prototype.readUInt8=function(S,M){return S=S>>>0,M||Oe(S,1,this.length),this[S]},z.prototype.readUint16LE=z.prototype.readUInt16LE=function(S,M){return S=S>>>0,M||Oe(S,2,this.length),this[S]|this[S+1]<<8},z.prototype.readUint16BE=z.prototype.readUInt16BE=function(S,M){return S=S>>>0,M||Oe(S,2,this.length),this[S]<<8|this[S+1]},z.prototype.readUint32LE=z.prototype.readUInt32LE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},z.prototype.readUint32BE=z.prototype.readUInt32BE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},z.prototype.readBigUInt64LE=xt(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=M+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24,Z=this[++S]+this[++S]*2**8+this[++S]*2**16+B*2**24;return BigInt(K)+(BigInt(Z)<<BigInt(32))}),z.prototype.readBigUInt64BE=xt(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=M*2**24+this[++S]*2**16+this[++S]*2**8+this[++S],Z=this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B;return(BigInt(K)<<BigInt(32))+BigInt(Z)}),z.prototype.readIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S],Z=1,re=0;for(;++re<M&&(Z*=256);)K+=this[S+re]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*M)),K},z.prototype.readIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=M,Z=1,re=this[S+--K];for(;K>0&&(Z*=256);)re+=this[S+--K]*Z;return Z*=128,re>=Z&&(re-=Math.pow(2,8*M)),re},z.prototype.readInt8=function(S,M){return S=S>>>0,M||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},z.prototype.readInt16LE=function(S,M){S=S>>>0,M||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},z.prototype.readInt16BE=function(S,M){S=S>>>0,M||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},z.prototype.readInt32LE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},z.prototype.readInt32BE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},z.prototype.readBigInt64LE=xt(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=this[S+4]+this[S+5]*2**8+this[S+6]*2**16+(B<<24);return(BigInt(K)<<BigInt(32))+BigInt(M+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),z.prototype.readBigInt64BE=xt(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=(M<<24)+this[++S]*2**16+this[++S]*2**8+this[++S];return(BigInt(K)<<BigInt(32))+BigInt(this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B)}),z.prototype.readFloatLE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),F.read(this,S,!0,23,4)},z.prototype.readFloatBE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),F.read(this,S,!1,23,4)},z.prototype.readDoubleLE=function(S,M){return S=S>>>0,M||Oe(S,8,this.length),F.read(this,S,!0,52,8)},z.prototype.readDoubleBE=function(S,M){return S=S>>>0,M||Oe(S,8,this.length),F.read(this,S,!1,52,8)};function Ie(N,S,M,B,K,Z){if(!z.isBuffer(N))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>K||S<Z)throw new RangeError('"value" argument is out of bounds');if(M+B>N.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,M,B,Be,0)}let Z=1,re=0;for(this[M]=S&255;++re<B&&(Z*=256);)this[M+re]=S/Z&255;return M+B},z.prototype.writeUintBE=z.prototype.writeUIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,M,B,Be,0)}let Z=B-1,re=1;for(this[M+Z]=S&255;--Z>=0&&(re*=256);)this[M+Z]=S/re&255;return M+B},z.prototype.writeUint8=z.prototype.writeUInt8=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,1,255,0),this[M]=S&255,M+1},z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,65535,0),this[M]=S&255,this[M+1]=S>>>8,M+2},z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,65535,0),this[M]=S>>>8,this[M+1]=S&255,M+2},z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,4294967295,0),this[M+3]=S>>>24,this[M+2]=S>>>16,this[M+1]=S>>>8,this[M]=S&255,M+4},z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,4294967295,0),this[M]=S>>>24,this[M+1]=S>>>16,this[M+2]=S>>>8,this[M+3]=S&255,M+4};function Fe(N,S,M,B,K){nt(S,B,K,N,M,7);let Z=Number(S&BigInt(4294967295));N[M++]=Z,Z=Z>>8,N[M++]=Z,Z=Z>>8,N[M++]=Z,Z=Z>>8,N[M++]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return N[M++]=re,re=re>>8,N[M++]=re,re=re>>8,N[M++]=re,re=re>>8,N[M++]=re,M}function lt(N,S,M,B,K){nt(S,B,K,N,M,7);let Z=Number(S&BigInt(4294967295));N[M+7]=Z,Z=Z>>8,N[M+6]=Z,Z=Z>>8,N[M+5]=Z,Z=Z>>8,N[M+4]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return N[M+3]=re,re=re>>8,N[M+2]=re,re=re>>8,N[M+1]=re,re=re>>8,N[M]=re,M+8}z.prototype.writeBigUInt64LE=xt(function(S,M=0){return Fe(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeBigUInt64BE=xt(function(S,M=0){return lt(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}let Z=0,re=1,Be=0;for(this[M]=S&255;++Z<B&&(re*=256);)S<0&&Be===0&&this[M+Z-1]!==0&&(Be=1),this[M+Z]=(S/re>>0)-Be&255;return M+B},z.prototype.writeIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}let Z=B-1,re=1,Be=0;for(this[M+Z]=S&255;--Z>=0&&(re*=256);)S<0&&Be===0&&this[M+Z+1]!==0&&(Be=1),this[M+Z]=(S/re>>0)-Be&255;return M+B},z.prototype.writeInt8=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,1,127,-128),S<0&&(S=255+S+1),this[M]=S&255,M+1},z.prototype.writeInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,32767,-32768),this[M]=S&255,this[M+1]=S>>>8,M+2},z.prototype.writeInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,32767,-32768),this[M]=S>>>8,this[M+1]=S&255,M+2},z.prototype.writeInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,2147483647,-2147483648),this[M]=S&255,this[M+1]=S>>>8,this[M+2]=S>>>16,this[M+3]=S>>>24,M+4},z.prototype.writeInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[M]=S>>>24,this[M+1]=S>>>16,this[M+2]=S>>>8,this[M+3]=S&255,M+4},z.prototype.writeBigInt64LE=xt(function(S,M=0){return Fe(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),z.prototype.writeBigInt64BE=xt(function(S,M=0){return lt(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ft(N,S,M,B,K,Z){if(M+B>N.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function He(N,S,M,B,K){return S=+S,M=M>>>0,K||ft(N,S,M,4),F.write(N,S,M,B,23,4),M+4}z.prototype.writeFloatLE=function(S,M,B){return He(this,S,M,!0,B)},z.prototype.writeFloatBE=function(S,M,B){return He(this,S,M,!1,B)};function jt(N,S,M,B,K){return S=+S,M=M>>>0,K||ft(N,S,M,8),F.write(N,S,M,B,52,8),M+8}z.prototype.writeDoubleLE=function(S,M,B){return jt(this,S,M,!0,B)},z.prototype.writeDoubleBE=function(S,M,B){return jt(this,S,M,!1,B)},z.prototype.copy=function(S,M,B,K){if(!z.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),M>=S.length&&(M=S.length),M||(M=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("sourceEnd out of bounds");K>this.length&&(K=this.length),S.length-M<K-B&&(K=S.length-M+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(M,B,K):q.prototype.set.call(S,this.subarray(B,K),M),Z},z.prototype.fill=function(S,M,B,K){if(typeof S=="string"){if(typeof M=="string"?(K=M,M=0,B=this.length):typeof B=="string"&&(K=B,B=this.length),K!==void 0&&typeof K!="string")throw new TypeError("encoding must be a string");if(typeof K=="string"&&!z.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const re=S.charCodeAt(0);(K==="utf8"&&re<128||K==="latin1")&&(S=re)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(M<0||this.length<M||this.length<B)throw new RangeError("Out of range index");if(B<=M)return this;M=M>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=M;Z<B;++Z)this[Z]=S;else{const re=z.isBuffer(S)?S:z.from(S,K),Be=re.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-M;++Z)this[Z+M]=re[Z%Be]}return this};const St={};function et(N,S,M){St[N]=class extends M{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${N}]`,this.stack,delete this.name}get code(){return N}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${N}]: ${this.message}`}}}et("ERR_BUFFER_OUT_OF_BOUNDS",function(N){return N?`${N} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),et("ERR_INVALID_ARG_TYPE",function(N,S){return`The "${N}" argument must be of type number. Received type ${typeof S}`},TypeError),et("ERR_OUT_OF_RANGE",function(N,S,M){let B=`The value of "${N}" is out of range.`,K=M;return Number.isInteger(M)&&Math.abs(M)>2**32?K=Tt(String(M)):typeof M=="bigint"&&(K=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(K=Tt(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function Tt(N){let S="",M=N.length;const B=N[0]==="-"?1:0;for(;M>=B+4;M-=3)S=`_${N.slice(M-3,M)}${S}`;return`${N.slice(0,M)}${S}`}function Bt(N,S,M){Et(S,"offset"),(N[S]===void 0||N[S+M]===void 0)&&Ot(S,N.length-(M+1))}function nt(N,S,M,B,K,Z){if(N>M||N<S){const re=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${re} and < 2${re} ** ${(Z+1)*8}${re}`:Be=`>= -(2${re} ** ${(Z+1)*8-1}${re}) and < 2 ** ${(Z+1)*8-1}${re}`:Be=`>= ${S}${re} and <= ${M}${re}`,new St.ERR_OUT_OF_RANGE("value",Be,N)}Bt(B,K,Z)}function Et(N,S){if(typeof N!="number")throw new St.ERR_INVALID_ARG_TYPE(S,"number",N)}function Ot(N,S,M){throw Math.floor(N)!==N?(Et(N,M),new St.ERR_OUT_OF_RANGE(M||"offset","an integer",N)):S<0?new St.ERR_BUFFER_OUT_OF_BOUNDS:new St.ERR_OUT_OF_RANGE(M||"offset",`>= ${M?1:0} and <= ${S}`,N)}const st=/[^+/0-9A-Za-z-_]/g;function kt(N){if(N=N.split("=")[0],N=N.trim().replace(st,""),N.length<2)return"";for(;N.length%4!==0;)N=N+"=";return N}function It(N,S){S=S||1/0;let M;const B=N.length;let K=null;const Z=[];for(let re=0;re<B;++re){if(M=N.charCodeAt(re),M>55295&&M<57344){if(!K){if(M>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(re+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=M;continue}if(M<56320){(S-=3)>-1&&Z.push(239,191,189),K=M;continue}M=(K-55296<<10|M-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,M<128){if((S-=1)<0)break;Z.push(M)}else if(M<2048){if((S-=2)<0)break;Z.push(M>>6|192,M&63|128)}else if(M<65536){if((S-=3)<0)break;Z.push(M>>12|224,M>>6&63|128,M&63|128)}else if(M<1114112){if((S-=4)<0)break;Z.push(M>>18|240,M>>12&63|128,M>>6&63|128,M&63|128)}else throw new Error("Invalid code point")}return Z}function it(N){const S=[];for(let M=0;M<N.length;++M)S.push(N.charCodeAt(M)&255);return S}function _t(N,S){let M,B,K;const Z=[];for(let re=0;re<N.length&&!((S-=2)<0);++re)M=N.charCodeAt(re),B=M>>8,K=M%256,Z.push(K),Z.push(B);return Z}function At(N){return R.toByteArray(kt(N))}function Ye(N,S,M,B){let K;for(K=0;K<B&&!(K+M>=S.length||K>=N.length);++K)S[K+M]=N[K];return K}function gt(N,S){return N instanceof S||N!=null&&N.constructor!=null&&N.constructor.name!=null&&N.constructor.name===S.name}function Pt(N){return N!==N}const ot=function(){const N="0123456789abcdef",S=new Array(256);for(let M=0;M<16;++M){const B=M*16;for(let K=0;K<16;++K)S[B+K]=N[M]+N[K]}return S}();function xt(N){return typeof BigInt>"u"?Ut:N}function Ut(){throw new Error("BigInt not supported")}})(t);const P=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=P,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(gh)),gh}var k7=bu();const vh=ga(k7);var an={},yh={exports:{}};yh.exports,function(e){(function(t,r){function n(D,p){if(!D)throw new Error(p||"Assertion failed")}function i(D,p){D.super_=p;var d=function(){};d.prototype=p.prototype,D.prototype=new d,D.prototype.constructor=D}function s(D,p,d){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init(D||0,p||10,d||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=bu().Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,m){if(typeof p=="number")return this._initNumber(p,d,m);if(typeof p=="object")return this._initArray(p,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var x=0;p[0]==="-"&&(x++,this.negative=1),x<p.length&&(d===16?this._parseHex(p,x,m):(this._parseBase(p,d,x),m==="le"&&this._initArray(this.toArray(),d,m)))},s.prototype._initNumber=function(p,d,m){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),d,m)},s.prototype._initArray=function(p,d,m){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A,E,O=0;if(m==="be")for(x=p.length-1,A=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[A]|=E<<O&67108863,this.words[A+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,A++);else if(m==="le")for(x=0,A=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[A]|=E<<O&67108863,this.words[A+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,A++);return this._strip()};function a(D,p){var d=D.charCodeAt(p);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;n(!1,"Invalid character in "+D)}function c(D,p,d){var m=a(D,d);return d-1>=p&&(m|=a(D,d-1)<<4),m}s.prototype._parseHex=function(p,d,m){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<A,this.words[E]|=O&67108863,A>=18?(A-=18,E+=1,this.words[E]|=O>>>26):A+=8;else{var C=p.length-d;for(x=C%2===0?d+1:d;x<p.length;x+=2)O=c(p,d,x)<<A,this.words[E]|=O&67108863,A>=18?(A-=18,E+=1,this.words[E]|=O>>>26):A+=8}this._strip()};function u(D,p,d,m){for(var x=0,A=0,E=Math.min(D.length,d),O=p;O<E;O++){var C=D.charCodeAt(O)-48;x*=m,C>=49?A=C-49+10:C>=17?A=C-17+10:A=C,n(C>=0&&A<m,"Invalid character"),x+=A}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,A=1;A<=67108863;A*=d)x++;x--,A=A/d|0;for(var E=p.length-m,O=E%x,C=Math.min(E,E-O)+m,g=0,v=m;v<C;v+=x)g=u(p,v,v+x,d),this.imuln(A),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var j=1;for(g=u(p,v,p.length,d),v=0;v<O;v++)j*=d;this.imuln(j),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function l(D,p){D.words=p.words,D.length=p.length,D.negative=p.negative,D.red=p.red}if(s.prototype._move=function(p){l(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)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")]=f}catch{s.prototype.inspect=f}else s.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],y=[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];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var m;if(p===16||p==="hex"){m="";for(var x=0,A=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|A)&16777215).toString(16);A=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),A!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(A!==0&&(m=A.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(p===(p|0)&&p>=2&&p<=36){var g=y[p],v=b[p];m="";var j=this.clone();for(j.negative=0;!j.isZero();){var ee=j.modrn(v).toString(p);j=j.idivn(v),j.isZero()?m=ee+m:m=h[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(o,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var w=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,m){this._strip();var x=this.byteLength(),A=m||Math.max(1,x);n(x<=A,"byte array longer than desired length"),n(A>0,"Requested array length <= 0");var E=w(p,A),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,A=0,E=0;A<this.length;A++){var O=this.words[A]<<E|x;p[m++]=O&255,m<p.length&&(p[m++]=O>>8&255),m<p.length&&(p[m++]=O>>16&255),E===6?(m<p.length&&(p[m++]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m<p.length)for(p[m++]=x;m<p.length;)p[m++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var m=p.length-1,x=0,A=0,E=0;A<this.length;A++){var O=this.words[A]<<E|x;p[m--]=O&255,m>=0&&(p[m--]=O>>8&255),m>=0&&(p[m--]=O>>16&255),E===6?(m>=0&&(p[m--]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m>=0)for(p[m--]=x;m>=0;)p[m--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function T(D){for(var p=new Array(D.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[d]=D.words[m]>>>x&1}return p}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var m=this._zeroBits(this.words[d]);if(p+=m,m!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).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(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]&p.words[m];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,m;this.length>p.length?(d=this,m=p):(d=p,m=this);for(var x=0;x<m.length;x++)this.words[x]=d.words[x]^m.words[x];if(this!==d)for(;x<d.length;x++)this.words[x]=d.words[x];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,m=p%26;this._expand(d),m>0&&d--;for(var x=0;x<d;x++)this.words[x]=~this.words[x]&67108863;return m>0&&(this.words[x]=~this.words[x]&67108863>>26-m),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var m=p/26|0,x=p%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<<x:this.words[m]=this.words[m]&~(1<<x),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var m,x;this.length>p.length?(m=this,x=p):(m=p,x=this);for(var A=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+A,this.words[E]=d&67108863,A=d>>>26;for(;A!==0&&E<m.length;E++)d=(m.words[E]|0)+A,this.words[E]=d&67108863,A=d>>>26;if(this.length=m.length,A!==0)this.words[this.length]=A,this.length++;else if(m!==this)for(;E<m.length;E++)this.words[E]=m.words[E];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var m=this.cmp(p);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,A;m>0?(x=this,A=p):(x=p,A=this);for(var E=0,O=0;O<A.length;O++)d=(x.words[O]|0)-(A.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;for(;E!==0&&O<x.length;O++)d=(x.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;if(E===0&&O<x.length&&x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this.length=Math.max(this.length,O),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function P(D,p,d){d.negative=p.negative^D.negative;var m=D.length+p.length|0;d.length=m,m=m-1|0;var x=D.words[0]|0,A=p.words[0]|0,E=x*A,O=E&67108863,C=E/67108864|0;d.words[0]=O;for(var g=1;g<m;g++){for(var v=C>>>26,j=C&67108863,ee=Math.min(g,p.length-1),se=Math.max(0,g-D.length+1);se<=ee;se++){var he=g-se|0;x=D.words[he]|0,A=p.words[se]|0,E=x*A+j,v+=E/67108864|0,j=E&67108863}d.words[g]=j|0,C=v|0}return C!==0?d.words[g]=C|0:d.length--,d._strip()}var k=function(p,d,m){var x=p.words,A=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,se=j>>>13,he=x[1]|0,ye=he&8191,Ee=he>>>13,Se=x[2]|0,Ge=Se&8191,Ue=Se>>>13,dt=x[3]|0,ht=dt&8191,$e=dt>>>13,mt=x[4]|0,xe=mt&8191,ge=mt>>>13,Te=x[5]|0,We=Te&8191,De=Te>>>13,Oe=x[6]|0,Ie=Oe&8191,Fe=Oe>>>13,lt=x[7]|0,ft=lt&8191,He=lt>>>13,jt=x[8]|0,St=jt&8191,et=jt>>>13,Tt=x[9]|0,Bt=Tt&8191,nt=Tt>>>13,Et=A[0]|0,Ot=Et&8191,st=Et>>>13,kt=A[1]|0,It=kt&8191,it=kt>>>13,_t=A[2]|0,At=_t&8191,Ye=_t>>>13,gt=A[3]|0,Pt=gt&8191,ot=gt>>>13,xt=A[4]|0,Ut=xt&8191,N=xt>>>13,S=A[5]|0,M=S&8191,B=S>>>13,K=A[6]|0,Z=K&8191,re=K>>>13,Be=A[7]|0,rt=Be&8191,Re=Be>>>13,V=A[8]|0,oe=V&8191,pe=V>>>13,ke=A[9]|0,Ke=ke&8191,Ne=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,Ot),g=Math.imul(ee,st),g=g+Math.imul(se,Ot)|0,v=Math.imul(se,st);var Ve=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,C=Math.imul(ye,Ot),g=Math.imul(ye,st),g=g+Math.imul(Ee,Ot)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(se,It)|0,v=v+Math.imul(se,it)|0;var ut=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,C=Math.imul(Ge,Ot),g=Math.imul(Ge,st),g=g+Math.imul(Ue,Ot)|0,v=Math.imul(Ue,st),C=C+Math.imul(ye,It)|0,g=g+Math.imul(ye,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,At)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(se,At)|0,v=v+Math.imul(se,Ye)|0;var Jt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,C=Math.imul(ht,Ot),g=Math.imul(ht,st),g=g+Math.imul($e,Ot)|0,v=Math.imul($e,st),C=C+Math.imul(Ge,It)|0,g=g+Math.imul(Ge,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(ye,At)|0,g=g+Math.imul(ye,Ye)|0,g=g+Math.imul(Ee,At)|0,v=v+Math.imul(Ee,Ye)|0,C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,ot)|0,g=g+Math.imul(se,Pt)|0,v=v+Math.imul(se,ot)|0;var Nt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,C=Math.imul(xe,Ot),g=Math.imul(xe,st),g=g+Math.imul(ge,Ot)|0,v=Math.imul(ge,st),C=C+Math.imul(ht,It)|0,g=g+Math.imul(ht,it)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,it)|0,C=C+Math.imul(Ge,At)|0,g=g+Math.imul(Ge,Ye)|0,g=g+Math.imul(Ue,At)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(ye,Pt)|0,g=g+Math.imul(ye,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ut)|0,g=g+Math.imul(ee,N)|0,g=g+Math.imul(se,Ut)|0,v=v+Math.imul(se,N)|0;var Lt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,C=Math.imul(We,Ot),g=Math.imul(We,st),g=g+Math.imul(De,Ot)|0,v=Math.imul(De,st),C=C+Math.imul(xe,It)|0,g=g+Math.imul(xe,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,At)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,At)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(Ge,Pt)|0,g=g+Math.imul(Ge,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(ye,Ut)|0,g=g+Math.imul(ye,N)|0,g=g+Math.imul(Ee,Ut)|0,v=v+Math.imul(Ee,N)|0,C=C+Math.imul(ee,M)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(se,M)|0,v=v+Math.imul(se,B)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(Ie,Ot),g=Math.imul(Ie,st),g=g+Math.imul(Fe,Ot)|0,v=Math.imul(Fe,st),C=C+Math.imul(We,It)|0,g=g+Math.imul(We,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(xe,At)|0,g=g+Math.imul(xe,Ye)|0,g=g+Math.imul(ge,At)|0,v=v+Math.imul(ge,Ye)|0,C=C+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,ot)|0,g=g+Math.imul($e,Pt)|0,v=v+Math.imul($e,ot)|0,C=C+Math.imul(Ge,Ut)|0,g=g+Math.imul(Ge,N)|0,g=g+Math.imul(Ue,Ut)|0,v=v+Math.imul(Ue,N)|0,C=C+Math.imul(ye,M)|0,g=g+Math.imul(ye,B)|0,g=g+Math.imul(Ee,M)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(se,Z)|0,v=v+Math.imul(se,re)|0;var Er=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Er>>>26)|0,Er&=67108863,C=Math.imul(ft,Ot),g=Math.imul(ft,st),g=g+Math.imul(He,Ot)|0,v=Math.imul(He,st),C=C+Math.imul(Ie,It)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Fe,It)|0,v=v+Math.imul(Fe,it)|0,C=C+Math.imul(We,At)|0,g=g+Math.imul(We,Ye)|0,g=g+Math.imul(De,At)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(xe,Pt)|0,g=g+Math.imul(xe,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ut)|0,g=g+Math.imul(ht,N)|0,g=g+Math.imul($e,Ut)|0,v=v+Math.imul($e,N)|0,C=C+Math.imul(Ge,M)|0,g=g+Math.imul(Ge,B)|0,g=g+Math.imul(Ue,M)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(ye,Z)|0,g=g+Math.imul(ye,re)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,re)|0,C=C+Math.imul(ee,rt)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(se,rt)|0,v=v+Math.imul(se,Re)|0;var or=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(or>>>26)|0,or&=67108863,C=Math.imul(St,Ot),g=Math.imul(St,st),g=g+Math.imul(et,Ot)|0,v=Math.imul(et,st),C=C+Math.imul(ft,It)|0,g=g+Math.imul(ft,it)|0,g=g+Math.imul(He,It)|0,v=v+Math.imul(He,it)|0,C=C+Math.imul(Ie,At)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Fe,At)|0,v=v+Math.imul(Fe,Ye)|0,C=C+Math.imul(We,Pt)|0,g=g+Math.imul(We,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(xe,Ut)|0,g=g+Math.imul(xe,N)|0,g=g+Math.imul(ge,Ut)|0,v=v+Math.imul(ge,N)|0,C=C+Math.imul(ht,M)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,M)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(Ge,Z)|0,g=g+Math.imul(Ge,re)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,re)|0,C=C+Math.imul(ye,rt)|0,g=g+Math.imul(ye,Re)|0,g=g+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,Re)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,pe)|0,g=g+Math.imul(se,oe)|0,v=v+Math.imul(se,pe)|0;var Yt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,C=Math.imul(Bt,Ot),g=Math.imul(Bt,st),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,st),C=C+Math.imul(St,It)|0,g=g+Math.imul(St,it)|0,g=g+Math.imul(et,It)|0,v=v+Math.imul(et,it)|0,C=C+Math.imul(ft,At)|0,g=g+Math.imul(ft,Ye)|0,g=g+Math.imul(He,At)|0,v=v+Math.imul(He,Ye)|0,C=C+Math.imul(Ie,Pt)|0,g=g+Math.imul(Ie,ot)|0,g=g+Math.imul(Fe,Pt)|0,v=v+Math.imul(Fe,ot)|0,C=C+Math.imul(We,Ut)|0,g=g+Math.imul(We,N)|0,g=g+Math.imul(De,Ut)|0,v=v+Math.imul(De,N)|0,C=C+Math.imul(xe,M)|0,g=g+Math.imul(xe,B)|0,g=g+Math.imul(ge,M)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,re)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,re)|0,C=C+Math.imul(Ge,rt)|0,g=g+Math.imul(Ge,Re)|0,g=g+Math.imul(Ue,rt)|0,v=v+Math.imul(Ue,Re)|0,C=C+Math.imul(ye,oe)|0,g=g+Math.imul(ye,pe)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,pe)|0,C=C+Math.imul(ee,Ke)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(se,Ke)|0,v=v+Math.imul(se,Ne)|0;var br=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(br>>>26)|0,br&=67108863,C=Math.imul(Bt,It),g=Math.imul(Bt,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(St,At)|0,g=g+Math.imul(St,Ye)|0,g=g+Math.imul(et,At)|0,v=v+Math.imul(et,Ye)|0,C=C+Math.imul(ft,Pt)|0,g=g+Math.imul(ft,ot)|0,g=g+Math.imul(He,Pt)|0,v=v+Math.imul(He,ot)|0,C=C+Math.imul(Ie,Ut)|0,g=g+Math.imul(Ie,N)|0,g=g+Math.imul(Fe,Ut)|0,v=v+Math.imul(Fe,N)|0,C=C+Math.imul(We,M)|0,g=g+Math.imul(We,B)|0,g=g+Math.imul(De,M)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(xe,Z)|0,g=g+Math.imul(xe,re)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,re)|0,C=C+Math.imul(ht,rt)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,rt)|0,v=v+Math.imul($e,Re)|0,C=C+Math.imul(Ge,oe)|0,g=g+Math.imul(Ge,pe)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,pe)|0,C=C+Math.imul(ye,Ke)|0,g=g+Math.imul(ye,Ne)|0,g=g+Math.imul(Ee,Ke)|0,v=v+Math.imul(Ee,Ne)|0;var Dn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,C=Math.imul(Bt,At),g=Math.imul(Bt,Ye),g=g+Math.imul(nt,At)|0,v=Math.imul(nt,Ye),C=C+Math.imul(St,Pt)|0,g=g+Math.imul(St,ot)|0,g=g+Math.imul(et,Pt)|0,v=v+Math.imul(et,ot)|0,C=C+Math.imul(ft,Ut)|0,g=g+Math.imul(ft,N)|0,g=g+Math.imul(He,Ut)|0,v=v+Math.imul(He,N)|0,C=C+Math.imul(Ie,M)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Fe,M)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(We,Z)|0,g=g+Math.imul(We,re)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,re)|0,C=C+Math.imul(xe,rt)|0,g=g+Math.imul(xe,Re)|0,g=g+Math.imul(ge,rt)|0,v=v+Math.imul(ge,Re)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,pe)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,pe)|0,C=C+Math.imul(Ge,Ke)|0,g=g+Math.imul(Ge,Ne)|0,g=g+Math.imul(Ue,Ke)|0,v=v+Math.imul(Ue,Ne)|0;var Kr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,C=Math.imul(Bt,Pt),g=Math.imul(Bt,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(St,Ut)|0,g=g+Math.imul(St,N)|0,g=g+Math.imul(et,Ut)|0,v=v+Math.imul(et,N)|0,C=C+Math.imul(ft,M)|0,g=g+Math.imul(ft,B)|0,g=g+Math.imul(He,M)|0,v=v+Math.imul(He,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,re)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,re)|0,C=C+Math.imul(We,rt)|0,g=g+Math.imul(We,Re)|0,g=g+Math.imul(De,rt)|0,v=v+Math.imul(De,Re)|0,C=C+Math.imul(xe,oe)|0,g=g+Math.imul(xe,pe)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,pe)|0,C=C+Math.imul(ht,Ke)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,Ke)|0,v=v+Math.imul($e,Ne)|0;var $n=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,C=Math.imul(Bt,Ut),g=Math.imul(Bt,N),g=g+Math.imul(nt,Ut)|0,v=Math.imul(nt,N),C=C+Math.imul(St,M)|0,g=g+Math.imul(St,B)|0,g=g+Math.imul(et,M)|0,v=v+Math.imul(et,B)|0,C=C+Math.imul(ft,Z)|0,g=g+Math.imul(ft,re)|0,g=g+Math.imul(He,Z)|0,v=v+Math.imul(He,re)|0,C=C+Math.imul(Ie,rt)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Fe,rt)|0,v=v+Math.imul(Fe,Re)|0,C=C+Math.imul(We,oe)|0,g=g+Math.imul(We,pe)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,pe)|0,C=C+Math.imul(xe,Ke)|0,g=g+Math.imul(xe,Ne)|0,g=g+Math.imul(ge,Ke)|0,v=v+Math.imul(ge,Ne)|0;var Vi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,C=Math.imul(Bt,M),g=Math.imul(Bt,B),g=g+Math.imul(nt,M)|0,v=Math.imul(nt,B),C=C+Math.imul(St,Z)|0,g=g+Math.imul(St,re)|0,g=g+Math.imul(et,Z)|0,v=v+Math.imul(et,re)|0,C=C+Math.imul(ft,rt)|0,g=g+Math.imul(ft,Re)|0,g=g+Math.imul(He,rt)|0,v=v+Math.imul(He,Re)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,pe)|0,g=g+Math.imul(Fe,oe)|0,v=v+Math.imul(Fe,pe)|0,C=C+Math.imul(We,Ke)|0,g=g+Math.imul(We,Ne)|0,g=g+Math.imul(De,Ke)|0,v=v+Math.imul(De,Ne)|0;var zi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,C=Math.imul(Bt,Z),g=Math.imul(Bt,re),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,re),C=C+Math.imul(St,rt)|0,g=g+Math.imul(St,Re)|0,g=g+Math.imul(et,rt)|0,v=v+Math.imul(et,Re)|0,C=C+Math.imul(ft,oe)|0,g=g+Math.imul(ft,pe)|0,g=g+Math.imul(He,oe)|0,v=v+Math.imul(He,pe)|0,C=C+Math.imul(Ie,Ke)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Fe,Ke)|0,v=v+Math.imul(Fe,Ne)|0;var Bn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,C=Math.imul(Bt,rt),g=Math.imul(Bt,Re),g=g+Math.imul(nt,rt)|0,v=Math.imul(nt,Re),C=C+Math.imul(St,oe)|0,g=g+Math.imul(St,pe)|0,g=g+Math.imul(et,oe)|0,v=v+Math.imul(et,pe)|0,C=C+Math.imul(ft,Ke)|0,g=g+Math.imul(ft,Ne)|0,g=g+Math.imul(He,Ke)|0,v=v+Math.imul(He,Ne)|0;var qi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(qi>>>26)|0,qi&=67108863,C=Math.imul(Bt,oe),g=Math.imul(Bt,pe),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,pe),C=C+Math.imul(St,Ke)|0,g=g+Math.imul(St,Ne)|0,g=g+Math.imul(et,Ke)|0,v=v+Math.imul(et,Ne)|0;var Wi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,C=Math.imul(Bt,Ke),g=Math.imul(Bt,Ne),g=g+Math.imul(nt,Ke)|0,v=Math.imul(nt,Ne);var $=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+($>>>26)|0,$&=67108863,E[0]=Ve,E[1]=ut,E[2]=Jt,E[3]=Nt,E[4]=Lt,E[5]=ir,E[6]=Er,E[7]=or,E[8]=Yt,E[9]=br,E[10]=Dn,E[11]=Kr,E[12]=$n,E[13]=Vi,E[14]=zi,E[15]=Bn,E[16]=qi,E[17]=Wi,E[18]=$,O!==0&&(E[19]=O,m.length++),m};Math.imul||(k=P);function R(D,p,d){d.negative=p.negative^D.negative,d.length=D.length+p.length;for(var m=0,x=0,A=0;A<d.length-1;A++){var E=x;x=0;for(var O=m&67108863,C=Math.min(A,p.length-1),g=Math.max(0,A-D.length+1);g<=C;g++){var v=A-g,j=D.words[v]|0,ee=p.words[g]|0,se=j*ee,he=se&67108863;E=E+(se/67108864|0)|0,he=he+O|0,O=he&67108863,E=E+(he>>>26)|0,x+=E>>>26,E&=67108863}d.words[A]=O,m=E,E=x}return m!==0?d.words[A]=m:d.length--,d._strip()}function F(D,p,d){return R(D,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=k(this,p,d):x<63?m=P(this,p,d):x<1024?m=R(this,p,d):m=F(this,p,d),m},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),F(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var m=0,x=0;x<this.length;x++){var A=(this.words[x]|0)*p,E=(A&67108863)+(m&67108863);m>>=26,m+=A/67108864|0,m+=E>>>26,this.words[x]=E&67108863}return m!==0&&(this.words[x]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=T(p);if(d.length===0)return new s(1);for(var m=this,x=0;x<d.length&&d[x]===0;x++,m=m.sqr());if(++x<d.length)for(var A=m.sqr();x<d.length;x++,A=A.sqr())d[x]!==0&&(m=m.mul(A));return m},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=67108863>>>26-d<<26-d,A;if(d!==0){var E=0;for(A=0;A<this.length;A++){var O=this.words[A]&x,C=(this.words[A]|0)-O<<d;this.words[A]=C|E,E=O>>>26-d}E&&(this.words[A]=E,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()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,m){n(typeof p=="number"&&p>=0);var x;d?x=(d-d%26)/26:x=0;var A=p%26,E=Math.min((p-A)/26,this.length),O=67108863^67108863>>>A<<A,C=m;if(x-=E,x=Math.max(0,x),C){for(var g=0;g<E;g++)C.words[g]=this.words[g];C.length=E}if(E!==0)if(this.length>E)for(this.length-=E,g=0;g<this.length;g++)this.words[g]=this.words[g+E];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=x);g--){var j=this.words[g]|0;this.words[g]=v<<26-A|j>>>A,v=j&O}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,m){return n(this.negative===0),this.iushrn(p,d,m)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return!1;var A=this.words[m];return!!(A&x)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var x=67108863^67108863>>>d<<d;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,m){var x=p.length+m,A;this._expand(x);var E,O=0;for(A=0;A<p.length;A++){E=(this.words[A+m]|0)+O;var C=(p.words[A]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[A+m]=E&67108863}for(;A<this.length-m;A++)E=(this.words[A+m]|0)+O,O=E>>26,this.words[A+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,A=0;A<this.length;A++)E=-(this.words[A]|0)+O,O=E>>26,this.words[A]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),A=p,E=A.words[A.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(A=A.ushln(m),x.iushln(m),E=A.words[A.length-1]|0);var C=x.length-A.length,g;if(d!=="mod"){g=new s(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var j=x.clone()._ishlnsubmul(A,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var se=(x.words[A.length+ee]|0)*67108864+(x.words[A.length+ee-1]|0);for(se=Math.min(se/E|0,67108863),x._ishlnsubmul(A,se,ee);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(A,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=se)}return g&&g._strip(),x._strip(),d!=="div"&&m!==0&&x.iushrn(m),{div:g||null,mod:x}},s.prototype.divmod=function(p,d,m){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,A,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(A=E.mod.neg(),m&&A.negative!==0&&A.iadd(p)),{div:x,mod:A}):this.negative===0&&p.negative!==0?(E=this.divmod(p.neg(),d),d!=="mod"&&(x=E.div.neg()),{div:x,mod:E.mod}):this.negative&p.negative?(E=this.neg().divmod(p.neg(),d),d!=="div"&&(A=E.mod.neg(),m&&A.negative!==0&&A.isub(p)),{div:E.div,mod:A}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(p):d.mod,x=p.ushrn(1),A=p.andln(1),E=m.cmp(x);return E<0||A===1&&E===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=(1<<26)%p,x=0,A=this.length-1;A>=0;A--)x=(m*x+(this.words[A]|0))%p;return d?-x:x},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=0,x=this.length-1;x>=0;x--){var A=(this.words[x]|0)+m*67108864;this.words[x]=A/p|0,m=A%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),A=new s(0),E=new s(0),O=new s(1),C=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=d.clone();!d.isZero();){for(var j=0,ee=1;!(d.words[0]&ee)&&j<26;++j,ee<<=1);if(j>0)for(d.iushrn(j);j-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(g),A.isub(v)),x.iushrn(1),A.iushrn(1);for(var se=0,he=1;!(m.words[0]&he)&&se<26;++se,he<<=1);if(se>0)for(m.iushrn(se);se-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(g),O.isub(v)),E.iushrn(1),O.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E),A.isub(O)):(m.isub(d),E.isub(x),O.isub(A))}return{a:E,b:O,gcd:m.iushln(C)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),A=new s(0),E=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var O=0,C=1;!(d.words[0]&C)&&O<26;++O,C<<=1);if(O>0)for(d.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(E),x.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(E),A.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(A)):(m.isub(d),A.isub(x))}var j;return d.cmpn(1)===0?j=x:j=A,j.cmpn(0)<0&&j.iadd(p),j},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),m=p.clone();d.negative=0,m.negative=0;for(var x=0;d.isEven()&&m.isEven();x++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var A=d.cmp(m);if(A<0){var E=d;d=m,m=E}else if(A===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(x)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return this._expand(m+1),this.words[m]|=x,this;for(var A=x,E=m;A!==0&&E<this.length;E++){var O=this.words[E]|0;O+=A,A=O>>>26,O&=67108863,this.words[E]=O}return A!==0&&(this.words[E]=A,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var x=this.words[0]|0;m=x===p?0:x<p?-1:1}return this.negative!==0?-m|0:m},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,m=this.length-1;m>=0;m--){var x=this.words[m]|0,A=p.words[m]|0;if(x!==A){x<A?d=-1:x>A&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new ce(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var L={k256:null,p224:null,p192:null,p25519:null};function G(D,p){this.name=D,this.p=new s(p,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},G.prototype.ireduce=function(p){var d=p,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var x=m<this.n?-1:d.ucmp(this.p);return x===0?(d.words[0]=0,d.length=1):x>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},G.prototype.split=function(p,d){p.iushrn(this.n,0,d)},G.prototype.imulK=function(p){return p.imul(this.k)};function q(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,G),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),A=0;A<x;A++)d.words[A]=p.words[A];if(d.length=x,p.length<=9){p.words[0]=0,p.length=1;return}var E=p.words[9];for(d.words[d.length++]=E&m,A=10;A<p.length;A++){var O=p.words[A]|0;p.words[A-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[A-10]=E,E===0&&p.length>10?p.length-=10:p.length-=9},q.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,m=0;m<p.length;m++){var x=p.words[m]|0;d+=x*977,p.words[m]=d&67108863,d=x*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function X(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(X,G);function ie(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ie,G);function ae(){G.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ae,G),ae.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,A=x&67108863;x>>>=26,p.words[m]=A,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(L[p])return L[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new X;else if(p==="p192")d=new ie;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce(D){if(typeof D=="string"){var p=s._prime(D);this.m=p.p,this.prime=p}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}ce.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},ce.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},ce.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},ce.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},ce.prototype.add=function(p,d){this._verify2(p,d);var m=p.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ce.prototype.iadd=function(p,d){this._verify2(p,d);var m=p.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},ce.prototype.sub=function(p,d){this._verify2(p,d);var m=p.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ce.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},ce.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},ce.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},ce.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},ce.prototype.isqr=function(p){return this.imul(p,p.clone())},ce.prototype.sqr=function(p){return this.mul(p,p)},ce.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(p,m)}for(var x=this.m.subn(1),A=0;!x.isZero()&&x.andln(1)===0;)A++,x.iushrn(1);n(!x.isZero());var E=new s(1).toRed(this),O=E.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,C).cmp(O)!==0;)g.redIAdd(O);for(var v=this.pow(g,x),j=this.pow(p,x.addn(1).iushrn(1)),ee=this.pow(p,x),se=A;ee.cmp(E)!==0;){for(var he=ee,ye=0;he.cmp(E)!==0;ye++)he=he.redSqr();n(ye<se);var Ee=this.pow(v,new s(1).iushln(se-ye-1));j=j.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),se=ye}return j},ce.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},ce.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var m=4,x=new Array(1<<m);x[0]=new s(1).toRed(this),x[1]=p;for(var A=2;A<x.length;A++)x[A]=this.mul(x[A-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),A=d.length-1;A>=0;A--){for(var v=d.words[A],j=g-1;j>=0;j--){var ee=v>>j&1;if(E!==x[0]&&(E=this.sqr(E)),ee===0&&O===0){C=0;continue}O<<=1,O|=ee,C++,!(C!==m&&(A!==0||j!==0))&&(E=this.mul(E,x[O]),C=0,O=0)}g=26}return E},ce.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},ce.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new z(p)};function z(D){ce.call(this,D),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)}i(z,ce),z.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},z.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},z.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var m=p.imul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},z.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var m=p.mul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},z.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,Nr)}(yh);var x2=yh.exports;const S2=ga(x2);var N7=Nr&&Nr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(an,"__esModule",{value:!0}),an.parseAccumulatorUpdateData=an.sliceAccumulatorUpdateData=an.parseTwapMessage=an.parsePriceFeedMessage=an.isAccumulatorUpdateData=void 0;const cn=N7(x2),R7="504e4155",D7=1,$7=0,bh=20,B7=0,L7=1;function wh(e){return e.toString("hex").slice(0,8)===R7&&e[4]===D7&&e[5]===$7}an.isAccumulatorUpdateData=wh;function F7(e){let t=0;if(e.readUInt8(t)!==B7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new cn.default(e.subarray(t,t+8),"be");t+=8;const s=new cn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new cn.default(e.subarray(t,t+8),"be");t+=8;const c=new cn.default(e.subarray(t,t+8),"be");t+=8;const u=new cn.default(e.subarray(t,t+8),"be");t+=8;const l=new cn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:s,exponent:o,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}an.parsePriceFeedMessage=F7;function U7(e){let t=0;if(e.readUInt8(t)!==L7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new cn.default(e.subarray(t,t+16),"be");t+=16;const s=new cn.default(e.subarray(t,t+16),"be");t+=16;const o=new cn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new cn.default(e.subarray(t,t+8),"be");t+=8;const u=new cn.default(e.subarray(t,t+8),"be");t+=8;const l=new cn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:s,numDownSlots:o,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}an.parseTwapMessage=U7;function V7(e,t,r){if(!wh(e))throw new Error("Invalid accumulator message");let n=6;const i=e.readUint8(n);n+=1+i,n+=1;const s=e.readUint16BE(n);n+=2,n+=s;const o=n,a=[],c=e.readUInt8(n);n+=1;for(let l=0;l<c;l++){const f=n,h=e.readUint16BE(n);n+=2,n+=h;const y=e.readUInt8(n);n+=1,n+=bh*y,a.push(e.subarray(f,n))}if(n!==e.length)throw new Error("Didn't reach the end of the message");const u=a.slice(t,r);return vh.concat([e.subarray(0,o),vh.from([u.length]),...a.slice(t,r)])}an.sliceAccumulatorUpdateData=V7;function z7(e){if(!wh(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 s=e.readUInt8(t),o=[];t+=1;for(let a=0;a<s;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 f=[];for(let h=0;h<l;h++)f.push(Array.from(e.subarray(t,t+bh))),t+=bh;o.push({message:u,proof:f})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:o}}an.parseAccumulatorUpdateData=z7,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=yu;var r=an;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 s=class V3{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 V3({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=s}(dh);function E2(e,t){return function(){return e.apply(t,arguments)}}const{toString:q7}=Object.prototype,{getPrototypeOf:_h}=Object,wu=(e=>t=>{const r=q7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),An=e=>(e=e.toLowerCase(),t=>wu(t)===e),_u=e=>t=>typeof t===e,{isArray:Oo}=Array,Za=_u("undefined");function W7(e){return e!==null&&!Za(e)&&e.constructor!==null&&!Za(e.constructor)&&Yr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const C2=An("ArrayBuffer");function G7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&C2(e.buffer),t}const H7=_u("string"),Yr=_u("function"),A2=_u("number"),xu=e=>e!==null&&typeof e=="object",K7=e=>e===!0||e===!1,Su=e=>{if(wu(e)!=="object")return!1;const t=_h(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},X7=An("Date"),J7=An("File"),Y7=An("Blob"),Z7=An("FileList"),Q7=e=>xu(e)&&Yr(e.pipe),ej=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Yr(e.append)&&((t=wu(e))==="formdata"||t==="object"&&Yr(e.toString)&&e.toString()==="[object FormData]"))},tj=An("URLSearchParams"),[rj,nj,ij,sj]=["ReadableStream","Request","Response","Headers"].map(An),oj=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Oo(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(n=0;n<o;n++)a=s[n],t.call(null,e[a],a,e)}}function M2(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 Vs=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Nr)(),T2=e=>!Za(e)&&e!==Vs;function xh(){const{caseless:e}=T2(this)&&this||{},t={},r=(n,i)=>{const s=e&&M2(t,i)||i;Su(t[s])&&Su(n)?t[s]=xh(t[s],n):Su(n)?t[s]=xh({},n):Oo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Qa(arguments[n],r);return t}const aj=(e,t,r,{allOwnKeys:n}={})=>(Qa(t,(i,s)=>{r&&Yr(i)?e[s]=E2(i,r):e[s]=i},{allOwnKeys:n}),e),cj=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),uj=(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)},lj=(e,t,r,n)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&_h(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},fj=(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},dj=e=>{if(!e)return null;if(Oo(e))return e;let t=e.length;if(!A2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},hj=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_h(Uint8Array)),pj=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},mj=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},gj=An("HTMLFormElement"),vj=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),O2=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),yj=An("RegExp"),I2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Qa(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},bj=e=>{I2(e,(t,r)=>{if(Yr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Yr(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+"'")})}})},wj=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Oo(e)?n(e):n(String(e).split(t)),r},_j=()=>{},xj=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Sh="abcdefghijklmnopqrstuvwxyz",P2="0123456789",j2={DIGIT:P2,ALPHA:Sh,ALPHA_DIGIT:Sh+Sh.toUpperCase()+P2},Sj=(e=16,t=j2.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Ej(e){return!!(e&&Yr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Cj=e=>{const t=new Array(10),r=(n,i)=>{if(xu(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Oo(n)?[]:{};return Qa(n,(o,a)=>{const c=r(o,i+1);!Za(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},Aj=An("AsyncFunction"),Mj=e=>e&&(xu(e)||Yr(e))&&Yr(e.then)&&Yr(e.catch),k2=((e,t)=>e?setImmediate:t?((r,n)=>(Vs.addEventListener("message",({source:i,data:s})=>{i===Vs&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Yr(Vs.postMessage)),Tj=typeof queueMicrotask<"u"?queueMicrotask.bind(Vs):typeof gn<"u"&&gn.nextTick||k2;var fe={isArray:Oo,isArrayBuffer:C2,isBuffer:W7,isFormData:ej,isArrayBufferView:G7,isString:H7,isNumber:A2,isBoolean:K7,isObject:xu,isPlainObject:Su,isReadableStream:rj,isRequest:nj,isResponse:ij,isHeaders:sj,isUndefined:Za,isDate:X7,isFile:J7,isBlob:Y7,isRegExp:yj,isFunction:Yr,isStream:Q7,isURLSearchParams:tj,isTypedArray:hj,isFileList:Z7,forEach:Qa,merge:xh,extend:aj,trim:oj,stripBOM:cj,inherits:uj,toFlatObject:lj,kindOf:wu,kindOfTest:An,endsWith:fj,toArray:dj,forEachEntry:pj,matchAll:mj,isHTMLForm:gj,hasOwnProperty:O2,hasOwnProp:O2,reduceDescriptors:I2,freezeMethods:bj,toObjectSet:wj,toCamelCase:vj,noop:_j,toFiniteNumber:xj,findKey:M2,global:Vs,isContextDefined:T2,ALPHABET:j2,generateString:Sj,isSpecCompliantForm:Ej,toJSONObject:Cj,isAsyncFn:Aj,isThenable:Mj,setImmediate:k2,asap:Tj};function pt(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)}fe.inherits(pt,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:fe.toJSONObject(this.config),code:this.code,status:this.status}}});const N2=pt.prototype,R2={};["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=>{R2[e]={value:e}}),Object.defineProperties(pt,R2),Object.defineProperty(N2,"isAxiosError",{value:!0}),pt.from=(e,t,r,n,i,s)=>{const o=Object.create(N2);return fe.toFlatObject(e,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),pt.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};var Oj=null;function Eh(e){return fe.isPlainObject(e)||fe.isArray(e)}function D2(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function $2(e,t,r){return e?e.concat(t).map(function(i,s){return i=D2(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function Ij(e){return fe.isArray(e)&&!e.some(Eh)}const Pj=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function Eu(e,t,r){if(!fe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=fe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,T){return!fe.isUndefined(T[w])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(t);if(!fe.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(!c&&fe.isBlob(b))throw new pt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):vh.from(b):b}function l(b,w,T){let P=b;if(b&&!T&&typeof b=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&Ij(b)||(fe.isFileList(b)||fe.endsWith(w,"[]"))&&(P=fe.toArray(b)))return w=D2(w),P.forEach(function(R,F){!(fe.isUndefined(R)||R===null)&&t.append(o===!0?$2([w],F,s):o===null?w:w+"[]",u(R))}),!1}return Eh(b)?!0:(t.append($2(T,w,s),u(b)),!1)}const f=[],h=Object.assign(Pj,{defaultVisitor:l,convertValue:u,isVisitable:Eh});function y(b,w){if(!fe.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(b),fe.forEach(b,function(P,k){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(k)?k.trim():k,w,h))===!0&&y(P,w?w.concat(k):[k])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function B2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Ch(e,t){this._pairs=[],e&&Eu(e,this,t)}const L2=Ch.prototype;L2.append=function(t,r){this._pairs.push([t,r])},L2.toString=function(t){const r=t?function(n){return t.call(this,n,B2)}:B2;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function jj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function F2(e,t,r){if(!t)return e;const n=r&&r.encode||jj;fe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(t,r):s=fe.isURLSearchParams(t)?t.toString():new Ch(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class kj{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){fe.forEach(this.handlers,function(n){n!==null&&t(n)})}}var U2=kj,V2={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Nj=typeof URLSearchParams<"u"?URLSearchParams:Ch,Rj=typeof FormData<"u"?FormData:null,Dj=typeof Blob<"u"?Blob:null,$j={isBrowser:!0,classes:{URLSearchParams:Nj,FormData:Rj,Blob:Dj},protocols:["http","https","file","blob","url","data"]};const Ah=typeof window<"u"&&typeof document<"u",Mh=typeof navigator=="object"&&navigator||void 0,Bj=Ah&&(!Mh||["ReactNative","NativeScript","NS"].indexOf(Mh.product)<0),Lj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Fj=Ah&&window.location.href||"http://localhost";var Uj=Object.freeze({__proto__:null,hasBrowserEnv:Ah,hasStandardBrowserWebWorkerEnv:Lj,hasStandardBrowserEnv:Bj,navigator:Mh,origin:Fj}),Tr={...Uj,...$j};function Vj(e,t){return Eu(e,new Tr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Tr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function zj(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qj(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}function z2(e){function t(r,n,i,s){let o=r[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=r.length;return o=!o&&fe.isArray(i)?i.length:o,c?(fe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!fe.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],s)&&fe.isArray(i[o])&&(i[o]=qj(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(zj(n),i,r,0)}),r}return null}function Wj(e,t,r){if(fe.isString(e))try{return(t||JSON.parse)(e),fe.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Th={transitional:V2,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=fe.isObject(t);if(s&&fe.isHTMLForm(t)&&(t=new FormData(t)),fe.isFormData(t))return i?JSON.stringify(z2(t)):t;if(fe.isArrayBuffer(t)||fe.isBuffer(t)||fe.isStream(t)||fe.isFile(t)||fe.isBlob(t)||fe.isReadableStream(t))return t;if(fe.isArrayBufferView(t))return t.buffer;if(fe.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vj(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Eu(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Wj(t)):t}],transformResponse:[function(t){const r=this.transitional||Th.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(fe.isResponse(t)||fe.isReadableStream(t))return t;if(t&&fe.isString(t)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?pt.from(a,pt.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:Tr.classes.FormData,Blob:Tr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],e=>{Th.headers[e]={}});var Oh=Th;const Gj=fe.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 Hj=e=>{const t={};let r,n,i;return e&&e.split(`
34
- `).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&Gj[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const q2=Symbol("internals");function ec(e){return e&&String(e).trim().toLowerCase()}function Cu(e){return e===!1||e==null?e:fe.isArray(e)?e.map(Cu):String(e)}function Kj(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 Xj=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ih(e,t,r,n,i){if(fe.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!fe.isString(t)){if(fe.isString(n))return t.indexOf(n)!==-1;if(fe.isRegExp(n))return n.test(t)}}function Jj(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Yj(e,t){const r=fe.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,s,o){return this[n].call(this,t,i,s,o)},configurable:!0})})}class Au{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=ec(c);if(!l)throw new Error("header name must be a non-empty string");const f=fe.findKey(i,l);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=Cu(a))}const o=(a,c)=>fe.forEach(a,(u,l)=>s(u,l,c));if(fe.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(fe.isString(t)&&(t=t.trim())&&!Xj(t))o(Hj(t),r);else if(fe.isHeaders(t))for(const[a,c]of t.entries())s(c,a,n);else t!=null&&s(r,t,n);return this}get(t,r){if(t=ec(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return Kj(i);if(fe.isFunction(r))return r.call(this,i,n);if(fe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ec(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ih(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=ec(o),o){const a=fe.findKey(n,o);a&&(!r||Ih(n,n[a],a,r))&&(delete n[a],i=!0)}}return fe.isArray(t)?t.forEach(s):s(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!t||Ih(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const r=this,n={};return fe.forEach(this,(i,s)=>{const o=fe.findKey(n,s);if(o){r[o]=Cu(i),delete r[s];return}const a=t?Jj(s):String(s).trim();a!==s&&delete r[s],r[a]=Cu(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return fe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&fe.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(`
35
- `)}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[q2]=this[q2]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=ec(o);n[a]||(Yj(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}Au.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Au.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),fe.freezeMethods(Au);var Mn=Au;function Ph(e,t){const r=this||Oh,n=t||r,i=Mn.from(n.headers);let s=n.data;return fe.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function W2(e){return!!(e&&e.__CANCEL__)}function Io(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Io,pt,{__CANCEL__:!0});function G2(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new pt("Request failed with status code "+r.status,[pt.ERR_BAD_REQUEST,pt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Zj(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Qj(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[s];o||(o=u),r[i]=c,n[i]=u;let f=s,h=0;for(;f!==i;)h+=r[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const y=l&&u-l;return y?Math.round(h*1e3/y):void 0}}function ek(e,t){let r=0,n=1e3/t,i,s;const o=(u,l=Date.now())=>{r=l,i=null,s&&(clearTimeout(s),s=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),f=l-r;f>=n?o(u,l):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-f)))},()=>i&&o(i)]}const Mu=(e,t,r=3)=>{let n=0;const i=Qj(50,250);return ek(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=o-n,u=i(c),l=o<=a;n=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},H2=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},K2=e=>(...t)=>fe.asap(()=>e(...t));var tk=Tr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Tr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Tr.origin),Tr.navigator&&/(msie|trident)/i.test(Tr.navigator.userAgent)):()=>!0,rk=Tr.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];fe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),fe.isString(n)&&o.push("path="+n),fe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.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 nk(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ik(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function X2(e,t){return e&&!nk(t)?ik(e,t):t}const J2=e=>e instanceof Mn?{...e}:e;function zs(e,t){t=t||{};const r={};function n(u,l,f,h){return fe.isPlainObject(u)&&fe.isPlainObject(l)?fe.merge.call({caseless:h},u,l):fe.isPlainObject(l)?fe.merge({},l):fe.isArray(l)?l.slice():l}function i(u,l,f,h){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function s(u,l){if(!fe.isUndefined(l))return n(void 0,l)}function o(u,l){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,l,f)=>i(J2(u),J2(l),f,!0)};return fe.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=c[l]||i,h=f(e[l],t[l],l);fe.isUndefined(h)&&f!==a||(r[l]=h)}),r}var Y2=e=>{const t=zs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Mn.from(o),t.url=F2(X2(t.baseURL,t.url),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(fe.isFormData(r)){if(Tr.hasStandardBrowserEnv||Tr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...l]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Tr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&tk(t.url))){const u=i&&s&&rk.read(s);u&&o.set(i,u)}return t},sk=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=Y2(e);let s=i.data;const o=Mn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,b;function w(){y&&y(),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 P(){if(!T)return;const R=Mn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:R,config:e,request:T};G2(function(q){r(q),w()},function(q){n(q),w()},L),T=null}"onloadend"in T?T.onloadend=P:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(P)},T.onabort=function(){T&&(n(new pt("Request aborted",pt.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new pt("Network Error",pt.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||V2;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new pt(F,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,T)),T=null},s===void 0&&o.setContentType(null),"setRequestHeader"in T&&fe.forEach(o.toJSON(),function(F,L){T.setRequestHeader(L,F)}),fe.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([h,b]=Mu(u,!0),T.addEventListener("progress",h)),c&&T.upload&&([f,y]=Mu(c),T.upload.addEventListener("progress",f),T.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=R=>{T&&(n(!R||R.type?new Io(null,e,T):R),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const k=Zj(i.url);if(k&&Tr.protocols.indexOf(k)===-1){n(new pt("Unsupported protocol "+k+":",pt.ERR_BAD_REQUEST,e));return}T.send(s||null)})},ok=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const s=function(u){if(!i){i=!0,a();const l=u instanceof Error?u:this.reason;n.abort(l instanceof pt?l:new Io(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new pt(`timeout ${t} of ms exceeded`,pt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>fe.asap(a),c}};const ak=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},ck=async function*(e,t){for await(const r of uk(e))yield*ak(r,t)},uk=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()}},Z2=(e,t,r,n)=>{const i=ck(e,t);let s=0,o,a=c=>{o||(o=!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 f=l.byteLength;if(r){let h=s+=f;r(h)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Tu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Q2=Tu&&typeof ReadableStream=="function",lk=Tu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),e_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fk=Q2&&e_(()=>{let e=!1;const t=new Request(Tr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),t_=64*1024,jh=Q2&&e_(()=>fe.isReadableStream(new Response("").body)),Ou={stream:jh&&(e=>e.body)};Tu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ou[t]&&(Ou[t]=fe.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new pt(`Response type '${t}' is not supported`,pt.ERR_NOT_SUPPORT,n)})})})(new Response);const dk=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Tr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(e)||fe.isArrayBuffer(e))return e.byteLength;if(fe.isURLSearchParams(e)&&(e=e+""),fe.isString(e))return(await lk(e)).byteLength},hk=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??dk(t)};var pk=Tu&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:h}=Y2(e);u=u?(u+"").toLowerCase():"text";let y=ok([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let T;try{if(c&&fk&&r!=="get"&&r!=="head"&&(T=await hk(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),G;if(fe.isFormData(n)&&(G=L.headers.get("content-type"))&&l.setContentType(G),L.body){const[q,X]=H2(T,Mu(K2(c)));n=Z2(L.body,t_,q,X)}}fe.isString(f)||(f=f?"include":"omit");const P="credentials"in Request.prototype;b=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:P?f:void 0});let k=await fetch(b);const R=jh&&(u==="stream"||u==="response");if(jh&&(a||R&&w)){const L={};["status","statusText","headers"].forEach(ie=>{L[ie]=k[ie]});const G=fe.toFiniteNumber(k.headers.get("content-length")),[q,X]=a&&H2(G,Mu(K2(a),!0))||[];k=new Response(Z2(k.body,t_,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let F=await Ou[fe.findKey(Ou,u)||"text"](k,e);return!R&&w&&w(),await new Promise((L,G)=>{G2(L,G,{data:F,headers:Mn.from(k.headers),status:k.status,statusText:k.statusText,config:e,request:b})})}catch(P){throw w&&w(),P&&P.name==="TypeError"&&/fetch/i.test(P.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,b),{cause:P.cause||P}):pt.from(P,P&&P.code,e,b)}});const kh={http:Oj,xhr:sk,fetch:pk};fe.forEach(kh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const r_=e=>`- ${e}`,mk=e=>fe.isFunction(e)||e===null||e===!1;var n_={getAdapter:e=>{e=fe.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let s=0;s<t;s++){r=e[s];let o;if(n=r,!mk(r)&&(n=kh[(o=String(r)).toLowerCase()],n===void 0))throw new pt(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
36
- `+s.map(r_).join(`
37
- `):" "+r_(s[0]):"as no adapter specified";throw new pt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:kh};function Nh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Io(null,e)}function i_(e){return Nh(e),e.headers=Mn.from(e.headers),e.data=Ph.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),n_.getAdapter(e.adapter||Oh.adapter)(e).then(function(n){return Nh(e),n.data=Ph.call(e,e.transformResponse,n),n.headers=Mn.from(n.headers),n},function(n){return W2(n)||(Nh(e),n&&n.response&&(n.response.data=Ph.call(e,e.transformResponse,n.response),n.response.headers=Mn.from(n.response.headers))),Promise.reject(n)})}const s_="1.7.9",Iu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Iu[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const o_={};Iu.transitional=function(t,r,n){function i(s,o){return"[Axios v"+s_+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(t===!1)throw new pt(i(o," has been removed"+(r?" in "+r:"")),pt.ERR_DEPRECATED);return r&&!o_[o]&&(o_[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,o,a):!0}},Iu.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function gk(e,t,r){if(typeof e!="object")throw new pt("options must be an object",pt.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const a=e[s],c=a===void 0||o(a,s,e);if(c!==!0)throw new pt("option "+s+" must be "+c,pt.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new pt("Unknown option "+s,pt.ERR_BAD_OPTION)}}var Pu={assertOptions:gk,validators:Iu};const ei=Pu.validators;class ju{constructor(t){this.defaults=t,this.interceptors={request:new U2,response:new U2}}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 s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
38
- `+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=zs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&Pu.assertOptions(n,{silentJSONParsing:ei.transitional(ei.boolean),forcedJSONParsing:ei.transitional(ei.boolean),clarifyTimeoutError:ei.transitional(ei.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:Pu.assertOptions(i,{encode:ei.function,serialize:ei.function},!0)),Pu.assertOptions(r,{baseUrl:ei.spelling("baseURL"),withXsrfToken:ei.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=Mn.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(c=c&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,f=0,h;if(!c){const b=[i_.bind(this),void 0];for(b.unshift.apply(b,a),b.push.apply(b,u),h=b.length,l=Promise.resolve(r);f<h;)l=l.then(b[f++],b[f++]);return l}h=a.length;let y=r;for(f=0;f<h;){const b=a[f++],w=a[f++];try{y=b(y)}catch(T){w.call(this,T);break}}try{l=i_.call(this,y)}catch(b){return Promise.reject(b)}for(f=0,h=u.length;f<h;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=zs(this.defaults,t);const r=X2(t.baseURL,t.url);return F2(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){ju.prototype[t]=function(r,n){return this.request(zs(n||{},{method:t,url:r,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(zs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ju.prototype[t]=r(),ju.prototype[t+"Form"]=r(!0)});var ku=ju;class Rh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},t(function(s,o,a){n.reason||(n.reason=new Io(s,o,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 Rh(function(i){t=i}),cancel:t}}}var vk=Rh;function yk(e){return function(r){return e.apply(null,r)}}function bk(e){return fe.isObject(e)&&e.isAxiosError===!0}const Dh={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(Dh).forEach(([e,t])=>{Dh[t]=e});var wk=Dh;function a_(e){const t=new ku(e),r=E2(ku.prototype.request,t);return fe.extend(r,ku.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return a_(zs(e,i))},r}const ur=a_(Oh);ur.Axios=ku,ur.CanceledError=Io,ur.CancelToken=vk,ur.isCancel=W2,ur.VERSION=s_,ur.toFormData=Eu,ur.AxiosError=pt,ur.Cancel=ur.CanceledError,ur.all=function(t){return Promise.all(t)},ur.spread=yk,ur.isAxiosError=bk,ur.mergeConfig=zs,ur.AxiosHeaders=Mn,ur.formToJSON=e=>z2(fe.isHTMLForm(e)?new FormData(e):e),ur.getAdapter=n_.getAdapter,ur.HttpStatusCode=wk,ur.default=ur;var c_=ur,$h={exports:{}},Zr={},u_={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})(u_);var _k=u_.exports,Bh={exports:{}},Lh={exports:{}},l_;function Nu(){return l_||(l_=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}(Lh)),Lh.exports}var f_;function xk(){return f_||(f_=1,function(e){var t=Nu().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},s=Object.prototype,o=s.hasOwnProperty,a=Object.defineProperty||function(E,O,C){E[O]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,C){return Object.defineProperty(E,O,{value:C,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(C,g,v){return C[g]=v}}function y(E,O,C,g){var v=O&&O.prototype instanceof F?O:F,j=Object.create(v.prototype),ee=new x(g||[]);return a(j,"_invoke",{value:D(E,C,ee)}),j}function b(E,O,C){try{return{type:"normal",arg:E.call(O,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var w="suspendedStart",T="suspendedYield",P="executing",k="completed",R={};function F(){}function L(){}function G(){}var q={};h(q,u,function(){return this});var X=Object.getPrototypeOf,ie=X&&X(X(A([])));ie&&ie!==s&&o.call(ie,u)&&(q=ie);var ae=G.prototype=F.prototype=Object.create(q);function ce(E){["next","throw","return"].forEach(function(O){h(E,O,function(C){return this._invoke(O,C)})})}function z(E,O){function C(v,j,ee,se){var he=b(E[v],E,j);if(he.type!=="throw"){var ye=he.arg,Ee=ye.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,se)},function(Se){C("throw",Se,ee,se)}):O.resolve(Ee).then(function(Se){ye.value=Se,ee(ye)},function(Se){return C("throw",Se,ee,se)})}se(he.arg)}var g;a(this,"_invoke",{value:function(j,ee){function se(){return new O(function(he,ye){C(j,ee,he,ye)})}return g=g?g.then(se,se):se()}})}function D(E,O,C){var g=w;return function(v,j){if(g===P)throw Error("Generator is already running");if(g===k){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var se=p(ee,C);if(se){if(se===R)continue;return se}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=k,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var he=b(E,O,C);if(he.type==="normal"){if(g=C.done?k:T,he.arg===R)continue;return{value:he.arg,done:C.done}}he.type==="throw"&&(g=k,C.method="throw",C.arg=he.arg)}}}function p(E,O){var C=O.method,g=E.iterator[C];if(g===n)return O.delegate=null,C==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||C!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+C+"' method")),R;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,R;var j=v.arg;return j?j.done?(O[E.resultName]=j.value,O.next=E.nextLoc,O.method!=="return"&&(O.method="next",O.arg=n),O.delegate=null,R):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,R)}function d(E){var O={tryLoc:E[0]};1 in E&&(O.catchLoc=E[1]),2 in E&&(O.finallyLoc=E[2],O.afterLoc=E[3]),this.tryEntries.push(O)}function m(E){var O=E.completion||{};O.type="normal",delete O.arg,E.completion=O}function x(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(d,this),this.reset(!0)}function A(E){if(E||E===""){var O=E[u];if(O)return O.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var C=-1,g=function v(){for(;++C<E.length;)if(o.call(E,C))return v.value=E[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(E)+" is not iterable")}return L.prototype=G,a(ae,"constructor",{value:G,configurable:!0}),a(G,"constructor",{value:L,configurable:!0}),L.displayName=h(G,f,"GeneratorFunction"),i.isGeneratorFunction=function(E){var O=typeof E=="function"&&E.constructor;return!!O&&(O===L||(O.displayName||O.name)==="GeneratorFunction")},i.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,G):(E.__proto__=G,h(E,f,"GeneratorFunction")),E.prototype=Object.create(ae),E},i.awrap=function(E){return{__await:E}},ce(z.prototype),h(z.prototype,l,function(){return this}),i.AsyncIterator=z,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new z(y(E,O,C,g),v);return i.isGeneratorFunction(O)?j:j.next().then(function(ee){return ee.done?ee.value:j.next()})},ce(ae),h(ae,f,"Generator"),h(ae,u,function(){return this}),h(ae,"toString",function(){return"[object Generator]"}),i.keys=function(E){var O=Object(E),C=[];for(var g in O)C.push(g);return C.reverse(),function v(){for(;C.length;){var j=C.pop();if(j in O)return v.value=j,v.done=!1,v}return v.done=!0,v}},i.values=A,x.prototype={constructor:x,reset:function(O){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),!O)for(var C in this)C.charAt(0)==="t"&&o.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var O=this.tryEntries[0].completion;if(O.type==="throw")throw O.arg;return this.rval},dispatchException:function(O){if(this.done)throw O;var C=this;function g(ye,Ee){return ee.type="throw",ee.arg=O,C.next=ye,Ee&&(C.method="next",C.arg=n),!!Ee}for(var v=this.tryEntries.length-1;v>=0;--v){var j=this.tryEntries[v],ee=j.completion;if(j.tryLoc==="root")return g("end");if(j.tryLoc<=this.prev){var se=o.call(j,"catchLoc"),he=o.call(j,"finallyLoc");if(se&&he){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(se){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!he)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return g(j.finallyLoc)}}}},abrupt:function(O,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&o.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var j=v;break}}j&&(O==="break"||O==="continue")&&j.tryLoc<=C&&C<=j.finallyLoc&&(j=null);var ee=j?j.completion:{};return ee.type=O,ee.arg=C,j?(this.method="next",this.next=j.finallyLoc,R):this.complete(ee)},complete:function(O,C){if(O.type==="throw")throw O.arg;return O.type==="break"||O.type==="continue"?this.next=O.arg:O.type==="return"?(this.rval=this.arg=O.arg,this.method="return",this.next="end"):O.type==="normal"&&C&&(this.next=C),R},finish:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),R}},catch:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===O){var v=g.completion;if(v.type==="throw"){var j=v.arg;m(g)}return j}}throw Error("illegal catch attempt")},delegateYield:function(O,C,g){return this.delegate={iterator:A(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),R}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Bh)),Bh.exports}var Fh,d_;function Sk(){if(d_)return Fh;d_=1;var e=xk()();Fh=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Fh}var Uh={exports:{}},h_;function Ek(){return h_||(h_=1,function(e){function t(n,i,s,o,a,c,u){try{var l=n[c](u),f=l.value}catch(h){return void s(h)}l.done?i(f):Promise.resolve(f).then(o,a)}function r(n){return function(){var i=this,s=arguments;return new Promise(function(o,a){var c=n.apply(i,s);function u(f){t(c,o,a,u,l,"next",f)}function l(f){t(c,o,a,u,l,"throw",f)}u(void 0)})}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Uh)),Uh.exports}var Vh={exports:{}},zh={exports:{}},qh={exports:{}},p_;function Ck(){return p_||(p_=1,function(e){var t=Nu().default;function r(n,i){if(t(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var o=s.call(n,i||"default");if(t(o)!="object")return o;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}(qh)),qh.exports}var m_;function Ak(){return m_||(m_=1,function(e){var t=Nu().default,r=Ck();function n(i){var s=r(i,"string");return t(s)=="symbol"?s:s+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(zh)),zh.exports}var g_;function Mk(){return g_||(g_=1,function(e){var t=Ak();function r(n,i,s){return(i=t(i))in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Vh)),Vh.exports}var Wh,v_;function Tk(){if(v_)return Wh;v_=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 Wh=t=>!e.has(t&&t.code),Wh}var tc=_k;Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.isNetworkError=Kh,Zr.isRetryableError=Du,Zr.isSafeRequestError=__,Zr.isIdempotentRequestError=Xh,Zr.isNetworkOrIdempotentRequestError=Jh,Zr.exponentialDelay=x_,Zr.default=qs,Zr.DEFAULT_OPTIONS=Zr.namespace=void 0;var Ru=tc(Sk()),Ok=tc(Nu()),y_=tc(Ek()),Ik=tc(Mk()),Pk=tc(Tk());function b_(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 Gh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?b_(Object(r),!0).forEach(function(n){(0,Ik.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Hh="axios-retry";Zr.namespace=Hh;function Kh(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Pk.default)(e)}var w_=["get","head","options"],jk=w_.concat(["put","delete"]);function Du(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function __(e){return e.config?Du(e)&&w_.indexOf(e.config.method)!==-1:!1}function Xh(e){return e.config?Du(e)&&jk.indexOf(e.config.method)!==-1:!1}function Jh(e){return Kh(e)||Xh(e)}function kk(){return 0}function x_(){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 S_={retries:3,retryCondition:Jh,retryDelay:kk,shouldResetTimeout:!1,onRetry:function(){}};Zr.DEFAULT_OPTIONS=S_;function Nk(e,t){return Gh(Gh(Gh({},S_),t),e[Hh])}function E_(e,t){var r=Nk(e,t);return r.retryCount=r.retryCount||0,e[Hh]=r,r}function Rk(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 Dk(e,t){return Yh.apply(this,arguments)}function Yh(){return Yh=(0,y_.default)(Ru.default.mark(function e(t,r){var n,i,s,o;return Ru.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,s=t.retryCount<n&&i(r),(0,Ok.default)(s)!=="object"){c.next=13;break}return c.prev=3,c.next=6,s;case 6:return o=c.sent,c.abrupt("return",o!==!1);case 10:return c.prev=10,c.t0=c.catch(3),c.abrupt("return",!1);case 13:return c.abrupt("return",s);case 14:case"end":return c.stop()}},e,null,[[3,10]])})),Yh.apply(this,arguments)}function qs(e,t){var r=e.interceptors.request.use(function(i){var s=E_(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,y_.default)(Ru.default.mark(function s(o){var a,c,u,l,f,h,y,b;return Ru.default.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(a=o.config,a){T.next=3;break}return T.abrupt("return",Promise.reject(o));case 3:return c=E_(a,t),T.next=6,Dk(c,o);case 6:if(!T.sent){T.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),Rk(e,a),!(!l&&a.timeout&&c.lastRequestTime)){T.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){T.next=16;break}return T.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],T.next=20,f(c.retryCount,o,a);case 20:return T.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return T.abrupt("return",Promise.reject(o));case 22:case"end":return T.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}qs.isNetworkError=Kh,qs.isSafeRequestError=__,qs.isIdempotentRequestError=Xh,qs.isNetworkOrIdempotentRequestError=Jh,qs.exponentialDelay=x_,qs.isRetryableError=Du;const C_=Zr.default;$h.exports=C_,$h.exports.default=C_;var $k=$h.exports,$u={},Po=null;typeof WebSocket<"u"?Po=WebSocket:typeof MozWebSocket<"u"?Po=MozWebSocket:typeof Nr<"u"?Po=Nr.WebSocket||Nr.MozWebSocket:typeof window<"u"?Po=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Po=self.WebSocket||self.MozWebSocket);var Bk=Po,Lk=Nr&&Nr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($u,"__esModule",{value:!0}),$u.ResilientWebSocket=void 0;const Fk=Lk(Bk),Uk=3e4+3e3;class Vk{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 Fk.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=zk(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await A_(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()},Uk)}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 A_(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}}$u.ResilientWebSocket=Vk;async function A_(e){return new Promise(t=>setTimeout(t,e))}function zk(e){return 2**e*100}var jo={};Object.defineProperty(jo,"__esModule",{value:!0}),jo.removeLeading0xIfExists=jo.makeWebsocketUrl=void 0;function qk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}jo.makeWebsocketUrl=qk;function Wk(e){return e.startsWith("0x")?e.substring(2):e}jo.removeLeading0xIfExists=Wk;var M_=Nr&&Nr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vu,"__esModule",{value:!0}),vu.PriceServiceConnection=void 0;const Zh=dh,Gk=M_(c_),T_=M_($k),Hk=$u,Qh=jo;class Kk{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,s;this.httpClient=Gk.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,T_.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:T_.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:(s=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:s.allowOutOfOrder},this.priceFeedCallbacks=new Map,this.logger=(r==null?void 0:r.logger)||{trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error},this.onWsError=o=>{this.logger.error(o),typeof gn<"u"&&typeof gn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),gn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Qh.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=>Zh.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 Zh.PriceFeed.fromJson(n.data)}async getPriceFeedIds(){return(await this.httpClient.get("/api/price_feed_ids")).data}async subscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Qh.removeLeading0xIfExists)(o));const n=[];for(const o of t)this.priceFeedCallbacks.has(o)||(this.priceFeedCallbacks.set(o,new Set),n.push(o)),this.priceFeedCallbacks.get(o).add(r);const i={ids:n,type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};await((s=this.wsClient)==null?void 0:s.send(JSON.stringify(i)))}async unsubscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Qh.removeLeading0xIfExists)(o));const n=[];for(const o of t)if(this.priceFeedCallbacks.has(o)){let a=!1;r===void 0?(this.priceFeedCallbacks.delete(o),a=!0):(this.priceFeedCallbacks.get(o).delete(r),this.priceFeedCallbacks.get(o).size===0&&(this.priceFeedCallbacks.delete(o),a=!0)),a&&n.push(o)}const i={ids:n,type:"unsubscribe"};await((s=this.wsClient)==null?void 0:s.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 Hk.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=Zh.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()}}vu.PriceServiceConnection=Kk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=vu;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=dh;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}})}(fh),Object.defineProperty(gu,"__esModule",{value:!0}),gu.SuiPriceServiceConnection=void 0;const Xk=fh,Jk=bu();class Yk extends Xk.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>Jk.Buffer.from(n,"base64"))}}gu.SuiPriceServiceConnection=Yk;var Bu={};Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.SuiPythClient=void 0;const Lu=Iy,ko=Hn,Zk=bu(),ep=16*1024;class Qk{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,s,o;if(((s=(i=n.data)==null?void 0:i.content)==null?void 0:s.dataType)=="moveObject")return n.data.content.fields;throw console.log((o=n.data)==null?void 0:o.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 s of t){const[o]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(s),{maxSize:ep}).toBytes()),r.object(Lu.SUI_CLOCK_OBJECT_ID)]});i.push(o)}return i}async updatePriceFeeds(t,r,n){const i=await this.getPythPackageId();let s;if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const o=this.extractVaaBytesFromAccumulatorMessage(r[0]),a=await this.verifyVaas([o],t);[s]=t.moveCall({target:`${i}::pyth::create_authenticated_price_infos_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(r[0]),{maxSize:ep}).toBytes()),a[0],t.object(Lu.SUI_CLOCK_OBJECT_ID)]});const c=[],u=await this.getBaseUpdateFee(),l=t.splitCoins(t.gas,n.map(()=>t.pure.u64(u)));let f=0;for(const h of n){const y=await this.getPriceFeedObjectId(h);if(!y)throw new Error(`Price feed ${h} not found, please create it first`);c.push(y),[s]=t.moveCall({target:`${i}::pyth::update_single_price_feed`,arguments:[t.object(this.pythStateId),s,t.object(y),l[f],t.object(Lu.SUI_CLOCK_OBJECT_ID)]}),f++}return t.moveCall({target:`${i}::hot_potato_vector::destroy`,arguments:[s],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]),s=await this.verifyVaas([i],t);t.moveCall({target:`${n}::pyth::create_price_feeds_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(r[0]),{maxSize:ep}).toBytes()),s[0],t.object(Lu.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(),s=await this.provider.getDynamicFieldObject({parentId:n,name:{type:`${i}::price_identifier::PriceIdentifier`,value:{bytes:Array.from(Zk.Buffer.from(r,"hex"))}}});if(!s.data||!s.data.content)return;if(s.data.content.dataType!=="moveObject")throw new Error("Price feed type mismatch");this.priceFeedObjectIdCache.set(r,s.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),s=n+2;return t.subarray(s,s+i)}}Bu.SuiPythClient=Qk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=gu;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Bu;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=fh;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(w2);var O_=bA,tp=Iy,e9=Mo,Fu=w2,t9=Object.create,rp=Object.defineProperty,r9=Object.defineProperties,n9=Object.getOwnPropertyDescriptor,i9=Object.getOwnPropertyDescriptors,I_=Object.getOwnPropertyNames,P_=Object.getOwnPropertySymbols,s9=Object.getPrototypeOf,j_=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,k_=(e,t,r)=>t in e?rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a9=(e,t)=>{for(var r in t||(t={}))j_.call(t,r)&&k_(e,r,t[r]);if(P_)for(var r of P_(t))o9.call(t,r)&&k_(e,r,t[r]);return e},c9=(e,t)=>r9(e,i9(t)),u9=(e=>typeof Vn<"u"?Vn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Vn<"u"?Vn:t)[r]}):e)(function(e){if(typeof Vn<"u")return Vn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),l9=(e,t)=>function(){return t||(0,e[I_(e)[0]])((t={exports:{}}).exports,t),t.exports},f9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of I_(t))!j_.call(e,i)&&i!==r&&rp(e,i,{get:()=>t[i],enumerable:!(n=n9(t,i))||n.enumerable});return e},No=(e,t,r)=>(r=e!=null?t9(s9(e)):{},f9(!e||!e.__esModule?rp(r,"default",{value:e,enumerable:!0}):r,e)),bt=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{a(r.next(c))}catch(u){i(u)}},o=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,o);a((r=r.apply(e,t)).next())}),Ro=l9({"node_modules/bn.js/lib/bn.js"(e,t){(function(r,n){function i(p,d){if(!p)throw new Error(d||"Assertion failed")}function s(p,d){p.super_=d;var m=function(){};m.prototype=d.prototype,p.prototype=new m,p.prototype.constructor=p}function o(p,d,m){if(o.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(p||0,d||10,m||"be"))}typeof r=="object"?r.exports=o:n.BN=o,o.BN=o,o.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=u9("buffer").Buffer}catch{}o.isBN=function(d){return d instanceof o?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===o.wordSize&&Array.isArray(d.words)},o.max=function(d,m){return d.cmp(m)>0?d:m},o.min=function(d,m){return d.cmp(m)<0?d:m},o.prototype._init=function(d,m,x){if(typeof d=="number")return this._initNumber(d,m,x);if(typeof d=="object")return this._initArray(d,m,x);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),d=d.toString().replace(/\s+/g,"");var A=0;d[0]==="-"&&(A++,this.negative=1),A<d.length&&(m===16?this._parseHex(d,A,x):(this._parseBase(d,m,A),x==="le"&&this._initArray(this.toArray(),m,x)))},o.prototype._initNumber=function(d,m,x){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),m,x)},o.prototype._initArray=function(d,m,x){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var E,O,C=0;if(x==="be")for(A=d.length-1,E=0;A>=0;A-=3)O=d[A]|d[A-1]<<8|d[A-2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);else if(x==="le")for(A=0,E=0;A<d.length;A+=3)O=d[A]|d[A+1]<<8|d[A+2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);return this._strip()};function c(p,d){var m=p.charCodeAt(d);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 "+p)}function u(p,d,m){var x=c(p,m);return m-1>=d&&(x|=c(p,m-1)<<4),x}o.prototype._parseHex=function(d,m,x){this.length=Math.ceil((d.length-m)/6),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var E=0,O=0,C;if(x==="be")for(A=d.length-1;A>=m;A-=2)C=u(d,m,A)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8;else{var g=d.length-m;for(A=g%2===0?m+1:m;A<d.length;A+=2)C=u(d,m,A)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8}this._strip()};function l(p,d,m,x){for(var A=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;A*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),A+=E}return A}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var A=0,E=1;E<=67108863;E*=m)A++;A--,E=E/m|0;for(var O=d.length-x,C=O%A,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=A)v=l(d,j,j+A,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(d,j,d.length,m),j=0;j<C;j++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red};function f(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(o.prototype._move=function(d){f(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)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")]=h}catch{o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","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],w=[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(d,m){d=d||10,m=m|0||1;var x;if(d===16||d==="hex"){x="";for(var A=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<A|E)&16777215).toString(16);E=C>>>24-A&16777215,A+=2,A>=26&&(A-=26,O--),E!==0||O!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(E!==0&&(x=E.toString(16)+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(d===(d|0)&&d>=2&&d<=36){var v=b[d],j=w[d];x="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var se=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=se+x:x=y[v-se.length]+se+x}for(this.isZero()&&(x="0"+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(d,m){return this.toArrayLike(a,d,m)}),o.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)};var T=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var A=this.byteLength(),E=x||Math.max(1,A);i(A<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=T(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,A),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,A=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|A;d[x++]=C&255,x<d.length&&(d[x++]=C>>8&255),x<d.length&&(d[x++]=C>>16&255),O===6?(x<d.length&&(d[x++]=C>>24&255),A=0,O=0):(A=C>>>24,O+=2)}if(x<d.length)for(d[x++]=A;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,A=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|A;d[x--]=C&255,x>=0&&(d[x--]=C>>8&255),x>=0&&(d[x--]=C>>16&255),O===6?(x>=0&&(d[x--]=C>>24&255),A=0,O=0):(A=C>>>24,O+=2)}if(x>=0)for(d[x--]=A;x>=0;)d[x--]=0},Math.clz32?o.prototype._countBits=function(d){return 32-Math.clz32(d)}:o.prototype._countBits=function(d){var m=d,x=0;return m>=4096&&(x+=13,m>>>=13),m>=64&&(x+=7,m>>>=7),m>=8&&(x+=4,m>>>=4),m>=2&&(x+=2,m>>>=2),x+m},o.prototype._zeroBits=function(d){if(d===0)return 26;var m=d,x=0;return m&8191||(x+=13,m>>>=13),m&127||(x+=7,m>>>=7),m&15||(x+=4,m>>>=4),m&3||(x+=2,m>>>=2),m&1||x++,x},o.prototype.bitLength=function(){var d=this.words[this.length-1],m=this._countBits(d);return(this.length-1)*26+m};function P(p){for(var d=new Array(p.bitLength()),m=0;m<d.length;m++){var x=m/26|0,A=m%26;d[m]=p.words[x]>>>A&1}return d}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,m=0;m<this.length;m++){var x=this._zeroBits(this.words[m]);if(d+=x,x!==26)break}return d},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},o.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).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(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]|d.words[m];return this._strip()},o.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},o.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},o.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},o.prototype.iuand=function(d){var m;this.length>d.length?m=d:m=this;for(var x=0;x<m.length;x++)this.words[x]=this.words[x]&d.words[x];return this.length=m.length,this._strip()},o.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},o.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},o.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},o.prototype.iuxor=function(d){var m,x;this.length>d.length?(m=this,x=d):(m=d,x=this);for(var A=0;A<x.length;A++)this.words[A]=m.words[A]^x.words[A];if(this!==m)for(;A<m.length;A++)this.words[A]=m.words[A];return this.length=m.length,this._strip()},o.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},o.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},o.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},o.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var m=Math.ceil(d/26)|0,x=d%26;this._expand(m),x>0&&m--;for(var A=0;A<m;A++)this.words[A]=~this.words[A]&67108863;return x>0&&(this.words[A]=~this.words[A]&67108863>>26-x),this._strip()},o.prototype.notn=function(d){return this.clone().inotn(d)},o.prototype.setn=function(d,m){i(typeof d=="number"&&d>=0);var x=d/26|0,A=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<A:this.words[x]=this.words[x]&~(1<<A),this._strip()},o.prototype.iadd=function(d){var m;if(this.negative!==0&&d.negative===0)return this.negative=0,m=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,m=this.isub(d),d.negative=1,m._normSign();var x,A;this.length>d.length?(x=this,A=d):(x=d,A=this);for(var E=0,O=0;O<A.length;O++)m=(x.words[O]|0)+(A.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;for(;E!==0&&O<x.length;O++)m=(x.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;if(this.length=x.length,E!==0)this.words[this.length]=E,this.length++;else if(x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this},o.prototype.add=function(d){var m;return d.negative!==0&&this.negative===0?(d.negative=0,m=this.sub(d),d.negative^=1,m):d.negative===0&&this.negative!==0?(this.negative=0,m=d.sub(this),this.negative=1,m):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},o.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var m=this.iadd(d);return d.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var x=this.cmp(d);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,E;x>0?(A=this,E=d):(A=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(A.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<A.length;C++)m=(A.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===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()},o.prototype.sub=function(d){return this.clone().isub(d)};function k(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var A=p.words[0]|0,E=d.words[0]|0,O=A*E,C=O&67108863,g=O/67108864|0;m.words[0]=C;for(var v=1;v<x;v++){for(var j=g>>>26,ee=g&67108863,se=Math.min(v,d.length-1),he=Math.max(0,v-p.length+1);he<=se;he++){var ye=v-he|0;A=p.words[ye]|0,E=d.words[he]|0,O=A*E+ee,j+=O/67108864|0,ee=O&67108863}m.words[v]=ee|0,g=j|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var R=function(d,m,x){var A=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=A[0]|0,se=ee&8191,he=ee>>>13,ye=A[1]|0,Ee=ye&8191,Se=ye>>>13,Ge=A[2]|0,Ue=Ge&8191,dt=Ge>>>13,ht=A[3]|0,$e=ht&8191,mt=ht>>>13,xe=A[4]|0,ge=xe&8191,Te=xe>>>13,We=A[5]|0,De=We&8191,Oe=We>>>13,Ie=A[6]|0,Fe=Ie&8191,lt=Ie>>>13,ft=A[7]|0,He=ft&8191,jt=ft>>>13,St=A[8]|0,et=St&8191,Tt=St>>>13,Bt=A[9]|0,nt=Bt&8191,Et=Bt>>>13,Ot=E[0]|0,st=Ot&8191,kt=Ot>>>13,It=E[1]|0,it=It&8191,_t=It>>>13,At=E[2]|0,Ye=At&8191,gt=At>>>13,Pt=E[3]|0,ot=Pt&8191,xt=Pt>>>13,Ut=E[4]|0,N=Ut&8191,S=Ut>>>13,M=E[5]|0,B=M&8191,K=M>>>13,Z=E[6]|0,re=Z&8191,Be=Z>>>13,rt=E[7]|0,Re=rt&8191,V=rt>>>13,oe=E[8]|0,pe=oe&8191,ke=oe>>>13,Ke=E[9]|0,Ne=Ke&8191,Ve=Ke>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(se,st),v=Math.imul(se,kt),v=v+Math.imul(he,st)|0,j=Math.imul(he,kt);var ut=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,g=Math.imul(Ee,st),v=Math.imul(Ee,kt),v=v+Math.imul(Se,st)|0,j=Math.imul(Se,kt),g=g+Math.imul(se,it)|0,v=v+Math.imul(se,_t)|0,v=v+Math.imul(he,it)|0,j=j+Math.imul(he,_t)|0;var Jt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,kt),v=v+Math.imul(dt,st)|0,j=Math.imul(dt,kt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,_t)|0,v=v+Math.imul(Se,it)|0,j=j+Math.imul(Se,_t)|0,g=g+Math.imul(se,Ye)|0,v=v+Math.imul(se,gt)|0,v=v+Math.imul(he,Ye)|0,j=j+Math.imul(he,gt)|0;var Nt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,g=Math.imul($e,st),v=Math.imul($e,kt),v=v+Math.imul(mt,st)|0,j=Math.imul(mt,kt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,_t)|0,v=v+Math.imul(dt,it)|0,j=j+Math.imul(dt,_t)|0,g=g+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,gt)|0,v=v+Math.imul(Se,Ye)|0,j=j+Math.imul(Se,gt)|0,g=g+Math.imul(se,ot)|0,v=v+Math.imul(se,xt)|0,v=v+Math.imul(he,ot)|0,j=j+Math.imul(he,xt)|0;var Lt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,kt),v=v+Math.imul(Te,st)|0,j=Math.imul(Te,kt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,_t)|0,v=v+Math.imul(mt,it)|0,j=j+Math.imul(mt,_t)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(dt,Ye)|0,j=j+Math.imul(dt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,xt)|0,v=v+Math.imul(Se,ot)|0,j=j+Math.imul(Se,xt)|0,g=g+Math.imul(se,N)|0,v=v+Math.imul(se,S)|0,v=v+Math.imul(he,N)|0,j=j+Math.imul(he,S)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(De,st),v=Math.imul(De,kt),v=v+Math.imul(Oe,st)|0,j=Math.imul(Oe,kt),g=g+Math.imul(ge,it)|0,v=v+Math.imul(ge,_t)|0,v=v+Math.imul(Te,it)|0,j=j+Math.imul(Te,_t)|0,g=g+Math.imul($e,Ye)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Ye)|0,j=j+Math.imul(mt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,xt)|0,v=v+Math.imul(dt,ot)|0,j=j+Math.imul(dt,xt)|0,g=g+Math.imul(Ee,N)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,N)|0,j=j+Math.imul(Se,S)|0,g=g+Math.imul(se,B)|0,v=v+Math.imul(se,K)|0,v=v+Math.imul(he,B)|0,j=j+Math.imul(he,K)|0;var Er=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Er>>>26)|0,Er&=67108863,g=Math.imul(Fe,st),v=Math.imul(Fe,kt),v=v+Math.imul(lt,st)|0,j=Math.imul(lt,kt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,_t)|0,v=v+Math.imul(Oe,it)|0,j=j+Math.imul(Oe,_t)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Te,Ye)|0,j=j+Math.imul(Te,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,xt)|0,v=v+Math.imul(mt,ot)|0,j=j+Math.imul(mt,xt)|0,g=g+Math.imul(Ue,N)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(dt,N)|0,j=j+Math.imul(dt,S)|0,g=g+Math.imul(Ee,B)|0,v=v+Math.imul(Ee,K)|0,v=v+Math.imul(Se,B)|0,j=j+Math.imul(Se,K)|0,g=g+Math.imul(se,re)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(he,re)|0,j=j+Math.imul(he,Be)|0;var or=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(He,st),v=Math.imul(He,kt),v=v+Math.imul(jt,st)|0,j=Math.imul(jt,kt),g=g+Math.imul(Fe,it)|0,v=v+Math.imul(Fe,_t)|0,v=v+Math.imul(lt,it)|0,j=j+Math.imul(lt,_t)|0,g=g+Math.imul(De,Ye)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Ye)|0,j=j+Math.imul(Oe,gt)|0,g=g+Math.imul(ge,ot)|0,v=v+Math.imul(ge,xt)|0,v=v+Math.imul(Te,ot)|0,j=j+Math.imul(Te,xt)|0,g=g+Math.imul($e,N)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,N)|0,j=j+Math.imul(mt,S)|0,g=g+Math.imul(Ue,B)|0,v=v+Math.imul(Ue,K)|0,v=v+Math.imul(dt,B)|0,j=j+Math.imul(dt,K)|0,g=g+Math.imul(Ee,re)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,re)|0,j=j+Math.imul(Se,Be)|0,g=g+Math.imul(se,Re)|0,v=v+Math.imul(se,V)|0,v=v+Math.imul(he,Re)|0,j=j+Math.imul(he,V)|0;var Yt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(et,st),v=Math.imul(et,kt),v=v+Math.imul(Tt,st)|0,j=Math.imul(Tt,kt),g=g+Math.imul(He,it)|0,v=v+Math.imul(He,_t)|0,v=v+Math.imul(jt,it)|0,j=j+Math.imul(jt,_t)|0,g=g+Math.imul(Fe,Ye)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(lt,Ye)|0,j=j+Math.imul(lt,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,xt)|0,v=v+Math.imul(Oe,ot)|0,j=j+Math.imul(Oe,xt)|0,g=g+Math.imul(ge,N)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Te,N)|0,j=j+Math.imul(Te,S)|0,g=g+Math.imul($e,B)|0,v=v+Math.imul($e,K)|0,v=v+Math.imul(mt,B)|0,j=j+Math.imul(mt,K)|0,g=g+Math.imul(Ue,re)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(dt,re)|0,j=j+Math.imul(dt,Be)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,V)|0,v=v+Math.imul(Se,Re)|0,j=j+Math.imul(Se,V)|0,g=g+Math.imul(se,pe)|0,v=v+Math.imul(se,ke)|0,v=v+Math.imul(he,pe)|0,j=j+Math.imul(he,ke)|0;var br=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(br>>>26)|0,br&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,kt),v=v+Math.imul(Et,st)|0,j=Math.imul(Et,kt),g=g+Math.imul(et,it)|0,v=v+Math.imul(et,_t)|0,v=v+Math.imul(Tt,it)|0,j=j+Math.imul(Tt,_t)|0,g=g+Math.imul(He,Ye)|0,v=v+Math.imul(He,gt)|0,v=v+Math.imul(jt,Ye)|0,j=j+Math.imul(jt,gt)|0,g=g+Math.imul(Fe,ot)|0,v=v+Math.imul(Fe,xt)|0,v=v+Math.imul(lt,ot)|0,j=j+Math.imul(lt,xt)|0,g=g+Math.imul(De,N)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,N)|0,j=j+Math.imul(Oe,S)|0,g=g+Math.imul(ge,B)|0,v=v+Math.imul(ge,K)|0,v=v+Math.imul(Te,B)|0,j=j+Math.imul(Te,K)|0,g=g+Math.imul($e,re)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,re)|0,j=j+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,V)|0,v=v+Math.imul(dt,Re)|0,j=j+Math.imul(dt,V)|0,g=g+Math.imul(Ee,pe)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Se,pe)|0,j=j+Math.imul(Se,ke)|0,g=g+Math.imul(se,Ne)|0,v=v+Math.imul(se,Ve)|0,v=v+Math.imul(he,Ne)|0,j=j+Math.imul(he,Ve)|0;var Dn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,_t),v=v+Math.imul(Et,it)|0,j=Math.imul(Et,_t),g=g+Math.imul(et,Ye)|0,v=v+Math.imul(et,gt)|0,v=v+Math.imul(Tt,Ye)|0,j=j+Math.imul(Tt,gt)|0,g=g+Math.imul(He,ot)|0,v=v+Math.imul(He,xt)|0,v=v+Math.imul(jt,ot)|0,j=j+Math.imul(jt,xt)|0,g=g+Math.imul(Fe,N)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(lt,N)|0,j=j+Math.imul(lt,S)|0,g=g+Math.imul(De,B)|0,v=v+Math.imul(De,K)|0,v=v+Math.imul(Oe,B)|0,j=j+Math.imul(Oe,K)|0,g=g+Math.imul(ge,re)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Te,re)|0,j=j+Math.imul(Te,Be)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,V)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,V)|0,g=g+Math.imul(Ue,pe)|0,v=v+Math.imul(Ue,ke)|0,v=v+Math.imul(dt,pe)|0,j=j+Math.imul(dt,ke)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,Ve)|0,v=v+Math.imul(Se,Ne)|0,j=j+Math.imul(Se,Ve)|0;var Kr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(Et,Ye)|0,j=Math.imul(Et,gt),g=g+Math.imul(et,ot)|0,v=v+Math.imul(et,xt)|0,v=v+Math.imul(Tt,ot)|0,j=j+Math.imul(Tt,xt)|0,g=g+Math.imul(He,N)|0,v=v+Math.imul(He,S)|0,v=v+Math.imul(jt,N)|0,j=j+Math.imul(jt,S)|0,g=g+Math.imul(Fe,B)|0,v=v+Math.imul(Fe,K)|0,v=v+Math.imul(lt,B)|0,j=j+Math.imul(lt,K)|0,g=g+Math.imul(De,re)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,re)|0,j=j+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,V)|0,v=v+Math.imul(Te,Re)|0,j=j+Math.imul(Te,V)|0,g=g+Math.imul($e,pe)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(mt,pe)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,Ve)|0,v=v+Math.imul(dt,Ne)|0,j=j+Math.imul(dt,Ve)|0;var $n=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+($n>>>26)|0,$n&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,xt),v=v+Math.imul(Et,ot)|0,j=Math.imul(Et,xt),g=g+Math.imul(et,N)|0,v=v+Math.imul(et,S)|0,v=v+Math.imul(Tt,N)|0,j=j+Math.imul(Tt,S)|0,g=g+Math.imul(He,B)|0,v=v+Math.imul(He,K)|0,v=v+Math.imul(jt,B)|0,j=j+Math.imul(jt,K)|0,g=g+Math.imul(Fe,re)|0,v=v+Math.imul(Fe,Be)|0,v=v+Math.imul(lt,re)|0,j=j+Math.imul(lt,Be)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,V)|0,v=v+Math.imul(Oe,Re)|0,j=j+Math.imul(Oe,V)|0,g=g+Math.imul(ge,pe)|0,v=v+Math.imul(ge,ke)|0,v=v+Math.imul(Te,pe)|0,j=j+Math.imul(Te,ke)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,Ve)|0,v=v+Math.imul(mt,Ne)|0,j=j+Math.imul(mt,Ve)|0;var Vi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,g=Math.imul(nt,N),v=Math.imul(nt,S),v=v+Math.imul(Et,N)|0,j=Math.imul(Et,S),g=g+Math.imul(et,B)|0,v=v+Math.imul(et,K)|0,v=v+Math.imul(Tt,B)|0,j=j+Math.imul(Tt,K)|0,g=g+Math.imul(He,re)|0,v=v+Math.imul(He,Be)|0,v=v+Math.imul(jt,re)|0,j=j+Math.imul(jt,Be)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,V)|0,v=v+Math.imul(lt,Re)|0,j=j+Math.imul(lt,V)|0,g=g+Math.imul(De,pe)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(Oe,pe)|0,j=j+Math.imul(Oe,ke)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,Ve)|0,v=v+Math.imul(Te,Ne)|0,j=j+Math.imul(Te,Ve)|0;var zi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(zi>>>26)|0,zi&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(Et,B)|0,j=Math.imul(Et,K),g=g+Math.imul(et,re)|0,v=v+Math.imul(et,Be)|0,v=v+Math.imul(Tt,re)|0,j=j+Math.imul(Tt,Be)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,V)|0,v=v+Math.imul(jt,Re)|0,j=j+Math.imul(jt,V)|0,g=g+Math.imul(Fe,pe)|0,v=v+Math.imul(Fe,ke)|0,v=v+Math.imul(lt,pe)|0,j=j+Math.imul(lt,ke)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,Ve)|0,v=v+Math.imul(Oe,Ne)|0,j=j+Math.imul(Oe,Ve)|0;var Bn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,g=Math.imul(nt,re),v=Math.imul(nt,Be),v=v+Math.imul(Et,re)|0,j=Math.imul(Et,Be),g=g+Math.imul(et,Re)|0,v=v+Math.imul(et,V)|0,v=v+Math.imul(Tt,Re)|0,j=j+Math.imul(Tt,V)|0,g=g+Math.imul(He,pe)|0,v=v+Math.imul(He,ke)|0,v=v+Math.imul(jt,pe)|0,j=j+Math.imul(jt,ke)|0,g=g+Math.imul(Fe,Ne)|0,v=v+Math.imul(Fe,Ve)|0,v=v+Math.imul(lt,Ne)|0,j=j+Math.imul(lt,Ve)|0;var qi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(qi>>>26)|0,qi&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,V),v=v+Math.imul(Et,Re)|0,j=Math.imul(Et,V),g=g+Math.imul(et,pe)|0,v=v+Math.imul(et,ke)|0,v=v+Math.imul(Tt,pe)|0,j=j+Math.imul(Tt,ke)|0,g=g+Math.imul(He,Ne)|0,v=v+Math.imul(He,Ve)|0,v=v+Math.imul(jt,Ne)|0,j=j+Math.imul(jt,Ve)|0;var Wi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,g=Math.imul(nt,pe),v=Math.imul(nt,ke),v=v+Math.imul(Et,pe)|0,j=Math.imul(Et,ke),g=g+Math.imul(et,Ne)|0,v=v+Math.imul(et,Ve)|0,v=v+Math.imul(Tt,Ne)|0,j=j+Math.imul(Tt,Ve)|0;var $=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+($>>>26)|0,$&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,Ve),v=v+Math.imul(Et,Ne)|0,j=Math.imul(Et,Ve);var H=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=ut,O[1]=Jt,O[2]=Nt,O[3]=Lt,O[4]=ir,O[5]=Er,O[6]=or,O[7]=Yt,O[8]=br,O[9]=Dn,O[10]=Kr,O[11]=$n,O[12]=Vi,O[13]=zi,O[14]=Bn,O[15]=qi,O[16]=Wi,O[17]=$,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(R=k);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,A=0,E=0;E<m.length-1;E++){var O=A;A=0;for(var C=x&67108863,g=Math.min(E,d.length-1),v=Math.max(0,E-p.length+1);v<=g;v++){var j=E-v,ee=p.words[j]|0,se=d.words[v]|0,he=ee*se,ye=he&67108863;O=O+(he/67108864|0)|0,ye=ye+C|0,C=ye&67108863,O=O+(ye>>>26)|0,A+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=A}return x!==0?m.words[E]=x:m.length--,m._strip()}function L(p,d,m){return F(p,d,m)}o.prototype.mulTo=function(d,m){var x,A=this.length+d.length;return this.length===10&&d.length===10?x=R(this,d,m):A<63?x=k(this,d,m):A<1024?x=F(this,d,m):x=L(this,d,m),x},o.prototype.mul=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),this.mulTo(d,m)},o.prototype.mulf=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),L(this,d,m)},o.prototype.imul=function(d){return this.clone().mulTo(d,this)},o.prototype.imuln=function(d){var m=d<0;m&&(d=-d),i(typeof d=="number"),i(d<67108864);for(var x=0,A=0;A<this.length;A++){var E=(this.words[A]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[A]=O&67108863}return x!==0&&(this.words[A]=x,this.length++),m?this.ineg():this},o.prototype.muln=function(d){return this.clone().imuln(d)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(d){var m=P(d);if(m.length===0)return new o(1);for(var x=this,A=0;A<m.length&&m[A]===0;A++,x=x.sqr());if(++A<m.length)for(var E=x.sqr();A<m.length;A++,E=E.sqr())m[A]!==0&&(x=x.mul(E));return x},o.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,A=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&A,g=(this.words[E]|0)-C<<m;this.words[E]=g|O,O=C>>>26-m}O&&(this.words[E]=O,this.length++)}if(x!==0){for(E=this.length-1;E>=0;E--)this.words[E+x]=this.words[E];for(E=0;E<x;E++)this.words[E]=0;this.length+=x}return this._strip()},o.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},o.prototype.iushrn=function(d,m,x){i(typeof d=="number"&&d>=0);var A;m?A=(m-m%26)/26:A=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(A-=O,A=Math.max(0,A),g){for(var v=0;v<O;v++)g.words[v]=this.words[v];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,v=0;v<this.length;v++)this.words[v]=this.words[v+O];else this.words[0]=0,this.length=1;var j=0;for(v=this.length-1;v>=0&&(j!==0||v>=A);v--){var ee=this.words[v]|0;this.words[v]=j<<26-E|ee>>>E,j=ee&C}return g&&j!==0&&(g.words[g.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(d,m,x){return i(this.negative===0),this.iushrn(d,m,x)},o.prototype.shln=function(d){return this.clone().ishln(d)},o.prototype.ushln=function(d){return this.clone().iushln(d)},o.prototype.shrn=function(d){return this.clone().ishrn(d)},o.prototype.ushrn=function(d){return this.clone().iushrn(d)},o.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,A=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&A)},o.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(m!==0&&x++,this.length=Math.min(x,this.length),m!==0){var A=67108863^67108863>>>m<<m;this.words[this.length-1]&=A}return this._strip()},o.prototype.maskn=function(d){return this.clone().imaskn(d)},o.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<=d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},o.prototype._iaddn=function(d){this.words[0]+=d;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},o.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,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()},o.prototype.addn=function(d){return this.clone().iaddn(d)},o.prototype.subn=function(d){return this.clone().isubn(d)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(d,m,x){var A=d.length+x,E;this._expand(A);var O,C=0;for(E=0;E<d.length;E++){O=(this.words[E+x]|0)+C;var g=(d.words[E]|0)*m;O-=g&67108863,C=(O>>26)-(g/67108864|0),this.words[E+x]=O&67108863}for(;E<this.length-x;E++)O=(this.words[E+x]|0)+C,C=O>>26,this.words[E+x]=O&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,E=0;E<this.length;E++)O=-(this.words[E]|0)+C,C=O>>26,this.words[E]=O&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,m){var x=this.length-d.length,A=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),A.iushln(x),O=E.words[E.length-1]|0);var g=A.length-E.length,v;if(m!=="mod"){v=new o(null),v.length=g+1,v.words=new Array(v.length);for(var j=0;j<v.length;j++)v.words[j]=0}var ee=A.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(A=ee,v&&(v.words[g]=1));for(var se=g-1;se>=0;se--){var he=(A.words[E.length+se]|0)*67108864+(A.words[E.length+se-1]|0);for(he=Math.min(he/O|0,67108863),A._ishlnsubmul(E,he,se);A.negative!==0;)he--,A.negative=0,A._ishlnsubmul(E,1,se),A.isZero()||(A.negative^=1);v&&(v.words[se]=he)}return v&&v._strip(),A._strip(),m!=="div"&&x!==0&&A.iushrn(x),{div:v||null,mod:A}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var A,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(A=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:A,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(A=O.div.neg()),{div:A,mod:O.mod}):this.negative&d.negative?(O=this.neg().divmod(d.neg(),m),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.isub(d)),{div:O.div,mod:E}):d.length>this.length||this.cmp(d)<0?{div:new o(0),mod:this}:d.length===1?m==="div"?{div:this.divn(d.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new o(this.modrn(d.words[0]))}:this._wordDiv(d,m)},o.prototype.div=function(d){return this.divmod(d,"div",!1).div},o.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},o.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},o.prototype.divRound=function(d){var m=this.divmod(d);if(m.mod.isZero())return m.div;var x=m.div.negative!==0?m.mod.isub(d):m.mod,A=d.ushrn(1),E=d.andln(1),O=x.cmp(A);return O<0||E===1&&O===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=(1<<26)%d,A=0,E=this.length-1;E>=0;E--)A=(x*A+(this.words[E]|0))%d;return m?-A:A},o.prototype.modn=function(d){return this.modrn(d)},o.prototype.idivn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=0,A=this.length-1;A>=0;A--){var E=(this.words[A]|0)+x*67108864;this.words[A]=E/d|0,x=E%d}return this._strip(),m?this.ineg():this},o.prototype.divn=function(d){return this.clone().idivn(d)},o.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var A=new o(1),E=new o(0),O=new o(0),C=new o(1),g=0;m.isEven()&&x.isEven();)m.iushrn(1),x.iushrn(1),++g;for(var v=x.clone(),j=m.clone();!m.isZero();){for(var ee=0,se=1;!(m.words[0]&se)&&ee<26;++ee,se<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(A.isOdd()||E.isOdd())&&(A.iadd(v),E.isub(j)),A.iushrn(1),E.iushrn(1);for(var he=0,ye=1;!(x.words[0]&ye)&&he<26;++he,ye<<=1);if(he>0)for(x.iushrn(he);he-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),A.isub(O),E.isub(C)):(x.isub(m),O.isub(A),C.isub(E))}return{a:O,b:C,gcd:x.iushln(g)}},o.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var A=new o(1),E=new o(0),O=x.clone();m.cmpn(1)>0&&x.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(O),A.iushrn(1);for(var v=0,j=1;!(x.words[0]&j)&&v<26;++v,j<<=1);if(v>0)for(x.iushrn(v);v-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);m.cmp(x)>=0?(m.isub(x),A.isub(E)):(x.isub(m),E.isub(A))}var ee;return m.cmpn(1)===0?ee=A:ee=E,ee.cmpn(0)<0&&ee.iadd(d),ee},o.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var m=this.clone(),x=d.clone();m.negative=0,x.negative=0;for(var A=0;m.isEven()&&x.isEven();A++)m.iushrn(1),x.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;x.isEven();)x.iushrn(1);var E=m.cmp(x);if(E<0){var O=m;m=x,x=O}else if(E===0||x.cmpn(1)===0)break;m.isub(x)}while(!0);return x.iushln(A)},o.prototype.invm=function(d){return this.egcd(d).a.umod(d)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(d){return this.words[0]&d},o.prototype.bincn=function(d){i(typeof d=="number");var m=d%26,x=(d-m)/26,A=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=A,this;for(var E=A,O=x;E!==0&&O<this.length;O++){var C=this.words[O]|0;C+=E,E=C>>>26,C&=67108863,this.words[O]=C}return E!==0&&(this.words[O]=E,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(d){var m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var x;if(this.length>1)x=1;else{m&&(d=-d),i(d<=67108863,"Number is too big");var A=this.words[0]|0;x=A===d?0:A<d?-1:1}return this.negative!==0?-x|0:x},o.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var m=this.ucmp(d);return this.negative!==0?-m|0:m},o.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var m=0,x=this.length-1;x>=0;x--){var A=this.words[x]|0,E=d.words[x]|0;if(A!==E){A<E?m=-1:A>E&&(m=1);break}}return m},o.prototype.gtn=function(d){return this.cmpn(d)===1},o.prototype.gt=function(d){return this.cmp(d)===1},o.prototype.gten=function(d){return this.cmpn(d)>=0},o.prototype.gte=function(d){return this.cmp(d)>=0},o.prototype.ltn=function(d){return this.cmpn(d)===-1},o.prototype.lt=function(d){return this.cmp(d)===-1},o.prototype.lten=function(d){return this.cmpn(d)<=0},o.prototype.lte=function(d){return this.cmp(d)<=0},o.prototype.eqn=function(d){return this.cmpn(d)===0},o.prototype.eq=function(d){return this.cmp(d)===0},o.red=function(d){return new z(d)},o.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(d){return this.red=d,this},o.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},o.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},o.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},o.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},o.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},o.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},o.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},o.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var G={k256:null,p224:null,p192:null,p25519:null};function q(p,d){this.name=p,this.p=new o(d,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 d=new o(null);return d.words=new Array(Math.ceil(this.n/13)),d},q.prototype.ireduce=function(d){var m=d,x;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),x=m.bitLength();while(x>this.n);var A=x<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},q.prototype.split=function(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function X(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(X,q),X.prototype.split=function(d,m){for(var x=4194303,A=Math.min(d.length,9),E=0;E<A;E++)m.words[E]=d.words[E];if(m.length=A,d.length<=9){d.words[0]=0,d.length=1;return}var O=d.words[9];for(m.words[m.length++]=O&x,E=10;E<d.length;E++){var C=d.words[E]|0;d.words[E-10]=(C&x)<<4|O>>>22,O=C}O>>>=22,d.words[E-10]=O,O===0&&d.length>10?d.length-=10:d.length-=9},X.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var m=0,x=0;x<d.length;x++){var A=d.words[x]|0;m+=A*977,d.words[x]=m&67108863,m=A*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ie(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ie,q);function ae(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,q);function ce(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ce,q),ce.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var A=(d.words[x]|0)*19+m,E=A&67108863;A>>>=26,d.words[x]=E,m=A}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(G[d])return G[d];var m;if(d==="k256")m=new X;else if(d==="p224")m=new ie;else if(d==="p192")m=new ae;else if(d==="p25519")m=new ce;else throw new Error("Unknown prime "+d);return G[d]=m,m};function z(p){if(typeof p=="string"){var d=o._prime(p);this.m=d.p,this.prime=d}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}z.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},z.prototype._verify2=function(d,m){i((d.negative|m.negative)===0,"red works only with positives"),i(d.red&&d.red===m.red,"red works only with red numbers")},z.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},z.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},z.prototype.add=function(d,m){this._verify2(d,m);var x=d.add(m);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},z.prototype.iadd=function(d,m){this._verify2(d,m);var x=d.iadd(m);return x.cmp(this.m)>=0&&x.isub(this.m),x},z.prototype.sub=function(d,m){this._verify2(d,m);var x=d.sub(m);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},z.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},z.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},z.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},z.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},z.prototype.isqr=function(d){return this.imul(d,d.clone())},z.prototype.sqr=function(d){return this.mul(d,d)},z.prototype.sqrt=function(d){if(d.isZero())return d.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var x=this.m.add(new o(1)).iushrn(2);return this.pow(d,x)}for(var A=this.m.subn(1),E=0;!A.isZero()&&A.andln(1)===0;)E++,A.iushrn(1);i(!A.isZero());var O=new o(1).toRed(this),C=O.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var j=this.pow(v,A),ee=this.pow(d,A.addn(1).iushrn(1)),se=this.pow(d,A),he=E;se.cmp(O)!==0;){for(var ye=se,Ee=0;ye.cmp(O)!==0;Ee++)ye=ye.redSqr();i(Ee<he);var Se=this.pow(j,new o(1).iushln(he-Ee-1));ee=ee.redMul(Se),j=Se.redSqr(),se=se.redMul(j),he=Ee}return ee},z.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},z.prototype.pow=function(d,m){if(m.isZero())return new o(1).toRed(this);if(m.cmpn(1)===0)return d.clone();var x=4,A=new Array(1<<x);A[0]=new o(1).toRed(this),A[1]=d;for(var E=2;E<A.length;E++)A[E]=this.mul(A[E-1],d);var O=A[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),E=m.length-1;E>=0;E--){for(var j=m.words[E],ee=v-1;ee>=0;ee--){var se=j>>ee&1;if(O!==A[0]&&(O=this.sqr(O)),se===0&&C===0){g=0;continue}C<<=1,C|=se,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,A[C]),g=0,C=0)}v=26}return O},z.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},z.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new D(d)};function D(p){z.call(this,p),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)}s(D,z),D.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},D.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(A).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(A).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),Do=9e15,rs=1e9,np="0123456789abcdef",Uu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Vu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ip={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Do,maxE:Do,crypto:!1},N_,Pi,at=!0,zu="[DecimalError] ",ns=zu+"Invalid argument: ",R_=zu+"Precision limit exceeded",D_=zu+"crypto unavailable",$_="[object Decimal]",Or=Math.floor,pr=Math.pow,d9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,h9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,p9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,B_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tn=1e7,Ze=7,m9=9007199254740991,g9=Uu.length-1,sp=Vu.length-1,be={toStringTag:$_};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)},be.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)},be.clampedTo=be.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(ns+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},be.comparedTo=be.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},be.cosine=be.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())+Ze,n.rounding=1,r=v9(n,q_(n,r)),n.precision=e,n.rounding=t,Xe(Pi==2||Pi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},be.cubeRoot=be.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(at=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=wr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Or((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),wr(a.d).slice(0,o)===(r=wr(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Xe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Xe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return at=!0,Xe(n,e,f.rounding,t)},be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Or(this.e/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},be.dividedBy=be.div=function(e){return qt(this,new this.constructor(e))},be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(t,new r(e),0,1,1),r.precision,r.rounding)},be.equals=be.eq=function(e){return this.cmp(e)===0},be.floor=function(){return Xe(new this.constructor(this),this.e+1,3)},be.greaterThan=be.gt=function(e){return this.cmp(e)>0},be.greaterThanOrEqualTo=be.gte=function(e){var t=this.cmp(e);return t==1||t===0},be.hyperbolicCosine=be.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Hu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=$o(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Xe(s,o.precision=r,o.rounding=n,!0)},be.hyperbolicSine=be.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=$o(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Hu(5,e)),i=$o(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Xe(i,t,r,!0)},be.hyperbolicTangent=be.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,qt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},be.inverseCosine=be.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?On(r,i,s):new r(0):new r(NaN):t.isZero()?On(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=On(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},be.inverseHyperbolicCosine=be.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,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},be.inverseHyperbolicSine=be.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,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},be.inverseHyperbolicTangent=be.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=qt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},be.inverseSine=be.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=On(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},be.inverseTangent=be.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=sp)return o=On(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=sp)return o=On(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Ze+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(a/Ze),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),at=!0,Xe(o,l.precision=f,l.rounding=h,!0)},be.isFinite=function(){return!!this.d},be.isInteger=be.isInt=function(){return!!this.d&&Or(this.e/Ze)>this.d.length-2},be.isNaN=function(){return!this.s},be.isNegative=be.isNeg=function(){return this.s<0},be.isPositive=be.isPos=function(){return this.s>0},be.isZero=function(){return!!this.d&&this.d[0]===0},be.lessThan=be.lt=function(e){return this.cmp(e)<0},be.lessThanOrEqualTo=be.lte=function(e){return this.cmp(e)<1},be.logarithm=be.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=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)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(at=!1,a=f+y,o=ss(u,a),n=t?Gu(l,a+10):ss(e,a),c=qt(o,n,a,1),rc(c.d,i=f,h))do if(a+=10,o=ss(u,a),n=t?Gu(l,a+10):ss(e,a),c=qt(o,n,a,1),!s){+wr(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(rc(c.d,i+=10,h));return at=!0,Xe(c,f,h)},be.minus=be.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return at?Xe(e,a,c):e}if(r=Or(e.e/Ze),l=Or(y.e/Ze),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Ze),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=Tn-1;--u[i],u[n]+=Tn}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Wu(u,r),at?Xe(e,a,c):e):new b(c===3?-0:0)},be.modulo=be.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]?Xe(new n(r),n.precision,n.rounding):(at=!1,n.modulo==9?(t=qt(r,e.abs(),0,3,1),t.s*=e.s):t=qt(r,e,0,n.modulo,1),t=t.times(e),at=!0,r.minus(t))},be.naturalExponential=be.exp=function(){return op(this)},be.naturalLogarithm=be.ln=function(){return ss(this)},be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)},be.plus=be.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),at?Xe(e,a,c):e;if(s=Or(f.e/Ze),n=Or(e.e/Ze),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Ze),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Tn|0,u[i]%=Tn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Wu(u,n),at?Xe(e,a,c):e},be.precision=be.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ns+e);return r.d?(t=L_(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},be.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)},be.sine=be.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())+Ze,n.rounding=1,r=b9(n,q_(n,r)),n.precision=e,n.rounding=t,Xe(Pi>2?r.neg():r,e,t,!0)):new n(NaN)},be.squareRoot=be.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=wr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Or((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(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),wr(s.d).slice(0,r)===(t=wr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Xe(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Xe(n,c+1,1),e=!n.times(n).eq(o));break}return at=!0,Xe(n,c,l.rounding,e)},be.tangent=be.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=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Pi==2||Pi==4?r.neg():r,e,t,!0)):new n(NaN)},be.times=be.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Or(l.e/Ze)+Or(e.e/Ze),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%Tn|0,t=a/Tn|0;s[i]=(s[i]+t)%Tn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Wu(s,r),at?Xe(e,f.precision,f.rounding):e},be.toBinary=function(e,t){return cp(this,2,e,t)},be.toDecimalPlaces=be.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(qr(e,0,rs),t===void 0?t=n.rounding:qr(t,0,8),Xe(r,e+r.e+1,t))},be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ti(n,!0):(qr(e,0,rs),t===void 0?t=i.rounding:qr(t,0,8),n=Xe(new i(n),e+1,t),r=ti(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ti(i):(qr(e,0,rs),t===void 0?t=s.rounding:qr(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ti(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},be.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=L_(b)-y.e-1,o=s%Ze,t.d[0]=pr(10,o<0?Ze+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(ns+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new w(wr(b)),l=w.precision,w.precision=s=b.length*Ze*2;f=qt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=qt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=qt(u,n,s,1).minus(y).abs().cmp(qt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,at=!0,h},be.toHexadecimal=be.toHex=function(e,t){return cp(this,16,e,t)},be.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]?(at=!1,r=qt(r,e,0,t,1).times(e),at=!0,Xe(r)):(e.s=r.s,r=e),r},be.toNumber=function(){return+this},be.toOctal=function(e,t){return cp(this,8,e,t)},be.toPower=be.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Or(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=m9)return i=F_(c,a,r,n),e.s<0?new c(1).div(i):Xe(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=pr(+a,u),t=r==0||!isFinite(r)?Or(u*(Math.log("0."+wr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=op(e.times(ss(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),rc(i.d,n,s)&&(t=n+10,i=Xe(op(e.times(ss(a,t+r)),t),t+5,1),+wr(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,at=!0,c.rounding=s,Xe(i,n,s))},be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ti(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(qr(e,1,rs),t===void 0?t=i.rounding:qr(t,0,8),n=Xe(new i(n),e,t),r=ti(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toSignificantDigits=be.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(qr(e,1,rs),t===void 0?t=n.rounding:qr(t,0,8)),Xe(new n(r),e,t)},be.toString=function(){var e=this,t=e.constructor,r=ti(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},be.truncated=be.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)},be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ti(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function wr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Ze-n.length,r&&(s+=is(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=is(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function qr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(ns+e)}function rc(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Ze,i=0):(i=Math.ceil((t+1)/Ze),t%=Ze),s=pr(10,Ze-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==pr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==pr(10,t-3)-1,o}function qu(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=np.indexOf(e.charAt(o++)),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 v9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Hu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=$o(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var qt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,T,P,k,R,F,L,G,q,X,ie,ae,ce,z,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=Tn,y=Ze,l=Or(n.e/y)-Or(i.e/y)),ce=m.length,ie=d.length,P=new D(p),k=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)k.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),k[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),F=R.length;F<ce;)R[F++]=0;z=m.slice(),z.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,F),u<0?(L=R[0],ce!=F&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,F=R.length,u=t(w,R,T,F),u==1&&(h--,r(w,ce<T?z:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<F&&w.unshift(0),r(R,w,F,c),u==-1&&(F=R.length,u=t(m,R,ce,F),u<1&&(h++,r(R,ce<F?z:m,F,c))),F=R.length):u===0&&(h++,R=[0]),k[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ie||R[0]!==void 0)&&G--);b=R[0]!==void 0}k[0]||k.shift()}if(y==1)P.e=l,N_=b;else{for(f=1,h=k[0];h>=10;h/=10)f++;P.e=f+l*y-1,Xe(P,a?s+P.e+1:s,o,b)}return P}}();function Xe(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Ze,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Ze),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Ze,o=s-Ze+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Ze,o=s-Ze+i,c=o<0?0:l/pr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%pr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/pr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=pr(10,(Ze-t%Ze)%Ze),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=pr(10,Ze-s),f[h]=o>0?(l/pr(10,i-o)%pr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==Tn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Tn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ti(e,t,r){if(!e.isFinite())return z_(e);var n,i=e.e,s=wr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+is(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+is(-i-1)+s,r&&(n=r-o)>0&&(s+=is(n))):i>=o?(s+=is(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+is(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=is(n))),s}function Wu(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function Gu(e,t,r){if(t>g9)throw at=!0,r&&(e.precision=r),Error(R_);return Xe(new e(Uu),t,1,!0)}function On(e,t,r){if(t>sp)throw Error(R_);return Xe(new e(Vu),t,r,!0)}function L_(e){var t=e.length-1,r=t*Ze+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 is(e){for(var t="";e--;)t+="0";return t}function F_(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(at=!1;;){if(r%2&&(s=s.times(t),W_(s.d,o)&&(i=!0)),r=Or(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),W_(t.d,o)}return at=!0,s}function U_(e){return e.d[e.d.length-1]&1}function V_(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function op(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(at=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(pr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Xe(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),wr(a.d).slice(0,c)===wr(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&rc(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Xe(o,h.precision=b,y,at=!0);else return h.precision=b,o}o=a}}function ss(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,P=w.constructor,k=P.rounding,R=P.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new P(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(at=!1,l=R):l=t,P.precision=l+=b,r=wr(T),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=wr(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=Gu(P,l+2,R).times(s+""),w=ss(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Xe(w,R,k,at=!0):w;for(f=w,c=o=w=qt(w.minus(1),w.plus(1),l,1),h=Xe(w.times(w),l,1),i=3;;){if(o=Xe(o.times(h),l,1),u=c.plus(qt(o,new P(i),l,1)),wr(u.d).slice(0,l)===wr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Gu(P,l+2,R).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(rc(c.d,l-b,k,a))P.precision=l+=b,u=o=w=qt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,P.precision=R,k,at=!0);else return P.precision=R,c;c=u,i+=2}}function z_(e){return String(e.s*e.s/0)}function ap(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)%Ze,r<0&&(n+=Ze),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ze;n<i;)e.d.push(+t.slice(n,n+=Ze));t=t.slice(n),n=Ze-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),at&&(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 y9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),B_.test(t))return ap(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(h9.test(t))r=16,t=t.toLowerCase();else if(d9.test(t))r=2;else if(p9.test(t))r=8;else throw Error(ns+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=F_(n,new n(r),s,s*2)),u=qu(t,r,Tn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Wu(u,l),e.d=u,at=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):nc.pow(2,c))),at=!0,e)}function b9(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:$o(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Hu(5,r)),t=$o(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function $o(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(at=!1,c=r.times(r),a=new e(n);;){if(o=qt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=qt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return at=!0,o.d.length=l+1,o}function Hu(e,t){for(var r=e;--t;)r*=e;return r}function q_(e,t){var r,n=t.s<0,i=On(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Pi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Pi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Pi=U_(r)?n?2:3:n?4:1,t;Pi=U_(r)?n?1:4:n?3:2}return t.minus(i).abs()}function cp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(qr(r,1,rs),n===void 0?n=y.rounding:qr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=z_(e);else{for(l=ti(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=qu(ti(h),10,i),h.e=h.d.length),f=qu(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=qt(e,h,r,n,0,i),f=e.d,s=e.e,u=N_),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=np.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=qu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=np.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function W_(e,t){if(e.length>t)return e.length=t,!0}function w9(e){return new this(e).abs()}function _9(e){return new this(e).acos()}function x9(e){return new this(e).acosh()}function S9(e,t){return new this(e).plus(t)}function E9(e){return new this(e).asin()}function C9(e){return new this(e).asinh()}function A9(e){return new this(e).atan()}function M9(e){return new this(e).atanh()}function T9(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=On(this,s,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,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(qt(e,t,s,1)),t=On(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(qt(e,t,s,1)),r}function O9(e){return new this(e).cbrt()}function I9(e){return Xe(e=new this(e),e.e+1,2)}function P9(e,t,r){return new this(e).clamp(t,r)}function j9(e){if(!e||typeof e!="object")throw Error(zu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,rs,"rounding",0,8,"toExpNeg",-Do,0,"toExpPos",0,Do,"maxE",0,Do,"minE",-Do,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=ip[r]),(n=e[r])!==void 0)if(Or(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(ns+r+": "+n);if(r="crypto",i&&(this[r]=ip[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(D_);else this[r]=!1;else throw Error(ns+r+": "+n);return this}function k9(e){return new this(e).cos()}function N9(e){return new this(e).cosh()}function G_(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,H_(s)){u.s=s.s,at?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;at?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return ap(u,s.toString())}else if(c!=="string")throw Error(ns+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),B_.test(s)?ap(u,s):y9(u,s)}if(i.prototype=be,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=j9,i.clone=G_,i.isDecimal=H_,i.abs=w9,i.acos=_9,i.acosh=x9,i.add=S9,i.asin=E9,i.asinh=C9,i.atan=A9,i.atanh=M9,i.atan2=T9,i.cbrt=O9,i.ceil=I9,i.clamp=P9,i.cos=k9,i.cosh=N9,i.div=R9,i.exp=D9,i.floor=$9,i.hypot=B9,i.ln=L9,i.log=F9,i.log10=V9,i.log2=U9,i.max=z9,i.min=q9,i.mod=W9,i.mul=G9,i.pow=H9,i.random=K9,i.round=X9,i.sign=J9,i.sin=Y9,i.sinh=Z9,i.sqrt=Q9,i.sub=eN,i.sum=tN,i.tan=rN,i.tanh=nN,i.trunc=iN,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 R9(e,t){return new this(e).div(t)}function D9(e){return new this(e).exp()}function $9(e){return Xe(e=new this(e),e.e+1,3)}function B9(){var e,t,r=new this(0);for(at=!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 at=!0,new this(1/0);r=t}return at=!0,r.sqrt()}function H_(e){return e instanceof nc||e&&e.toStringTag===$_||!1}function L9(e){return new this(e).ln()}function F9(e,t){return new this(e).log(t)}function U9(e){return new this(e).log(2)}function V9(e){return new this(e).log(10)}function z9(){return V_(this,arguments,"lt")}function q9(){return V_(this,arguments,"gt")}function W9(e,t){return new this(e).mod(t)}function G9(e,t){return new this(e).mul(t)}function H9(e,t){return new this(e).pow(t)}function K9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:qr(e,1,rs),n=Math.ceil(e/Ze),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(D_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=pr(10,Ze-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ze)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ze&&(r-=Ze-n)}return o.e=r,o.d=a,o}function X9(e){return Xe(e=new this(e),e.e+1,this.rounding)}function J9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Y9(e){return new this(e).sin()}function Z9(e){return new this(e).sinh()}function Q9(e){return new this(e).sqrt()}function eN(e,t){return new this(e).sub(t)}function tN(){var e=0,t=arguments,r=new this(t[e]);for(at=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return at=!0,Xe(r,this.precision,this.rounding)}function rN(e){return new this(e).tan()}function nN(e){return new this(e).tanh()}function iN(e){return Xe(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString,be[Symbol.toStringTag]="Decimal";var nc=be.constructor=G_(ip);Uu=new nc(Uu),Vu=new nc(Vu);var Ku=nc,os=No(Ro()),up=No(Ro()),sN=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 up.default(e).mul(new up.default(this.slippage)).div(new up.default("1000000000000000000")).toString()}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];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 f=[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],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::aftermath::${c}`,typeArguments:[u,l,r.extendedDetails.aftermathLpSupplyType],arguments:f})})}},K_="0x000000000000000000000000000000000000000000000000000000000000dee9",oN=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return bt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:K_,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 bt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${K_}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=yield this.getOrCreateAccountCap(t,e.client,e.signer),h=[t.object(r.id),n,f.accountCap,t.object(ni)],y=yr(e.publishedAtV2(),i),b=t.moveCall({target:`${y}::deepbook::${c}`,typeArguments:[u,l],arguments:h});return f.isCreate&&t.transferObjects([f.accountCap],e.signer),b})}},aN=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(r.id),n],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::kriya_amm::${c}`,typeArguments:[u,l],arguments:f})})}},cN=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 bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(r.id),n,t.object(this.version),t.object(ni)],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::kriya_clmm::${c}`,typeArguments:[u,l],arguments:f})})}},uN=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.container),n],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::flowx_amm::${c}`,typeArguments:[u,l],arguments:f})})}},lN=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 bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ni)],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::flowx_clmm::${c}`,typeArguments:[u,l],arguments:f})})}},fN=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];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 f=[t.object(r.id),n,t.object(ni),t.object(this.versioned)],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::turbos::${c}`,typeArguments:[u,l,r.extendedDetails.turbosFeeType],arguments:f})})}},X_=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:s,from:o,target:a}=r,[c,u,l]=s?["flash_swap_a2b",o,a]:["flash_swap_b2a",a,o];let f=n?r.amountIn:r.amountOut;const h=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(f),t.pure.bool(n),t.object(ni)],y=yr(e.publishedAtV2(),i),b=t.moveCall({target:`${y}::cetus::${c}`,typeArguments:[u,l],arguments:h});return{targetCoin:b[0],flashReceipt:b[1],payAmount:b[2]}}repay_flash_swap(e,t,r,n,i,s){const{direction:o,from:a,target:c}=r,[u,l,f]=o?["repay_flash_swap_a2b",a,c]:["repay_flash_swap_b2a",c,a],h=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i],y=yr(e.publishedAtV2(),s);return t.moveCall({target:`${y}::cetus::${u}`,typeArguments:[l,f],arguments:h})[0]}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ni)],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::cetus::${c}`,typeArguments:[u,l],arguments:f})})}};function J_(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 dN(e){return e.split("::")[0]}function Ws(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=Ws(r),u=c9(a9({},c),{type_arguments:i.map(l=>Ws(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>ri.isSuiCoin(l)?l:Ws(l).source_address),u.source_address=J_(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===Z_||r===mN?"0x2":tp.normalizeSuiObjectId(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=J_(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function Y_(e){return Ws(e).source_address}var hN="0x2::coin::Coin",pN=/^0x2::coin::Coin<(.+)>$/,Z_="0x2::sui::SUI",mN="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",ri=class Ss{static getCoinTypeArg(t){const r=t.type.match(pN);return r?r[1]:null}static isSUI(t){const r=Ss.getCoinTypeArg(t);return r?Ss.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`${hN}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{Y_(i.coinAddress)===Y_(t)&&n.push(i)}),n}static isSuiCoin(t){return Ws(t).full_address===Z_}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Ss.selectCoinAssetGreaterThanOrEqual(t,r,n),s=i.selectedCoins.map(c=>c.coinObjectId),o=i.remainingCoins,a=i.selectedCoins.map(c=>c.balance.toString());return{objectArray:s,remainCoins:o,amountArray:a}}static selectCoinAssetGreaterThanOrEqual(t,r,n=[]){const i=Ss.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Ss.calculateTotalBalance(i);if(s<r)return{selectedCoins:[],remainingCoins:i};if(s===r)return{selectedCoins:i,remainingCoins:[]};let o=BigInt(0);const a=[],c=[...i];for(;o<s;){const u=r-o,l=c.findIndex(h=>h.balance>=u);if(l!==-1){a.push(c[l]),c.splice(l,1);break}const f=c.pop();f.balance>0&&(a.push(f),o+=f.balance)}return{selectedCoins:Ss.sortByBalance(a),remainingCoins:Ss.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 lp(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";default:return"Unknown error"}}function as(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 gN(e,t){e=as(e),t=as(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 Q_(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function fp(e,t,r,n){const i=ri.getCoinAssets(n,t);if(r===BigInt(0))return ri.isSuiCoin(n)||i.length===0&&!ri.isSuiCoin(n)?{targetCoin:Q_(e,n),isMintZeroCoin:!0,targetCoinAmount:0}:{targetCoin:e.object(i[0].coinObjectId),isMintZeroCoin:!1,targetCoinAmount:Number(i[0].balance.toString())};if(ri.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(ri.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=ri.sortByBalance(i);o.slice(0,3).reduce((h,y)=>h+y.balance,BigInt(0))<BigInt(r)&&(o=ri.sortByBalanceDes(i));let c=ri.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(h=>e.object(h))),{targetCoin:e.splitCoins(e.object(u),[e.pure.u64(r.toString())]),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function vN(e,t=!0){return bt(this,null,function*(){console.log("inputs",e.getData().inputs),e.getData().commands.forEach((r,n)=>{t&&console.log(`transaction ${n}: `,JSON.stringify(r,null,2))})})}function yN(e){return!(!e.startsWith("0x")||e.length!==66)}var Bo=No(Ro()),cs=No(Ro()),ic=No(Ro()),ji=new ic.default(0);new ic.default(1);var bN=new ic.default(2);bN.pow(new ic.default(128));var wN=new ic.default("18446744073709551615"),un=1e9;function _N(e,t,r){let n=ji;return t?n=e.mul(new cs.default(un-r*un)).div(new cs.default(un)):n=e.mul(new cs.default(un+r*un)).div(new cs.default(un)),Number(n.toString())}function xN(e,t,r){let n=ji;return t?n=e.mul(new cs.default(un-r*un)).div(new cs.default(un)):n=e.mul(new cs.default(un+r*un)).div(new cs.default(un)),n}function SN(e,t,r){return new Ku(e).mul(Ku.pow(2,-64)).pow(2).mul(Ku.pow(10,t-r))}function EN(e,t,r,n){return bt(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=as(u),w=as(l),T=new e9.Transaction,P=gN(b,w),k=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",R=P?b:w,F=P?w:b,L=[R,F];console.log("typeArguments",L,k);for(let C=0;C<y.length;C++){const g=[T.object(y[C]),T.pure.bool(P),T.pure.bool(h),T.pure.u64(f.toString())];T.moveCall({target:`${k}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!yN(r))throw new AggregateError("Aggregator package not set","InvalidWallet");vN(T);const G=yield e.devInspectTransactionBlock({transactionBlock:T,sender:r});if(G.error!=null)throw console.log("simulateRes.error",G.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=G.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?ji:wN,ie=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new Bo.BN(q[C].parsedJson.data.amount_out);g.gt(X)&&(ie=C,X=g)}else{const g=new Bo.BN(q[C].parsedJson.data.amount_out);g.lt(X)&&(ie=C,X=g)}const ae=q[ie].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[z,D]=yield Promise.all([e.getCoinMetadata({coinType:R}).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 p=SN(ce,z,D),d=Number(ae.fee_rate)/1e6,m=new Bo.BN((s=ae.amount_in)!=null?s:0),x=new Bo.BN((o=ae.fee_amount)!=null?o:0),A=m.add(x),E={amountIn:A,amountOut:new Bo.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ie],direction:P,provider:"CETUS",from:b,target:w,feeRate:d,amountIn:ae.amount_in,amountOut:ae.amount_out,extendedDetails:{afterSqrtPrice:ae.after_sqrt_price}}],amountIn:A,amountOut:new Bo.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1,byAmountIn:t.byAmountIn};return{isExceed:ae.is_exceed,routeData:E}})}var CN=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s}=r,o=s?"swap_a2b":"swap_b2a",a=[t.object(r.id),t.object("0x5"),n],c=yr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::haedal::${o}`,typeArguments:[],arguments:a})})}},AN=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 bt(this,null,function*(){const{direction:s}=r;if(!s)throw new Error("Afsui not support b2a swap");const o="swap_a2b",a=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n],c=yr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::afsui::${o}`,typeArguments:[],arguments:a})})}},MN=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 bt(this,null,function*(){const{direction:s}=r;if(!s)throw new Error("Volo not support b2a swap");const o="swap_a2b",a=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n],c=yr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::volo::${o}`,typeArguments:[],arguments:a})})}},TN=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.dexInfo),n],h=yr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::bluemove::${c}`,typeArguments:[u,l],arguments:f})})}},ON=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i,s){return bt(this,null,function*(){const{direction:o,from:a,target:c}=r,[u,l,f]=o?["swap_a2b",a,c]:["swap_b2a",c,a];let h;s?h=s:h=Q_(t,e.deepbookv3DeepFeeType());const y=[t.object(this.deepbookV3Config),t.object(r.id),n,h,t.object(ni)],b=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${b}::deepbookv3::${u}`,typeArguments:[l,f],arguments:y})})}},IN=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 bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",o,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 f=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ni)],h=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${h}::scallop::${c}`,typeArguments:[u,l],arguments:f})})}},ex=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 bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u]=s?["swap_a2b",a]:["swap_b2a",o],l=[t.object(r.id),t.object(this.sui_system_state),n],f=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${f}::suilend::${c}`,typeArguments:[u],arguments:l})})}},PN=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),n,t.object(ni)],h=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${h}::bluefin::${c}`,typeArguments:[u,l],arguments:f})})}},jN=class{constructor(e,t){if(e===1){this.connection=new Fu.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Fu.SuiPythClient(t,n,r)}else{this.connection=new Fu.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Fu.SuiPythClient(t,n,r)}}swap(e,t,r,n,i){return bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];let f,h;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");f=r.extendedDetails.haedalPmmBasePriceSeed,h=r.extendedDetails.haedalPmmQuotePriceSeed;const y=[f,h],b=yield this.connection.getPriceFeedsUpdateData(y),w=yield this.pythClient.updatePriceFeeds(t,b,y),T=[t.object(r.id),t.object(w[0]),t.object(w[1]),n,t.object(ni)],P=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${P}::haedalpmm::${c}`,typeArguments:[u,l],arguments:T})})}},kN=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 bt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u]=s?["swap_a2b",a]:["swap_b2a",o],l=[t.object(r.id),t.object(this.sui_system_state),n],f=Lo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${f}::alphafi::${c}`,typeArguments:[u],arguments:l})})}},tx="CETUS",NN="DEEPBOOK",RN="KRIYA",DN="FLOWX",$N="FLOWXV3",BN="KRIYAV3",rx="TURBOS",dp="AFTERMATH",LN="HAEDAL",FN="VOLO",UN="AFSUI",VN="BLUEMOVE",nx="DEEPBOOKV3",ix="SCALLOP",zN="SUILEND",qN="BLUEFIN",sx="HAEDALPMM",WN="ALPHAFI",GN="SPRINGSUI",HN="https://api-sui.cetus.zone/router_v2";function ox(e){return Array.isArray(e.routers)}function hp(e){return Array.isArray(e.routers)}var KN=class{constructor(e,t,r,n){this.endpoint=e?ZN(e):HN,this.client=r||new O_.SuiClient({url:O_.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return bt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let r=null,n=50;if(!t){const s=this.allCoins.get(e);if(s)return s}const i=[];for(;;){const s=yield this.client.getCoins({owner:this.signer,coinType:e,cursor:r,limit:n});for(const o of s.data)i.push({coinAddress:Ws(o.coinType).source_address,coinObjectId:o.coinObjectId,balance:BigInt(o.balance)});if(s.data.length<n)break;r=s.data[n-1].coinObjectId}return this.allCoins.set(e,i),i})}findRouters(e){return bt(this,null,function*(){return QN(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s,o){return bt(this,null,function*(){if(r.length===0)throw new Error("No router found");const a=r.map(b=>b.amountIn.toString()),c=r[0].path[0].from,u=r[0].path[r[0].path.length-1].target,l=e.splitCoins(t,a),f=[];for(let b=0;b<r.length;b++){if(r[b].path.length===0)throw new Error("Empty path");let w=l[b];for(const T of r[b].path)w=yield this.newDex(T.provider,i).swap(this,e,T,w,o,s);f.push(w)}const h=yr(this.publishedAtV2(),o);return this.transferOrDestoryCoin(e,t,c,this.publishedAtV2()),this.checkCoinThresholdAndMergeCoin(e,f,u,n,h)})}expectOutputSwap(e,t,r,n,i){return bt(this,null,function*(){const s=[],o=[],a=[],c=new X_(this.env,n),u=yr(this.publishedAtV2(),i);for(let f=0;f<r.length;f++){const h=r[f];for(let b=h.path.length-1;b>=0;b--){const w=h.path[b],T=c.flash_swap(this,e,w,!1);s.unshift(T.targetCoin),o.unshift(T.flashReceipt)}let y=t;for(let b=0;b<h.path.length;b++){const w=h.path[b],T=c.repay_flash_swap(this,e,w,y,o[b]);y=s[b],b===0?t=T:this.transferOrDestoryCoin(e,T,w.from,u),b===h.path.length-1&&a.push(y)}}const l=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,l,u),a.length>1){const f=e.makeMoveVec({elements:a.slice(1)});e.moveCall({target:`${tp.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[a[0],f]})}return a[0]})}swapInPools(e){return bt(this,null,function*(){let t;try{t=yield EN(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return bt(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,txb:i,partner:s,deepbookv3DeepFee:o}=e,a=Array.isArray(t)?t:t.routes,c=ox(e)?e.byAmountIn:e.routers.byAmountIn,u=a.reduce((T,P)=>T.add(P.amountIn),new os.default(0)),l=a.reduce((T,P)=>T.add(P.amountOut),new os.default(0)),f=xN(c?l:u,c,n),h=ox(e)?void 0:e.routers.packages;console.log("packages11",h);const y=yr(this.publishedAtV2(),h);if(c)return yield this.expectInputSwap(i,r,a,f,s,o,h);const b=i.splitCoins(r,[f.toString()]);return this.transferOrDestoryCoin(i,r,a[0].path[0].from,y),yield this.expectOutputSwap(i,b[0],a,s)})}fastRouterSwap(e){return bt(this,null,function*(){const{routers:t,slippage:r,txb:n,partner:i,refreshAllCoins:s,payDeepFeeAmount:o}=e,a=Array.isArray(t)?t:t.routes,c=a[0].path[0].from;let u=yield this.getCoins(c,s);const l=a[0].path[a[0].path.length-1].target,f=a.reduce((F,L)=>F.add(L.amountIn),new os.default(0)),h=a.reduce((F,L)=>F.add(L.amountOut),new os.default(0)),y=hp(e)?e.byAmountIn:e.routers.byAmountIn,b=_N(y?h:f,y,r),T=fp(n,u,BigInt((y?f:b).toString()),c);let P;if(o&&o>0){let F=yield this.getCoins(this.deepbookv3DeepFeeType());P=fp(n,F,BigInt(o),this.deepbookv3DeepFeeType()).targetCoin}const k=hp(e)?{routers:a,inputCoin:T.targetCoin,slippage:r,byAmountIn:y,txb:n,partner:i,deepbookv3DeepFee:P}:{routers:e.routers,inputCoin:T.targetCoin,slippage:r,byAmountIn:y,txb:n,partner:i,deepbookv3DeepFee:P},R=yield this.routerSwap(k);if(ri.isSuiCoin(l))n.mergeCoins(n.gas,[R]);else{let F=yield this.getCoins(l,s);const L=fp(n,F,BigInt(0),l),G=hp(e)?void 0:e.routers.packages,q=yr(this.publishedAtV2(),G);n.mergeCoins(L.targetCoin,[R]),L.isMintZeroCoin&&this.transferOrDestoryCoin(n,L.targetCoin,l,q)}})}publishedAtV2(){return this.env===0?"0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2Extend(){return this.env===0?"0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r,n){e.moveCall({target:`${n}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n,i){let s=t[0];if(t.length>1){let o=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${tp.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],o]}),s=t[0]}return e.moveCall({target:`${i}::utils::check_coin_threshold`,typeArguments:[r],arguments:[s,e.pure.u64(n.toString())]}),s}newDex(e,t){switch(e){case tx:return new X_(this.env,t);case NN:return new oN(this.env);case nx:return new ON(this.env);case RN:return new aN(this.env);case BN:return new cN(this.env);case DN:return new uN(this.env);case $N:return new lN(this.env);case rx:return new fN(this.env);case dp:return new sN(this.env);case LN:return new CN(this.env);case UN:return new AN(this.env);case FN:return new MN(this.env);case VN:return new TN(this.env);case ix:return new IN(this.env);case zN:return new ex(this.env);case GN:return new ex(this.env);case qN:return new PN(this.env);case sx:return new jN(this.env,this.client);case WN:return new kN(this.env);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return bt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return bt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return bt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return bt(this,null,function*(){const e=yield rR(this.endpoint);return e?e.data:null})}};function XN(e,t){let r=0;for(const s of e.routes)for(const o of s.path)o.extended_details&&o.extended_details.deepbookv3_deep_fee&&(r+=Number(o.extended_details.deepbookv3_deep_fee));let n;if(e.packages!=null){n=new Map;for(const[s,o]of Object.entries(e.packages))n.set(s,o)}return{amountIn:new os.default(e.amount_in.toString()),amountOut:new os.default(e.amount_out.toString()),byAmountIn:t,insufficientLiquidity:!1,routes:e.routes.map(s=>({path:s.path.map(o=>{var a,c,u,l,f,h,y;let b;o.provider===dp&&(b=o.extended_details.aftermath_pool_flatness===0?"v2":"v3");let w;return(o.provider===rx||o.provider===dp||o.provider===tx||o.provider===nx||o.provider===ix||o.provider===sx)&&(w={aftermathLpSupplyType:(a=o.extended_details)==null?void 0:a.aftermath_lp_supply_type,turbosFeeType:(c=o.extended_details)==null?void 0:c.turbos_fee_type,afterSqrtPrice:(u=o.extended_details)==null?void 0:u.after_sqrt_price,deepbookv3DeepFee:(l=o.extended_details)==null?void 0:l.deepbookv3_deep_fee,scallopScoinTreasury:(f=o.extended_details)==null?void 0:f.scallop_scoin_treasury,haedalPmmBasePriceSeed:(h=o.extended_details)==null?void 0:h.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(y=o.extended_details)==null?void 0:y.haedal_pmm_quote_price_seed}),{id:o.id,direction:o.direction,provider:o.provider,from:o.from,target:o.target,feeRate:o.fee_rate,amountIn:o.amount_in,amountOut:o.amount_out,extendedDetails:w,version:b}}),amountIn:new os.default(s.amount_in.toString()),amountOut:new os.default(s.amount_out.toString()),initialPrice:new Ku(s.initial_price.toString())})),totalDeepFee:r,packages:n}}var ni="0x0000000000000000000000000000000000000000000000000000000000000006",JN="aggregator_v2",YN="aggregator_v2_extend";function yr(e,t){var r;return t instanceof Map&&(r=t.get(JN))!=null?r:e}function Lo(e,t){var r;return t instanceof Map&&(r=t.get(YN))!=null?r:e}No(Ro());function ZN(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function QN(e,t){return bt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield tR(e,t):r=yield eR(e,t),!r)return null;if(!r.ok)return{amountIn:ji,amountOut:ji,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:!1,error:{code:10001,msg:lp(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:ji,amountOut:ji,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:i,error:{code:10004,msg:lp(10004)}}:n.data!=null?XN(n.data,t.byAmountIn):{amountIn:ji,amountOut:ji,routes:[],insufficientLiquidity:i,byAmountIn:t.byAmountIn,error:{code:10003,msg:lp(10003)}}})}function eR(e,t){return bt(this,null,function*(){try{const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l}=t,f=as(r),h=as(n);let y=`${e}/find_routes?from=${f}&target=${h}&amount=${i.toString()}&by_amount_in=${s}`;return o&&(y+=`&depth=${o}`),a&&(y+=`&split_algorithm=${a}`),c&&(y+=`&split_factor=${c}`),u&&(y+=`&split_count=${u}`),l&&l.length>0&&(y+=`&providers=${l.join(",")}`),y+="&v=1000321",yield fetch(y)}catch(r){return console.error(r),null}})}function tR(e,t){return bt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:f}=t,h=as(r),y=as(n),b=`${e}/find_routes`,w=l==null?void 0:l.join(","),T={from:h,target:y,amount:Number(i.toString()),by_amount_in:s,depth:o,split_algorithm:a,split_factor:c,split_count:u,providers:w,liquidity_changes:f.map(P=>({pool:P.poolID,tick_lower:P.ticklower,tick_upper:P.tickUpper,delta_liquidity:P.deltaLiquidity}))};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}catch(P){return console.error("Error:",P),null}})}function rR(e){return bt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var ax=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(ax||{}),cx=KN,nR=ax,ux=dN,sc=Ws;const lx="0x2::sui::SUI",iR="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function fx(e){return Ir(e).full_address===lx}function dx(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 Ir(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={...Ir(r),type_arguments:i.map(l=>Ir(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>fx(l)?l:Ir(l).source_address),u.source_address=dx(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===lx||r===iR?"0x2":bi(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=dx(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function sR(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const ki=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=bi(n);return t&&(i=sR(i)),`${i}::${r.join("::")}`};/*!
29
+ */(function(R){const k=r,F=A,$=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 H=2147483647;R.kMaxLength=H;const{Uint8Array:q,ArrayBuffer:Y,SharedArrayBuffer:ne}=globalThis;z.TYPED_ARRAY_SUPPORT=se(),!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 se(){try{const j=new q(1),E={foo:function(){return 42}};return Object.setPrototypeOf(E,q.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>H)throw new RangeError('The value "'+j+'" is invalid for option "size"');const E=new q(j);return Object.setPrototypeOf(E,z.prototype),E}function z(j,E,T){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,T)}z.poolSize=8192;function D(j,E,T){if(typeof j=="string")return S(j,E);if(Y.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(mt(j,Y)||j&&mt(j.buffer,Y)||typeof ne<"u"&&(mt(j,ne)||j&&mt(j.buffer,ne)))return I(j,E,T);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const L=j.valueOf&&j.valueOf();if(L!=null&&L!==j)return z.from(L,E,T);const K=C(j);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return z.from(j[Symbol.toPrimitive]("string"),E,T);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,T){return D(j,E,T)},Object.setPrototypeOf(z.prototype,q.prototype),Object.setPrototypeOf(z,q);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,T){return h(j),j<=0?ae(j):E!==void 0?typeof T=="string"?ae(j).fill(E,T):ae(j).fill(E):ae(j)}z.alloc=function(j,E,T){return f(j,E,T)};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 T=N(j,E)|0;let L=ae(T);const K=L.write(j,E);return K!==T&&(L=L.slice(0,K)),L}function M(j){const E=j.length<0?0:g(j.length)|0,T=ae(E);for(let L=0;L<E;L+=1)T[L]=j[L]&255;return T}function _(j){if(mt(j,q)){const E=new q(j);return I(E.buffer,E.byteOffset,E.byteLength)}return M(j)}function I(j,E,T){if(E<0||j.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<E+(T||0))throw new RangeError('"length" is outside of buffer bounds');let L;return E===void 0&&T===void 0?L=new q(j):T===void 0?L=new q(j,E):L=new q(j,E,T),Object.setPrototypeOf(L,z.prototype),L}function C(j){if(z.isBuffer(j)){const E=g(j.length)|0,T=ae(E);return T.length===0||j.copy(T,0,0,E),T}if(j.length!==void 0)return typeof j.length!="number"||Pt(j.length)?ae(0):M(j);if(j.type==="Buffer"&&Array.isArray(j.data))return M(j.data)}function g(j){if(j>=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.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,T){if(mt(E,q)&&(E=z.from(E,E.offset,E.byteLength)),mt(T,q)&&(T=z.from(T,T.offset,T.byteLength)),!z.isBuffer(E)||!z.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===T)return 0;let L=E.length,K=T.length;for(let J=0,re=Math.min(L,K);J<re;++J)if(E[J]!==T[J]){L=E[J],K=T[J];break}return L<K?-1:K<L?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,T){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return z.alloc(0);let L;if(T===void 0)for(T=0,L=0;L<E.length;++L)T+=E[L].length;const K=z.allocUnsafe(T);let J=0;for(L=0;L<E.length;++L){let re=E[L];if(mt(re,q))J+re.length>K.length?(z.isBuffer(re)||(re=z.from(re)),re.copy(K,J)):q.prototype.set.call(K,re,J);else if(z.isBuffer(re))re.copy(K,J);else throw new TypeError('"list" argument must be an Array of Buffers');J+=re.length}return K};function N(j,E){if(z.isBuffer(j))return j.length;if(Y.isView(j)||mt(j,Y))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 T=j.length,L=arguments.length>2&&arguments[2]===!0;if(!L&&T===0)return 0;let K=!1;for(;;)switch(E){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return Ot(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Mt(j).length;default:if(K)return L?-1:Ot(j).length;E=(""+E).toLowerCase(),K=!0}}z.byteLength=N;function ee(j,E,T){let L=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,E>>>=0,T<=E))return"";for(j||(j="utf8");;)switch(j){case"hex":return Ue(this,E,T);case"utf8":case"utf-8":return je(this,E,T);case"ascii":return he(this,E,T);case"latin1":case"binary":return Ce(this,E,T);case"base64":return dt(this,E,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ne(this,E,T);default:if(L)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),L=!0}}z.prototype._isBuffer=!0;function ie(j,E,T){const L=j[E];j[E]=j[T],j[T]=L}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 T=0;T<E;T+=2)ie(this,T,T+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 T=0;T<E;T+=4)ie(this,T,T+3),ie(this,T+1,T+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 T=0;T<E;T+=8)ie(this,T,T+7),ie(this,T+1,T+6),ie(this,T+2,T+5),ie(this,T+3,T+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 T=R.INSPECT_MAX_BYTES;return E=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(E+=" ... "),"<Buffer "+E+">"},$&&(z.prototype[$]=z.prototype.inspect),z.prototype.compare=function(E,T,L,K,J){if(mt(E,q)&&(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(T===void 0&&(T=0),L===void 0&&(L=E?E.length:0),K===void 0&&(K=0),J===void 0&&(J=this.length),T<0||L>E.length||K<0||J>this.length)throw new RangeError("out of range index");if(K>=J&&T>=L)return 0;if(K>=J)return-1;if(T>=L)return 1;if(T>>>=0,L>>>=0,K>>>=0,J>>>=0,this===E)return 0;let re=J-K,ke=L-T;const Je=Math.min(re,ke),Re=this.slice(K,J),V=E.slice(T,L);for(let oe=0;oe<Je;++oe)if(Re[oe]!==V[oe]){re=Re[oe],ke=V[oe];break}return re<ke?-1:ke<re?1:0};function le(j,E,T,L,K){if(j.length===0)return-1;if(typeof T=="string"?(L=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,Pt(T)&&(T=K?0:j.length-1),T<0&&(T=j.length+T),T>=j.length){if(K)return-1;T=j.length-1}else if(T<0)if(K)T=0;else return-1;if(typeof E=="string"&&(E=z.from(E,L)),z.isBuffer(E))return E.length===0?-1:me(j,E,T,L,K);if(typeof E=="number")return E=E&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(j,E,T):q.prototype.lastIndexOf.call(j,E,T):me(j,[E],T,L,K);throw new TypeError("val must be string, number or Buffer")}function me(j,E,T,L,K){let J=1,re=j.length,ke=E.length;if(L!==void 0&&(L=String(L).toLowerCase(),L==="ucs2"||L==="ucs-2"||L==="utf16le"||L==="utf-16le")){if(j.length<2||E.length<2)return-1;J=2,re/=2,ke/=2,T/=2}function Je(V,oe){return J===1?V[oe]:V.readUInt16BE(oe*J)}let Re;if(K){let V=-1;for(Re=T;Re<re;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(T+ke>re&&(T=re-ke),Re=T;Re>=0;Re--){let V=!0;for(let oe=0;oe<ke;oe++)if(Je(j,Re+oe)!==Je(E,oe)){V=!1;break}if(V)return Re}return-1}z.prototype.includes=function(E,T,L){return this.indexOf(E,T,L)!==-1},z.prototype.indexOf=function(E,T,L){return le(this,E,T,L,!0)},z.prototype.lastIndexOf=function(E,T,L){return le(this,E,T,L,!1)};function xe(j,E,T,L){T=Number(T)||0;const K=j.length-T;L?(L=Number(L),L>K&&(L=K)):L=K;const J=E.length;L>J/2&&(L=J/2);let re;for(re=0;re<L;++re){const ke=parseInt(E.substr(re*2,2),16);if(Pt(ke))return re;j[T+re]=ke}return re}function be(j,E,T,L){return Ge(Ot(E,j.length-T),j,T,L)}function Ve(j,E,T,L){return Ge(et(E),j,T,L)}function Le(j,E,T,L){return Ge(Mt(E),j,T,L)}function ft(j,E,T,L){return Ge(xt(E,j.length-T),j,T,L)}z.prototype.write=function(E,T,L,K){if(T===void 0)K="utf8",L=this.length,T=0;else if(L===void 0&&typeof T=="string")K=T,L=this.length,T=0;else if(isFinite(T))T=T>>>0,isFinite(L)?(L=L>>>0,K===void 0&&(K="utf8")):(K=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const J=this.length-T;if((L===void 0||L>J)&&(L=J),E.length>0&&(L<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let re=!1;for(;;)switch(K){case"hex":return xe(this,E,T,L);case"utf8":case"utf-8":return be(this,E,T,L);case"ascii":case"latin1":case"binary":return Ve(this,E,T,L);case"base64":return Le(this,E,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ft(this,E,T,L);default:if(re)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),re=!0}},z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(j,E,T){return E===0&&T===j.length?k.fromByteArray(j):k.fromByteArray(j.slice(E,T))}function je(j,E,T){T=Math.min(j.length,T);const L=[];let K=E;for(;K<T;){const J=j[K];let re=null,ke=J>239?4:J>223?3:J>191?2:1;if(K+ke<=T){let Je,Re,V,oe;switch(ke){case 1:J<128&&(re=J);break;case 2:Je=j[K+1],(Je&192)===128&&(oe=(J&31)<<6|Je&63,oe>127&&(re=oe));break;case 3:Je=j[K+1],Re=j[K+2],(Je&192)===128&&(Re&192)===128&&(oe=(J&15)<<12|(Je&63)<<6|Re&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:Je=j[K+1],Re=j[K+2],V=j[K+3],(Je&192)===128&&(Re&192)===128&&(V&192)===128&&(oe=(J&15)<<18|(Je&63)<<12|(Re&63)<<6|V&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,ke=1):re>65535&&(re-=65536,L.push(re>>>10&1023|55296),re=56320|re&1023),L.push(re),K+=ke}return we(L)}const pt=4096;function we(j){const E=j.length;if(E<=pt)return String.fromCharCode.apply(String,j);let T="",L=0;for(;L<E;)T+=String.fromCharCode.apply(String,j.slice(L,L+=pt));return T}function he(j,E,T){let L="";T=Math.min(j.length,T);for(let K=E;K<T;++K)L+=String.fromCharCode(j[K]&127);return L}function Ce(j,E,T){let L="";T=Math.min(j.length,T);for(let K=E;K<T;++K)L+=String.fromCharCode(j[K]);return L}function Ue(j,E,T){const L=j.length;(!E||E<0)&&(E=0),(!T||T<0||T>L)&&(T=L);let K="";for(let J=E;J<T;++J)K+=nt[j[J]];return K}function Ne(j,E,T){const L=j.slice(E,T);let K="";for(let J=0;J<L.length-1;J+=2)K+=String.fromCharCode(L[J]+L[J+1]*256);return K}z.prototype.slice=function(E,T){const L=this.length;E=~~E,T=T===void 0?L:~~T,E<0?(E+=L,E<0&&(E=0)):E>L&&(E=L),T<0?(T+=L,T<0&&(T=0)):T>L&&(T=L),T<E&&(T=E);const K=this.subarray(E,T);return Object.setPrototypeOf(K,z.prototype),K};function Me(j,E,T){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+E>T)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(E,T,L){E=E>>>0,T=T>>>0,L||Me(E,T,this.length);let K=this[E],J=1,re=0;for(;++re<T&&(J*=256);)K+=this[E+re]*J;return K},z.prototype.readUintBE=z.prototype.readUIntBE=function(E,T,L){E=E>>>0,T=T>>>0,L||Me(E,T,this.length);let K=this[E+--T],J=1;for(;T>0&&(J*=256);)K+=this[E+--T]*J;return K},z.prototype.readUint8=z.prototype.readUInt8=function(E,T){return E=E>>>0,T||Me(E,1,this.length),this[E]},z.prototype.readUint16LE=z.prototype.readUInt16LE=function(E,T){return E=E>>>0,T||Me(E,2,this.length),this[E]|this[E+1]<<8},z.prototype.readUint16BE=z.prototype.readUInt16BE=function(E,T){return E=E>>>0,T||Me(E,2,this.length),this[E]<<8|this[E+1]},z.prototype.readUint32LE=z.prototype.readUInt32LE=function(E,T){return E=E>>>0,T||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,T){return E=E>>>0,T||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 T=this[E],L=this[E+7];(T===void 0||L===void 0)&&It(E,this.length-8);const K=T+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24,J=this[++E]+this[++E]*2**8+this[++E]*2**16+L*2**24;return BigInt(K)+(BigInt(J)<<BigInt(32))}),z.prototype.readBigUInt64BE=St(function(E){E=E>>>0,_t(E,"offset");const T=this[E],L=this[E+7];(T===void 0||L===void 0)&&It(E,this.length-8);const K=T*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+L;return(BigInt(K)<<BigInt(32))+BigInt(J)}),z.prototype.readIntLE=function(E,T,L){E=E>>>0,T=T>>>0,L||Me(E,T,this.length);let K=this[E],J=1,re=0;for(;++re<T&&(J*=256);)K+=this[E+re]*J;return J*=128,K>=J&&(K-=Math.pow(2,8*T)),K},z.prototype.readIntBE=function(E,T,L){E=E>>>0,T=T>>>0,L||Me(E,T,this.length);let K=T,J=1,re=this[E+--K];for(;K>0&&(J*=256);)re+=this[E+--K]*J;return J*=128,re>=J&&(re-=Math.pow(2,8*T)),re},z.prototype.readInt8=function(E,T){return E=E>>>0,T||Me(E,1,this.length),this[E]&128?(255-this[E]+1)*-1:this[E]},z.prototype.readInt16LE=function(E,T){E=E>>>0,T||Me(E,2,this.length);const L=this[E]|this[E+1]<<8;return L&32768?L|4294901760:L},z.prototype.readInt16BE=function(E,T){E=E>>>0,T||Me(E,2,this.length);const L=this[E+1]|this[E]<<8;return L&32768?L|4294901760:L},z.prototype.readInt32LE=function(E,T){return E=E>>>0,T||Me(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},z.prototype.readInt32BE=function(E,T){return E=E>>>0,T||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 T=this[E],L=this[E+7];(T===void 0||L===void 0)&&It(E,this.length-8);const K=this[E+4]+this[E+5]*2**8+this[E+6]*2**16+(L<<24);return(BigInt(K)<<BigInt(32))+BigInt(T+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 T=this[E],L=this[E+7];(T===void 0||L===void 0)&&It(E,this.length-8);const K=(T<<24)+this[++E]*2**16+this[++E]*2**8+this[++E];return(BigInt(K)<<BigInt(32))+BigInt(this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+L)}),z.prototype.readFloatLE=function(E,T){return E=E>>>0,T||Me(E,4,this.length),F.read(this,E,!0,23,4)},z.prototype.readFloatBE=function(E,T){return E=E>>>0,T||Me(E,4,this.length),F.read(this,E,!1,23,4)},z.prototype.readDoubleLE=function(E,T){return E=E>>>0,T||Me(E,8,this.length),F.read(this,E,!0,52,8)},z.prototype.readDoubleBE=function(E,T){return E=E>>>0,T||Me(E,8,this.length),F.read(this,E,!1,52,8)};function Ae(j,E,T,L,K,J){if(!z.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>K||E<J)throw new RangeError('"value" argument is out of bounds');if(T+L>j.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(E,T,L,K){if(E=+E,T=T>>>0,L=L>>>0,!K){const ke=Math.pow(2,8*L)-1;Ae(this,E,T,L,ke,0)}let J=1,re=0;for(this[T]=E&255;++re<L&&(J*=256);)this[T+re]=E/J&255;return T+L},z.prototype.writeUintBE=z.prototype.writeUIntBE=function(E,T,L,K){if(E=+E,T=T>>>0,L=L>>>0,!K){const ke=Math.pow(2,8*L)-1;Ae(this,E,T,L,ke,0)}let J=L-1,re=1;for(this[T+J]=E&255;--J>=0&&(re*=256);)this[T+J]=E/re&255;return T+L},z.prototype.writeUint8=z.prototype.writeUInt8=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,1,255,0),this[T]=E&255,T+1},z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,2,65535,0),this[T]=E&255,this[T+1]=E>>>8,T+2},z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,2,65535,0),this[T]=E>>>8,this[T+1]=E&255,T+2},z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,4,4294967295,0),this[T+3]=E>>>24,this[T+2]=E>>>16,this[T+1]=E>>>8,this[T]=E&255,T+4},z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,4,4294967295,0),this[T]=E>>>24,this[T+1]=E>>>16,this[T+2]=E>>>8,this[T+3]=E&255,T+4};function Be(j,E,T,L,K){Qe(E,L,K,j,T,7);let J=Number(E&BigInt(4294967295));j[T++]=J,J=J>>8,j[T++]=J,J=J>>8,j[T++]=J,J=J>>8,j[T++]=J;let re=Number(E>>BigInt(32)&BigInt(4294967295));return j[T++]=re,re=re>>8,j[T++]=re,re=re>>8,j[T++]=re,re=re>>8,j[T++]=re,T}function ut(j,E,T,L,K){Qe(E,L,K,j,T,7);let J=Number(E&BigInt(4294967295));j[T+7]=J,J=J>>8,j[T+6]=J,J=J>>8,j[T+5]=J,J=J>>8,j[T+4]=J;let re=Number(E>>BigInt(32)&BigInt(4294967295));return j[T+3]=re,re=re>>8,j[T+2]=re,re=re>>8,j[T+1]=re,re=re>>8,j[T]=re,T+8}z.prototype.writeBigUInt64LE=St(function(E,T=0){return Be(this,E,T,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeBigUInt64BE=St(function(E,T=0){return ut(this,E,T,BigInt(0),BigInt("0xffffffffffffffff"))}),z.prototype.writeIntLE=function(E,T,L,K){if(E=+E,T=T>>>0,!K){const Je=Math.pow(2,8*L-1);Ae(this,E,T,L,Je-1,-Je)}let J=0,re=1,ke=0;for(this[T]=E&255;++J<L&&(re*=256);)E<0&&ke===0&&this[T+J-1]!==0&&(ke=1),this[T+J]=(E/re>>0)-ke&255;return T+L},z.prototype.writeIntBE=function(E,T,L,K){if(E=+E,T=T>>>0,!K){const Je=Math.pow(2,8*L-1);Ae(this,E,T,L,Je-1,-Je)}let J=L-1,re=1,ke=0;for(this[T+J]=E&255;--J>=0&&(re*=256);)E<0&&ke===0&&this[T+J+1]!==0&&(ke=1),this[T+J]=(E/re>>0)-ke&255;return T+L},z.prototype.writeInt8=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,1,127,-128),E<0&&(E=255+E+1),this[T]=E&255,T+1},z.prototype.writeInt16LE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,2,32767,-32768),this[T]=E&255,this[T+1]=E>>>8,T+2},z.prototype.writeInt16BE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,2,32767,-32768),this[T]=E>>>8,this[T+1]=E&255,T+2},z.prototype.writeInt32LE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,4,2147483647,-2147483648),this[T]=E&255,this[T+1]=E>>>8,this[T+2]=E>>>16,this[T+3]=E>>>24,T+4},z.prototype.writeInt32BE=function(E,T,L){return E=+E,T=T>>>0,L||Ae(this,E,T,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[T]=E>>>24,this[T+1]=E>>>16,this[T+2]=E>>>8,this[T+3]=E&255,T+4},z.prototype.writeBigInt64LE=St(function(E,T=0){return Be(this,E,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),z.prototype.writeBigInt64BE=St(function(E,T=0){return ut(this,E,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(j,E,T,L,K,J){if(T+L>j.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function ze(j,E,T,L,K){return E=+E,T=T>>>0,K||lt(j,E,T,4),F.write(j,E,T,L,23,4),T+4}z.prototype.writeFloatLE=function(E,T,L){return ze(this,E,T,!0,L)},z.prototype.writeFloatBE=function(E,T,L){return ze(this,E,T,!1,L)};function Nt(j,E,T,L,K){return E=+E,T=T>>>0,K||lt(j,E,T,8),F.write(j,E,T,L,52,8),T+8}z.prototype.writeDoubleLE=function(E,T,L){return Nt(this,E,T,!0,L)},z.prototype.writeDoubleBE=function(E,T,L){return Nt(this,E,T,!1,L)},z.prototype.copy=function(E,T,L,K){if(!z.isBuffer(E))throw new TypeError("argument should be a Buffer");if(L||(L=0),!K&&K!==0&&(K=this.length),T>=E.length&&(T=E.length),T||(T=0),K>0&&K<L&&(K=L),K===L||E.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("sourceEnd out of bounds");K>this.length&&(K=this.length),E.length-T<K-L&&(K=E.length-T+L);const J=K-L;return this===E&&typeof q.prototype.copyWithin=="function"?this.copyWithin(T,L,K):q.prototype.set.call(E,this.subarray(L,K),T),J},z.prototype.fill=function(E,T,L,K){if(typeof E=="string"){if(typeof T=="string"?(K=T,T=0,L=this.length):typeof L=="string"&&(K=L,L=this.length),K!==void 0&&typeof K!="string")throw new TypeError("encoding must be a string");if(typeof K=="string"&&!z.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(E.length===1){const re=E.charCodeAt(0);(K==="utf8"&&re<128||K==="latin1")&&(E=re)}}else typeof E=="number"?E=E&255:typeof E=="boolean"&&(E=Number(E));if(T<0||this.length<T||this.length<L)throw new RangeError("Out of range index");if(L<=T)return this;T=T>>>0,L=L===void 0?this.length:L>>>0,E||(E=0);let J;if(typeof E=="number")for(J=T;J<L;++J)this[J]=E;else{const re=z.isBuffer(E)?E:z.from(E,K),ke=re.length;if(ke===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(J=0;J<L-T;++J)this[J+T]=re[J%ke]}return this};const Et={};function Ze(j,E,T){Et[j]=class extends T{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(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,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,T){let L=`The value of "${j}" is out of range.`,K=T;return Number.isInteger(T)&&Math.abs(T)>2**32?K=At(String(T)):typeof T=="bigint"&&(K=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(K=At(K)),K+="n"),L+=` It must be ${E}. Received ${K}`,L},RangeError);function At(j){let E="",T=j.length;const L=j[0]==="-"?1:0;for(;T>=L+4;T-=3)E=`_${j.slice(T-3,T)}${E}`;return`${j.slice(0,T)}${E}`}function Ft(j,E,T){_t(E,"offset"),(j[E]===void 0||j[E+T]===void 0)&&It(E,j.length-(T+1))}function Qe(j,E,T,L,K,J){if(j>T||j<E){const re=typeof E=="bigint"?"n":"";let ke;throw J>3?E===0||E===BigInt(0)?ke=`>= 0${re} and < 2${re} ** ${(J+1)*8}${re}`:ke=`>= -(2${re} ** ${(J+1)*8-1}${re}) and < 2 ** ${(J+1)*8-1}${re}`:ke=`>= ${E}${re} and <= ${T}${re}`,new Et.ERR_OUT_OF_RANGE("value",ke,j)}Ft(L,K,J)}function _t(j,E){if(typeof j!="number")throw new Et.ERR_INVALID_ARG_TYPE(E,"number",j)}function It(j,E,T){throw Math.floor(j)!==j?(_t(j,T),new Et.ERR_OUT_OF_RANGE(T||"offset","an integer",j)):E<0?new Et.ERR_BUFFER_OUT_OF_BOUNDS:new Et.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${E}`,j)}const rt=/[^+/0-9A-Za-z-_]/g;function jt(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 Ot(j,E){E=E||1/0;let T;const L=j.length;let K=null;const J=[];for(let re=0;re<L;++re){if(T=j.charCodeAt(re),T>55295&&T<57344){if(!K){if(T>56319){(E-=3)>-1&&J.push(239,191,189);continue}else if(re+1===L){(E-=3)>-1&&J.push(239,191,189);continue}K=T;continue}if(T<56320){(E-=3)>-1&&J.push(239,191,189),K=T;continue}T=(K-55296<<10|T-56320)+65536}else K&&(E-=3)>-1&&J.push(239,191,189);if(K=null,T<128){if((E-=1)<0)break;J.push(T)}else if(T<2048){if((E-=2)<0)break;J.push(T>>6|192,T&63|128)}else if(T<65536){if((E-=3)<0)break;J.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((E-=4)<0)break;J.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return J}function et(j){const E=[];for(let T=0;T<j.length;++T)E.push(j.charCodeAt(T)&255);return E}function xt(j,E){let T,L,K;const J=[];for(let re=0;re<j.length&&!((E-=2)<0);++re)T=j.charCodeAt(re),L=T>>8,K=T%256,J.push(K),J.push(L);return J}function Mt(j){return k.toByteArray(jt(j))}function Ge(j,E,T,L){let K;for(K=0;K<L&&!(K+T>=E.length||K>=j.length);++K)E[K+T]=j[K];return K}function mt(j,E){return j instanceof E||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===E.name}function Pt(j){return j!==j}const nt=function(){const j="0123456789abcdef",E=new Array(256);for(let T=0;T<16;++T){const L=T*16;for(let K=0;K<16;++K)E[L+K]=j[T]+j[K]}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 E8=cc();const zl=ks(E8);var nn={},ql={exports:{}};ql.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],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,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=x[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 A(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,pt=S[4]|0,we=pt&8191,he=pt>>>13,Ce=S[5]|0,Ue=Ce&8191,Ne=Ce>>>13,Me=S[6]|0,Ae=Me&8191,Be=Me>>>13,ut=S[7]|0,lt=ut&8191,ze=ut>>>13,Nt=S[8]|0,Et=Nt&8191,Ze=Nt>>>13,At=S[9]|0,Ft=At&8191,Qe=At>>>13,_t=M[0]|0,It=_t&8191,rt=_t>>>13,jt=M[1]|0,Ot=jt&8191,et=jt>>>13,xt=M[2]|0,Mt=xt&8191,Ge=xt>>>13,mt=M[3]|0,Pt=mt&8191,nt=mt>>>13,St=M[4]|0,zt=St&8191,j=St>>>13,E=M[5]|0,T=E&8191,L=E>>>13,K=M[6]|0,J=K&8191,re=K>>>13,ke=M[7]|0,Je=ke&8191,Re=ke>>>13,V=M[8]|0,oe=V&8191,fe=V>>>13,Oe=M[9]|0,qe=Oe&8191,Pe=Oe>>>13;m.negative=h.negative^f.negative,m.length=19,C=Math.imul(ee,It),g=Math.imul(ee,rt),g=g+Math.imul(ie,It)|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,It),g=Math.imul(me,rt),g=g+Math.imul(xe,It)|0,v=Math.imul(xe,rt),C=C+Math.imul(ee,Ot)|0,g=g+Math.imul(ee,et)|0,g=g+Math.imul(ie,Ot)|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,It),g=Math.imul(Ve,rt),g=g+Math.imul(Le,It)|0,v=Math.imul(Le,rt),C=C+Math.imul(me,Ot)|0,g=g+Math.imul(me,et)|0,g=g+Math.imul(xe,Ot)|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,It),g=Math.imul(dt,rt),g=g+Math.imul(je,It)|0,v=Math.imul(je,rt),C=C+Math.imul(Ve,Ot)|0,g=g+Math.imul(Ve,et)|0,g=g+Math.imul(Le,Ot)|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,Pt)|0,g=g+Math.imul(ee,nt)|0,g=g+Math.imul(ie,Pt)|0,v=v+Math.imul(ie,nt)|0;var kt=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(kt>>>26)|0,kt&=67108863,C=Math.imul(we,It),g=Math.imul(we,rt),g=g+Math.imul(he,It)|0,v=Math.imul(he,rt),C=C+Math.imul(dt,Ot)|0,g=g+Math.imul(dt,et)|0,g=g+Math.imul(je,Ot)|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,Pt)|0,g=g+Math.imul(me,nt)|0,g=g+Math.imul(xe,Pt)|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,It),g=Math.imul(Ue,rt),g=g+Math.imul(Ne,It)|0,v=Math.imul(Ne,rt),C=C+Math.imul(we,Ot)|0,g=g+Math.imul(we,et)|0,g=g+Math.imul(he,Ot)|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,Pt)|0,g=g+Math.imul(Ve,nt)|0,g=g+Math.imul(Le,Pt)|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,T)|0,g=g+Math.imul(ee,L)|0,g=g+Math.imul(ie,T)|0,v=v+Math.imul(ie,L)|0;var cr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(cr>>>26)|0,cr&=67108863,C=Math.imul(Ae,It),g=Math.imul(Ae,rt),g=g+Math.imul(Be,It)|0,v=Math.imul(Be,rt),C=C+Math.imul(Ue,Ot)|0,g=g+Math.imul(Ue,et)|0,g=g+Math.imul(Ne,Ot)|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,Pt)|0,g=g+Math.imul(dt,nt)|0,g=g+Math.imul(je,Pt)|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,T)|0,g=g+Math.imul(me,L)|0,g=g+Math.imul(xe,T)|0,v=v+Math.imul(xe,L)|0,C=C+Math.imul(ee,J)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(ie,J)|0,v=v+Math.imul(ie,re)|0;var Tr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,C=Math.imul(lt,It),g=Math.imul(lt,rt),g=g+Math.imul(ze,It)|0,v=Math.imul(ze,rt),C=C+Math.imul(Ae,Ot)|0,g=g+Math.imul(Ae,et)|0,g=g+Math.imul(Be,Ot)|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,Pt)|0,g=g+Math.imul(we,nt)|0,g=g+Math.imul(he,Pt)|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,T)|0,g=g+Math.imul(Ve,L)|0,g=g+Math.imul(Le,T)|0,v=v+Math.imul(Le,L)|0,C=C+Math.imul(me,J)|0,g=g+Math.imul(me,re)|0,g=g+Math.imul(xe,J)|0,v=v+Math.imul(xe,re)|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 lr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(lr>>>26)|0,lr&=67108863,C=Math.imul(Et,It),g=Math.imul(Et,rt),g=g+Math.imul(Ze,It)|0,v=Math.imul(Ze,rt),C=C+Math.imul(lt,Ot)|0,g=g+Math.imul(lt,et)|0,g=g+Math.imul(ze,Ot)|0,v=v+Math.imul(ze,et)|0,C=C+Math.imul(Ae,Mt)|0,g=g+Math.imul(Ae,Ge)|0,g=g+Math.imul(Be,Mt)|0,v=v+Math.imul(Be,Ge)|0,C=C+Math.imul(Ue,Pt)|0,g=g+Math.imul(Ue,nt)|0,g=g+Math.imul(Ne,Pt)|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,T)|0,g=g+Math.imul(dt,L)|0,g=g+Math.imul(je,T)|0,v=v+Math.imul(je,L)|0,C=C+Math.imul(Ve,J)|0,g=g+Math.imul(Ve,re)|0,g=g+Math.imul(Le,J)|0,v=v+Math.imul(Le,re)|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,oe)|0,g=g+Math.imul(ee,fe)|0,g=g+Math.imul(ie,oe)|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,It),g=Math.imul(Ft,rt),g=g+Math.imul(Qe,It)|0,v=Math.imul(Qe,rt),C=C+Math.imul(Et,Ot)|0,g=g+Math.imul(Et,et)|0,g=g+Math.imul(Ze,Ot)|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(Ae,Pt)|0,g=g+Math.imul(Ae,nt)|0,g=g+Math.imul(Be,Pt)|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,T)|0,g=g+Math.imul(we,L)|0,g=g+Math.imul(he,T)|0,v=v+Math.imul(he,L)|0,C=C+Math.imul(dt,J)|0,g=g+Math.imul(dt,re)|0,g=g+Math.imul(je,J)|0,v=v+Math.imul(je,re)|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,oe)|0,g=g+Math.imul(me,fe)|0,g=g+Math.imul(xe,oe)|0,v=v+Math.imul(xe,fe)|0,C=C+Math.imul(ee,qe)|0,g=g+Math.imul(ee,Pe)|0,g=g+Math.imul(ie,qe)|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,Ot),g=Math.imul(Ft,et),g=g+Math.imul(Qe,Ot)|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,Pt)|0,g=g+Math.imul(lt,nt)|0,g=g+Math.imul(ze,Pt)|0,v=v+Math.imul(ze,nt)|0,C=C+Math.imul(Ae,zt)|0,g=g+Math.imul(Ae,j)|0,g=g+Math.imul(Be,zt)|0,v=v+Math.imul(Be,j)|0,C=C+Math.imul(Ue,T)|0,g=g+Math.imul(Ue,L)|0,g=g+Math.imul(Ne,T)|0,v=v+Math.imul(Ne,L)|0,C=C+Math.imul(we,J)|0,g=g+Math.imul(we,re)|0,g=g+Math.imul(he,J)|0,v=v+Math.imul(he,re)|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,oe)|0,g=g+Math.imul(Ve,fe)|0,g=g+Math.imul(Le,oe)|0,v=v+Math.imul(Le,fe)|0,C=C+Math.imul(me,qe)|0,g=g+Math.imul(me,Pe)|0,g=g+Math.imul(xe,qe)|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,Pt)|0,g=g+Math.imul(Et,nt)|0,g=g+Math.imul(Ze,Pt)|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(Ae,T)|0,g=g+Math.imul(Ae,L)|0,g=g+Math.imul(Be,T)|0,v=v+Math.imul(Be,L)|0,C=C+Math.imul(Ue,J)|0,g=g+Math.imul(Ue,re)|0,g=g+Math.imul(Ne,J)|0,v=v+Math.imul(Ne,re)|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,oe)|0,g=g+Math.imul(dt,fe)|0,g=g+Math.imul(je,oe)|0,v=v+Math.imul(je,fe)|0,C=C+Math.imul(Ve,qe)|0,g=g+Math.imul(Ve,Pe)|0,g=g+Math.imul(Le,qe)|0,v=v+Math.imul(Le,Pe)|0;var Gr=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,C=Math.imul(Ft,Pt),g=Math.imul(Ft,nt),g=g+Math.imul(Qe,Pt)|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,T)|0,g=g+Math.imul(lt,L)|0,g=g+Math.imul(ze,T)|0,v=v+Math.imul(ze,L)|0,C=C+Math.imul(Ae,J)|0,g=g+Math.imul(Ae,re)|0,g=g+Math.imul(Be,J)|0,v=v+Math.imul(Be,re)|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,oe)|0,g=g+Math.imul(we,fe)|0,g=g+Math.imul(he,oe)|0,v=v+Math.imul(he,fe)|0,C=C+Math.imul(dt,qe)|0,g=g+Math.imul(dt,Pe)|0,g=g+Math.imul(je,qe)|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,T)|0,g=g+Math.imul(Et,L)|0,g=g+Math.imul(Ze,T)|0,v=v+Math.imul(Ze,L)|0,C=C+Math.imul(lt,J)|0,g=g+Math.imul(lt,re)|0,g=g+Math.imul(ze,J)|0,v=v+Math.imul(ze,re)|0,C=C+Math.imul(Ae,Je)|0,g=g+Math.imul(Ae,Re)|0,g=g+Math.imul(Be,Je)|0,v=v+Math.imul(Be,Re)|0,C=C+Math.imul(Ue,oe)|0,g=g+Math.imul(Ue,fe)|0,g=g+Math.imul(Ne,oe)|0,v=v+Math.imul(Ne,fe)|0,C=C+Math.imul(we,qe)|0,g=g+Math.imul(we,Pe)|0,g=g+Math.imul(he,qe)|0,v=v+Math.imul(he,Pe)|0;var Ti=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,C=Math.imul(Ft,T),g=Math.imul(Ft,L),g=g+Math.imul(Qe,T)|0,v=Math.imul(Qe,L),C=C+Math.imul(Et,J)|0,g=g+Math.imul(Et,re)|0,g=g+Math.imul(Ze,J)|0,v=v+Math.imul(Ze,re)|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(Ae,oe)|0,g=g+Math.imul(Ae,fe)|0,g=g+Math.imul(Be,oe)|0,v=v+Math.imul(Be,fe)|0,C=C+Math.imul(Ue,qe)|0,g=g+Math.imul(Ue,Pe)|0,g=g+Math.imul(Ne,qe)|0,v=v+Math.imul(Ne,Pe)|0;var Ai=(I+C|0)+((g&8191)<<13)|0;I=(v+(g>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,C=Math.imul(Ft,J),g=Math.imul(Ft,re),g=g+Math.imul(Qe,J)|0,v=Math.imul(Qe,re),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,oe)|0,g=g+Math.imul(lt,fe)|0,g=g+Math.imul(ze,oe)|0,v=v+Math.imul(ze,fe)|0,C=C+Math.imul(Ae,qe)|0,g=g+Math.imul(Ae,Pe)|0,g=g+Math.imul(Be,qe)|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,oe)|0,g=g+Math.imul(Et,fe)|0,g=g+Math.imul(Ze,oe)|0,v=v+Math.imul(Ze,fe)|0,C=C+Math.imul(lt,qe)|0,g=g+Math.imul(lt,Pe)|0,g=g+Math.imul(ze,qe)|0,v=v+Math.imul(ze,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,oe),g=Math.imul(Ft,fe),g=g+Math.imul(Qe,oe)|0,v=Math.imul(Qe,fe),C=C+Math.imul(Et,qe)|0,g=g+Math.imul(Et,Pe)|0,g=g+Math.imul(Ze,qe)|0,v=v+Math.imul(Ze,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,qe),g=Math.imul(Ft,Pe),g=g+Math.imul(Qe,qe)|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]=kt,_[4]=Ut,_[5]=cr,_[6]=Tr,_[7]=lr,_[8]=er,_[9]=xr,_[10]=Rn,_[11]=Gr,_[12]=Nn,_[13]=Ti,_[14]=Ai,_[15]=jn,_[16]=Ii,_[17]=Oi,_[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=A(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 $={k256:null,p224:null,p192:null,p25519:null};function H(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()}H.prototype._tmp=function(){var h=new o(null);return h.words=new Array(Math.ceil(this.n/13)),h},H.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},H.prototype.split=function(h,f){h.iushrn(this.n,0,f)},H.prototype.imulK=function(h){return h.imul(this.k)};function q(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,H),q.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},q.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 Y(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(Y,H);function ne(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,H);function se(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(se,H),se.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($[h])return $[h];var f;if(h==="k256")f=new q;else if(h==="p224")f=new Y;else if(h==="p192")f=new ne;else if(h==="p25519")f=new se;else throw new Error("Unknown prime "+h);return $[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)}(ql);var bp=ql.exports;const xp=ks(bp);var _8=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nn,"__esModule",{value:!0}),nn.parseAccumulatorUpdateData=nn.sliceAccumulatorUpdateData=nn.parseTwapMessage=nn.parsePriceFeedMessage=nn.isAccumulatorUpdateData=void 0;const on=_8(bp),C8="504e4155",M8=1,T8=0,Hl=20,A8=0,I8=1;function Wl(e){return e.toString("hex").slice(0,8)===C8&&e[4]===M8&&e[5]===T8}nn.isAccumulatorUpdateData=Wl;function O8(e){let t=0;if(e.readUInt8(t)!==A8)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new on.default(e.subarray(t,t+8),"be");t+=8;const o=new on.default(e.subarray(t,t+8),"be");t+=8;const s=e.readInt32BE(t);t+=4;const a=new on.default(e.subarray(t,t+8),"be");t+=8;const c=new on.default(e.subarray(t,t+8),"be");t+=8;const u=new on.default(e.subarray(t,t+8),"be");t+=8;const l=new on.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}}nn.parsePriceFeedMessage=O8;function P8(e){let t=0;if(e.readUInt8(t)!==I8)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new on.default(e.subarray(t,t+16),"be");t+=16;const o=new on.default(e.subarray(t,t+16),"be");t+=16;const s=new on.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new on.default(e.subarray(t,t+8),"be");t+=8;const u=new on.default(e.subarray(t,t+8),"be");t+=8;const l=new on.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}}nn.parseTwapMessage=P8;function R8(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+=Hl*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)])}nn.sliceAccumulatorUpdateData=R8;function N8(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+Hl))),t+=Hl;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}}nn.parseAccumulatorUpdateData=N8,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=nn;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){gt(this,"conf");gt(this,"expo");gt(this,"price");gt(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){gt(this,"attestationTime");gt(this,"emitterChain");gt(this,"priceServiceReceiveTime");gt(this,"sequenceNumber");gt(this,"slot");gt(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 C2{constructor(a){gt(this,"emaPrice");gt(this,"id");gt(this,"metadata");gt(this,"vaa");gt(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 C2({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 Sp(e,t){return function(){return e.apply(t,arguments)}}const{toString:j8}=Object.prototype,{getPrototypeOf:Gl}=Object,uc=(e=>t=>{const r=j8.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),bn=e=>(e=e.toLowerCase(),t=>uc(t)===e),lc=e=>t=>typeof t===e,{isArray:Go}=Array,oa=lc("undefined");function k8(e){return e!==null&&!oa(e)&&e.constructor!==null&&!oa(e.constructor)&&Xr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ep=bn("ArrayBuffer");function D8(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ep(e.buffer),t}const B8=lc("string"),Xr=lc("function"),_p=lc("number"),fc=e=>e!==null&&typeof e=="object",L8=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)},$8=bn("Date"),F8=bn("File"),U8=bn("Blob"),V8=bn("FileList"),z8=e=>fc(e)&&Xr(e.pipe),q8=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Xr(e.append)&&((t=uc(e))==="formdata"||t==="object"&&Xr(e.toString)&&e.toString()==="[object FormData]"))},H8=bn("URLSearchParams"),[W8,G8,K8,Y8]=["ReadableStream","Request","Response","Headers"].map(bn),Z8=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]),Go(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 Cp(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 vo=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Dr)(),Mp=e=>!oa(e)&&e!==vo;function Kl(){const{caseless:e}=Mp(this)&&this||{},t={},r=(n,i)=>{const o=e&&Cp(t,i)||i;dc(t[o])&&dc(n)?t[o]=Kl(t[o],n):dc(n)?t[o]=Kl({},n):Go(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 X8=(e,t,r,{allOwnKeys:n}={})=>(sa(t,(i,o)=>{r&&Xr(i)?e[o]=Sp(i,r):e[o]=i},{allOwnKeys:n}),e),J8=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Q8=(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)},ex=(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},tx=(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},rx=e=>{if(!e)return null;if(Go(e))return e;let t=e.length;if(!_p(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},nx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Gl(Uint8Array)),ix=(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])}},ox=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},sx=bn("HTMLFormElement"),ax=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Tp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),cx=bn("RegExp"),Ap=(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)},ux=e=>{Ap(e,(t,r)=>{if(Xr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Xr(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+"'")})}})},lx=(e,t)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Go(e)?n(e):n(String(e).split(t)),r},fx=()=>{},dx=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Yl="abcdefghijklmnopqrstuvwxyz",Ip="0123456789",Op={DIGIT:Ip,ALPHA:Yl,ALPHA_DIGIT:Yl+Yl.toUpperCase()+Ip},hx=(e=16,t=Op.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function px(e){return!!(e&&Xr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const mx=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=Go(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)},gx=bn("AsyncFunction"),vx=e=>e&&(fc(e)||Xr(e))&&Xr(e.then)&&Xr(e.catch),Pp=((e,t)=>e?setImmediate:t?((r,n)=>(vo.addEventListener("message",({source:i,data:o})=>{i===vo&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),vo.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Xr(vo.postMessage)),yx=typeof queueMicrotask<"u"?queueMicrotask.bind(vo):typeof hn<"u"&&hn.nextTick||Pp;var ce={isArray:Go,isArrayBuffer:Ep,isBuffer:k8,isFormData:q8,isArrayBufferView:D8,isString:B8,isNumber:_p,isBoolean:L8,isObject:fc,isPlainObject:dc,isReadableStream:W8,isRequest:G8,isResponse:K8,isHeaders:Y8,isUndefined:oa,isDate:$8,isFile:F8,isBlob:U8,isRegExp:cx,isFunction:Xr,isStream:z8,isURLSearchParams:H8,isTypedArray:nx,isFileList:V8,forEach:sa,merge:Kl,extend:X8,trim:Z8,stripBOM:J8,inherits:Q8,toFlatObject:ex,kindOf:uc,kindOfTest:bn,endsWith:tx,toArray:rx,forEachEntry:ix,matchAll:ox,isHTMLForm:sx,hasOwnProperty:Tp,hasOwnProp:Tp,reduceDescriptors:Ap,freezeMethods:ux,toObjectSet:lx,toCamelCase:ax,noop:fx,toFiniteNumber:dx,findKey:Cp,global:vo,isContextDefined:Mp,ALPHABET:Op,generateString:hx,isSpecCompliantForm:px,toJSONObject:mx,isAsyncFn:gx,isThenable:vx,setImmediate:Pp,asap:yx};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 Rp=ht.prototype,Np={};["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=>{Np[e]={value:e}}),Object.defineProperties(ht,Np),Object.defineProperty(Rp,"isAxiosError",{value:!0}),ht.from=(e,t,r,n,i,o)=>{const s=Object.create(Rp);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 wx=null;function Zl(e){return ce.isPlainObject(e)||ce.isArray(e)}function jp(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function kp(e,t,r){return e?e.concat(t).map(function(i,o){return i=jp(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function bx(e){return ce.isArray(e)&&!e.some(Zl)}const xx=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,A){return!ce.isUndefined(A[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,A){let O=x;if(x&&!A&&typeof x=="object"){if(ce.endsWith(y,"{}"))y=n?y:y.slice(0,-2),x=JSON.stringify(x);else if(ce.isArray(x)&&bx(x)||(ce.isFileList(x)||ce.endsWith(y,"[]"))&&(O=ce.toArray(x)))return y=jp(y),O.forEach(function(k,F){!(ce.isUndefined(k)||k===null)&&t.append(s===!0?kp([y],F,o):s===null?y:y+"[]",u(k))}),!1}return Zl(x)?!0:(t.append(kp(A,y,o),u(x)),!1)}const d=[],p=Object.assign(xx,{defaultVisitor:l,convertValue:u,isVisitable:Zl});function w(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,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 Dp(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 Bp=Xl.prototype;Bp.append=function(t,r){this._pairs.push([t,r])},Bp.toString=function(t){const r=t?function(n){return t.call(this,n,Dp)}:Dp;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Sx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lp(e,t,r){if(!t)return e;const n=r&&r.encode||Sx;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 Ex{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 $p=Ex,Fp={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_x=typeof URLSearchParams<"u"?URLSearchParams:Xl,Cx=typeof FormData<"u"?FormData:null,Mx=typeof Blob<"u"?Blob:null,Tx={isBrowser:!0,classes:{URLSearchParams:_x,FormData:Cx,Blob:Mx},protocols:["http","https","file","blob","url","data"]};const Jl=typeof window<"u"&&typeof document<"u",Ql=typeof navigator=="object"&&navigator||void 0,Ax=Jl&&(!Ql||["ReactNative","NativeScript","NS"].indexOf(Ql.product)<0),Ix=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Ox=Jl&&window.location.href||"http://localhost";var Px=Object.freeze({__proto__:null,hasBrowserEnv:Jl,hasStandardBrowserWebWorkerEnv:Ix,hasStandardBrowserEnv:Ax,navigator:Ql,origin:Ox}),Or={...Px,...Tx};function Rx(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 Nx(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function jx(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 Up(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]=jx(i[s])),!a)}if(ce.isFormData(e)&&ce.isFunction(e.entries)){const r={};return ce.forEachEntry(e,(n,i)=>{t(Nx(n),i,r,0)}),r}return null}function kx(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:Fp,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(Up(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 Rx(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),kx(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 Dx=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 Bx=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]&&Dx[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const Vp=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 Lx(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 $x=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 Fx(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Ux(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())&&!$x(t))s(Bx(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 Lx(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?Fx(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[Vp]=this[Vp]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=aa(s);n[a]||(Ux(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 xn=mc;function nf(e,t){const r=this||tf,n=t||r,i=xn.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 zp(e){return!!(e&&e.__CANCEL__)}function Ko(e,t,r){ht.call(this,e??"canceled",ht.ERR_CANCELED,t,r),this.name="CanceledError"}ce.inherits(Ko,ht,{__CANCEL__:!0});function qp(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 Vx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zx(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 qx(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=zx(50,250);return qx(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)},Hp=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Wp=e=>(...t)=>ce.asap(()=>e(...t));var Hx=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,Wx=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 Gx(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Kx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Gp(e,t){return e&&!Gx(t)?Kx(e,t):t}const Kp=e=>e instanceof xn?{...e}:e;function yo(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(Kp(u),Kp(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 Yp=e=>{const t=yo({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=xn.from(s),t.url=Lp(Gp(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&&Hx(t.url))){const u=i&&o&&Wx.read(o);u&&s.set(i,u)}return t},Yx=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=Yp(e);let o=i.data;const s=xn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,d,p,w,x;function y(){w&&w(),x&&x(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function O(){if(!A)return;const k=xn.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),$={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:k,config:e,request:A};qp(function(q){r(q),y()},function(q){n(q),y()},$),A=null}"onloadend"in A?A.onloadend=O:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(O)},A.onabort=function(){A&&(n(new ht("Request aborted",ht.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new ht("Network Error",ht.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const $=i.transitional||Fp;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new ht(F,$.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,e,A)),A=null},o===void 0&&s.setContentType(null),"setRequestHeader"in A&&ce.forEach(s.toJSON(),function(F,$){A.setRequestHeader($,F)}),ce.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([p,x]=gc(u,!0),A.addEventListener("progress",p)),c&&A.upload&&([d,w]=gc(c),A.upload.addEventListener("progress",d),A.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(l=k=>{A&&(n(!k||k.type?new Ko(null,e,A):k),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=Vx(i.url);if(R&&Or.protocols.indexOf(R)===-1){n(new ht("Unsupported protocol "+R+":",ht.ERR_BAD_REQUEST,e));return}A.send(o||null)})},Zx=(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 Ko(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 Xx=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},Jx=async function*(e,t){for await(const r of Qx(e))yield*Xx(r,t)},Qx=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()}},Zp=(e,t,r,n)=>{const i=Jx(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",Xp=vc&&typeof ReadableStream=="function",e3=vc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Jp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},t3=Xp&&Jp(()=>{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}),Qp=64*1024,of=Xp&&Jp(()=>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 r3=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 e3(e)).byteLength},n3=async(e,t)=>{const r=ce.toFiniteNumber(e.getContentLength());return r??r3(t)};var i3=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}=Yp(e);u=u?(u+"").toLowerCase():"text";let w=Zx([i,o&&o.toAbortSignal()],s),x;const y=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let A;try{if(c&&t3&&r!=="get"&&r!=="head"&&(A=await n3(l,n))!==0){let $=new Request(t,{method:"POST",body:n,duplex:"half"}),H;if(ce.isFormData(n)&&(H=$.headers.get("content-type"))&&l.setContentType(H),$.body){const[q,Y]=Hp(A,gc(Wp(c)));n=Zp($.body,Qp,q,Y)}}ce.isString(d)||(d=d?"include":"omit");const O="credentials"in Request.prototype;x=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(x);const k=of&&(u==="stream"||u==="response");if(of&&(a||k&&y)){const $={};["status","statusText","headers"].forEach(ne=>{$[ne]=R[ne]});const H=ce.toFiniteNumber(R.headers.get("content-length")),[q,Y]=a&&Hp(H,gc(Wp(a),!0))||[];R=new Response(Zp(R.body,Qp,q,()=>{Y&&Y(),y&&y()}),$)}u=u||"text";let F=await yc[ce.findKey(yc,u)||"text"](R,e);return!k&&y&&y(),await new Promise(($,H)=>{qp($,H,{data:F,headers:xn.from(R.headers),status:R.status,statusText:R.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 sf={http:wx,xhr:Yx,fetch:i3};ce.forEach(sf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const em=e=>`- ${e}`,o3=e=>ce.isFunction(e)||e===null||e===!1;var tm={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,!o3(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(em).join(`
33
+ `):" "+em(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 Ko(null,e)}function rm(e){return af(e),e.headers=xn.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),tm.getAdapter(e.adapter||tf.adapter)(e).then(function(n){return af(e),n.data=nf.call(e,e.transformResponse,n),n.headers=xn.from(n.headers),n},function(n){return zp(n)||(af(e),n&&n.response&&(n.response.data=nf.call(e,e.transformResponse,n.response),n.response.headers=xn.from(n.response.headers))),Promise.reject(n)})}const nm="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 im={};wc.transitional=function(t,r,n){function i(o,s){return"[Axios v"+nm+"] 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&&!im[s]&&(im[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 s3(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:s3,validators:wc};const Un=bc.validators;class xc{constructor(t){this.defaults=t,this.interceptors={request:new $p,response:new $p}}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=yo(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"],x=>{delete o[x]}),r.headers=xn.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=[rm.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 w=r;for(d=0;d<p;){const x=a[d++],y=a[d++];try{w=x(w)}catch(A){y.call(this,A);break}}try{l=rm.call(this,w)}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=yo(this.defaults,t);const r=Gp(t.baseURL,t.url);return Lp(r,t.params,t.paramsSerializer)}}ce.forEach(["delete","get","head","options"],function(t){xc.prototype[t]=function(r,n){return this.request(yo(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(yo(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 Ko(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 a3=cf;function c3(e){return function(r){return e.apply(null,r)}}function u3(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 l3=uf;function om(e){const t=new Sc(e),r=Sp(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 om(yo(e,i))},r}const dr=om(tf);dr.Axios=Sc,dr.CanceledError=Ko,dr.CancelToken=a3,dr.isCancel=zp,dr.VERSION=nm,dr.toFormData=hc,dr.AxiosError=ht,dr.Cancel=dr.CanceledError,dr.all=function(t){return Promise.all(t)},dr.spread=c3,dr.isAxiosError=u3,dr.mergeConfig=yo,dr.AxiosHeaders=xn,dr.formToJSON=e=>Up(ce.isHTMLForm(e)?new FormData(e):e),dr.getAdapter=tm.getAdapter,dr.HttpStatusCode=l3,dr.default=dr;var sm=dr,lf={exports:{}},Jr={},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 f3=am.exports,ff={exports:{}},df={exports:{}},cm;function Ec(){return cm||(cm=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 um;function d3(){return um||(um=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 x(_,I,C){try{return{type:"normal",arg:_.call(I,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=w;var y="suspendedStart",A="suspendedYield",O="executing",R="completed",k={};function F(){}function $(){}function H(){}var q={};p(q,u,function(){return this});var Y=Object.getPrototypeOf,ne=Y&&Y(Y(M([])));ne&&ne!==o&&s.call(ne,u)&&(q=ne);var se=H.prototype=F.prototype=Object.create(q);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=x(_[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=x(_,I,C);if(le.type==="normal"){if(g=C.done?R:A,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=x(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 $.prototype=H,a(se,"constructor",{value:H,configurable:!0}),a(H,"constructor",{value:$,configurable:!0}),$.displayName=p(H,d,"GeneratorFunction"),i.isGeneratorFunction=function(_){var I=typeof _=="function"&&_.constructor;return!!I&&(I===$||(I.displayName||I.name)==="GeneratorFunction")},i.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,H):(_.__proto__=H,p(_,d,"GeneratorFunction")),_.prototype=Object.create(se),_},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(se),p(se,d,"Generator"),p(se,u,function(){return this}),p(se,"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,lm;function h3(){if(lm)return hf;lm=1;var e=d3()();hf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return hf}var pf={exports:{}},fm;function p3(){return fm||(fm=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:{}},dm;function m3(){return dm||(dm=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 hm;function g3(){return hm||(hm=1,function(e){var t=Ec().default,r=m3();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 pm;function v3(){return pm||(pm=1,function(e){var t=g3();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,mm;function y3(){if(mm)return yf;mm=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=f3;Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.isNetworkError=xf,Jr.isRetryableError=Cc,Jr.isSafeRequestError=wm,Jr.isIdempotentRequestError=Sf,Jr.isNetworkOrIdempotentRequestError=Ef,Jr.exponentialDelay=bm,Jr.default=wo,Jr.DEFAULT_OPTIONS=Jr.namespace=void 0;var _c=ca(h3()),w3=ca(Ec()),gm=ca(p3()),b3=ca(v3()),x3=ca(y3());function vm(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?vm(Object(r),!0).forEach(function(n){(0,b3.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var bf="axios-retry";Jr.namespace=bf;function xf(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,x3.default)(e)}var ym=["get","head","options"],S3=ym.concat(["put","delete"]);function Cc(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function wm(e){return e.config?Cc(e)&&ym.indexOf(e.config.method)!==-1:!1}function Sf(e){return e.config?Cc(e)&&S3.indexOf(e.config.method)!==-1:!1}function Ef(e){return xf(e)||Sf(e)}function E3(){return 0}function bm(){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 xm={retries:3,retryCondition:Ef,retryDelay:E3,shouldResetTimeout:!1,onRetry:function(){}};Jr.DEFAULT_OPTIONS=xm;function _3(e,t){return wf(wf(wf({},xm),t),e[bf])}function Sm(e,t){var r=_3(e,t);return r.retryCount=r.retryCount||0,e[bf]=r,r}function C3(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 M3(e,t){return _f.apply(this,arguments)}function _f(){return _f=(0,gm.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,w3.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 wo(e,t){var r=e.interceptors.request.use(function(i){var o=Sm(i,t);return o.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,gm.default)(_c.default.mark(function o(s){var a,c,u,l,d,p,w,x;return _c.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=s.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(s));case 3:return c=Sm(a,t),A.next=6,M3(c,s);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,d=c.onRetry,p=u(c.retryCount,s),C3(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(w=Date.now()-c.lastRequestTime,x=a.timeout-w-p,!(x<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(s));case 16:a.timeout=x;case 17:return a.transformRequest=[function(O){return O}],A.next=20,d(c.retryCount,s,a);case 20:return A.abrupt("return",new Promise(function(O){return setTimeout(function(){return O(e(a))},p)}));case 21:return A.abrupt("return",Promise.reject(s));case 22:case"end":return A.stop()}},o)}));return function(o){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}wo.isNetworkError=xf,wo.isSafeRequestError=wm,wo.isIdempotentRequestError=Sf,wo.isNetworkOrIdempotentRequestError=Ef,wo.exponentialDelay=bm,wo.isRetryableError=Cc;const Em=Jr.default;lf.exports=Em,lf.exports.default=Em;var T3=lf.exports,Mc={},Yo=null;typeof WebSocket<"u"?Yo=WebSocket:typeof MozWebSocket<"u"?Yo=MozWebSocket:typeof Dr<"u"?Yo=Dr.WebSocket||Dr.MozWebSocket:typeof window<"u"?Yo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Yo=self.WebSocket||self.MozWebSocket);var A3=Yo,I3=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.ResilientWebSocket=void 0;const O3=I3(A3),P3=3e4+3e3;class R3{constructor(t,r){gt(this,"endpoint");gt(this,"wsClient");gt(this,"wsUserClosed");gt(this,"wsFailedAttempts");gt(this,"pingTimeout");gt(this,"logger");gt(this,"onError");gt(this,"onMessage");gt(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 O3.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=N3(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await _m(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()},P3)}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 _m(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=R3;async function _m(e){return new Promise(t=>setTimeout(t,e))}function N3(e){return 2**e*100}var Zo={};Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.removeLeading0xIfExists=Zo.makeWebsocketUrl=void 0;function j3(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Zo.makeWebsocketUrl=j3;function k3(e){return e.startsWith("0x")?e.substring(2):e}Zo.removeLeading0xIfExists=k3;var Cm=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,D3=Cm(sm),Mm=Cm(T3),B3=Mc,Mf=Zo;class L3{constructor(t,r){gt(this,"httpClient");gt(this,"priceFeedCallbacks");gt(this,"wsClient");gt(this,"wsEndpoint");gt(this,"logger");gt(this,"priceFeedRequestConfig");gt(this,"onWsError");var n,i,o;this.httpClient=D3.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,Mm.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:Mm.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 hn<"u"&&typeof hn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),hn.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 B3.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=L3,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 $3=Bl,F3=cc();class U3 extends $3.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>F3.Buffer.from(n,"base64"))}}oc.SuiPriceServiceConnection=U3;var Tc={};const V3=Wh(c4),Xo=Wh(e6);var Tf=Object.defineProperty,z3=Object.getOwnPropertyDescriptor,q3=Object.getOwnPropertyNames,H3=Object.prototype.hasOwnProperty,W3=(e,t)=>{for(var r in t)Tf(e,r,{get:t[r],enumerable:!0})},G3=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of q3(t))!H3.call(e,i)&&i!==r&&Tf(e,i,{get:()=>t[i],enumerable:!(n=z3(t,i))||n.enumerable});return e},K3=e=>G3(Tf({},"__esModule",{value:!0}),e),Tm={};W3(Tm,{SUI_ADDRESS_LENGTH:()=>Af,isValidSuiAddress:()=>Om,isValidSuiObjectId:()=>X3,isValidTransactionDigest:()=>Z3,normalizeStructTag:()=>Pm,normalizeSuiAddress:()=>Of,normalizeSuiObjectId:()=>Q3,parseStructTag:()=>If});var Am=K3(Tm),Im=Xo;const Y3=32;function Z3(e){try{return(0,Im.fromBase58)(e).length===Y3}catch{return!1}}const Af=32;function Om(e){return eS(e)&&tS(e)===Af}function X3(e){return Om(e)}function J3(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,Im.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(s=>J3(s.trim())):[];return{address:Of(t),module:r,name:i,typeParams:o}}function Pm(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:Pm(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(Af*2,"0")}`}function Q3(e,t=!1){return Of(e,t)}function eS(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function tS(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Pf=Object.defineProperty,rS=Object.getOwnPropertyDescriptor,nS=Object.getOwnPropertyNames,iS=Object.prototype.hasOwnProperty,oS=(e,t)=>{for(var r in t)Pf(e,r,{get:t[r],enumerable:!0})},sS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nS(t))!iS.call(e,i)&&i!==r&&Pf(e,i,{get:()=>t[i],enumerable:!(n=rS(t,i))||n.enumerable});return e},aS=e=>sS(Pf({},"__esModule",{value:!0}),e),Rm={};oS(Rm,{TypeTagSerializer:()=>bo});var Nm=aS(Rm),cS=Xo,uS=Am;const lS=/^vector<(.+)>$/,fS=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class bo{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(lS);if(n)return{vector:bo.parseFromStr(n[1],r)};const i=t.match(fS);if(i)return{struct:{address:r?(0,uS.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:bo.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,cS.splitGenericParameters)(t).map(n=>bo.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<${bo.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(bo.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Rf=Object.defineProperty,dS=Object.getOwnPropertyDescriptor,hS=Object.getOwnPropertyNames,pS=Object.prototype.hasOwnProperty,mS=(e,t)=>{for(var r in t)Rf(e,r,{get:t[r],enumerable:!0})},gS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hS(t))!pS.call(e,i)&&i!==r&&Rf(e,i,{get:()=>t[i],enumerable:!(n=dS(t,i))||n.enumerable});return e},vS=e=>gS(Rf({},"__esModule",{value:!0}),e),jm={};mS(jm,{Address:()=>Vn,AppId:()=>Jm,Argument:()=>zn,CallArg:()=>Fm,Command:()=>Vm,CompressedSignature:()=>tg,GasData:()=>Gm,Intent:()=>Qm,IntentMessage:()=>eg,IntentScope:()=>Zm,IntentVersion:()=>Xm,MultiSig:()=>bS,MultiSigPkMap:()=>ng,MultiSigPublicKey:()=>ig,ObjectArg:()=>$m,ObjectDigest:()=>Bm,PasskeyAuthenticator:()=>SS,ProgrammableMoveCall:()=>Um,ProgrammableTransaction:()=>zm,PublicKey:()=>rg,SenderSignedData:()=>xS,SenderSignedTransaction:()=>sg,SharedObjectRef:()=>Lm,StructTag:()=>Wm,SuiObjectRef:()=>Ac,TransactionData:()=>Ym,TransactionDataV1:()=>Km,TransactionExpiration:()=>Hm,TransactionKind:()=>qm,TypeTag:()=>jf,base64String:()=>og});var km=vS(jm),ue=Xo,ua=Am,Dm=Nm;function yS(e){return ue.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function wS(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))}),Bm=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")}}),Ac=ue.bcs.struct("SuiObjectRef",{objectId:Vn,version:ue.bcs.u64(),digest:Bm}),Lm=ue.bcs.struct("SharedObjectRef",{objectId:Vn,initialSharedVersion:ue.bcs.u64(),mutable:ue.bcs.bool()}),$m=ue.bcs.enum("ObjectArg",{ImmOrOwnedObject:Ac,SharedObject:Lm,Receiving:Ac}),Fm=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:$m}),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(()=>Wm),u16:null,u32:null,u256:null}),jf=Nf.transform({input:e=>typeof e=="string"?Dm.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>Dm.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()])}),Um=ue.bcs.struct("ProgrammableMoveCall",{package:Vn,module:ue.bcs.string(),function:ue.bcs.string(),typeArguments:ue.bcs.vector(jf),arguments:ue.bcs.vector(zn)}),Vm=ue.bcs.enum("Command",{MoveCall:Um,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:wS(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})}),zm=ue.bcs.struct("ProgrammableTransaction",{inputs:ue.bcs.vector(Fm),commands:ue.bcs.vector(Vm)}),qm=ue.bcs.enum("TransactionKind",{ProgrammableTransaction:zm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Hm=ue.bcs.enum("TransactionExpiration",{None:null,Epoch:yS()}),Wm=ue.bcs.struct("StructTag",{address:Vn,module:ue.bcs.string(),name:ue.bcs.string(),typeParams:ue.bcs.vector(Nf)}),Gm=ue.bcs.struct("GasData",{payment:ue.bcs.vector(Ac),owner:Vn,price:ue.bcs.u64(),budget:ue.bcs.u64()}),Km=ue.bcs.struct("TransactionDataV1",{kind:qm,sender:Vn,gasData:Gm,expiration:Hm}),Ym=ue.bcs.enum("TransactionData",{V1:Km}),Zm=ue.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Xm=ue.bcs.enum("IntentVersion",{V0:null}),Jm=ue.bcs.enum("AppId",{Sui:null}),Qm=ue.bcs.struct("Intent",{scope:Zm,version:Xm,appId:Jm});function eg(e){return ue.bcs.struct(`IntentMessage<${e.name}>`,{intent:Qm,value:e})}const tg=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())}),rg=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())}),ng=ue.bcs.struct("MultiSigPkMap",{pubKey:rg,weight:ue.bcs.u8()}),ig=ue.bcs.struct("MultiSigPublicKey",{pk_map:ue.bcs.vector(ng),threshold:ue.bcs.u16()}),bS=ue.bcs.struct("MultiSig",{sigs:ue.bcs.vector(tg),bitmap:ue.bcs.u16(),multisig_pk:ig}),og=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))}),sg=ue.bcs.struct("SenderSignedTransaction",{intentMessage:eg(Ym),txSignatures:ue.bcs.vector(og)}),xS=ue.bcs.vector(sg,{name:"SenderSignedData"}),SS=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,ES=Object.getOwnPropertyDescriptor,_S=Object.getOwnPropertyNames,CS=Object.prototype.hasOwnProperty,MS=(e,t)=>{for(var r in t)kf(e,r,{get:t[r],enumerable:!0})},TS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _S(t))!CS.call(e,i)&&i!==r&&kf(e,i,{get:()=>t[i],enumerable:!(n=ES(t,i))||n.enumerable});return e},AS=e=>TS(kf({},"__esModule",{value:!0}),e),ag={};MS(ag,{TransactionEffects:()=>VS});var IS=AS(ag),pe=Xo,Bt=km;const OS=pe.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:pe.bcs.struct("UnableToFetchPackage",{packageId:Bt.Address}),NotAPackage:pe.bcs.struct("NotAPackage",{objectId:Bt.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:Bt.Address,ticketId:Bt.Address})}),PS=pe.bcs.struct("ModuleId",{address:Bt.Address,name:pe.bcs.string()}),cg=pe.bcs.struct("MoveLocation",{module:PS,function:pe.bcs.u16(),instruction:pe.bcs.u16(),functionName:pe.bcs.option(pe.bcs.string())}),RS=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}),NS=pe.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),jS=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:Bt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:pe.bcs.option(cg),MoveAbort:pe.bcs.tuple([cg,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:RS}),TypeArgumentError:pe.bcs.struct("TypeArgumentError",{argumentIdx:pe.bcs.u16(),kind:NS}),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:OS}),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(Bt.Address)}),AddressDeniedForCoin:pe.bcs.struct("AddressDeniedForCoin",{address:Bt.Address,coinType:pe.bcs.string()}),CoinTypeGlobalPause:pe.bcs.struct("CoinTypeGlobalPause",{coinType:pe.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),ug=pe.bcs.enum("ExecutionStatus",{Success:null,Failed:pe.bcs.struct("ExecutionFailed",{error:jS,command:pe.bcs.option(pe.bcs.u64())})}),lg=pe.bcs.struct("GasCostSummary",{computationCost:pe.bcs.u64(),storageCost:pe.bcs.u64(),storageRebate:pe.bcs.u64(),nonRefundableStorageFee:pe.bcs.u64()}),Jo=pe.bcs.enum("Owner",{AddressOwner:Bt.Address,ObjectOwner:Bt.Address,Shared:pe.bcs.struct("Shared",{initialSharedVersion:pe.bcs.u64()}),Immutable:null}),kS=pe.bcs.struct("TransactionEffectsV1",{status:ug,executedEpoch:pe.bcs.u64(),gasUsed:lg,modifiedAtVersions:pe.bcs.vector(pe.bcs.tuple([Bt.Address,pe.bcs.u64()])),sharedObjects:pe.bcs.vector(Bt.SuiObjectRef),transactionDigest:Bt.ObjectDigest,created:pe.bcs.vector(pe.bcs.tuple([Bt.SuiObjectRef,Jo])),mutated:pe.bcs.vector(pe.bcs.tuple([Bt.SuiObjectRef,Jo])),unwrapped:pe.bcs.vector(pe.bcs.tuple([Bt.SuiObjectRef,Jo])),deleted:pe.bcs.vector(Bt.SuiObjectRef),unwrappedThenDeleted:pe.bcs.vector(Bt.SuiObjectRef),wrapped:pe.bcs.vector(Bt.SuiObjectRef),gasObject:pe.bcs.tuple([Bt.SuiObjectRef,Jo]),eventsDigest:pe.bcs.option(Bt.ObjectDigest),dependencies:pe.bcs.vector(Bt.ObjectDigest)}),Df=pe.bcs.tuple([pe.bcs.u64(),Bt.ObjectDigest]),DS=pe.bcs.enum("ObjectIn",{NotExist:null,Exist:pe.bcs.tuple([Df,Jo])}),BS=pe.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:pe.bcs.tuple([Bt.ObjectDigest,Jo]),PackageWrite:Df}),LS=pe.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),$S=pe.bcs.struct("EffectsObjectChange",{inputState:DS,outputState:BS,idOperation:LS}),FS=pe.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Df,MutateDeleted:pe.bcs.u64(),ReadDeleted:pe.bcs.u64(),Cancelled:pe.bcs.u64(),PerEpochConfig:null}),US=pe.bcs.struct("TransactionEffectsV2",{status:ug,executedEpoch:pe.bcs.u64(),gasUsed:lg,transactionDigest:Bt.ObjectDigest,gasObjectIndex:pe.bcs.option(pe.bcs.u32()),eventsDigest:pe.bcs.option(Bt.ObjectDigest),dependencies:pe.bcs.vector(Bt.ObjectDigest),lamportVersion:pe.bcs.u64(),changedObjects:pe.bcs.vector(pe.bcs.tuple([Bt.Address,$S])),unchangedSharedObjects:pe.bcs.vector(pe.bcs.tuple([Bt.Address,FS])),auxDataDigest:pe.bcs.option(Bt.ObjectDigest)}),VS=pe.bcs.enum("TransactionEffects",{V1:kS,V2:US});var Bf=Object.defineProperty,zS=Object.getOwnPropertyDescriptor,qS=Object.getOwnPropertyNames,HS=Object.prototype.hasOwnProperty,WS=(e,t)=>{for(var r in t)Bf(e,r,{get:t[r],enumerable:!0})},GS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qS(t))!HS.call(e,i)&&i!==r&&Bf(e,i,{get:()=>t[i],enumerable:!(n=zS(t,i))||n.enumerable});return e},KS=e=>GS(Bf({},"__esModule",{value:!0}),e),fg={};WS(fg,{BcsType:()=>JS.BcsType,TypeTagSerializer:()=>XS.TypeTagSerializer,bcs:()=>QS});var YS=KS(fg),qn=Xo,Lt=km,ZS=IS,XS=Nm,JS=Xo;const QS={...qn.bcs,U8:qn.bcs.u8(),U16:qn.bcs.u16(),U32:qn.bcs.u32(),U64:qn.bcs.u64(),U128:qn.bcs.u128(),U256:qn.bcs.u256(),ULEB128:qn.bcs.uleb128(),Bool:qn.bcs.bool(),String:qn.bcs.string(),Address:Lt.Address,AppId:Lt.AppId,Argument:Lt.Argument,CallArg:Lt.CallArg,CompressedSignature:Lt.CompressedSignature,GasData:Lt.GasData,Intent:Lt.Intent,IntentMessage:Lt.IntentMessage,IntentScope:Lt.IntentScope,IntentVersion:Lt.IntentVersion,MultiSig:Lt.MultiSig,MultiSigPkMap:Lt.MultiSigPkMap,MultiSigPublicKey:Lt.MultiSigPublicKey,ObjectArg:Lt.ObjectArg,ObjectDigest:Lt.ObjectDigest,ProgrammableMoveCall:Lt.ProgrammableMoveCall,ProgrammableTransaction:Lt.ProgrammableTransaction,PublicKey:Lt.PublicKey,SenderSignedData:Lt.SenderSignedData,SenderSignedTransaction:Lt.SenderSignedTransaction,SharedObjectRef:Lt.SharedObjectRef,StructTag:Lt.StructTag,SuiObjectRef:Lt.SuiObjectRef,Command:Lt.Command,TransactionData:Lt.TransactionData,TransactionDataV1:Lt.TransactionDataV1,TransactionExpiration:Lt.TransactionExpiration,TransactionKind:Lt.TransactionKind,TypeTag:Lt.TypeTag,TransactionEffects:ZS.TransactionEffects,PasskeyAuthenticator:Lt.PasskeyAuthenticator};Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.SuiPythClient=void 0;const Ic=V3,Qo=YS,eE=cc(),Lf=16*1024;class tE{constructor(t,r,n){gt(this,"provider");gt(this,"pythStateId");gt(this,"wormholeStateId");gt(this,"pythPackageId");gt(this,"wormholePackageId");gt(this,"priceTableInfo");gt(this,"priceFeedObjectIdCache",new Map);gt(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(Qo.bcs.vector(Qo.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(Qo.bcs.vector(Qo.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(Qo.bcs.vector(Qo.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(eE.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)}}Tc.SuiPythClient=tE,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=Tc;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}})}(ia);var rE=Object.create,$f=Object.defineProperty,nE=Object.defineProperties,iE=Object.getOwnPropertyDescriptor,oE=Object.getOwnPropertyDescriptors,dg=Object.getOwnPropertyNames,hg=Object.getOwnPropertySymbols,sE=Object.getPrototypeOf,pg=Object.prototype.hasOwnProperty,aE=Object.prototype.propertyIsEnumerable,mg=(e,t,r)=>t in e?$f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cE=(e,t)=>{for(var r in t||(t={}))pg.call(t,r)&&mg(e,r,t[r]);if(hg)for(var r of hg(t))aE.call(t,r)&&mg(e,r,t[r]);return e},uE=(e,t)=>nE(e,oE(t)),lE=(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')}),fE=(e,t)=>function(){return t||(0,e[dg(e)[0]])((t={exports:{}}).exports,t),t.exports},dE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dg(t))!pg.call(e,i)&&i!==r&&$f(e,i,{get:()=>t[i],enumerable:!(n=iE(t,i))||n.enumerable});return e},es=(e,t,r)=>(r=e!=null?rE(sE(e)):{},dE(!e||!e.__esModule?$f(r,"default",{value:e,enumerable:!0}):r,e)),yt=(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())}),ts=fE({"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=lE("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"],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 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=x[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 A=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=A(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,pt=dt>>>13,we=M[4]|0,he=we&8191,Ce=we>>>13,Ue=M[5]|0,Ne=Ue&8191,Me=Ue>>>13,Ae=M[6]|0,Be=Ae&8191,ut=Ae>>>13,lt=M[7]|0,ze=lt&8191,Nt=lt>>>13,Et=M[8]|0,Ze=Et&8191,At=Et>>>13,Ft=M[9]|0,Qe=Ft&8191,_t=Ft>>>13,It=_[0]|0,rt=It&8191,jt=It>>>13,Ot=_[1]|0,et=Ot&8191,xt=Ot>>>13,Mt=_[2]|0,Ge=Mt&8191,mt=Mt>>>13,Pt=_[3]|0,nt=Pt&8191,St=Pt>>>13,zt=_[4]|0,j=zt&8191,E=zt>>>13,T=_[5]|0,L=T&8191,K=T>>>13,J=_[6]|0,re=J&8191,ke=J>>>13,Je=_[7]|0,Re=Je&8191,V=Je>>>13,oe=_[8]|0,fe=oe&8191,Oe=oe>>>13,qe=_[9]|0,Pe=qe&8191,$e=qe>>>13;S.negative=f.negative^m.negative,S.length=19,g=Math.imul(ie,rt),v=Math.imul(ie,jt),v=v+Math.imul(le,rt)|0,N=Math.imul(le,jt);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,jt),v=v+Math.imul(be,rt)|0,N=Math.imul(be,jt),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,jt),v=v+Math.imul(ft,rt)|0,N=Math.imul(ft,jt),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,mt)|0,v=v+Math.imul(le,Ge)|0,N=N+Math.imul(le,mt)|0;var kt=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(kt>>>26)|0,kt&=67108863,g=Math.imul(je,rt),v=Math.imul(je,jt),v=v+Math.imul(pt,rt)|0,N=Math.imul(pt,jt),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,mt)|0,v=v+Math.imul(be,Ge)|0,N=N+Math.imul(be,mt)|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,jt),v=v+Math.imul(Ce,rt)|0,N=Math.imul(Ce,jt),g=g+Math.imul(je,et)|0,v=v+Math.imul(je,xt)|0,v=v+Math.imul(pt,et)|0,N=N+Math.imul(pt,xt)|0,g=g+Math.imul(Le,Ge)|0,v=v+Math.imul(Le,mt)|0,v=v+Math.imul(ft,Ge)|0,N=N+Math.imul(ft,mt)|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 cr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(cr>>>26)|0,cr&=67108863,g=Math.imul(Ne,rt),v=Math.imul(Ne,jt),v=v+Math.imul(Me,rt)|0,N=Math.imul(Me,jt),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,mt)|0,v=v+Math.imul(pt,Ge)|0,N=N+Math.imul(pt,mt)|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,L)|0,v=v+Math.imul(ie,K)|0,v=v+Math.imul(le,L)|0,N=N+Math.imul(le,K)|0;var Tr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,g=Math.imul(Be,rt),v=Math.imul(Be,jt),v=v+Math.imul(ut,rt)|0,N=Math.imul(ut,jt),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,mt)|0,v=v+Math.imul(Ce,Ge)|0,N=N+Math.imul(Ce,mt)|0,g=g+Math.imul(je,nt)|0,v=v+Math.imul(je,St)|0,v=v+Math.imul(pt,nt)|0,N=N+Math.imul(pt,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,L)|0,v=v+Math.imul(xe,K)|0,v=v+Math.imul(be,L)|0,N=N+Math.imul(be,K)|0,g=g+Math.imul(ie,re)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(le,re)|0,N=N+Math.imul(le,ke)|0;var lr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(lr>>>26)|0,lr&=67108863,g=Math.imul(ze,rt),v=Math.imul(ze,jt),v=v+Math.imul(Nt,rt)|0,N=Math.imul(Nt,jt),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,mt)|0,v=v+Math.imul(Me,Ge)|0,N=N+Math.imul(Me,mt)|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(pt,j)|0,N=N+Math.imul(pt,E)|0,g=g+Math.imul(Le,L)|0,v=v+Math.imul(Le,K)|0,v=v+Math.imul(ft,L)|0,N=N+Math.imul(ft,K)|0,g=g+Math.imul(xe,re)|0,v=v+Math.imul(xe,ke)|0,v=v+Math.imul(be,re)|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,jt),v=v+Math.imul(At,rt)|0,N=Math.imul(At,jt),g=g+Math.imul(ze,et)|0,v=v+Math.imul(ze,xt)|0,v=v+Math.imul(Nt,et)|0,N=N+Math.imul(Nt,xt)|0,g=g+Math.imul(Be,Ge)|0,v=v+Math.imul(Be,mt)|0,v=v+Math.imul(ut,Ge)|0,N=N+Math.imul(ut,mt)|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,L)|0,v=v+Math.imul(je,K)|0,v=v+Math.imul(pt,L)|0,N=N+Math.imul(pt,K)|0,g=g+Math.imul(Le,re)|0,v=v+Math.imul(Le,ke)|0,v=v+Math.imul(ft,re)|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,jt),v=v+Math.imul(_t,rt)|0,N=Math.imul(_t,jt),g=g+Math.imul(Ze,et)|0,v=v+Math.imul(Ze,xt)|0,v=v+Math.imul(At,et)|0,N=N+Math.imul(At,xt)|0,g=g+Math.imul(ze,Ge)|0,v=v+Math.imul(ze,mt)|0,v=v+Math.imul(Nt,Ge)|0,N=N+Math.imul(Nt,mt)|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,L)|0,v=v+Math.imul(he,K)|0,v=v+Math.imul(Ce,L)|0,N=N+Math.imul(Ce,K)|0,g=g+Math.imul(je,re)|0,v=v+Math.imul(je,ke)|0,v=v+Math.imul(pt,re)|0,N=N+Math.imul(pt,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,mt)|0,v=v+Math.imul(At,Ge)|0,N=N+Math.imul(At,mt)|0,g=g+Math.imul(ze,nt)|0,v=v+Math.imul(ze,St)|0,v=v+Math.imul(Nt,nt)|0,N=N+Math.imul(Nt,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,L)|0,v=v+Math.imul(Ne,K)|0,v=v+Math.imul(Me,L)|0,N=N+Math.imul(Me,K)|0,g=g+Math.imul(he,re)|0,v=v+Math.imul(he,ke)|0,v=v+Math.imul(Ce,re)|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(pt,Re)|0,N=N+Math.imul(pt,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 Gr=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,g=Math.imul(Qe,Ge),v=Math.imul(Qe,mt),v=v+Math.imul(_t,Ge)|0,N=Math.imul(_t,mt),g=g+Math.imul(Ze,nt)|0,v=v+Math.imul(Ze,St)|0,v=v+Math.imul(At,nt)|0,N=N+Math.imul(At,St)|0,g=g+Math.imul(ze,j)|0,v=v+Math.imul(ze,E)|0,v=v+Math.imul(Nt,j)|0,N=N+Math.imul(Nt,E)|0,g=g+Math.imul(Be,L)|0,v=v+Math.imul(Be,K)|0,v=v+Math.imul(ut,L)|0,N=N+Math.imul(ut,K)|0,g=g+Math.imul(Ne,re)|0,v=v+Math.imul(Ne,ke)|0,v=v+Math.imul(Me,re)|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(pt,fe)|0,N=N+Math.imul(pt,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(At,j)|0,N=N+Math.imul(At,E)|0,g=g+Math.imul(ze,L)|0,v=v+Math.imul(ze,K)|0,v=v+Math.imul(Nt,L)|0,N=N+Math.imul(Nt,K)|0,g=g+Math.imul(Be,re)|0,v=v+Math.imul(Be,ke)|0,v=v+Math.imul(ut,re)|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(pt,Pe)|0,N=N+Math.imul(pt,$e)|0;var Ti=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ti>>>26)|0,Ti&=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,L)|0,v=v+Math.imul(Ze,K)|0,v=v+Math.imul(At,L)|0,N=N+Math.imul(At,K)|0,g=g+Math.imul(ze,re)|0,v=v+Math.imul(ze,ke)|0,v=v+Math.imul(Nt,re)|0,N=N+Math.imul(Nt,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 Ai=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,g=Math.imul(Qe,L),v=Math.imul(Qe,K),v=v+Math.imul(_t,L)|0,N=Math.imul(_t,K),g=g+Math.imul(Ze,re)|0,v=v+Math.imul(Ze,ke)|0,v=v+Math.imul(At,re)|0,N=N+Math.imul(At,ke)|0,g=g+Math.imul(ze,Re)|0,v=v+Math.imul(ze,V)|0,v=v+Math.imul(Nt,Re)|0,N=N+Math.imul(Nt,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,re),v=Math.imul(Qe,ke),v=v+Math.imul(_t,re)|0,N=Math.imul(_t,ke),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,V)|0,v=v+Math.imul(At,Re)|0,N=N+Math.imul(At,V)|0,g=g+Math.imul(ze,fe)|0,v=v+Math.imul(ze,Oe)|0,v=v+Math.imul(Nt,fe)|0,N=N+Math.imul(Nt,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 Ii=(C+g|0)+((v&8191)<<13)|0;C=(N+(v>>>13)|0)+(Ii>>>26)|0,Ii&=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(At,fe)|0,N=N+Math.imul(At,Oe)|0,g=g+Math.imul(ze,Pe)|0,v=v+Math.imul(ze,$e)|0,v=v+Math.imul(Nt,Pe)|0,N=N+Math.imul(Nt,$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,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(At,Pe)|0,N=N+Math.imul(At,$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]=kt,I[3]=Ut,I[4]=cr,I[5]=Tr,I[6]=lr,I[7]=er,I[8]=xr,I[9]=Rn,I[10]=Gr,I[11]=Nn,I[12]=Ti,I[13]=Ai,I[14]=jn,I[15]=Ii,I[16]=Oi,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 $(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=$(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),$(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 H={k256:null,p224:null,p192:null,p25519:null};function q(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()}q.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},q.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},q.prototype.split=function(f,m){f.iushrn(this.n,0,m)},q.prototype.imulK=function(f){return f.imul(this.k)};function Y(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(Y,q),Y.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},Y.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 ne(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(ne,q);function se(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(se,q);function ae(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ae,q),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(H[f])return H[f];var m;if(f==="k256")m=new Y;else if(f==="p224")m=new ne;else if(f==="p192")m=new se;else if(f==="p25519")m=new ae;else throw new Error("Unknown prime "+f);return H[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)}}),rs=9e15,ki=1e9,Ff="0123456789abcdef",Oc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Pc="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Uf={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-rs,maxE:rs,crypto:!1},gg,gi,ot=!0,Rc="[DecimalError] ",Di=Rc+"Invalid argument: ",vg=Rc+"Precision limit exceeded",yg=Rc+"crypto unavailable",wg="[object Decimal]",Pr=Math.floor,gr=Math.pow,hE=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,pE=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,mE=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,bg=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Sn=1e7,Ke=7,gE=9007199254740991,vE=Oc.length-1,Vf=Pc.length-1,ge={toStringTag:wg};ge.absoluteValue=ge.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),He(e)},ge.ceil=function(){return He(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(Di+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=yE(n,Mg(n,r)),n.precision=e,n.rounding=t,He(gi==2||gi==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*gr(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=gr(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&&(He(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")&&(He(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ot=!0,He(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 He(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 He(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=ns(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 He(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=ns(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=ns(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,He(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()?En(r,i,o):new r(0):new r(NaN):t.isZero()?En(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=En(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?He(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=En(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=En(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=En(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,He(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=Li(u,a),n=t?kc(l,a+10):Li(e,a),c=Gt(s,n,a,1),la(c.d,i=d,p))do if(a+=10,s=Li(u,a),n=t?kc(l,a+10):Li(e,a),c=Gt(s,n,a,1),!o){+Er(c.d).slice(i+1,i+15)+1==1e14&&(c=He(c,d+1,0));break}while(la(c.d,i+=10,p));return ot=!0,He(c,d,p)},ge.minus=ge.sub=function(e){var t,r,n,i,o,s,a,c,u,l,d,p,w=this,x=w.constructor;if(e=new x(e),!w.d||!e.d)return!w.s||!e.s?e=new x(NaN):w.d?e.s=-e.s:e=new x(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=x.precision,c=x.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new x(w);else return new x(c===3?-0:0);return ot?He(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]=Sn-1;--u[i],u[n]+=Sn}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?He(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]?He(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 Li(this)},ge.negated=ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s,He(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?He(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)/Sn|0,u[i]%=Sn;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=jc(u,n),ot?He(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(Di+e);return r.d?(t=xg(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ge.round=function(){var e=this,t=e.constructor;return He(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=bE(n,Mg(n,r)),n.precision=e,n.rounding=t,He(gi>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&&(He(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")&&(He(n,c+1,1),e=!n.times(n).eq(s));break}return ot=!0,He(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,He(gi==2||gi==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%Sn|0,t=a/Sn|0;o[i]=(o[i]+t)%Sn|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=jc(o,r),ot?He(e,d.precision,d.rounding):e},ge.toBinary=function(e,t){return Hf(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,ki),t===void 0?t=n.rounding:zr(t,0,8),He(r,e+r.e+1,t))},ge.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Hn(n,!0):(zr(e,0,ki),t===void 0?t=i.rounding:zr(t,0,8),n=He(new i(n),e+1,t),r=Hn(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=Hn(i):(zr(e,0,ki),t===void 0?t=o.rounding:zr(t,0,8),n=He(new o(i),e+i.e+1,t),r=Hn(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,x=w.d,y=w.constructor;if(!x)return new y(w);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=xg(x)-w.e-1,s=o%Ke,t.d[0]=gr(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(Di+a);e=a.gt(t)?o>0?t:u:a}for(ot=!1,a=new y(Er(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=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 Hf(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,He(r)):(e.s=r.s,r=e),r},ge.toNumber=function(){return+this},ge.toOctal=function(e,t){return Hf(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(gr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return He(a,n,o);if(t=Pr(e.e/Ke),t>=e.d.length-1&&(r=u<0?-u:u)<=gE)return i=Sg(c,a,r,n),e.s<0?new c(1).div(i):He(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=gr(+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(Li(a,n+r)),n),i.d&&(i=He(i,n+5,1),la(i.d,n,o)&&(t=n+10,i=He(zf(e.times(Li(a,t+r)),t),t+5,1),+Er(i.d).slice(n+1,n+15)+1==1e14&&(i=He(i,n+1,0)))),i.s=s,ot=!0,c.rounding=o,He(i,n,o))},ge.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Hn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(zr(e,1,ki),t===void 0?t=i.rounding:zr(t,0,8),n=He(new i(n),e,t),r=Hn(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,ki),t===void 0?t=n.rounding:zr(t,0,8)),He(new n(r),e,t)},ge.toString=function(){var e=this,t=e.constructor,r=Hn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ge.truncated=ge.trunc=function(){return He(new this.constructor(this),this.e+1,1)},ge.valueOf=ge.toJSON=function(){var e=this,t=e.constructor,r=Hn(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+=Bi(r)),o+=n;s=e[t],n=s+"",r=Ke-n.length,r&&(o+=Bi(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(Di+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=gr(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)==gr(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)==gr(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 yE(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=ns(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,x,y,A,O,R,k,F,$,H,q,Y,ne,se,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=Sn,w=Ke,l=Pr(n.e/w)-Pr(i.e/w)),ae=m.length,ne=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?(H=o=D.precision,s=D.rounding):a?H=o+(n.e-i.e)+1:H=o,H<0)R.push(1),x=!0;else{if(H=H/w+2|0,d=0,ae==1){for(p=0,m=m[0],H++;(d<ne||p)&&H--;d++)q=p*c+(f[d]||0),R[d]=q/m|0,p=q%m|0;x=p||d<ne}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,ne=f.length),Y=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;z=m.slice(),z.unshift(0),se=m[0],m[1]>=c/2&&++se;do p=0,u=t(m,k,ae,F),u<0?($=k[0],ae!=F&&($=$*c+(k[1]||0)),p=$/se|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),A=y.length,F=k.length,u=t(y,k,A,F),u==1&&(p--,r(y,ae<A?z:m,A,c))):(p==0&&(u=p=1),y=m.slice()),A=y.length,A<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[Y]||0:(k=[f[Y]],F=1);while((Y++<ne||k[0]!==void 0)&&H--);x=k[0]!==void 0}R[0]||R.shift()}if(w==1)O.e=l,gg=x;else{for(d=1,p=R[0];p>=10;p/=10)d++;O.e=d+l*w-1,He(O,a?o+O.e+1:o,s,x)}return O}}();function He(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/gr(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/gr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%gr(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/gr(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]=gr(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=gr(10,Ke-o),d[p]=s>0?(l/gr(10,i-s)%gr(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]==Sn&&(d[0]=1));break}else{if(d[p]+=a,d[p]!=Sn)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 Hn(e,t,r){if(!e.isFinite())return Cg(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)+Bi(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Bi(-i-1)+o,r&&(n=r-s)>0&&(o+=Bi(n))):i>=s?(o+=Bi(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+Bi(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=Bi(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>vE)throw ot=!0,r&&(e.precision=r),Error(vg);return He(new e(Oc),t,1,!0)}function En(e,t,r){if(t>Vf)throw Error(vg);return He(new e(Pc),t,r,!0)}function xg(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 Bi(e){for(var t="";e--;)t+="0";return t}function Sg(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),Tg(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),Tg(t.d,s)}return ot=!0,o}function Eg(e){return e.d[e.d.length-1]&1}function _g(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,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(gr(2,d))/Math.LN10*2+5|0,c+=n,r=o=s=new p(1),p.precision=c;;){if(o=He(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=He(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 He(s,p.precision=x,w,ot=!0);else return p.precision=x,s}s=a}}function Li(e,t){var r,n,i,o,s,a,c,u,l,d,p,w=1,x=10,y=e,A=y.d,O=y.constructor,R=O.rounding,k=O.precision;if(y.s<0||!A||!A[0]||!y.e&&A[0]==1&&A.length==1)return new O(A&&!A[0]?-1/0:y.s!=1?NaN:A?0:y);if(t==null?(ot=!1,l=k):l=t,O.precision=l+=x,r=Er(A),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=Li(new O(n+"."+r.slice(1)),l-x).plus(u),O.precision=k,t==null?He(y,k,R,ot=!0):y;for(d=y,c=s=y=Gt(y.minus(1),y.plus(1),l,1),p=He(y.times(y),l,1),i=3;;){if(s=He(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-x,R,a))O.precision=l+=x,u=s=y=Gt(d.minus(1),d.plus(1),l,1),p=He(y.times(y),l,1),i=a=1;else return He(c,O.precision=k,R,ot=!0);else return O.precision=k,c;c=u,i+=2}}function Cg(e){return String(e.s*e.s/0)}function qf(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 wE(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),bg.test(t))return qf(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(pE.test(t))r=16,t=t.toLowerCase();else if(hE.test(t))r=2;else if(mE.test(t))r=8;else throw Error(Di+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=Sg(n,new n(r),o,o*2)),u=Nc(t,r,Sn),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?gr(2,c):fa.pow(2,c))),ot=!0,e)}function bE(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:ns(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Dc(5,r)),t=ns(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 ns(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 Mg(e,t){var r,n=t.s<0,i=En(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return gi=n?4:1,t;if(r=t.divToInt(i),r.isZero())gi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return gi=Eg(r)?n?2:3:n?4:1,t;gi=Eg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Hf(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor,x=r!==void 0;if(x?(zr(r,1,ki),n===void 0?n=w.rounding:zr(n,0,8)):(r=w.precision,n=w.rounding),!e.isFinite())l=Cg(e);else{for(l=Hn(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 w(1),p.e=l.length-s,p.d=Nc(Hn(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=x?"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=gg),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(x){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 Tg(e,t){if(e.length>t)return e.length=t,!0}function xE(e){return new this(e).abs()}function SE(e){return new this(e).acos()}function EE(e){return new this(e).acosh()}function _E(e,t){return new this(e).plus(t)}function CE(e){return new this(e).asin()}function ME(e){return new this(e).asinh()}function TE(e){return new this(e).atan()}function AE(e){return new this(e).atanh()}function IE(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=En(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?En(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=En(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=En(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 OE(e){return new this(e).cbrt()}function PE(e){return He(e=new this(e),e.e+1,2)}function RE(e,t,r){return new this(e).clamp(t,r)}function NE(e){if(!e||typeof e!="object")throw Error(Rc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,ki,"rounding",0,8,"toExpNeg",-rs,0,"toExpPos",0,rs,"maxE",0,rs,"minE",-rs,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(Di+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(yg);else this[r]=!1;else throw Error(Di+r+": "+n);return this}function jE(e){return new this(e).cos()}function kE(e){return new this(e).cosh()}function Ag(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,Ig(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 qf(u,o.toString())}else if(c!=="string")throw Error(Di+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),bg.test(o)?qf(u,o):wE(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=NE,i.clone=Ag,i.isDecimal=Ig,i.abs=xE,i.acos=SE,i.acosh=EE,i.add=_E,i.asin=CE,i.asinh=ME,i.atan=TE,i.atanh=AE,i.atan2=IE,i.cbrt=OE,i.ceil=PE,i.clamp=RE,i.cos=jE,i.cosh=kE,i.div=DE,i.exp=BE,i.floor=LE,i.hypot=$E,i.ln=FE,i.log=UE,i.log10=zE,i.log2=VE,i.max=qE,i.min=HE,i.mod=WE,i.mul=GE,i.pow=KE,i.random=YE,i.round=ZE,i.sign=XE,i.sin=JE,i.sinh=QE,i.sqrt=e_,i.sub=t_,i.sum=r_,i.tan=n_,i.tanh=i_,i.trunc=o_,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 DE(e,t){return new this(e).div(t)}function BE(e){return new this(e).exp()}function LE(e){return He(e=new this(e),e.e+1,3)}function $E(){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 Ig(e){return e instanceof fa||e&&e.toStringTag===wg||!1}function FE(e){return new this(e).ln()}function UE(e,t){return new this(e).log(t)}function VE(e){return new this(e).log(2)}function zE(e){return new this(e).log(10)}function qE(){return _g(this,arguments,"lt")}function HE(){return _g(this,arguments,"gt")}function WE(e,t){return new this(e).mod(t)}function GE(e,t){return new this(e).mul(t)}function KE(e,t){return new this(e).pow(t)}function YE(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:zr(e,1,ki),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(yg);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ke,n&&e&&(i=gr(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 ZE(e){return He(e=new this(e),e.e+1,this.rounding)}function XE(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function JE(e){return new this(e).sin()}function QE(e){return new this(e).sinh()}function e_(e){return new this(e).sqrt()}function t_(e,t){return new this(e).sub(t)}function r_(){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,He(r,this.precision,this.rounding)}function n_(e){return new this(e).tan()}function i_(e){return new this(e).tanh()}function o_(e){return He(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=Ag(Uf);Oc=new fa(Oc),Pc=new fa(Pc);var Bc=fa,$i=es(ts()),Wf=es(ts()),s_=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 yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::aftermath::${c}`,typeArguments:[u,l,r.extendedDetails.aftermathLpSupplyType],arguments:d})})}},Og="0x000000000000000000000000000000000000000000000000000000000000dee9",a_=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return yt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:Og,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 yt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${Og}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n,i){return yt(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(Cn)],w=br(e.publishedAtV2(),i),x=t.moveCall({target:`${w}::deepbook::${c}`,typeArguments:[u,l],arguments:p});return d.isCreate&&t.transferObjects([d.accountCap],e.signer),x})}},c_=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n,i){return yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_amm::${c}`,typeArguments:[u,l],arguments:d})})}},u_=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 yt(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(Cn)],p=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::kriya_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},l_=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n,i){return yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_amm::${c}`,typeArguments:[u,l],arguments:d})})}},f_=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 yt(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(Cn)],p=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::flowx_clmm::${c}`,typeArguments:[u,l],arguments:d})})}},d_=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n,i){return yt(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(Cn),t.object(this.versioned)],p=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::turbos::${c}`,typeArguments:[u,l,r.extendedDetails.turbosFeeType],arguments:d})})}},Pg=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(Cn)],w=br(e.publishedAtV2(),i),x=t.moveCall({target:`${w}::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],w=br(e.publishedAtV2(),o);return t.moveCall({target:`${w}::cetus::${u}`,typeArguments:[l,d],arguments:p})[0]}swap(e,t,r,n,i){return yt(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(Cn)],p=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::cetus::${c}`,typeArguments:[u,l],arguments:d})})}};function Rg(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 Ng(e){return e.split("::")[0]}function _n(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=_n(r),u=uE(cE({},c),{type_arguments:i.map(l=>_n(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Wn.isSuiCoin(l)?l:_n(l).source_address),u.source_address=Rg(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===kg||r===m_?"0x2":Kr(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=Rg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function jg(e){return _n(e).source_address}var h_="0x2::coin::Coin",p_=/^0x2::coin::Coin<(.+)>$/,kg="0x2::sui::SUI",m_="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Wn=class ro{static getCoinTypeArg(t){const r=t.type.match(p_);return r?r[1]:null}static isSUI(t){const r=ro.getCoinTypeArg(t);return r?ro.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`${h_}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{jg(i.coinAddress)===jg(t)&&n.push(i)}),n}static isSuiCoin(t){return _n(t).full_address===kg}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=ro.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=ro.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),o=ro.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:ro.sortByBalance(a),remainingCoins:ro.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";default:return"Unknown error"}}function Fi(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 g_(e,t){e=Fi(e),t=Fi(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 Dg(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Kf(e,t,r,n){const i=Wn.getCoinAssets(n,t);if(r===BigInt(0))return Wn.isSuiCoin(n)||i.length===0&&!Wn.isSuiCoin(n)?{targetCoin:Dg(e,n),isMintZeroCoin:!0,targetCoinAmount:0}:{targetCoin:e.object(i[0].coinObjectId),isMintZeroCoin:!1,targetCoinAmount:Number(i[0].balance.toString())};if(Wn.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Wn.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let s=Wn.sortByBalance(i);s.slice(0,3).reduce((p,w)=>p+w.balance,BigInt(0))<BigInt(r)&&(s=Wn.sortByBalanceDes(i));let c=Wn.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 v_(e){return!(!e.startsWith("0x")||e.length!==66)}var is=es(ts()),Ui=es(ts()),da=es(ts()),vi=new da.default(0);new da.default(1);var y_=new da.default(2);y_.pow(new da.default(128));var w_=new da.default("18446744073709551615"),sn=1e9;function b_(e,t,r){let n=vi;return t?n=e.mul(new Ui.default(sn-r*sn)).div(new Ui.default(sn)):n=e.mul(new Ui.default(sn+r*sn)).div(new Ui.default(sn)),Number(n.toString())}function x_(e,t,r){let n=vi;return t?n=e.mul(new Ui.default(sn-r*sn)).div(new Ui.default(sn)):n=e.mul(new Ui.default(sn+r*sn)).div(new Ui.default(sn)),n}function S_(e,t,r){return new Bc(e).mul(Bc.pow(2,-64)).pow(2).mul(Bc.pow(10,t-r))}function E_(e,t,r,n){return yt(this,null,function*(){var i,o,s,a,c;const{from:u,target:l,amount:d,byAmountIn:p,pools:w}=t,x=Fi(u),y=Fi(l),A=new Ho,O=g_(x,y),R=n===0?"0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4":"0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6",k=O?x:y,F=O?y:x,$=[k,F];for(let C=0;C<w.length;C++){const g=[A.object(w[C]),A.pure.bool(O),A.pure.bool(p),A.pure.u64(d.toString())];A.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:$})}if(!v_(r))throw new AggregateError("Aggregator package not set","InvalidWallet");const H=yield e.devInspectTransactionBlock({transactionBlock:A,sender:r});if(H.error!=null)throw console.log("simulateRes.error",H.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=H.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==w.length)throw new AggregateError("Simulate event result error","simulateEventError");let Y=p?vi:w_,ne=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new is.BN(q[C].parsedJson.data.amount_out);g.gt(Y)&&(ne=C,Y=g)}else{const g=new is.BN(q[C].parsedJson.data.amount_out);g.lt(Y)&&(ne=C,Y=g)}const se=q[ne].parsedJson.data,ae=se.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=S_(ae,z,D),f=Number(se.fee_rate)/1e6,m=new is.BN((o=se.amount_in)!=null?o:0),S=new is.BN((s=se.fee_amount)!=null?s:0),M=m.add(S),_={amountIn:M,amountOut:new is.BN((a=se.amount_out)!=null?a:0),routes:[{path:[{id:w[ne],direction:O,provider:"CETUS",from:x,target:y,feeRate:f,amountIn:se.amount_in,amountOut:se.amount_out,extendedDetails:{afterSqrtPrice:se.after_sqrt_price}}],amountIn:M,amountOut:new is.BN((c=se.amount_out)!=null?c:0),initialPrice:h}],insufficientLiquidity:!1,byAmountIn:t.byAmountIn};return{isExceed:se.is_exceed,routeData:_}})}var __=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n,i){return yt(this,null,function*(){const{direction:o}=r,s=o?"swap_a2b":"swap_b2a",a=[t.object(r.id),t.object("0x5"),n],c=br(e.publishedAtV2(),i);return t.moveCall({target:`${c}::haedal::${s}`,typeArguments:[],arguments:a})})}},C_=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 yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${c}::afsui::${s}`,typeArguments:[],arguments:a})})}},M_=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 yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${c}::volo::${s}`,typeArguments:[],arguments:a})})}},T_=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n,i){return yt(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=br(e.publishedAtV2(),i);return t.moveCall({target:`${p}::bluemove::${c}`,typeArguments:[u,l],arguments:d})})}},A_=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i,o){return yt(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=Dg(t,e.deepbookv3DeepFeeType());const w=[t.object(this.deepbookV3Config),t.object(r.id),n,p,t.object(Cn)],x=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${x}::deepbookv3::${u}`,typeArguments:[l,d],arguments:w})})}},I_=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 yt(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(Cn)],p=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::scallop::${c}`,typeArguments:[u,l],arguments:d})})}},Bg=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 yt(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=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::suilend::${c}`,typeArguments:[u],arguments:l})})}},O_=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n,i){return yt(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(Cn)],p=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${p}::bluefin::${c}`,typeArguments:[u,l],arguments:d})})}},P_=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 yt(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),x=this.pythPriceIDs.get(p);if(!w||!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(w),t.object(x),n,t.object(Cn)],A=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${A}::haedalpmm::${c}`,typeArguments:[u,l],arguments:y})})}},R_=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 yt(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=xo(e.publishedAtV2Extend(),i);return t.moveCall({target:`${d}::alphafi::${c}`,typeArguments:[u],arguments:l})})}},N_=class{constructor(e){if(e!==0)throw new Error("Steamm only supported on mainnet")}swap(e,t,r,n,i){return yt(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(Cn)],p=xo(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})})}},Lg="CETUS",j_="DEEPBOOK",k_="KRIYA",D_="FLOWX",B_="FLOWXV3",L_="KRIYAV3",$g="TURBOS",Yf="AFTERMATH",$_="HAEDAL",F_="VOLO",U_="AFSUI",V_="BLUEMOVE",Fg="DEEPBOOKV3",Ug="SCALLOP",z_="SUILEND",q_="BLUEFIN",Zf="HAEDALPMM",H_="ALPHAFI",W_="SPRINGSUI",Vg="STEAMM",G_="https://api-sui.cetus.zone/router_v2";function zg(e){return Array.isArray(e.routers)}function Xf(e){return Array.isArray(e.routers)}var qg=class M2{constructor(t,r,n,i){this.endpoint=t?J_(t):G_,this.client=n||new na({url:n0("mainnet")}),this.signer=r||"",this.env=i||0,this.allCoins=new Map;const o=M2.CONFIG[this.env];this.pythConnections=o.connections,this.pythClient=new ia.SuiPythClient(this.client,o.pythStateId,o.wormholeStateId)}getCoins(t,r=!0){return yt(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(;;){const s=yield this.client.getCoins({owner:this.signer,coinType:t,cursor:n,limit:i});for(const a of s.data)o.push({coinAddress:_n(a.coinType).source_address,coinObjectId:a.coinObjectId,balance:BigInt(a.balance)});if(s.data.length<i)break;n=s.data[i-1].coinObjectId}return this.allCoins.set(t,o),o})}findRouters(t){return yt(this,null,function*(){return Q_(this.endpoint,t)})}expectInputSwap(t,r,n,i,o,s,a,c){return yt(this,null,function*(){if(n.length===0)throw new Error("No router found");const u=n.map(A=>A.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 A=0;A<n.length;A++){if(n[A].path.length===0)throw new Error("Empty path");let O=p[A];for(const R of n[A].path)O=yield this.newDex(R.provider,o,s).swap(this,t,R,O,c,a);w.push(O)}const x=br(this.publishedAtV2(),c);return this.transferOrDestoryCoin(t,r,l,this.publishedAtV2()),this.checkCoinThresholdAndMergeCoin(t,w,d,i,x)})}expectOutputSwap(t,r,n,i,o){return yt(this,null,function*(){const s=[],a=[],c=[],u=new Pg(this.env,i),l=br(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 A=w.path[y],O=u.flash_swap(this,t,A,!1);s.unshift(O.targetCoin),a.unshift(O.flashReceipt)}let x=r;for(let y=0;y<w.path.length;y++){const A=w.path[y],O=u.repay_flash_swap(this,t,A,x,a[y]);x=s[y],y===0?r=O:this.transferOrDestoryCoin(t,O,A.from,l),y===w.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:`${qs}::pay::join_vec`,typeArguments:[n[0].path[n[0].path.length-1].target],arguments:[c[0],p]})}return c[0]})}swapInPools(t){return yt(this,null,function*(){let r;try{r=yield E_(this.client,t,this.signer,this.env)}catch(n){return console.error("swapInPools error:",n),null}return r})}routerSwap(t){return yt(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=zg(t)?t.byAmountIn:t.routers.byAmountIn,l=c.reduce((k,F)=>k.add(F.amountIn),new $i.default(0)),d=c.reduce((k,F)=>k.add(F.amountOut),new $i.default(0)),p=x_(u?d:l,u,i),w=zg(t)?void 0:t.routers.packages,x=br(this.publishedAtV2(),w),y=K_(c),A=y.length>0?yield this.updatePythPriceIDs(y,o):new Map;if(u)return yield this.expectInputSwap(o,n,c,p,A,s,a,w);const O=o.splitCoins(n,[p.toString()]);return this.transferOrDestoryCoin(o,n,c[0].path[0].from,x),yield this.expectOutputSwap(o,O[0],c,s)})}fastRouterSwap(t){return yt(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(($,H)=>$.add(H.amountIn),new $i.default(0)),w=c.reduce(($,H)=>$.add(H.amountOut),new $i.default(0)),x=Xf(t)?t.byAmountIn:t.routers.byAmountIn,y=b_(x?w:p,x,n),O=Kf(i,l,BigInt((x?p:y).toString()),u);let R;if(a&&a>0){let $=yield this.getCoins(this.deepbookv3DeepFeeType());R=Kf(i,$,BigInt(a),this.deepbookv3DeepFeeType()).targetCoin}const k=Xf(t)?{routers:c,inputCoin:O.targetCoin,slippage:n,byAmountIn:x,txb:i,partner:o,deepbookv3DeepFee:R}:{routers:t.routers,inputCoin:O.targetCoin,slippage:n,byAmountIn:x,txb:i,partner:o,deepbookv3DeepFee:R},F=yield this.routerSwap(k);if(Wn.isSuiCoin(d))i.mergeCoins(i.gas,[F]);else{let $=yield this.getCoins(d,s);const H=Kf(i,$,BigInt(0),d),q=Xf(t)?void 0:t.routers.packages,Y=br(this.publishedAtV2(),q);i.mergeCoins(H.targetCoin,[F]),H.isMintZeroCoin&&this.transferOrDestoryCoin(i,H.targetCoin,d,Y)}})}publishedAtV2(){return this.env===0?"0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2Extend(){return this.env===0?"0xa2d8a4279d69d8fec04b2fea8852d0d467d3cc0d39c5890180d439ae7a9953ed":"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:`${qs}::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 Lg:return new Pg(this.env,n);case j_:return new a_(this.env);case Fg:return new A_(this.env);case k_:return new c_(this.env);case L_:return new u_(this.env);case D_:return new l_(this.env);case B_:return new f_(this.env);case $g:return new d_(this.env);case Yf:return new s_(this.env);case $_:return new __(this.env);case U_:return new C_(this.env);case F_:return new M_(this.env);case V_:return new T_(this.env);case Ug:return new I_(this.env);case z_:return new Bg(this.env);case W_:return new Bg(this.env);case q_:return new O_(this.env);case Zf:return new P_(this.env,r);case H_:return new R_(this.env);case Vg:return new N_(this.env);default:throw new Error(`Unsupported dex ${t}`)}}signAndExecuteTransaction(t,r){return yt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(t){return yt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:t,sender:this.signer})})}sendTransaction(t,r){return yt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:t,signer:r})})}getDeepbookV3Config(){return yt(this,null,function*(){const t=yield rC(this.endpoint);return t?t.data:null})}updatePythPriceIDs(t,r){return yt(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(`No pyth price seeds update data found: ${i==null?void 0:i.message}`);let o=[];try{o=yield this.pythClient.updatePriceFeeds(r,n,t)}catch(a){throw new Error(`Failed to update price feeds: ${a}`)}let s=new Map;for(let a=0;a<t.length;a++)s.set(t[a],o[a]);return s})}};qg.CONFIG={1:{connections:[new ia.SuiPriceServiceConnection("https://hermes-beta.pyth.network")],wormholeStateId:"0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",pythStateId:"0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c"},0:{connections:[new ia.SuiPriceServiceConnection("https://cetus.liquify.com/api=X9LTVPQD7Y3R5N2A/hermes",{timeout:3e3}),new ia.SuiPriceServiceConnection("https://hermes.pyth.network",{timeout:3e3})],wormholeStateId:"0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",pythStateId:"0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"}};var Hg=qg;function K_(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));return Array.from(t)}function Y_(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 $i.default(e.amount_in.toString()),amountOut:new $i.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,x,y,A,O,R,k,F;let $;s.provider===Yf&&($=s.extended_details.aftermath_pool_flatness===0?"v2":"v3");let H;return(s.provider===$g||s.provider===Yf||s.provider===Lg||s.provider===Fg||s.provider===Ug||s.provider===Zf||s.provider===Vg)&&(H={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:(x=s.extended_details)==null?void 0:x.steamm_bank_a,steammBankB:(y=s.extended_details)==null?void 0:y.steamm_bank_b,steammLendingMarket:(A=s.extended_details)==null?void 0:A.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}),{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:H,version:$}}),amountIn:new $i.default(o.amount_in.toString()),amountOut:new $i.default(o.amount_out.toString()),initialPrice:new Bc(o.initial_price.toString())})),totalDeepFee:r,packages:n}}var Cn=K0,Z_="aggregator_v2",X_="aggregator_v2_extend";function br(e,t){var r;return t instanceof Map&&(r=t.get(Z_))!=null?r:e}function xo(e,t){var r;return t instanceof Map&&(r=t.get(X_))!=null?r:e}es(ts());function J_(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function Q_(e,t){return yt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield tC(e,t):r=yield eC(e,t),!r)return null;if(!r.ok)return{amountIn:vi,amountOut:vi,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:!1,error:{code:10001,msg:Gf(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:vi,amountOut:vi,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:i,error:{code:10004,msg:Gf(10004)}}:n.data!=null?(console.log("data.data",JSON.stringify(n.data,null,2)),Y_(n.data,t.byAmountIn)):{amountIn:vi,amountOut:vi,routes:[],insufficientLiquidity:i,byAmountIn:t.byAmountIn,error:{code:10003,msg:Gf(10003)}}})}function eC(e,t){return yt(this,null,function*(){try{const{from:r,target:n,amount:i,byAmountIn:o,depth:s,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l}=t,d=Fi(r),p=Fi(n);let w=`${e}/find_routes?from=${d}&target=${p}&amount=${i.toString()}&by_amount_in=${o}`;return s&&(w+=`&depth=${s}`),a&&(w+=`&split_algorithm=${a}`),c&&(w+=`&split_factor=${c}`),u&&(w+=`&split_count=${u}`),l&&l.length>0&&(w+=`&providers=${l.join(",")}`),w+="&v=1000327",yield fetch(w)}catch(r){return console.error(r),null}})}function tC(e,t){return yt(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=Fi(r),w=Fi(n),x=`${e}/find_routes`,y=l==null?void 0:l.join(","),A={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}))};try{return yield fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(O){return console.error("Error:",O),null}})}function rC(e){return yt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var Wg=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(Wg||{});const Gg="0x2::sui::SUI",nC="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function Kg(e){return Rr(e).full_address===Gg}function Yg(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=>Kg(l)?l:Rr(l).source_address),u.source_address=Yg(u.full_address,u.type_arguments),u}const o=r.split("::"),a={full_address:r,address:r===Gg||r===nC?"0x2":Kr(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=Yg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function iC(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const yi=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Kr(n);return t&&(i=iC(i)),`${i}::${r.join("::")}`};/*!
39
35
  * decimal.js v10.4.3
40
36
  * An arbitrary-precision Decimal type for JavaScript.
41
37
  * https://github.com/MikeMcl/decimal.js
42
38
  * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
43
39
  * MIT Licence
44
- */var Fo=9e15,us=1e9,pp="0123456789abcdef",Xu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ju="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mp={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Fo,maxE:Fo,crypto:!1},hx,Ni,ct=!0,Yu="[DecimalError] ",ls=Yu+"Invalid argument: ",px=Yu+"Precision limit exceeded",mx=Yu+"crypto unavailable",gx="[object Decimal]",Pr=Math.floor,mr=Math.pow,oR=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,aR=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,cR=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,vx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,In=1e7,Qe=7,uR=9007199254740991,lR=Xu.length-1,gp=Ju.length-1,we={toStringTag:gx};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Je(e)},we.ceil=function(){return Je(new this.constructor(this),this.e+1,2)},we.clampedTo=we.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(ls+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},we.comparedTo=we.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},we.cosine=we.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())+Qe,n.rounding=1,r=fR(n,Sx(n,r)),n.precision=e,n.rounding=t,Je(Ni==2||Ni==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},we.cubeRoot=we.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(ct=!1,s=l.s*mr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=_r(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=mr(r,1/3),e=Pr((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Wt(u.plus(l).times(a),u.plus(c),o+2,1),_r(a.d).slice(0,o)===(r=_r(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Je(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Je(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ct=!0,Je(n,e,f.rounding,t)},we.decimalPlaces=we.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Pr(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},we.dividedBy=we.div=function(e){return Wt(this,new this.constructor(e))},we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Je(Wt(t,new r(e),0,1,1),r.precision,r.rounding)},we.equals=we.eq=function(e){return this.cmp(e)===0},we.floor=function(){return Je(new this.constructor(this),this.e+1,3)},we.greaterThan=we.gt=function(e){return this.cmp(e)>0},we.greaterThanOrEqualTo=we.gte=function(e){var t=this.cmp(e);return t==1||t===0},we.hyperbolicCosine=we.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/tl(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Uo(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Je(s,o.precision=r,o.rounding=n,!0)},we.hyperbolicSine=we.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Uo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/tl(5,e)),i=Uo(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Je(i,t,r,!0)},we.hyperbolicTangent=we.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,Wt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},we.inverseCosine=we.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?Pn(r,i,s):new r(0):new r(NaN):t.isZero()?Pn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Pn(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},we.inverseHyperbolicCosine=we.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,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},we.inverseHyperbolicSine=we.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,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln())},we.inverseHyperbolicTangent=we.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Je(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Wt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},we.inverseSine=we.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=Pn(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},we.inverseTangent=we.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=gp)return o=Pn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=gp)return o=Pn(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Qe+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ct=!1,t=Math.ceil(a/Qe),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),ct=!0,Je(o,l.precision=f,l.rounding=h,!0)},we.isFinite=function(){return!!this.d},we.isInteger=we.isInt=function(){return!!this.d&&Pr(this.e/Qe)>this.d.length-2},we.isNaN=function(){return!this.s},we.isNegative=we.isNeg=function(){return this.s<0},we.isPositive=we.isPos=function(){return this.s>0},we.isZero=function(){return!!this.d&&this.d[0]===0},we.lessThan=we.lt=function(e){return this.cmp(e)<0},we.lessThanOrEqualTo=we.lte=function(e){return this.cmp(e)<1},we.logarithm=we.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=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)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(ct=!1,a=f+y,o=ds(u,a),n=t?el(l,a+10):ds(e,a),c=Wt(o,n,a,1),oc(c.d,i=f,h))do if(a+=10,o=ds(u,a),n=t?el(l,a+10):ds(e,a),c=Wt(o,n,a,1),!s){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=Je(c,f+1,0));break}while(oc(c.d,i+=10,h));return ct=!0,Je(c,f,h)},we.minus=we.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return ct?Je(e,a,c):e}if(r=Pr(e.e/Qe),l=Pr(y.e/Qe),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Qe),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=In-1;--u[i],u[n]+=In}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Qu(u,r),ct?Je(e,a,c):e):new b(c===3?-0:0)},we.modulo=we.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]?Je(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Wt(r,e.abs(),0,3,1),t.s*=e.s):t=Wt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))},we.naturalExponential=we.exp=function(){return vp(this)},we.naturalLogarithm=we.ln=function(){return ds(this)},we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Je(e)},we.plus=we.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),ct?Je(e,a,c):e;if(s=Pr(f.e/Qe),n=Pr(e.e/Qe),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Qe),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,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),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Qu(u,n),ct?Je(e,a,c):e},we.precision=we.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ls+e);return r.d?(t=yx(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},we.round=function(){var e=this,t=e.constructor;return Je(new t(e),e.e+1,t.rounding)},we.sine=we.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())+Qe,n.rounding=1,r=hR(n,Sx(n,r)),n.precision=e,n.rounding=t,Je(Ni>2?r.neg():r,e,t,!0)):new n(NaN)},we.squareRoot=we.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(ct=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=_r(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(s=n,n=s.plus(Wt(o,s,r+2,1)).times(.5),_r(s.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&&(Je(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Je(n,c+1,1),e=!n.times(n).eq(o));break}return ct=!0,Je(n,c,l.rounding,e)},we.tangent=we.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=Wt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Je(Ni==2||Ni==4?r.neg():r,e,t,!0)):new n(NaN)},we.times=we.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Pr(l.e/Qe)+Pr(e.e/Qe),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%In|0,t=a/In|0;s[i]=(s[i]+t)%In|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Qu(s,r),ct?Je(e,f.precision,f.rounding):e},we.toBinary=function(e,t){return bp(this,2,e,t)},we.toDecimalPlaces=we.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Wr(e,0,us),t===void 0?t=n.rounding:Wr(t,0,8),Je(r,e+r.e+1,t))},we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ii(n,!0):(Wr(e,0,us),t===void 0?t=i.rounding:Wr(t,0,8),n=Je(new i(n),e+1,t),r=ii(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ii(i):(Wr(e,0,us),t===void 0?t=s.rounding:Wr(t,0,8),n=Je(new s(i),e+i.e+1,t),r=ii(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},we.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=yx(b)-y.e-1,o=s%Qe,t.d[0]=mr(10,o<0?Qe+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(ls+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(_r(b)),l=w.precision,w.precision=s=b.length*Qe*2;f=Wt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=Wt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=Wt(u,n,s,1).minus(y).abs().cmp(Wt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h},we.toHexadecimal=we.toHex=function(e,t){return bp(this,16,e,t)},we.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]?(ct=!1,r=Wt(r,e,0,t,1).times(e),ct=!0,Je(r)):(e.s=r.s,r=e),r},we.toNumber=function(){return+this},we.toOctal=function(e,t){return bp(this,8,e,t)},we.toPower=we.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(mr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Je(a,n,s);if(t=Pr(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=uR)return i=bx(c,a,r,n),e.s<0?new c(1).div(i):Je(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=mr(+a,u),t=r==0||!isFinite(r)?Pr(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?o/0:0):(ct=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=vp(e.times(ds(a,n+r)),n),i.d&&(i=Je(i,n+5,1),oc(i.d,n,s)&&(t=n+10,i=Je(vp(e.times(ds(a,t+r)),t),t+5,1),+_r(i.d).slice(n+1,n+15)+1==1e14&&(i=Je(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Je(i,n,s))},we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ii(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Wr(e,1,us),t===void 0?t=i.rounding:Wr(t,0,8),n=Je(new i(n),e,t),r=ii(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toSignificantDigits=we.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Wr(e,1,us),t===void 0?t=n.rounding:Wr(t,0,8)),Je(new n(r),e,t)},we.toString=function(){var e=this,t=e.constructor,r=ii(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},we.truncated=we.trunc=function(){return Je(new this.constructor(this),this.e+1,1)},we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ii(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,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Qe-n.length,r&&(s+=fs(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=fs(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Wr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(ls+e)}function oc(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Qe,i=0):(i=Math.ceil((t+1)/Qe),t%=Qe),s=mr(10,Qe-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==mr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==mr(10,t-3)-1,o}function Zu(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=pp.indexOf(e.charAt(o++)),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 fR(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/tl(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Uo(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Wt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,T,P,k,R,F,L,G,q,X,ie,ae,ce,z,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=In,y=Qe,l=Pr(n.e/y)-Pr(i.e/y)),ce=m.length,ie=d.length,P=new D(p),k=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)k.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),k[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),F=R.length;F<ce;)R[F++]=0;z=m.slice(),z.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,F),u<0?(L=R[0],ce!=F&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,F=R.length,u=t(w,R,T,F),u==1&&(h--,r(w,ce<T?z:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<F&&w.unshift(0),r(R,w,F,c),u==-1&&(F=R.length,u=t(m,R,ce,F),u<1&&(h++,r(R,ce<F?z:m,F,c))),F=R.length):u===0&&(h++,R=[0]),k[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ie||R[0]!==void 0)&&G--);b=R[0]!==void 0}k[0]||k.shift()}if(y==1)P.e=l,hx=b;else{for(f=1,h=k[0];h>=10;h/=10)f++;P.e=f+l*y-1,Je(P,a?s+P.e+1:s,o,b)}return P}}();function Je(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Qe,o=t,l=f[h=0],c=l/mr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Qe),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Qe,o=s-Qe+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Qe,o=s-Qe+i,c=o<0?0:l/mr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%mr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/mr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=mr(10,(Qe-t%Qe)%Qe),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=mr(10,Qe-s),f[h]=o>0?(l/mr(10,i-o)%mr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==In&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=In)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ct&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ii(e,t,r){if(!e.isFinite())return xx(e);var n,i=e.e,s=_r(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+fs(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+fs(-i-1)+s,r&&(n=r-o)>0&&(s+=fs(n))):i>=o?(s+=fs(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+fs(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=fs(n))),s}function Qu(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function el(e,t,r){if(t>lR)throw ct=!0,r&&(e.precision=r),Error(px);return Je(new e(Xu),t,1,!0)}function Pn(e,t,r){if(t>gp)throw Error(px);return Je(new e(Ju),t,r,!0)}function yx(e){var t=e.length-1,r=t*Qe+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 fs(e){for(var t="";e--;)t+="0";return t}function bx(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Qe+4);for(ct=!1;;){if(r%2&&(s=s.times(t),Ex(s.d,o)&&(i=!0)),r=Pr(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),Ex(t.d,o)}return ct=!0,s}function wx(e){return e.d[e.d.length-1]&1}function _x(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function vp(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ct=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(mr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Je(s.times(e),c,1),r=r.times(++l),a=o.plus(Wt(s,r,c,1)),_r(a.d).slice(0,c)===_r(o.d).slice(0,c)){for(i=f;i--;)o=Je(o.times(o),c,1);if(t==null)if(u<3&&oc(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Je(o,h.precision=b,y,ct=!0);else return h.precision=b,o}o=a}}function ds(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,P=w.constructor,k=P.rounding,R=P.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new P(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(ct=!1,l=R):l=t,P.precision=l+=b,r=_r(T),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=_r(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=el(P,l+2,R).times(s+""),w=ds(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Je(w,R,k,ct=!0):w;for(f=w,c=o=w=Wt(w.minus(1),w.plus(1),l,1),h=Je(w.times(w),l,1),i=3;;){if(o=Je(o.times(h),l,1),u=c.plus(Wt(o,new P(i),l,1)),_r(u.d).slice(0,l)===_r(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(el(P,l+2,R).times(s+""))),c=Wt(c,new P(y),l,1),t==null)if(oc(c.d,l-b,k,a))P.precision=l+=b,u=o=w=Wt(f.minus(1),f.plus(1),l,1),h=Je(w.times(w),l,1),i=a=1;else return Je(c,P.precision=R,k,ct=!0);else return P.precision=R,c;c=u,i+=2}}function xx(e){return String(e.s*e.s/0)}function yp(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)%Qe,r<0&&(n+=Qe),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Qe;n<i;)e.d.push(+t.slice(n,n+=Qe));t=t.slice(n),n=Qe-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ct&&(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 dR(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),vx.test(t))return yp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(aR.test(t))r=16,t=t.toLowerCase();else if(oR.test(t))r=2;else if(cR.test(t))r=8;else throw Error(ls+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=bx(n,new n(r),s,s*2)),u=Zu(t,r,In),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Qu(u,l),e.d=u,ct=!1,o&&(e=Wt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?mr(2,c):Br.pow(2,c))),ct=!0,e)}function hR(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Uo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/tl(5,r)),t=Uo(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function Uo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Qe);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Wt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Wt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return ct=!0,o.d.length=l+1,o}function tl(e,t){for(var r=e;--t;)r*=e;return r}function Sx(e,t){var r,n=t.s<0,i=Pn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Ni=n?4:1,t;if(r=t.divToInt(i),r.isZero())Ni=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Ni=wx(r)?n?2:3:n?4:1,t;Ni=wx(r)?n?1:4:n?3:2}return t.minus(i).abs()}function bp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Wr(r,1,us),n===void 0?n=y.rounding:Wr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=xx(e);else{for(l=ii(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=Zu(ii(h),10,i),h.e=h.d.length),f=Zu(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=Wt(e,h,r,n,0,i),f=e.d,s=e.e,u=hx),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=pp.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=Zu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=pp.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Ex(e,t){if(e.length>t)return e.length=t,!0}function pR(e){return new this(e).abs()}function mR(e){return new this(e).acos()}function gR(e){return new this(e).acosh()}function vR(e,t){return new this(e).plus(t)}function yR(e){return new this(e).asin()}function bR(e){return new this(e).asinh()}function wR(e){return new this(e).atan()}function _R(e){return new this(e).atanh()}function xR(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=Pn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Pn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Pn(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Wt(e,t,s,1)),t=Pn(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Wt(e,t,s,1)),r}function SR(e){return new this(e).cbrt()}function ER(e){return Je(e=new this(e),e.e+1,2)}function CR(e,t,r){return new this(e).clamp(t,r)}function AR(e){if(!e||typeof e!="object")throw Error(Yu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,us,"rounding",0,8,"toExpNeg",-Fo,0,"toExpPos",0,Fo,"maxE",0,Fo,"minE",-Fo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=mp[r]),(n=e[r])!==void 0)if(Pr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(ls+r+": "+n);if(r="crypto",i&&(this[r]=mp[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(mx);else this[r]=!1;else throw Error(ls+r+": "+n);return this}function MR(e){return new this(e).cos()}function TR(e){return new this(e).cosh()}function Cx(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,Ax(s)){u.s=s.s,ct?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;ct?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return yp(u,s.toString())}else if(c!=="string")throw Error(ls+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),vx.test(s)?yp(u,s):dR(u,s)}if(i.prototype=we,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=AR,i.clone=Cx,i.isDecimal=Ax,i.abs=pR,i.acos=mR,i.acosh=gR,i.add=vR,i.asin=yR,i.asinh=bR,i.atan=wR,i.atanh=_R,i.atan2=xR,i.cbrt=SR,i.ceil=ER,i.clamp=CR,i.cos=MR,i.cosh=TR,i.div=OR,i.exp=IR,i.floor=PR,i.hypot=jR,i.ln=kR,i.log=NR,i.log10=DR,i.log2=RR,i.max=$R,i.min=BR,i.mod=LR,i.mul=FR,i.pow=UR,i.random=VR,i.round=zR,i.sign=qR,i.sin=WR,i.sinh=GR,i.sqrt=HR,i.sub=KR,i.sum=XR,i.tan=JR,i.tanh=YR,i.trunc=ZR,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 OR(e,t){return new this(e).div(t)}function IR(e){return new this(e).exp()}function PR(e){return Je(e=new this(e),e.e+1,3)}function jR(){var e,t,r=new this(0);for(ct=!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 ct=!0,new this(1/0);r=t}return ct=!0,r.sqrt()}function Ax(e){return e instanceof Br||e&&e.toStringTag===gx||!1}function kR(e){return new this(e).ln()}function NR(e,t){return new this(e).log(t)}function RR(e){return new this(e).log(2)}function DR(e){return new this(e).log(10)}function $R(){return _x(this,arguments,"lt")}function BR(){return _x(this,arguments,"gt")}function LR(e,t){return new this(e).mod(t)}function FR(e,t){return new this(e).mul(t)}function UR(e,t){return new this(e).pow(t)}function VR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Wr(e,1,us),n=Math.ceil(e/Qe),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(mx);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=mr(10,Qe-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Qe)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Qe&&(r-=Qe-n)}return o.e=r,o.d=a,o}function zR(e){return Je(e=new this(e),e.e+1,this.rounding)}function qR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function WR(e){return new this(e).sin()}function GR(e){return new this(e).sinh()}function HR(e){return new this(e).sqrt()}function KR(e,t){return new this(e).sub(t)}function XR(){var e=0,t=arguments,r=new this(t[e]);for(ct=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ct=!0,Je(r,this.precision,this.rounding)}function JR(e){return new this(e).tan()}function YR(e){return new this(e).tanh()}function ZR(e){return Je(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString,we[Symbol.toStringTag]="Decimal";var Br=we.constructor=Cx(mp);Xu=new Br(Xu),Ju=new Br(Ju),Br.config({precision:256,rounding:Br.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const jr=(e,t,r,n=Br.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=Gs(e,t,n);if(!Le(u).equals(0))return r?u:Vo(u)}const i=Le(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Le(o).gt(0))!a||Le(o.length).gte(9)?c=Gs(i,0,n):Le(o.length).gte(4)?c=Gs(i,2,n):c=Gs(i,4,n);else{Gs(i,6,n);const u=tD(a);if(u<6)c=Gs(i,u+6,n);else{if(u>30)return"0";c=Gs(i,9+(u-6),n)}}return r||Le(o).lt(1)?c:Vo(c)},Mx=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=jr(e,t,!0,Br.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Vo(i).toString();return o.includes("e")&&(o=n?i:Vo(i).toString()),!r&&Number(i)<Math.pow(10,-t)?s?`-$${o.slice(1)}`:`<$${Math.pow(10,-t).toFixed(t)}`:s?`-$${o.slice(1)}`:`$${o}`}catch{return"$--"}},QR=(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(),s=n<0;let o=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],f=a[4];let h="",y=u?u.substr(f):"";if(y&&(y=`.${y}`),l!=="-"){for(let b=0;b<f;b+=1){const w=u[b]||"0";h+=w}o=c+h+y}else{let b="0";for(let w=0;w<f;w+=1)h=(c[c.length-w-1]||"0")+h;c.length>f&&(b=c.substr(0,c.length-f)),o=`${b}.${h}${u}`}}if(t&&r){let a=`${o.split(".")[0]}.`;const c=o.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";o=a}if(o.length>14){const a=o.split(".");a[0].length>14?o=`${a[0].slice(0,14)}+`:(o=o.slice(0,13),o.indexOf(".")===12&&(o=o.slice(0,12)))}return`${s?"-":""}${o}`},Le=e=>Br.isDecimal(e)?e:new Br(typeof e>"u"||e==="undefined"||!e?0:e);function eD(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Gs=(e,t,r)=>Le(e).toDP(t,r).toString(),Vo=e=>{const[t,r]=e.split(".");let n="";for(let i=t.length-1,s=0;i>=0;i--,s++)n=t[i]+n,s%3===2&&i!==0&&(n=","+n);return r?`${n}.${r}`:n};function tD(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function rD(e,t){const r=Tx(Le(t));return Number(Le(e).mul(r))}function nD(e,t){const r=Tx(Le(t));return Number(Le(e).div(r))}function Tx(e){return Le(10).pow(Le(e).abs())}function wp(e,t){const r=nD(e,t);return iD(r.toString(),Number(t))}function iD(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return QR(r,t);const[n,i]=r.split("e");let s=n;const o=Math.abs(parseInt(i,10));let a="",c=s.length;if(n.includes(".")){const[u,l]=n.split(".");s=u+l,c=u.length}for(let u=0;u<o-c;u++)a+="0";return`0.${a}${s}`.slice(0,t+2)}return e}function rl(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Hs=(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):"",_p=(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(!_p(e[i],t[i]))return!1;return!0};function Ox(e){return!e||Object.keys(e).length===0}function Ix(e){var t;return((t=e.split("::"))==null?void 0:t.length)===3}const Px=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function sD(e,t,r=!1){var a;const n=e.balanceChanges,i=(a=e.effects)==null?void 0:a.gasUsed,s={};let o="0";return i&&(o=Le(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=sc(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===kf;let f=c.amount;l&&(f=r?f:Le(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function jx(e,t){if(t){const r=e[sc(t.coin_type).full_address];if(r)return wp(Le(r.amount).abs().toFixed(0),t.decimals)}}function $t(e){return`https://archive.cetus.zone/assets/terminal${e}`}const ln=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,nl=(e,t)=>ki(e||"")===ki(t||""),oD=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 s=new AbortController,o=setTimeout(()=>{s.abort()},r);try{const a=await fetch(i,{signal:s.signal});if(clearTimeout(o),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(o),a.name==="AbortError"?new Error("request time out"):a}},aD=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const s=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!s.ok)throw new Error("Request failed");return s.json()}catch(s){throw clearTimeout(i),s.name==="AbortError"?new Error("request time out"):s}},xp="tokenMap",kx="trustedTokenList",Nx="collectTokenMap",Rx="importTokenList";var Dx={exports:{}};/*!
40
+ */var os=9e15,Vi=1e9,Jf="0123456789abcdef",Lc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$c="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qf={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-os,maxE:os,crypto:!1},Zg,wi,st=!0,Fc="[DecimalError] ",zi=Fc+"Invalid argument: ",Xg=Fc+"Precision limit exceeded",Jg=Fc+"crypto unavailable",Qg="[object Decimal]",Nr=Math.floor,vr=Math.pow,oC=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,sC=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aC=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,e1=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mn=1e7,Ye=7,cC=9007199254740991,uC=Lc.length-1,ed=$c.length-1,ve={toStringTag:Qg};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(zi+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=lC(n,s1(n,r)),n.precision=e,n.rounding=t,We(wi==2||wi==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*vr(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=vr(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/qc(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=ss(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=ss(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/qc(5,e)),i=ss(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()?Tn(r,i,o):new r(0):new r(NaN):t.isZero()?Tn(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Tn(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=Tn(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<=ed)return s=Tn(l,d+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=ed)return s=Tn(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=Hi(u,a),n=t?zc(l,a+10):Hi(e,a),c=Kt(s,n,a,1),ha(c.d,i=d,p))do if(a+=10,s=Hi(u,a),n=t?zc(l,a+10):Hi(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,x=w.constructor;if(e=new x(e),!w.d||!e.d)return!w.s||!e.s?e=new x(NaN):w.d?e.s=-e.s:e=new x(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=x.precision,c=x.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new x(w);else return new x(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 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):(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 td(this)},ve.naturalLogarithm=ve.ln=function(){return Hi(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(zi+e);return r.d?(t=t1(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=dC(n,s1(n,r)),n.precision=e,n.rounding=t,We(wi>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(wi==2||wi==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 nd(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,Vi),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=Gn(n,!0):(qr(e,0,Vi),t===void 0?t=i.rounding:qr(t,0,8),n=We(new i(n),e+1,t),r=Gn(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=Gn(i):(qr(e,0,Vi),t===void 0?t=o.rounding:qr(t,0,8),n=We(new o(i),e+i.e+1,t),r=Gn(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,x=w.d,y=w.constructor;if(!x)return new y(w);if(u=r=new y(1),n=c=new y(0),t=new y(n),o=t.e=t1(x)-w.e-1,s=o%Ye,t.d[0]=vr(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(zi+a);e=a.gt(t)?o>0?t:u:a}for(st=!1,a=new y(_r(x)),l=y.precision,y.precision=o=x.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 nd(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 nd(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(vr(+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)<=cC)return i=r1(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=vr(+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=td(e.times(Hi(a,n+r)),n),i.d&&(i=We(i,n+5,1),ha(i.d,n,o)&&(t=n+10,i=We(td(e.times(Hi(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=Gn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(qr(e,1,Vi),t===void 0?t=i.rounding:qr(t,0,8),n=We(new i(n),e,t),r=Gn(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,Vi),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=Gn(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=Gn(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(zi+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=vr(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)==vr(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)==vr(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]+=Jf.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 lC(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/qc(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=ss(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,x,y,A,O,R,k,F,$,H,q,Y,ne,se,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,ne=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?(H=o=D.precision,s=D.rounding):a?H=o+(n.e-i.e)+1:H=o,H<0)R.push(1),x=!0;else{if(H=H/w+2|0,d=0,ae==1){for(p=0,m=m[0],H++;(d<ne||p)&&H--;d++)q=p*c+(f[d]||0),R[d]=q/m|0,p=q%m|0;x=p||d<ne}else{for(p=c/(m[0]+1)|0,p>1&&(m=e(m,p,c),f=e(f,p,c),ae=m.length,ne=f.length),Y=ae,k=f.slice(0,ae),F=k.length;F<ae;)k[F++]=0;z=m.slice(),z.unshift(0),se=m[0],m[1]>=c/2&&++se;do p=0,u=t(m,k,ae,F),u<0?($=k[0],ae!=F&&($=$*c+(k[1]||0)),p=$/se|0,p>1?(p>=c&&(p=c-1),y=e(m,p,c),A=y.length,F=k.length,u=t(y,k,A,F),u==1&&(p--,r(y,ae<A?z:m,A,c))):(p==0&&(u=p=1),y=m.slice()),A=y.length,A<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[Y]||0:(k=[f[Y]],F=1);while((Y++<ne||k[0]!==void 0)&&H--);x=k[0]!==void 0}R[0]||R.shift()}if(w==1)O.e=l,Zg=x;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,x)}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/vr(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/vr(10,i-s-1)%10|0}if(n=n||t<0||d[p+1]!==void 0||(s<0?l:l%vr(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/vr(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]=vr(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=vr(10,Ye-o),d[p]=s>0?(l/vr(10,i-s)%vr(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 Gn(e,t,r){if(!e.isFinite())return o1(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>uC)throw st=!0,r&&(e.precision=r),Error(Xg);return We(new e(Lc),t,1,!0)}function Tn(e,t,r){if(t>ed)throw Error(Xg);return We(new e($c),t,r,!0)}function t1(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 r1(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),a1(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),a1(t.d,s)}return st=!0,o}function n1(e){return e.d[e.d.length-1]&1}function i1(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 td(e,t){var r,n,i,o,s,a,c,u=0,l=0,d=0,p=e.constructor,w=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?(st=!1,c=x):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),d+=5;for(n=Math.log(vr(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=x,w,st=!0);else return p.precision=x,s}s=a}}function Hi(e,t){var r,n,i,o,s,a,c,u,l,d,p,w=1,x=10,y=e,A=y.d,O=y.constructor,R=O.rounding,k=O.precision;if(y.s<0||!A||!A[0]||!y.e&&A[0]==1&&A.length==1)return new O(A&&!A[0]?-1/0:y.s!=1?NaN:A?0:y);if(t==null?(st=!1,l=k):l=t,O.precision=l+=x,r=_r(A),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=Hi(new O(n+"."+r.slice(1)),l-x).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-x,R,a))O.precision=l+=x,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 o1(e){return String(e.s*e.s/0)}function rd(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 fC(e,t){var r,n,i,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),e1.test(t))return rd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(sC.test(t))r=16,t=t.toLowerCase();else if(oC.test(t))r=2;else if(aC.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=r1(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?vr(2,c):Lr.pow(2,c))),st=!0,e)}function dC(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:ss(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/qc(5,r)),t=ss(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 ss(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 qc(e,t){for(var r=e;--t;)r*=e;return r}function s1(e,t){var r,n=t.s<0,i=Tn(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return wi=n?4:1,t;if(r=t.divToInt(i),r.isZero())wi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return wi=n1(r)?n?2:3:n?4:1,t;wi=n1(r)?n?1:4:n?3:2}return t.minus(i).abs()}function nd(e,t,r,n){var i,o,s,a,c,u,l,d,p,w=e.constructor,x=r!==void 0;if(x?(qr(r,1,Vi),n===void 0?n=w.rounding:qr(n,0,8)):(r=w.precision,n=w.rounding),!e.isFinite())l=o1(e);else{for(l=Gn(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 w(1),p.e=l.length-s,p.d=Uc(Gn(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=x?"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=Zg),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+=Jf.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=Uc(l,i,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Jf.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 a1(e,t){if(e.length>t)return e.length=t,!0}function hC(e){return new this(e).abs()}function pC(e){return new this(e).acos()}function mC(e){return new this(e).acosh()}function gC(e,t){return new this(e).plus(t)}function vC(e){return new this(e).asin()}function yC(e){return new this(e).asinh()}function wC(e){return new this(e).atan()}function bC(e){return new this(e).atanh()}function xC(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=Tn(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Tn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Tn(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=Tn(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 SC(e){return new this(e).cbrt()}function EC(e){return We(e=new this(e),e.e+1,2)}function _C(e,t,r){return new this(e).clamp(t,r)}function CC(e){if(!e||typeof e!="object")throw Error(Fc+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,Vi,"rounding",0,8,"toExpNeg",-os,0,"toExpPos",0,os,"maxE",0,os,"minE",-os,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=Qf[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]=Qf[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(Jg);else this[r]=!1;else throw Error(zi+r+": "+n);return this}function MC(e){return new this(e).cos()}function TC(e){return new this(e).cosh()}function c1(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,u1(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 rd(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),e1.test(o)?rd(u,o):fC(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=CC,i.clone=c1,i.isDecimal=u1,i.abs=hC,i.acos=pC,i.acosh=mC,i.add=gC,i.asin=vC,i.asinh=yC,i.atan=wC,i.atanh=bC,i.atan2=xC,i.cbrt=SC,i.ceil=EC,i.clamp=_C,i.cos=MC,i.cosh=TC,i.div=AC,i.exp=IC,i.floor=OC,i.hypot=PC,i.ln=RC,i.log=NC,i.log10=kC,i.log2=jC,i.max=DC,i.min=BC,i.mod=LC,i.mul=$C,i.pow=FC,i.random=UC,i.round=VC,i.sign=zC,i.sin=qC,i.sinh=HC,i.sqrt=WC,i.sub=GC,i.sum=KC,i.tan=YC,i.tanh=ZC,i.trunc=XC,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 AC(e,t){return new this(e).div(t)}function IC(e){return new this(e).exp()}function OC(e){return We(e=new this(e),e.e+1,3)}function PC(){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 u1(e){return e instanceof Lr||e&&e.toStringTag===Qg||!1}function RC(e){return new this(e).ln()}function NC(e,t){return new this(e).log(t)}function jC(e){return new this(e).log(2)}function kC(e){return new this(e).log(10)}function DC(){return i1(this,arguments,"lt")}function BC(){return i1(this,arguments,"gt")}function LC(e,t){return new this(e).mod(t)}function $C(e,t){return new this(e).mul(t)}function FC(e,t){return new this(e).pow(t)}function UC(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:qr(e,1,Vi),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(Jg);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=Ye,n&&e&&(i=vr(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 VC(e){return We(e=new this(e),e.e+1,this.rounding)}function zC(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function qC(e){return new this(e).sin()}function HC(e){return new this(e).sinh()}function WC(e){return new this(e).sqrt()}function GC(e,t){return new this(e).sub(t)}function KC(){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 YC(e){return new this(e).tan()}function ZC(e){return new this(e).tanh()}function XC(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=c1(Qf);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:as(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=e5(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:as(c)},l1=(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:as(i).toString();return s.includes("e")&&(s=n?i:as(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"$--"}},JC=(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 x=0;x<d;x+=1){const y=u[x]||"0";p+=y}s=c+p+w}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}`},De=e=>Lr.isDecimal(e)?e:new Lr(typeof e>"u"||e==="undefined"||!e?0:e);function QC(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(),as=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 e5(e){let t=0;if(e)for(;t<e.length;){if(De(e[t]).gt(0))return t+1;t++}return 0}function t5(e,t){const r=f1(De(t));return Number(De(e).mul(r))}function r5(e,t){const r=f1(De(t));return Number(De(e).div(r))}function f1(e){return De(10).pow(De(e).abs())}function id(e,t){const r=r5(e,t);return n5(r.toString(),Number(t))}function n5(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return JC(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 Hc(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):"",od=(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(!od(e[i],t[i]))return!1;return!0};function d1(e){return!e||Object.keys(e).length===0}function h1(e){var t;return((t=e.split("::"))==null?void 0:t.length)===3}const p1=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function i5(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=_n(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 m1(e,t){if(t){const r=e[_n(t.coin_type).full_address];if(r)return id(De(r.amount).abs().toFixed(0),t.decimals)}}function $t(e){return`https://archive.cetus.zone/assets/terminal${e}`}const an=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&De(t).gt(0)?`${e.slice(0,t)}...`:e,Wc=(e,t)=>yi(e||"")===yi(t||""),o5=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}},s5=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}},sd="tokenMap",g1="trustedTokenList",v1="collectTokenMap",y1="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 w1={exports:{}};/*!
45
41
  localForage -- Offline Storage, Improved
46
42
  Version 1.10.0
47
43
  https://localforage.github.io/localForage
48
44
  (c) 2013-2017 Mozilla, Apache License 2.0
49
- */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(u,l){if(!i[u]){if(!n[u]){var f=typeof Vn=="function"&&Vn;if(!l&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[u]={exports:{}};n[u][0].call(y.exports,function(b){var w=n[u][1][b];return o(w||b)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof Vn=="function"&&Vn,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(r,n,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,u=new o(b),l=s.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var T=s.document.createElement("script");T.onreadystatechange=function(){b(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},s.document.documentElement.appendChild(T)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var T,P,k=y.length;k;){for(P=y,y=[],T=-1;++T<k;)P[T]();k=y.length}h=!1}n.exports=w;function w(T){y.push(T)===1&&!h&&a()}}).call(this,typeof Nr<"u"?Nr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var s=r(1);function o(){}var a={},c=["REJECTED"],u=["FULFILLED"],l=["PENDING"];n.exports=f;function f(L){if(typeof L!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,L!==o&&w(this,L)}f.prototype.catch=function(L){return this.then(null,L)},f.prototype.then=function(L,G){if(typeof L!="function"&&this.state===u||typeof G!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var X=this.state===u?L:G;y(q,X,this.outcome)}else this.queue.push(new h(q,L,G));return q};function h(L,G,q){this.promise=L,typeof G=="function"&&(this.onFulfilled=G,this.callFulfilled=this.otherCallFulfilled),typeof q=="function"&&(this.onRejected=q,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(L){a.resolve(this.promise,L)},h.prototype.otherCallFulfilled=function(L){y(this.promise,this.onFulfilled,L)},h.prototype.callRejected=function(L){a.reject(this.promise,L)},h.prototype.otherCallRejected=function(L){y(this.promise,this.onRejected,L)};function y(L,G,q){s(function(){var X;try{X=G(q)}catch(ie){return a.reject(L,ie)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,G){var q=T(b,G);if(q.status==="error")return a.reject(L,q.value);var X=q.value;if(X)w(L,X);else{L.state=u,L.outcome=G;for(var ie=-1,ae=L.queue.length;++ie<ae;)L.queue[ie].callFulfilled(G)}return L},a.reject=function(L,G){L.state=c,L.outcome=G;for(var q=-1,X=L.queue.length;++q<X;)L.queue[q].callRejected(G);return L};function b(L){var G=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof G=="function")return function(){G.apply(L,arguments)}}function w(L,G){var q=!1;function X(z){q||(q=!0,a.reject(L,z))}function ie(z){q||(q=!0,a.resolve(L,z))}function ae(){G(ie,X)}var ce=T(ae);ce.status==="error"&&X(ce.value)}function T(L,G){var q={};try{q.value=L(G),q.status="success"}catch(X){q.status="error",q.value=X}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=k;function k(L){var G=new this(o);return a.reject(G,L)}f.all=R;function R(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=new Array(q),ae=0,ce=-1,z=new this(o);++ce<q;)D(L[ce],ce);return z;function D(p,d){G.resolve(p).then(m,function(x){X||(X=!0,a.reject(z,x))});function m(x){ie[d]=x,++ae===q&&!X&&(X=!0,a.resolve(z,ie))}}}f.race=F;function F(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=-1,ae=new this(o);++ie<q;)ce(L[ie]);return ae;function ce(z){G.resolve(z).then(function(D){X||(X=!0,a.resolve(ae,D))},function(D){X||(X=!0,a.reject(ae,D))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Nr<"u"?Nr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $};function o($,H){if(!($ instanceof H))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 $=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),H=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!$||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l($,H){$=$||[],H=H||{};try{return new Blob($,H)}catch(J){if(J.name!=="TypeError")throw J;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new U,Q=0;Q<$.length;Q+=1)Y.append($[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h($,H){H&&$.then(function(U){H(null,U)},function(U){H(U)})}function y($,H,U){typeof H=="function"&&$.then(H),typeof U=="function"&&$.catch(U)}function b($){return typeof $!="string"&&(console.warn($+" used as a key, but it is not a string."),$=String($)),$}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",P=void 0,k={},R=Object.prototype.toString,F="readonly",L="readwrite";function G($){for(var H=$.length,U=new ArrayBuffer(H),Y=new Uint8Array(U),Q=0;Q<H;Q++)Y[Q]=$.charCodeAt(Q);return U}function q($){return new f(function(H){var U=$.transaction(T,L),Y=l([""]);U.objectStore(T).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);H(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X($){return typeof P=="boolean"?f.resolve(P):q($).then(function(H){return P=H,P})}function ie($){var H=k[$.name],U={};U.promise=new f(function(Y,Q){U.resolve=Y,U.reject=Q}),H.deferredOperations.push(U),H.dbReady?H.dbReady=H.dbReady.then(function(){return U.promise}):H.dbReady=U.promise}function ae($){var H=k[$.name],U=H.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ce($,H){var U=k[$.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function z($,H){return new f(function(U,Y){if(k[$.name]=k[$.name]||g(),$.db)if(H)ie($),$.db.close();else return U($.db);var Q=[$.name];H&&Q.push($.version);var J=c.open.apply(c,Q);H&&(J.onupgradeneeded=function(me){var _e=J.result;try{_e.createObjectStore($.storeName),me.oldVersion<=1&&_e.createObjectStore(T)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+$.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+$.storeName+'" already exists.');else throw Ce}}),J.onerror=function(me){me.preventDefault(),Y(J.error)},J.onsuccess=function(){var me=J.result;me.onversionchange=function(_e){_e.target.close()},U(me),ae($)}})}function D($){return z($,!1)}function p($){return z($,!0)}function d($,H){if(!$.db)return!0;var U=!$.db.objectStoreNames.contains($.storeName),Y=$.version<$.db.version,Q=$.version>$.db.version;if(Y&&($.version!==H&&console.warn('The database "'+$.name+`" can't be downgraded from version `+$.db.version+" to version "+$.version+"."),$.version=$.db.version),Q||U){if(U){var J=$.db.version+1;J>$.version&&($.version=J)}return!0}return!1}function m($){return new f(function(H,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:J,type:$.type})},Y.readAsBinaryString($)})}function x($){var H=G(atob($.data));return l([H],{type:$.type})}function A($){return $&&$.__local_forage_encoded_blob}function E($){var H=this,U=H._initReady().then(function(){var Y=k[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,$,$),U}function O($){ie($);for(var H=k[$.name],U=H.forages,Y=0;Y<U.length;Y++){var Q=U[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return $.db=null,D($).then(function(J){return $.db=J,d($)?p($):J}).then(function(J){$.db=H.db=J;for(var me=0;me<U.length;me++)U[me]._dbInfo.db=J}).catch(function(J){throw ce($,J),J})}function C($,H,U,Y){Y===void 0&&(Y=1);try{var Q=$.db.transaction($.storeName,H);U(null,Q)}catch(J){if(Y>0&&(!$.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!$.db||J.name==="NotFoundError"&&!$.db.objectStoreNames.contains($.storeName)&&$.version<=$.db.version)return $.db&&($.version=$.db.version+1),p($)}).then(function(){return O($).then(function(){C($,H,U,Y-1)})}).catch(U);U(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v($){var H=this,U={db:null};if($)for(var Y in $)U[Y]=$[Y];var Q=k[U.name];Q||(Q=g(),k[U.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var J=[];function me(){return f.resolve()}for(var _e=0;_e<Q.forages.length;_e++){var Ce=Q.forages[_e];Ce!==H&&J.push(Ce._initReady().catch(me))}var Ae=Q.forages.slice(0);return f.all(J).then(function(){return U.db=Q.db,D(U)}).then(function(Me){return U.db=Me,d(U,H._defaultConfig.version)?p(U):Me}).then(function(Me){U.db=Q.db=Me,H._dbInfo=U;for(var ze=0;ze<Ae.length;ze++){var yt=Ae[ze];yt!==H&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function j($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,_e){if(me)return J(me);try{var Ce=_e.objectStore(U._dbInfo.storeName),Ae=Ce.get($);Ae.onsuccess=function(){var Me=Ae.result;Me===void 0&&(Me=null),A(Me)&&(Me=x(Me)),Q(Me)},Ae.onerror=function(){J(Ae.error)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,H),Y}function ee($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,_e){if(me)return J(me);try{var Ce=_e.objectStore(U._dbInfo.storeName),Ae=Ce.openCursor(),Me=1;Ae.onsuccess=function(){var ze=Ae.result;if(ze){var yt=ze.value;A(yt)&&(yt=x(yt));var Ft=$(yt,ze.key,Me++);Ft!==void 0?Q(Ft):ze.continue()}else Q()},Ae.onerror=function(){J(Ae.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,H),Y}function se($,H,U){var Y=this;$=b($);var Q=new f(function(J,me){var _e;Y.ready().then(function(){return _e=Y._dbInfo,R.call(H)==="[object Blob]"?X(_e.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Ae,Me){if(Ae)return me(Ae);try{var ze=Me.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=ze.put(Ce,$);Me.oncomplete=function(){Ce===void 0&&(Ce=null),J(Ce)},Me.onabort=Me.onerror=function(){var Ft=yt.error?yt.error:yt.transaction.error;me(Ft)}}catch(Ft){me(Ft)}})}).catch(me)});return h(Q,U),Q}function he($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,L,function(me,_e){if(me)return J(me);try{var Ce=_e.objectStore(U._dbInfo.storeName),Ae=Ce.delete($);_e.oncomplete=function(){Q()},_e.onerror=function(){J(Ae.error)},_e.onabort=function(){var Me=Ae.error?Ae.error:Ae.transaction.error;J(Me)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,H),Y}function ye($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(J,me){if(J)return Q(J);try{var _e=me.objectStore(H._dbInfo.storeName),Ce=_e.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Ae=Ce.error?Ce.error:Ce.transaction.error;Q(Ae)}}catch(Ae){Q(Ae)}})}).catch(Q)});return h(U,$),U}function Ee($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var _e=me.objectStore(H._dbInfo.storeName),Ce=_e.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Ae){Q(Ae)}})}).catch(Q)});return h(U,$),U}function Se($,H){var U=this,Y=new f(function(Q,J){if($<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(me,_e){if(me)return J(me);try{var Ce=_e.objectStore(U._dbInfo.storeName),Ae=!1,Me=Ce.openKeyCursor();Me.onsuccess=function(){var ze=Me.result;if(!ze){Q(null);return}$===0||Ae?Q(ze.key):(Ae=!0,ze.advance($))},Me.onerror=function(){J(Me.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,H),Y}function Ge($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var _e=me.objectStore(H._dbInfo.storeName),Ce=_e.openKeyCursor(),Ae=[];Ce.onsuccess=function(){var Me=Ce.result;if(!Me){Y(Ae);return}Ae.push(Me.key),Me.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,$),U}function Ue($,H){H=w.apply(this,arguments);var U=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||U.name,$.storeName=$.storeName||U.storeName);var Y=this,Q;if(!$.name)Q=f.reject("Invalid arguments");else{var J=$.name===U.name&&Y._dbInfo.db,me=J?f.resolve(Y._dbInfo.db):D($).then(function(_e){var Ce=k[$.name],Ae=Ce.forages;Ce.db=_e;for(var Me=0;Me<Ae.length;Me++)Ae[Me]._dbInfo.db=_e;return _e});$.storeName?Q=me.then(function(_e){if(_e.objectStoreNames.contains($.storeName)){var Ce=_e.version+1;ie($);var Ae=k[$.name],Me=Ae.forages;_e.close();for(var ze=0;ze<Me.length;ze++){var yt=Me[ze];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var Ft=new f(function(Vt,lr){var ar=c.open($.name,Ce);ar.onerror=function(mn){var Nc=ar.result;Nc.close(),lr(mn)},ar.onupgradeneeded=function(){var mn=ar.result;mn.deleteObjectStore($.storeName)},ar.onsuccess=function(){var mn=ar.result;mn.close(),Vt(mn)}});return Ft.then(function(Vt){Ae.db=Vt;for(var lr=0;lr<Me.length;lr++){var ar=Me[lr];ar._dbInfo.db=Vt,ae(ar._dbInfo)}}).catch(function(Vt){throw(ce($,Vt)||f.resolve()).catch(function(){}),Vt})}}):Q=me.then(function(_e){ie($);var Ce=k[$.name],Ae=Ce.forages;_e.close();for(var Me=0;Me<Ae.length;Me++){var ze=Ae[Me];ze._dbInfo.db=null}var yt=new f(function(Ft,Vt){var lr=c.deleteDatabase($.name);lr.onerror=function(){var ar=lr.result;ar&&ar.close(),Vt(lr.error)},lr.onblocked=function(){console.warn('dropInstance blocked for database "'+$.name+'" until all open connections are closed')},lr.onsuccess=function(){var ar=lr.result;ar&&ar.close(),Ft(ar)}});return yt.then(function(Ft){Ce.db=Ft;for(var Vt=0;Vt<Ae.length;Vt++){var lr=Ae[Vt];ae(lr._dbInfo)}}).catch(function(Ft){throw(ce($,Ft)||f.resolve()).catch(function(){}),Ft})})}return h(Q,H),Q}var dt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:se,removeItem:he,clear:ye,length:Ee,key:Se,keys:Ge,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",xe=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Te=ge.length,We="arbf",De="blob",Oe="si08",Ie="ui08",Fe="uic8",lt="si16",ft="si32",He="ur16",jt="ui32",St="fl32",et="fl64",Tt=Te+We.length,Bt=Object.prototype.toString;function nt($){var H=$.length*.75,U=$.length,Y,Q=0,J,me,_e,Ce;$[$.length-1]==="="&&(H--,$[$.length-2]==="="&&H--);var Ae=new ArrayBuffer(H),Me=new Uint8Array(Ae);for(Y=0;Y<U;Y+=4)J=$e.indexOf($[Y]),me=$e.indexOf($[Y+1]),_e=$e.indexOf($[Y+2]),Ce=$e.indexOf($[Y+3]),Me[Q++]=J<<2|me>>4,Me[Q++]=(me&15)<<4|_e>>2,Me[Q++]=(_e&3)<<6|Ce&63;return Ae}function Et($){var H=new Uint8Array($),U="",Y;for(Y=0;Y<H.length;Y+=3)U+=$e[H[Y]>>2],U+=$e[(H[Y]&3)<<4|H[Y+1]>>4],U+=$e[(H[Y+1]&15)<<2|H[Y+2]>>6],U+=$e[H[Y+2]&63];return H.length%3===2?U=U.substring(0,U.length-1)+"=":H.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Ot($,H){var U="";if($&&(U=Bt.call($)),$&&(U==="[object ArrayBuffer]"||$.buffer&&Bt.call($.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;$ instanceof ArrayBuffer?(Y=$,Q+=We):(Y=$.buffer,U==="[object Int8Array]"?Q+=Oe:U==="[object Uint8Array]"?Q+=Ie:U==="[object Uint8ClampedArray]"?Q+=Fe:U==="[object Int16Array]"?Q+=lt:U==="[object Uint16Array]"?Q+=He:U==="[object Int32Array]"?Q+=ft:U==="[object Uint32Array]"?Q+=jt:U==="[object Float32Array]"?Q+=St:U==="[object Float64Array]"?Q+=et:H(new Error("Failed to get type for BinaryArray"))),H(Q+Et(Y))}else if(U==="[object Blob]"){var J=new FileReader;J.onload=function(){var me=mt+$.type+"~"+Et(this.result);H(ge+De+me)},J.readAsArrayBuffer($)}else try{H(JSON.stringify($))}catch(me){console.error("Couldn't convert value into a JSON string: ",$),H(null,me)}}function st($){if($.substring(0,Te)!==ge)return JSON.parse($);var H=$.substring(Tt),U=$.substring(Te,Tt),Y;if(U===De&&xe.test(H)){var Q=H.match(xe);Y=Q[1],H=H.substring(Q[0].length)}var J=nt(H);switch(U){case We:return J;case De:return l([J],{type:Y});case Oe:return new Int8Array(J);case Ie:return new Uint8Array(J);case Fe:return new Uint8ClampedArray(J);case lt:return new Int16Array(J);case He:return new Uint16Array(J);case ft:return new Int32Array(J);case jt:return new Uint32Array(J);case St:return new Float32Array(J);case et:return new Float64Array(J);default:throw new Error("Unkown type: "+U)}}var kt={serialize:Ot,deserialize:st,stringToBuffer:nt,bufferToString:Et};function It($,H,U,Y){$.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function it($){var H=this,U={db:null};if($)for(var Y in $)U[Y]=typeof $[Y]!="string"?$[Y].toString():$[Y];var Q=new f(function(J,me){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(_e){return me(_e)}U.db.transaction(function(_e){It(_e,U,function(){H._dbInfo=U,J()},function(Ce,Ae){me(Ae)})},me)});return U.serializer=kt,Q}function _t($,H,U,Y,Q,J){$.executeSql(U,Y,Q,function(me,_e){_e.code===_e.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Ae){Ae.rows.length?J(Ce,_e):It(Ce,H,function(){Ce.executeSql(U,Y,Q,J)},J)},J):J(me,_e)},J)}function At($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(_e){_t(_e,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[$],function(Ce,Ae){var Me=Ae.rows.length?Ae.rows.item(0).value:null;Me&&(Me=me.serializer.deserialize(Me)),Q(Me)},function(Ce,Ae){J(Ae)})})}).catch(J)});return h(Y,H),Y}function Ye($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(_e){_t(_e,me,"SELECT * FROM "+me.storeName,[],function(Ce,Ae){for(var Me=Ae.rows,ze=Me.length,yt=0;yt<ze;yt++){var Ft=Me.item(yt),Vt=Ft.value;if(Vt&&(Vt=me.serializer.deserialize(Vt)),Vt=$(Vt,Ft.key,yt+1),Vt!==void 0){Q(Vt);return}}Q()},function(Ce,Ae){J(Ae)})})}).catch(J)});return h(Y,H),Y}function gt($,H,U,Y){var Q=this;$=b($);var J=new f(function(me,_e){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Ae=Q._dbInfo;Ae.serializer.serialize(H,function(Me,ze){ze?_e(ze):Ae.db.transaction(function(yt){_t(yt,Ae,"INSERT OR REPLACE INTO "+Ae.storeName+" (key, value) VALUES (?, ?)",[$,Me],function(){me(Ce)},function(Ft,Vt){_e(Vt)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[$,Ce,U,Y-1]));return}_e(yt)}})})}).catch(_e)});return h(J,U),J}function Pt($,H,U){return gt.apply(this,[$,H,U,1])}function ot($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(_e){_t(_e,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[$],function(){Q()},function(Ce,Ae){J(Ae)})})}).catch(J)});return h(Y,H),Y}function xt($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){_t(me,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(_e,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function Ut($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){_t(me,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(_e,Ce){var Ae=Ce.rows.item(0).c;Y(Ae)},function(_e,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function N($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(_e){_t(_e,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[$+1],function(Ce,Ae){var Me=Ae.rows.length?Ae.rows.item(0).key:null;Q(Me)},function(Ce,Ae){J(Ae)})})}).catch(J)});return h(Y,H),Y}function S($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){_t(me,J,"SELECT key FROM "+J.storeName,[],function(_e,Ce){for(var Ae=[],Me=0;Me<Ce.rows.length;Me++)Ae.push(Ce.rows.item(Me).key);Y(Ae)},function(_e,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function M($){return new f(function(H,U){$.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var me=[],_e=0;_e<J.rows.length;_e++)me.push(J.rows.item(_e).name);H({db:$,storeNames:me})},function(Q,J){U(J)})},function(Y){U(Y)})})}function B($,H){H=w.apply(this,arguments);var U=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||U.name,$.storeName=$.storeName||U.storeName);var Y=this,Q;return $.name?Q=new f(function(J){var me;$.name===U.name?me=Y._dbInfo.db:me=openDatabase($.name,"","",0),$.storeName?J({db:me,storeNames:[$.storeName]}):J(M(me))}).then(function(J){return new f(function(me,_e){J.db.transaction(function(Ce){function Ae(Ft){return new f(function(Vt,lr){Ce.executeSql("DROP TABLE IF EXISTS "+Ft,[],function(){Vt()},function(ar,mn){lr(mn)})})}for(var Me=[],ze=0,yt=J.storeNames.length;ze<yt;ze++)Me.push(Ae(J.storeNames[ze]));f.all(Me).then(function(){me()}).catch(function(Ft){_e(Ft)})},function(Ce){_e(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:At,setItem:Pt,removeItem:ot,clear:xt,length:Ut,key:N,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re($,H){var U=$.name+"/";return $.storeName!==H.storeName&&(U+=$.storeName+"/"),U}function Be(){var $="_localforage_support_test";try{return localStorage.setItem($,!0),localStorage.removeItem($),!1}catch{return!0}}function rt(){return!Be()||localStorage.length>0}function Re($){var H=this,U={};if($)for(var Y in $)U[Y]=$[Y];return U.keyPrefix=re($,H._defaultConfig),rt()?(H._dbInfo=U,U.serializer=kt,f.resolve()):f.reject()}function V($){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(U,$),U}function oe($,H){var U=this;$=b($);var Y=U.ready().then(function(){var Q=U._dbInfo,J=localStorage.getItem(Q.keyPrefix+$);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,H),Y}function pe($,H){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,J=Q.keyPrefix,me=J.length,_e=localStorage.length,Ce=1,Ae=0;Ae<_e;Ae++){var Me=localStorage.key(Ae);if(Me.indexOf(J)===0){var ze=localStorage.getItem(Me);if(ze&&(ze=Q.serializer.deserialize(ze)),ze=$(ze,Me.substring(me),Ce++),ze!==void 0)return ze}}});return h(Y,H),Y}function ke($,H){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,J;try{J=localStorage.key($)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,H),Y}function Ke($){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,J=[],me=0;me<Q;me++){var _e=localStorage.key(me);_e.indexOf(Y.keyPrefix)===0&&J.push(_e.substring(Y.keyPrefix.length))}return J});return h(U,$),U}function Ne($){var H=this,U=H.keys().then(function(Y){return Y.length});return h(U,$),U}function Ve($,H){var U=this;$=b($);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+$)});return h(Y,H),Y}function ut($,H,U){var Y=this;$=b($);var Q=Y.ready().then(function(){H===void 0&&(H=null);var J=H;return new f(function(me,_e){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Ae,Me){if(Me)_e(Me);else try{localStorage.setItem(Ce.keyPrefix+$,Ae),me(J)}catch(ze){(ze.name==="QuotaExceededError"||ze.name==="NS_ERROR_DOM_QUOTA_REACHED")&&_e(ze),_e(ze)}})})});return h(Q,U),Q}function Jt($,H){if(H=w.apply(this,arguments),$=typeof $!="function"&&$||{},!$.name){var U=this.config();$.name=$.name||U.name,$.storeName=$.storeName||U.storeName}var Y=this,Q;return $.name?Q=new f(function(J){$.storeName?J(re($,Y._defaultConfig)):J($.name+"/")}).then(function(J){for(var me=localStorage.length-1;me>=0;me--){var _e=localStorage.key(me);_e.indexOf(J)===0&&localStorage.removeItem(_e)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Nt={_driver:"localStorageWrapper",_initStorage:Re,_support:Z(),iterate:pe,getItem:oe,setItem:ut,removeItem:Ve,clear:V,length:Ne,key:ke,keys:Ke,dropInstance:Jt},Lt=function(H,U){return H===U||typeof H=="number"&&typeof U=="number"&&isNaN(H)&&isNaN(U)},ir=function(H,U){for(var Y=H.length,Q=0;Q<Y;){if(Lt(H[Q],U))return!0;Q++}return!1},Er=Array.isArray||function($){return Object.prototype.toString.call($)==="[object Array]"},or={},Yt={},br={INDEXEDDB:dt,WEBSQL:K,LOCALSTORAGE:Nt},Dn=[br.INDEXEDDB._driver,br.WEBSQL._driver,br.LOCALSTORAGE._driver],Kr=["dropInstance"],$n=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Kr),Vi={description:"",driver:Dn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function zi($,H){$[H]=function(){var U=arguments;return $.ready().then(function(){return $[H].apply($,U)})}}function Bn(){for(var $=1;$<arguments.length;$++){var H=arguments[$];if(H)for(var U in H)H.hasOwnProperty(U)&&(Er(H[U])?arguments[0][U]=H[U].slice():arguments[0][U]=H[U])}return arguments[0]}var qi=function(){function $(H){o(this,$);for(var U in br)if(br.hasOwnProperty(U)){var Y=br[U],Q=Y._driver;this[U]=Q,or[Q]||this.defineDriver(Y)}this._defaultConfig=Bn({},Vi),this._config=Bn({},this._defaultConfig,H),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return $.prototype.config=function(U){if((typeof U>"u"?"undefined":s(U))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var Y in U){if(Y==="storeName"&&(U[Y]=U[Y].replace(/\W/g,"_")),Y==="version"&&typeof U[Y]!="number")return new Error("Database version must be a number.");this._config[Y]=U[Y]}return"driver"in U&&U.driver?this.setDriver(this._config.driver):!0}else return typeof U=="string"?this._config[U]:this._config},$.prototype.defineDriver=function(U,Y,Q){var J=new f(function(me,_e){try{var Ce=U._driver,Ae=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){_e(Ae);return}for(var Me=$n.concat("_initStorage"),ze=0,yt=Me.length;ze<yt;ze++){var Ft=Me[ze],Vt=!ir(Kr,Ft);if((Vt||U[Ft])&&typeof U[Ft]!="function"){_e(Ae);return}}var lr=function(){for(var Nc=function(EX){return function(){var CX=new Error("Method "+EX+" is not implemented by the current driver"),F3=f.reject(CX);return h(F3,arguments[arguments.length-1]),F3}},Q0=0,SX=Kr.length;Q0<SX;Q0++){var em=Kr[Q0];U[em]||(U[em]=Nc(em))}};lr();var ar=function(Nc){or[Ce]&&console.info("Redefining LocalForage driver: "+Ce),or[Ce]=U,Yt[Ce]=Nc,me()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(ar,_e):ar(!!U._support):ar(!0)}catch(mn){_e(mn)}});return y(J,Y,Q),J},$.prototype.driver=function(){return this._driver||null},$.prototype.getDriver=function(U,Y,Q){var J=or[U]?f.resolve(or[U]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},$.prototype.getSerializer=function(U){var Y=f.resolve(kt);return y(Y,U),Y},$.prototype.ready=function(U){var Y=this,Q=Y._driverSet.then(function(){return Y._ready===null&&(Y._ready=Y._initDriver()),Y._ready});return y(Q,U,U),Q},$.prototype.setDriver=function(U,Y,Q){var J=this;Er(U)||(U=[U]);var me=this._getSupportedDrivers(U);function _e(){J._config.driver=J.driver()}function Ce(ze){return J._extend(ze),_e(),J._ready=J._initStorage(J._config),J._ready}function Ae(ze){return function(){var yt=0;function Ft(){for(;yt<ze.length;){var Vt=ze[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(Vt).then(Ce).catch(Ft)}_e();var lr=new Error("No available storage method found.");return J._driverSet=f.reject(lr),J._driverSet}return Ft()}}var Me=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Me.then(function(){var ze=me[0];return J._dbInfo=null,J._ready=null,J.getDriver(ze).then(function(yt){J._driver=yt._driver,_e(),J._wrapLibraryMethodsWithReady(),J._initDriver=Ae(me)})}).catch(function(){_e();var ze=new Error("No available storage method found.");return J._driverSet=f.reject(ze),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},$.prototype.supports=function(U){return!!Yt[U]},$.prototype._extend=function(U){Bn(this,U)},$.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,J=U.length;Q<J;Q++){var me=U[Q];this.supports(me)&&Y.push(me)}return Y},$.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=$n.length;U<Y;U++)zi(this,$n[U])},$.prototype.createInstance=function(U){return new $(U)},$}(),Wi=new qi;n.exports=Wi},{3:3}]},{},[4])(4)})})(Dx);var cD=Dx.exports;const ac=ga(cD);ac.config({name:"CetusSite",storeName:"tokens"});class Ri{static async setItem(t,r){try{await ac.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await ac.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await ac.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await ac.clear()}catch(t){console.error("Failed to clear storage",t)}}}const il=[{name:"SuiVision",link:"https://suivision.xyz",img:$t("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:$t("/images/logo_suiscan@2x.png"),isCustom:!1}],sl=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],uD=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],ol={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"],lD="0x45f3c0814d7be4aa5fbd32d7e3c40f3c062a2b63eaf5ec4f8c1539b5987b11af",fD=$t("/images/birdeye-logo.png"),dD=$t("/images/img-logo@2x.png"),hD=$t("/images/logo_CoinGecko@2x.png"),pD=$t("/images/logo_pyth.png");var cc=(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))(cc||{});const $x={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},mD={pyth:pD,coingecko:hD,birdeye:fD,Cetus:dD},gr={CETUS:$t("/images/aggregator-source/cetus.png"),KRIYA:$t("/images/aggregator-source/kriya.png"),FLOWX:$t("/images/aggregator-source/flowx.png"),AFTERMATH:$t("/images/aggregator-source/aftermath.png"),TURBOS:$t("/images/aggregator-source/turbos.png"),HAEDAL:$t("/images/aggregator-source/haedal.png"),VOLO:$t("/images/aggregator-source/volo.png"),AFSUI:$t("/images/aggregator-source/aftermath.png"),BLUEMOVE:$t("/images/aggregator-source/bluemove.png"),KRIYAV3:$t("/images/aggregator-source/kriya.png"),FLOWXV3:$t("/images/aggregator-source/flowx.png"),DEEPBOOKV3:$t("/images/aggregator-source/deepbook.png"),SCALLOP:$t("/images/aggregator-source/scallop.png"),SPRINGSUI:$t("/images/aggregator-source/suilend.png"),BLUEFIN:$t("/images/aggregator-source/bluefin.png"),HAEDALPMM:$t("/images/aggregator-source/haedal.png"),ALPHAFI:$t("/images/aggregator-source/stSui.png")},Bx={CETUS:{name:"Cetus",id:"CETUS",logo:gr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:gr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:gr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:gr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:gr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:gr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:gr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:gr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:gr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:gr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:gr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:gr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:gr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:gr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:gr.SCALLOP,type:"other",sort:70},SPRINGSUI:{name:"SpringSui",id:"SPRINGSUI",logo:gr.SPRINGSUI,type:"other",sort:60},ALPHAFI:{name:"stSUI",id:"ALPHAFI",logo:gr.ALPHAFI,type:"other",sort:50}},Lx=e=>{let t;const r=new Set,n=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(y=>y(t,h))}},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},gD=e=>e?Lx(e):Lx,vD=e=>e;function yD(e,t=vD){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const Fx=e=>{const t=gD(e),r=n=>yD(t,n);return Object.assign(r,t),r},Di=e=>e?Fx(e):Fx;function bD(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,t==null?void 0:t.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const Sp=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Sp(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Sp(n)(r)}}}},Lr=Di(((e,t)=>(r,n,i)=>{let s={storage:bD(()=>localStorage),partialize:w=>w,version:0,merge:(w,T)=>({...T,...w}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...w)},n,i);const l=()=>{const w=s.partialize({...n()});return u.setItem(s.name,{state:w,version:s.version})},f=i.setState;i.setState=(w,T)=>{f(w,T),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,T;if(!u)return;o=!1,a.forEach(k=>{var R;return k((R=n())!=null?R:h)});const P=((T=s.onRehydrateStorage)==null?void 0:T.call(s,(w=n())!=null?w:h))||void 0;return Sp(u.getItem.bind(u))(s.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==s.version){if(s.migrate){const R=s.migrate(k.state,k.version);return R instanceof Promise?R.then(F=>[!0,F]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var R;const[F,L]=k;if(y=s.merge(L,(R=n())!=null?R:h),r(y,!0),F)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(k=>k(y))}).catch(k=>{P==null||P(void 0,k)})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(u=w.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},s.skipHydration||b(),y||h})((e,t)=>({ignoreWarnTokenMap:{},currentExplorer:il[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:sl,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:sl[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(cc),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[ki(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}}}));function zo(){const{currentExplorer:e}=Lr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${_D(n)}/${r}`:s=`${i}/${wD(n)}/${r}`,s}}}const wD=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"}},_D=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 Ux(e){const{text:t,keywords:r,onKeywordClick:n,text_highlight_color:i="var(--cs-primary)",text_size:s="12px",text_color:o="var(--cs-btn-disabled-text)"}=e,a=new RegExp(`(${r.join("|")})`,"gi"),c=t.split(a);return _.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return _.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var Vx={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 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(x){var y=n[u][1][x];return s(y||x)},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(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 A=o.document.createElement("script");A.onreadystatechange=function(){x(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},o.document.documentElement.appendChild(A)}:a=function(){setTimeout(x,0)};var p,w=[];function x(){p=!0;for(var A,O,R=w.length;R;){for(O=w,w=[],A=-1;++A<R;)O[A]();R=w.length}p=!1}n.exports=y;function y(A){w.push(A)===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($){if(typeof $!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,$!==s&&y(this,$)}d.prototype.catch=function($){return this.then(null,$)},d.prototype.then=function($,H){if(typeof $!="function"&&this.state===u||typeof H!="function"&&this.state===c)return this;var q=new this.constructor(s);if(this.state!==l){var Y=this.state===u?$:H;w(q,Y,this.outcome)}else this.queue.push(new p(q,$,H));return q};function p($,H,q){this.promise=$,typeof H=="function"&&(this.onFulfilled=H,this.callFulfilled=this.otherCallFulfilled),typeof q=="function"&&(this.onRejected=q,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function($){a.resolve(this.promise,$)},p.prototype.otherCallFulfilled=function($){w(this.promise,this.onFulfilled,$)},p.prototype.callRejected=function($){a.reject(this.promise,$)},p.prototype.otherCallRejected=function($){w(this.promise,this.onRejected,$)};function w($,H,q){o(function(){var Y;try{Y=H(q)}catch(ne){return a.reject($,ne)}Y===$?a.reject($,new TypeError("Cannot resolve promise with itself")):a.resolve($,Y)})}a.resolve=function($,H){var q=A(x,H);if(q.status==="error")return a.reject($,q.value);var Y=q.value;if(Y)y($,Y);else{$.state=u,$.outcome=H;for(var ne=-1,se=$.queue.length;++ne<se;)$.queue[ne].callFulfilled(H)}return $},a.reject=function($,H){$.state=c,$.outcome=H;for(var q=-1,Y=$.queue.length;++q<Y;)$.queue[q].callRejected(H);return $};function x($){var H=$&&$.then;if($&&(typeof $=="object"||typeof $=="function")&&typeof H=="function")return function(){H.apply($,arguments)}}function y($,H){var q=!1;function Y(z){q||(q=!0,a.reject($,z))}function ne(z){q||(q=!0,a.resolve($,z))}function se(){H(ne,Y)}var ae=A(se);ae.status==="error"&&Y(ae.value)}function A($,H){var q={};try{q.value=$(H),q.status="success"}catch(Y){q.status="error",q.value=Y}return q}d.resolve=O;function O($){return $ instanceof this?$:a.resolve(new this(s),$)}d.reject=R;function R($){var H=new this(s);return a.reject(H,$)}d.all=k;function k($){var H=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=$.length,Y=!1;if(!q)return this.resolve([]);for(var ne=new Array(q),se=0,ae=-1,z=new this(s);++ae<q;)D($[ae],ae);return z;function D(h,f){H.resolve(h).then(m,function(S){Y||(Y=!0,a.reject(z,S))});function m(S){ne[f]=S,++se===q&&!Y&&(Y=!0,a.resolve(z,ne))}}}d.race=F;function F($){var H=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=$.length,Y=!1;if(!q)return this.resolve([]);for(var ne=-1,se=new this(s);++ne<q;)ae($[ne]);return se;function ae(z){H.resolve(z).then(function(D){Y||(Y=!0,a.resolve(se,D))},function(D){Y||(Y=!0,a.reject(se,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 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 A="local-forage-detect-blob-support",O=void 0,R={},k=Object.prototype.toString,F="readonly",$="readwrite";function H(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 q(B){return new d(function(G){var U=B.transaction(A,$),X=l([""]);U.objectStore(A).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 Y(B){return typeof O=="boolean"?d.resolve(O):q(B).then(function(G){return O=G,O})}function ne(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 se(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)ne(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(A)}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),se(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=H(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){ne(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=x(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=x(B);var Q=new d(function(Z,de){var ye;X.ready().then(function(){return ye=X._dbInfo,k.call(G)==="[object Blob]"?Y(ye.db).then(function(Se){return Se?G:m(G)}):G}).then(function(Se){C(X._dbInfo,$,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=x(B);var X=new d(function(Q,Z){U.ready().then(function(){C(U._dbInfo,$,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,$,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;ne(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(qt,hr){var fr=c.open(B.name,Se);fr.onerror=function(dn){var Ua=fr.result;Ua.close(),hr(dn)},fr.onupgradeneeded=function(){var dn=fr.result;dn.deleteObjectStore(B.storeName)},fr.onsuccess=function(){var dn=fr.result;dn.close(),qt(dn)}});return Vt.then(function(qt){Ee.db=qt;for(var hr=0;hr<_e.length;hr++){var fr=_e[hr];fr._dbInfo.db=qt,se(fr._dbInfo)}}).catch(function(qt){throw(ae(B,qt)||d.resolve()).catch(function(){}),qt})}}):Q=de.then(function(ye){ne(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,qt){var hr=c.deleteDatabase(B.name);hr.onerror=function(){var fr=hr.result;fr&&fr.close(),qt(hr.error)},hr.onblocked=function(){console.warn('dropInstance blocked for database "'+B.name+'" until all open connections are closed')},hr.onsuccess=function(){var fr=hr.result;fr&&fr.close(),Vt(fr)}});return wt.then(function(Vt){Se.db=Vt;for(var qt=0;qt<Ee.length;qt++){var hr=Ee[qt];se(hr._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+/",pt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,he="__lfsc__:",Ce=he.length,Ue="arbf",Ne="blob",Me="si08",Ae="ui08",Be="uic8",ut="si16",lt="si32",ze="ur16",Nt="ui32",Et="fl32",Ze="fl64",At=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 It(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+=Ae:U==="[object Uint8ClampedArray]"?Q+=Be:U==="[object Int16Array]"?Q+=ut:U==="[object Uint16Array]"?Q+=ze:U==="[object Int32Array]"?Q+=lt:U==="[object Uint32Array]"?Q+=Nt: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=pt+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(At),U=B.substring(Ce,At),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 Ae: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 Nt:return new Uint32Array(Z);case Et:return new Float32Array(Z);case Ze:return new Float64Array(Z);default:throw new Error("Unkown type: "+U)}}var jt={serialize:It,deserialize:rt,stringToBuffer:Qe,bufferToString:_t};function Ot(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){Ot(ye,U,function(){G._dbInfo=U,Z()},function(Se,Ee){de(Ee)})},de)});return U.serializer=jt,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):Ot(Se,G,function(){Se.executeSql(U,X,Q,Z)},Z)},Z):Z(de,ye)},Z)}function Mt(B,G){var U=this;B=x(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),qt=Vt.value;if(qt&&(qt=de.serializer.deserialize(qt)),qt=B(qt,Vt.key,wt+1),qt!==void 0){Q(qt);return}}Q()},function(Se,Ee){Z(Ee)})})}).catch(Z)});return p(X,G),X}function mt(B,G,U,X){var Q=this;B=x(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,qt){ye(qt)})},function(wt){if(wt.code===wt.QUOTA_ERR){if(X>0){de(mt.apply(Q,[B,Se,U,X-1]));return}ye(wt)}})})}).catch(ye)});return p(Z,U),Z}function Pt(B,G,U){return mt.apply(this,[B,G,U,1])}function nt(B,G){var U=this;B=x(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 T(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 L(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(T(de))}).then(function(Z){return new d(function(de,ye){Z.db.transaction(function(Se){function Ee(Vt){return new d(function(qt,hr){Se.executeSql("DROP TABLE IF EXISTS "+Vt,[],function(){qt()},function(fr,dn){hr(dn)})})}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 K={_driver:"webSQLStorage",_initStorage:et,_support:dt(),iterate:Ge,getItem:Mt,setItem:Pt,removeItem:nt,clear:St,length:zt,key:j,keys:E,dropInstance:L};function J(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re(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=re(B,G._defaultConfig),Je()?(G._dbInfo=U,U.serializer=jt,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 oe(B,G){var U=this;B=x(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 qe(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=x(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=x(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(re(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 kt={_driver:"localStorageWrapper",_initStorage:Re,_support:J(),iterate:fe,getItem:oe,setItem:at,removeItem:$e,clear:V,length:Pe,key:Oe,keys:qe,dropInstance:Qt},Ut=function(G,U){return G===U||typeof G=="number"&&typeof U=="number"&&isNaN(G)&&isNaN(U)},cr=function(G,U){for(var X=G.length,Q=0;Q<X;){if(Ut(G[Q],U))return!0;Q++}return!1},Tr=Array.isArray||function(B){return Object.prototype.toString.call(B)==="[object Array]"},lr={},er={},xr={INDEXEDDB:ft,WEBSQL:K,LOCALSTORAGE:kt},Rn=[xr.INDEXEDDB._driver,xr.WEBSQL._driver,xr.LOCALSTORAGE._driver],Gr=["dropInstance"],Nn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Gr),Ti={description:"",driver:Rn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ai(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)&&(Tr(G[U])?arguments[0][U]=G[U].slice():arguments[0][U]=G[U])}return arguments[0]}var Ii=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,lr[Q]||this.defineDriver(X)}this._defaultConfig=jn({},Ti),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],qt=!cr(Gr,Vt);if((qt||U[Vt])&&typeof U[Vt]!="function"){ye(Ee);return}}var hr=function(){for(var Ua=function(ED){return function(){var _D=new Error("Method "+ED+" is not implemented by the current driver"),E2=d.reject(_D);return p(E2,arguments[arguments.length-1]),E2}},Bh=0,SD=Gr.length;Bh<SD;Bh++){var Lh=Gr[Bh];U[Lh]||(U[Lh]=Ua(Lh))}};hr();var fr=function(Ua){lr[Se]&&console.info("Redefining LocalForage driver: "+Se),lr[Se]=U,er[Se]=Ua,de()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(fr,ye):fr(!!U._support):fr(!0)}catch(dn){ye(dn)}});return w(Z,X,Q),Z},B.prototype.driver=function(){return this._driver||null},B.prototype.getDriver=function(U,X,Q){var Z=lr[U]?d.resolve(lr[U]):d.reject(new Error("Driver not found."));return w(Z,X,Q),Z},B.prototype.getSerializer=function(U){var X=d.resolve(jt);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;Tr(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 qt=Fe[wt];return wt++,Z._dbInfo=null,Z._ready=null,Z.getDriver(qt).then(Se).catch(Vt)}ye();var hr=new Error("No available storage method found.");return Z._driverSet=d.reject(hr),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++)Ai(this,Nn[U])},B.prototype.createInstance=function(U){return new B(U)},B}(),Oi=new Ii;n.exports=Oi},{3:3}]},{},[4])(4)})})(w1);var a5=w1.exports;const pa=ks(a5);pa.config({name:"CetusSite",storeName:"tokens"});class bi{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:$t("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:$t("/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}],c5=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],Zc={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"],u5="0x45f3c0814d7be4aa5fbd32d7e3c40f3c062a2b63eaf5ec4f8c1539b5987b11af",l5=$t("/images/birdeye-logo.png"),f5=$t("/images/img-logo@2x.png"),d5=$t("/images/logo_CoinGecko@2x.png"),h5=$t("/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))(ma||{});const b1={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},p5={pyth:h5,coingecko:d5,birdeye:l5,Cetus:f5},yr={CETUS:$t("/images/aggregator-source/cetus.png"),KRIYA:$t("/images/aggregator-source/kriya.png"),FLOWX:$t("/images/aggregator-source/flowx.png"),AFTERMATH:$t("/images/aggregator-source/aftermath.png"),TURBOS:$t("/images/aggregator-source/turbos.png"),HAEDAL:$t("/images/aggregator-source/haedal.png"),VOLO:$t("/images/aggregator-source/volo.png"),AFSUI:$t("/images/aggregator-source/aftermath.png"),BLUEMOVE:$t("/images/aggregator-source/bluemove.png"),KRIYAV3:$t("/images/aggregator-source/kriya.png"),FLOWXV3:$t("/images/aggregator-source/flowx.png"),DEEPBOOKV3:$t("/images/aggregator-source/deepbook.png"),SCALLOP:$t("/images/aggregator-source/scallop.png"),SPRINGSUI:$t("/images/aggregator-source/suilend.png"),BLUEFIN:$t("/images/aggregator-source/bluefin.png"),HAEDALPMM:$t("/images/aggregator-source/haedal.png"),ALPHAFI:$t("/images/aggregator-source/stSui.png")},x1={CETUS:{name:"Cetus",id:"CETUS",logo:yr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:yr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:yr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:yr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:yr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:yr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:yr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:yr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:yr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:yr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:yr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:yr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:yr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:yr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:yr.SCALLOP,type:"other",sort:70},SPRINGSUI:{name:"SpringSui",id:"SPRINGSUI",logo:yr.SPRINGSUI,type:"other",sort:60},ALPHAFI:{name:"stSUI",id:"ALPHAFI",logo:yr.ALPHAFI,type:"other",sort:50}},S1=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},m5=e=>e?S1(e):S1,g5=e=>e;function v5(e,t=g5){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const E1=e=>{const t=m5(e),r=n=>v5(t,n);return Object.assign(r,t),r},xi=e=>e?E1(e):E1;function y5(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 ad=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return ad(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return ad(n)(r)}}}},$r=xi(((e,t)=>(r,n,i)=>{let o={storage:y5(()=>localStorage),partialize:y=>y,version:0,merge:(y,A)=>({...A,...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,A)=>{d(y,A),l()};const p=e((...y)=>{r(...y),l()},n,i);i.getInitialState=()=>p;let w;const x=()=>{var y,A;if(!u)return;s=!1,a.forEach(R=>{var k;return R((k=n())!=null?k:p)});const O=((A=o.onRehydrateStorage)==null?void 0:A.call(o,(y=n())!=null?y:p))||void 0;return ad(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,$]=R;if(w=o.merge($,(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:()=>x(),hasHydrated:()=>s,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},o.skipHydration||x(),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[yi(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 cs(){const{currentExplorer:e}=$r();return{getExplorerUrl:(r,n="account",i=e)=>{let o;return i.includes("suivision")?o=`${i}/${b5(n)}/${r}`:o=`${i}/${w5(n)}/${r}`,o}}}const w5=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"}},b5=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 _1(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 b.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const d=r.includes(u);return b.jsx("span",{style:{lineHeight:"20px",fontSize:o,color:d?i:s,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var C1={exports:{}};/*!
50
46
  Copyright (c) 2018 Jed Watson.
51
47
  Licensed under the MIT License (MIT), see
52
48
  http://jedwatson.github.io/classnames
53
- */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,n(a)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return r.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(Vx);var xD=Vx.exports;const Kt=ga(xD);function tt(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 SD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function al(...e){return t=>e.forEach(r=>SD(r,t))}function Qt(...e){return I.useCallback(al(...e),e)}function qo(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];const u=f=>{var P;const{scope:h,children:y,...b}=f,w=((P=h==null?void 0:h[e])==null?void 0:P[c])||a,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})};u.displayName=s+"Provider";function l(f,h){var w;const y=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,ED(i,...t)]}function ED(...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(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var $i=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(CD);if(s){const o=s.props.children,a=i.map(c=>c===s?I.Children.count(o)>1?I.Children.only(null):I.isValidElement(o)?o.props.children:null:c);return _.jsx(Ep,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(Ep,{...n,ref:t,children:r})});$i.displayName="Slot";var Ep=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=MD(r);return I.cloneElement(r,{...AD(n,r.props),ref:t?al(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});Ep.displayName="SlotClone";var Wo=({children:e})=>_.jsx(_.Fragment,{children:e});function CD(e){return I.isValidElement(e)&&e.type===Wo}function AD(e,t){const r={...t};for(const n in t){const i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function MD(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 TD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=TD.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?$i:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zx(e,t){e&&nm.flushSync(()=>e.dispatchEvent(t))}function vr(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function OD(e,t=globalThis==null?void 0:globalThis.document){const r=vr(e);I.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 ID="DismissableLayer",Cp="dismissableLayer.update",PD="dismissableLayer.pointerDownOutside",jD="dismissableLayer.focusOutside",qx,Wx=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ap=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(Wx),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Qt(t,q=>f(q)),w=Array.from(u.layers),[T]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(T),k=l?w.indexOf(l):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,F=k>=P,L=RD(q=>{const X=q.target,ie=[...u.branches].some(ae=>ae.contains(X));!F||ie||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),G=DD(q=>{const X=q.target;[...u.branches].some(ae=>ae.contains(X))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return OD(q=>{k===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),I.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(qx=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Gx(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=qx)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Gx())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(Cp,q),()=>document.removeEventListener(Cp,q)},[]),_.jsx(Gt.div,{...c,ref:b,style:{pointerEvents:R?F?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,G.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});Ap.displayName=ID;var kD="DismissableLayerBranch",ND=I.forwardRef((e,t)=>{const r=I.useContext(Wx),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),_.jsx(Gt.div,{...e,ref:i})});ND.displayName=kD;function RD(e,t=globalThis==null?void 0:globalThis.document){const r=vr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){Hx(PD,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},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function DD(e,t=globalThis==null?void 0:globalThis.document){const r=vr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&Hx(jD,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Gx(){const e=new CustomEvent(Cp);document.dispatchEvent(e)}function Hx(e,t,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?zx(i,s):i.dispatchEvent(s)}var hs=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},$D=I["useId".toString()]||(()=>{}),BD=0;function uc(e){const[t,r]=I.useState($D());return hs(()=>{e||r(n=>n??String(BD++))},[e]),e||(t?`radix-${t}`:"")}const LD=["top","right","bottom","left"],ps=Math.min,Qr=Math.max,cl=Math.round,ul=Math.floor,si=e=>({x:e,y:e}),FD={left:"right",right:"left",bottom:"top",top:"bottom"},UD={start:"end",end:"start"};function Mp(e,t,r){return Qr(e,ps(t,r))}function Bi(e,t){return typeof e=="function"?e(t):e}function Li(e){return e.split("-")[0]}function Go(e){return e.split("-")[1]}function Tp(e){return e==="x"?"y":"x"}function Op(e){return e==="y"?"height":"width"}function ms(e){return["top","bottom"].includes(Li(e))?"y":"x"}function Ip(e){return Tp(ms(e))}function VD(e,t,r){r===void 0&&(r=!1);const n=Go(e),i=Ip(e),s=Op(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ll(o)),[o,ll(o)]}function zD(e){const t=ll(e);return[Pp(e),t,Pp(t)]}function Pp(e){return e.replace(/start|end/g,t=>UD[t])}function qD(e,t,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?s:o;default:return[]}}function WD(e,t,r,n){const i=Go(e);let s=qD(Li(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Pp)))),s}function ll(e){return e.replace(/left|right|bottom|top/g,t=>FD[t])}function GD(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kx(e){return typeof e!="number"?GD(e):{top:e,right:e,bottom:e,left:e}}function fl(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 Xx(e,t,r){let{reference:n,floating:i}=e;const s=ms(t),o=Ip(t),a=Op(o),c=Li(t),u=s==="y",l=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let y;switch(c){case"top":y={x:l,y:n.y-i.height};break;case"bottom":y={x:l,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:f};break;case"left":y={x:n.x-i.width,y:f};break;default:y={x:n.x,y:n.y}}switch(Go(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const HD=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:f}=Xx(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:T,fn:P}=a[w],{x:k,y:R,data:F,reset:L}=await P({x:l,y:f,initialPlacement:n,placement:h,strategy:i,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});l=k??l,f=R??f,y={...y,[T]:{...y[T],...F}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(h=L.placement),L.rects&&(u=L.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:f}=Xx(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function lc(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:h=!1,padding:y=0}=Bi(t,e),b=Kx(y),T=a[h?f==="floating"?"reference":"floating":f],P=fl(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(T)))==null||r?T:T.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),k=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},L=fl(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:R,strategy:c}):k);return{top:(P.top-L.top+b.top)/F.y,bottom:(L.bottom-P.bottom+b.bottom)/F.y,left:(P.left-L.left+b.left)/F.x,right:(L.right-P.right+b.right)/F.x}}const KD=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Bi(e,t)||{};if(u==null)return{};const f=Kx(l),h={x:r,y:n},y=Ip(i),b=Op(y),w=await o.getDimensions(u),T=y==="y",P=T?"top":"left",k=T?"bottom":"right",R=T?"clientHeight":"clientWidth",F=s.reference[b]+s.reference[y]-h[y]-s.floating[b],L=h[y]-s.reference[y],G=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=G?G[R]:0;(!q||!await(o.isElement==null?void 0:o.isElement(G)))&&(q=a.floating[R]||s.floating[b]);const X=F/2-L/2,ie=q/2-w[b]/2-1,ae=ps(f[P],ie),ce=ps(f[k],ie),z=ae,D=q-w[b]-ce,p=q/2-w[b]/2+X,d=Mp(z,p,D),m=!c.arrow&&Go(i)!=null&&p!==d&&s.reference[b]/2-(p<z?ae:ce)-w[b]/2<0,x=m?p<z?p-z:p-D:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),XD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...T}=Bi(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Li(i),k=ms(a),R=Li(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(R||!w?[ll(a)]:zD(a)),G=b!=="none";!h&&G&&L.push(...WD(a,w,b,F));const q=[a,...L],X=await lc(t,T),ie=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ie.push(X[P]),f){const p=VD(i,o,F);ie.push(X[p[0]],X[p[1]])}if(ae=[...ae,{placement:i,overflows:ie}],!ie.every(p=>p<=0)){var ce,z;const p=(((ce=s.flip)==null?void 0:ce.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:ae},reset:{placement:d}};let m=(z=ae.filter(x=>x.overflows[0]<=0).sort((x,A)=>x.overflows[1]-A.overflows[1])[0])==null?void 0:z.placement;if(!m)switch(y){case"bestFit":{var D;const x=(D=ae.filter(A=>{if(G){const E=ms(A.placement);return E===k||E==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((A,E)=>A[1]-E[1])[0])==null?void 0:D[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function Jx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yx(e){return LD.some(t=>e[t]>=0)}const JD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Bi(e,t);switch(n){case"referenceHidden":{const s=await lc(t,{...i,elementContext:"reference"}),o=Jx(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Yx(o)}}}case"escaped":{const s=await lc(t,{...i,altBoundary:!0}),o=Jx(s,r.floating);return{data:{escapedOffsets:o,escaped:Yx(o)}}}default:return{}}}}};async function YD(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Li(r),a=Go(r),c=ms(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Bi(t,e);let{mainAxis:h,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(y=a==="end"?b*-1:b),c?{x:y*l,y:h*u}:{x:h*u,y:y*l}}const ZD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=t,c=await YD(t,e);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},QD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:T=>{let{x:P,y:k}=T;return{x:P,y:k}}},...c}=Bi(e,t),u={x:r,y:n},l=await lc(t,c),f=ms(Li(i)),h=Tp(f);let y=u[h],b=u[f];if(s){const T=h==="y"?"top":"left",P=h==="y"?"bottom":"right",k=y+l[T],R=y-l[P];y=Mp(k,y,R)}if(o){const T=f==="y"?"top":"left",P=f==="y"?"bottom":"right",k=b+l[T],R=b-l[P];b=Mp(k,b,R)}const w=a.fn({...t,[h]:y,[f]:b});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},e$=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Bi(e,t),l={x:r,y:n},f=ms(i),h=Tp(f);let y=l[h],b=l[f];const w=Bi(a,t),T=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const R=h==="y"?"height":"width",F=s.reference[h]-s.floating[R]+T.mainAxis,L=s.reference[h]+s.reference[R]-T.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var P,k;const R=h==="y"?"width":"height",F=["top","left"].includes(Li(i)),L=s.reference[f]-s.floating[R]+(F&&((P=o.offset)==null?void 0:P[f])||0)+(F?0:T.crossAxis),G=s.reference[f]+s.reference[R]+(F?0:((k=o.offset)==null?void 0:k[f])||0)-(F?T.crossAxis:0);b<L?b=L:b>G&&(b=G)}return{[h]:y,[f]:b}}}},t$=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:c=()=>{},...u}=Bi(e,t),l=await lc(t,u),f=Li(i),h=Go(i),y=ms(i)==="y",{width:b,height:w}=s.floating;let T,P;f==="top"||f==="bottom"?(T=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,T=h==="end"?"top":"bottom");const k=w-l.top-l.bottom,R=b-l.left-l.right,F=ps(w-l[T],k),L=ps(b-l[P],R),G=!t.middlewareData.shift;let q=F,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=R),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=k),G&&!h){const ae=Qr(l.left,0),ce=Qr(l.right,0),z=Qr(l.top,0),D=Qr(l.bottom,0);y?X=b-2*(ae!==0||ce!==0?ae+ce:Qr(l.left,l.right)):q=w-2*(z!==0||D!==0?z+D:Qr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const ie=await o.getDimensions(a.floating);return b!==ie.width||w!==ie.height?{reset:{rects:!0}}:{}}}};function dl(){return typeof window<"u"}function Ho(e){return Zx(e)?(e.nodeName||"").toLowerCase():"#document"}function en(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oi(e){var t;return(t=(Zx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zx(e){return dl()?e instanceof Node||e instanceof en(e).Node:!1}function jn(e){return dl()?e instanceof Element||e instanceof en(e).Element:!1}function ai(e){return dl()?e instanceof HTMLElement||e instanceof en(e).HTMLElement:!1}function Qx(e){return!dl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof en(e).ShadowRoot}function fc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function r$(e){return["table","td","th"].includes(Ho(e))}function hl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function jp(e){const t=kp(),r=jn(e)?kn(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 n$(e){let t=gs(e);for(;ai(t)&&!Ko(t);){if(jp(t))return t;if(hl(t))return null;t=gs(t)}return null}function kp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ko(e){return["html","body","#document"].includes(Ho(e))}function kn(e){return en(e).getComputedStyle(e)}function pl(e){return jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gs(e){if(Ho(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qx(e)&&e.host||oi(e);return Qx(t)?t.host:t}function e4(e){const t=gs(e);return Ko(t)?e.ownerDocument?e.ownerDocument.body:e.body:ai(t)&&fc(t)?t:e4(t)}function dc(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=e4(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=en(i);if(s){const a=Np(o);return t.concat(o,o.visualViewport||[],fc(i)?i:[],a&&r?dc(a):[])}return t.concat(i,dc(i,[],r))}function Np(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function t4(e){const t=kn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ai(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=cl(r)!==s||cl(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function Rp(e){return jn(e)?e:e.contextElement}function Xo(e){const t=Rp(e);if(!ai(t))return si(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=t4(t);let o=(s?cl(r.width):r.width)/n,a=(s?cl(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const i$=si(0);function r4(e){const t=en(e);return!kp()||!t.visualViewport?i$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function s$(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==en(e)?!1:t}function Ks(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=Rp(e);let o=si(1);t&&(n?jn(n)&&(o=Xo(n)):o=Xo(e));const a=s$(s,r,n)?r4(s):si(0);let c=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,l=i.width/o.x,f=i.height/o.y;if(s){const h=en(s),y=n&&jn(n)?en(n):n;let b=h,w=Np(b);for(;w&&n&&y!==b;){const T=Xo(w),P=w.getBoundingClientRect(),k=kn(w),R=P.left+(w.clientLeft+parseFloat(k.paddingLeft))*T.x,F=P.top+(w.clientTop+parseFloat(k.paddingTop))*T.y;c*=T.x,u*=T.y,l*=T.x,f*=T.y,c+=R,u+=F,b=en(w),w=Np(b)}}return fl({width:l,height:f,x:c,y:u})}function Dp(e,t){const r=pl(e).scrollLeft;return t?t.left+r:Ks(oi(e)).left+r}function n4(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:Dp(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function o$(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=oi(n),a=t?hl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=si(1);const l=si(0),f=ai(n);if((f||!f&&!s)&&((Ho(n)!=="body"||fc(o))&&(c=pl(n)),ai(n))){const y=Ks(n);u=Xo(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?n4(o,c,!0):si(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+h.x,y:r.y*u.y-c.scrollTop*u.y+l.y+h.y}}function a$(e){return Array.from(e.getClientRects())}function c$(e){const t=oi(e),r=pl(e),n=e.ownerDocument.body,i=Qr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Qr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+Dp(e);const a=-r.scrollTop;return kn(n).direction==="rtl"&&(o+=Qr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function u$(e,t){const r=en(e),n=oi(e),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const u=kp();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function l$(e,t){const r=Ks(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=ai(e)?Xo(e):si(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,c=i*s.x,u=n*s.y;return{width:o,height:a,x:c,y:u}}function i4(e,t,r){let n;if(t==="viewport")n=u$(e,r);else if(t==="document")n=c$(oi(e));else if(jn(t))n=l$(t,r);else{const i=r4(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return fl(n)}function s4(e,t){const r=gs(e);return r===t||!jn(r)||Ko(r)?!1:kn(r).position==="fixed"||s4(r,t)}function f$(e,t){const r=t.get(e);if(r)return r;let n=dc(e,[],!1).filter(a=>jn(a)&&Ho(a)!=="body"),i=null;const s=kn(e).position==="fixed";let o=s?gs(e):e;for(;jn(o)&&!Ko(o);){const a=kn(o),c=jp(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||fc(o)&&!c&&s4(e,o))?n=n.filter(l=>l!==o):i=a,o=gs(o)}return t.set(e,n),n}function d$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?hl(t)?[]:f$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=i4(t,l,i);return u.top=Qr(f.top,u.top),u.right=ps(f.right,u.right),u.bottom=ps(f.bottom,u.bottom),u.left=Qr(f.left,u.left),u},i4(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function h$(e){const{width:t,height:r}=t4(e);return{width:t,height:r}}function p$(e,t,r){const n=ai(t),i=oi(t),s=r==="fixed",o=Ks(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=si(0);if(n||!n&&!s)if((Ho(t)!=="body"||fc(i))&&(a=pl(t)),n){const h=Ks(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=Dp(i));const u=i&&!n&&!s?n4(i,a):si(0),l=o.left+a.scrollLeft-c.x-u.x,f=o.top+a.scrollTop-c.y-u.y;return{x:l,y:f,width:o.width,height:o.height}}function $p(e){return kn(e).position==="static"}function o4(e,t){if(!ai(e)||kn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return oi(e)===r&&(r=r.ownerDocument.body),r}function a4(e,t){const r=en(e);if(hl(e))return r;if(!ai(e)){let i=gs(e);for(;i&&!Ko(i);){if(jn(i)&&!$p(i))return i;i=gs(i)}return r}let n=o4(e,t);for(;n&&r$(n)&&$p(n);)n=o4(n,t);return n&&Ko(n)&&$p(n)&&!jp(n)?r:n||n$(e)||r}const m$=async function(e){const t=this.getOffsetParent||a4,r=this.getDimensions,n=await r(e.floating);return{reference:p$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function g$(e){return kn(e).direction==="rtl"}const v$={convertOffsetParentRelativeRectToViewportRelativeRect:o$,getDocumentElement:oi,getClippingRect:d$,getOffsetParent:a4,getElementRects:m$,getClientRects:a$,getDimensions:h$,getScale:Xo,isElement:jn,isRTL:g$};function y$(e,t){let r=null,n;const i=oi(e);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:u,top:l,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const y=ul(l),b=ul(i.clientWidth-(u+f)),w=ul(i.clientHeight-(l+h)),T=ul(u),k={rootMargin:-y+"px "+-b+"px "+-w+"px "+-T+"px",threshold:Qr(0,ps(1,c))||1};let R=!0;function F(L){const G=L[0].intersectionRatio;if(G!==c){if(!R)return o();G?o(!1,G):n=setTimeout(()=>{o(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(F,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,k)}r.observe(e)}return o(!0),s}function b$(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Rp(e),l=i||s?[...u?dc(u):[],...dc(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?y$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[k]=P;k&&k.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Ks(e):null;c&&T();function T(){const P=Ks(e);w&&(P.x!==w.x||P.y!==w.y||P.width!==w.width||P.height!==w.height)&&r(),w=P,b=requestAnimationFrame(T)}return r(),()=>{var P;l.forEach(k=>{i&&k.removeEventListener("scroll",r),s&&k.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const w$=ZD,_$=QD,x$=XD,S$=t$,E$=JD,c4=KD,C$=e$,A$=(e,t,r)=>{const n=new Map,i={platform:v$,...r},s={...i.platform,_c:n};return HD(e,t,{...i,platform:s})};var ml=typeof document<"u"?te.useLayoutEffect:te.useEffect;function gl(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(!gl(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 s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!gl(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function u4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function l4(e,t){const r=u4(e);return Math.round(t*r)/r}function Bp(e){const t=I.useRef(e);return ml(()=>{t.current=e}),t}function M$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,f]=I.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,y]=I.useState(n);gl(h,n)||y(n);const[b,w]=I.useState(null),[T,P]=I.useState(null),k=I.useCallback(A=>{A!==G.current&&(G.current=A,w(A))},[]),R=I.useCallback(A=>{A!==q.current&&(q.current=A,P(A))},[]),F=s||b,L=o||T,G=I.useRef(null),q=I.useRef(null),X=I.useRef(l),ie=c!=null,ae=Bp(c),ce=Bp(i),z=Bp(u),D=I.useCallback(()=>{if(!G.current||!q.current)return;const A={placement:t,strategy:r,middleware:h};ce.current&&(A.platform=ce.current),A$(G.current,q.current,A).then(E=>{const O={...E,isPositioned:z.current!==!1};p.current&&!gl(X.current,O)&&(X.current=O,nm.flushSync(()=>{f(O)}))})},[h,t,r,ce,z]);ml(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(A=>({...A,isPositioned:!1})))},[u]);const p=I.useRef(!1);ml(()=>(p.current=!0,()=>{p.current=!1}),[]),ml(()=>{if(F&&(G.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,D);D()}},[F,L,D,ae,ie]);const d=I.useMemo(()=>({reference:G,floating:q,setReference:k,setFloating:R}),[k,R]),m=I.useMemo(()=>({reference:F,floating:L}),[F,L]),x=I.useMemo(()=>{const A={position:r,left:0,top:0};if(!m.floating)return A;const E=l4(m.floating,l.x),O=l4(m.floating,l.y);return a?{...A,transform:"translate("+E+"px, "+O+"px)",...u4(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:E,top:O}},[r,a,m.floating,l.x,l.y]);return I.useMemo(()=>({...l,update:D,refs:d,elements:m,floatingStyles:x}),[l,D,d,m,x])}const T$=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?c4({element:n.current,padding:i}).fn(r):{}:n?c4({element:n,padding:i}).fn(r):{}}}},O$=(e,t)=>({...w$(e),options:[e,t]}),I$=(e,t)=>({..._$(e),options:[e,t]}),P$=(e,t)=>({...C$(e),options:[e,t]}),j$=(e,t)=>({...x$(e),options:[e,t]}),k$=(e,t)=>({...S$(e),options:[e,t]}),N$=(e,t)=>({...E$(e),options:[e,t]}),R$=(e,t)=>({...T$(e),options:[e,t]});var D$="Arrow",f4=I.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return _.jsx(Gt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});f4.displayName=D$;var $$=f4;function B$(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,L$(i,...t)]}function L$(...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(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function Lp(e){const[t,r]=I.useState(void 0);return hs(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;r({width:o,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Fp="Popper",[d4,vl]=B$(Fp),[F$,h4]=d4(Fp),p4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(F$,{scope:t,anchor:n,onAnchorChange:i,children:r})};p4.displayName=Fp;var m4="PopperAnchor",g4=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=h4(m4,r),o=I.useRef(null),a=Qt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Gt.div,{...i,ref:a})});g4.displayName=m4;var Up="PopperContent",[U$,V$]=d4(Up),v4=I.forwardRef((e,t)=>{var he,ye,Ee,Se,Ge,Ue;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,T=h4(Up,r),[P,k]=I.useState(null),R=Qt(t,dt=>k(dt)),[F,L]=I.useState(null),G=Lp(F),q=(G==null?void 0:G.width)??0,X=(G==null?void 0:G.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],z=ce.length>0,D={padding:ae,boundary:ce.filter(q$),altBoundary:z},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:A}=M$({strategy:"fixed",placement:ie,whileElementsMounted:(...dt)=>b$(...dt,{animationFrame:y==="always"}),elements:{reference:T.anchor},middleware:[O$({mainAxis:i+X,alignmentAxis:o}),c&&I$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?P$():void 0,...D}),c&&j$({...D}),k$({...D,apply:({elements:dt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:xe,height:ge}=ht.reference,Te=dt.floating.style;Te.setProperty("--radix-popper-available-width",`${$e}px`),Te.setProperty("--radix-popper-available-height",`${mt}px`),Te.setProperty("--radix-popper-anchor-width",`${xe}px`),Te.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),F&&R$({element:F,padding:a}),W$({arrowWidth:q,arrowHeight:X}),h&&N$({strategy:"referenceHidden",...D})]}),[E,O]=w4(m),C=vr(b);hs(()=>{x&&(C==null||C())},[x,C]);const g=(he=A.arrow)==null?void 0:he.x,v=(ye=A.arrow)==null?void 0:ye.y,j=((Ee=A.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,se]=I.useState();return hs(()=>{P&&se(window.getComputedStyle(P).zIndex)},[P]),_.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(Se=A.transformOrigin)==null?void 0:Se.x,(Ge=A.transformOrigin)==null?void 0:Ge.y].join(" "),...((Ue=A.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(U$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:_.jsx(Gt.div,{"data-side":E,"data-align":O,...w,ref:R,style:{...w.style,animation:x?void 0:"none"}})})})});v4.displayName=Up;var y4="PopperArrow",z$={top:"bottom",right:"left",bottom:"top",left:"right"},b4=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=V$(y4,n),o=z$[s.placedSide];return _.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:_.jsx($$,{...i,ref:r,style:{...i.style,display:"block"}})})});b4.displayName=y4;function q$(e){return e!==null}var W$=e=>({name:"transformOrigin",options:e,fn(t){var T,P,k;const{placement:r,rects:n,middlewareData:i}=t,o=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=w4(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((k=i.arrow)==null?void 0:k.y)??0)+c/2;let b="",w="";return u==="bottom"?(b=o?f:`${h}px`,w=`${-c}px`):u==="top"?(b=o?f:`${h}px`,w=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,w=o?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,w=o?f:`${y}px`),{data:{x:b,y:w}}}});function w4(e){const[t,r="center"]=e.split("-");return[t,r]}var _4=p4,x4=g4,S4=v4,E4=b4,G$="Portal",C4=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);hs(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Ln.createPortal(_.jsx(Gt.div,{...n,ref:t}),o):null});C4.displayName=G$;function H$(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var Nn=e=>{const{present:t,children:r}=e,n=K$(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Qt(n.ref,X$(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};Nn.displayName="Presence";function K$(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=H$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=yl(n.current);s.current=a==="mounted"?u:"none"},[a]),hs(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=yl(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&h!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),hs(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=yl(n.current).includes(y.animationName);if(y.target===t&&w&&(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)})}},h=y=>{y.target===t&&(s.current=yl(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:I.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function yl(e){return(e==null?void 0:e.animationName)||"none"}function X$(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 hc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=J$({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=vr(r),c=I.useCallback(u=>{if(s){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[s,e,i,a]);return[o,c]}function J$({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=vr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var Y$="VisuallyHidden",A4=I.forwardRef((e,t)=>_.jsx(Gt.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}}));A4.displayName=Y$;var Z$=A4,[bl,JX]=qo("Tooltip",[vl]),Vp=vl(),M4="TooltipProvider",Q$=700,T4="tooltip.open",[eB,O4]=bl(M4),I4=e=>{const{__scopeTooltip:t,delayDuration:r=Q$,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=I.useState(!0),c=I.useRef(!1),u=I.useRef(0);return I.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),_.jsx(eB,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:I.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:I.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:I.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:s})};I4.displayName=M4;var P4="Tooltip",[YX,wl]=bl(P4),zp="TooltipTrigger",tB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=wl(zp,r),s=O4(zp,r),o=Vp(r),a=I.useRef(null),c=Qt(t,a,i.onTriggerChange),u=I.useRef(!1),l=I.useRef(!1),f=I.useCallback(()=>u.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),_.jsx(x4,{asChild:!0,...o,children:_.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:tt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:tt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:tt(e.onBlur,i.onClose),onClick:tt(e.onClick,i.onClose)})})});tB.displayName=zp;var rB="TooltipPortal",[ZX,nB]=bl(rB,{forceMount:void 0}),Jo="TooltipContent",iB=I.forwardRef((e,t)=>{const r=nB(Jo,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=wl(Jo,e.__scopeTooltip);return _.jsx(Nn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(j4,{side:i,...s,ref:t}):_.jsx(sB,{side:i,...s,ref:t})})}),sB=I.forwardRef((e,t)=>{const r=wl(Jo,e.__scopeTooltip),n=O4(Jo,e.__scopeTooltip),i=I.useRef(null),s=Qt(t,i),[o,a]=I.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=I.useCallback(()=>{a(null),f(!1)},[f]),y=I.useCallback((b,w)=>{const T=b.currentTarget,P={x:b.clientX,y:b.clientY},k=uB(P,T.getBoundingClientRect()),R=lB(P,k),F=fB(w.getBoundingClientRect()),L=hB([...R,...F]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=T=>y(T,l),w=T=>y(T,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",w)}}},[c,l,y,h]),I.useEffect(()=>{if(o){const b=w=>{const T=w.target,P={x:w.clientX,y:w.clientY},k=(c==null?void 0:c.contains(T))||(l==null?void 0:l.contains(T)),R=!dB(P,o);k?h():R&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(j4,{...e,ref:s})}),[oB,aB]=bl(P4,{isInside:!1}),j4=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=wl(Jo,r),u=Vp(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(T4,l),()=>document.removeEventListener(T4,l)),[l]),I.useEffect(()=>{if(c.trigger){const f=h=>{const y=h.target;y!=null&&y.contains(c.trigger)&&l()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,l]),_.jsx(Ap,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(S4,{"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:[_.jsx(Wo,{children:n}),_.jsx(oB,{scope:r,isInside:!0,children:_.jsx(Z$,{id:c.contentId,role:"tooltip",children:i||n})})]})})});iB.displayName=Jo;var k4="TooltipArrow",cB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Vp(r);return aB(k4,r).isInside?null:_.jsx(E4,{...i,...n,ref:t})});cB.displayName=k4;function uB(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,i,s)){case s:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function lB(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 fB(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 dB(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function hB(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),pB(t)}function pB(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 s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.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 s=r[r.length-1],o=r[r.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.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 mB=I4,N4=I.createContext(void 0),gB=e=>{const{dir:t,children:r}=e;return _.jsx(N4.Provider,{value:t,children:r})};function qp(e){const t=I.useContext(N4);return e||t||"ltr"}const vB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],yB=["sky","mint","lime","yellow","amber"],bB=["gold","bronze"],wB=[...vB,...yB,...bB],_B=["gray",...["mauve","slate","sage","olive","sand"]];function xB(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 SB=["inherit","light","dark"],EB=[...wB,"gray"],CB=[..._B,"auto"],Fr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:SB,default:"inherit"},accentColor:{type:"enum",values:EB,default:"indigo"},grayColor:{type:"enum",values:CB,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 R4(e){return e==="gray"?"gray":xB(e)}const Yo=()=>{},_l=I.createContext(void 0);function AB(){const e=I.useContext(_l);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const xl=I.forwardRef((e,t)=>I.useContext(_l)===void 0?I.createElement(mB,null,I.createElement(gB,{dir:"ltr"},I.createElement(D4,{...e,ref:t}))):I.createElement(Wp,{...e,ref:t}));xl.displayName="Theme";const D4=I.forwardRef((e,t)=>{const{appearance:r=Fr.appearance.default,accentColor:n=Fr.accentColor.default,grayColor:i=Fr.grayColor.default,panelBackground:s=Fr.panelBackground.default,radius:o=Fr.radius.default,scaling:a=Fr.scaling.default,hasBackground:c=Fr.hasBackground.default,...u}=e,[l,f]=I.useState(r);I.useEffect(()=>f(r),[r]);const[h,y]=I.useState(n);I.useEffect(()=>y(n),[n]);const[b,w]=I.useState(i);I.useEffect(()=>w(i),[i]);const[T,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[k,R]=I.useState(o);I.useEffect(()=>R(o),[o]);const[F,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const G=I.memo(({appearance:X})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${X}';c.add('${X}');}catch(e){}})();`}}),()=>!0);G.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>MB(r),[r]);const q=b==="auto"?R4(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(G,{appearance:l}),c&&I.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})()})(C1);var x5=C1.exports;const Xt=ks(x5);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 S5(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Xc(...e){return t=>e.forEach(r=>S5(r,t))}function rr(...e){return P.useCallback(Xc(...e),e)}function us(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,...x}=d,y=((O=p==null?void 0:p[e])==null?void 0:O[c])||a,A=P.useMemo(()=>x,Object.values(x));return b.jsx(y.Provider,{value:A,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,x=P.useContext(w);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,E5(i,...t)]}function E5(...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 Si=P.forwardRef((e,t)=>{const{children:r,...n}=e,i=P.Children.toArray(r),o=i.find(_5);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 b.jsx(cd,{...n,ref:t,children:P.isValidElement(s)?P.cloneElement(s,void 0,a):null})}return b.jsx(cd,{...n,ref:t,children:r})});Si.displayName="Slot";var cd=P.forwardRef((e,t)=>{const{children:r,...n}=e;if(P.isValidElement(r)){const i=M5(r);return P.cloneElement(r,{...C5(n,r.props),ref:t?Xc(t,i):i})}return P.Children.count(r)>1?P.Children.only(null):null});cd.displayName="SlotClone";var ls=({children:e})=>b.jsx(b.Fragment,{children:e});function _5(e){return P.isValidElement(e)&&e.type===ls}function C5(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 M5(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 T5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Yt=T5.reduce((e,t)=>{const r=P.forwardRef((n,i)=>{const{asChild:o,...s}=n,a=o?Si:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(a,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function M1(e,t){e&&Uh.flushSync(()=>e.dispatchEvent(t))}function wr(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 A5(e,t=globalThis==null?void 0:globalThis.document){const r=wr(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 I5="DismissableLayer",ud="dismissableLayer.update",O5="dismissableLayer.pointerDownOutside",P5="dismissableLayer.focusOutside",T1,A1=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ld=P.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...c}=e,u=P.useContext(A1),[l,d]=P.useState(null),p=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=P.useState({}),x=rr(t,q=>d(q)),y=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),O=y.indexOf(A),R=l?y.indexOf(l):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,F=R>=O,$=j5(q=>{const Y=q.target,ne=[...u.branches].some(se=>se.contains(Y));!F||ne||(i==null||i(q),s==null||s(q),q.defaultPrevented||a==null||a())},p),H=k5(q=>{const Y=q.target;[...u.branches].some(se=>se.contains(Y))||(o==null||o(q),s==null||s(q),q.defaultPrevented||a==null||a())},p);return A5(q=>{R===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},p),P.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(T1=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),I1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=T1)}},[l,p,r,u]),P.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),I1())},[l,u]),P.useEffect(()=>{const q=()=>w({});return document.addEventListener(ud,q),()=>document.removeEventListener(ud,q)},[]),b.jsx(Yt.div,{...c,ref:x,style:{pointerEvents:k?F?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,H.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,$.onPointerDownCapture)})});ld.displayName=I5;var R5="DismissableLayerBranch",N5=P.forwardRef((e,t)=>{const r=P.useContext(A1),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]),b.jsx(Yt.div,{...e,ref:i})});N5.displayName=R5;function j5(e,t=globalThis==null?void 0:globalThis.document){const r=wr(e),n=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){O1(O5,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 k5(e,t=globalThis==null?void 0:globalThis.document){const r=wr(e),n=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!n.current&&O1(P5,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 I1(){const e=new CustomEvent(ud);document.dispatchEvent(e)}function O1(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?M1(i,o):i.dispatchEvent(o)}var Wi=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},D5=P["useId".toString()]||(()=>{}),B5=0;function ga(e){const[t,r]=P.useState(D5());return Wi(()=>{e||r(n=>n??String(B5++))},[e]),e||(t?`radix-${t}`:"")}const L5=["top","right","bottom","left"],Gi=Math.min,Qr=Math.max,Jc=Math.round,Qc=Math.floor,Kn=e=>({x:e,y:e}),$5={left:"right",right:"left",bottom:"top",top:"bottom"},F5={start:"end",end:"start"};function fd(e,t,r){return Qr(e,Gi(t,r))}function Ei(e,t){return typeof e=="function"?e(t):e}function _i(e){return e.split("-")[0]}function fs(e){return e.split("-")[1]}function dd(e){return e==="x"?"y":"x"}function hd(e){return e==="y"?"height":"width"}function Ki(e){return["top","bottom"].includes(_i(e))?"y":"x"}function pd(e){return dd(Ki(e))}function U5(e,t,r){r===void 0&&(r=!1);const n=fs(e),i=pd(e),o=hd(i);let s=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=eu(s)),[s,eu(s)]}function V5(e){const t=eu(e);return[md(e),t,md(t)]}function md(e){return e.replace(/start|end/g,t=>F5[t])}function z5(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 q5(e,t,r,n){const i=fs(e);let o=z5(_i(e),r==="start",n);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(md)))),o}function eu(e){return e.replace(/left|right|bottom|top/g,t=>$5[t])}function H5(e){return{top:0,right:0,bottom:0,left:0,...e}}function P1(e){return typeof e!="number"?H5(e):{top:e,right:e,bottom:e,left:e}}function tu(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 R1(e,t,r){let{reference:n,floating:i}=e;const o=Ki(t),s=pd(t),a=hd(s),c=_i(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(fs(t)){case"start":w[s]-=p*(r&&u?-1:1);break;case"end":w[s]+=p*(r&&u?-1:1);break}return w}const W5=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}=R1(u,n,c),p=n,w={},x=0;for(let y=0;y<a.length;y++){const{name:A,fn:O}=a[y],{x:R,y:k,data:F,reset:$}=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,[A]:{...w[A],...F}},$&&x<=50&&(x++,typeof $=="object"&&($.placement&&(p=$.placement),$.rects&&(u=$.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):$.rects),{x:l,y:d}=R1(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}=Ei(t,e),x=P1(w),A=a[p?d==="floating"?"reference":"floating":d],O=tu(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(A)))==null||r?A:A.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},$=tu(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:k,strategy:c}):R);return{top:(O.top-$.top+x.top)/F.y,bottom:($.bottom-O.bottom+x.bottom)/F.y,left:(O.left-$.left+x.left)/F.x,right:($.right-O.right+x.right)/F.x}}const G5=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}=Ei(e,t)||{};if(u==null)return{};const d=P1(l),p={x:r,y:n},w=pd(i),x=hd(w),y=await s.getDimensions(u),A=w==="y",O=A?"top":"left",R=A?"bottom":"right",k=A?"clientHeight":"clientWidth",F=o.reference[x]+o.reference[w]-p[w]-o.floating[x],$=p[w]-o.reference[w],H=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let q=H?H[k]:0;(!q||!await(s.isElement==null?void 0:s.isElement(H)))&&(q=a.floating[k]||o.floating[x]);const Y=F/2-$/2,ne=q/2-y[x]/2-1,se=Gi(d[O],ne),ae=Gi(d[R],ne),z=se,D=q-y[x]-ae,h=q/2-y[x]/2+Y,f=fd(z,h,D),m=!c.arrow&&fs(i)!=null&&h!==f&&o.reference[x]/2-(h<z?se:ae)-y[x]/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}}}),K5=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:x="none",flipAlignment:y=!0,...A}=Ei(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const O=_i(i),R=Ki(a),k=_i(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),$=p||(k||!y?[eu(a)]:V5(a)),H=x!=="none";!p&&H&&$.push(...q5(a,y,x,F));const q=[a,...$],Y=await va(t,A),ne=[];let se=((n=o.flip)==null?void 0:n.overflows)||[];if(l&&ne.push(Y[O]),d){const h=U5(i,s,F);ne.push(Y[h[0]],Y[h[1]])}if(se=[...se,{placement:i,overflows:ne}],!ne.every(h=>h<=0)){var ae,z;const h=(((ae=o.flip)==null?void 0:ae.index)||0)+1,f=q[h];if(f)return{data:{index:h,overflows:se},reset:{placement:f}};let m=(z=se.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=se.filter(M=>{if(H){const _=Ki(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 N1(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function j1(e){return L5.some(t=>e[t]>=0)}const Y5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ei(e,t);switch(n){case"referenceHidden":{const o=await va(t,{...i,elementContext:"reference"}),s=N1(o,r.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:j1(s)}}}case"escaped":{const o=await va(t,{...i,altBoundary:!0}),s=N1(o,r.floating);return{data:{escapedOffsets:s,escaped:j1(s)}}}default:return{}}}}};async function Z5(e,t){const{placement:r,platform:n,elements:i}=e,o=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=_i(r),a=fs(r),c=Ki(r)==="y",u=["left","top"].includes(s)?-1:1,l=o&&c?-1:1,d=Ei(t,e);let{mainAxis:p,crossAxis:w,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"&&(w=a==="end"?x*-1:x),c?{x:w*l,y:p*u}:{x:p*u,y:w*l}}const X5=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 Z5(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}}}}},J5=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:A=>{let{x:O,y:R}=A;return{x:O,y:R}}},...c}=Ei(e,t),u={x:r,y:n},l=await va(t,c),d=Ki(_i(i)),p=dd(d);let w=u[p],x=u[d];if(o){const A=p==="y"?"top":"left",O=p==="y"?"bottom":"right",R=w+l[A],k=w-l[O];w=fd(R,w,k)}if(s){const A=d==="y"?"top":"left",O=d==="y"?"bottom":"right",R=x+l[A],k=x-l[O];x=fd(R,x,k)}const y=a.fn({...t,[p]:w,[d]:x});return{...y,data:{x:y.x-r,y:y.y-n,enabled:{[p]:o,[d]:s}}}}}},Q5=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}=Ei(e,t),l={x:r,y:n},d=Ki(i),p=dd(d);let w=l[p],x=l[d];const y=Ei(a,t),A=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]+A.mainAxis,$=o.reference[p]+o.reference[k]-A.mainAxis;w<F?w=F:w>$&&(w=$)}if(u){var O,R;const k=p==="y"?"width":"height",F=["top","left"].includes(_i(i)),$=o.reference[d]-o.floating[k]+(F&&((O=s.offset)==null?void 0:O[d])||0)+(F?0:A.crossAxis),H=o.reference[d]+o.reference[k]+(F?0:((R=s.offset)==null?void 0:R[d])||0)-(F?A.crossAxis:0);x<$?x=$:x>H&&(x=H)}return{[p]:w,[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}=Ei(e,t),l=await va(t,u),d=_i(i),p=fs(i),w=Ki(i)==="y",{width:x,height:y}=o.floating;let A,O;d==="top"||d==="bottom"?(A=d,O=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(O=d,A=p==="end"?"top":"bottom");const R=y-l.top-l.bottom,k=x-l.left-l.right,F=Gi(y-l[A],R),$=Gi(x-l[O],k),H=!t.middlewareData.shift;let q=F,Y=$;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(Y=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=R),H&&!p){const se=Qr(l.left,0),ae=Qr(l.right,0),z=Qr(l.top,0),D=Qr(l.bottom,0);w?Y=x-2*(se!==0||ae!==0?se+ae:Qr(l.left,l.right)):q=y-2*(z!==0||D!==0?z+D:Qr(l.top,l.bottom))}await c({...t,availableWidth:Y,availableHeight:q});const ne=await s.getDimensions(a.floating);return x!==ne.width||y!==ne.height?{reset:{rects:!0}}:{}}}};function ru(){return typeof window<"u"}function ds(e){return k1(e)?(e.nodeName||"").toLowerCase():"#document"}function en(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yn(e){var t;return(t=(k1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function k1(e){return ru()?e instanceof Node||e instanceof en(e).Node:!1}function An(e){return ru()?e instanceof Element||e instanceof en(e).Element:!1}function Zn(e){return ru()?e instanceof HTMLElement||e instanceof en(e).HTMLElement:!1}function D1(e){return!ru()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof en(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 tM(e){return["table","td","th"].includes(ds(e))}function nu(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function gd(e){const t=vd(),r=An(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 rM(e){let t=Yi(e);for(;Zn(t)&&!hs(t);){if(gd(t))return t;if(nu(t))return null;t=Yi(t)}return null}function vd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function hs(e){return["html","body","#document"].includes(ds(e))}function In(e){return en(e).getComputedStyle(e)}function iu(e){return An(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yi(e){if(ds(e)==="html")return e;const t=e.assignedSlot||e.parentNode||D1(e)&&e.host||Yn(e);return D1(t)?t.host:t}function B1(e){const t=Yi(e);return hs(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zn(t)&&ya(t)?t:B1(t)}function wa(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=B1(e),o=i===((n=e.ownerDocument)==null?void 0:n.body),s=en(i);if(o){const a=yd(s);return t.concat(s,s.visualViewport||[],ya(i)?i:[],a&&r?wa(a):[])}return t.concat(i,wa(i,[],r))}function yd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L1(e){const t=In(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Zn(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=Jc(r)!==o||Jc(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function wd(e){return An(e)?e:e.contextElement}function ps(e){const t=wd(e);if(!Zn(t))return Kn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=L1(t);let s=(o?Jc(r.width):r.width)/n,a=(o?Jc(r.height):r.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const nM=Kn(0);function $1(e){const t=en(e);return!vd()||!t.visualViewport?nM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iM(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==en(e)?!1:t}function _o(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),o=wd(e);let s=Kn(1);t&&(n?An(n)&&(s=ps(n)):s=ps(e));const a=iM(o,r,n)?$1(o):Kn(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=en(o),w=n&&An(n)?en(n):n;let x=p,y=yd(x);for(;y&&n&&w!==x;){const A=ps(y),O=y.getBoundingClientRect(),R=In(y),k=O.left+(y.clientLeft+parseFloat(R.paddingLeft))*A.x,F=O.top+(y.clientTop+parseFloat(R.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,d*=A.y,c+=k,u+=F,x=en(y),y=yd(x)}}return tu({width:l,height:d,x:c,y:u})}function bd(e,t){const r=iu(e).scrollLeft;return t?t.left+r:_o(Yn(e)).left+r}function F1(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:bd(e,n)),o=n.top+t.scrollTop;return{x:i,y:o}}function oM(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o=i==="fixed",s=Yn(n),a=t?nu(t.floating):!1;if(n===s||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Kn(1);const l=Kn(0),d=Zn(n);if((d||!d&&!o)&&((ds(n)!=="body"||ya(s))&&(c=iu(n)),Zn(n))){const w=_o(n);u=ps(n),l.x=w.x+n.clientLeft,l.y=w.y+n.clientTop}const p=s&&!d&&!o?F1(s,c,!0):Kn(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 sM(e){return Array.from(e.getClientRects())}function aM(e){const t=Yn(e),r=iu(e),n=e.ownerDocument.body,i=Qr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Qr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+bd(e);const a=-r.scrollTop;return In(n).direction==="rtl"&&(s+=Qr(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}function cM(e,t){const r=en(e),n=Yn(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=vd();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function uM(e,t){const r=_o(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=Zn(e)?ps(e):Kn(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 U1(e,t,r){let n;if(t==="viewport")n=cM(e,r);else if(t==="document")n=aM(Yn(e));else if(An(t))n=uM(t,r);else{const i=$1(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return tu(n)}function V1(e,t){const r=Yi(e);return r===t||!An(r)||hs(r)?!1:In(r).position==="fixed"||V1(r,t)}function lM(e,t){const r=t.get(e);if(r)return r;let n=wa(e,[],!1).filter(a=>An(a)&&ds(a)!=="body"),i=null;const o=In(e).position==="fixed";let s=o?Yi(e):e;for(;An(s)&&!hs(s);){const a=In(s),c=gd(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||ya(s)&&!c&&V1(e,s))?n=n.filter(l=>l!==s):i=a,s=Yi(s)}return t.set(e,n),n}function fM(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const s=[...r==="clippingAncestors"?nu(t)?[]:lM(t,this._c):[].concat(r),n],a=s[0],c=s.reduce((u,l)=>{const d=U1(t,l,i);return u.top=Qr(d.top,u.top),u.right=Gi(d.right,u.right),u.bottom=Gi(d.bottom,u.bottom),u.left=Qr(d.left,u.left),u},U1(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function dM(e){const{width:t,height:r}=L1(e);return{width:t,height:r}}function hM(e,t,r){const n=Zn(t),i=Yn(t),o=r==="fixed",s=_o(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Kn(0);if(n||!n&&!o)if((ds(t)!=="body"||ya(i))&&(a=iu(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=bd(i));const u=i&&!n&&!o?F1(i,a):Kn(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 xd(e){return In(e).position==="static"}function z1(e,t){if(!Zn(e)||In(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Yn(e)===r&&(r=r.ownerDocument.body),r}function q1(e,t){const r=en(e);if(nu(e))return r;if(!Zn(e)){let i=Yi(e);for(;i&&!hs(i);){if(An(i)&&!xd(i))return i;i=Yi(i)}return r}let n=z1(e,t);for(;n&&tM(n)&&xd(n);)n=z1(n,t);return n&&hs(n)&&xd(n)&&!gd(n)?r:n||rM(e)||r}const pM=async function(e){const t=this.getOffsetParent||q1,r=this.getDimensions,n=await r(e.floating);return{reference:hM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function mM(e){return In(e).direction==="rtl"}const gM={convertOffsetParentRelativeRectToViewportRelativeRect:oM,getDocumentElement:Yn,getClippingRect:fM,getOffsetParent:q1,getElementRects:pM,getClientRects:sM,getDimensions:dM,getScale:ps,isElement:An,isRTL:mM};function vM(e,t){let r=null,n;const i=Yn(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=Qc(l),x=Qc(i.clientWidth-(u+d)),y=Qc(i.clientHeight-(l+p)),A=Qc(u),R={rootMargin:-w+"px "+-x+"px "+-y+"px "+-A+"px",threshold:Qr(0,Gi(1,c))||1};let k=!0;function F($){const H=$[0].intersectionRatio;if(H!==c){if(!k)return s();H?s(!1,H):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 yM(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=wd(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?vM(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 x,y=c?_o(e):null;c&&A();function A(){const O=_o(e);y&&(O.x!==y.x||O.y!==y.y||O.width!==y.width||O.height!==y.height)&&r(),y=O,x=requestAnimationFrame(A)}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(x)}}const wM=X5,bM=J5,xM=K5,SM=eM,EM=Y5,H1=G5,_M=Q5,CM=(e,t,r)=>{const n=new Map,i={platform:gM,...r},o={...i.platform,_c:n};return W5(e,t,{...i,platform:o})};var ou=typeof document<"u"?te.useLayoutEffect:te.useEffect;function su(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(!su(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)&&!su(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function W1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G1(e,t){const r=W1(e);return Math.round(t*r)/r}function Sd(e){const t=P.useRef(e);return ou(()=>{t.current=e}),t}function MM(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);su(p,n)||w(n);const[x,y]=P.useState(null),[A,O]=P.useState(null),R=P.useCallback(M=>{M!==H.current&&(H.current=M,y(M))},[]),k=P.useCallback(M=>{M!==q.current&&(q.current=M,O(M))},[]),F=o||x,$=s||A,H=P.useRef(null),q=P.useRef(null),Y=P.useRef(l),ne=c!=null,se=Sd(c),ae=Sd(i),z=Sd(u),D=P.useCallback(()=>{if(!H.current||!q.current)return;const M={placement:t,strategy:r,middleware:p};ae.current&&(M.platform=ae.current),CM(H.current,q.current,M).then(_=>{const I={..._,isPositioned:z.current!==!1};h.current&&!su(Y.current,I)&&(Y.current=I,Uh.flushSync(()=>{d(I)}))})},[p,t,r,ae,z]);ou(()=>{u===!1&&Y.current.isPositioned&&(Y.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[u]);const h=P.useRef(!1);ou(()=>(h.current=!0,()=>{h.current=!1}),[]),ou(()=>{if(F&&(H.current=F),$&&(q.current=$),F&&$){if(se.current)return se.current(F,$,D);D()}},[F,$,D,se,ne]);const f=P.useMemo(()=>({reference:H,floating:q,setReference:R,setFloating:k}),[R,k]),m=P.useMemo(()=>({reference:F,floating:$}),[F,$]),S=P.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const _=G1(m.floating,l.x),I=G1(m.floating,l.y);return a?{...M,transform:"translate("+_+"px, "+I+"px)",...W1(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 TM=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?H1({element:n.current,padding:i}).fn(r):{}:n?H1({element:n,padding:i}).fn(r):{}}}},AM=(e,t)=>({...wM(e),options:[e,t]}),IM=(e,t)=>({...bM(e),options:[e,t]}),OM=(e,t)=>({..._M(e),options:[e,t]}),PM=(e,t)=>({...xM(e),options:[e,t]}),RM=(e,t)=>({...SM(e),options:[e,t]}),NM=(e,t)=>({...EM(e),options:[e,t]}),jM=(e,t)=>({...TM(e),options:[e,t]});var kM="Arrow",K1=P.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...o}=e;return b.jsx(Yt.svg,{...o,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});K1.displayName=kM;var DM=K1;function BM(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,...x}=d,y=(p==null?void 0:p[e][c])||a,A=P.useMemo(()=>x,Object.values(x));return b.jsx(y.Provider,{value:A,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,x=P.useContext(w);if(x)return x;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,LM(i,...t)]}function LM(...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 Ed(e){const[t,r]=P.useState(void 0);return Wi(()=>{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 _d="Popper",[Y1,au]=BM(_d),[$M,Z1]=Y1(_d),X1=e=>{const{__scopePopper:t,children:r}=e,[n,i]=P.useState(null);return b.jsx($M,{scope:t,anchor:n,onAnchorChange:i,children:r})};X1.displayName=_d;var J1="PopperAnchor",Q1=P.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,o=Z1(J1,r),s=P.useRef(null),a=rr(t,s);return P.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:b.jsx(Yt.div,{...i,ref:a})});Q1.displayName=J1;var Cd="PopperContent",[FM,UM]=Y1(Cd),ev=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:x,...y}=e,A=Z1(Cd,r),[O,R]=P.useState(null),k=rr(t,ft=>R(ft)),[F,$]=P.useState(null),H=Ed(F),q=(H==null?void 0:H.width)??0,Y=(H==null?void 0:H.height)??0,ne=n+(o!=="center"?"-"+o:""),se=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:se,boundary:ae.filter(zM),altBoundary:z},{refs:h,floatingStyles:f,placement:m,isPositioned:S,middlewareData:M}=MM({strategy:"fixed",placement:ne,whileElementsMounted:(...ft)=>yM(...ft,{animationFrame:w==="always"}),elements:{reference:A.anchor},middleware:[AM({mainAxis:i+Y,alignmentAxis:s}),c&&IM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?OM():void 0,...D}),c&&PM({...D}),RM({...D,apply:({elements:ft,rects:dt,availableWidth:je,availableHeight:pt})=>{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",`${pt}px`),Ce.setProperty("--radix-popper-anchor-width",`${we}px`),Ce.setProperty("--radix-popper-anchor-height",`${he}px`)}}),F&&jM({element:F,padding:a}),qM({arrowWidth:q,arrowHeight:Y}),p&&NM({strategy:"referenceHidden",...D})]}),[_,I]=nv(m),C=wr(x);Wi(()=>{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 Wi(()=>{O&&ie(window.getComputedStyle(O).zIndex)},[O]),b.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:b.jsx(FM,{scope:r,placedSide:_,onArrowChange:$,arrowX:g,arrowY:v,shouldHideArrow:N,children:b.jsx(Yt.div,{"data-side":_,"data-align":I,...y,ref:k,style:{...y.style,animation:S?void 0:"none"}})})})});ev.displayName=Cd;var tv="PopperArrow",VM={top:"bottom",right:"left",bottom:"top",left:"right"},rv=P.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,o=UM(tv,n),s=VM[o.placedSide];return b.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:b.jsx(DM,{...i,ref:r,style:{...i.style,display:"block"}})})});rv.displayName=tv;function zM(e){return e!==null}var qM=e=>({name:"transformOrigin",options:e,fn(t){var A,O,R;const{placement:r,rects:n,middlewareData:i}=t,s=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,l]=nv(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 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:`${w}px`):u==="left"&&(x=`${n.floating.width+c}px`,y=s?d:`${w}px`),{data:{x,y}}}});function nv(e){const[t,r="center"]=e.split("-");return[t,r]}var iv=X1,ov=Q1,sv=ev,av=rv,HM="Portal",cv=P.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,o]=P.useState(!1);Wi(()=>o(!0),[]);const s=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?kn.createPortal(b.jsx(Yt.div,{...n,ref:t}),s):null});cv.displayName=HM;function WM(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var On=e=>{const{present:t,children:r}=e,n=GM(t),i=typeof r=="function"?r({present:n.isPresent}):P.Children.only(r),o=rr(n.ref,KM(i));return typeof r=="function"||n.isPresent?P.cloneElement(i,{ref:o}):null};On.displayName="Presence";function GM(e){const[t,r]=P.useState(),n=P.useRef({}),i=P.useRef(e),o=P.useRef("none"),s=e?"mounted":"unmounted",[a,c]=WM(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const u=cu(n.current);o.current=a==="mounted"?u:"none"},[a]),Wi(()=>{const u=n.current,l=i.current;if(l!==e){const p=o.current,w=cu(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]),Wi(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,d=w=>{const y=cu(n.current).includes(w.animationName);if(w.target===t&&y&&(c("ANIMATION_END"),!i.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},p=w=>{w.target===t&&(o.current=cu(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 cu(e){return(e==null?void 0:e.animationName)||"none"}function KM(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]=YM({defaultProp:t,onChange:r}),o=e!==void 0,s=o?e:n,a=wr(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 YM({defaultProp:e,onChange:t}){const r=P.useState(e),[n]=r,i=P.useRef(n),o=wr(t);return P.useEffect(()=>{i.current!==n&&(o(n),i.current=n)},[n,i,o]),r}var ZM="VisuallyHidden",uv=P.forwardRef((e,t)=>b.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}}));uv.displayName=ZM;var XM=uv,[uu,YD]=us("Tooltip",[au]),Md=au(),lv="TooltipProvider",JM=700,fv="tooltip.open",[QM,dv]=uu(lv),hv=e=>{const{__scopeTooltip:t,delayDuration:r=JM,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)},[]),b.jsx(QM,{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})};hv.displayName=lv;var pv="Tooltip",[ZD,lu]=uu(pv),Td="TooltipTrigger",eT=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=lu(Td,r),o=dv(Td,r),s=Md(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]),b.jsx(ov,{asChild:!0,...s,children:b.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)})})});eT.displayName=Td;var tT="TooltipPortal",[XD,rT]=uu(tT,{forceMount:void 0}),ms="TooltipContent",nT=P.forwardRef((e,t)=>{const r=rT(ms,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...o}=e,s=lu(ms,e.__scopeTooltip);return b.jsx(On,{present:n||s.open,children:s.disableHoverableContent?b.jsx(mv,{side:i,...o,ref:t}):b.jsx(iT,{side:i,...o,ref:t})})}),iT=P.forwardRef((e,t)=>{const r=lu(ms,e.__scopeTooltip),n=dv(ms,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((x,y)=>{const A=x.currentTarget,O={x:x.clientX,y:x.clientY},R=cT(O,A.getBoundingClientRect()),k=uT(O,R),F=lT(y.getBoundingClientRect()),$=dT([...k,...F]);a($),d(!0)},[d]);return P.useEffect(()=>()=>p(),[p]),P.useEffect(()=>{if(c&&l){const x=A=>w(A,l),y=A=>w(A,c);return c.addEventListener("pointerleave",x),l.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",x),l.removeEventListener("pointerleave",y)}}},[c,l,w,p]),P.useEffect(()=>{if(s){const x=y=>{const A=y.target,O={x:y.clientX,y:y.clientY},R=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),k=!fT(O,s);R?p():k&&(p(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,l,s,u,p]),b.jsx(mv,{...e,ref:o})}),[oT,sT]=uu(pv,{isInside:!1}),mv=P.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,c=lu(ms,r),u=Md(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 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]),b.jsx(ld,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:l,children:b.jsxs(sv,{"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:[b.jsx(ls,{children:n}),b.jsx(oT,{scope:r,isInside:!0,children:b.jsx(XM,{id:c.contentId,role:"tooltip",children:i||n})})]})})});nT.displayName=ms;var gv="TooltipArrow",aT=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Md(r);return sT(gv,r).isInside?null:b.jsx(av,{...i,...n,ref:t})});aT.displayName=gv;function cT(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 uT(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 lT(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 fT(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 dT(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),hT(t)}function hT(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 pT=hv,vv=P.createContext(void 0),mT=e=>{const{dir:t,children:r}=e;return b.jsx(vv.Provider,{value:t,children:r})};function Ad(e){const t=P.useContext(vv);return e||t||"ltr"}const gT=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],vT=["sky","mint","lime","yellow","amber"],yT=["gold","bronze"],wT=[...gT,...vT,...yT],bT=["gray",...["mauve","slate","sage","olive","sand"]];function xT(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 ST=["inherit","light","dark"],ET=[...wT,"gray"],_T=[...bT,"auto"],Fr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:ST,default:"inherit"},accentColor:{type:"enum",values:ET,default:"indigo"},grayColor:{type:"enum",values:_T,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 yv(e){return e==="gray"?"gray":xT(e)}const gs=()=>{},fu=P.createContext(void 0);function CT(){const e=P.useContext(fu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const du=P.forwardRef((e,t)=>P.useContext(fu)===void 0?P.createElement(pT,null,P.createElement(mT,{dir:"ltr"},P.createElement(wv,{...e,ref:t}))):P.createElement(Id,{...e,ref:t}));du.displayName="Theme";const wv=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[x,y]=P.useState(i);P.useEffect(()=>y(i),[i]);const[A,O]=P.useState(o);P.useEffect(()=>O(o),[o]);const[R,k]=P.useState(s);P.useEffect(()=>k(s),[s]);const[F,$]=P.useState(a);P.useEffect(()=>$(a),[a]);const H=P.memo(({appearance:Y})=>P.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${Y}';c.add('${Y}');}catch(e){}})();`}}),()=>!0);H.displayName="ExplicitRootAppearanceScript",P.useEffect(()=>MT(r),[r]);const q=x==="auto"?yv(p):x;return P.createElement(P.Fragment,null,l!=="inherit"&&P.createElement(H,{appearance:l}),c&&P.createElement("style",{dangerouslySetInnerHTML:{__html:`
54
50
  :root, .light, .light-theme { --color-page-background: white; }
55
51
  .dark, .dark-theme { --color-page-background: var(--${q}-1); }
56
52
  body { background-color: var(--color-page-background); }
57
- `}}),I.createElement(Wp,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:T,radius:k,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:R,onScalingChange:L}))});D4.displayName="ThemeRoot";const Wp=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(_l),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Fr.appearance.default,accentColor:y=(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:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:Fr.panelBackground.default,radius:T=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:Fr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Fr.scaling.default,onAppearanceChange:k=Yo,onAccentColorChange:R=Yo,onGrayColorChange:F=Yo,onPanelBackgroundChange:L=Yo,onRadiusChange:G=Yo,onScalingChange:q=Yo,...X}=e,ie=u?$i:"div",ae=b==="auto"?R4(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",z=e.grayColor!==void 0,D=!l&&(f===!0||f!==!1&&(ce||z));return I.createElement(_l.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:w,radius:T,scaling:P,onAppearanceChange:k,onAccentColorChange:R,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:G,onScalingChange:q}),[h,y,b,ae,w,T,P,k,R,F,L,G,q])},I.createElement(ie,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":D?"true":"false","data-panel-background":w,"data-radius":T,"data-scaling":P,ref:t,...X,className:Kt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});Wp.displayName="ThemeImpl";function MB(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 pc={type:"enum",values:Fr.accentColor.values,default:void 0},Sl={type:"boolean",default:void 0};function wt(e,t="",r){var n,i,s,o;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("-"),f=t===""?"":"-",h=l?`-${t}`:t,y=l?u==null?void 0:u.substring(1):u;if(y===void 0)continue;const b=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,w=c==="initial"?`${h}${f}${b}`:`${c}:${h}${f}${b}`;a.push(w)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,f=c?e.substring(1):e,h=(s=r==null?void 0:r[f])!==null&&s!==void 0?s:f;a.push(`${l}${u}${h}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(o=r==null?void 0:r[u])!==null&&o!==void 0?o:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const Xs=["0","1","2","3","4","5","6","7","8","9"],TB={p:{type:"enum",values:Xs,default:void 0,responsive:!0},px:{type:"enum",values:Xs,default:void 0,responsive:!0},py:{type:"enum",values:Xs,default:void 0,responsive:!0},pt:{type:"enum",values:Xs,default:void 0,responsive:!0},pr:{type:"enum",values:Xs,default:void 0,responsive:!0},pb:{type:"enum",values:Xs,default:void 0,responsive:!0},pl:{type:"enum",values:Xs,default:void 0,responsive:!0}};function OB(e){const{p:t=xr.p.default,px:r=xr.px.default,py:n=xr.py.default,pt:i=xr.pt.default,pr:s=xr.pr.default,pb:o=xr.pb.default,pl:a=xr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function IB(e){return[wt(e.p,"rt-r-p"),wt(e.px,"rt-r-px"),wt(e.py,"rt-r-py"),wt(e.pt,"rt-r-pt"),wt(e.pr,"rt-r-pr"),wt(e.pb,"rt-r-pb"),wt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const PB=["static","relative","absolute","fixed","sticky"],mc=["auto","0","50%","100%"],$4=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],xr={...TB,position:{type:"enum",values:PB,default:void 0,responsive:!0},inset:{type:"enum",values:mc,default:void 0,responsive:!0},top:{type:"enum",values:mc,default:void 0,responsive:!0},right:{type:"enum",values:mc,default:void 0,responsive:!0},bottom:{type:"enum",values:mc,default:void 0,responsive:!0},left:{type:"enum",values:mc,default:void 0,responsive:!0},width:{type:"enum",values:$4,default:void 0,responsive:!0},height:{type:"enum",values:$4,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 jB(e){const{rest:t,...r}=OB(e),{position:n=xr.position.default,width:i=xr.width.default,height:s=xr.height.default,inset:o=xr.inset.default,top:a=xr.top.default,bottom:c=xr.bottom.default,left:u=xr.left.default,right:l=xr.right.default,shrink:f=xr.shrink.default,grow:h=xr.grow.default,...y}=t;return{...r,position:n,width:i,height:s,inset:o,top:a,bottom:c,left:u,right:l,shrink:f,grow:h,rest:y}}function kB(e){return[IB(e),wt(e.position,"rt-r-position"),wt(e.shrink,"rt-r-fs"),wt(e.grow,"rt-r-fg"),wt(e.width,"rt-r-w"),wt(e.height,"rt-r-h"),wt(e.inset,"rt-r-inset"),wt(e.top,"rt-r-top"),wt(e.bottom,"rt-r-bottom"),wt(e.left,"rt-r-left"),wt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Js=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Ys={m:{type:"enum",values:Js,default:void 0,responsive:!0},mx:{type:"enum",values:Js,default:void 0,responsive:!0},my:{type:"enum",values:Js,default:void 0,responsive:!0},mt:{type:"enum",values:Js,default:void 0,responsive:!0},mr:{type:"enum",values:Js,default:void 0,responsive:!0},mb:{type:"enum",values:Js,default:void 0,responsive:!0},ml:{type:"enum",values:Js,default:void 0,responsive:!0}};function Zo(e){const{m:t=Ys.m.default,mx:r=Ys.mx.default,my:n=Ys.my.default,mt:i=Ys.mt.default,mr:s=Ys.mr.default,mb:o=Ys.mb.default,ml:a=Ys.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Qo(e){return[wt(e.m,"rt-r-m"),wt(e.mx,"rt-r-mx"),wt(e.my,"rt-r-my"),wt(e.mt,"rt-r-mt"),wt(e.mr,"rt-r-mr"),wt(e.mb,"rt-r-mb"),wt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Gp={type:"enum",values:Fr.radius.values,default:void 0},ea={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}},B4=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{rest:i,...s}=jB(r),{className:o,asChild:a,display:c=ea.display.default,direction:u=ea.direction.default,align:l=ea.align.default,justify:f=ea.justify.default,wrap:h=ea.wrap.default,gap:y=ea.gap.default,...b}=i,w=a?$i:"div";return I.createElement(w,{...b,ref:t,className:Kt("rt-Flex",o,wt(c,"rt-r-display"),wt(u,"rt-r-fd"),wt(l,"rt-r-ai"),wt(f,"rt-r-jc",{between:"space-between"}),wt(h,"rt-r-fw"),wt(y,"rt-r-gap"),kB(s),Qo(n))})});B4.displayName="Flex";function L4(e){const t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hp="Checkbox",[NB,dJ]=qo(Hp),[RB,DB]=NB(Hp),F4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,F=>y(F)),w=I.useRef(!1),T=h?l||!!h.closest("form"):!0,[P=!1,k]=hc({prop:i,defaultProp:s,onChange:u}),R=I.useRef(P);return I.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>k(R.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,k]),_.jsxs(RB,{scope:r,state:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":vs(P)?"mixed":P,"aria-required":o,"data-state":z4(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:tt(e.onClick,F=>{k(L=>vs(L)?!0:!L),T&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),T&&_.jsx($B,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:vs(s)?!1:s})]})});F4.displayName=Hp;var U4="CheckboxIndicator",V4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=DB(U4,r);return _.jsx(Nn,{present:n||vs(s.state)||s.state===!0,children:_.jsx(Gt.span,{"data-state":z4(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});V4.displayName=U4;var $B=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=L4(r),c=Lp(t);I.useEffect(()=>{const l=o.current,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==r&&y){const b=new Event("click",{bubbles:n});l.indeterminate=vs(r),y.call(l,vs(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(vs(r)?!1:r);return _.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function vs(e){return e==="indeterminate"}function z4(e){return vs(e)?"indeterminate":e?"checked":"unchecked"}var BB=F4,LB=V4;const El={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:pc,highContrast:Sl},Cl=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.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"})));Cl.displayName="ThickCheckIcon";const FB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.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"})));FB.displayName="ChevronDownIcon";const q4=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.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"})));q4.displayName="ThickChevronRightIcon";const UB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.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"})));UB.displayName="InfoCircledIcon";const Al=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{className:i,style:s,size:o=El.size.default,variant:a=El.variant.default,color:c=El.color.default,highContrast:u=El.highContrast.default,...l}=r;return I.createElement("span",{className:Kt("rt-CheckboxRoot",i,wt(o,"rt-r-size"),Qo(n)),style:s},I.createElement(BB,{"data-accent-color":c,...l,ref:t,className:Kt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(LB,{className:"rt-CheckboxIndicator"},I.createElement(Cl,{className:"rt-CheckboxIndicatorIcon"}))))});Al.displayName="Checkbox";function VB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,zB(i,...t)]}function zB(...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(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function W4(e){const t=e+"CollectionProvider",[r,n]=VB(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,T=te.useRef(null),P=te.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:T,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((y,b)=>{const{scope:w,children:T}=y,P=s(a,w),k=Qt(b,P.collectionRef);return _.jsx($i,{ref:k,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=te.forwardRef((y,b)=>{const{scope:w,children:T,...P}=y,k=te.useRef(null),R=Qt(b,k),F=s(u,w);return te.useEffect(()=>(F.itemMap.set(k,{ref:k,...P}),()=>void F.itemMap.delete(k))),_.jsx($i,{[l]:"",ref:R,children:T})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return te.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const P=Array.from(T.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((F,L)=>P.indexOf(F.ref.current)-P.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function qB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,WB(i,...t)]}function WB(...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(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Kp="rovingFocusGroup.onEntryFocus",GB={bubbles:!1,cancelable:!0},Ml="RovingFocusGroup",[Xp,G4,HB]=W4(Ml),[KB,H4]=qB(Ml,[HB]),[XB,JB]=KB(Ml),K4=I.forwardRef((e,t)=>_.jsx(Xp.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(Xp.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(YB,{...e,ref:t})})}));K4.displayName=Ml;var YB=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...f}=e,h=I.useRef(null),y=Qt(t,h),b=qp(s),[w=null,T]=hc({prop:o,defaultProp:a,onChange:c}),[P,k]=I.useState(!1),R=vr(u),F=G4(r),L=I.useRef(!1),[G,q]=I.useState(0);return I.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Kp,R),()=>X.removeEventListener(Kp,R)},[R]),_.jsx(XB,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(X=>T(X),[T]),onItemShiftTab:I.useCallback(()=>k(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:I.useCallback(()=>q(X=>X-1),[]),children:_.jsx(Gt.div,{tabIndex:P||G===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:tt(e.onMouseDown,()=>{L.current=!0}),onFocus:tt(e.onFocus,X=>{const ie=!L.current;if(X.target===X.currentTarget&&ie&&!P){const ae=new CustomEvent(Kp,GB);if(X.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=F().filter(m=>m.focusable),z=ce.find(m=>m.active),D=ce.find(m=>m.id===w),d=[z,D,...ce].filter(Boolean).map(m=>m.ref.current);Y4(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>k(!1))})})}),X4="RovingFocusGroupItem",J4=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=uc(),c=s||a,u=JB(X4,r),l=u.currentTabStopId===c,f=G4(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(Xp.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:_.jsx(Gt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:tt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:tt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:tt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=eL(b,u.orientation,u.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let P=f().filter(k=>k.focusable).map(k=>k.ref.current);if(w==="last")P.reverse();else if(w==="prev"||w==="next"){w==="prev"&&P.reverse();const k=P.indexOf(b.currentTarget);P=u.loop?tL(P,k+1):P.slice(k+1)}setTimeout(()=>Y4(P))}})})})});J4.displayName=X4;var ZB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function QB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eL(e,t,r){const n=QB(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return ZB[n]}function Y4(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function tL(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var rL=K4,nL=J4;function iL(e,[t,r]){return Math.min(r,Math.max(t,e))}var Jp=0;function sL(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Z4()),document.body.insertAdjacentElement("beforeend",e[1]??Z4()),Jp++,()=>{Jp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Jp--}},[])}function Z4(){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 Yp="focusScope.autoFocusOnMount",Zp="focusScope.autoFocusOnUnmount",Q4={bubbles:!1,cancelable:!0},oL="FocusScope",e6=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=vr(i),l=vr(s),f=I.useRef(null),h=Qt(t,w=>c(w)),y=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(n){let w=function(R){if(y.paused||!a)return;const F=R.target;a.contains(F)?f.current=F:ys(f.current,{select:!0})},T=function(R){if(y.paused||!a)return;const F=R.relatedTarget;F!==null&&(a.contains(F)||ys(f.current,{select:!0}))},P=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&ys(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",T);const k=new MutationObserver(P);return a&&k.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",T),k.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){n6.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(Yp,Q4);a.addEventListener(Yp,u),a.dispatchEvent(P),P.defaultPrevented||(aL(dL(t6(a)),{select:!0}),document.activeElement===w&&ys(a))}return()=>{a.removeEventListener(Yp,u),setTimeout(()=>{const P=new CustomEvent(Zp,Q4);a.addEventListener(Zp,l),a.dispatchEvent(P),P.defaultPrevented||ys(w??document.body,{select:!0}),a.removeEventListener(Zp,l),n6.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const T=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(T&&P){const k=w.currentTarget,[R,F]=cL(k);R&&F?!w.shiftKey&&P===F?(w.preventDefault(),r&&ys(R,{select:!0})):w.shiftKey&&P===R&&(w.preventDefault(),r&&ys(F,{select:!0})):P===k&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});e6.displayName=oL;function aL(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ys(n,{select:t}),document.activeElement!==r)return}function cL(e){const t=t6(e),r=r6(t,e),n=r6(t.reverse(),e);return[r,n]}function t6(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 r6(e,t){for(const r of e)if(!uL(r,{upTo:t}))return r}function uL(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 lL(e){return e instanceof HTMLInputElement&&"select"in e}function ys(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&lL(e)&&t&&e.select()}}var n6=fL();function fL(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=i6(e,t),e.unshift(t)},remove(t){var r;e=i6(e,t),(r=e[0])==null||r.resume()}}}function i6(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function dL(e){return e.filter(t=>t.tagName!=="A")}var hL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ta=new WeakMap,Tl=new WeakMap,Ol={},Qp=0,s6=function(e){return e&&(e.host||s6(e.parentNode))},pL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=s6(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})},mL=function(e,t,r,n){var i=pL(t,Array.isArray(e)?e:[e]);Ol[r]||(Ol[r]=new WeakMap);var s=Ol[r],o=[],a=new Set,c=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var l=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))l(h);else try{var y=h.getAttribute(n),b=y!==null&&y!=="false",w=(ta.get(h)||0)+1,T=(s.get(h)||0)+1;ta.set(h,w),s.set(h,T),o.push(h),w===1&&b&&Tl.set(h,!0),T===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(P){console.error("aria-hidden: cannot operate on ",h,P)}})};return l(t),a.clear(),Qp++,function(){o.forEach(function(f){var h=ta.get(f)-1,y=s.get(f)-1;ta.set(f,h),s.set(f,y),h||(Tl.has(f)||f.removeAttribute(n),Tl.delete(f)),y||f.removeAttribute(r)}),Qp--,Qp||(ta=new WeakMap,ta=new WeakMap,Tl=new WeakMap,Ol={})}},gL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||hL(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),mL(n,i,r,"aria-hidden")):function(){return null}},ci=function(){return ci=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},ci.apply(this,arguments)};function o6(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 vL(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Il="right-scroll-bar-position",Pl="width-before-scroll-bar",yL="with-scroll-bars-hidden",bL="--removed-body-scroll-bar-size";function e0(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wL(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 _L=typeof window<"u"?I.useLayoutEffect:I.useEffect,a6=new WeakMap;function xL(e,t){var r=wL(t||null,function(n){return e.forEach(function(i){return e0(i,n)})});return _L(function(){var n=a6.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||e0(a,null)}),s.forEach(function(a){i.has(a)||e0(a,o)})}a6.set(r,e)},[e]),r}function SL(e){return e}function EL(e,t){t===void 0&&(t=SL);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(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var c=function(){var l=o;o=[],l.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(l){o.push(l),u()},filter:function(l){return o=o.filter(l),r}}}};return i}function CL(e){e===void 0&&(e={});var t=EL(null);return t.options=ci({async:!0,ssr:!1},e),t}var c6=function(e){var t=e.sideCar,r=o6(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 I.createElement(n,ci({},r))};c6.isSideCarExport=!0;function AL(e,t){return e.useMedium(t),c6}var u6=CL(),t0=function(){},jl=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:t0,onWheelCapture:t0,onTouchMoveCapture:t0}),i=n[0],s=n[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,f=e.shards,h=e.sideCar,y=e.noIsolation,b=e.inert,w=e.allowPinchZoom,T=e.as,P=T===void 0?"div":T,k=e.gapMode,R=o6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=xL([r,t]),G=ci(ci({},R),i);return I.createElement(I.Fragment,null,l&&I.createElement(F,{sideCar:u6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:k}),o?I.cloneElement(I.Children.only(a),ci(ci({},G),{ref:L})):I.createElement(P,ci({},G,{className:c,ref:L}),a))});jl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},jl.classNames={fullWidth:Pl,zeroRight:Il};var l6,ML=function(){if(l6)return l6;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function TL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ML();return t&&e.setAttribute("nonce",t),e}function OL(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function IL(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var PL=function(){var e=0,t=null;return{add:function(r){e==0&&(t=TL())&&(OL(t,r),IL(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jL=function(){var e=PL();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},f6=function(){var e=jL(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},kL={left:0,top:0,right:0,gap:0},r0=function(e){return parseInt(e||"",10)||0},NL=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[r0(r),r0(n),r0(i)]},RL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return kL;var t=NL(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])}},DL=f6(),ra="data-scroll-locked",$L=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return r===void 0&&(r="margin"),`
58
- .`.concat(yL,` {
53
+ `}}),P.createElement(Id,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:p,grayColor:x,panelBackground:A,radius:R,scaling:F,onAppearanceChange:d,onAccentColorChange:w,onGrayColorChange:y,onPanelBackgroundChange:O,onRadiusChange:k,onScalingChange:$}))});wv.displayName="ThemeRoot";const Id=P.forwardRef((e,t)=>{var r,n,i,o,s,a;const c=P.useContext(fu),{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:x=(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:A=(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=gs,onAccentColorChange:k=gs,onGrayColorChange:F=gs,onPanelBackgroundChange:$=gs,onRadiusChange:H=gs,onScalingChange:q=gs,...Y}=e,ne=u?Si:"div",se=x==="auto"?yv(w):x,ae=e.appearance!==void 0&&e.appearance!=="inherit",z=e.grayColor!==void 0,D=!l&&(d===!0||d!==!1&&(ae||z));return P.createElement(fu.Provider,{value:P.useMemo(()=>({appearance:p,accentColor:w,grayColor:x,resolvedGrayColor:se,panelBackground:y,radius:A,scaling:O,onAppearanceChange:R,onAccentColorChange:k,onGrayColorChange:F,onPanelBackgroundChange:$,onRadiusChange:H,onScalingChange:q}),[p,w,x,se,y,A,O,R,k,F,$,H,q])},P.createElement(ne,{"data-is-root-theme":l?"true":"false","data-accent-color":w,"data-gray-color":se,"data-has-background":D?"true":"false","data-panel-background":y,"data-radius":A,"data-scaling":O,ref:t,...Y,className:Xt("radix-themes",{light:!l&&p==="light",dark:!l&&p==="dark"},Y.className)}))});Id.displayName="ThemeImpl";function MT(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},hu={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 x=(i=r==null?void 0:r[w])!==null&&i!==void 0?i:w,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 Co=["0","1","2","3","4","5","6","7","8","9"],TT={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 AT(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 IT(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 OT=["static","relative","absolute","fixed","sticky"],Sa=["auto","0","50%","100%"],bv=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],Cr={...TT,position:{type:"enum",values:OT,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:bv,default:void 0,responsive:!0},height:{type:"enum",values:bv,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 PT(e){const{rest:t,...r}=AT(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 RT(e){return[IT(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"],To={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 vs(e){const{m:t=To.m.default,mx:r=To.mx.default,my:n=To.my.default,mt:i=To.mt.default,mr:o=To.mr.default,mb:s=To.mb.default,ml:a=To.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:o,mb:s,ml:a,rest:c}}function ys(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 Od={type:"enum",values:Fr.radius.values,default:void 0},ws={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}},xv=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(e),{rest:i,...o}=PT(r),{className:s,asChild:a,display:c=ws.display.default,direction:u=ws.direction.default,align:l=ws.align.default,justify:d=ws.justify.default,wrap:p=ws.wrap.default,gap:w=ws.gap.default,...x}=i,y=a?Si:"div";return P.createElement(y,{...x,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"),RT(o),ys(n))})});xv.displayName="Flex";function Sv(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 Pd="Checkbox",[NT,fB]=us(Pd),[jT,kT]=NT(Pd),Ev=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),x=rr(t,F=>w(F)),y=P.useRef(!1),A=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 $=()=>R(k.current);return F.addEventListener("reset",$),()=>F.removeEventListener("reset",$)}},[p,R]),b.jsxs(jT,{scope:r,state:O,disabled:a,children:[b.jsx(Yt.button,{type:"button",role:"checkbox","aria-checked":Zi(O)?"mixed":O,"aria-required":s,"data-state":Mv(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=>{R($=>Zi($)?!0:!$),A&&(y.current=F.isPropagationStopped(),y.current||F.stopPropagation())})}),A&&b.jsx(DT,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:Zi(o)?!1:o})]})});Ev.displayName=Pd;var _v="CheckboxIndicator",Cv=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,o=kT(_v,r);return b.jsx(On,{present:n||Zi(o.state)||o.state===!0,children:b.jsx(Yt.span,{"data-state":Mv(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Cv.displayName=_v;var DT=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...o}=e,s=P.useRef(null),a=Sv(r),c=Ed(t);P.useEffect(()=>{const l=s.current,d=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==r&&w){const x=new Event("click",{bubbles:n});l.indeterminate=Zi(r),w.call(l,Zi(r)?!1:r),l.dispatchEvent(x)}},[a,r,n]);const u=P.useRef(Zi(r)?!1:r);return b.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 Zi(e){return e==="indeterminate"}function Mv(e){return Zi(e)?"indeterminate":e?"checked":"unchecked"}var BT=Ev,LT=Cv;const pu={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:xa,highContrast:hu},mu=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"})));mu.displayName="ThickCheckIcon";const $T=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"})));$T.displayName="ChevronDownIcon";const Tv=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"})));Tv.displayName="ThickChevronRightIcon";const FT=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"})));FT.displayName="InfoCircledIcon";const gu=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(e),{className:i,style:o,size:s=pu.size.default,variant:a=pu.variant.default,color:c=pu.color.default,highContrast:u=pu.highContrast.default,...l}=r;return P.createElement("span",{className:Xt("rt-CheckboxRoot",i,bt(s,"rt-r-size"),ys(n)),style:o},P.createElement(BT,{"data-accent-color":c,...l,ref:t,className:Xt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},P.createElement(LT,{className:"rt-CheckboxIndicator"},P.createElement(mu,{className:"rt-CheckboxIndicatorIcon"}))))});gu.displayName="Checkbox";function UT(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,...x}=d,y=(p==null?void 0:p[e][c])||a,A=P.useMemo(()=>x,Object.values(x));return b.jsx(y.Provider,{value:A,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,x=P.useContext(w);if(x)return x;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,VT(i,...t)]}function VT(...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 Av(e){const t=e+"CollectionProvider",[r,n]=UT(t),[i,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:x,children:y}=w,A=te.useRef(null),O=te.useRef(new Map).current;return b.jsx(i,{scope:x,itemMap:O,collectionRef:A,children:y})};s.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((w,x)=>{const{scope:y,children:A}=w,O=o(a,y),R=rr(x,O.collectionRef);return b.jsx(Si,{ref:R,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",d=te.forwardRef((w,x)=>{const{scope:y,children:A,...O}=w,R=te.useRef(null),k=rr(x,R),F=o(u,y);return te.useEffect(()=>(F.itemMap.set(R,{ref:R,...O}),()=>void F.itemMap.delete(R))),b.jsx(Si,{[l]:"",ref:k,children:A})});d.displayName=u;function p(w){const x=o(e+"CollectionConsumer",w);return te.useCallback(()=>{const A=x.collectionRef.current;if(!A)return[];const O=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(x.itemMap.values()).sort((F,$)=>O.indexOf(F.ref.current)-O.indexOf($.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:s,Slot:c,ItemSlot:d},p,n]}function zT(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,...x}=d,y=(p==null?void 0:p[e][c])||a,A=P.useMemo(()=>x,Object.values(x));return b.jsx(y.Provider,{value:A,children:w})}function l(d,p){const w=(p==null?void 0:p[e][c])||a,x=P.useContext(w);if(x)return x;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,qT(i,...t)]}function qT(...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 Rd="rovingFocusGroup.onEntryFocus",HT={bubbles:!1,cancelable:!0},vu="RovingFocusGroup",[Nd,Iv,WT]=Av(vu),[GT,Ov]=zT(vu,[WT]),[KT,YT]=GT(vu),Pv=P.forwardRef((e,t)=>b.jsx(Nd.Provider,{scope:e.__scopeRovingFocusGroup,children:b.jsx(Nd.Slot,{scope:e.__scopeRovingFocusGroup,children:b.jsx(ZT,{...e,ref:t})})}));Pv.displayName=vu;var ZT=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),x=Ad(o),[y=null,A]=ba({prop:s,defaultProp:a,onChange:c}),[O,R]=P.useState(!1),k=wr(u),F=Iv(r),$=P.useRef(!1),[H,q]=P.useState(0);return P.useEffect(()=>{const Y=p.current;if(Y)return Y.addEventListener(Rd,k),()=>Y.removeEventListener(Rd,k)},[k]),b.jsx(KT,{scope:r,orientation:n,dir:x,loop:i,currentTabStopId:y,onItemFocus:P.useCallback(Y=>A(Y),[A]),onItemShiftTab:P.useCallback(()=>R(!0),[]),onFocusableItemAdd:P.useCallback(()=>q(Y=>Y+1),[]),onFocusableItemRemove:P.useCallback(()=>q(Y=>Y-1),[]),children:b.jsx(Yt.div,{tabIndex:O||H===0?-1:0,"data-orientation":n,...d,ref:w,style:{outline:"none",...e.style},onMouseDown:Xe(e.onMouseDown,()=>{$.current=!0}),onFocus:Xe(e.onFocus,Y=>{const ne=!$.current;if(Y.target===Y.currentTarget&&ne&&!O){const se=new CustomEvent(Rd,HT);if(Y.currentTarget.dispatchEvent(se),!se.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);jv(f,l)}}$.current=!1}),onBlur:Xe(e.onBlur,()=>R(!1))})})}),Rv="RovingFocusGroupItem",Nv=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...s}=e,a=ga(),c=o||a,u=YT(Rv,r),l=u.currentTabStopId===c,d=Iv(r),{onFocusableItemAdd:p,onFocusableItemRemove:w}=u;return P.useEffect(()=>{if(n)return p(),()=>w()},[n,p,w]),b.jsx(Nd.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:b.jsx(Yt.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=QT(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(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(x.currentTarget);O=u.loop?eA(O,R+1):O.slice(R+1)}setTimeout(()=>jv(O))}})})})});Nv.displayName=Rv;var XT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JT(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function QT(e,t,r){const n=JT(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return XT[n]}function jv(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function eA(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var tA=Pv,rA=Nv;function nA(e,[t,r]){return Math.min(r,Math.max(t,e))}var jd=0;function iA(){P.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kv()),document.body.insertAdjacentElement("beforeend",e[1]??kv()),jd++,()=>{jd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jd--}},[])}function kv(){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 kd="focusScope.autoFocusOnMount",Dd="focusScope.autoFocusOnUnmount",Dv={bubbles:!1,cancelable:!0},oA="FocusScope",Bv=P.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,c]=P.useState(null),u=wr(i),l=wr(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:Xi(d.current,{select:!0})},A=function(k){if(w.paused||!a)return;const F=k.relatedTarget;F!==null&&(a.contains(F)||Xi(d.current,{select:!0}))},O=function(k){if(document.activeElement===document.body)for(const $ of k)$.removedNodes.length>0&&Xi(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",A);const R=new MutationObserver(O);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",A),R.disconnect()}}},[n,a,w.paused]),P.useEffect(()=>{if(a){Fv.add(w);const y=document.activeElement;if(!a.contains(y)){const O=new CustomEvent(kd,Dv);a.addEventListener(kd,u),a.dispatchEvent(O),O.defaultPrevented||(sA(fA(Lv(a)),{select:!0}),document.activeElement===y&&Xi(a))}return()=>{a.removeEventListener(kd,u),setTimeout(()=>{const O=new CustomEvent(Dd,Dv);a.addEventListener(Dd,l),a.dispatchEvent(O),O.defaultPrevented||Xi(y??document.body,{select:!0}),a.removeEventListener(Dd,l),Fv.remove(w)},0)}}},[a,u,l,w]);const x=P.useCallback(y=>{if(!r&&!n||w.paused)return;const A=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,O=document.activeElement;if(A&&O){const R=y.currentTarget,[k,F]=aA(R);k&&F?!y.shiftKey&&O===F?(y.preventDefault(),r&&Xi(k,{select:!0})):y.shiftKey&&O===k&&(y.preventDefault(),r&&Xi(F,{select:!0})):O===R&&y.preventDefault()}},[r,n,w.paused]);return b.jsx(Yt.div,{tabIndex:-1,...s,ref:p,onKeyDown:x})});Bv.displayName=oA;function sA(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Xi(n,{select:t}),document.activeElement!==r)return}function aA(e){const t=Lv(e),r=$v(t,e),n=$v(t.reverse(),e);return[r,n]}function Lv(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 $v(e,t){for(const r of e)if(!cA(r,{upTo:t}))return r}function cA(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 uA(e){return e instanceof HTMLInputElement&&"select"in e}function Xi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&uA(e)&&t&&e.select()}}var Fv=lA();function lA(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Uv(e,t),e.unshift(t)},remove(t){var r;e=Uv(e,t),(r=e[0])==null||r.resume()}}}function Uv(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function fA(e){return e.filter(t=>t.tagName!=="A")}var dA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},bs=new WeakMap,yu=new WeakMap,wu={},Bd=0,Vv=function(e){return e&&(e.host||Vv(e.parentNode))},hA=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Vv(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})},pA=function(e,t,r,n){var i=hA(t,Array.isArray(e)?e:[e]);wu[r]||(wu[r]=new WeakMap);var o=wu[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),x=w!==null&&w!=="false",y=(bs.get(p)||0)+1,A=(o.get(p)||0)+1;bs.set(p,y),o.set(p,A),s.push(p),y===1&&x&&yu.set(p,!0),A===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(),Bd++,function(){s.forEach(function(d){var p=bs.get(d)-1,w=o.get(d)-1;bs.set(d,p),o.set(d,w),p||(yu.has(d)||d.removeAttribute(n),yu.delete(d)),w||d.removeAttribute(r)}),Bd--,Bd||(bs=new WeakMap,bs=new WeakMap,yu=new WeakMap,wu={})}},mA=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||dA(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),pA(n,i,r,"aria-hidden")):function(){return null}},Xn=function(){return Xn=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},Xn.apply(this,arguments)};function zv(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 gA(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 bu="right-scroll-bar-position",xu="width-before-scroll-bar",vA="with-scroll-bars-hidden",yA="--removed-body-scroll-bar-size";function Ld(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wA(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 bA=typeof window<"u"?P.useLayoutEffect:P.useEffect,qv=new WeakMap;function xA(e,t){var r=wA(t||null,function(n){return e.forEach(function(i){return Ld(i,n)})});return bA(function(){var n=qv.get(r);if(n){var i=new Set(n),o=new Set(e),s=r.current;i.forEach(function(a){o.has(a)||Ld(a,null)}),o.forEach(function(a){i.has(a)||Ld(a,s)})}qv.set(r,e)},[e]),r}function SA(e){return e}function EA(e,t){t===void 0&&(t=SA);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 _A(e){e===void 0&&(e={});var t=EA(null);return t.options=Xn({async:!0,ssr:!1},e),t}var Hv=function(e){var t=e.sideCar,r=zv(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,Xn({},r))};Hv.isSideCarExport=!0;function CA(e,t){return e.useMedium(t),Hv}var Wv=_A(),$d=function(){},Su=P.forwardRef(function(e,t){var r=P.useRef(null),n=P.useState({onScrollCapture:$d,onWheelCapture:$d,onTouchMoveCapture:$d}),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,x=e.inert,y=e.allowPinchZoom,A=e.as,O=A===void 0?"div":A,R=e.gapMode,k=zv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=p,$=xA([r,t]),H=Xn(Xn({},k),i);return P.createElement(P.Fragment,null,l&&P.createElement(F,{sideCar:Wv,removeScrollBar:u,shards:d,noIsolation:w,inert:x,setCallbacks:o,allowPinchZoom:!!y,lockRef:r,gapMode:R}),s?P.cloneElement(P.Children.only(a),Xn(Xn({},H),{ref:$})):P.createElement(O,Xn({},H,{className:c,ref:$}),a))});Su.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Su.classNames={fullWidth:xu,zeroRight:bu};var Gv,MA=function(){if(Gv)return Gv;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function TA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=MA();return t&&e.setAttribute("nonce",t),e}function AA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function IA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var OA=function(){var e=0,t=null;return{add:function(r){e==0&&(t=TA())&&(AA(t,r),IA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},PA=function(){var e=OA();return function(t,r){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Kv=function(){var e=PA(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},RA={left:0,top:0,right:0,gap:0},Fd=function(e){return parseInt(e||"",10)||0},NA=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[Fd(r),Fd(n),Fd(i)]},jA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return RA;var t=NA(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])}},kA=Kv(),xs="data-scroll-locked",DA=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(vA,` {
59
55
  overflow: hidden `).concat(n,`;
60
56
  padding-right: `).concat(a,"px ").concat(n,`;
61
57
  }
62
- body[`).concat(ra,`] {
58
+ body[`).concat(xs,`] {
63
59
  overflow: hidden `).concat(n,`;
64
60
  overscroll-behavior: contain;
65
61
  `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
66
62
  padding-left: `.concat(i,`px;
67
- padding-top: `).concat(s,`px;
68
- padding-right: `).concat(o,`px;
63
+ padding-top: `).concat(o,`px;
64
+ padding-right: `).concat(s,`px;
69
65
  margin-left:0;
70
66
  margin-top:0;
71
67
  margin-right: `).concat(a,"px ").concat(n,`;
72
68
  `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
73
69
  }
74
70
 
75
- .`).concat(Il,` {
71
+ .`).concat(bu,` {
76
72
  right: `).concat(a,"px ").concat(n,`;
77
73
  }
78
74
 
79
- .`).concat(Pl,` {
75
+ .`).concat(xu,` {
80
76
  margin-right: `).concat(a,"px ").concat(n,`;
81
77
  }
82
78
 
83
- .`).concat(Il," .").concat(Il,` {
79
+ .`).concat(bu," .").concat(bu,` {
84
80
  right: 0 `).concat(n,`;
85
81
  }
86
82
 
87
- .`).concat(Pl," .").concat(Pl,` {
83
+ .`).concat(xu," .").concat(xu,` {
88
84
  margin-right: 0 `).concat(n,`;
89
85
  }
90
86
 
91
- body[`).concat(ra,`] {
92
- `).concat(bL,": ").concat(a,`px;
87
+ body[`).concat(xs,`] {
88
+ `).concat(yA,": ").concat(a,`px;
93
89
  }
94
- `)},d6=function(){var e=parseInt(document.body.getAttribute(ra)||"0",10);return isFinite(e)?e:0},BL=function(){I.useEffect(function(){return document.body.setAttribute(ra,(d6()+1).toString()),function(){var e=d6()-1;e<=0?document.body.removeAttribute(ra):document.body.setAttribute(ra,e.toString())}},[])},LL=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;BL();var s=I.useMemo(function(){return RL(i)},[i]);return I.createElement(DL,{styles:$L(s,!t,i,r?"":"!important")})},n0=!1;if(typeof window<"u")try{var kl=Object.defineProperty({},"passive",{get:function(){return n0=!0,!0}});window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch{n0=!1}var na=n0?{passive:!1}:!1,FL=function(e){return e.tagName==="TEXTAREA"},h6=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!FL(e)&&r[t]==="visible")},UL=function(e){return h6(e,"overflowY")},VL=function(e){return h6(e,"overflowX")},p6=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=m6(e,n);if(i){var s=g6(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},zL=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},qL=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},m6=function(e,t){return e==="v"?UL(t):VL(t)},g6=function(e,t){return e==="v"?zL(t):qL(t)},WL=function(e,t){return e==="h"&&t==="rtl"?-1:1},GL=function(e,t,r,n,i){var s=WL(e,window.getComputedStyle(t).direction),o=s*n,a=r.target,c=t.contains(a),u=!1,l=o>0,f=0,h=0;do{var y=g6(e,a),b=y[0],w=y[1],T=y[2],P=w-T-s*b;(b||P)&&m6(e,a)&&(f+=P,h+=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(f)<1||!i&&o>f)||!l&&(i&&Math.abs(h)<1||!i&&-o>h))&&(u=!0),u},Nl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},v6=function(e){return[e.deltaX,e.deltaY]},y6=function(e){return e&&"current"in e?e.current:e},HL=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KL=function(e){return`
90
+ `)},Yv=function(){var e=parseInt(document.body.getAttribute(xs)||"0",10);return isFinite(e)?e:0},BA=function(){P.useEffect(function(){return document.body.setAttribute(xs,(Yv()+1).toString()),function(){var e=Yv()-1;e<=0?document.body.removeAttribute(xs):document.body.setAttribute(xs,e.toString())}},[])},LA=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;BA();var o=P.useMemo(function(){return jA(i)},[i]);return P.createElement(kA,{styles:DA(o,!t,i,r?"":"!important")})},Ud=!1;if(typeof window<"u")try{var Eu=Object.defineProperty({},"passive",{get:function(){return Ud=!0,!0}});window.addEventListener("test",Eu,Eu),window.removeEventListener("test",Eu,Eu)}catch{Ud=!1}var Ss=Ud?{passive:!1}:!1,$A=function(e){return e.tagName==="TEXTAREA"},Zv=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!$A(e)&&r[t]==="visible")},FA=function(e){return Zv(e,"overflowY")},UA=function(e){return Zv(e,"overflowX")},Xv=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Jv(e,n);if(i){var o=Qv(e,n),s=o[1],a=o[2];if(s>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},VA=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},zA=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Jv=function(e,t){return e==="v"?FA(t):UA(t)},Qv=function(e,t){return e==="v"?VA(t):zA(t)},qA=function(e,t){return e==="h"&&t==="rtl"?-1:1},HA=function(e,t,r,n,i){var o=qA(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=Qv(e,a),x=w[0],y=w[1],A=w[2],O=y-A-o*x;(x||O)&&Jv(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},_u=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ey=function(e){return[e.deltaX,e.deltaY]},ty=function(e){return e&&"current"in e?e.current:e},WA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},GA=function(e){return`
95
91
  .block-interactivity-`.concat(e,` {pointer-events: none;}
96
92
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
97
- `)},XL=0,ia=[];function JL(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(XL++)[0],s=I.useState(f6)[0],o=I.useRef(e);I.useEffect(function(){o.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=vL([e.lockRef.current],(e.shards||[]).map(y6),!0).filter(Boolean);return w.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,T){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=Nl(w),k=r.current,R="deltaX"in w?w.deltaX:k[0]-P[0],F="deltaY"in w?w.deltaY:k[1]-P[1],L,G=w.target,q=Math.abs(R)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&G.type==="range")return!1;var X=p6(q,G);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=p6(q,G)),!X)return!1;if(!n.current&&"changedTouches"in w&&(R||F)&&(n.current=L),!L)return!0;var ie=n.current||L;return GL(ie,T,w,ie==="h"?R:F,!0)},[]),c=I.useCallback(function(w){var T=w;if(!(!ia.length||ia[ia.length-1]!==s)){var P="deltaY"in T?v6(T):Nl(T),k=t.current.filter(function(L){return L.name===T.type&&(L.target===T.target||T.target===L.shadowParent)&&HL(L.delta,P)})[0];if(k&&k.should){T.cancelable&&T.preventDefault();return}if(!k){var R=(o.current.shards||[]).map(y6).filter(Boolean).filter(function(L){return L.contains(T.target)}),F=R.length>0?a(T,R[0]):!o.current.noIsolation;F&&T.cancelable&&T.preventDefault()}}},[]),u=I.useCallback(function(w,T,P,k){var R={name:w,delta:T,target:P,should:k,shadowParent:YL(P)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(F){return F!==R})},1)},[]),l=I.useCallback(function(w){r.current=Nl(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,v6(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,Nl(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return ia.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,na),document.addEventListener("touchmove",c,na),document.addEventListener("touchstart",l,na),function(){ia=ia.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,na),document.removeEventListener("touchmove",c,na),document.removeEventListener("touchstart",l,na)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:KL(i)}):null,y?I.createElement(LL,{gapMode:e.gapMode}):null)}function YL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZL=AL(u6,JL);var b6=I.forwardRef(function(e,t){return I.createElement(jl,ci({},e,{ref:t,sideCar:ZL}))});b6.classNames=jl.classNames;const QL=b6;function eF(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var i0="ScrollArea",[w6,mJ]=qo(i0),[tF,fn]=w6(i0),_6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=I.useState(null),[u,l]=I.useState(null),[f,h]=I.useState(null),[y,b]=I.useState(null),[w,T]=I.useState(null),[P,k]=I.useState(0),[R,F]=I.useState(0),[L,G]=I.useState(!1),[q,X]=I.useState(!1),ie=Qt(t,ce=>c(ce)),ae=qp(i);return _.jsx(tF,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:G,scrollbarY:w,onScrollbarYChange:T,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:k,onCornerHeightChange:F,children:_.jsx(Gt.div,{dir:ae,...o,ref:ie,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});_6.displayName=i0;var x6="ScrollAreaViewport",S6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=fn(x6,r),a=I.useRef(null),c=Qt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.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}),_.jsx(Gt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});S6.displayName=x6;var ui="ScrollAreaScrollbar",E6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ui,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return I.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(rF,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(nF,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(C6,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(s0,{...n,ref:t}):null});E6.displayName=ui;var rF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ui,e.__scopeScrollArea),[s,o]=I.useState(!1);return I.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!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]),_.jsx(Nn,{present:r||s,children:_.jsx(C6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),nF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ui,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Bl(()=>c("SCROLL_END"),100),[a,c]=eF("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 I.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),I.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const h=()=>{const y=u[l];f!==y&&(c("SCROLL"),o()),f=y};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,c,o]),_.jsx(Nn,{present:r||a!=="hidden",children:_.jsx(s0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),C6=I.forwardRef((e,t)=>{const r=fn(ui,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Bl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return sa(r.viewport,c),sa(r.content,c),_.jsx(Nn,{present:n||s,children:_.jsx(s0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),s0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=fn(ui,e.__scopeScrollArea),s=I.useRef(null),o=I.useRef(0),[a,c]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=I6(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,y){return uF(h,o.current,a,y)}return r==="horizontal"?_.jsx(iF,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=P6(h,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):r==="vertical"?_.jsx(sF,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=P6(h,a);s.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),iF=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(ui,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(M6,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":$l(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+l.deltaX;e.onWheelScroll(h),k6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Dl(o.paddingLeft),paddingEnd:Dl(o.paddingRight)}})}})}),sF=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(ui,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(M6,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":$l(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollTop+l.deltaY;e.onWheelScroll(h),k6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Dl(o.paddingTop),paddingEnd:Dl(o.paddingBottom)}})}})}),[oF,A6]=w6(ui),M6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:f,...h}=e,y=fn(ui,r),[b,w]=I.useState(null),T=Qt(t,ie=>w(ie)),P=I.useRef(null),k=I.useRef(""),R=y.viewport,F=n.content-n.viewport,L=vr(l),G=vr(c),q=Bl(f,10);function X(ie){if(P.current){const ae=ie.clientX-P.current.left,ce=ie.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ie=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,F)};return document.addEventListener("wheel",ie,{passive:!1}),()=>document.removeEventListener("wheel",ie,{passive:!1})},[R,b,F,L]),I.useEffect(G,[n,G]),sa(b,q),sa(y.content,q),_.jsx(oF,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:vr(s),onThumbPointerUp:vr(o),onThumbPositionChange:G,onThumbPointerDown:vr(a),children:_.jsx(Gt.div,{...h,ref:T,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,ie=>{ie.button===0&&(ie.target.setPointerCapture(ie.pointerId),P.current=b.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(ie))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,ie=>{const ae=ie.target;ae.hasPointerCapture(ie.pointerId)&&ae.releasePointerCapture(ie.pointerId),document.body.style.webkitUserSelect=k.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),Rl="ScrollAreaThumb",T6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=A6(Rl,e.__scopeScrollArea);return _.jsx(Nn,{present:r||i.hasThumb,children:_.jsx(aF,{ref:t,...n})})}),aF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=fn(Rl,r),o=A6(Rl,r),{onThumbPositionChange:a}=o,c=Qt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Bl(()=>{u.current&&(u.current(),u.current=void 0)},100);return I.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(l(),!u.current){const y=lF(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),_.jsx(Gt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),b=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:b,y:w})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});T6.displayName=Rl;var o0="ScrollAreaCorner",O6=I.forwardRef((e,t)=>{const r=fn(o0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(cF,{...e,ref:t}):null});O6.displayName=o0;var cF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=fn(o0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return sa(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),sa(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Gt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Dl(e){return e?parseInt(e,10):0}function I6(e,t){const r=e/t;return isNaN(r)?0:r}function $l(e){const t=I6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function uF(e,t,r,n="ltr"){const i=$l(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return j6([c,u],f)(e)}function P6(e,t,r="ltr"){const n=$l(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],u=iL(e,c);return j6([0,o],[0,a])(u)}function j6(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 k6(e,t){return e>0&&e<t}var lF=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function Bl(e,t){const r=vr(e),n=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(n.current),[]),I.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function sa(e,t){const r=vr(t);hs(()=>{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 fF=_6,dF=S6,N6=E6,R6=T6,hF=O6,a0="Switch",[pF,gJ]=qo(a0),[mF,gF]=pF(a0),D6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,R=>y(R)),w=I.useRef(!1),T=h?l||!!h.closest("form"):!0,[P=!1,k]=hc({prop:i,defaultProp:s,onChange:u});return _.jsxs(mF,{scope:r,checked:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":L6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,R=>{k(F=>!F),T&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})}),T&&_.jsx(vF,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});D6.displayName=a0;var $6="SwitchThumb",B6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=gF($6,r);return _.jsx(Gt.span,{"data-state":L6(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});B6.displayName=$6;var vF=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=L4(r),a=Lp(t);return I.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[o,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function L6(e){return e?"checked":"unchecked"}var yF=D6,bF=B6;const gc={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:pc,highContrast:Sl,radius:Gp},F6=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{className:i,style:s,size:o=gc.size.default,variant:a=gc.variant.default,color:c=gc.color.default,highContrast:u=gc.highContrast.default,radius:l=gc.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Kt("rt-SwitchRoot",i,wt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Qo(n)),style:s},I.createElement(yF,{"data-accent-color":c,...f,ref:t,className:Kt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(bF,{className:Kt("rt-SwitchThumb",{"rt-high-contrast":u})})))});F6.displayName="Switch";var c0=["Enter"," "],wF=["ArrowDown","PageUp","Home"],U6=["ArrowUp","PageDown","End"],_F=[...wF,...U6],xF={ltr:[...c0,"ArrowRight"],rtl:[...c0,"ArrowLeft"]},SF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vc="Menu",[yc,EF,CF]=W4(vc),[Zs,V6]=qo(vc,[CF,vl,H4]),bc=vl(),z6=H4(),[q6,bs]=Zs(vc),[AF,wc]=Zs(vc),W6=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=bc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=vr(s),h=qp(i);return I.useEffect(()=>{const y=()=>{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",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),_.jsx(_4,{...a,children:_.jsx(q6,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(AF,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};W6.displayName=vc;var MF="MenuAnchor",u0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=bc(r);return _.jsx(x4,{...i,...n,ref:t})});u0.displayName=MF;var l0="MenuPortal",[TF,G6]=Zs(l0,{forceMount:void 0}),H6=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=bs(l0,t);return _.jsx(TF,{scope:t,forceMount:r,children:_.jsx(Nn,{present:r||s.open,children:_.jsx(C4,{asChild:!0,container:i,children:n})})})};H6.displayName=l0;var dn="MenuContent",[OF,f0]=Zs(dn),K6=I.forwardRef((e,t)=>{const r=G6(dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=bs(dn,e.__scopeMenu),o=wc(dn,e.__scopeMenu);return _.jsx(yc.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(yc.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(IF,{...i,ref:t}):_.jsx(PF,{...i,ref:t})})})})}),IF=I.forwardRef((e,t)=>{const r=bs(dn,e.__scopeMenu),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return gL(s)},[]),_.jsx(d0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),PF=I.forwardRef((e,t)=>{const r=bs(dn,e.__scopeMenu);return _.jsx(d0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),d0=I.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,disableOutsideScroll:b,...w}=e,T=bs(dn,r),P=wc(dn,r),k=bc(r),R=z6(r),F=EF(r),[L,G]=I.useState(null),q=I.useRef(null),X=Qt(t,q,T.onContentChange),ie=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),z=I.useRef(null),D=I.useRef("right"),p=I.useRef(0),d=b?QL:I.Fragment,m=b?{as:$i,allowPinchZoom:!0}:void 0,x=E=>{var he,ye;const O=ae.current+E,C=F().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(he=C.find(Ee=>Ee.ref.current===g))==null?void 0:he.textValue,j=C.map(Ee=>Ee.textValue),ee=zF(j,O,v),se=(ye=C.find(Ee=>Ee.textValue===ee))==null?void 0:ye.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ie.current),Se!==""&&(ie.current=window.setTimeout(()=>Ee(""),1e3))})(O),se&&setTimeout(()=>se.focus())};I.useEffect(()=>()=>window.clearTimeout(ie.current),[]),sL();const A=I.useCallback(E=>{var C,g;return D.current===((C=z.current)==null?void 0:C.side)&&WF(E,(g=z.current)==null?void 0:g.area)},[]);return _.jsx(OF,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{A(E)&&E.preventDefault()},[A]),onItemLeave:I.useCallback(E=>{var O;A(E)||((O=q.current)==null||O.focus(),G(null))},[A]),onTriggerLeave:I.useCallback(E=>{A(E)&&E.preventDefault()},[A]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{z.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(e6,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Ap,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(rL,{asChild:!0,...R,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:tt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(S4,{role:"menu","aria-orientation":"vertical","data-state":dS(T.open),"data-radix-menu-content":"",dir:P.dir,...k,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,E=>{const C=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;C&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const j=q.current;if(E.target!==j||!_F.includes(E.key))return;E.preventDefault();const se=F().filter(he=>!he.disabled).map(he=>he.ref.current);U6.includes(E.key)&&se.reverse(),UF(se)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,xc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";D.current=g,p.current=E.clientX}}))})})})})})})});K6.displayName=dn;var jF="MenuGroup",h0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"group",...n,ref:t})});h0.displayName=jF;var kF="MenuLabel",X6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{...n,ref:t})});X6.displayName=kF;var Ll="MenuItem",J6="menu.itemSelect",Fl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=wc(Ll,e.__scopeMenu),a=f0(Ll,e.__scopeMenu),c=Qt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(J6,{bubbles:!0,cancelable:!0});f.addEventListener(J6,y=>n==null?void 0:n(y),{once:!0}),zx(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(Y6,{...i,ref:c,disabled:r,onClick:tt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:tt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:tt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||c0.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Fl.displayName=Ll;var Y6=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=f0(Ll,r),a=z6(r),c=I.useRef(null),u=Qt(t,c),[l,f]=I.useState(!1),[h,y]=I.useState("");return I.useEffect(()=>{const b=c.current;b&&y((b.textContent??"").trim())},[s.children]),_.jsx(yc.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(nL,{asChild:!0,...a,focusable:!n,children:_.jsx(Gt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:tt(e.onPointerMove,xc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,xc(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),NF="MenuCheckboxItem",Z6=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(nS,{scope:e.__scopeMenu,checked:r,children:_.jsx(Fl,{role:"menuitemcheckbox","aria-checked":Ul(r)?"mixed":r,...i,ref:t,"data-state":g0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Ul(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Z6.displayName=NF;var Q6="MenuRadioGroup",[RF,DF]=Zs(Q6,{value:void 0,onValueChange:()=>{}}),eS=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=vr(n);return _.jsx(RF,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(h0,{...i,ref:t})})});eS.displayName=Q6;var tS="MenuRadioItem",rS=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=DF(tS,e.__scopeMenu),s=r===i.value;return _.jsx(nS,{scope:e.__scopeMenu,checked:s,children:_.jsx(Fl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":g0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});rS.displayName=tS;var p0="MenuItemIndicator",[nS,$F]=Zs(p0,{checked:!1}),iS=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=$F(p0,r);return _.jsx(Nn,{present:n||Ul(s.checked)||s.checked===!0,children:_.jsx(Gt.span,{...i,ref:t,"data-state":g0(s.checked)})})});iS.displayName=p0;var BF="MenuSeparator",sS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});sS.displayName=BF;var LF="MenuArrow",oS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=bc(r);return _.jsx(E4,{...i,...n,ref:t})});oS.displayName=LF;var m0="MenuSub",[FF,aS]=Zs(m0),cS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=bs(m0,t),o=bc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=vr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(_4,{...o,children:_.jsx(q6,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(FF,{scope:t,contentId:uc(),triggerId:uc(),trigger:a,onTriggerChange:c,children:r})})})};cS.displayName=m0;var _c="MenuSubTrigger",uS=I.forwardRef((e,t)=>{const r=bs(_c,e.__scopeMenu),n=wc(_c,e.__scopeMenu),i=aS(_c,e.__scopeMenu),s=f0(_c,e.__scopeMenu),o=I.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=I.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return I.useEffect(()=>l,[l]),I.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(u0,{asChild:!0,...u,children:_.jsx(Y6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":dS(r.open),...e,ref:al(t,i.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:tt(e.onPointerMove,xc(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:tt(e.onPointerLeave,xc(f=>{var y,b;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const w=(b=r.content)==null?void 0:b.dataset.side,T=w==="right",P=T?-5:5,k=h[T?"left":"right"],R=h[T?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:k,y:h.top},{x:R,y:h.top},{x:R,y:h.bottom},{x:k,y:h.bottom}],side:w}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||xF[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});uS.displayName=_c;var lS="MenuSubContent",fS=I.forwardRef((e,t)=>{const r=G6(dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=bs(dn,e.__scopeMenu),o=wc(dn,e.__scopeMenu),a=aS(lS,e.__scopeMenu),c=I.useRef(null),u=Qt(t,c);return _.jsx(yc.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(yc.Slot,{scope:e.__scopeMenu,children:_.jsx(d0,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:tt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:tt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=SF[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});fS.displayName=lS;function dS(e){return e?"open":"closed"}function Ul(e){return e==="indeterminate"}function g0(e){return Ul(e)?"indeterminate":e?"checked":"unchecked"}function UF(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function VF(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function zF(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=VF(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function qF(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function WF(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return qF(r,t)}function xc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var GF=W6,HF=u0,KF=H6,XF=K6,JF=h0,YF=X6,ZF=Fl,QF=Z6,eU=eS,tU=rS,rU=iS,nU=sS,iU=oS,sU=cS,oU=uS,aU=fS,v0="DropdownMenu",[cU,bJ]=qo(v0,[V6]),kr=V6(),[uU,hS]=cU(v0),pS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=kr(t),u=I.useRef(null),[l=!1,f]=hc({prop:i,defaultProp:s,onChange:o});return _.jsx(uU,{scope:t,triggerId:uc(),triggerRef:u,contentId:uc(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(GF,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};pS.displayName=v0;var mS="DropdownMenuTrigger",gS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=hS(mS,r),o=kr(r);return _.jsx(HF,{asChild:!0,...o,children:_.jsx(Gt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:al(t,s.triggerRef),onPointerDown:tt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:tt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});gS.displayName=mS;var lU="DropdownMenuPortal",vS=e=>{const{__scopeDropdownMenu:t,...r}=e,n=kr(t);return _.jsx(KF,{...n,...r})};vS.displayName=lU;var yS="DropdownMenuContent",bS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=hS(yS,r),s=kr(r),o=I.useRef(!1);return _.jsx(XF,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:tt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:tt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(o.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)"}})});bS.displayName=yS;var fU="DropdownMenuGroup",wS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(JF,{...i,...n,ref:t})});wS.displayName=fU;var dU="DropdownMenuLabel",_S=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(YF,{...i,...n,ref:t})});_S.displayName=dU;var hU="DropdownMenuItem",xS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(ZF,{...i,...n,ref:t})});xS.displayName=hU;var pU="DropdownMenuCheckboxItem",SS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(QF,{...i,...n,ref:t})});SS.displayName=pU;var mU="DropdownMenuRadioGroup",ES=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(eU,{...i,...n,ref:t})});ES.displayName=mU;var gU="DropdownMenuRadioItem",CS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(tU,{...i,...n,ref:t})});CS.displayName=gU;var vU="DropdownMenuItemIndicator",AS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(rU,{...i,...n,ref:t})});AS.displayName=vU;var yU="DropdownMenuSeparator",MS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(nU,{...i,...n,ref:t})});MS.displayName=yU;var bU="DropdownMenuArrow",wU=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(iU,{...i,...n,ref:t})});wU.displayName=bU;var _U=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=kr(t),[a=!1,c]=hc({prop:n,defaultProp:s,onChange:i});return _.jsx(sU,{...o,open:a,onOpenChange:c,children:r})},xU="DropdownMenuSubTrigger",TS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(oU,{...i,...n,ref:t})});TS.displayName=xU;var SU="DropdownMenuSubContent",OS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(aU,{...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)"}})});OS.displayName=SU;var EU=pS,CU=gS,IS=vS,AU=bS,MU=wS,TU=_S,OU=xS,IU=SS,PU=ES,jU=CS,PS=AS,kU=MS,NU=_U,RU=TS,DU=OS;const y0={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Gp,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},b0=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=y0.size.default,radius:l=y0.radius.default,scrollbars:f=y0.scrollbars.default,...h}=r;return I.createElement(fF,{type:o,scrollHideDelay:a,className:Kt("rt-ScrollAreaRoot",i,Qo(n)),style:s},I.createElement(dF,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(N6,{"data-radius":l,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",wt(u,"rt-r-size"))},I.createElement(R6,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(N6,{"data-radius":l,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",wt(u,"rt-r-size"))},I.createElement(R6,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(hF,{className:"rt-ScrollAreaCorner"}):null)});b0.displayName="ScrollArea";const w0={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:pc,highContrast:Sl},jS={color:pc,shortcut:{type:"string",default:void 0}},kS=e=>I.createElement(EU,{...e});kS.displayName="DropdownMenuRoot";const NS=I.forwardRef((e,t)=>I.createElement(CU,{...e,ref:t,asChild:!0}));NS.displayName="DropdownMenuTrigger";const RS=I.createContext({}),DS=I.forwardRef((e,t)=>{const r=AB(),{className:n,children:i,size:s=w0.size.default,variant:o=w0.variant.default,highContrast:a=w0.highContrast.default,color:c=jS.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(IS,{container:u,forceMount:l},I.createElement(xl,{asChild:!0},I.createElement(AU,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,wt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(b0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(RS.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});DS.displayName="DropdownMenuContent";const $S=I.forwardRef((e,t)=>I.createElement(TU,{...e,ref:t,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));$S.displayName="DropdownMenuLabel";const BS=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=jS.color.default,shortcut:s,...o}=e;return I.createElement(OU,{"data-accent-color":i,...o,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(Wo,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});BS.displayName="DropdownMenuItem";const LS=I.forwardRef((e,t)=>I.createElement(MU,{...e,ref:t,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));LS.displayName="DropdownMenuGroup";const FS=I.forwardRef((e,t)=>I.createElement(PU,{...e,ref:t,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));FS.displayName="DropdownMenuRadioGroup";const US=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(jU,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(Wo,null,r),I.createElement(PS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Cl,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});US.displayName="DropdownMenuRadioItem";const VS=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(IU,{...s,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(Wo,null,r),I.createElement(PS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Cl,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});VS.displayName="DropdownMenuCheckboxItem";const zS=e=>I.createElement(NU,{...e});zS.displayName="DropdownMenuSub";const qS=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(RU,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(Wo,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(q4,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});qS.displayName="DropdownMenuSubTrigger";const WS=I.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=I.useContext(RS);return I.createElement(IS,{container:i,forceMount:s},I.createElement(xl,{asChild:!0},I.createElement(DU,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,wt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(b0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});WS.displayName="DropdownMenuSubContent";const GS=I.forwardRef((e,t)=>I.createElement(kU,{...e,ref:t,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));GS.displayName="DropdownMenuSeparator";const hn=Object.assign({},{Root:kS,Trigger:NS,Content:DS,Label:$S,Item:BS,Group:LS,RadioGroup:FS,RadioItem:US,CheckboxItem:VS,Sub:zS,SubTrigger:qS,SubContent:WS,Separator:GS}),Sc={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:pc,highContrast:Sl,radius:Gp},HS=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{className:i,asChild:s=!1,size:o=Sc.size.default,variant:a=Sc.variant.default,color:c=Sc.color.default,highContrast:u=Sc.highContrast.default,radius:l=Sc.radius.default,...f}=r,h=s?$i:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Kt("rt-reset","rt-BaseButton",i,wt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Qo(n))})});HS.displayName="BaseButton";const KS=I.forwardRef((e,t)=>I.createElement(HS,{...e,ref:t,className:Kt("rt-Button",e.className)}));KS.displayName="Button";const $U={loading:{type:"boolean",default:!0}},oa=I.forwardRef((e,t)=>{const{rest:r,...n}=Zo(e),{className:i,children:s,loading:o=$U.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?$i:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Kt("rt-Skeleton",i,Qo(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});oa.displayName="Skeleton";const BU=$t("/images/ghost_loading.png"),LU={primary:$t("/images/primary_loading.png"),ghost:BU};function FU({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(B4,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:LU[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const UU="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==",_0="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,...s}){const[o,a]=te.useState(_0),c=u=>{a(_0)};return te.useEffect(()=>{a(e||_0)},[e]),_.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[_.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&_.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:UU})]})}function VU({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=zo(),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 _.jsxs("div",{className:"cs-toast",children:[_.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[_.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&_.jsx("div",{children:_.jsx(FU,{})}),_.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&_.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&_.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&_.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&_.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&_.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&_.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&_.jsx(Ux,{text:"Confirmation is in progress. Check your transaction on here",keywords:["here"],text_highlight_color:"#72c1f7",onKeywordClick:()=>{window.open(o(i,"tx"),"_blank")}})]}),r==="rejected"&&_.jsxs(_.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&_.jsx("span",{children:"Something went wrong"})]}),r==="success"&&_.jsx(_.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),il.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Gr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const zU=Di((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)}))}})),aa=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=zU(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},s=a=>{const c=Date.now();return a.id=c,r(a),c},o=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),Ln.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(VU,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}},MJ="";function qU(){const{mevProtect:e,setMevProtect:t}=Lr();return _.jsxs(hn.Root,{children:[_.jsx(hn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-mev"})})})}),_.jsx(hn.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:_.jsxs("div",{className:"mev-settings-box",children:[_.jsxs("div",{className:"mev-setting-title",children:[_.jsxs("div",{className:"name",children:[_.jsx("img",{src:$t("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(F6,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),_.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 WU({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return _.jsx("div",{className:"refresh-button",children:_.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:_.jsx("use",{xlinkHref:"#icon-refresh"})})})}const TJ="",OJ="";function x0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(KS,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function GU(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Lr();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsxs("span",{children:[r,"%"]})]}),t&&_.jsx(HU,{onClose:()=>e(!1)})]})}function HU({onClose:e}){const{slippage:t,setSlippage:r}=Lr(),[n,i]=te.useState(t),s=u=>{i(u.display)},o=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 _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Slippage Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:uD.map(u=>_.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display," %"]}))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),_.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(x0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function KU({handleRefresh:e}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(GU,{}),_.jsx(qU,{}),_.jsx(WU,{onClick:e})]})]})})}const IJ="",PJ="";function XU(){const[e,t]=te.useState(!1);return _.jsxs(hn.Root,{open:e,onOpenChange:t,children:[_.jsx(hn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(hn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(JU,{}),_.jsx(ZU,{onClose:()=>{t(!1)}})]})})]})}function JU(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Lr(),i=s=>{t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:il.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Al,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const YU=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function ZU({onClose:e}){const{addTxToast:t}=aa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Lr(),[a,c]=te.useState(i),[u,l]=te.useState(r),f=w=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${w}`})})},h=w=>{l(w),w.isCustom||(n(w),f(w.link),e())},y=w=>{c(w.target.value)},b=()=>{if(a){const w={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(w),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(w=>_.jsxs("div",{className:"rpc-item",onClick:()=>h(w),children:[_.jsx(Al,{color:"indigo",checked:u.name===w.name,variant:"soft",className:"cs-checkbox"}),_.jsx("span",{children:w.name})]})),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),_.jsx(x0,{btnIsDisabled:YU(a),text:"Save",onClick:b})]})]})]})}const jJ="",Rn=Di((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 QU=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()}},eV=QU,XS={"text/plain":"Text","text/html":"Url",default:"Text"},tV="Copy to clipboard: #{key}, Enter";function rV(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function nV(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=eV(),s=document.createRange(),o=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 f=XS[t.format]||XS.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);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(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=rV("message"in t?t.message:tV),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var iV=nV;const JS=ga(iV);function sV({currentAccount:e}){const{mutate:t}=Ur.useSwitchAccount(),r=Ur.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Rn(),s=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const o=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:s,children:[_.jsx("span",{children:Hs(e)}),(o==null?void 0:o.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>_.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsx("div",{className:"label",children:c==null?void 0:c.label}),_.jsx("div",{className:"address",children:Hs(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const oV=te.forwardRef(({connect:e})=>{const t=Ur.useCurrentAccount();return _.jsx("div",{children:t?_.jsx(aV,{}):_.jsx(x0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function aV(){const{mutate:e}=Ur.useDisconnectWallet(),t=Ur.useCurrentAccount(),{currentWallet:r}=Ur.useCurrentWallet(),{addCommonToast:n}=aa(),{getExplorerUrl:i}=zo(),s=()=>{t&&(JS(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),_.jsxs(hn.Root,{children:[_.jsx(hn.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{children:Hs(t==null?void 0:t.address)})]})}),_.jsx(hn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),_.jsx(sV,{currentAccount:t==null?void 0:t.address}),_.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:o,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function cV(){Ur.useCurrentAccount(),Ur.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Rn();return Ur.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Ur.ConnectModal,{trigger:_.jsx(oV,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function uV({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:$t("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(cV,{}),_.jsx(XU,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const kJ="",YS=()=>{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 _.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:_.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)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function lV({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(fV,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(dV,{info:s,status:r,tx:i,onClose:e})]})}function fV({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(YS,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function dV({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=zo();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),il.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Vl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await oD(`${i||ol.api}${t}`,n):await aD(`${i||ol.api}${t}`,n)}catch(s){throw s}}}}function hV(){const{fetchByApi:e}=Vl(),{setProviders:t}=Lr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function pV({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]),s=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Qs=Di((e,t)=>({suiClient:new Ta({url:ol.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new cx,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),ca=Di((e,t)=>({tokenMapIsInit:!1,requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=Ir(r.coin_type).full_address;if(!n.has(s)){const o=new Map(n);o.set(s,r);const a=i.filter(c=>c!==r.coin_type);e(()=>({tokenMap:o,requestTokenList:[...a]})),Ri.setItem(xp,o)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||Ri.setItem(xp,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Ri.setItem(kx,r)}}));Ri.getItem(xp).then(e=>{e!==null&&ca.getState().setTokenMap(e,!0)}),Ri.getItem(kx).then(e=>{e!==null&&ca.getState().setTrustedTokenList(e,!0)});function mV(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 ws(){const{suiClient:e}=Qs(),{fetchByApi:t}=Vl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=ca(),c=async()=>{var b;const f=await t("/v2/sui/coins_info","GET"),h=[],y=(b=f==null?void 0:f.list)==null?void 0:b.reduce((w,T)=>(w.set(T.coin_type,T),T.is_trusted&&h.push({...T,coin_type:Ir(T.coin_type).full_address}),w),new Map);y&&(y.set("0x2::sui::SUI",{...y.get("0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"),coin_type:"0x2::sui::SUI"}),r(y),a(h))},u=async f=>{try{const h=l(f);if(h)return h;if(s.includes(f))return;o(f);const y=await e.getCoinMetadata({coinType:f});if(y){fx(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=mV(y,f);return i(b),b}}catch{}},l=te.useCallback(f=>{if(f)return n.get(Ir(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function zl(e){const{suiClient:t}=Qs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Rn(),{fetchTokenInfo:s}=ws(),[o,a]=te.useState([]),{tokenMap:c}=ca(),u=async(y=(r==null?void 0:r.address)||"",b)=>{try{if(!y){l();return}let w=[];b?w=[await t.getBalance({owner:y,coinType:b})]:w=[...await t.getAllBalances({owner:y})],a(w)}catch{a([])}},l=()=>{n({})};te.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const b={};for(let w=0;w<(y==null?void 0:y.length);w++)try{const T=y[w],P=await s(T.coinType),k=eD(T.totalBalance,P==null?void 0:P.decimals),R=jr(k,4);b[Ir(T.coinType).full_address]={...T,displayBalance:R,totalBalanceFormat:k}}catch{continue}n(b)},h=te.useMemo(()=>{if(e&&r)return i[e]||i[Ir(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const pn=Di((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}))}})),gV={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"}},ZS={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"}},QS=gV;function vV(e,t){const{fetchTokenInfo:r}=ws(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=pn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Lr(),{tokenMapIsInit:u}=ca(),l=te.useRef({}),f=async(y,b)=>{const w=y?await r(y):ZS,T=b?await r(b):QS;n(w),i(T),s(w==null?void 0:w.coin_type,T==null?void 0:T.coin_type)},h=(y,b)=>{const w=[sl[0]];let T=sl[0];y.forEach(P=>{const k={name:P,link:P,isCustom:!1};w.push(k),P===b&&(T=k)}),a([...w,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(T)};return te.useEffect(()=>{if(u&&!_p(e,l.current)){const{defaultFromToken:y,defaultToToken:b,defaultSlippage:w,customRpcList:T,defaultRpc:P}=e;f(y,b),w&&o(w),(T==null?void 0:T.length)>0&&h(T,P),l.current=e}},[e,u]),{handleSetDefaultPair:f}}function yV(){const{currentRpc:e}=Lr(),{setSuiClient:t,setAggregatorSDK:r}=Qs(),{currentAccount:n}=Rn();te.useEffect(()=>{if(e){const i=new Ta({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new cx(ol.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Ta({url:e.link}),nR.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const e8=Di((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Ir(i).full_address]}),e({coinPriceObj:{...n}})}}));function ql(){const{fetchByApi:e}=Vl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=e8(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>ki(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Ir(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=te.useCallback(a=>{if(!a)return;const c=t[Ir(a).full_address];if(c)return c},[t]),o=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Le(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const S0=Di((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Sr=[];for(let e=0;e<256;++e)Sr.push((e+256).toString(16).slice(1));function bV(e,t=0){return(Sr[e[t+0]]+Sr[e[t+1]]+Sr[e[t+2]]+Sr[e[t+3]]+"-"+Sr[e[t+4]]+Sr[e[t+5]]+"-"+Sr[e[t+6]]+Sr[e[t+7]]+"-"+Sr[e[t+8]]+Sr[e[t+9]]+"-"+Sr[e[t+10]]+Sr[e[t+11]]+Sr[e[t+12]]+Sr[e[t+13]]+Sr[e[t+14]]+Sr[e[t+15]]).toLowerCase()}let E0;const wV=new Uint8Array(16);function _V(){if(!E0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");E0=crypto.getRandomValues.bind(crypto)}return E0(wV)}const t8={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function r8(e,t,r){if(t8.randomUUID&&!t&&!e)return t8.randomUUID();e=e||{};const n=e.random||(e.rng||_V)();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 bV(n)}var eo=(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))(eo||{});const xV=new Ta({url:ym("mainnet")}),SV=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],EV=["deny_list","DenyList","DenyCap","create_regulated_currency"],CV={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},AV=async e=>{let t=!1;if(SV.includes(e))return t;const r=e.split("::"),n=r[0]&&Vr(r[0]),i=r[1],s=await xV.getObject({id:n,options:CV}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(EV.join("|"),"i").test(o)&&(t=!0),t},MV=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ki(i,!1)))==null?void 0:n.join(",")};function TV(){const{fetchByApi:e}=Vl(),t=async n=>{try{const i={...n},s=MV(n==null?void 0:n.coin_type);s&&(i.coin_type=s);const o=await e("/v2/sui/stats_pools","GET",i);if(o!=null&&o.lp_list)return{list:(o==null?void 0:o.lp_list)||[],total:o==null?void 0:o.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,s,o,a;try{const c=$t("/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=(s=u==null?void 0:u.data)==null?void 0:s.lp_list;let f=l;if(n!=null&&n.coin_type){const y=(a=(o=n==null?void 0:n.coin_type)==null?void 0:o.split(","))==null?void 0:a.map(b=>sc(b).source_address);f=l==null?void 0:l.filter(b=>{var P,k;const w=sc((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,T=sc((k=b==null?void 0:b.coin_b)==null?void 0:k.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(T)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(T)))})}n!=null&&n.is_vaults&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.has_farming));const h=f;return{list:h,total:(h==null?void 0:h.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function OV(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Lr(),{getPoolList:n,getLocalJsonPoolList:i}=TV();return{getPoolListByCoinType:async(o,a)=>{if(o&&a){const c=[o,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const f={coin_type:`${o},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let h=e?await i(f):void 0;(h===void 0||h.list.length===0)&&(h=await n(f));const y=h.list;if(y.length>0)return t[u]=y,r(u,y),y}return[]}}}function IV(e){const{routerData:t}=pn();return{priceAcceptRouterData:te.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 n8(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Le(s).mul(Le(1).sub(Le(e).div(100))).toString():Le(i).mul(Le(1).add(Le(e).div(100))).toString()}},[e,t])}}function PV(e){const{getTokenInfo:t,fetchTokenInfo:r}=ws();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Le(0);if(e.routerData.routes.forEach((l,f)=>{const h={},y=e.byAmountIn?l.amountIn.toString():l.amountOut.toString();f===e.routerData.routes.length-1?h.percentage=Le(1).sub(c).toFixed(2):h.percentage=Le(y).div(s).toFixed(2),c=Le(c).add(h.percentage);const b=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const T=Ir(w.from).full_address,P=Ir(w.target).full_address,k=t(T),R=t(P);k||a.includes(T)&&a.push(T),R||a.includes(P)&&a.push(P);const F=w.provider===cc.SCALLOP||w.provider===cc.FLOWX||w.provider===cc.FLOWXV3;b.push({from_type:T,to_type:P,pool_address:F?"":w.id,fee_rate:w.feeRate,provider:w.provider})}),h.paths=b,o.push(h)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function jV(){const{fromCoin:e,toCoin:t}=pn(),{getPoolListByCoinType:r}=OV();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function i8(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function s8(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await AV(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 kV(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=pn(),{getTokenInfo:i}=ws(),{ignoreWarnTokenMap:s}=Lr(),o=i(e),a=i(t),c=te.useMemo(()=>!nl(r,ZS.coin_type)||!nl(n,QS.coin_type),[r,n]),u=te.useCallback(f=>f&&!s[ki(f.coin_type)]&&(nl(r,f.coin_type)||nl(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=te.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function NV(){const{aggregatorSDK:e}=Qs(),{getSwapPoolAddress:t}=jV(),r=s=>s&&s.error?s.error.code===eo.InsufficientLiquidity||eo.HoneyPot||eo.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const h={from:o.coin_type,target:a.coin_type,amount:new S2(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},y=await e.findRouters(h);if(y&&r(y))return i(!1,l,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,l,f,o,a,y)}catch{const y=await t(),b={from:o.coin_type,target:a.coin_type,amount:new S2(c),byAmountIn:l,pools:y};try{const w=await e.swapInPools(b);return!w||!w.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,w.routeData)}catch{return{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(l){const h=l.error!==void 0,y=wp(l.amountIn.toString(),c.decimals).toString(),b=wp(l.amountOut.toString(),u.decimals).toString();return{routerData:h?void 0:l,fromAmountUi:h?o?y:"":y,toAmountUi:h&&o?"":b,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function ua(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function RV(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function DV(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function $V(e){return!!String(e).includes("Could not find the referenced transaction")}function BV(e){return RV(e)?"User rejected the request":DV(e)?"Exceeded price slippage":$V(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var C0={};Object.defineProperty(C0,"__esModule",{value:!0});var LV=C0.executeAuction=o8,FV=c_,UV="https://rpc.getshio.com",VV=500,zV=300;function o8(e,t,r){r===void 0&&(r=VV);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),FV.default.post(UV,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,zV)}).catch(s)})}C0.default={executeAuction:o8};function qV(){const{suiClient:e}=Qs(),{currentAccount:t}=Rn(),{mutateAsync:r}=Ur.useSignTransaction(),{mutate:n}=Ur.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const b=await e.devInspectTransactionBlock({transactionBlock:Mo.Transaction.from(yn(c)),sender:t.address});if(!b||((h=b.effects)==null?void 0:h.status.status)==="failure")throw Error((y=b.effects)==null?void 0:y.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 f,h;let l;if(typeof c=="string"?l=Mo.Transaction.from(c):l=c,u){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((h=y.effects)==null?void 0:h.status.error)}return l.setGasBudget(1e8),new Promise((y,b)=>{n({transaction:l,chain:i},{onSuccess:w=>{y(w)},onError:w=>{console.error("signAndExecuteTransactionBlock transaction failed",w),b(w)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Mo.Transaction.from(c)),typeof c=="string"&&(c=Mo.Transaction.from(yn(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,h,y,b)=>{console.error("signTransactionBlock onSettled",{data:f,error:h,variables:y})}})})),executeTransactionBlock:s}}function WV(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=qV(),{currentAccount:n}=Rn(),{suiClient:i}=Qs(),{setTransactionData:s}=S0(),{addTxToast:o,removeToast:a}=aa(),c=5,u=2e3;async function l(y,b=1){try{let w;try{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0}})}if(w)return w;throw new Error("Empty response")}catch(w){if(console.error(`Attempt ${b} failed:`,w),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await Px(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:T=!1,useMev:P,txAction:k="signTransactionBlock"}=w;let R;b.status="confirmation",s(b);try{let G;if(k==="signTransactionBlock"){const X=await e(y),{bytes:ie,signature:ae}=X;if(P)try{const ce=await LV(ie,ae,500)}catch{}G=await t(ie,ae,T)}else G=await r(y,T);b.status="submitted",s({...b}),b.tx=G.digest,R=o(b),await Px(u);const q=await l(G.digest,0);if(!q||((F=q.effects)==null?void 0:F.status.status)==="failure")h(b,(L=q.effects)==null?void 0:L.status.error);else{const X=sD(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const ie=b.buildShowInfo("success",X);b.buildShowInfo=ae=>ie}a(R),b.status="success",s({...b})}return q}catch(G){h(b,G)}},h=(y,b)=>{const w=BV(b);if(y.buildShowInfo){const T=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(T.toastDescriptionContent=w,T.modalDescriptionText=w,T),y.status="rejected",s({...y})}else y.buildShowInfo=T=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function A0(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 GV(){const{aggregatorSDK:e}=Qs(),{findBestRouters:t}=NV(),{getTokenAmountValue:r,fetchTokenPrices:n}=ql(),{providers:i,slippage:s,mevProtect:o}=Lr(),{signAndExecuteTransaction:a}=WV(),{setTransactionData:c}=S0(),{addTxToast:u}=aa(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:T,setFromAmount:P,setFindRouterLoading:k,setRouterData:R,setByAmountIn:F,byAmountIn:L}=pn(),[G,q]=te.useState(""),X=ua(G),ie=ua(L),ae=ua(w),ce=ua(T),z=ua(l),D=ua(f),{balanceInfo:p,getOwnerCoinBalances:d}=zl(l==null?void 0:l.coin_type),{balanceInfo:m}=zl(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),A=r(f==null?void 0:f.coin_type,T),O=A0(async(Se,Ge,Ue)=>{if(z.current&&D.current&&+Se){(+ae.current||+ce.current)&&k(!0);const dt=rD(Se,Ge?z.current.decimals:D.current.decimals),ht=await t({fromToken:z.current,toToken:D.current,amount:dt.toString(),providersKeys:i,by_amount_in:Ge,uuid:Ue});k(!1),X.current===Ue&&(Ge?+ae.current?(b(ht.toAmountUi||""),R(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),R(ht)):P(""))}else v(!Ge)},500),C=(Se,Ge,Ue=!1)=>{if(F(Ge),Ge?(P(Se),Ue&&b("")):(b(Se),Ue&&P("")),+Se){const dt=r8();q(dt),O(Se,Ge,dt)}else k(!1),R(void 0),v(!Ge)},g=(Se,Ge=!0)=>{v(),Ge?((Se==null?void 0:Se.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(Se)):((Se==null?void 0:Se.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(Se))},v=Se=>{Se===void 0?(P(""),b("")):Se?P(""):b(""),k(!1),R(void 0)},j=()=>{const Se=ie.current?ae.current:ce.current;if(+Se){const Ge=r8();q(Ge),O(Se,ie.current,Ge)}},ee=async(Se,Ge)=>{const{routerData:Ue,byAmountIn:dt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new Mo.Transaction,xe={routers:Ue,slippage:Number(s)/100,txb:mt,partner:Ge||lD};try{await e.fastRouterSwap(xe);const ge={status:"confirmation",buildShowInfo:(We,De)=>{const Oe=`Swap ${jr(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${jr($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(We==="success"){let Fe=ht,lt=$e;De&&(Fe=jx(De,l)||ht,lt=jx(De,f)||$e);const ft=`Swapped ${jr(Fe,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${jr(lt,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=ft,Ie.modalDescriptionText=ft}return Ie},id:0};c(ge),await a(mt,ge,{useMev:o})?(v(),d()):j()}catch(ge){String(ge).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Te,We){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{se(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const se=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:he}=s8(l),{isScamsCoin:ye}=s8(f),Ee=te.useMemo(()=>{if(!(!he&&!ye)){if(he&&ye)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(he)return`${l==null?void 0:l.symbol} token is `;if(ye)return`${f==null?void 0:f.symbol} token is `}},[he,ye]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:A,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:se,scamsText:Ee}}function HV(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=pn(),{currentAccount:o}=Rn(),a=te.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.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(s&&s.errorCode){if(s.errorCode===eo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===eo.NoRouter||s.errorCode===eo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${ln(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function a8({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const s=50-parseFloat(t),o=2*Math.PI*s,a=o*i,c=o-a;return _.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),_.jsx("style",{children:`
93
+ `)},KA=0,Es=[];function YA(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(KA++)[0],o=P.useState(Kv)[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=gA([e.lockRef.current],(e.shards||[]).map(ty),!0).filter(Boolean);return y.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(y,A){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var O=_u(y),R=r.current,k="deltaX"in y?y.deltaX:R[0]-O[0],F="deltaY"in y?y.deltaY:R[1]-O[1],$,H=y.target,q=Math.abs(k)>Math.abs(F)?"h":"v";if("touches"in y&&q==="h"&&H.type==="range")return!1;var Y=Xv(q,H);if(!Y)return!0;if(Y?$=q:($=q==="v"?"h":"v",Y=Xv(q,H)),!Y)return!1;if(!n.current&&"changedTouches"in y&&(k||F)&&(n.current=$),!$)return!0;var ne=n.current||$;return HA(ne,A,y,ne==="h"?k:F,!0)},[]),c=P.useCallback(function(y){var A=y;if(!(!Es.length||Es[Es.length-1]!==o)){var O="deltaY"in A?ey(A):_u(A),R=t.current.filter(function($){return $.name===A.type&&($.target===A.target||A.target===$.shadowParent)&&WA($.delta,O)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var k=(s.current.shards||[]).map(ty).filter(Boolean).filter(function($){return $.contains(A.target)}),F=k.length>0?a(A,k[0]):!s.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=P.useCallback(function(y,A,O,R){var k={name:y,delta:A,target:O,should:R,shadowParent:ZA(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=_u(y),n.current=void 0},[]),d=P.useCallback(function(y){u(y.type,ey(y),y.target,a(y,e.lockRef.current))},[]),p=P.useCallback(function(y){u(y.type,_u(y),y.target,a(y,e.lockRef.current))},[]);P.useEffect(function(){return Es.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Ss),document.addEventListener("touchmove",c,Ss),document.addEventListener("touchstart",l,Ss),function(){Es=Es.filter(function(y){return y!==o}),document.removeEventListener("wheel",c,Ss),document.removeEventListener("touchmove",c,Ss),document.removeEventListener("touchstart",l,Ss)}},[]);var w=e.removeScrollBar,x=e.inert;return P.createElement(P.Fragment,null,x?P.createElement(o,{styles:GA(i)}):null,w?P.createElement(LA,{gapMode:e.gapMode}):null)}function ZA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const XA=CA(Wv,YA);var ry=P.forwardRef(function(e,t){return P.createElement(Su,Xn({},e,{ref:t,sideCar:XA}))});ry.classNames=Su.classNames;const JA=ry;function QA(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var Vd="ScrollArea",[ny,pB]=us(Vd),[e7,cn]=ny(Vd),iy=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,x]=P.useState(null),[y,A]=P.useState(null),[O,R]=P.useState(0),[k,F]=P.useState(0),[$,H]=P.useState(!1),[q,Y]=P.useState(!1),ne=rr(t,ae=>c(ae)),se=Ad(i);return b.jsx(e7,{scope:r,type:n,dir:se,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:l,content:d,onContentChange:p,scrollbarX:w,onScrollbarXChange:x,scrollbarXEnabled:$,onScrollbarXEnabledChange:H,scrollbarY:y,onScrollbarYChange:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:Y,onCornerWidthChange:R,onCornerHeightChange:F,children:b.jsx(Yt.div,{dir:se,...s,ref:ne,style:{position:"relative","--radix-scroll-area-corner-width":O+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});iy.displayName=Vd;var oy="ScrollAreaViewport",sy=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...o}=e,s=cn(oy,r),a=P.useRef(null),c=rr(t,a,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.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}),b.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:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});sy.displayName=oy;var Jn="ScrollAreaScrollbar",ay=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=cn(Jn,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"?b.jsx(t7,{...n,ref:t,forceMount:r}):i.type==="scroll"?b.jsx(r7,{...n,ref:t,forceMount:r}):i.type==="auto"?b.jsx(cy,{...n,ref:t,forceMount:r}):i.type==="always"?b.jsx(zd,{...n,ref:t}):null});ay.displayName=Jn;var t7=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=cn(Jn,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]),b.jsx(On,{present:r||o,children:b.jsx(cy,{"data-state":o?"visible":"hidden",...n,ref:t})})}),r7=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=cn(Jn,e.__scopeScrollArea),o=e.orientation==="horizontal",s=Au(()=>c("SCROLL_END"),100),[a,c]=QA("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]),b.jsx(On,{present:r||a!=="hidden",children:b.jsx(zd,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Xe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Xe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),cy=P.forwardRef((e,t)=>{const r=cn(Jn,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 _s(r.viewport,c),_s(r.content,c),b.jsx(On,{present:n||o,children:b.jsx(zd,{"data-state":o?"visible":"hidden",...i,ref:t})})}),zd=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=cn(Jn,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=hy(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 c7(p,s.current,a,w)}return r==="horizontal"?b.jsx(n7,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollLeft,w=py(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"?b.jsx(i7,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const p=i.viewport.scrollTop,w=py(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}),n7=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=cn(Jn,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]),b.jsx(ly,{"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":Tu(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),gy(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:Mu(s.paddingLeft),paddingEnd:Mu(s.paddingRight)}})}})}),i7=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=cn(Jn,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]),b.jsx(ly,{"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":Tu(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),gy(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:Mu(s.paddingTop),paddingEnd:Mu(s.paddingBottom)}})}})}),[o7,uy]=ny(Jn),ly=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=cn(Jn,r),[x,y]=P.useState(null),A=rr(t,ne=>y(ne)),O=P.useRef(null),R=P.useRef(""),k=w.viewport,F=n.content-n.viewport,$=wr(l),H=wr(c),q=Au(d,10);function Y(ne){if(O.current){const se=ne.clientX-O.current.left,ae=ne.clientY-O.current.top;u({x:se,y:ae})}}return P.useEffect(()=>{const ne=se=>{const ae=se.target;(x==null?void 0:x.contains(ae))&&$(se,F)};return document.addEventListener("wheel",ne,{passive:!1}),()=>document.removeEventListener("wheel",ne,{passive:!1})},[k,x,F,$]),P.useEffect(H,[n,H]),_s(x,q),_s(w.content,q),b.jsx(o7,{scope:r,scrollbar:x,hasThumb:i,onThumbChange:wr(o),onThumbPointerUp:wr(s),onThumbPositionChange:H,onThumbPointerDown:wr(a),children:b.jsx(Yt.div,{...p,ref:A,style:{position:"absolute",...p.style},onPointerDown:Xe(e.onPointerDown,ne=>{ne.button===0&&(ne.target.setPointerCapture(ne.pointerId),O.current=x.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),Y(ne))}),onPointerMove:Xe(e.onPointerMove,Y),onPointerUp:Xe(e.onPointerUp,ne=>{const se=ne.target;se.hasPointerCapture(ne.pointerId)&&se.releasePointerCapture(ne.pointerId),document.body.style.webkitUserSelect=R.current,w.viewport&&(w.viewport.style.scrollBehavior=""),O.current=null})})})}),Cu="ScrollAreaThumb",fy=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=uy(Cu,e.__scopeScrollArea);return b.jsx(On,{present:r||i.hasThumb,children:b.jsx(s7,{ref:t,...n})})}),s7=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,o=cn(Cu,r),s=uy(Cu,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=u7(d,a);u.current=w,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[o.viewport,l,a]),b.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(),x=d.clientX-w.left,y=d.clientY-w.top;s.onThumbPointerDown({x,y})}),onPointerUp:Xe(e.onPointerUp,s.onThumbPointerUp)})});fy.displayName=Cu;var qd="ScrollAreaCorner",dy=P.forwardRef((e,t)=>{const r=cn(qd,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?b.jsx(a7,{...e,ref:t}):null});dy.displayName=qd;var a7=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=cn(qd,r),[o,s]=P.useState(0),[a,c]=P.useState(0),u=!!(o&&a);return _s(i.scrollbarX,()=>{var d;const l=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),_s(i.scrollbarY,()=>{var d;const l=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(l),s(l)}),u?b.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 Mu(e){return e?parseInt(e,10):0}function hy(e,t){const r=e/t;return isNaN(r)?0:r}function Tu(e){const t=hy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function c7(e,t,r,n="ltr"){const i=Tu(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 my([c,u],d)(e)}function py(e,t,r="ltr"){const n=Tu(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=nA(e,c);return my([0,s],[0,a])(u)}function my(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 gy(e,t){return e>0&&e<t}var u7=(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=wr(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 _s(e,t){const r=wr(t);Wi(()=>{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 l7=iy,f7=sy,vy=ay,yy=fy,d7=dy,Hd="Switch",[h7,mB]=us(Hd),[p7,m7]=h7(Hd),wy=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),x=rr(t,k=>w(k)),y=P.useRef(!1),A=p?l||!!p.closest("form"):!0,[O=!1,R]=ba({prop:i,defaultProp:o,onChange:u});return b.jsxs(p7,{scope:r,checked:O,disabled:a,children:[b.jsx(Yt.button,{type:"button",role:"switch","aria-checked":O,"aria-required":s,"data-state":Sy(O),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:x,onClick:Xe(e.onClick,k=>{R(F=>!F),A&&(y.current=k.isPropagationStopped(),y.current||k.stopPropagation())})}),A&&b.jsx(g7,{control:p,bubbles:!y.current,name:n,value:c,checked:O,required:s,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});wy.displayName=Hd;var by="SwitchThumb",xy=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=m7(by,r);return b.jsx(Yt.span,{"data-state":Sy(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});xy.displayName=by;var g7=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,o=P.useRef(null),s=Sv(r),a=Ed(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]),b.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 Sy(e){return e?"checked":"unchecked"}var v7=wy,y7=xy;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:hu,radius:Od},Ey=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(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},ys(n)),style:o},P.createElement(v7,{"data-accent-color":c,...d,ref:t,className:Xt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(y7,{className:Xt("rt-SwitchThumb",{"rt-high-contrast":u})})))});Ey.displayName="Switch";var Wd=["Enter"," "],w7=["ArrowDown","PageUp","Home"],_y=["ArrowUp","PageDown","End"],b7=[...w7,..._y],x7={ltr:[...Wd,"ArrowRight"],rtl:[...Wd,"ArrowLeft"]},S7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_a="Menu",[Ca,E7,_7]=Av(_a),[Ao,Cy]=us(_a,[_7,au,Ov]),Ma=au(),My=Ov(),[Ty,Ji]=Ao(_a),[C7,Ta]=Ao(_a),Ay=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=wr(o),p=Ad(i);return P.useEffect(()=>{const w=()=>{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",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),b.jsx(iv,{...a,children:b.jsx(Ty,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:b.jsx(C7,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:l,dir:p,modal:s,children:n})})})};Ay.displayName=_a;var M7="MenuAnchor",Gd=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ma(r);return b.jsx(ov,{...i,...n,ref:t})});Gd.displayName=M7;var Kd="MenuPortal",[T7,Iy]=Ao(Kd,{forceMount:void 0}),Oy=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=Ji(Kd,t);return b.jsx(T7,{scope:t,forceMount:r,children:b.jsx(On,{present:r||o.open,children:b.jsx(cv,{asChild:!0,container:i,children:n})})})};Oy.displayName=Kd;var un="MenuContent",[A7,Yd]=Ao(un),Py=P.forwardRef((e,t)=>{const r=Iy(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=Ji(un,e.__scopeMenu),s=Ta(un,e.__scopeMenu);return b.jsx(Ca.Provider,{scope:e.__scopeMenu,children:b.jsx(On,{present:n||o.open,children:b.jsx(Ca.Slot,{scope:e.__scopeMenu,children:s.modal?b.jsx(I7,{...i,ref:t}):b.jsx(O7,{...i,ref:t})})})})}),I7=P.forwardRef((e,t)=>{const r=Ji(un,e.__scopeMenu),n=P.useRef(null),i=rr(t,n);return P.useEffect(()=>{const o=n.current;if(o)return mA(o)},[]),b.jsx(Zd,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Xe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),O7=P.forwardRef((e,t)=>{const r=Ji(un,e.__scopeMenu);return b.jsx(Zd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Zd=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:x,...y}=e,A=Ji(un,r),O=Ta(un,r),R=Ma(r),k=My(r),F=E7(r),[$,H]=P.useState(null),q=P.useRef(null),Y=rr(t,q,A.onContentChange),ne=P.useRef(0),se=P.useRef(""),ae=P.useRef(0),z=P.useRef(null),D=P.useRef("right"),h=P.useRef(0),f=x?JA:P.Fragment,m=x?{as:Si,allowPinchZoom:!0}:void 0,S=_=>{var le,me;const I=se.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=V7(N,I,v),ie=(me=C.find(xe=>xe.textValue===ee))==null?void 0:me.ref.current;(function xe(be){se.current=be,window.clearTimeout(ne.current),be!==""&&(ne.current=window.setTimeout(()=>xe(""),1e3))})(I),ie&&setTimeout(()=>ie.focus())};P.useEffect(()=>()=>window.clearTimeout(ne.current),[]),iA();const M=P.useCallback(_=>{var C,g;return D.current===((C=z.current)==null?void 0:C.side)&&q7(_,(g=z.current)==null?void 0:g.area)},[]);return b.jsx(A7,{scope:r,searchRef:se,onItemEnter:P.useCallback(_=>{M(_)&&_.preventDefault()},[M]),onItemLeave:P.useCallback(_=>{var I;M(_)||((I=q.current)==null||I.focus(),H(null))},[M]),onTriggerLeave:P.useCallback(_=>{M(_)&&_.preventDefault()},[M]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:P.useCallback(_=>{z.current=_},[]),children:b.jsx(f,{...m,children:b.jsx(Bv,{asChild:!0,trapped:i,onMountAutoFocus:Xe(o,_=>{var I;_.preventDefault(),(I=q.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:b.jsx(ld,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:p,onDismiss:w,children:b.jsx(tA,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:n,currentTabStopId:$,onCurrentTabStopIdChange:H,onEntryFocus:Xe(c,_=>{O.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:b.jsx(sv,{role:"menu","aria-orientation":"vertical","data-state":Yy(A.open),"data-radix-menu-content":"",dir:O.dir,...R,...y,ref:Y,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=q.current;if(_.target!==N||!b7.includes(_.key))return;_.preventDefault();const ie=F().filter(le=>!le.disabled).map(le=>le.ref.current);_y.includes(_.key)&&ie.reverse(),F7(ie)}),onBlur:Xe(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(ne.current),se.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}}))})})})})})})});Py.displayName=un;var P7="MenuGroup",Xd=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Yt.div,{role:"group",...n,ref:t})});Xd.displayName=P7;var R7="MenuLabel",Ry=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Yt.div,{...n,ref:t})});Ry.displayName=R7;var Iu="MenuItem",Ny="menu.itemSelect",Ou=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=P.useRef(null),s=Ta(Iu,e.__scopeMenu),a=Yd(Iu,e.__scopeMenu),c=rr(t,o),u=P.useRef(!1),l=()=>{const d=o.current;if(!r&&d){const p=new CustomEvent(Ny,{bubbles:!0,cancelable:!0});d.addEventListener(Ny,w=>n==null?void 0:n(w),{once:!0}),M1(d,p),p.defaultPrevented?u.current=!1:s.onClose()}};return b.jsx(jy,{...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===" "||Wd.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Ou.displayName=Iu;var jy=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,s=Yd(Iu,r),a=My(r),c=P.useRef(null),u=rr(t,c),[l,d]=P.useState(!1),[p,w]=P.useState("");return P.useEffect(()=>{const x=c.current;x&&w((x.textContent??"").trim())},[o.children]),b.jsx(Ca.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:b.jsx(rA,{asChild:!0,...a,focusable:!n,children:b.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(x=>{n?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Xe(e.onPointerLeave,Ia(x=>s.onItemLeave(x))),onFocus:Xe(e.onFocus,()=>d(!0)),onBlur:Xe(e.onBlur,()=>d(!1))})})})}),N7="MenuCheckboxItem",ky=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return b.jsx(Fy,{scope:e.__scopeMenu,checked:r,children:b.jsx(Ou,{role:"menuitemcheckbox","aria-checked":Pu(r)?"mixed":r,...i,ref:t,"data-state":eh(r),onSelect:Xe(i.onSelect,()=>n==null?void 0:n(Pu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});ky.displayName=N7;var Dy="MenuRadioGroup",[j7,k7]=Ao(Dy,{value:void 0,onValueChange:()=>{}}),By=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,o=wr(n);return b.jsx(j7,{scope:e.__scopeMenu,value:r,onValueChange:o,children:b.jsx(Xd,{...i,ref:t})})});By.displayName=Dy;var Ly="MenuRadioItem",$y=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=k7(Ly,e.__scopeMenu),o=r===i.value;return b.jsx(Fy,{scope:e.__scopeMenu,checked:o,children:b.jsx(Ou,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":eh(o),onSelect:Xe(n.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,r)},{checkForDefaultPrevented:!1})})})});$y.displayName=Ly;var Jd="MenuItemIndicator",[Fy,D7]=Ao(Jd,{checked:!1}),Uy=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,o=D7(Jd,r);return b.jsx(On,{present:n||Pu(o.checked)||o.checked===!0,children:b.jsx(Yt.span,{...i,ref:t,"data-state":eh(o.checked)})})});Uy.displayName=Jd;var B7="MenuSeparator",Vy=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Vy.displayName=B7;var L7="MenuArrow",zy=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ma(r);return b.jsx(av,{...i,...n,ref:t})});zy.displayName=L7;var Qd="MenuSub",[$7,qy]=Ao(Qd),Hy=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,o=Ji(Qd,t),s=Ma(t),[a,c]=P.useState(null),[u,l]=P.useState(null),d=wr(i);return P.useEffect(()=>(o.open===!1&&d(!1),()=>d(!1)),[o.open,d]),b.jsx(iv,{...s,children:b.jsx(Ty,{scope:t,open:n,onOpenChange:d,content:u,onContentChange:l,children:b.jsx($7,{scope:t,contentId:ga(),triggerId:ga(),trigger:a,onTriggerChange:c,children:r})})})};Hy.displayName=Qd;var Aa="MenuSubTrigger",Wy=P.forwardRef((e,t)=>{const r=Ji(Aa,e.__scopeMenu),n=Ta(Aa,e.__scopeMenu),i=qy(Aa,e.__scopeMenu),o=Yd(Aa,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]),b.jsx(Gd,{asChild:!0,...u,children:b.jsx(jy,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":Yy(r.open),...e,ref:Xc(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,x;l();const p=(w=r.content)==null?void 0:w.getBoundingClientRect();if(p){const y=(x=r.content)==null?void 0:x.dataset.side,A=y==="right",O=A?-5:5,R=p[A?"left":"right"],k=p[A?"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===" "||x7[n.dir].includes(d.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),d.preventDefault())})})})});Wy.displayName=Aa;var Gy="MenuSubContent",Ky=P.forwardRef((e,t)=>{const r=Iy(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=Ji(un,e.__scopeMenu),s=Ta(un,e.__scopeMenu),a=qy(Gy,e.__scopeMenu),c=P.useRef(null),u=rr(t,c);return b.jsx(Ca.Provider,{scope:e.__scopeMenu,children:b.jsx(On,{present:n||o.open,children:b.jsx(Ca.Slot,{scope:e.__scopeMenu,children:b.jsx(Zd,{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=S7[s.dir].includes(l.key);d&&p&&(o.onOpenChange(!1),(w=a.trigger)==null||w.focus(),l.preventDefault())})})})})})});Ky.displayName=Gy;function Yy(e){return e?"open":"closed"}function Pu(e){return e==="indeterminate"}function eh(e){return Pu(e)?"indeterminate":e?"checked":"unchecked"}function F7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function U7(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function V7(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=U7(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 z7(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 q7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return z7(r,t)}function Ia(e){return t=>t.pointerType==="mouse"?e(t):void 0}var H7=Ay,W7=Gd,G7=Oy,K7=Py,Y7=Xd,Z7=Ry,X7=Ou,J7=ky,Q7=By,e9=$y,t9=Uy,r9=Vy,n9=zy,i9=Hy,o9=Wy,s9=Ky,th="DropdownMenu",[a9,yB]=us(th,[Cy]),kr=Cy(),[c9,Zy]=a9(th),Xy=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 b.jsx(c9,{scope:t,triggerId:ga(),triggerRef:u,contentId:ga(),open:l,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(p=>!p),[d]),modal:a,children:b.jsx(H7,{...c,open:l,onOpenChange:d,dir:n,modal:a,children:r})})};Xy.displayName=th;var Jy="DropdownMenuTrigger",Qy=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=Zy(Jy,r),s=kr(r);return b.jsx(W7,{asChild:!0,...s,children:b.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:Xc(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())})})})});Qy.displayName=Jy;var u9="DropdownMenuPortal",ew=e=>{const{__scopeDropdownMenu:t,...r}=e,n=kr(t);return b.jsx(G7,{...n,...r})};ew.displayName=u9;var tw="DropdownMenuContent",rw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Zy(tw,r),o=kr(r),s=P.useRef(!1);return b.jsx(K7,{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)"}})});rw.displayName=tw;var l9="DropdownMenuGroup",nw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(Y7,{...i,...n,ref:t})});nw.displayName=l9;var f9="DropdownMenuLabel",iw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(Z7,{...i,...n,ref:t})});iw.displayName=f9;var d9="DropdownMenuItem",ow=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(X7,{...i,...n,ref:t})});ow.displayName=d9;var h9="DropdownMenuCheckboxItem",sw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(J7,{...i,...n,ref:t})});sw.displayName=h9;var p9="DropdownMenuRadioGroup",aw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(Q7,{...i,...n,ref:t})});aw.displayName=p9;var m9="DropdownMenuRadioItem",cw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(e9,{...i,...n,ref:t})});cw.displayName=m9;var g9="DropdownMenuItemIndicator",uw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(t9,{...i,...n,ref:t})});uw.displayName=g9;var v9="DropdownMenuSeparator",lw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(r9,{...i,...n,ref:t})});lw.displayName=v9;var y9="DropdownMenuArrow",w9=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(n9,{...i,...n,ref:t})});w9.displayName=y9;var b9=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 b.jsx(i9,{...s,open:a,onOpenChange:c,children:r})},x9="DropdownMenuSubTrigger",fw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(o9,{...i,...n,ref:t})});fw.displayName=x9;var S9="DropdownMenuSubContent",dw=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return b.jsx(s9,{...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)"}})});dw.displayName=S9;var E9=Xy,_9=Qy,hw=ew,C9=rw,M9=nw,T9=iw,A9=ow,I9=sw,O9=aw,P9=cw,pw=uw,R9=lw,N9=b9,j9=fw,k9=dw;const rh={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Od,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},nh=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(e),{className:i,style:o,type:s,scrollHideDelay:a=s!=="scroll"?0:void 0,dir:c,size:u=rh.size.default,radius:l=rh.radius.default,scrollbars:d=rh.scrollbars.default,...p}=r;return P.createElement(l7,{type:s,scrollHideDelay:a,className:Xt("rt-ScrollAreaRoot",i,ys(n)),style:o},P.createElement(f7,{...p,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),d!=="vertical"?P.createElement(vy,{"data-radius":l,orientation:"horizontal",className:Xt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(yy,{className:"rt-ScrollAreaThumb"})):null,d!=="horizontal"?P.createElement(vy,{"data-radius":l,orientation:"vertical",className:Xt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},P.createElement(yy,{className:"rt-ScrollAreaThumb"})):null,d==="both"?P.createElement(d7,{className:"rt-ScrollAreaCorner"}):null)});nh.displayName="ScrollArea";const ih={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:xa,highContrast:hu},mw={color:xa,shortcut:{type:"string",default:void 0}},gw=e=>P.createElement(E9,{...e});gw.displayName="DropdownMenuRoot";const vw=P.forwardRef((e,t)=>P.createElement(_9,{...e,ref:t,asChild:!0}));vw.displayName="DropdownMenuTrigger";const yw=P.createContext({}),ww=P.forwardRef((e,t)=>{const r=CT(),{className:n,children:i,size:o=ih.size.default,variant:s=ih.variant.default,highContrast:a=ih.highContrast.default,color:c=mw.color.default,container:u,forceMount:l,...d}=e,p=c??r.accentColor;return P.createElement(hw,{container:u,forceMount:l},P.createElement(du,{asChild:!0},P.createElement(C9,{"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(nh,{type:"auto"},P.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(yw.Provider,{value:P.useMemo(()=>({size:o,variant:s,color:p,highContrast:a}),[o,s,p,a])},i))))))});ww.displayName="DropdownMenuContent";const bw=P.forwardRef((e,t)=>P.createElement(T9,{...e,ref:t,className:Xt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));bw.displayName="DropdownMenuLabel";const xw=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=mw.color.default,shortcut:o,...s}=e;return P.createElement(A9,{"data-accent-color":i,...s,ref:t,className:Xt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(ls,null,n),o&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},o))});xw.displayName="DropdownMenuItem";const Sw=P.forwardRef((e,t)=>P.createElement(M9,{...e,ref:t,className:Xt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Sw.displayName="DropdownMenuGroup";const Ew=P.forwardRef((e,t)=>P.createElement(O9,{...e,ref:t,className:Xt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Ew.displayName="DropdownMenuRadioGroup";const _w=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement(P9,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(ls,null,r),P.createElement(pw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(mu,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});_w.displayName="DropdownMenuRadioItem";const Cw=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...o}=e;return P.createElement(I9,{...o,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(ls,null,r),P.createElement(pw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(mu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Cw.displayName="DropdownMenuCheckboxItem";const Mw=e=>P.createElement(N9,{...e});Mw.displayName="DropdownMenuSub";const Tw=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(j9,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(ls,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement(Tv,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});Tw.displayName="DropdownMenuSubTrigger";const Aw=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(yw);return P.createElement(hw,{container:i,forceMount:o},P.createElement(du,{asChild:!0},P.createElement(k9,{"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(nh,{type:"auto"},P.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});Aw.displayName="DropdownMenuSubContent";const Iw=P.forwardRef((e,t)=>P.createElement(R9,{...e,ref:t,className:Xt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));Iw.displayName="DropdownMenuSeparator";const ln=Object.assign({},{Root:gw,Trigger:vw,Content:ww,Label:bw,Item:xw,Group:Sw,RadioGroup:Ew,RadioItem:_w,CheckboxItem:Cw,Sub:Mw,SubTrigger:Tw,SubContent:Aw,Separator:Iw}),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:hu,radius:Od},Ow=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(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?Si:"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},ys(n))})});Ow.displayName="BaseButton";const Pw=P.forwardRef((e,t)=>P.createElement(Ow,{...e,ref:t,className:Xt("rt-Button",e.className)}));Pw.displayName="Button";const D9={loading:{type:"boolean",default:!0}},Cs=P.forwardRef((e,t)=>{const{rest:r,...n}=vs(e),{className:i,children:o,loading:s=D9.loading.default,...a}=r;if(!s)return P.createElement(P.Fragment,null,o);const c=P.isValidElement(o)?Si:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:Xt("rt-Skeleton",i,ys(n)),"data-inline-skeleton":P.isValidElement(o)?void 0:!0,tabIndex:-1,inert:"",...a},o)});Cs.displayName="Skeleton";const B9=$t("/images/ghost_loading.png"),L9={primary:$t("/images/primary_loading.png"),ghost:B9};function $9({size:e="24px",variant:t="primary",wrapStyle:r={}}){return b.jsx(xv,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:b.jsx("img",{src:L9[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const F9="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==",oh="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 Hr({src:e,alt:t,className:r,style:n,showWarn:i,...o}){const[s,a]=te.useState(oh),c=u=>{a(oh)};return te.useEffect(()=>{a(e||oh)},[e]),b.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[b.jsx("img",{src:s,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...o}),i&&b.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:F9})]})}function U9({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:o}=e,{getExplorerUrl:s}=cs(),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 b.jsxs("div",{className:"cs-toast",children:[b.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[b.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&b.jsx("div",{children:b.jsx($9,{})}),b.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&b.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&b.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&b.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&b.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&b.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&b.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&b.jsx(_1,{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"&&b.jsxs(b.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&b.jsx("span",{children:"Something went wrong"})]}),r==="success"&&b.jsx(b.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&b.jsxs("div",{className:"view-transaction",children:[b.jsx("span",{children:"View Transaction"}),Kc.map(u=>b.jsx("a",{href:s(i,"tx",u.link),target:"_blank",children:b.jsx(Hr,{src:u.img})},u.link))]})]}),b.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(o),children:b.jsx("use",{xlinkHref:"#icon-close"})})]})}const V9=xi((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)}))}})),Ms=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=V9(),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(b.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>b.jsx(U9,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:o,ToastContainer:s,removeToast:n}},MB="";function z9(){const{mevProtect:e,setMevProtect:t}=$r();return b.jsxs(ln.Root,{children:[b.jsx(ln.Trigger,{children:b.jsx("div",{className:"cs-settings-btn",children:b.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:b.jsx("use",{xlinkHref:"#icon-mev"})})})}),b.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:b.jsxs("div",{className:"mev-settings-box",children:[b.jsxs("div",{className:"mev-setting-title",children:[b.jsxs("div",{className:"name",children:[b.jsx("img",{src:$t("/images/icon_mev@2x.png")}),b.jsx("span",{children:"MEV Protect"})]}),b.jsx(Ey,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),b.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 q9({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return b.jsx("div",{className:"refresh-button",children:b.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:b.jsx("use",{xlinkHref:"#icon-refresh"})})})}const TB="",AB="";function sh(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,o=()=>{r&&r()};return b.jsx(Pw,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:o,children:t})}function H9(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=$r();return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-verticalslider"})}),b.jsxs("span",{children:[r,"%"]})]}),t&&b.jsx(W9,{onClose:()=>e(!1)})]})}function W9({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 b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),b.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:b.jsxs("div",{className:"slippage-settings",children:[b.jsxs("div",{className:"slippage-settings-header",children:[b.jsx("div",{className:"title",children:"Slippage Settings"}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:b.jsx("use",{xlinkHref:"#icon-close"})})]}),b.jsxs("div",{className:"title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-verticalslider"})}),b.jsx("span",{children:"Slippage Tolerance"})]}),b.jsxs("div",{className:"form-box",children:[b.jsx("div",{className:"slippage-tab-list",children:c5.map(u=>b.jsxs("span",{className:u.display===n?"active":"",onClick:()=>o(u),children:[u.display," %"]}))}),b.jsxs("div",{className:"input-box",children:[b.jsx("span",{children:"Custom"}),b.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:s}),b.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&b.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&b.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&b.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),b.jsx(sh,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function G9({handleRefresh:e}){return b.jsx(b.Fragment,{children:b.jsxs("div",{className:"swap-header",children:[b.jsx("h3",{className:"swap-title",children:"Swap"}),b.jsxs("div",{className:"right",children:[b.jsx(H9,{}),b.jsx(z9,{}),b.jsx(q9,{onClick:e})]})]})})}const IB="",OB="";function K9(){const[e,t]=te.useState(!1);return b.jsxs(ln.Root,{open:e,onOpenChange:t,children:[b.jsx(ln.Trigger,{children:b.jsx("div",{className:"cs-settings-btn",children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-settings"})})})}),b.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:b.jsxs("div",{className:"cs-settings-box",children:[b.jsx("h3",{children:"Settings"}),b.jsx(Y9,{}),b.jsx(X9,{onClose:()=>{t(!1)}})]})})]})}function Y9(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=$r(),i=o=>{t(o)};return b.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[b.jsxs("h3",{className:"card-title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-plorer"})}),b.jsx("span",{children:"Preferred Explorer"})]}),b.jsx("div",{className:"explorer-checkbox-group",children:Kc.map(o=>b.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(o.link),children:[b.jsx(gu,{color:"indigo",checked:o.link===e,variant:"soft",className:"cs-checkbox"}),b.jsx("img",{src:o.img}),b.jsx("span",{children:o.name})]}))})]})}const Z9=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function X9({onClose:e}){const{addTxToast:t}=Ms(),{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)},x=()=>{if(a){const y={name:"Custom RPC URL",link:a,isCustom:!0};o(a),n(y),d(a),e()}};return b.jsxs("div",{className:"settings-card rpc-settings-card",children:[b.jsxs("h3",{className:"card-title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-settings"})}),b.jsx("span",{children:"RPC Node"})]}),b.jsxs("div",{className:"rpc-checkbox-group",children:[s.map(y=>b.jsxs("div",{className:"rpc-item",onClick:()=>p(y),children:[b.jsx(gu,{color:"indigo",checked:u.name===y.name,variant:"soft",className:"cs-checkbox"}),b.jsx("span",{children:y.name})]})),u.isCustom&&b.jsxs("div",{className:"custom-rpc-input-box",children:[b.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:w,value:a}),b.jsx(sh,{btnIsDisabled:Z9(a),text:"Save",onClick:x})]})]})]})}const PB="",Pn=xi((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 J9=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()}},Q9=J9,Rw={"text/plain":"Text","text/html":"Url",default:"Text"},eI="Copy to clipboard: #{key}, Enter";function tI(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function rI(e,t){var r,n,i,o,s,a,c=!1;t||(t={}),r=t.debug||!1;try{i=Q9(),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=Rw[t.format]||Rw.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=tI("message"in t?t.message:eI),window.prompt(n,e)}}finally{s&&(typeof s.removeRange=="function"?s.removeRange(o):s.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var nI=rI;const Nw=ks(nI);function iI({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 b.jsxs("div",{className:"cs-account-switch",children:[b.jsxs("div",{className:"account",onClick:o,children:[b.jsx("span",{children:Eo(e)}),(s==null?void 0:s.length)>0&&b.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-unfold"})})]}),b.jsx("div",{className:`account-list ${n?"open":"close"}`,children:s.map(c=>b.jsxs("div",{className:"account-item",children:[b.jsxs("div",{className:"left",children:[b.jsx("div",{className:"label",children:c==null?void 0:c.label}),b.jsx("div",{className:"address",children:Eo(c==null?void 0:c.address)})]}),b.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const oI=te.forwardRef(({connect:e})=>{const t=Ur.useCurrentAccount();return b.jsx("div",{children:t?b.jsx(sI,{}):b.jsx(sh,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function sI(){const{mutate:e}=Ur.useDisconnectWallet(),t=Ur.useCurrentAccount(),{currentWallet:r}=Ur.useCurrentWallet(),{addCommonToast:n}=Ms(),{getExplorerUrl:i}=cs(),o=()=>{t&&(Nw(t.address||"",{debug:!1,message:"message"}),n("Copied"))},s=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),b.jsxs(ln.Root,{children:[b.jsx(ln.Trigger,{children:b.jsxs("div",{className:"cs-connected-button",children:[b.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),b.jsx("span",{children:Eo(t==null?void 0:t.address)})]})}),b.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:b.jsxs("div",{className:"account-op-box",children:[b.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),b.jsx(iI,{currentAccount:t==null?void 0:t.address}),b.jsxs("div",{className:"account-op-item",onClick:o,style:{marginTop:"12px"},children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-copy"})}),b.jsx("span",{children:"Copy address"})]}),b.jsxs("div",{className:"account-op-item",onClick:s,children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-link"})}),b.jsx("span",{children:"Open explorer"})]}),b.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-disconnect"})}),b.jsx("span",{children:"Disconnect"})]})]})})]})}function aI(){Ur.useCurrentAccount(),Ur.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Pn();return Ur.useWallets(),b.jsx(b.Fragment,{children:b.jsx(Ur.ConnectModal,{trigger:b.jsx(oI,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function cI({independentWallet:e,customWallet:t}){return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"widget-header",children:[b.jsx("img",{src:$t("/images/logo@2x.png"),className:"cetus-logo"}),b.jsxs("div",{className:"right",children:[e&&b.jsx(aI,{}),b.jsx(K9,{})]})]}),b.jsx("div",{style:{marginTop:"20px"}})]})}const RB="",jw=()=>{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 b.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:b.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)=>b.jsx("div",{style:t(i),children:b.jsx("div",{style:r})},i))})})};function uI({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,o=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return b.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&b.jsx(lI,{info:o,status:r}),(r==="success"||r==="rejected")&&b.jsx(fI,{info:o,status:r,tx:i,onClose:e})]})}function lI({info:e,status:t}){return b.jsxs("div",{className:"progress-dialog",children:[b.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),b.jsx("div",{className:"loading-box",children:b.jsx(jw,{})}),b.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),b.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function fI({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=cs();return b.jsxs("div",{className:"finally-status-dialog",children:[b.jsxs("div",{className:"center-content",children:[b.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[b.jsx("div",{className:"status-icon-box",children:b.jsx("div",{className:"status-icon",children:b.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?b.jsx("use",{xlinkHref:"#icon-sel"}):b.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?b.jsx("span",{children:"Swap Success"}):b.jsx("span",{children:"Swap failed"})]}),b.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&b.jsxs("div",{className:"view-transaction",children:[b.jsx("span",{children:"View Transaction"}),Kc.map(o=>b.jsx("a",{href:i(r,"tx",o.link),target:"_blank",children:b.jsx("img",{src:o.img})},o.link))]})]}),b.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Ru(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await o5(`${i||Zc.api}${t}`,n):await s5(`${i||Zc.api}${t}`,n)}catch(o){throw o}}}}function dI(){const{fetchByApi:e}=Ru(),{setProviders:t}=$r();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function hI({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=xi((e,t)=>({suiClient:new na({url:Zc.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new Hg,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),Ts=xi((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]})),bi.setItem(sd,s)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||bi.setItem(sd,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||bi.setItem(g1,r)}}));bi.getItem(sd).then(e=>{e!==null&&Ts.getState().setTokenMap(e,!0)}),bi.getItem(g1).then(e=>{e!==null&&Ts.getState().setTrustedTokenList(e,!0)});function pI(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 Qi(){const{suiClient:e}=Io(),{fetchByApi:t}=Ru(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:o,addRequestTokenList:s,setTrustedTokenList:a}=Ts(),c=async()=>{var x;const d=await t("/v2/sui/coins_info","GET"),p=[],w=(x=d==null?void 0:d.list)==null?void 0:x.reduce((y,A)=>(y.set(A.coin_type,A),A.is_trusted&&p.push({...A,coin_type:Rr(A.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){Kg(d)&&(w.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const x=pI(w,d);return i(x),x}}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 Nu(e){const{suiClient:t}=Io(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Pn(),{fetchTokenInfo:o}=Qi(),[s,a]=te.useState([]),{tokenMap:c}=Ts(),u=async(w=(r==null?void 0:r.address)||"",x)=>{try{if(!w){l();return}let y=[];x?y=[await t.getBalance({owner:w,coinType:x})]: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 x={};for(let y=0;y<(w==null?void 0:w.length);y++)try{const A=w[y],O=await o(A.coinType),R=QC(A.totalBalance,O==null?void 0:O.decimals),k=jr(R,4);x[Rr(A.coinType).full_address]={...A,displayBalance:k,totalBalanceFormat:R}}catch{continue}n(x)},p=te.useMemo(()=>{if(e&&r)return i[e]||i[Rr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:p}}const fn=xi((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}))}})),mI={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"}},kw={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"}},Dw=mI;function gI(e,t){const{fetchTokenInfo:r}=Qi(),{setFromCoin:n,setToCoin:i,setDefaultCoin:o}=fn(),{setSlippage:s,setRpcList:a,setCurrentRpc:c}=$r(),{tokenMapIsInit:u}=Ts(),l=te.useRef({}),d=async(w,x)=>{const y=w?await r(w):kw,A=x?await r(x):Dw;n(y),i(A),o(y==null?void 0:y.coin_type,A==null?void 0:A.coin_type)},p=(w,x)=>{const y=[Yc[0]];let A=Yc[0];w.forEach(O=>{const R={name:O,link:O,isCustom:!1};y.push(R),O===x&&(A=R)}),a([...y,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(A)};return te.useEffect(()=>{if(u&&!od(e,l.current)){const{defaultFromToken:w,defaultToToken:x,defaultSlippage:y,customRpcList:A,defaultRpc:O}=e;d(w,x),y&&s(y),(A==null?void 0:A.length)>0&&p(A,O),l.current=e}},[e,u]),{handleSetDefaultPair:d}}function vI(){const{currentRpc:e}=$r(),{setSuiClient:t,setAggregatorSDK:r}=Io(),{currentAccount:n}=Pn();te.useEffect(()=>{if(e){const i=new na({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new Hg(Zc.aggregatorUrl,(n==null?void 0:n.address)||void 0,new na({url:e.link}),Wg.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const Bw=xi((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 ju(){const{fetchByApi:e}=Ru(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Bw(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>yi(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 ah=xi((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 yI(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 ch;const wI=new Uint8Array(16);function bI(){if(!ch){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ch=crypto.getRandomValues.bind(crypto)}return ch(wI)}const Lw={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function $w(e,t,r){if(Lw.randomUUID&&!t&&!e)return Lw.randomUUID();e=e||{};const n=e.random||(e.rng||bI)();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 yI(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 xI=new na({url:n0("mainnet")}),SI=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],EI=["deny_list","DenyList","DenyCap","create_regulated_currency"],_I={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},CI=async e=>{let t=!1;if(SI.includes(e))return t;const r=e.split("::"),n=r[0]&&Rt(r[0]),i=r[1],o=await xI.getObject({id:n,options:_I}),s="disassembled"in o.data.content?o.data.content.disassembled[i]:null;return s&&typeof s=="string"&&new RegExp(EI.join("|"),"i").test(s)&&(t=!0),t},MI=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>yi(i,!1)))==null?void 0:n.join(",")};function TI(){const{fetchByApi:e}=Ru(),t=async n=>{try{const i={...n},o=MI(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=$t("/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(x=>_n(x).source_address);d=l==null?void 0:l.filter(x=>{var O,R;const y=_n((O=x==null?void 0:x.coin_a)==null?void 0:O.address).source_address,A=_n((R=x==null?void 0:x.coin_b)==null?void 0:R.address).source_address;return(w==null?void 0:w.length)>1&&w.includes(y)&&w.includes(A)?!0:!!((w==null?void 0:w.length)===1&&(w.includes(y)||w.includes(A)))})}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 AI(e=!0){const{poolApiMap:t,setPoolApiMap:r}=$r(),{getPoolList:n,getLocalJsonPoolList:i}=TI();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 II(e){const{routerData:t}=fn();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 Fw(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 OI(e){const{getTokenInfo:t,fetchTokenInfo:r}=Qi();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 x=[];l.path.forEach(y=>{i.includes(y.provider)||i.push(y.provider);const A=Rr(y.from).full_address,O=Rr(y.target).full_address,R=t(A),k=t(O);R||a.includes(A)&&a.push(A),k||a.includes(O)&&a.push(O);const F=y.provider===ma.SCALLOP||y.provider===ma.FLOWX||y.provider===ma.FLOWXV3;x.push({from_type:A,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 PI(){const{fromCoin:e,toCoin:t}=fn(),{getPoolListByCoinType:r}=AI();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(s=>s.address):[]}}function Uw(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 Vw(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await CI(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 RI(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=fn(),{getTokenInfo:i}=Qi(),{ignoreWarnTokenMap:o}=$r(),s=i(e),a=i(t),c=te.useMemo(()=>!Wc(r,kw.coin_type)||!Wc(n,Dw.coin_type),[r,n]),u=te.useCallback(d=>d&&!o[yi(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 NI(){const{aggregatorSDK:e}=Io(),{getSwapPoolAddress:t}=PI(),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 xp(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(),x={from:s.coin_type,target:a.coin_type,amount:new xp(c),byAmountIn:l,pools:w};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,w=id(l.amountIn.toString(),c.decimals).toString(),x=id(l.amountOut.toString(),u.decimals).toString();return{routerData:p?void 0:l,fromAmountUi:p?s?w:"":w,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 As(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function jI(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function kI(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function DI(e){return!!String(e).includes("Could not find the referenced transaction")}function BI(e){return jI(e)?"User rejected the request":kI(e)?"Exceeded price slippage":DI(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var uh={};Object.defineProperty(uh,"__esModule",{value:!0});var LI=uh.executeAuction=zw,$I=sm,FI="https://rpc.getshio.com",UI=500,VI=300;function zw(e,t,r){r===void 0&&(r=UI);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,o){setTimeout(i,r),$I.default.post(FI,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(s){console.log("Shio executeAuction response:",s.data),setTimeout(i,VI)}).catch(o)})}uh.default={executeAuction:zw};function zI(){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 x=await e.devInspectTransactionBlock({transactionBlock:Ho.from(Ar(c)),sender:t.address});if(!x||((p=x.effects)==null?void 0:p.status.status)==="failure")throw Error((w=x.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=Ho.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,x)=>{n({transaction:l,chain:i},{onSuccess:y=>{w(y)},onError:y=>{console.error("signAndExecuteTransactionBlock transaction failed",y),x(y)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Ho.from(c)),typeof c=="string"&&(c=Ho.from(Ar(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,x)=>{console.error("signTransactionBlock onSettled",{data:d,error:p,variables:w})}})})),executeTransactionBlock:o}}function qI(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=zI(),{currentAccount:n}=Pn(),{suiClient:i}=Io(),{setTransactionData:o}=ah(),{addTxToast:s,removeToast:a}=Ms(),c=5,u=2e3;async function l(w,x=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 ${x} failed:`,y),x>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await p1(u),l(w,x+1)}}const d=async(w,x,y={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,$;const{useDevInspect:A=!1,useMev:O,txAction:R="signTransactionBlock"}=y;let k;x.status="confirmation",o(x);try{let H;if(R==="signTransactionBlock"){const Y=await e(w),{bytes:ne,signature:se}=Y;if(O)try{const ae=await LI(ne,se,500)}catch{}H=await t(ne,se,A)}else H=await r(w,A);x.status="submitted",o({...x}),x.tx=H.digest,k=s(x),await p1(u);const q=await l(H.digest,0);if(!q||((F=q.effects)==null?void 0:F.status.status)==="failure")p(x,($=q.effects)==null?void 0:$.status.error);else{const Y=i5(q,n==null?void 0:n.address,!1);if(x.buildShowInfo){const ne=x.buildShowInfo("success",Y);x.buildShowInfo=se=>ne}a(k),x.status="success",o({...x})}return q}catch(H){p(x,H)}},p=(w,x)=>{const y=BI(x);if(w.buildShowInfo){const A=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(A.toastDescriptionContent=y,A.modalDescriptionText=y,A),w.status="rejected",o({...w})}else w.buildShowInfo=A=>{const O={};return O.toastDescriptionContent=y,O.modalDescriptionText=y,O},w.status="rejected",o({...w})};return{signAndExecuteTransaction:d}}function lh(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 HI(){const{aggregatorSDK:e}=Io(),{findBestRouters:t}=NI(),{getTokenAmountValue:r,fetchTokenPrices:n}=ju(),{providers:i,slippage:o,mevProtect:s}=$r(),{signAndExecuteTransaction:a}=qI(),{setTransactionData:c}=ah(),{addTxToast:u}=Ms(),{fromCoin:l,toCoin:d,setFromCoin:p,setToCoin:w,setToAmount:x,fromAmount:y,toAmount:A,setFromAmount:O,setFindRouterLoading:R,setRouterData:k,setByAmountIn:F,byAmountIn:$}=fn(),[H,q]=te.useState(""),Y=As(H),ne=As($),se=As(y),ae=As(A),z=As(l),D=As(d),{balanceInfo:h,getOwnerCoinBalances:f}=Nu(l==null?void 0:l.coin_type),{balanceInfo:m}=Nu(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,A),I=lh(async(be,Ve,Le)=>{if(z.current&&D.current&&+be){(+se.current||+ae.current)&&R(!0);const ft=t5(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),Y.current===Le&&(Ve?+se.current?(x(dt.toAmountUi||""),k(dt)):x(""):+ae.current?(O(dt.fromAmountUi||"ß"),k(dt)):O(""))}else v(!Ve)},500),C=(be,Ve,Le=!1)=>{if(F(Ve),Ve?(O(be),Le&&x("")):(x(be),Le&&O("")),+be){const ft=$w();q(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(""),x("")):be?O(""):x(""),R(!1),k(void 0)},N=()=>{const be=ne.current?se.current:ae.current;if(+be){const Ve=$w();q(Ve),I(be,ne.current,Ve)}},ee=async(be,Ve)=>{const{routerData:Le,byAmountIn:ft,fromAmountUi:dt,toAmountUi:je}=be,pt=new Ho,we={routers:Le,slippage:Number(o)/100,txb:pt,partner:Ve||u5};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}`,Ae={modalDescriptionText:Me,toastTitleText:Me};if(Ue==="success"){let Be=dt,ut=je;Ne&&(Be=m1(Ne,l)||dt,ut=m1(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}`;Ae.toastTitleText=lt,Ae.modalDescriptionText=lt}return Ae},id:0};c(he),await a(pt,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}=Vw(l),{isScamsCoin:me}=Vw(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 WI(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:o}=fn(),{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 ${an(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 qw({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 b.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[b.jsx("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:n,strokeWidth:t}),b.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"}}),b.jsx("style",{children:`
98
94
  @keyframes dash {
99
95
  0% {
100
96
  stroke-dashoffset: 0; /* 从起点开始 */
101
97
  }
102
98
  100% {
103
- stroke-dashoffset: -${o}; /* 一圈 */
99
+ stroke-dashoffset: -${s}; /* 一圈 */
104
100
  }
105
101
  }
106
- `})]})}function M0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=te.useState(!0),a=i8(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Gr,{src:s?e.logo_url:t.logo_url}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",ln(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(oa,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):jr(a,t.decimals)," ",ln(s?t.symbol:e.symbol)]}),_.jsx(Gr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Wl(){const[e,t]=te.useState(window.innerWidth),r=A0(()=>{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 c8(e,t,r,n){const{getTokenPrice:i}=ql(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=i8(!0,r,n),c=te.useMemo(()=>{if(o&&s)return Le(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=te.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const b=[];return s&&b.push(s.market),o&&!b.includes(o.market)&&b.push(o.market),b},[s==null?void 0:s.market,o==null?void 0:o.market]),f=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),h=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]),y=te.useMemo(()=>{let b,w="yellow";if(u)if(Le(u).gt(0))w="green",Le(u).lt(.1)?b="< 0.1% cheaper than":b=`${jr(u,2,!0,Br.ROUND_UP)}% cheaper than`;else if(Le(u).eq(0))b="0%",w="green";else{const T=Le(u).abs();T.lte(5)?(w="green",b=`Within ${jr(T.toString(),2,!0,Br.ROUND_UP)}%`):T.lte(10)?(w="yellow",b=`${jr(T.toString(),2,!0,Br.ROUND_UP)}% more than`):T.lte(100)?(w="red",b=`${jr(T.toString(),2,!0,Br.ROUND_UP)}% more than`):(w="red",b="> 100% more than")}return{priceImpactText:b,textColor:w}},[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h,priceImpactTextInfo:y}}function Gl({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=te.useState(!1),[o,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{o||(s(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},f=()=>{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{}}},h=te.useRef(null),[y,b]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var w;if(i&&h.current){const T=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,k;r==="top"?(P=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.top-2*T.height-8}px`):r==="bottom"?(P=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.bottom}px`):r==="left"?(P=`${window.scrollX+T.left-8}px`,k=`${window.scrollY+T.top+T.height/2}px`):r==="right"?(P=`${window.scrollX+T.right+8}px`,k=`${window.scrollY+T.top+T.height/2}px`):(P=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.top+T.height/2}px`),b({left:P,top:k})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&Ln.createPortal(_.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)",...f(),...y},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),s(!1)},children:e}),document.body)]})}function u8({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Wl();return i&&n?_.jsxs(hn.Root,{children:[_.jsx(hn.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(hn.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})]}):_.jsx(Gl,{content:e,position:r,children:t})}function l8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=pn();Wl();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l}=c8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Le(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),_.jsx(u8,{autoSwitchTooltip:!0,position:"top",content:_.jsx(KV,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(oa,{style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(Gl,{content:_.jsx("span",{style:{fontSize:"12px"},children:$x[f]}),position:"top",delay:300,children:_.jsx(Gr,{src:mD[f]})},f))})]})]})]})]})}function KV({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=Wl();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:s?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?_.jsx(M0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):_.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(o=>$x[o]+" ").join("")})]})]})}function f8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=pn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(oa,{style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[jr(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Br.ROUND_DOWN)," ",ln(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function XV({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:_.jsx(Ux,{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 JV({onClick:e}){return _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function T0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(JV,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Hl=globalThis||void 0||self;var YV=typeof Hl=="object"&&Hl&&Hl.Object===Object&&Hl;const d8=YV;var ZV=typeof self=="object"&&self&&self.Object===Object&&self,QV=d8||ZV||Function("return this")();const li=QV;var ez=li.Symbol;const fi=ez;var h8=Object.prototype,tz=h8.hasOwnProperty,rz=h8.toString,Ec=fi?fi.toStringTag:void 0;function nz(e){var t=tz.call(e,Ec),r=e[Ec];try{e[Ec]=void 0;var n=!0}catch{}var i=rz.call(e);return n&&(t?e[Ec]=r:delete e[Ec]),i}var iz=Object.prototype,sz=iz.toString;function oz(e){return sz.call(e)}var az="[object Null]",cz="[object Undefined]",p8=fi?fi.toStringTag:void 0;function la(e){return e==null?e===void 0?cz:az:p8&&p8 in Object(e)?nz(e):oz(e)}function _s(e){return e!=null&&typeof e=="object"}var uz="[object Symbol]";function Cc(e){return typeof e=="symbol"||_s(e)&&la(e)==uz}function Kl(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 lz=Array.isArray;const Hr=lz;var fz=1/0,m8=fi?fi.prototype:void 0,g8=m8?m8.toString:void 0;function v8(e){if(typeof e=="string")return e;if(Hr(e))return Kl(e,v8)+"";if(Cc(e))return g8?g8.call(e):"";var t=e+"";return t=="0"&&1/e==-fz?"-0":t}function fa(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function y8(e){return e}var dz="[object AsyncFunction]",hz="[object Function]",pz="[object GeneratorFunction]",mz="[object Proxy]";function b8(e){if(!fa(e))return!1;var t=la(e);return t==hz||t==pz||t==dz||t==mz}var gz=li["__core-js_shared__"];const O0=gz;var w8=function(){var e=/[^.]+$/.exec(O0&&O0.keys&&O0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function vz(e){return!!w8&&w8 in e}var yz=Function.prototype,bz=yz.toString;function to(e){if(e!=null){try{return bz.call(e)}catch{}try{return e+""}catch{}}return""}var wz=/[\\^$.*+?()[\]{}|]/g,_z=/^\[object .+?Constructor\]$/,xz=Function.prototype,Sz=Object.prototype,Ez=xz.toString,Cz=Sz.hasOwnProperty,Az=RegExp("^"+Ez.call(Cz).replace(wz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mz(e){if(!fa(e)||vz(e))return!1;var t=b8(e)?Az:_z;return t.test(to(e))}function Tz(e,t){return e==null?void 0:e[t]}function ro(e,t){var r=Tz(e,t);return Mz(r)?r:void 0}var Oz=ro(li,"WeakMap");const I0=Oz;var _8=Object.create,Iz=function(){function e(){}return function(t){if(!fa(t))return{};if(_8)return _8(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const Pz=Iz;function jz(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var kz=function(){try{var e=ro(Object,"defineProperty");return e({},"",{}),e}catch{}}();const x8=kz;function Nz(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Rz=9007199254740991,Dz=/^(?:0|[1-9]\d*)$/;function S8(e,t){var r=typeof e;return t=t??Rz,!!t&&(r=="number"||r!="symbol"&&Dz.test(e))&&e>-1&&e%1==0&&e<t}function E8(e,t,r){t=="__proto__"&&x8?x8(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function P0(e,t){return e===t||e!==e&&t!==t}var $z=Object.prototype,Bz=$z.hasOwnProperty;function C8(e,t,r){var n=e[t];(!(Bz.call(e,t)&&P0(n,r))||r===void 0&&!(t in e))&&E8(e,t,r)}function Xl(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?E8(r,a,c):C8(r,a,c)}return r}var Lz=9007199254740991;function j0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Lz}function Jl(e){return e!=null&&j0(e.length)&&!b8(e)}var Fz=Object.prototype;function k0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Fz;return e===r}function Uz(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Vz="[object Arguments]";function A8(e){return _s(e)&&la(e)==Vz}var M8=Object.prototype,zz=M8.hasOwnProperty,qz=M8.propertyIsEnumerable,Wz=A8(function(){return arguments}())?A8:function(e){return _s(e)&&zz.call(e,"callee")&&!qz.call(e,"callee")};const T8=Wz;function Gz(){return!1}var O8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,I8=O8&&typeof module=="object"&&module&&!module.nodeType&&module,Hz=I8&&I8.exports===O8,P8=Hz?li.Buffer:void 0,Kz=P8?P8.isBuffer:void 0,Xz=Kz||Gz;const Yl=Xz;var Jz="[object Arguments]",Yz="[object Array]",Zz="[object Boolean]",Qz="[object Date]",eq="[object Error]",tq="[object Function]",rq="[object Map]",nq="[object Number]",iq="[object Object]",sq="[object RegExp]",oq="[object Set]",aq="[object String]",cq="[object WeakMap]",uq="[object ArrayBuffer]",lq="[object DataView]",fq="[object Float32Array]",dq="[object Float64Array]",hq="[object Int8Array]",pq="[object Int16Array]",mq="[object Int32Array]",gq="[object Uint8Array]",vq="[object Uint8ClampedArray]",yq="[object Uint16Array]",bq="[object Uint32Array]",Xt={};Xt[fq]=Xt[dq]=Xt[hq]=Xt[pq]=Xt[mq]=Xt[gq]=Xt[vq]=Xt[yq]=Xt[bq]=!0,Xt[Jz]=Xt[Yz]=Xt[uq]=Xt[Zz]=Xt[lq]=Xt[Qz]=Xt[eq]=Xt[tq]=Xt[rq]=Xt[nq]=Xt[iq]=Xt[sq]=Xt[oq]=Xt[aq]=Xt[cq]=!1;function wq(e){return _s(e)&&j0(e.length)&&!!Xt[la(e)]}function Zl(e){return function(t){return e(t)}}var j8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,Ac=j8&&typeof module=="object"&&module&&!module.nodeType&&module,_q=Ac&&Ac.exports===j8,N0=_q&&d8.process,xq=function(){try{var e=Ac&&Ac.require&&Ac.require("util").types;return e||N0&&N0.binding&&N0.binding("util")}catch{}}();const da=xq;var k8=da&&da.isTypedArray,Sq=k8?Zl(k8):wq;const N8=Sq;var Eq=Object.prototype,Cq=Eq.hasOwnProperty;function R8(e,t){var r=Hr(e),n=!r&&T8(e),i=!r&&!n&&Yl(e),s=!r&&!n&&!i&&N8(e),o=r||n||i||s,a=o?Uz(e.length,String):[],c=a.length;for(var u in e)(t||Cq.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||S8(u,c)))&&a.push(u);return a}function D8(e,t){return function(r){return e(t(r))}}var Aq=D8(Object.keys,Object);const Mq=Aq;var Tq=Object.prototype,Oq=Tq.hasOwnProperty;function Iq(e){if(!k0(e))return Mq(e);var t=[];for(var r in Object(e))Oq.call(e,r)&&r!="constructor"&&t.push(r);return t}function Mc(e){return Jl(e)?R8(e):Iq(e)}function Pq(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var jq=Object.prototype,kq=jq.hasOwnProperty;function Nq(e){if(!fa(e))return Pq(e);var t=k0(e),r=[];for(var n in e)n=="constructor"&&(t||!kq.call(e,n))||r.push(n);return r}function R0(e){return Jl(e)?R8(e,!0):Nq(e)}var Rq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dq=/^\w*$/;function D0(e,t){if(Hr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Cc(e)?!0:Dq.test(e)||!Rq.test(e)||t!=null&&e in Object(t)}var $q=ro(Object,"create");const Tc=$q;function Bq(){this.__data__=Tc?Tc(null):{},this.size=0}function Lq(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Fq="__lodash_hash_undefined__",Uq=Object.prototype,Vq=Uq.hasOwnProperty;function zq(e){var t=this.__data__;if(Tc){var r=t[e];return r===Fq?void 0:r}return Vq.call(t,e)?t[e]:void 0}var qq=Object.prototype,Wq=qq.hasOwnProperty;function Gq(e){var t=this.__data__;return Tc?t[e]!==void 0:Wq.call(t,e)}var Hq="__lodash_hash_undefined__";function Kq(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tc&&t===void 0?Hq: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=Bq,no.prototype.delete=Lq,no.prototype.get=zq,no.prototype.has=Gq,no.prototype.set=Kq;function Xq(){this.__data__=[],this.size=0}function Ql(e,t){for(var r=e.length;r--;)if(P0(e[r][0],t))return r;return-1}var Jq=Array.prototype,Yq=Jq.splice;function Zq(e){var t=this.__data__,r=Ql(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Yq.call(t,r,1),--this.size,!0}function Qq(e){var t=this.__data__,r=Ql(t,e);return r<0?void 0:t[r][1]}function eW(e){return Ql(this.__data__,e)>-1}function tW(e,t){var r=this.__data__,n=Ql(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Fi(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])}}Fi.prototype.clear=Xq,Fi.prototype.delete=Zq,Fi.prototype.get=Qq,Fi.prototype.has=eW,Fi.prototype.set=tW;var rW=ro(li,"Map");const Oc=rW;function nW(){this.size=0,this.__data__={hash:new no,map:new(Oc||Fi),string:new no}}function iW(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ef(e,t){var r=e.__data__;return iW(t)?r[typeof t=="string"?"string":"hash"]:r.map}function sW(e){var t=ef(this,e).delete(e);return this.size-=t?1:0,t}function oW(e){return ef(this,e).get(e)}function aW(e){return ef(this,e).has(e)}function cW(e,t){var r=ef(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ui(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])}}Ui.prototype.clear=nW,Ui.prototype.delete=sW,Ui.prototype.get=oW,Ui.prototype.has=aW,Ui.prototype.set=cW;var uW="Expected a function";function $0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(uW);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new($0.Cache||Ui),r}$0.Cache=Ui;var lW=500;function fW(e){var t=$0(e,function(n){return r.size===lW&&r.clear(),n}),r=t.cache;return t}var dW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hW=/\\(\\)?/g,pW=fW(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(dW,function(r,n,i,s){t.push(i?s.replace(hW,"$1"):n||r)}),t});const mW=pW;function gW(e){return e==null?"":v8(e)}function $8(e,t){return Hr(e)?e:D0(e,t)?[e]:mW(gW(e))}var vW=1/0;function tf(e){if(typeof e=="string"||Cc(e))return e;var t=e+"";return t=="0"&&1/e==-vW?"-0":t}function B0(e,t){t=$8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[tf(t[r++])];return r&&r==n?e:void 0}function yW(e,t,r){var n=e==null?void 0:B0(e,t);return n===void 0?r:n}function B8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var bW=D8(Object.getPrototypeOf,Object);const L8=bW;function wW(){this.__data__=new Fi,this.size=0}function _W(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function xW(e){return this.__data__.get(e)}function SW(e){return this.__data__.has(e)}var EW=200;function CW(e,t){var r=this.__data__;if(r instanceof Fi){var n=r.__data__;if(!Oc||n.length<EW-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ui(n)}return r.set(e,t),this.size=r.size,this}function di(e){var t=this.__data__=new Fi(e);this.size=t.size}di.prototype.clear=wW,di.prototype.delete=_W,di.prototype.get=xW,di.prototype.has=SW,di.prototype.set=CW;function AW(e,t){return e&&Xl(t,Mc(t),e)}function MW(e,t){return e&&Xl(t,R0(t),e)}var F8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,U8=F8&&typeof module=="object"&&module&&!module.nodeType&&module,TW=U8&&U8.exports===F8,V8=TW?li.Buffer:void 0,z8=V8?V8.allocUnsafe:void 0;function OW(e,t){if(t)return e.slice();var r=e.length,n=z8?z8(r):new e.constructor(r);return e.copy(n),n}function q8(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function W8(){return[]}var IW=Object.prototype,PW=IW.propertyIsEnumerable,G8=Object.getOwnPropertySymbols,jW=G8?function(e){return e==null?[]:(e=Object(e),q8(G8(e),function(t){return PW.call(e,t)}))}:W8;const L0=jW;function kW(e,t){return Xl(e,L0(e),t)}var NW=Object.getOwnPropertySymbols,RW=NW?function(e){for(var t=[];e;)B8(t,L0(e)),e=L8(e);return t}:W8;const H8=RW;function DW(e,t){return Xl(e,H8(e),t)}function K8(e,t,r){var n=t(e);return Hr(e)?n:B8(n,r(e))}function F0(e){return K8(e,Mc,L0)}function $W(e){return K8(e,R0,H8)}var BW=ro(li,"DataView");const U0=BW;var LW=ro(li,"Promise");const V0=LW;var FW=ro(li,"Set");const z0=FW;var X8="[object Map]",UW="[object Object]",J8="[object Promise]",Y8="[object Set]",Z8="[object WeakMap]",Q8="[object DataView]",VW=to(U0),zW=to(Oc),qW=to(V0),WW=to(z0),GW=to(I0),io=la;(U0&&io(new U0(new ArrayBuffer(1)))!=Q8||Oc&&io(new Oc)!=X8||V0&&io(V0.resolve())!=J8||z0&&io(new z0)!=Y8||I0&&io(new I0)!=Z8)&&(io=function(e){var t=la(e),r=t==UW?e.constructor:void 0,n=r?to(r):"";if(n)switch(n){case VW:return Q8;case zW:return X8;case qW:return J8;case WW:return Y8;case GW:return Z8}return t});const Ic=io;var HW=Object.prototype,KW=HW.hasOwnProperty;function XW(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&KW.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var JW=li.Uint8Array;const rf=JW;function q0(e){var t=new e.constructor(e.byteLength);return new rf(t).set(new rf(e)),t}function YW(e,t){var r=t?q0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var ZW=/\w*$/;function QW(e){var t=new e.constructor(e.source,ZW.exec(e));return t.lastIndex=e.lastIndex,t}var e3=fi?fi.prototype:void 0,t3=e3?e3.valueOf:void 0;function eG(e){return t3?Object(t3.call(e)):{}}function tG(e,t){var r=t?q0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var rG="[object Boolean]",nG="[object Date]",iG="[object Map]",sG="[object Number]",oG="[object RegExp]",aG="[object Set]",cG="[object String]",uG="[object Symbol]",lG="[object ArrayBuffer]",fG="[object DataView]",dG="[object Float32Array]",hG="[object Float64Array]",pG="[object Int8Array]",mG="[object Int16Array]",gG="[object Int32Array]",vG="[object Uint8Array]",yG="[object Uint8ClampedArray]",bG="[object Uint16Array]",wG="[object Uint32Array]";function _G(e,t,r){var n=e.constructor;switch(t){case lG:return q0(e);case rG:case nG:return new n(+e);case fG:return YW(e,r);case dG:case hG:case pG:case mG:case gG:case vG:case yG:case bG:case wG:return tG(e,r);case iG:return new n;case sG:case cG:return new n(e);case oG:return QW(e);case aG:return new n;case uG:return eG(e)}}function xG(e){return typeof e.constructor=="function"&&!k0(e)?Pz(L8(e)):{}}var SG="[object Map]";function EG(e){return _s(e)&&Ic(e)==SG}var r3=da&&da.isMap,CG=r3?Zl(r3):EG;const AG=CG;var MG="[object Set]";function TG(e){return _s(e)&&Ic(e)==MG}var n3=da&&da.isSet,OG=n3?Zl(n3):TG;const IG=OG;var PG=1,jG=2,kG=4,i3="[object Arguments]",NG="[object Array]",RG="[object Boolean]",DG="[object Date]",$G="[object Error]",s3="[object Function]",BG="[object GeneratorFunction]",LG="[object Map]",FG="[object Number]",o3="[object Object]",UG="[object RegExp]",VG="[object Set]",zG="[object String]",qG="[object Symbol]",WG="[object WeakMap]",GG="[object ArrayBuffer]",HG="[object DataView]",KG="[object Float32Array]",XG="[object Float64Array]",JG="[object Int8Array]",YG="[object Int16Array]",ZG="[object Int32Array]",QG="[object Uint8Array]",eH="[object Uint8ClampedArray]",tH="[object Uint16Array]",rH="[object Uint32Array]",Ht={};Ht[i3]=Ht[NG]=Ht[GG]=Ht[HG]=Ht[RG]=Ht[DG]=Ht[KG]=Ht[XG]=Ht[JG]=Ht[YG]=Ht[ZG]=Ht[LG]=Ht[FG]=Ht[o3]=Ht[UG]=Ht[VG]=Ht[zG]=Ht[qG]=Ht[QG]=Ht[eH]=Ht[tH]=Ht[rH]=!0,Ht[$G]=Ht[s3]=Ht[WG]=!1;function nf(e,t,r,n,i,s){var o,a=t&PG,c=t&jG,u=t&kG;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!fa(e))return e;var l=Hr(e);if(l){if(o=XW(e),!a)return jz(e,o)}else{var f=Ic(e),h=f==s3||f==BG;if(Yl(e))return OW(e,a);if(f==o3||f==i3||h&&!i){if(o=c||h?{}:xG(e),!a)return c?DW(e,MW(o,e)):kW(e,AW(o,e))}else{if(!Ht[f])return i?e:{};o=_G(e,f,a)}}s||(s=new di);var y=s.get(e);if(y)return y;s.set(e,o),IG(e)?e.forEach(function(T){o.add(nf(T,t,r,T,e,s))}):AG(e)&&e.forEach(function(T,P){o.set(P,nf(T,t,r,P,e,s))});var b=u?c?$W:F0:c?R0:Mc,w=l?void 0:b(e);return Nz(w||e,function(T,P){w&&(P=T,T=e[P]),C8(o,P,nf(T,t,r,P,e,s))}),o}var nH=1,iH=4;function sH(e){return nf(e,nH|iH)}var oH="__lodash_hash_undefined__";function aH(e){return this.__data__.set(e,oH),this}function cH(e){return this.__data__.has(e)}function sf(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ui;++t<r;)this.add(e[t])}sf.prototype.add=sf.prototype.push=aH,sf.prototype.has=cH;function uH(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 lH(e,t){return e.has(t)}var fH=1,dH=2;function a3(e,t,r,n,i,s){var o=r&fH,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,h=!0,y=r&dH?new sf:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var T=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(T!==void 0){if(T)continue;h=!1;break}if(y){if(!uH(t,function(P,k){if(!lH(y,k)&&(b===P||i(b,P,r,n,s)))return y.push(k)})){h=!1;break}}else if(!(b===w||i(b,w,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function hH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function pH(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var mH=1,gH=2,vH="[object Boolean]",yH="[object Date]",bH="[object Error]",wH="[object Map]",_H="[object Number]",xH="[object RegExp]",SH="[object Set]",EH="[object String]",CH="[object Symbol]",AH="[object ArrayBuffer]",MH="[object DataView]",c3=fi?fi.prototype:void 0,W0=c3?c3.valueOf:void 0;function TH(e,t,r,n,i,s,o){switch(r){case MH:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case AH:return!(e.byteLength!=t.byteLength||!s(new rf(e),new rf(t)));case vH:case yH:case _H:return P0(+e,+t);case bH:return e.name==t.name&&e.message==t.message;case xH:case EH:return e==t+"";case wH:var a=hH;case SH:var c=n&mH;if(a||(a=pH),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=gH,o.set(e,t);var l=a3(a(e),a(t),n,i,s,o);return o.delete(e),l;case CH:if(W0)return W0.call(e)==W0.call(t)}return!1}var OH=1,IH=Object.prototype,PH=IH.hasOwnProperty;function jH(e,t,r,n,i,s){var o=r&OH,a=F0(e),c=a.length,u=F0(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:PH.call(t,h)))return!1}var y=s.get(e),b=s.get(t);if(y&&b)return y==t&&b==e;var w=!0;s.set(e,t),s.set(t,e);for(var T=o;++f<c;){h=a[f];var P=e[h],k=t[h];if(n)var R=o?n(k,P,h,t,e,s):n(P,k,h,e,t,s);if(!(R===void 0?P===k||i(P,k,r,n,s):R)){w=!1;break}T||(T=h=="constructor")}if(w&&!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)&&(w=!1)}return s.delete(e),s.delete(t),w}var kH=1,u3="[object Arguments]",l3="[object Array]",of="[object Object]",NH=Object.prototype,f3=NH.hasOwnProperty;function RH(e,t,r,n,i,s){var o=Hr(e),a=Hr(t),c=o?l3:Ic(e),u=a?l3:Ic(t);c=c==u3?of:c,u=u==u3?of:u;var l=c==of,f=u==of,h=c==u;if(h&&Yl(e)){if(!Yl(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new di),o||N8(e)?a3(e,t,r,n,i,s):TH(e,t,c,r,n,i,s);if(!(r&kH)){var y=l&&f3.call(e,"__wrapped__"),b=f&&f3.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,T=b?t.value():t;return s||(s=new di),i(w,T,r,n,s)}}return h?(s||(s=new di),jH(e,t,r,n,i,s)):!1}function af(e,t,r,n,i){return e===t?!0:e==null||t==null||!_s(e)&&!_s(t)?e!==e&&t!==t:RH(e,t,r,n,af,i)}var DH=1,$H=2;function BH(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new di;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?af(l,u,DH|$H,n,f):h))return!1}}return!0}function d3(e){return e===e&&!fa(e)}function LH(e){for(var t=Mc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,d3(i)]}return t}function h3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function FH(e){var t=LH(e);return t.length==1&&t[0][2]?h3(t[0][0],t[0][1]):function(r){return r===e||BH(r,e,t)}}function UH(e,t){return e!=null&&t in Object(e)}function VH(e,t,r){t=$8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=tf(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&j0(i)&&S8(o,i)&&(Hr(e)||T8(e)))}function zH(e,t){return e!=null&&VH(e,t,UH)}var qH=1,WH=2;function GH(e,t){return D0(e)&&d3(t)?h3(tf(e),t):function(r){var n=yW(r,e);return n===void 0&&n===t?zH(r,e):af(t,n,qH|WH)}}function HH(e){return function(t){return t==null?void 0:t[e]}}function KH(e){return function(t){return B0(t,e)}}function XH(e){return D0(e)?HH(tf(e)):KH(e)}function p3(e){return typeof e=="function"?e:e==null?y8:typeof e=="object"?Hr(e)?GH(e[0],e[1]):FH(e):XH(e)}function JH(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var YH=JH();const ZH=YH;function QH(e,t){return e&&ZH(e,t,Mc)}function eK(e,t){return function(r,n){if(r==null)return r;if(!Jl(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var tK=eK(QH);const m3=tK;function rK(e,t){var r=[];return m3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function nK(e,t){var r=Hr(e)?q8:rK;return r(e,p3(t))}function iK(e,t){var r=-1,n=Jl(e)?Array(e.length):[];return m3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function sK(e,t){return af(e,t)}function oK(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function aK(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Cc(e),o=t!==void 0,a=t===null,c=t===t,u=Cc(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function cK(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=aK(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function uK(e,t,r){t.length?t=Kl(t,function(s){return Hr(s)?function(o){return B0(o,s.length===1?s[0]:s)}:s}):t=[y8];var n=-1;t=Kl(t,Zl(p3));var i=iK(e,function(s,o,a){var c=Kl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return oK(i,function(s,o){return cK(s,o,r)})}function lK(e,t,r,n){return e==null?[]:(Hr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Hr(r)||(r=r==null?[]:[r]),uK(e,t,r))}function fK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=pn(),s=te.useRef(!1),{slippage:o}=Lr(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=n8(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=c8(n,i,u,l),{priceAcceptRouterData:w}=IV(a),[T,P]=te.useState(!1),[k,R]=te.useState(!1);te.useMemo(()=>f?i:n,[f]);const F=te.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=sH(w);c(q),setTimeout(()=>{s.current=!1},300)}},G=te.useMemo(()=>T?!1:!!b,[T,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(T0,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Vo(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:ln((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Vo(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:ln((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:_.jsx(M0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(f8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(l8,{isLoading:!1,routerData:a,noTips:!0}),b&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.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?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:T?"#72c1f7":"#7F98A7"},onClick:()=>{P(!0)},children:"Yes, please continue."}),_.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&&_.jsx("button",{disabled:G||k,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{k||(R(!0),t(a))},children:k?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(a8,{})}):"Confirm Swap"}),F&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function cf(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:s}=aa(),o=a=>{n||(rl(a),JS(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:"copy-btn",onClick:o,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:o,children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function dK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=pn(),{getTokenInfo:a}=ws(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return _.jsxs("div",{className:"route-dialog",children:[_.jsx(T0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(v3,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),_.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[_.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[_.jsx(Gr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:jr(s,n==null?void 0:n.decimals)}),_.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),_.jsx("div",{className:"route-box-h5 center",children:_.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)=>_.jsxs("div",{className:"route-item-box-h5",children:[_.jsxs("div",{className:"percent",children:[Le(u.percentage).mul(100).toString(),"%"]}),_.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(f=>_.jsx("div",{className:"route-path-item",children:_.jsx(u8,{autoSwitchTooltip:!0,position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(pK,{poolAddress:f.pool_address}),_.jsx(g3,{token:f.fromToken}),_.jsx(g3,{token:f.toToken})]}),children:_.jsx(hK,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Gr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:jr(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function hK({path:e}){var t,r,n;return _.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Gr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Gr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=Bx[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function g3({token:e}){const{getExplorerUrl:t}=zo();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Gr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:ln((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:rl,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Hs(e==null?void 0:e.coin_type)}),_.jsx(cf,{text:(e==null?void 0:e.coin_type)||""})]})]})}function pK({poolAddress:e}){const{getExplorerUrl:t}=zo();return _.jsxs(_.Fragment,{children:[e&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[_.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:rl,href:t(e,"poolAddress"),target:"_blank",children:Hs(e)}),_.jsx(cf,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function v3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var f;const[n,i]=te.useState(!1),{isApp:s}=Wl(),{fetchTokenInfo:o}=ws(),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 w,T;const h=[],y=((T=(w=r==null?void 0:r.routers)==null?void 0:w[0])==null?void 0:T.paths)||[];for(let P=0;P<y.length;P++){const k=y[P],R=await o(k==null?void 0:k.to_type);if(P===0){const F=await o(k==null?void 0:k.from_type);h.push(`${F==null?void 0:F.symbol} > ${R==null?void 0:R.symbol}`)}else h.push(R==null?void 0:R.symbol)}const b=h.join(" > ");u(b)};return te.useEffect(()=>{a&&l()},[a]),_.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?_.jsx(oa,{style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[_.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?c:r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(f=r==null?void 0:r.providers)==null?void 0:f.map((h,y)=>{var b;return s?_.jsx(Gr,{src:gr[h],style:{width:"16px",height:"16px"}}):_.jsx(Gl,{content:_.jsx("div",{children:((b=Bx[h])==null?void 0:b.name)||h}),position:"top",delay:300,children:_.jsx(Gr,{src:gr[h],style:{width:"16px",height:"16px"}})},h)}),e&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&_.jsx(dK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const LJ="",Pc=Di((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||Ri.setItem(Nx,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:s}=t();let o=i;if(n)o=[r,...o];else{const a=ux(r.coin_type);o=i.filter(c=>ux(c.coin_type)!==a)}return s(o),Ri.setItem(Rx,o),o},setImportTokenList:r=>{e(()=>({importTokenList:r}))},setImportTokenIsLoading:r=>{e(()=>({importTokenIsLoading:r}))},searchInput:"",setSearchInput:r=>{e(()=>({searchInput:r}))},showTokenListIsLoading:!1,setShowTokenListIsLoading:r=>{e(()=>({showTokenListIsLoading:r}))}}));Ri.getItem(Nx).then(e=>{e!==null&&Pc.getState().setCollectTokenMap(e,!0)}),Ri.getItem(Rx).then(e=>{e&&Pc.getState().setImportTokenList(e)});function y3(){const{setCollectTokenMap:e,collectTokenMap:t}=Pc(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function mK(e){const{trustedTokenList:t}=ca(),{tokenBalanceObj:r,currentAccount:n}=Rn(),{coinPriceObj:i}=e8(),{getTokenAmountValue:s}=ql(),{fetchTokenInfo:o}=ws(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:T,searchInput:P,setSearchInput:k,importTokenIsLoading:R,showTokenListIsLoading:F,setCurrentTypeTab:L}=Pc(),[G,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,ie]=te.useState(!1);te.useEffect(()=>{Ox(i)||ie(!0)},[i]);const ae=te.useRef({}),[ce,z]=te.useState(!1);te.useEffect(()=>{(!Ox(r)||!_p(ae.current,r))&&(ae.current=r,z(!0))},[r]);const D=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),se=v.map(ye=>{let Ee=0,Se=0;ye.symbol.toLowerCase()===ee||ye.name.toLowerCase()===ee||ye.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):ye.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):ye.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):ye.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):ye.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let Ge=Array.isArray(ye==null?void 0:ye.coin_priority)?Number(ye.coin_priority[0])||0:Number(ye==null?void 0:ye.coin_priority)||0;return e===ye.coin_type&&!j&&(Se=12,Ee=1e3,Ge=1e4),{...ye,mark:Ee,sort:Se,coin_priority_sort:Ge,rateNumber:Number((ye==null?void 0:ye.rate)||"0"),balanceNumber:Number((ye==null?void 0:ye.balance)||"0")}});return lK(se,[ye=>!j&&e===ye.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,j=!1)=>{const ee=j?v.trim():v.toLowerCase().trim(),se=["symbol","name","coin_type"];return nK(ee.length===0?l:[...l,...f],ye=>se.some(Ee=>{const Se=ye[Ee];if(typeof Se=="string"){const Ge=j?Se:Se.toLowerCase();return Ee==="coin_type"?Ge.includes(ee)||ki(Ge,!0).includes(ki(ee,!0)):Ge.includes(ee)}return!1}))},d=v=>{v||b(void 0);const j=p(v);if((j==null?void 0:j.length)===0){m(v);return}else{const ee=D(j,v);u(ee)}},m=async v=>{var j;w(!0);try{if(Ix(v)){const ee=v.trim(),se=Ir(ee).full_address,he=await o(se);if(!he){u([]);return}const ye=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Ee=Le(ye).gt("0")?s(ee,ye):"0",Se={...he,balance:ye,rate:Ee};u([Se]),b(Se)}else{u([]);return}}catch{b(void 0),u([]);return}finally{w(!1)}},x=v=>{if(v==="Default")O("All");else{const j=D(f,P);u(j)}},A=()=>{if(T){const v=y(T,!0),j=D(v,P);u(j),b(void 0),k("")}},E=v=>{const j=y(v,!1),ee=D(j,P);u(ee)},O=v=>{const j=v==="All"?[...l]:l.filter(se=>v=="Native"?!se.labels||se.labels.length==0||se.labels=="Native":se.labels&&se.labels.length>0&&se.labels[0].toLowerCase()==v.toLowerCase()),ee=D(j,P);u(ee)};te.useEffect(()=>{if(!G||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address){const v=[];for(const j of t){const ee=r==null?void 0:r[j==null?void 0:j.coin_type],se=(ee==null?void 0:ee.totalBalanceFormat)||"0",he=(ee==null?void 0:ee.displayBalance)||"0",ye=Le(se).gt("0")?s(j==null?void 0:j.coin_type,se):"0";v.push({...j,balance:he,rate:jr(ye,4,!0)})}h(v)}},[G,X,ce,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!sK(C.current,l)){C.current=l;const v=D(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("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&&!R)return!0;return!1},[P,c,T,R,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:T,handleChangeType:x,handleImportClick:A,handleDeleteImportClick:E,isNoData:g}}function gK({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(vK,{token:r,onHandleTokenAction:t},r.coin_type))})}function vK({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),_.jsx("span",{children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}const yK=$t("/images/img_no_data@2x.png");function bK(e){const{img:t=yK,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function wK({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var b3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function _K(e,t){return!!(e===t||b3(e)&&b3(t))}function xK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!_K(e[r],t[r]))return!1;return!0}function SK(e,t){t===void 0&&(t=xK);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function G0(){return G0=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},G0.apply(null,arguments)}function w3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H0(e,t){return H0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},H0(e,t)}function EK(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,H0(e,t)}var _3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function CK(e,t){return!!(e===t||_3(e)&&_3(t))}function AK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!CK(e[r],t[r]))return!1;return!0}function K0(e,t){t===void 0&&(t=AK);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function x3(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 MK=typeof performance=="object"&&typeof performance.now=="function",S3=MK?function(){return performance.now()}:function(){return Date.now()};function E3(e){cancelAnimationFrame(e.id)}function TK(e,t){var r=S3();function n(){S3()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var X0=-1;function C3(e){if(e===void 0&&(e=!1),X0===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),X0=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return X0}var ha=null;function A3(e){if(e===void 0&&(e=!1),ha===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?ha="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ha="negative":ha="positive-ascending"),document.body.removeChild(t),ha}return ha}gn.env.NODE_ENV;var OK=150,IK=function(t,r){return t},uf=null,lf=null;gn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(uf=new WeakSet,lf=new WeakSet);function PK(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){EK(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,w3(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:w3(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=K0(function(T,P,k,R){return w.props.onItemsRendered({overscanStartIndex:T,overscanStopIndex:P,visibleStartIndex:k,visibleStopIndex:R})}),w._callOnScroll=void 0,w._callOnScroll=K0(function(T,P,k){return w.props.onScroll({scrollDirection:T,scrollOffset:P,scrollUpdateWasRequested:k})}),w._getItemStyle=void 0,w._getItemStyle=function(T){var P=w.props,k=P.direction,R=P.itemSize,F=P.layout,L=w._getItemStyleCache(u&&R,u&&F,u&&k),G;if(L.hasOwnProperty(T))G=L[T];else{var q=r(w.props,T,w._instanceProps),X=i(w.props,T,w._instanceProps),ie=k==="horizontal"||F==="horizontal",ae=k==="rtl",ce=ie?q:0;L[T]=G={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ie?0:q,height:ie?"100%":X,width:ie?X:"100%"}}return G},w._getItemStyleCache=void 0,w._getItemStyleCache=K0(function(T,P,k){return{}}),w._onScrollHorizontal=function(T){var P=T.currentTarget,k=P.clientWidth,R=P.scrollLeft,F=P.scrollWidth;w.setState(function(L){if(L.scrollOffset===R)return null;var G=w.props.direction,q=R;if(G==="rtl")switch(A3()){case"negative":q=-R;break;case"positive-descending":q=F-k-R;break}return q=Math.max(0,Math.min(q,F-k)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(T){var P=T.currentTarget,k=P.clientHeight,R=P.scrollHeight,F=P.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var G=Math.max(0,Math.min(F,R-k));return{isScrolling:!0,scrollDirection:L.scrollOffset<G?"forward":"backward",scrollOffset:G,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(T){var P=w.props.outerRef;w._outerRef=T,typeof P=="function"?P(T):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=T)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&E3(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=TK(w._resetIsScrolling,OK)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,T){return jK(w,T),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(T){return T.scrollOffset===w?null:{scrollDirection:T.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,T){T===void 0&&(T="auto");var P=this.props,k=P.itemCount,R=P.layout,F=this.state.scrollOffset;w=Math.max(0,Math.min(w,k-1));var L=0;if(this._outerRef){var G=this._outerRef;R==="vertical"?L=G.scrollWidth>G.clientWidth?C3():0:L=G.scrollHeight>G.clientHeight?C3():0}this.scrollTo(s(this.props,w,T,F,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,T=w.direction,P=w.initialScrollOffset,k=w.layout;if(typeof P=="number"&&this._outerRef!=null){var R=this._outerRef;T==="horizontal"||k==="horizontal"?R.scrollLeft=P:R.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,T=w.direction,P=w.layout,k=this.state,R=k.scrollOffset,F=k.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(T==="horizontal"||P==="horizontal")if(T==="rtl")switch(A3()){case"negative":L.scrollLeft=-R;break;case"positive-ascending":L.scrollLeft=R;break;default:var G=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-G-R;break}else L.scrollLeft=R;else L.scrollTop=R}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&E3(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,T=w.children,P=w.className,k=w.direction,R=w.height,F=w.innerRef,L=w.innerElementType,G=w.innerTagName,q=w.itemCount,X=w.itemData,ie=w.itemKey,ae=ie===void 0?IK:ie,ce=w.layout,z=w.outerElementType,D=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,A=k==="horizontal"||ce==="horizontal",E=A?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),C=O[0],g=O[1],v=[];if(q>0)for(var j=C;j<=g;j++)v.push(te.createElement(T,{data:X,key:ae(j,X),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return te.createElement(z||D||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:G0({position:"relative",height:R,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:k},p)},te.createElement(L||G||"div",{children:v,ref:F,style:{height:A?"100%":ee,pointerEvents:x?"none":void 0,width:A?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var T=this._getRangeToRender(),P=T[0],k=T[1],R=T[2],F=T[3];this._callOnItemsRendered(P,k,R,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,G=L.scrollDirection,q=L.scrollOffset,X=L.scrollUpdateWasRequested;this._callOnScroll(G,q,X)}},y._getRangeToRender=function(){var w=this.props,T=w.itemCount,P=w.overscanCount,k=this.state,R=k.isScrolling,F=k.scrollDirection,L=k.scrollOffset;if(T===0)return[0,0,0,0];var G=o(this.props,L,this._instanceProps),q=a(this.props,G,L,this._instanceProps),X=!R||F==="backward"?Math.max(1,P):1,ie=!R||F==="forward"?Math.max(1,P):1;return[Math.max(0,G-X),Math.max(0,Math.min(T-1,q+ie)),G,q]},h}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var jK=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(gn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&lf&&!lf.has(l)&&(lf.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":uf&&!uf.has(l)&&(uf.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(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" 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(f&&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(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},kK=PK({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,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,h=t.width,y=a==="horizontal"||f==="horizontal",b=y?h:c,w=Math.max(0,u*l-b),T=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=T+b?n="auto":n="center"),n){case"start":return T;case"end":return P;case"center":{var k=Math.round(P+(T-P)/2);return k<Math.ceil(b/2)?0:k>w+Math.floor(b/2)?w:k}case"auto":default:return i>=P&&i<=T?i:i<P?P: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,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,h=l?u:s,y=Math.ceil((h+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(gn.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 M3(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 NK=["style"],RK=["style"];function DK(e,t){var r=e.style,n=x3(e,NK),i=t.style,s=x3(t,RK);return!M3(r,i)&&!M3(n,s)}const $K=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(FK,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},DK),BK=SK((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function LK({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 s=BK(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(kK,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:$K})})}function FK({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=y3(),{getExplorerUrl:s}=zo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Gr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:ln(e.symbol)})}),_.jsx("p",{className:"token-name",children:ln(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:rl,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Hs(e==null?void 0:e.coin_type)}),_.jsx(cf,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?Mx(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function UK({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function VK({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=mK(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:T,setIsOpenImportDialog:P,setSearchInput:k,searchInput:R,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:G}=Pc();te.useEffect(()=>()=>{k(""),b("All"),h("Default"),G(void 0)},[]);const{handleCollectToken:q,collectTokenMap:X}=y3(),ie=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},z=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();k(x),x?D(x):(D(""),ie("Default"))},D=A0(m=>{Ix(m)?s(ki(m,!0)):s(m)},300),p=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=te.useMemo(()=>Array.from(X.values()),[X]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(T0,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:R,onChange:m=>z(m.target.value),style:{paddingRight:"40px"}}),R.length>0&&_.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:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(gK,{tokenList:d,onHandleTokenAction:p}),R.length===0&&_.jsx(UK,{currentType:f,changeTab:ie}),R.length===0&&f==="Default"&&_.jsx(wK,{tabList:w,currentTab:y,changeTab:ae})]}),i&&_.jsx(zK,{showTooltip:R.length>0,text:R.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&_.jsx(YS,{}),L&&_.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&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(LK,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:p}),L&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ce(),p(L,"select_token")},children:"Import"})})]})]})]})}function zK({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(bK,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Gl,{position:"bottom",content:_.jsx("div",{children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function qK({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1),{setIgnoreWarnToken:s}=Lr();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.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(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Gr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:Hs(o.coin_type)}),_.jsx(cf,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(Al,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}const FJ="";function T3(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 jc;(function(e){e.event="event",e.props="prop"})(jc||(jc={}));function xs(){}function WK(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(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function kc(e){return!!(e||"").match(/\d/)}function pa(e){return e==null}function GK(e){return typeof e=="number"&&isNaN(e)}function O3(e){return pa(e)||GK(e)||typeof e=="number"&&!isFinite(e)}function I3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function HK(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 KK(e,t,r){var n=HK(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 XK(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 J0(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function JK(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 P3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function j3(e,t){return Array(t+1).join(e)}function k3(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+j3("0",Math.abs(o))+i:o>=a?i=i+j3("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function N3(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=J0(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(w,T,P){return w.length>P?(Number(w[0])+Number(T)).toString()+w.substring(1,w.length):T+w},l[0]));var h=P3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function so(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 R3=WK(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),YK=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function ZK(e,t,r){return Math.min(Math.max(e,t),r)}function Y0(e){return Math.max(e.selectionStart,e.selectionEnd)}function QK(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function eX(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function tX(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function rX(e,t,r,n,i,s,o){o===void 0&&(o=tX);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,f={},h=new Array(u),y=0;y<u;y++){h[y]=-1;for(var b=0,w=l;b<w;b++){var T=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(T&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var k=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var R=P===-1||h[P]===-1?0:h[P]+1;return R>k?k:n-R<k-n?R:k}function D3(e,t,r,n){var i=e.length;if(t=ZK(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 nX(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(kc(e[r])||kc(e[r-1]));return t}function $3(e,t,r,n,i,s){s===void 0&&(s=xs);var o=XK(function(b,w){var T,P;return O3(b)?(P="",T=""):typeof b=="number"||w?(P=typeof b=="number"?k3(b):b,T=n(P)):(P=i(b,void 0),T=n(P)),{formattedValue:T,numAsString:P}}),a=te.useState(function(){return o(pa(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,w){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),s(b,w)},f=e,h=r;pa(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return te.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function iX(e){return e.replace(/[^0-9]/g,"")}function sX(e){return e}function oX(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,s=e.getInputRef,o=e.format;o===void 0&&(o=sX);var a=e.removeFormatting;a===void 0&&(a=iX);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=xs);var y=e.onKeyDown;y===void 0&&(y=xs);var b=e.onMouseUp;b===void 0&&(b=xs);var w=e.onFocus;w===void 0&&(w=xs);var T=e.onBlur;T===void 0&&(T=xs);var P=e.value,k=e.getCaretBoundary;k===void 0&&(k=nX);var R=e.isValidInputCharacter;R===void 0&&(R=kc);var F=e.isCharacterSame,L=T3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),G=$3(P,c,!!u,o,a,l),q=G[0],X=q.formattedValue,ie=q.numAsString,ae=G[1],ce=te.useRef(),z=te.useRef({formattedValue:X,numAsString:ie}),D=function(xe,ge){z.current={formattedValue:xe.formattedValue,numAsString:xe.value},ae(xe,ge)},p=te.useState(!1),d=p[0],m=p[1],x=te.useRef(null),A=te.useRef({setCaretTimeout:null,focusTimeout:null});te.useEffect(function(){return m(!0),function(){clearTimeout(A.current.setCaretTimeout),clearTimeout(A.current.focusTimeout)}},[]);var E=o,O=function(xe,ge){var Te=parseFloat(ge);return{formattedValue:xe,value:ge,floatValue:isNaN(Te)?void 0:Te}},C=function(xe,ge,Te){xe.selectionStart===0&&xe.selectionEnd===xe.value.length||(so(xe,ge),A.current.setCaretTimeout=setTimeout(function(){xe.value===Te&&xe.selectionStart!==ge&&so(xe,ge)},0))},g=function(xe,ge,Te){return D3(xe,ge,k(xe),Te)},v=function(xe,ge,Te){var We=k(ge),De=rX(ge,X,xe,Te,We,R,F);return De=D3(ge,De,We),De},j=function(xe){var ge=xe.formattedValue;ge===void 0&&(ge="");var Te=xe.input,We=xe.source,De=xe.event,Oe=xe.numAsString,Ie;if(Te){var Fe=xe.inputValue||Te.value,lt=Y0(Te);Te.value=ge,Ie=v(Fe,ge,lt),Ie!==void 0&&C(Te,Ie,ge)}ge!==X&&D(O(ge,Oe),{event:De,source:We})};te.useEffect(function(){var xe=z.current,ge=xe.formattedValue,Te=xe.numAsString;(X!==ge||ie!==Te)&&D(O(X,ie),{event:void 0,source:jc.props})},[X,ie]);var ee=x.current?Y0(x.current):void 0,se=typeof window<"u"?te.useLayoutEffect:te.useEffect;se(function(){var xe=x.current;if(X!==z.current.formattedValue&&xe){var ge=v(z.current.formattedValue,X,ee);xe.value=X,C(xe,ge,X)}},[X]);var he=function(xe,ge,Te){var We=ge.target,De=ce.current?YK(ce.current,We.selectionEnd):R3(X,xe),Oe=Object.assign(Object.assign({},De),{lastValue:X}),Ie=a(xe,Oe),Fe=E(Ie);if(Ie=a(Fe,void 0),f&&!f(O(Fe,Ie))){var lt=ge.target,ft=Y0(lt),He=v(xe,X,ft);return lt.value=X,C(lt,He,X),!1}return j({formattedValue:Fe,numAsString:Ie,inputValue:xe,event:ge,source:Te,input:ge.target}),!0},ye=function(xe,ge){ge===void 0&&(ge=0);var Te=xe.selectionStart,We=xe.selectionEnd;ce.current={selectionStart:Te,selectionEnd:We+ge}},Ee=function(xe){var ge=xe.target,Te=ge.value,We=he(Te,xe,jc.event);We&&h(xe),ce.current=void 0},Se=function(xe){var ge=xe.target,Te=xe.key,We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Te==="ArrowLeft"||Te==="Backspace"?Ie=Math.max(We-1,0):Te==="ArrowRight"?Ie=Math.min(We+1,Oe.length):Te==="Delete"&&(Ie=We);var Fe=0;Te==="Delete"&&We===De&&(Fe=1);var lt=Te==="ArrowLeft"||Te==="ArrowRight";if(Ie===void 0||We!==De&&!lt){y(xe),ye(ge,Fe);return}var ft=Ie;if(lt){var He=Te==="ArrowLeft"?"left":"right";ft=g(Oe,Ie,He),ft!==Ie&&xe.preventDefault()}else Te==="Delete"&&!R(Oe[Ie])?ft=g(Oe,Ie,"right"):Te==="Backspace"&&!R(Oe[Ie])&&(ft=g(Oe,Ie,"left"));ft!==Ie&&C(ge,ft,Oe),y(xe),ye(ge,Fe)},Ge=function(xe){var ge=xe.target,Te=function(){var We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),We===De){var Ie=g(Oe,We);Ie!==We&&C(ge,Ie,Oe)}};Te(),requestAnimationFrame(function(){Te()}),b(xe),ye(ge)},Ue=function(xe){xe.persist&&xe.persist();var ge=xe.target,Te=xe.currentTarget;x.current=ge,A.current.focusTimeout=setTimeout(function(){var We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,We);Ie!==We&&!(We===0&&De===Oe.length)&&C(ge,Ie,Oe),w(Object.assign(Object.assign({},xe),{currentTarget:Te}))},0)},dt=function(xe){x.current=null,clearTimeout(A.current.focusTimeout),clearTimeout(A.current.setCaretTimeout),T(xe)},ht=d&&QK()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ee,onKeyDown:Se,onMouseUp:Ge,onFocus:Ue,onBlur:dt});if(r==="text")return i?te.createElement(te.Fragment,null,i(X,L)||null):te.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return te.createElement(mt,Object.assign({},$e,{ref:s}))}return te.createElement("input",Object.assign({},$e,{ref:s}))}function B3(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=ff(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=J0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=P3(b,r,!!n)),u&&(y=KK(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function ff(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 aX(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function cX(e,t){return new RegExp("(^-)|[0-9]|"+I3(e),t?"g":void 0)}function uX(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function lX(e,t,r){var n;t===void 0&&(t=eX(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,h=ff(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(kc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var T=a===0?"":b;e=e.substring(0,l)+T+e.substring(l+1,e.length)}var P=function(x,A,E){var O=!1,C=!1;s.startsWith("-")?O=!1:x.startsWith("--")?(O=!1,C=!0):o.startsWith("-")&&x.length===o.length?O=!1:x[0]==="-"&&(O=!0);var g=O?1:0;return C&&(g=2),g&&(x=x.substring(g),A-=g,E-=g),{value:x,start:A,end:E,hasNegation:O}},k=P(e,l,f),R=k.hasNegation;n=k,e=n.value,l=n.start,f=n.end;var F=P(t.lastValue,c.start,c.end),L=F.start,G=F.end,q=F.value,X=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||G<s.length)&&!(X&&o.startsWith(X))&&(e=q);var ie=0;e.startsWith(s)?ie+=s.length:l<s.length&&(ie=l),e=e.substring(ie),f-=ie;var ae=e.length,ce=e.length-o.length;e.endsWith(o)?ae=ce:(f>ce||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=aX(R?"-"+e:e,i),e=(e.match(cX(b,!0))||[]).join("");var z=e.indexOf(b);e=e.replace(new RegExp(I3(b),"g"),function(x,A){return A===z?".":""});var D=J0(e,i),p=D.beforeDecimal,d=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function fX(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}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function dX(e){var t=ff(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
102
+ `})]})}function fh({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[o,s]=te.useState(!0),a=Uw(o,r,n);return b.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{s(!o)},children:[b.jsx(Hr,{src:o?e.logo_url:t.logo_url}),b.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",an(o?e.symbol:t.symbol)," ","="," ",i?b.jsx(Cs,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):jr(a,t.decimals)," ",an(o?t.symbol:e.symbol)]}),b.jsx(Hr,{src:o?t.logo_url:e.logo_url}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-swap"})})]})}function ku(){const[e,t]=te.useState(window.innerWidth),r=lh(()=>{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 Hw(e,t,r,n){const{getTokenPrice:i}=ju(),o=i(e==null?void 0:e.coin_type),s=i(t==null?void 0:t.coin_type),a=Uw(!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 x=[];return o&&x.push(o.market),s&&!x.includes(s.market)&&x.push(s.market),x},[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 x,y="yellow";if(u)if(De(u).gt(0))y="green",De(u).lt(.1)?x="< 0.1% cheaper than":x=`${jr(u,2,!0,Lr.ROUND_UP)}% cheaper than`;else if(De(u).eq(0))x="0%",y="green";else{const A=De(u).abs();A.lte(5)?(y="green",x=`Within ${jr(A.toString(),2,!0,Lr.ROUND_UP)}%`):A.lte(10)?(y="yellow",x=`${jr(A.toString(),2,!0,Lr.ROUND_UP)}% more than`):A.lte(100)?(y="red",x=`${jr(A.toString(),2,!0,Lr.ROUND_UP)}% more than`):(y="red",x="> 100% more than")}return{priceImpactText:x,textColor:y}},[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:d,showPriceImpactWarn:p,priceImpactTextInfo:w}}function Du({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,x]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var y;if(i&&p.current){const A=(y=p.current)==null?void 0:y.getBoundingClientRect();let O,R;r==="top"?(O=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(O=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.bottom}px`):r==="left"?(O=`${window.scrollX+A.left-8}px`,R=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(O=`${window.scrollX+A.right+8}px`,R=`${window.scrollY+A.top+A.height/2}px`):(O=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top+A.height/2}px`),x({left:O,top:R})}},[i]),b.jsxs("div",{ref:p,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&kn.createPortal(b.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 Ww({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=ku();return i&&n?b.jsxs(ln.Root,{children:[b.jsx(ln.Trigger,{children:b.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),b.jsx(ln.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})]}):b.jsx(Du,{content:e,position:r,children:t})}function Gw({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=fn();ku();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l}=Hw(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return b.jsxs(b.Fragment,{children:[!r&&De(a).lte(-30)&&b.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),b.jsxs("div",{className:"price-impact-block",children:[b.jsxs("div",{className:"left",children:[b.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),b.jsx(Ww,{autoSwitchTooltip:!0,position:"top",content:b.jsx(GI,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:b.jsx("use",{xlinkHref:"#icon-tips"})})})]}),b.jsxs("div",{children:[e&&b.jsx(Cs,{style:{width:"80px",height:"20px"}}),!e&&b.jsxs("div",{className:"right",children:[b.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),b.jsx("div",{className:"platforms",children:c.map(d=>b.jsx(Du,{content:b.jsx("span",{style:{fontSize:"12px"},children:b1[d]}),position:"top",delay:300,children:b.jsx(Hr,{src:p5[d]})},d))})]})]})]})]})}function GI({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:o}=ku();return b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[b.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."}),b.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[b.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?b.jsx(fh,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):b.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[b.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),b.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(s=>b1[s]+" ").join("")})]})]})}function Kw({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:o,byAmountIn:s}=fn();return b.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[b.jsx("div",{className:"left",children:s?"Minimum Received":"Maximum Sold"}),n?b.jsx(Cs,{style:{height:"18px",width:"80px"}}):b.jsxs("div",{className:"right",children:[jr(r,s?o==null?void 0:o.decimals:i==null?void 0:i.decimals,!1,Lr.ROUND_DOWN)," ",an(s?(o==null?void 0:o.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function KI({scamsText:e}){return b.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[b.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-alert"})}),b.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),b.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:b.jsx(_1,{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 YI({onClick:e}){return b.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-back"})}),b.jsx("span",{children:"Back"})]})}function dh({title:e,backClick:t}){return b.jsxs("div",{className:"cs-have-back-header",children:[b.jsx(YI,{onClick:t}),b.jsx("span",{className:"title",children:e})]})}const Bu=globalThis||void 0||self;var ZI=typeof Bu=="object"&&Bu&&Bu.Object===Object&&Bu;const Yw=ZI;var XI=typeof self=="object"&&self&&self.Object===Object&&self,JI=Yw||XI||Function("return this")();const Qn=JI;var QI=Qn.Symbol;const ei=QI;var Zw=Object.prototype,eO=Zw.hasOwnProperty,tO=Zw.toString,Pa=ei?ei.toStringTag:void 0;function rO(e){var t=eO.call(e,Pa),r=e[Pa];try{e[Pa]=void 0;var n=!0}catch{}var i=tO.call(e);return n&&(t?e[Pa]=r:delete e[Pa]),i}var nO=Object.prototype,iO=nO.toString;function oO(e){return iO.call(e)}var sO="[object Null]",aO="[object Undefined]",Xw=ei?ei.toStringTag:void 0;function Is(e){return e==null?e===void 0?aO:sO:Xw&&Xw in Object(e)?rO(e):oO(e)}function eo(e){return e!=null&&typeof e=="object"}var cO="[object Symbol]";function Ra(e){return typeof e=="symbol"||eo(e)&&Is(e)==cO}function Lu(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 uO=Array.isArray;const Wr=uO;var lO=1/0,Jw=ei?ei.prototype:void 0,Qw=Jw?Jw.toString:void 0;function eb(e){if(typeof e=="string")return e;if(Wr(e))return Lu(e,eb)+"";if(Ra(e))return Qw?Qw.call(e):"";var t=e+"";return t=="0"&&1/e==-lO?"-0":t}function Os(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function tb(e){return e}var fO="[object AsyncFunction]",dO="[object Function]",hO="[object GeneratorFunction]",pO="[object Proxy]";function rb(e){if(!Os(e))return!1;var t=Is(e);return t==dO||t==hO||t==fO||t==pO}var mO=Qn["__core-js_shared__"];const hh=mO;var nb=function(){var e=/[^.]+$/.exec(hh&&hh.keys&&hh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function gO(e){return!!nb&&nb in e}var vO=Function.prototype,yO=vO.toString;function Po(e){if(e!=null){try{return yO.call(e)}catch{}try{return e+""}catch{}}return""}var wO=/[\\^$.*+?()[\]{}|]/g,bO=/^\[object .+?Constructor\]$/,xO=Function.prototype,SO=Object.prototype,EO=xO.toString,_O=SO.hasOwnProperty,CO=RegExp("^"+EO.call(_O).replace(wO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function MO(e){if(!Os(e)||gO(e))return!1;var t=rb(e)?CO:bO;return t.test(Po(e))}function TO(e,t){return e==null?void 0:e[t]}function Ro(e,t){var r=TO(e,t);return MO(r)?r:void 0}var AO=Ro(Qn,"WeakMap");const ph=AO;var ib=Object.create,IO=function(){function e(){}return function(t){if(!Os(t))return{};if(ib)return ib(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const OO=IO;function PO(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var RO=function(){try{var e=Ro(Object,"defineProperty");return e({},"",{}),e}catch{}}();const ob=RO;function NO(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var jO=9007199254740991,kO=/^(?:0|[1-9]\d*)$/;function sb(e,t){var r=typeof e;return t=t??jO,!!t&&(r=="number"||r!="symbol"&&kO.test(e))&&e>-1&&e%1==0&&e<t}function ab(e,t,r){t=="__proto__"&&ob?ob(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function mh(e,t){return e===t||e!==e&&t!==t}var DO=Object.prototype,BO=DO.hasOwnProperty;function cb(e,t,r){var n=e[t];(!(BO.call(e,t)&&mh(n,r))||r===void 0&&!(t in e))&&ab(e,t,r)}function $u(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?ab(r,a,c):cb(r,a,c)}return r}var LO=9007199254740991;function gh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=LO}function Fu(e){return e!=null&&gh(e.length)&&!rb(e)}var $O=Object.prototype;function vh(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||$O;return e===r}function FO(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var UO="[object Arguments]";function ub(e){return eo(e)&&Is(e)==UO}var lb=Object.prototype,VO=lb.hasOwnProperty,zO=lb.propertyIsEnumerable,qO=ub(function(){return arguments}())?ub:function(e){return eo(e)&&VO.call(e,"callee")&&!zO.call(e,"callee")};const fb=qO;function HO(){return!1}var db=typeof Ht=="object"&&Ht&&!Ht.nodeType&&Ht,hb=db&&typeof module=="object"&&module&&!module.nodeType&&module,WO=hb&&hb.exports===db,pb=WO?Qn.Buffer:void 0,GO=pb?pb.isBuffer:void 0,KO=GO||HO;const Uu=KO;var YO="[object Arguments]",ZO="[object Array]",XO="[object Boolean]",JO="[object Date]",QO="[object Error]",eP="[object Function]",tP="[object Map]",rP="[object Number]",nP="[object Object]",iP="[object RegExp]",oP="[object Set]",sP="[object String]",aP="[object WeakMap]",cP="[object ArrayBuffer]",uP="[object DataView]",lP="[object Float32Array]",fP="[object Float64Array]",dP="[object Int8Array]",hP="[object Int16Array]",pP="[object Int32Array]",mP="[object Uint8Array]",gP="[object Uint8ClampedArray]",vP="[object Uint16Array]",yP="[object Uint32Array]",Jt={};Jt[lP]=Jt[fP]=Jt[dP]=Jt[hP]=Jt[pP]=Jt[mP]=Jt[gP]=Jt[vP]=Jt[yP]=!0,Jt[YO]=Jt[ZO]=Jt[cP]=Jt[XO]=Jt[uP]=Jt[JO]=Jt[QO]=Jt[eP]=Jt[tP]=Jt[rP]=Jt[nP]=Jt[iP]=Jt[oP]=Jt[sP]=Jt[aP]=!1;function wP(e){return eo(e)&&gh(e.length)&&!!Jt[Is(e)]}function Vu(e){return function(t){return e(t)}}var mb=typeof Ht=="object"&&Ht&&!Ht.nodeType&&Ht,Na=mb&&typeof module=="object"&&module&&!module.nodeType&&module,bP=Na&&Na.exports===mb,yh=bP&&Yw.process,xP=function(){try{var e=Na&&Na.require&&Na.require("util").types;return e||yh&&yh.binding&&yh.binding("util")}catch{}}();const Ps=xP;var gb=Ps&&Ps.isTypedArray,SP=gb?Vu(gb):wP;const vb=SP;var EP=Object.prototype,_P=EP.hasOwnProperty;function yb(e,t){var r=Wr(e),n=!r&&fb(e),i=!r&&!n&&Uu(e),o=!r&&!n&&!i&&vb(e),s=r||n||i||o,a=s?FO(e.length,String):[],c=a.length;for(var u in e)(t||_P.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||sb(u,c)))&&a.push(u);return a}function wb(e,t){return function(r){return e(t(r))}}var CP=wb(Object.keys,Object);const MP=CP;var TP=Object.prototype,AP=TP.hasOwnProperty;function IP(e){if(!vh(e))return MP(e);var t=[];for(var r in Object(e))AP.call(e,r)&&r!="constructor"&&t.push(r);return t}function ja(e){return Fu(e)?yb(e):IP(e)}function OP(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var PP=Object.prototype,RP=PP.hasOwnProperty;function NP(e){if(!Os(e))return OP(e);var t=vh(e),r=[];for(var n in e)n=="constructor"&&(t||!RP.call(e,n))||r.push(n);return r}function wh(e){return Fu(e)?yb(e,!0):NP(e)}var jP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kP=/^\w*$/;function bh(e,t){if(Wr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ra(e)?!0:kP.test(e)||!jP.test(e)||t!=null&&e in Object(t)}var DP=Ro(Object,"create");const ka=DP;function BP(){this.__data__=ka?ka(null):{},this.size=0}function LP(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $P="__lodash_hash_undefined__",FP=Object.prototype,UP=FP.hasOwnProperty;function VP(e){var t=this.__data__;if(ka){var r=t[e];return r===$P?void 0:r}return UP.call(t,e)?t[e]:void 0}var zP=Object.prototype,qP=zP.hasOwnProperty;function HP(e){var t=this.__data__;return ka?t[e]!==void 0:qP.call(t,e)}var WP="__lodash_hash_undefined__";function GP(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ka&&t===void 0?WP: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=BP,No.prototype.delete=LP,No.prototype.get=VP,No.prototype.has=HP,No.prototype.set=GP;function KP(){this.__data__=[],this.size=0}function zu(e,t){for(var r=e.length;r--;)if(mh(e[r][0],t))return r;return-1}var YP=Array.prototype,ZP=YP.splice;function XP(e){var t=this.__data__,r=zu(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():ZP.call(t,r,1),--this.size,!0}function JP(e){var t=this.__data__,r=zu(t,e);return r<0?void 0:t[r][1]}function QP(e){return zu(this.__data__,e)>-1}function eR(e,t){var r=this.__data__,n=zu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ci(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])}}Ci.prototype.clear=KP,Ci.prototype.delete=XP,Ci.prototype.get=JP,Ci.prototype.has=QP,Ci.prototype.set=eR;var tR=Ro(Qn,"Map");const Da=tR;function rR(){this.size=0,this.__data__={hash:new No,map:new(Da||Ci),string:new No}}function nR(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function qu(e,t){var r=e.__data__;return nR(t)?r[typeof t=="string"?"string":"hash"]:r.map}function iR(e){var t=qu(this,e).delete(e);return this.size-=t?1:0,t}function oR(e){return qu(this,e).get(e)}function sR(e){return qu(this,e).has(e)}function aR(e,t){var r=qu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Mi(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])}}Mi.prototype.clear=rR,Mi.prototype.delete=iR,Mi.prototype.get=oR,Mi.prototype.has=sR,Mi.prototype.set=aR;var cR="Expected a function";function xh(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(cR);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(xh.Cache||Mi),r}xh.Cache=Mi;var uR=500;function lR(e){var t=xh(e,function(n){return r.size===uR&&r.clear(),n}),r=t.cache;return t}var fR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dR=/\\(\\)?/g,hR=lR(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(fR,function(r,n,i,o){t.push(i?o.replace(dR,"$1"):n||r)}),t});const pR=hR;function mR(e){return e==null?"":eb(e)}function bb(e,t){return Wr(e)?e:bh(e,t)?[e]:pR(mR(e))}var gR=1/0;function Hu(e){if(typeof e=="string"||Ra(e))return e;var t=e+"";return t=="0"&&1/e==-gR?"-0":t}function Sh(e,t){t=bb(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 vR(e,t,r){var n=e==null?void 0:Sh(e,t);return n===void 0?r:n}function xb(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var yR=wb(Object.getPrototypeOf,Object);const Sb=yR;function wR(){this.__data__=new Ci,this.size=0}function bR(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function xR(e){return this.__data__.get(e)}function SR(e){return this.__data__.has(e)}var ER=200;function _R(e,t){var r=this.__data__;if(r instanceof Ci){var n=r.__data__;if(!Da||n.length<ER-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Mi(n)}return r.set(e,t),this.size=r.size,this}function ti(e){var t=this.__data__=new Ci(e);this.size=t.size}ti.prototype.clear=wR,ti.prototype.delete=bR,ti.prototype.get=xR,ti.prototype.has=SR,ti.prototype.set=_R;function CR(e,t){return e&&$u(t,ja(t),e)}function MR(e,t){return e&&$u(t,wh(t),e)}var Eb=typeof Ht=="object"&&Ht&&!Ht.nodeType&&Ht,_b=Eb&&typeof module=="object"&&module&&!module.nodeType&&module,TR=_b&&_b.exports===Eb,Cb=TR?Qn.Buffer:void 0,Mb=Cb?Cb.allocUnsafe:void 0;function AR(e,t){if(t)return e.slice();var r=e.length,n=Mb?Mb(r):new e.constructor(r);return e.copy(n),n}function Tb(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 Ab(){return[]}var IR=Object.prototype,OR=IR.propertyIsEnumerable,Ib=Object.getOwnPropertySymbols,PR=Ib?function(e){return e==null?[]:(e=Object(e),Tb(Ib(e),function(t){return OR.call(e,t)}))}:Ab;const Eh=PR;function RR(e,t){return $u(e,Eh(e),t)}var NR=Object.getOwnPropertySymbols,jR=NR?function(e){for(var t=[];e;)xb(t,Eh(e)),e=Sb(e);return t}:Ab;const Ob=jR;function kR(e,t){return $u(e,Ob(e),t)}function Pb(e,t,r){var n=t(e);return Wr(e)?n:xb(n,r(e))}function _h(e){return Pb(e,ja,Eh)}function DR(e){return Pb(e,wh,Ob)}var BR=Ro(Qn,"DataView");const Ch=BR;var LR=Ro(Qn,"Promise");const Mh=LR;var $R=Ro(Qn,"Set");const Th=$R;var Rb="[object Map]",FR="[object Object]",Nb="[object Promise]",jb="[object Set]",kb="[object WeakMap]",Db="[object DataView]",UR=Po(Ch),VR=Po(Da),zR=Po(Mh),qR=Po(Th),HR=Po(ph),jo=Is;(Ch&&jo(new Ch(new ArrayBuffer(1)))!=Db||Da&&jo(new Da)!=Rb||Mh&&jo(Mh.resolve())!=Nb||Th&&jo(new Th)!=jb||ph&&jo(new ph)!=kb)&&(jo=function(e){var t=Is(e),r=t==FR?e.constructor:void 0,n=r?Po(r):"";if(n)switch(n){case UR:return Db;case VR:return Rb;case zR:return Nb;case qR:return jb;case HR:return kb}return t});const Ba=jo;var WR=Object.prototype,GR=WR.hasOwnProperty;function KR(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&GR.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var YR=Qn.Uint8Array;const Wu=YR;function Ah(e){var t=new e.constructor(e.byteLength);return new Wu(t).set(new Wu(e)),t}function ZR(e,t){var r=t?Ah(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var XR=/\w*$/;function JR(e){var t=new e.constructor(e.source,XR.exec(e));return t.lastIndex=e.lastIndex,t}var Bb=ei?ei.prototype:void 0,Lb=Bb?Bb.valueOf:void 0;function QR(e){return Lb?Object(Lb.call(e)):{}}function eN(e,t){var r=t?Ah(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var tN="[object Boolean]",rN="[object Date]",nN="[object Map]",iN="[object Number]",oN="[object RegExp]",sN="[object Set]",aN="[object String]",cN="[object Symbol]",uN="[object ArrayBuffer]",lN="[object DataView]",fN="[object Float32Array]",dN="[object Float64Array]",hN="[object Int8Array]",pN="[object Int16Array]",mN="[object Int32Array]",gN="[object Uint8Array]",vN="[object Uint8ClampedArray]",yN="[object Uint16Array]",wN="[object Uint32Array]";function bN(e,t,r){var n=e.constructor;switch(t){case uN:return Ah(e);case tN:case rN:return new n(+e);case lN:return ZR(e,r);case fN:case dN:case hN:case pN:case mN:case gN:case vN:case yN:case wN:return eN(e,r);case nN:return new n;case iN:case aN:return new n(e);case oN:return JR(e);case sN:return new n;case cN:return QR(e)}}function xN(e){return typeof e.constructor=="function"&&!vh(e)?OO(Sb(e)):{}}var SN="[object Map]";function EN(e){return eo(e)&&Ba(e)==SN}var $b=Ps&&Ps.isMap,_N=$b?Vu($b):EN;const CN=_N;var MN="[object Set]";function TN(e){return eo(e)&&Ba(e)==MN}var Fb=Ps&&Ps.isSet,AN=Fb?Vu(Fb):TN;const IN=AN;var ON=1,PN=2,RN=4,Ub="[object Arguments]",NN="[object Array]",jN="[object Boolean]",kN="[object Date]",DN="[object Error]",Vb="[object Function]",BN="[object GeneratorFunction]",LN="[object Map]",$N="[object Number]",zb="[object Object]",FN="[object RegExp]",UN="[object Set]",VN="[object String]",zN="[object Symbol]",qN="[object WeakMap]",HN="[object ArrayBuffer]",WN="[object DataView]",GN="[object Float32Array]",KN="[object Float64Array]",YN="[object Int8Array]",ZN="[object Int16Array]",XN="[object Int32Array]",JN="[object Uint8Array]",QN="[object Uint8ClampedArray]",ej="[object Uint16Array]",tj="[object Uint32Array]",Zt={};Zt[Ub]=Zt[NN]=Zt[HN]=Zt[WN]=Zt[jN]=Zt[kN]=Zt[GN]=Zt[KN]=Zt[YN]=Zt[ZN]=Zt[XN]=Zt[LN]=Zt[$N]=Zt[zb]=Zt[FN]=Zt[UN]=Zt[VN]=Zt[zN]=Zt[JN]=Zt[QN]=Zt[ej]=Zt[tj]=!0,Zt[DN]=Zt[Vb]=Zt[qN]=!1;function Gu(e,t,r,n,i,o){var s,a=t&ON,c=t&PN,u=t&RN;if(r&&(s=i?r(e,n,i,o):r(e)),s!==void 0)return s;if(!Os(e))return e;var l=Wr(e);if(l){if(s=KR(e),!a)return PO(e,s)}else{var d=Ba(e),p=d==Vb||d==BN;if(Uu(e))return AR(e,a);if(d==zb||d==Ub||p&&!i){if(s=c||p?{}:xN(e),!a)return c?kR(e,MR(s,e)):RR(e,CR(s,e))}else{if(!Zt[d])return i?e:{};s=bN(e,d,a)}}o||(o=new ti);var w=o.get(e);if(w)return w;o.set(e,s),IN(e)?e.forEach(function(A){s.add(Gu(A,t,r,A,e,o))}):CN(e)&&e.forEach(function(A,O){s.set(O,Gu(A,t,r,O,e,o))});var x=u?c?DR:_h:c?wh:ja,y=l?void 0:x(e);return NO(y||e,function(A,O){y&&(O=A,A=e[O]),cb(s,O,Gu(A,t,r,O,e,o))}),s}var rj=1,nj=4;function ij(e){return Gu(e,rj|nj)}var oj="__lodash_hash_undefined__";function sj(e){return this.__data__.set(e,oj),this}function aj(e){return this.__data__.has(e)}function Ku(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Mi;++t<r;)this.add(e[t])}Ku.prototype.add=Ku.prototype.push=sj,Ku.prototype.has=aj;function cj(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 uj(e,t){return e.has(t)}var lj=1,fj=2;function qb(e,t,r,n,i,o){var s=r&lj,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&fj?new Ku:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var x=e[d],y=t[d];if(n)var A=s?n(y,x,d,t,e,o):n(x,y,d,e,t,o);if(A!==void 0){if(A)continue;p=!1;break}if(w){if(!cj(t,function(O,R){if(!uj(w,R)&&(x===O||i(x,O,r,n,o)))return w.push(R)})){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 dj(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function hj(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var pj=1,mj=2,gj="[object Boolean]",vj="[object Date]",yj="[object Error]",wj="[object Map]",bj="[object Number]",xj="[object RegExp]",Sj="[object Set]",Ej="[object String]",_j="[object Symbol]",Cj="[object ArrayBuffer]",Mj="[object DataView]",Hb=ei?ei.prototype:void 0,Ih=Hb?Hb.valueOf:void 0;function Tj(e,t,r,n,i,o,s){switch(r){case Mj:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Cj:return!(e.byteLength!=t.byteLength||!o(new Wu(e),new Wu(t)));case gj:case vj:case bj:return mh(+e,+t);case yj:return e.name==t.name&&e.message==t.message;case xj:case Ej:return e==t+"";case wj:var a=dj;case Sj:var c=n&pj;if(a||(a=hj),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=mj,s.set(e,t);var l=qb(a(e),a(t),n,i,o,s);return s.delete(e),l;case _j:if(Ih)return Ih.call(e)==Ih.call(t)}return!1}var Aj=1,Ij=Object.prototype,Oj=Ij.hasOwnProperty;function Pj(e,t,r,n,i,o){var s=r&Aj,a=_h(e),c=a.length,u=_h(t),l=u.length;if(c!=l&&!s)return!1;for(var d=c;d--;){var p=a[d];if(!(s?p in t:Oj.call(t,p)))return!1}var w=o.get(e),x=o.get(t);if(w&&x)return w==t&&x==e;var y=!0;o.set(e,t),o.set(t,e);for(var A=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}A||(A=p=="constructor")}if(y&&!A){var F=e.constructor,$=t.constructor;F!=$&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof $=="function"&&$ instanceof $)&&(y=!1)}return o.delete(e),o.delete(t),y}var Rj=1,Wb="[object Arguments]",Gb="[object Array]",Yu="[object Object]",Nj=Object.prototype,Kb=Nj.hasOwnProperty;function jj(e,t,r,n,i,o){var s=Wr(e),a=Wr(t),c=s?Gb:Ba(e),u=a?Gb:Ba(t);c=c==Wb?Yu:c,u=u==Wb?Yu:u;var l=c==Yu,d=u==Yu,p=c==u;if(p&&Uu(e)){if(!Uu(t))return!1;s=!0,l=!1}if(p&&!l)return o||(o=new ti),s||vb(e)?qb(e,t,r,n,i,o):Tj(e,t,c,r,n,i,o);if(!(r&Rj)){var w=l&&Kb.call(e,"__wrapped__"),x=d&&Kb.call(t,"__wrapped__");if(w||x){var y=w?e.value():e,A=x?t.value():t;return o||(o=new ti),i(y,A,r,n,o)}}return p?(o||(o=new ti),Pj(e,t,r,n,i,o)):!1}function Zu(e,t,r,n,i){return e===t?!0:e==null||t==null||!eo(e)&&!eo(t)?e!==e&&t!==t:jj(e,t,r,n,Zu,i)}var kj=1,Dj=2;function Bj(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 ti;if(n)var p=n(u,l,c,e,t,d);if(!(p===void 0?Zu(l,u,kj|Dj,n,d):p))return!1}}return!0}function Yb(e){return e===e&&!Os(e)}function Lj(e){for(var t=ja(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Yb(i)]}return t}function Zb(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function $j(e){var t=Lj(e);return t.length==1&&t[0][2]?Zb(t[0][0],t[0][1]):function(r){return r===e||Bj(r,e,t)}}function Fj(e,t){return e!=null&&t in Object(e)}function Uj(e,t,r){t=bb(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&&gh(i)&&sb(s,i)&&(Wr(e)||fb(e)))}function Vj(e,t){return e!=null&&Uj(e,t,Fj)}var zj=1,qj=2;function Hj(e,t){return bh(e)&&Yb(t)?Zb(Hu(e),t):function(r){var n=vR(r,e);return n===void 0&&n===t?Vj(r,e):Zu(t,n,zj|qj)}}function Wj(e){return function(t){return t==null?void 0:t[e]}}function Gj(e){return function(t){return Sh(t,e)}}function Kj(e){return bh(e)?Wj(Hu(e)):Gj(e)}function Xb(e){return typeof e=="function"?e:e==null?tb:typeof e=="object"?Wr(e)?Hj(e[0],e[1]):$j(e):Kj(e)}function Yj(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 Zj=Yj();const Xj=Zj;function Jj(e,t){return e&&Xj(e,t,ja)}function Qj(e,t){return function(r,n){if(r==null)return r;if(!Fu(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 ek=Qj(Jj);const Jb=ek;function tk(e,t){var r=[];return Jb(e,function(n,i,o){t(n,i,o)&&r.push(n)}),r}function rk(e,t){var r=Wr(e)?Tb:tk;return r(e,Xb(t))}function nk(e,t){var r=-1,n=Fu(e)?Array(e.length):[];return Jb(e,function(i,o,s){n[++r]=t(i,o,s)}),n}function ik(e,t){return Zu(e,t)}function ok(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function sk(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 ak(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=sk(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 ck(e,t,r){t.length?t=Lu(t,function(o){return Wr(o)?function(s){return Sh(s,o.length===1?o[0]:o)}:o}):t=[tb];var n=-1;t=Lu(t,Vu(Xb));var i=nk(e,function(o,s,a){var c=Lu(t,function(u){return u(o)});return{criteria:c,index:++n,value:o}});return ok(i,function(o,s){return ak(o,s,r)})}function uk(e,t,r,n){return e==null?[]:(Wr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Wr(r)||(r=r==null?[]:[r]),ck(e,t,r))}function lk({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=fn(),o=te.useRef(!1),{slippage:s}=$r(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:d}=a,{amountLimit:p}=Fw(s,a),{showPriceImpactTips:w,showPriceImpactWarn:x}=Hw(n,i,u,l),{priceAcceptRouterData:y}=II(a),[A,O]=te.useState(!1),[R,k]=te.useState(!1);te.useMemo(()=>d?i:n,[d]);const F=te.useMemo(()=>y!==void 0,[y]),$=()=>{if(y){if(o.current)return;o.current=!0;const q=ij(y);c(q),setTimeout(()=>{o.current=!1},300)}},H=te.useMemo(()=>A?!1:!!x,[A,x]);return b.jsxs("div",{className:"secondary-dialog",children:[b.jsx(dh,{title:"Review your order",backClick:e}),b.jsxs("div",{className:"secondary-content",children:[b.jsxs("div",{className:"trade-info",children:[b.jsxs("div",{className:"amount-info",children:[b.jsx("span",{className:"amount",children:as(u||"")}),b.jsx("img",{src:n==null?void 0:n.logo_url}),b.jsx("span",{className:"symbol",children:an((n==null?void 0:n.symbol)||"")})]}),b.jsx("div",{className:"dividing-line",children:b.jsx("div",{className:"swap-icon",children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-trade"})})})}),b.jsxs("div",{className:"amount-info",children:[b.jsx("span",{className:"amount",children:as(l||"")}),b.jsx("img",{src:i==null?void 0:i.logo_url}),b.jsx("span",{className:"symbol",children:an((i==null?void 0:i.symbol)||"")})]})]}),b.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[b.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:b.jsx(fh,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),w&&b.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),b.jsxs("div",{className:"swap-info-between",children:[b.jsx("div",{className:"left",children:"Slippage Tolerance"}),b.jsxs("div",{className:"right",children:[s,"%"]})]}),b.jsx(Kw,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),b.jsx(Gw,{isLoading:!1,routerData:a,noTips:!0}),x&&b.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[b.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?"}),b.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[b.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:A?"#72c1f7":"#7F98A7"},onClick:()=>{O(!0)},children:"Yes, please continue."}),b.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&&b.jsx("button",{disabled:H||R,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{R||(k(!0),t(a))},children:R?b.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:b.jsx(qw,{})}):"Confirm Swap"}),F&&b.jsxs("div",{className:"price-update",children:[b.jsxs("div",{className:"left",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-alert"})}),b.jsx("span",{children:"Price update"})]}),b.jsx("div",{className:"right",children:b.jsx("button",{className:"cs-solid-btn",onClick:$,children:"Accept"})})]})]})}function Xu(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:o}=Ms(),s=a=>{n||(Hc(a),Nw(t,{debug:!1,message:"message"}),o("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),b.jsx(b.Fragment,{children:r==="btn"?b.jsxs("div",{className:"copy-btn",onClick:s,children:[b.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),b.jsx("span",{children:"Copy"})]}):b.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:s,children:b.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function fk({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:o,toAmount:s}=fn(),{getTokenInfo:a}=Qi(),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 b.jsxs("div",{className:"route-dialog",children:[b.jsx(dh,{title:"Route",backClick:e}),b.jsxs("div",{className:"route-dialog-content",children:[b.jsx("div",{className:"simple-router-box",children:b.jsx(e2,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),b.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[b.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[b.jsx(Hr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:jr(o,n==null?void 0:n.decimals)}),b.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),b.jsx("div",{className:"route-box-h5 center",children:b.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)=>b.jsxs("div",{className:"route-item-box-h5",children:[b.jsxs("div",{className:"percent",children:[De(u.percentage).mul(100).toString(),"%"]}),b.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=>b.jsx("div",{className:"route-path-item",children:b.jsx(Ww,{autoSwitchTooltip:!0,position:"bottom",content:b.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[b.jsx(hk,{poolAddress:d.pool_address}),b.jsx(Qb,{token:d.fromToken}),b.jsx(Qb,{token:d.toToken})]}),children:b.jsx(dk,{path:d})})},d.to_type))})]},l))})}),b.jsxs("div",{className:"center",style:{gap:"4px"},children:[b.jsx(Hr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:jr(s,i==null?void 0:i.decimals)}),b.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function dk({path:e}){var t,r,n;return b.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[b.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[b.jsx(Hr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),b.jsx(Hr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),b.jsxs("span",{className:"provider",children:[(n=x1[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&b.jsxs("div",{className:"fee-tier",children:[" ",De(e.fee_rate).mul(100).toString(),"%"]})]})}function Qb({token:e}){const{getExplorerUrl:t}=cs();return b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[b.jsx(Hr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),b.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:an((e==null?void 0:e.symbol)||"")})]}),b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[b.jsx("a",{onClick:Hc,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)}),b.jsx(Xu,{text:(e==null?void 0:e.coin_type)||""})]})]})}function hk({poolAddress:e}){const{getExplorerUrl:t}=cs();return b.jsxs(b.Fragment,{children:[e&&b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[b.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[b.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:Hc,href:t(e,"poolAddress"),target:"_blank",children:Eo(e)}),b.jsx(Xu,{text:e})]})]}),e&&b.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function e2({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var d;const[n,i]=te.useState(!1),{isApp:o}=ku(),{fetchTokenInfo:s}=Qi(),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,A;const p=[],w=((A=(y=r==null?void 0:r.routers)==null?void 0:y[0])==null?void 0:A.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 x=p.join(" > ");u(x)};return te.useEffect(()=>{a&&l()},[a]),b.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[b.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?b.jsx(Cs,{style:{width:"80px",height:"18px"}}):b.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[b.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?c:r==null?void 0:r.router_summery}),b.jsxs("div",{className:"providers",children:[(d=r==null?void 0:r.providers)==null?void 0:d.map((p,w)=>{var x;return o?b.jsx(Hr,{src:yr[p],style:{width:"16px",height:"16px"}}):b.jsx(Du,{content:b.jsx("div",{children:((x=x1[p])==null?void 0:x.name)||p}),position:"top",delay:300,children:b.jsx(Hr,{src:yr[p],style:{width:"16px",height:"16px"}})},p)}),e&&b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:b.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&b.jsx(fk,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const LB="",La=xi((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||bi.setItem(v1,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=Ng(r.coin_type);s=i.filter(c=>Ng(c.coin_type)!==a)}return o(s),bi.setItem(y1,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}))}}));bi.getItem(v1).then(e=>{e!==null&&La.getState().setCollectTokenMap(e,!0)}),bi.getItem(y1).then(e=>{e&&La.getState().setImportTokenList(e)});function t2(){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 pk(e){const{trustedTokenList:t}=Ts(),{tokenBalanceObj:r,currentAccount:n}=Pn(),{coinPriceObj:i}=Bw(),{getTokenAmountValue:o}=ju(),{fetchTokenInfo:s}=Qi(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:d,setComBineTokenList:p,setImportToken:w,setCurrentImportTokenData:x,setImportTokenIsLoading:y,currentImportTokenData:A,searchInput:O,setSearchInput:R,importTokenIsLoading:k,showTokenListIsLoading:F,setCurrentTypeTab:$}=La(),[H,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[Y,ne]=te.useState(!1);te.useEffect(()=>{d1(i)||ne(!0)},[i]);const se=te.useRef({}),[ae,z]=te.useState(!1);te.useEffect(()=>{(!d1(r)||!od(se.current,r))&&(se.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 uk(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 rk(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)||yi(Ve,!0).includes(yi(ee,!0)):Ve.includes(ee)}return!1}))},f=v=>{v||x(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(h1(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]),x(be)}else{u([]);return}}catch{x(void 0),u([]);return}finally{y(!1)}},S=v=>{if(v==="Default")I("All");else{const N=D(d,O);u(N)}},M=()=>{if(A){const v=w(A,!0),N=D(v,O);u(N),x(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(!H||!(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)}},[H,Y,ae,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!ik(C.current,l)){C.current=l;const v=D(l);e&&d.find(ee=>ee.coin_type===e)!==void 0?($("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,A,k,F]);return{showTokenList:c,handleSearch:f,handleChangePlatform:I,currentImportTokenData:A,handleChangeType:S,handleImportClick:M,handleDeleteImportClick:_,isNoData:g}}function mk({tokenList:e,onHandleTokenAction:t}){return b.jsx("div",{className:"token-collect-list",children:e.map(r=>b.jsx(gk,{token:r,onHandleTokenAction:t},r.coin_type))})}function gk({token:e,onHandleTokenAction:t}){return b.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[b.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),b.jsx("span",{children:e.symbol}),b.jsx("i",{children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:b.jsx("use",{xlinkHref:"#icon-close"})})})]})}const vk=$t("/images/img_no_data@2x.png");function yk(e){const{img:t=vk,text:r,width:n="100%",height:i="auto",padding:o="20px",subItem:s}=e;return b.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:o,boxSizing:"border-box",textAlign:"center"},children:[t&&b.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&b.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),s&&s]})}function wk({tabList:e,currentTab:t,changeTab:r}){return b.jsx("div",{className:"platform-tabs",children:e.map(n=>b.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var r2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function bk(e,t){return!!(e===t||r2(e)&&r2(t))}function xk(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!bk(e[r],t[r]))return!1;return!0}function Sk(e,t){t===void 0&&(t=xk);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 Oh(){return Oh=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},Oh.apply(null,arguments)}function n2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ph(e,t){return Ph=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ph(e,t)}function Ek(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ph(e,t)}var i2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function _k(e,t){return!!(e===t||i2(e)&&i2(t))}function Ck(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!_k(e[r],t[r]))return!1;return!0}function Rh(e,t){t===void 0&&(t=Ck);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 o2(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 Mk=typeof performance=="object"&&typeof performance.now=="function",s2=Mk?function(){return performance.now()}:function(){return Date.now()};function a2(e){cancelAnimationFrame(e.id)}function Tk(e,t){var r=s2();function n(){s2()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Nh=-1;function c2(e){if(e===void 0&&(e=!1),Nh===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Nh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Nh}var Rs=null;function u2(e){if(e===void 0&&(e=!1),Rs===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?Rs="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Rs="negative":Rs="positive-ascending"),document.body.removeChild(t),Rs}return Rs}hn.env.NODE_ENV;var Ak=150,Ik=function(t,r){return t},Ju=null,Qu=null;hn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ju=new WeakSet,Qu=new WeakSet);function Ok(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){Ek(p,d);function p(x){var y;return y=d.call(this,x)||this,y._instanceProps=c(y.props,n2(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:n2(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Rh(function(A,O,R,k){return y.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:O,visibleStartIndex:R,visibleStopIndex:k})}),y._callOnScroll=void 0,y._callOnScroll=Rh(function(A,O,R){return y.props.onScroll({scrollDirection:A,scrollOffset:O,scrollUpdateWasRequested:R})}),y._getItemStyle=void 0,y._getItemStyle=function(A){var O=y.props,R=O.direction,k=O.itemSize,F=O.layout,$=y._getItemStyleCache(u&&k,u&&F,u&&R),H;if($.hasOwnProperty(A))H=$[A];else{var q=r(y.props,A,y._instanceProps),Y=i(y.props,A,y._instanceProps),ne=R==="horizontal"||F==="horizontal",se=R==="rtl",ae=ne?q:0;$[A]=H={position:"absolute",left:se?void 0:ae,right:se?ae:void 0,top:ne?0:q,height:ne?"100%":Y,width:ne?Y:"100%"}}return H},y._getItemStyleCache=void 0,y._getItemStyleCache=Rh(function(A,O,R){return{}}),y._onScrollHorizontal=function(A){var O=A.currentTarget,R=O.clientWidth,k=O.scrollLeft,F=O.scrollWidth;y.setState(function($){if($.scrollOffset===k)return null;var H=y.props.direction,q=k;if(H==="rtl")switch(u2()){case"negative":q=-k;break;case"positive-descending":q=F-R-k;break}return q=Math.max(0,Math.min(q,F-R)),{isScrolling:!0,scrollDirection:$.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(A){var O=A.currentTarget,R=O.clientHeight,k=O.scrollHeight,F=O.scrollTop;y.setState(function($){if($.scrollOffset===F)return null;var H=Math.max(0,Math.min(F,k-R));return{isScrolling:!0,scrollDirection:$.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(A){var O=y.props.outerRef;y._outerRef=A,typeof O=="function"?O(A):O!=null&&typeof O=="object"&&O.hasOwnProperty("current")&&(O.current=A)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&a2(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=Tk(y._resetIsScrolling,Ak)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,A){return Pk(y,A),l(y),null};var w=p.prototype;return w.scrollTo=function(y){y=Math.max(0,y),this.setState(function(A){return A.scrollOffset===y?null:{scrollDirection:A.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},w.scrollToItem=function(y,A){A===void 0&&(A="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 $=0;if(this._outerRef){var H=this._outerRef;k==="vertical"?$=H.scrollWidth>H.clientWidth?c2():0:$=H.scrollHeight>H.clientHeight?c2():0}this.scrollTo(o(this.props,y,A,F,this._instanceProps,$))},w.componentDidMount=function(){var y=this.props,A=y.direction,O=y.initialScrollOffset,R=y.layout;if(typeof O=="number"&&this._outerRef!=null){var k=this._outerRef;A==="horizontal"||R==="horizontal"?k.scrollLeft=O:k.scrollTop=O}this._callPropsCallbacks()},w.componentDidUpdate=function(){var y=this.props,A=y.direction,O=y.layout,R=this.state,k=R.scrollOffset,F=R.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var $=this._outerRef;if(A==="horizontal"||O==="horizontal")if(A==="rtl")switch(u2()){case"negative":$.scrollLeft=-k;break;case"positive-ascending":$.scrollLeft=k;break;default:var H=$.clientWidth,q=$.scrollWidth;$.scrollLeft=q-H-k;break}else $.scrollLeft=k;else $.scrollTop=k}this._callPropsCallbacks()},w.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&a2(this._resetIsScrollingTimeoutId)},w.render=function(){var y=this.props,A=y.children,O=y.className,R=y.direction,k=y.height,F=y.innerRef,$=y.innerElementType,H=y.innerTagName,q=y.itemCount,Y=y.itemData,ne=y.itemKey,se=ne===void 0?Ik:ne,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(q>0)for(var N=C;N<=g;N++)v.push(te.createElement(A,{data:Y,key:se(N,Y),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:Oh({position:"relative",height:k,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},h)},te.createElement($||H||"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 A=this._getRangeToRender(),O=A[0],R=A[1],k=A[2],F=A[3];this._callOnItemsRendered(O,R,k,F)}}if(typeof this.props.onScroll=="function"){var $=this.state,H=$.scrollDirection,q=$.scrollOffset,Y=$.scrollUpdateWasRequested;this._callOnScroll(H,q,Y)}},w._getRangeToRender=function(){var y=this.props,A=y.itemCount,O=y.overscanCount,R=this.state,k=R.isScrolling,F=R.scrollDirection,$=R.scrollOffset;if(A===0)return[0,0,0,0];var H=s(this.props,$,this._instanceProps),q=a(this.props,H,$,this._instanceProps),Y=!k||F==="backward"?Math.max(1,O):1,ne=!k||F==="forward"?Math.max(1,O):1;return[Math.max(0,H-Y),Math.max(0,Math.min(A-1,q+ne)),H,q]},p}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Pk=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(hn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Qu&&!Qu.has(l)&&(Qu.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":Ju&&!Ju.has(l)&&(Ju.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.'))}},Rk=Ok({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",x=w?p:c,y=Math.max(0,u*l-x),A=Math.min(y,r*l),O=Math.max(0,r*l-x+l+s);switch(n==="smart"&&(i>=O-x&&i<=A+x?n="auto":n="center"),n){case"start":return A;case"end":return O;case"center":{var R=Math.round(O+(A-O)/2);return R<Math.ceil(x/2)?0:R>y+Math.floor(x/2)?y:R}case"auto":default:return i>=O&&i<=A?i:i<O?O:A}},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(hn.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 l2(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 Nk=["style"],jk=["style"];function kk(e,t){var r=e.style,n=o2(e,Nk),i=t.style,o=o2(t,jk);return!l2(r,i)&&!l2(n,o)}const Dk=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:o,showDelete:s}=e,a=n[t];return b.jsx("div",{style:r,children:b.jsx($k,{data:a,onHandleTokenAction:i,showCollect:o,showDelete:s})})},kk),Bk=Sk((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function Lk({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=Bk(e,t,r,n);return b.jsx("div",{className:"token-list",children:b.jsx(Rk,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:o,itemSize:72,width:"100%",children:Dk})})}function $k({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=t2(),{getExplorerUrl:o}=cs();return b.jsxs("div",{className:"token-list-item",onClick:s=>{t&&(s.stopPropagation(),n(e,"select_token"))},children:[b.jsx(Hr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),b.jsxs("div",{className:"token-info",children:[b.jsx("h4",{className:"token-symbol",children:b.jsx("span",{children:an(e.symbol)})}),b.jsx("p",{className:"token-name",children:an(e==null?void 0:e.name,20)}),b.jsxs("div",{className:"copy",children:[b.jsx("a",{onClick:Hc,href:o(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Eo(e==null?void 0:e.coin_type)}),b.jsx(Xu,{text:e==null?void 0:e.coin_type})]})]}),b.jsxs("div",{className:"token-balance",children:[b.jsxs("div",{className:"balance",children:[b.jsx("h4",{children:e==null?void 0:e.balance}),b.jsx("p",{children:e!=null&&e.rate?l1(e==null?void 0:e.rate,2):""})]}),r&&b.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"delete_import")},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&b.jsx("div",{className:"collect-button",onClick:s=>{s.stopPropagation(),n(e,"collect_token")},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function Fk({currentType:e,changeTab:t}){const r=["Default","Imported"];return b.jsx("div",{className:"type-tabs",children:r.map(n=>b.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function Uk({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:o,handleChangePlatform:s,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=pk(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:d,setCurrentTypeTab:p,currentPlatformTab:w,setCurrentPlatformTab:x,platformList:y,isOpenImportDialog:A,setIsOpenImportDialog:O,setSearchInput:R,searchInput:k,importTokenIsLoading:F,currentImportTokenData:$,setCurrentImportTokenData:H}=La();te.useEffect(()=>()=>{R(""),x("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:Y}=t2(),ne=m=>{p(m),a(m)},se=m=>{x(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(""),ne("Default"))},D=lh(m=>{h1(m)?o(yi(m,!0)):o(m)},300),h=(m,S)=>{if(S==="delete_import"){u(m);return}if(S==="collect_token"||S==="un_collect"){q(m);return}S==="select_token"&&(t(m),e())},f=te.useMemo(()=>Array.from(Y.values()),[Y]);return b.jsxs("div",{className:"token-select-modal",children:[b.jsx(dh,{backClick:e,title:"Select Token"}),b.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[b.jsxs("div",{className:"center-content",children:[b.jsxs("div",{className:"search-input",style:{position:"relative"},children:[b.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&&b.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:b.jsx("use",{xlinkHref:"#icon-close"})})]}),f.length>0&&b.jsx(mk,{tokenList:f,onHandleTokenAction:h}),k.length===0&&b.jsx(Fk,{currentType:d,changeTab:ne}),k.length===0&&d==="Default"&&b.jsx(wk,{tabList:y,currentTab:w,changeTab:se})]}),i&&b.jsx(Vk,{showTooltip:k.length>0,text:k.length>0||$===void 0?"No tokens found":"No Imported Tokens"}),F&&b.jsx(jw,{}),$&&b.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&&b.jsxs("div",{style:{position:"relative"},children:[b.jsx(Lk,{showTokenList:n,showCollect:!$,showDelete:!$&&d==="Imported",onHandleTokenAction:h}),$&&b.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:b.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($,"select_token")},children:"Import"})})]})]})]})}function Vk({showTooltip:e,text:t}){return b.jsx("div",{style:{height:"360px"},children:b.jsx(yk,{text:t,subItem:e?b.jsx("div",{children:b.jsx(Du,{position:"bottom",content:b.jsx("div",{children:"The unique id of coin"}),children:b.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:b.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function zk({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1),{setIgnoreWarnToken:o}=$r();return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"dialog-mask",onClick:e}),b.jsxs("div",{className:"import-dialog",children:[b.jsxs("div",{className:"cs-dialog-header",children:[b.jsx("div",{className:"title",children:"Tips"}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:b.jsx("use",{xlinkHref:"#icon-close"})})]}),b.jsxs("div",{className:"import-content",children:[b.jsx("div",{className:"tip-text-box",children:b.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=>b.jsxs("div",{className:"import-token-info",children:[b.jsx(Hr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),b.jsxs("div",{className:"info",children:[b.jsx("div",{className:"name",children:b.jsxs("span",{children:[" ",s.symbol," "]})}),b.jsxs("div",{className:"address",children:[b.jsx("span",{children:Eo(s.coin_type)}),b.jsx(Xu,{text:s.coin_type})]})]})]},s.coin_type)),b.jsxs("div",{className:"risk-checkbox",children:[b.jsx(gu,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),b.jsx("span",{children:"I acknowledge the risk"})]}),b.jsxs("div",{className:"button-block",children:[b.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),b.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(s=>{o(s.coin_type)})},children:"Confirm"})]})]})]})]})}const $B="";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 $a;(function(e){e.event="event",e.props="prop"})($a||($a={}));function to(){}function qk(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 Ns(e){return e==null}function Hk(e){return typeof e=="number"&&isNaN(e)}function d2(e){return Ns(e)||Hk(e)||typeof e=="number"&&!isFinite(e)}function h2(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Wk(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 Gk(e,t,r){var n=Wk(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 Kk(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 jh(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 Yk(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 p2(e,t,r){for(var n="",i=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||i;return n}function m2(e,t){return Array(t+1).join(e)}function g2(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."+m2("0",Math.abs(s))+i:s>=a?i=i+m2("0",s-a):i=(i.substring(0,s)||"0")+"."+i.substring(s),r+i}function v2(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=jh(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,A,O){return y.length>O?(Number(y[0])+Number(A)).toString()+y.substring(1,y.length):A+y},l[0]));var p=p2(l[1]||"",t,r),w=a?"-":"",x=n?".":"";return""+w+d+x+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 y2=qk(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}}}),Zk=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Xk(e,t,r){return Math.min(Math.max(e,t),r)}function kh(e){return Math.max(e.selectionStart,e.selectionEnd)}function Jk(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Qk(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function eD(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function tD(e,t,r,n,i,o,s){s===void 0&&(s=eD);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 x=0,y=l;x<y;x++){var A=s({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:w,formattedValueIndex:x});if(A&&d[x]!==!0){p[w]=x,d[x]=!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 w2(e,t,r,n){var i=e.length;if(t=Xk(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 rD(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 b2(e,t,r,n,i,o){o===void 0&&(o=to);var s=Kk(function(x,y){var A,O;return d2(x)?(O="",A=""):typeof x=="number"||y?(O=typeof x=="number"?g2(x):x,A=n(O)):(O=i(x,void 0),A=n(O)),{formattedValue:A,numAsString:O}}),a=te.useState(function(){return s(Ns(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;Ns(e)&&(d=c.numAsString,p=!0);var w=s(d,p);return te.useMemo(function(){u(w)},[w.formattedValue]),[c,l]}function nD(e){return e.replace(/[^0-9]/g,"")}function iD(e){return e}function oD(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=iD);var a=e.removeFormatting;a===void 0&&(a=nD);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,d=e.isAllowed,p=e.onChange;p===void 0&&(p=to);var w=e.onKeyDown;w===void 0&&(w=to);var x=e.onMouseUp;x===void 0&&(x=to);var y=e.onFocus;y===void 0&&(y=to);var A=e.onBlur;A===void 0&&(A=to);var O=e.value,R=e.getCaretBoundary;R===void 0&&(R=rD);var k=e.isValidInputCharacter;k===void 0&&(k=Fa);var F=e.isCharacterSame,$=f2(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=b2(O,c,!!u,s,a,l),q=H[0],Y=q.formattedValue,ne=q.numAsString,se=H[1],ae=te.useRef(),z=te.useRef({formattedValue:Y,numAsString:ne}),D=function(we,he){z.current={formattedValue:we.formattedValue,numAsString:we.value},se(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 w2(we,he,R(we),Ce)},v=function(we,he,Ce){var Ue=R(he),Ne=tD(he,Y,we,Ce,Ue,k,F);return Ne=w2(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,Ae;if(Ce){var Be=we.inputValue||Ce.value,ut=kh(Ce);Ce.value=he,Ae=v(Be,he,ut),Ae!==void 0&&C(Ce,Ae,he)}he!==Y&&D(I(he,Me),{event:Ne,source:Ue})};te.useEffect(function(){var we=z.current,he=we.formattedValue,Ce=we.numAsString;(Y!==he||ne!==Ce)&&D(I(Y,ne),{event:void 0,source:$a.props})},[Y,ne]);var ee=S.current?kh(S.current):void 0,ie=typeof window<"u"?te.useLayoutEffect:te.useEffect;ie(function(){var we=S.current;if(Y!==z.current.formattedValue&&we){var he=v(z.current.formattedValue,Y,ee);we.value=Y,C(we,he,Y)}},[Y]);var le=function(we,he,Ce){var Ue=he.target,Ne=ae.current?Zk(ae.current,Ue.selectionEnd):y2(Y,we),Me=Object.assign(Object.assign({},Ne),{lastValue:Y}),Ae=a(we,Me),Be=_(Ae);if(Ae=a(Be,void 0),d&&!d(I(Be,Ae))){var ut=he.target,lt=kh(ut),ze=v(we,Y,lt);return ut.value=Y,C(ut,ze,Y),!1}return N({formattedValue:Be,numAsString:Ae,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 Ae;Ce==="ArrowLeft"||Ce==="Backspace"?Ae=Math.max(Ue-1,0):Ce==="ArrowRight"?Ae=Math.min(Ue+1,Me.length):Ce==="Delete"&&(Ae=Ue);var Be=0;Ce==="Delete"&&Ue===Ne&&(Be=1);var ut=Ce==="ArrowLeft"||Ce==="ArrowRight";if(Ae===void 0||Ue!==Ne&&!ut){w(we),me(he,Be);return}var lt=Ae;if(ut){var ze=Ce==="ArrowLeft"?"left":"right";lt=g(Me,Ae,ze),lt!==Ae&&we.preventDefault()}else Ce==="Delete"&&!k(Me[Ae])?lt=g(Me,Ae,"right"):Ce==="Backspace"&&!k(Me[Ae])&&(lt=g(Me,Ae,"left"));lt!==Ae&&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 Ae=g(Me,Ue);Ae!==Ue&&C(he,Ae,Me)}};Ce(),requestAnimationFrame(function(){Ce()}),x(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 Ae=g(Me,Ue);Ae!==Ue&&!(Ue===0&&Ne===Me.length)&&C(he,Ae,Me),y(Object.assign(Object.assign({},we),{currentTarget:Ce}))},0)},ft=function(we){S.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),A(we)},dt=f&&Jk()?"numeric":void 0,je=Object.assign({inputMode:dt},$,{type:t,value:Y,onChange:xe,onKeyDown:be,onMouseUp:Ve,onFocus:Le,onBlur:ft});if(r==="text")return i?te.createElement(te.Fragment,null,i(Y,$)||null):te.createElement("span",Object.assign({},$,{ref:o}),Y);if(n){var pt=n;return te.createElement(pt,Object.assign({},je,{ref:o}))}return te.createElement("input",Object.assign({},je,{ref:o}))}function x2(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=el(t),u=c.thousandSeparator,l=c.decimalSeparator,d=r!==0&&e.indexOf(".")!==-1||r&&n,p=jh(e,s),w=p.beforeDecimal,x=p.afterDecimal,y=p.addNegation;return r!==void 0&&(x=p2(x,r,!!n)),u&&(w=Gk(w,u,a)),i&&(w=i+w),o&&(x=x+o),y&&(w="-"+w),e=w+(d&&l||"")+x,e}function el(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 sD(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 aD(e,t){return new RegExp("(^-)|[0-9]|"+h2(e),t?"g":void 0)}function cD(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function uD(e,t,r){var n;t===void 0&&(t=Qk(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=el(r),w=p.allowedDecimalSeparators,x=p.decimalSeparator,y=e[d]===x;if(Fa(e)&&(e===o||e===s)&&t.lastValue==="")return e;if(d-l===1&&w.indexOf(e[l])!==-1){var A=a===0?"":x;e=e.substring(0,l)+A+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),$=F.start,H=F.end,q=F.value,Y=e.substring(l,d);e.length&&q.length&&($>q.length-s.length||H<o.length)&&!(Y&&s.startsWith(Y))&&(e=q);var ne=0;e.startsWith(o)?ne+=o.length:l<o.length&&(ne=l),e=e.substring(ne),d-=ne;var se=e.length,ae=e.length-s.length;e.endsWith(s)?se=ae:(d>ae||d>e.length-s.length)&&(se=d),e=e.substring(0,se),e=sD(k?"-"+e:e,i),e=(e.match(aD(x,!0))||[]).join("");var z=e.indexOf(x);e=e.replace(new RegExp(h2(x),"g"),function(S,M){return M===z?".":""});var D=jh(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 lD(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 fD(e){var t=el(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(`
107
103
  Decimal separator can't be same as thousand separator.
108
104
  thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
109
105
  decimalSeparator: `+n+` (default value for decimalSeparator is .)
110
- `);return i.startsWith("-")&&s&&(console.error(`
106
+ `);return i.startsWith("-")&&o&&(console.error(`
111
107
  Prefix can't start with '-' when allowNegative is true.
112
108
  prefix: `+i+`
113
- allowNegative: `+s+`
114
- `),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function hX(e){e=dX(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=xs);var s=e.onBlur;s===void 0&&(s=xs);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var l=e.defaultValue,f=e.value,h=e.valueIsNumericString,y=e.onValueChange,b=T3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=ff(e),T=w.decimalSeparator,P=w.allowedDecimalSeparators,k=function(m){return B3(m,e)},R=function(m,x){return lX(m,x,e)},F=pa(f)?l:f,L=h??uX(F,u,t);pa(f)?pa(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var G=function(m){return O3(m)?m:(typeof m=="number"&&(m=k3(m)),L&&typeof a=="number"?N3(m,a,!!c):m)},q=$3(G(f),G(l),!!L,k,R,y),X=q[0],ie=X.numAsString,ae=X.formattedValue,ce=q[1],z=function(m){var x=m.target,A=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(A==="Backspace"||A==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}A==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&so(x,1),a&&c&&(A==="Backspace"&&C[E-1]===T?(so(x,E-1),m.preventDefault()):A==="Delete"&&C[E]===T&&m.preventDefault()),P!=null&&P.includes(A)&&C[E]===T&&so(x,E+1);var g=o===!0?",":o;A==="Backspace"&&C[E-1]===g&&so(x,E-1),A==="Delete"&&C[E]===g&&so(x,E+1),i(m)},D=function(m){var x=ie;if(x.match(/\d/g)||(x=""),n||(x=JK(x)),c&&a&&(x=N3(x,a,c)),x!==ie){var A=B3(x,e);ce({formattedValue:A,value:x,floatValue:parseFloat(x)},{event:m,source:jc.event})}s(m)},p=function(m){return m===T?!0:kc(m)},d=function(m){var x=m.currentValue,A=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=R3(A,x),ee=j.to,se=function(he){return R(he).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===T&&se(x)<O&&se(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===T?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:k,removeFormatting:R,getCaretBoundary:function(m){return fX(m,e)},onKeyDown:z,onBlur:D})}function pX(e){var t=hX(e);return te.createElement(oX,Object.assign({},t))}function mX(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...f}=e,h=y=>{var T;const b=((T=y==null?void 0:y.target)==null?void 0:T.value)||"";let w=b;if(b.startsWith("0")&&b!=="0"&&!b.startsWith("0.")&&(w=b.replace(/^0+/,"")),w){if(w.startsWith(".")){o(w.slice(1,w.length));return}let P=String(w).replace(/,/g,"");if(P.startsWith("-")){o("");return}l&&(P=P.replace(l,"")),a!==void 0&&Le(P).gt(a)?P=a.toString():c!==void 0&&Le(P).lt(c)&&(P=c.toString()),o(String(P))}else o("")};return _.jsx(pX,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:h,...f,style:{...s,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 gX(e){const{token:t,handleTokenSelectClick:r}=e;return _.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[_.jsx("div",{className:"token-img-box",children:_.jsx(Gr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),_.jsx("div",{className:"name",children:_.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function L3({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:f}){const[h,y]=te.useState(!1),{currentAccount:b}=Rn(),w=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),k=jr(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Le(k).eq(t)||i(k)},T=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||0),k=Ir((o==null?void 0:o.coin_type)||"").full_address===kf,R=.05;let F=P;k&&Le(P).gt(R)&&(F=F.sub(R)),!(t&&Le(F).eq(t))&&Le(F).gte(0)&&i(F.toString())};return _.jsxs("div",{className:h?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:f},children:[_.jsxs("div",{className:"title",children:[" ",e," "]}),_.jsxs("div",{className:"token-input",children:[a?_.jsxs("div",{style:{flex:1},children:[" ",_.jsx(oa,{style:{width:"200px",height:"28px",flex:1}})," "]}):_.jsx(mX,{inputAllowed:l,value:t,decimals:(o==null?void 0:o.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(gX,{token:o,handleTokenSelectClick:s})]}),_.jsxs("div",{className:"info-box",children:[!a&&r&&Le(r).gt(0)?_.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:Mx(r,2)}):_.jsx("div",{}),b&&o&&_.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[_.jsxs("div",{className:"token-balance",children:[_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-wallet"})}),_.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),_.jsxs("div",{className:"btn-box",children:[u&&_.jsx("button",{className:"cs-outline-btn",onClick:w,children:"HALF"}),c&&_.jsx("button",{className:"cs-outline-btn",onClick:T,children:"MAX"})]})]})]})]})}function vX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Rn(),{getOwnerCoinBalances:s}=zl(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b,isOpenTokensDialog:w,setIsOpenTokensDialog:T}=pn(),{handleAmountChange:P,handleSelectToken:k,fromBalanceInfo:R,toBalanceInfo:F,fromAmountValue:L,toAmountValue:G,doSwapAction:q,reCalculateRouteData:X,refreshMarketPrice:ie,scamsText:ae}=GV(),{slippage:ce}=Lr(),{isCustomMode:z,customWarnTokenList:D}=kV(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:p}=n8(ce,h),{formatSwapRouter:d}=PV(h),[m,x]=te.useState(!1),{btnText:A,btnDisabled:E}=HV(R==null?void 0:R.totalBalanceFormat),[O,C]=te.useState(!1),[g,v]=te.useState(!1);te.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{X(),n&&s(),ie()},ee=()=>({...h}),se=async()=>{a&&k(a,!0)};return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[_.jsx(L3,{loading:!f&&l,balance:R,amountValue:L,handleTokenSelectClick:()=>{C(!0),T(!0)},onInputChange:he=>{P(he,!0)},amount:c,token:o}),_.jsx("div",{onClick:se,className:"swap-icon",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:_.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),_.jsx(L3,{marginTop:"-20px",loading:f&&l,balance:F,showHalf:!1,showMax:!1,amountValue:G,handleTokenSelectClick:()=>{C(!1),T(!0)},onInputChange:he=>{P(he,!1)},inputAllowed:!1,amount:u,token:a})]}),ae&&_.jsx(XV,{scamsText:ae}),_.jsxs("div",{className:"swap-bottom-block",style:{border:E?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:E||l,onClick:()=>{n?z&&D.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(a8,{})}):A}),c&&u&&Le(c).gt(0)&&Le(u).gt(0)&&_.jsxs("div",{className:"content",children:[_.jsxs("div",{className:"price-related-info",children:[h&&!(h!=null&&h.errorCode)&&_.jsx(M0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(l8,{isLoading:l,routerData:h})]}),_.jsx(f8,{isLoading:l,amountLimit:p}),_.jsx(v3,{hasSubMenu:!0,formatSwapRouter:d,isLoading:l})]})]}),y&&_.jsx(fK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async he=>{try{await q(he,r==null?void 0:r.partner)}finally{b(!1)}}}),w&&_.jsx(VK,{currToken:O?o:a,backClick:()=>T(!1),onSelectToken:he=>{k(he,O),T(!1)}}),g&&D.length>0&&_.jsx(qK,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),b(!0)}})]})}function yX({initProps:e={},customWallet:t}){yV();const{ToastContainer:r}=aa(),{fetchRouterConfig:n}=hV(),{getTokens:i}=ws(),{fetchTokenPrices:s}=ql(),{transactionData:o,setTransactionData:a}=S0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=pn(),[y,b]=te.useState(0),w=te.useRef(y);vV(e),te.useEffect(()=>{i(),s([]),n()},[]),te.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),pV({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&T():w.current>=20&&T()}});const T=()=>{w.current=20,b(20),setTimeout(()=>{w.current=0,b(0)},20)};return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[_.jsx(uV,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(KU,{handleRefresh:T}),_.jsx(vX,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(lV,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function Z0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=zl(),n=Ur.useCurrentAccount(),{saveCurrentAccount:i}=Rn(),{mutate:s}=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)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),_.jsx(yX,{initProps:e,customWallet:t})}function bX({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(Z0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function wX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=te.useState(!1),o=()=>{s(!i)};return _.jsxs("div",{className:"widget-btn-box",children:[_.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})}):_.jsx("img",{src:$t("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(Z0,{initProps:r,customWallet:n})})]})}function _X({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(xl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(Z0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(wX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(bX,{initProps:e,customWallet:t})]})}const xX=_X;zt.CetusSwap=xX,Object.defineProperty(zt,Symbol.toStringTag,{value:"Module"})});
109
+ allowNegative: `+o+`
110
+ `),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}function dD(e){e=fD(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=to);var o=e.onBlur;o===void 0&&(o=to);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,x=f2(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),y=el(e),A=y.decimalSeparator,O=y.allowedDecimalSeparators,R=function(m){return x2(m,e)},k=function(m,S){return uD(m,S,e)},F=Ns(d)?l:d,$=p??cD(F,u,t);Ns(d)?Ns(l)||($=$||typeof l=="number"):$=$||typeof d=="number";var H=function(m){return d2(m)?m:(typeof m=="number"&&(m=g2(m)),$&&typeof a=="number"?v2(m,a,!!c):m)},q=b2(H(d),H(l),!!$,R,k,w),Y=q[0],ne=Y.numAsString,se=Y.formattedValue,ae=q[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]===A?(ko(S,_-1),m.preventDefault()):M==="Delete"&&C[_]===A&&m.preventDefault()),O!=null&&O.includes(M)&&C[_]===A&&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=ne;if(S.match(/\d/g)||(S=""),n||(S=Yk(S)),c&&a&&(S=v2(S,a,c)),S!==ne){var M=x2(S,e);ae({formattedValue:M,value:S,floatValue:parseFloat(S)},{event:m,source:$a.event})}o(m)},h=function(m){return m===A?!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=y2(M,S),ee=N.to,ie=function(le){return k(le).indexOf(".")+u.length};return d===0&&c&&a&&S[ee.start]===A&&ie(S)<I&&ie(_)>C?!1:I>=ee.start&&I<ee.end&&O&&O.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},x),{value:se,valueIsNumericString:!1,isValidInputCharacter:h,isCharacterSame:f,onValueChange:ae,format:R,removeFormatting:k,getCaretBoundary:function(m){return lD(m,e)},onKeyDown:z,onBlur:D})}function hD(e){var t=dD(e);return te.createElement(oD,Object.assign({},t))}function pD(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 A;const x=((A=w==null?void 0:w.target)==null?void 0:A.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&&De(O).gt(a)?O=a.toString():c!==void 0&&De(O).lt(c)&&(O=c.toString()),s(String(O))}else s("")};return b.jsx(hD,{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 mD(e){const{token:t,handleTokenSelectClick:r}=e;return b.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[b.jsx("div",{className:"token-img-box",children:b.jsx(Hr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),b.jsx("div",{className:"name",children:b.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function S2({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:x}=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)},A=()=>{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 b.jsxs("div",{className:p?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:d},children:[b.jsxs("div",{className:"title",children:[" ",e," "]}),b.jsxs("div",{className:"token-input",children:[a?b.jsxs("div",{style:{flex:1},children:[" ",b.jsx(Cs,{style:{width:"200px",height:"28px",flex:1}})," "]}):b.jsx(pD,{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)}),b.jsx(mD,{token:s,handleTokenSelectClick:o})]}),b.jsxs("div",{className:"info-box",children:[!a&&r&&De(r).gt(0)?b.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:l1(r,2)}):b.jsx("div",{}),x&&s&&b.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[b.jsxs("div",{className:"token-balance",children:[b.jsx("svg",{className:"icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-wallet"})}),b.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),b.jsxs("div",{className:"btn-box",children:[u&&b.jsx("button",{className:"cs-outline-btn",onClick:y,children:"HALF"}),c&&b.jsx("button",{className:"cs-outline-btn",onClick:A,children:"MAX"})]})]})]})]})}function gD({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Pn(),{getOwnerCoinBalances:o}=Nu(),{fromCoin:s,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:d,routerData:p,isOpenSecondary:w,setIsOpenSecondary:x,isOpenTokensDialog:y,setIsOpenTokensDialog:A}=fn(),{handleAmountChange:O,handleSelectToken:R,fromBalanceInfo:k,toBalanceInfo:F,fromAmountValue:$,toAmountValue:H,doSwapAction:q,reCalculateRouteData:Y,refreshMarketPrice:ne,scamsText:se}=HI(),{slippage:ae}=$r(),{isCustomMode:z,customWarnTokenList:D}=RI(s==null?void 0:s.coin_type,a==null?void 0:a.coin_type),{amountLimit:h}=Fw(ae,p),{formatSwapRouter:f}=OI(p),[m,S]=te.useState(!1),{btnText:M,btnDisabled:_}=WI(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=()=>{Y(),n&&o(),ne()},ee=()=>({...p}),ie=async()=>{a&&R(a,!0)};return b.jsxs("div",{className:"swap-trade-box",children:[b.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[b.jsx(S2,{loading:!d&&l,balance:k,amountValue:$,handleTokenSelectClick:()=>{C(!0),A(!0)},onInputChange:le=>{O(le,!0)},amount:c,token:s}),b.jsx("div",{onClick:ie,className:"swap-icon",onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{cursor:"pointer"},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:b.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),b.jsx(S2,{marginTop:"-20px",loading:d&&l,balance:F,showHalf:!1,showMax:!1,amountValue:H,handleTokenSelectClick:()=>{C(!1),A(!0)},onInputChange:le=>{O(le,!1)},inputAllowed:!1,amount:u,token:a})]}),se&&b.jsx(KI,{scamsText:se}),b.jsxs("div",{className:"swap-bottom-block",style:{border:_?"0px solid #2a3238":"1px solid #2a3238"},children:[b.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:_||l,onClick:()=>{n?z&&D.length>0?v(!0):x(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?b.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:b.jsx(qw,{})}):M}),c&&u&&De(c).gt(0)&&De(u).gt(0)&&b.jsxs("div",{className:"content",children:[b.jsxs("div",{className:"price-related-info",children:[p&&!(p!=null&&p.errorCode)&&b.jsx(fh,{baseToken:s,quoteToken:a,baseAmount:p.fromAmountUi||"",quoteAmount:p.toAmountUi||"",loading:l}),b.jsx(Gw,{isLoading:l,routerData:p})]}),b.jsx(Kw,{isLoading:l,amountLimit:h}),b.jsx(e2,{hasSubMenu:!0,formatSwapRouter:f,isLoading:l})]})]}),w&&b.jsx(lk,{data:ee(),toBack:()=>x(!1),onSubmitClick:async le=>{try{await q(le,r==null?void 0:r.partner)}finally{x(!1)}}}),y&&b.jsx(Uk,{currToken:I?s:a,backClick:()=>A(!1),onSelectToken:le=>{R(le,I),A(!1)}}),g&&D.length>0&&b.jsx(zk,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),x(!0)}})]})}function vD({initProps:e={},customWallet:t}){vI();const{ToastContainer:r}=Ms(),{fetchRouterConfig:n}=dI(),{getTokens:i}=Qi(),{fetchTokenPrices:o}=ju(),{transactionData:s,setTransactionData:a}=ah(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:d,fromAmount:p}=fn(),[w,x]=te.useState(0),y=te.useRef(w);gI(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]),hI({interval:1e3,callback:()=>{y.current=y.current+1,c?y.current>=5&&A():y.current>=20&&A()}});const A=()=>{y.current=20,x(20),setTimeout(()=>{y.current=0,x(0)},20)};return b.jsx(b.Fragment,{children:b.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[b.jsx(cI,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),b.jsx(G9,{handleRefresh:A}),b.jsx(gD,{refreshCount:w,customWallet:t,initProps:e}),s&&b.jsx(uI,{transactionData:s,onClose:()=>{a(void 0)}}),b.jsx(r,{})]})})}function Dh({initProps:e={},customWallet:t}){var s;const{getOwnerCoinBalances:r}=Nu(),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]),b.jsx(vD,{initProps:e,customWallet:t})}function yD({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return b.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&b.jsx("div",{className:"swap-modal-box",children:b.jsx(Dh,{initProps:e,customWallet:t})}),b.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function wD({size:e,direction:t,initProps:r,customWallet:n}){const[i,o]=te.useState(!1),s=()=>{o(!i)};return b.jsxs("div",{className:"widget-btn-box",children:[b.jsx("div",{className:`img-btn ${e} ${t}`,onClick:s,children:i?b.jsx("svg",{className:"icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-unfold"})}):b.jsx("img",{src:$t("/images/img-logo@2x.png")})}),i&&b.jsx("div",{className:`widget-modal ${t} ${e}`,children:b.jsx(Dh,{initProps:r,customWallet:n})})]})}function bD({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return b.jsxs(du,{appearance:"dark",children:[r==="Integrated"&&b.jsx(Dh,{initProps:e,customWallet:t}),r==="Widget"&&b.jsx(wD,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&b.jsx(yD,{initProps:e,customWallet:t})]})}const xD=bD;Ht.CetusSwap=xD,Object.defineProperty(Ht,Symbol.toStringTag,{value:"Module"})});